/*	@(#)imc_msghdr.h	13.1 (RC International) 91/02/02	*/

#ifndef _IMC_MSGHDR_
#define _IMC_MSGHDR_

#include <sys/types.h>

/*
 * Common header structure used in communication
 * between the UPU and the IMC server on the RPU.
 */
struct imc_msghdr
{
    union
    {
	int		u_req;		/* identifies the request */
	int		u_resp;		/* identifies the response */
	int		u_event;	/* identifies the event */
    } imch_u;
    int			imch_error;	/* significant in responses/events */
    caddr_t		imch_rpu_ref;	/* id of the port/connection on RPU */
    UID_T		imch_upu_uid;	/* uid of the IMC server q on the UPU */
    UID_T		imch_upu_ref;	/* id of the control block on UPU */
    UID_T		imch_con_ref;	/* reserved uid for connection ref */
};

#define imch_req	imch_u.u_req
#define imch_resp	imch_u.u_resp
#define imch_event	imch_u.u_event

/*
 * IMC requests/responses exchanged between the IMC protocol software
 * on the UPU (imc_usrreq()) and the IMC server on the RPU.
 *
 * Requests are in the direction UPU -> RPU. Possible responses
 * are, of course, in the opposite direction. If no response
 * should be given, this is specified in the comment.
 */
#define IMC_OPENPORT		0	/* open a port with specified name */
#define IMC_CLOSEPORT		1	/* no response */
#define IMC_GETCONNECTION_ASYNC	2	/* allow incoming conn., no response */
#define IMC_CONNECT_SYNC	3	/* connect to a specified port */
#define IMC_DISCONNECT		4	/* no response */
#define IMC_SEND_SYNC		5	/* send data on a connection */
#define IMC_SEND_ASYNC		6	/* send data async., no response */
#define IMC_SENDNOWAIT		7	/* send data but do not block */
#define IMC_RECEIVE_ASYNC	8	/* allow recv on a conn., no response */

/*
 * IMC events sent from the IMC server on the RPU
 * to the IMC server on the UPU.
 */
#define IMC_PORT_CLOSED		0
#define IMC_CONNECTED		1	/* indicates an incoming connection */
#define IMC_DISCONNECTED	2
#define IMC_DATA_SENT		3
#define IMC_DATA_ARRIVED	4	/* carries incoming data */
#define IMC_DATA_OVERRUN	5	/* incoming data lost */

#endif _IMC_MSGHDR_
