/* File:  courmux.h - Last Edit:  */
/* arvani		Thu Feb  8 09:58:57 1990 */
/* Copyright (C) by Xerox Corporation, 1990.  All rights reserved. */

/* helge	Tue Nov 21 18:10:50 1989
 * 
 * Copyright (c) 1989 by Xerox Corporation. All rights reserved. */

/** Copyright (c) 1988  Mentat Inc.
 ** last change 2/22/89 HS
 **/
#ifndef	←COURMUX←
#define	←COURMUX←

#ifndef	BE16←TO←U16
#define	BE16←TO←U16(dp)	(((u16)(dp)[0] << 8) | ((u16)(dp)[1]))
#define	U16←TO←BE16(u1,dp) ((dp[0] = U8((u1) >> 8)),(dp[1] = U8((u1))))
#endif

#ifndef	BE16←TO←I16
#define	BE16←TO←I16(dp)	(((i16)(dp)[0] << 8) | ((i16)(dp)[1]))
#define	I16←TO←BE16(i1,dp) ((dp[0] = U8((i1) >> 8)),(dp[1] = U8((i1))))
#endif

#ifndef	BE32←TO←U32
#define	BE32←TO←U32(dp)	((((u32)(dp)[0] & 0xFF) << (u32)24) | (((u32)(dp)[1] & 0xFF) << (u32)16) | (((u32)(dp)[2] & 0xFF) << (u32)8)  | ((u32)(dp)[3] & 0xFF))
#define	U32←TO←BE32(u1,dp) ((dp[0] = U8((u1) >> 24)),(dp[1] = U8((u1) >> 16)),(dp[2] = U8((u1) >> 8)),(dp[3] = U8((u1))))
#endif

/* CMUX I←STR ioctl cmds */
#define	CMUX←BASE		('C' << 8)
#define	CMUX←ADDR←COMPLETE	(CMUX←BASE + 1)		/* helper -> cmux */
#define	CMUX←ADDR←REQ		(CMUX←BASE + 2)		/* client -> cmux */
#define	CMUX←CALL←REQ		(CMUX←BASE + 3)		/* cmux -> helper */
#define	CMUX←CALL←REJECT	(CMUX←BASE + 4)		/* helper -> cmux */
#define	CMUX←CLIENT←REQ←IOCTL	(CMUX←BASE + 5)		/* client -> helper */
#define	CMUX←HELPER←ADD		(CMUX←BASE + 6)		/* helper -> cmux */
#define CMUX←HELPER←REPLY←IOCTL	(CMUX←BASE + 7)		/* helper -> client */
#define	CMUX←PASSTHRU←BEGIN	(CMUX←BASE + 8)		/* client -> cmux */
#define	CMUX←PASSTHRU←END	(CMUX←BASE + 9)		/* client -> cmux */
#define	CMUX←SERVER←ADD		(CMUX←BASE + 10)	/* server -> cmux */
#define	CMUX←TRANSPORT←REQ	(CMUX←BASE + 11)	/* cmux -> helper */
/* Available			(CMUX←BASE + 12) */
#define	CMUX←UNBLOCK←STREAM	(CMUX←BASE + 13)	/* helper -> cmux */
#define	CMUX←UNLINK←REQ		(CMUX←BASE + 14)	/* cmux -> helper */
#define	CMUX←HELPER←DBG		(CMUX←BASE + 15) /* client -> cmux -> helper */
#define	CMUX←SERVER←QUIT	(CMUX←BASE + 16)	/* server -> cmux */
#define	CMUX←PASSTHRU←BEGIN←DEFERRED (CMUX←BASE + 17)
#define	CMUX←NO←MORE←TRANSPORTS	(CMUX←BASE + 18)	/* helper -> cmux */
/* Available			(CMUX←BASE + 19) */
#define	CMUX←SERVER←COUNTDOWN	(CMUX←BASE + 20)	/* server -> cmux */
#define	CMUX←SERVER←RESET←UID	(CMUX←BASE + 21)	/* server -> cmux */
#define CMUX←REMOTE←ADDR←REQ	(CMUX←BASE + 22)	/* client -> cmux */
#define CMUX←REMOTE←ADDR←RESPONSE (CMUX←BASE + 23)	/* helper -> cmux */

#define	CMUX←GET←VALUE		1
#define	CMUX←SET←VALUE		2
#define	CMUX←DEL←VALUE		3
#define	CMUX←CH←ADD		4
#define	CMUX←TR←ADD		5
#define	CMUX←RETRIEVE←ITEM	6 /* Retrieve an item from a clearinghouse */

#define	CMUX←DEF←ADDR←TYPE	1

#ifndef	COURIER←MUX←NAME←DEF
#define	COURIER←MUX←NAME←DEF	"/dev/courmux"
#endif

#endif

/* 2/22/89: HS Corrected spelling of DEFERRED */
/* Tue Nov 21 18:10:13 1989 HS: added CMUX←REMOTE←ADDR←REQ and
 *                              CMUX←REMOTE←ADDR←RESPONSE.
 */