1: /* $Header: courier.h,v 2.0 85/11/21 07:22:05 jqj Exp $ */
   2: /*
   3:  $Log:	courier.h,v $
   4:  * Revision 2.0  85/11/21  07:22:05  jqj
   5:  * 4.3BSD standard release
   6:  *
   7:  * Revision 1.3  85/10/23  16:43:30  root
   8:  * Probably correct versions of basic conversion operators for the Gould.
   9:  *
  10:  * Revision 1.2  85/10/21  12:49:15  root
  11:  * Gould version:  definitions for MoveLong, etc. (the MoveLong routine is in misc.c)
  12:  *
  13:  * Revision 1.2  85/10/17  16:46:55  jqj
  14:  * first Gould version: definitions for MoveLong etc.
  15:  *
  16:  * Revision 1.5  85/05/23  06:18:06  jqj
  17:  * Public Beta-test version, released 24 May 1985
  18:  *
  19:  * Revision 1.3  85/03/11  16:36:54  jqj
  20:  * Public alpha-test version, released 11 March 1985
  21:  *
  22:  * Revision 1.2  85/01/27  07:37:18  jqj
  23:  * finished but undebugged version
  24:  *
  25:  */
  26: 
  27: #ifndef COURIERVERSION
  28: /*
  29:  * the version of Courier we support
  30:  */
  31: #define COURIERVERSION 3
  32: 
  33: /*
  34:  * Predefined Courier types.
  35:  */
  36: typedef char        Boolean;
  37: typedef unsigned short  Cardinal;
  38: typedef unsigned long   LongCardinal;
  39: typedef short       Integer;
  40: typedef long        LongInteger;
  41: typedef char        *String;
  42: typedef unsigned short  Unspecified;
  43: typedef unsigned long   LongUnspecified;
  44: typedef int     NilRecord;
  45: 
  46: 
  47: /*
  48:  * Low-level byte moving, with byte-swapping.
  49:  * Use these definitions for VAX and other low-enders.
  50:  */
  51: #if vax
  52: #define externalize_Boolean(p, buf) (*(short*)(buf) = *((char*)(p))<<8, 1)
  53: #define internalize_Boolean(p, buf) (*(char*)(p) = *((char*)(buf)+1), 1)
  54: #define MoveShort(a, b) (*(char*)(b) = *((char*)(a)+1),\
  55:              *((char*)(b)+1) = *(char*)(a),1)
  56: #define MoveLong(a, b)  (*(char*)(b) = *((char*)(a)+3),\
  57:              *((char*)(b)+1) = *((char*)(a)+2),\
  58:              *((char*)(b)+2) = *((char*)(a)+1),\
  59:              *((char*)(b)+3) = *(char*)(a), 2)
  60: #endif
  61: 
  62: /*
  63:  * Low-level byte moving, without byte-swapping.
  64:  * Use these definitions for SUN and other high-enders.
  65:  */
  66: #if sun
  67: #define externalize_Boolean(p, buf)  (*(Unspecified*)(buf) = 1&*(char*)(p), 1)
  68: #define internalize_Boolean(p, buf)  (*(char*)(p) = 1&*(Unspecified*)(buf), 1)
  69: #define MoveShort(a, b) (*(short *)(b) = *(short *)(a),1)
  70: #define MoveLong(a, b)  (*(long *)(b) = *(long *)(a),2)
  71: #endif
  72: 
  73: /*
  74:  * Low-level byte moving, without byte-swapping.
  75:  * Use these definitions for sel and other high-enders that require
  76:  * longword alignment.
  77:  */
  78: #if sel
  79: #define externalize_Boolean(p, buf)  (*(Unspecified*)(buf) = 1&*(char*)(p), 1)
  80: #define internalize_Boolean(p, buf)  (*(p) = 1&*(Unspecified*)(buf), 1)
  81: #define MoveShort(a, b) (*(short *)(b) = *(short *)(a),1)
  82: int MoveLong();
  83: #endif
  84: 
  85: /*
  86:  * sizeof_Foo(p) is a function that returns the externalized size of
  87:  * the variable specified as argument (assumed to be of type Foo).
  88:  * clear_Foo(p) is a function that deallocates any components of Foo.
  89:  * externalize_Foo translates a variable from C form to external
  90:  * serialized form.
  91:  * internalize_Foo translates a variable from external serializedform
  92:  * to internal C form
  93:  */
  94: #define sizeof_NilRecord(p)     0
  95: #define clear_NilRecord(p)
  96: #define externalize_NilRecord(p, buf)       0
  97: #define internalize_NilRecord(p, buf)       0
  98: 
  99: #define sizeof_Boolean(p)       1
 100: #define clear_Boolean(p)
 101: 
 102: #define sizeof_Cardinal(p)      1
 103: #define clear_Cardinal(p)
 104: #define externalize_Cardinal(p, buf)        MoveShort(p, buf)
 105: #define internalize_Cardinal(p, buf)        MoveShort(buf, p)
 106: 
 107: #define sizeof_LongCardinal(p)      2
 108: #define clear_LongCardinal(p)
 109: #define externalize_LongCardinal(p, buf)    MoveLong(p, buf)
 110: #define internalize_LongCardinal(p, buf)    MoveLong(buf, p)
 111: 
 112: #define sizeof_Integer(p)       1
 113: #define clear_Integer(p)
 114: #define externalize_Integer(p, buf)     MoveShort(p, buf)
 115: #define internalize_Integer(p, buf)     MoveShort(buf, p)
 116: 
 117: #define sizeof_LongInteger(p)       2
 118: #define clear_LongInteger(p)
 119: #define externalize_LongInteger(p, buf)     MoveLong(p, buf)
 120: #define internalize_LongInteger(p, buf)     MoveLong(buf, p)
 121: 
 122: #define sizeof_Unspecified(p)       1
 123: #define clear_Unspecified(p)
 124: #define externalize_Unspecified(p, buf)     MoveShort(p, buf)
 125: #define internalize_Unspecified(p, buf)     MoveShort(buf, p)
 126: 
 127: #define sizeof_LongUnspecified(p)   2
 128: #define clear_LongUnspecified(p)
 129: #define externalize_LongUnspecified(p, buf) MoveLong(p, buf)
 130: #define internalize_LongUnspecified(p, buf) MoveLong(buf, p)
 131: 
 132: 
 133: /*
 134:  * SPP stream types used by Courier
 135:  */
 136: #define SPPSST_RPC 0
 137: #define SPPSST_BDT 1
 138: #define SPPSST_END 254
 139: #define SPPSST_ENDREPLY 255
 140: 
 141: /*
 142:  * the following should be in xn.h or spp.h
 143:  */
 144: #define IDPPORT_COURIER 5
 145: #ifndef MAXWORDS
 146: #define MAXWORDS 267
 147: #endif
 148: #ifndef SPPMAXDATA
 149: #define SPPMAXDATA (MAXWORDS*2)
 150: #endif
 151: 
 152: /*
 153:  * For streams
 154:  */
 155: typedef enum {
 156:     nextSegment = 0,
 157:     lastSegment = 1
 158: } StreamEnumerator;
 159: #define sizeof_StreamEnumerator sizeof_enumeration
 160: #define clear_StreamEnumerator clear_enumeration
 161: #define externalize_StreamEnumerator externalize_enumeration
 162: #define internalize_StreamEnumerator internalize_enumeration
 163: 
 164: 
 165: /*
 166:  * miscellaneous structures and values used by Courier
 167:  * runtimes
 168:  */
 169: 
 170: /*
 171:  * message types for Courier messages (should be mixed case?)
 172:  * (should only be of interest to the runtimes)
 173:  */
 174: #define CALL 0
 175: #define REJECT 1
 176: #define RETURN 2
 177: #define ABORT 3
 178: 
 179: /*
 180:  * components of Courier error messages
 181:  */
 182: 
 183: typedef struct {
 184:     Cardinal lowest;
 185:     Cardinal highest;
 186: } ImplementedVersionNumbers;
 187: 
 188: typedef struct {
 189:     enum {
 190:         unspecifiedError = 65535,
 191:         invalidArgument = 3,
 192:         noSuchProcedureValue = 2,
 193:         noSuchVersionNumber = 1,
 194:         noSuchProgramNumber = 0
 195:     } designator;
 196:     union {
 197:         NilRecord u_noSuchProgramNumber;
 198: #define noSuchProgramNumber_case u.u_noSuchProgramNumber
 199:         ImplementedVersionNumbers u_noSuchVersionNumber;
 200: #define noSuchVersionNumber_case u.u_noSuchVersionNumber
 201:         NilRecord u_noSuchProcedureValue;
 202: #define noSuchProcedureValue_case u.u_noSuchProcedureValue
 203:         NilRecord u_invalidArgument;
 204: #define invalidArgument_case u.u_invalidArgument
 205:         NilRecord u_unspecifiedError;
 206: #define unspecifiedError_case u.u_unspecifiedError
 207:     } u;
 208: } rejectionDetails;
 209: 
 210: /*
 211:  * Macro for unpacking error arguments given a typedef and a field name
 212:  */
 213: #define CourierErrArgs(type,field) \
 214:     (((type *)Exception.Message)->field)
 215: 
 216: /*
 217:  * miscellaneous constants
 218:  */
 219: 
 220: #ifndef TRUE
 221: #define TRUE (1)
 222: #endif
 223: 
 224: #ifndef FALSE
 225: #define FALSE (0)
 226: #endif
 227: 
 228: #ifndef NULL
 229: #define NULL ((char*) 0)
 230: #endif
 231: 
 232: 
 233: /*
 234:  * exceptions defined in Courier
 235:  */
 236: 
 237: #define REJECT_ERROR 65535
 238: #define PROTOCOL_VIOLATION 65534
 239: 
 240: /* plus all user-defined ERROR values, offset by ERROR_OFFSET */
 241: #define ERROR_OFFSET 65536
 242: 
 243: /*
 244:  * External declarations.
 245:  */
 246: 
 247: extern Unspecified *Allocate();
 248: extern Unspecified *ReceiveCallMessage(), *ReceiveReturnMessage();
 249: extern Unspecified *ReadMessage();
 250: extern int BDTwrite(),BDTclosewrite(),BDTread();
 251: extern int sppclose(),sppclosereply();
 252: 
 253: #endif COURIERVERSION

