/* $Id: action_transfer.h,v 1.1 1999/05/05 18:33:37 v2kea318 Exp $

$Log: action_transfer.h,v $
 * Revision 1.1  1999/05/05  18:33:37  v2kea318
 * Initial revision
 *
***************************************************************************

Some useful functions for sending and receiving action codes.

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

#ifndef ACTION_TRANSFER_H
#define ACTION_TRANSFER_H

#include "action_evaluation.h"
#include "Socket.h"
#include "pointer.h"
#include "msg_codes.h"

// send an action code, and optionally evaluate the response.
inline void send_action(const Socket& s, msg_action_code c, bool e = true)
{
  write(s, c);
  if (e) eval_response(s);
}
inline void send_action(const Pointer<Socket>& s, msg_action_code c,
			bool e = true)
{
  send_action(*s, c, e);
}

// get an action code.
inline msg_action_code get_action(const Socket& sock)
{
  msg_action_code code;
  read(sock, code);
  return code;
}
inline msg_action_code get_action(const Pointer<Socket>& s)
{
  return get_action(*s);
}

#endif
