/* $Id: msg_codes.h,v 1.4 1999/08/10 21:09:52 v2kea318 Exp $

$Log: msg_codes.h,v $
 * Revision 1.4  1999/08/10  21:09:52  v2kea318
 * Added the TEST message type.
 *
 * Revision 1.3  1999/05/05  14:05:47  v2kea318
 * Removed the DIE code.
 *
 * Revision 1.2  1999/05/04  20:45:56  v2kea318
 * Added the ROUTE, COPY, and DIE codes.
 *
 * Revision 1.1  1999/05/03  20:14:34  v2kea318
 * Initial revision
 *
***************************************************************************

Define the action and return codes for the msg server.

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

#ifndef MSG_ACTION_CODES_H
#define MSG_ACTION_CODES_H

// define the storage size for an action code (1 byte)
typedef char msg_action_code;

/* define the action codes.  These are instructions to the server to
   do something. */
enum msg_actions {
  REGISTER_USER,          // register a user.
  ROUTE_MESSAGE,          // send a message to a registered user.  
  QUERY_REG_LIST,         // query the registration list.
  CLOSE_SESSION           // terminate a session.
};

/* Define return codes from the server.  All return codes have the upper
   nibble with all bits on.  Success is 0xF0.  Any error will have the
   form 0xF? where ? is the error code.  Return codes are stored with the
   same size as the action codes, i.e. 1 byte. */
enum server_return_codes {
  success             = 0xF0,
  general_failure     = 0xFF,    // undefined/generic error.
  bad_user_id         = 0xF1,    // the supplied user id is not registered.
  unrecognized_action = 0xF2,    // requested action is not recognized.
  insufficient_data   = 0xF3,    // not enough data was read on the server
  error_transfer_data = 0xF4     // error transferring data
};

/* Define message types.  When a message is being routed , the message will
   be send with type ROUTE to the recipient and type COPY to the sender. */
enum message_types {
  ROUTE   = 0xAA,
  COPY    = 0x55,
  TEST    = 0x00  // test type, simply to test connectivity.
};

#endif