Defined typedef's

Boolean defined in line 36; used 1 times
Integer defined in line 39; never used
LongInteger defined in line 40; used 1 times
LongUnspecified defined in line 43; never used
NilRecord defined in line 44; used 4 times
String defined in line 41; used 12 times

Defined macros

ABORT defined in line 177; used 1 times
CALL defined in line 174; used 1 times
COURIERVERSION defined in line 31; used 5 times
CourierErrArgs defined in line 213; never used
ERROR_OFFSET defined in line 241; used 1 times
IDPPORT_COURIER defined in line 144; used 1 times
MoveLong defined in line 70; used 7 times
MoveShort defined in line 81; used 6 times
PROTOCOL_VIOLATION defined in line 238; never used
REJECT defined in line 175; used 1 times
REJECT_ERROR defined in line 237; used 1 times
RETURN defined in line 176; used 1 times
SPPSST_BDT defined in line 137; used 5 times
SPPSST_ENDREPLY defined in line 139; used 4 times
clear_Boolean defined in line 100; never used
clear_Cardinal defined in line 103; never used
clear_Integer defined in line 113; never used
clear_LongCardinal defined in line 108; never used
clear_LongInteger defined in line 118; never used
clear_LongUnspecified defined in line 128; never used
clear_NilRecord defined in line 95; never used
clear_StreamEnumerator defined in line 160; never used
clear_Unspecified defined in line 123; never used
externalize_Boolean defined in line 79; never used
externalize_Integer defined in line 114; never used
externalize_LongCardinal defined in line 109; used 1 times
externalize_LongInteger defined in line 119; never used
externalize_LongUnspecified defined in line 129; never used
externalize_NilRecord defined in line 96; never used
externalize_StreamEnumerator defined in line 161; never used
internalize_Boolean defined in line 80; never used
internalize_Integer defined in line 115; never used
internalize_LongInteger defined in line 120; never used
internalize_LongUnspecified defined in line 130; never used
internalize_NilRecord defined in line 97; never used
internalize_StreamEnumerator defined in line 162; never used
invalidArgument_case defined in line 204; never used
noSuchProcedureValue_case defined in line 202; never used
noSuchProgramNumber_case defined in line 198; never used
noSuchVersionNumber_case defined in line 200; used 2 times
sizeof_Boolean defined in line 99; never used
sizeof_Cardinal defined in line 102; used 1 times
sizeof_Integer defined in line 112; never used
sizeof_LongCardinal defined in line 107; never used
sizeof_LongInteger defined in line 117; never used
sizeof_LongUnspecified defined in line 127; never used
sizeof_NilRecord defined in line 94; never used
sizeof_StreamEnumerator defined in line 159; never used
sizeof_Unspecified defined in line 122; never used
unspecifiedError_case defined in line 206; never used

Usage of this include

Last modified: 1986-03-13
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1500
Valid CSS Valid XHTML 1.0 Strict