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