/* $Id: handle_message.h,v 1.6 1999/10/05 15:13:28 v2kea318 Exp $

$Log: handle_message.h,v $
 * Revision 1.6  1999/10/05  15:13:28  v2kea318
 * Pass a reference to an AutoReply descriptor object in the parameters.
 *
 * Revision 1.5  1999/09/30  20:34:27  v2kea318
 * Added fields to the HandleMessageParms structure to control the
 * autoreply system.
 *
 * Revision 1.4  1999/08/06  18:57:51  v2kea318
 * Changed the HandleMessageParms struct to pass the socket.
 *
 * Revision 1.3  1999/07/30  17:55:48  v2kea318
 * Reformat the header file names for Standard C++ compliance.
 *
 * Revision 1.2  1999/07/06  17:02:44  v2kea318
 * Added an initialization routine for the message handler system.
 *
 * Revision 1.1  1999/05/17  20:48:17  v2kea318
 * Initial revision
 *
***************************************************************************

Handle a message received by the daemon.

***************************************************************************/

#ifndef MSG_HANDLE_MESSAGE_H
#define MSG_HANDLE_MESSAGE_H

#include "msg_codes.h"
#include <string>
#include "Socket.h"
#include "autoreply.h"

// define a parameters structure.
struct HandleMessageParms {
  Pointer<Socket> socket;   // the socket to the user.  
  msg_action_code tp;       // the message type
  const AutoReply& areply;  // the autoreply object
  HandleMessageParms(Pointer<Socket>& s, const msg_action_code cd,
		     const AutoReply& ar)
    : socket(s), tp(cd), areply(ar) {}
};

/* Define the handler routine.  The routine is intended as an initial
   routine for a thread.  The parameters will be passed via a pointer
   to a HandleMessageParms structure.  The routine will free this
   memory, so it must be dynamically allocated. */
void* handle_message(void* parms);

/* Initialize the message handler system.  This needs to be called before
   the daemon starts accepting messages. */
void handle_message_initialize();

#endif
