|
|
1.1 root 1: /* psap2.h - include file for presentation users (PS-USER) continued */
2:
3: /*
4: * $Header: /f/osi/h/RCS/psap2.h,v 7.0 89/11/23 21:55:53 mrose Rel $
5: *
6: *
7: * $Log: psap2.h,v $
8: * Revision 7.0 89/11/23 21:55:53 mrose
9: * Release 6.0
10: *
11: */
12:
13: /*
14: * NOTICE
15: *
16: * Acquisition, use, and distribution of this module and related
17: * materials are subject to the restrictions of a license agreement.
18: * Consult the Preface in the User's Manual for the full terms of
19: * this agreement.
20: *
21: */
22:
23:
24: #ifndef _PSAP2_
25: #define _PSAP2_
26:
27: #ifndef _PSAP_
28: #include "psap.h" /* definitions for PS-USERs */
29: #endif
30: #ifndef _SSAP_
31: #include "ssap.h" /* definitions for SS-USERs */
32: #endif
33: #ifndef _ISOADDRS_
34: #include "isoaddrs.h" /* definitions of ISO addresses */
35: #endif
36:
37: /* */
38:
39: #define NPDATA 25 /* arbitrary */
40:
41:
42: struct PSAPcontext { /* presentation context */
43: int pc_id; /* identifier */
44:
45: OID pc_asn; /* abstract syntax name */
46:
47: OID pc_atn; /* abstract transfer name */
48: /* NULLOID if provider should handle it */
49:
50: int pc_result; /* same codes as pc_result below */
51: };
52:
53: struct PSAPctxlist { /* list of presentation contexts */
54: int pc_nctx; /* number of contexts */
55:
56: #define NPCTX 10 /* arbitrary */
57: struct PSAPcontext pc_ctx[NPCTX];
58: };
59: #define NULLPC ((struct PSAPctxlist *) 0)
60:
61:
62: #define BER "basic encoding of a single asn.1 type"
63:
64:
65: struct SSAPref *addr2ref (); /* address to session reference */
66:
67: char *sprintref (); /* return session reference in string form */
68:
69: /* */
70:
71: struct PSAPstart { /* P-CONNECT.INDICATION */
72: int ps_sd; /* PRESENTATION descriptor */
73:
74:
75: struct PSAPaddr ps_calling; /* address of peer calling */
76: struct PSAPaddr ps_called; /* address of peer called */
77:
78: struct PSAPctxlist ps_ctxlist;/* list of proposed contexts */
79:
80: OID ps_defctx; /* name of proposed default context */
81: int ps_defctxresult; /* what the provider thinks about it */
82:
83: int ps_prequirements; /* presentation requirements */
84:
85: int ps_srequirements; /* session requirements */
86: int ps_settings; /* initial settings of tokens */
87: long ps_isn; /* initial serial number */
88:
89: struct SSAPref ps_connect; /* session connection identifier */
90:
91: int ps_ssdusize; /* largest atomic SSDU */
92:
93: struct QOStype ps_qos; /* quality of service */
94:
95: /* initial data from peer */
96: int ps_ninfo; /* number of elements */
97: PE ps_info[NPDATA]; /* data */
98: };
99: #define PSFREE(ps) \
100: { \
101: register int PSI; \
102: \
103: for (PSI = (ps) -> ps_ctxlist.pc_nctx - 1; PSI >= 0; PSI--) { \
104: oid_free ((ps) -> ps_ctxlist.pc_ctx[PSI].pc_asn); \
105: oid_free ((ps) -> ps_ctxlist.pc_ctx[PSI].pc_atn); \
106: (ps) -> ps_ctxlist.pc_ctx[PSI].pc_asn = \
107: (ps) -> ps_ctxlist.pc_ctx[PSI].pc_atn = NULLOID; \
108: } \
109: (ps) -> ps_ctxlist.pc_nctx = 0; \
110: if ((ps) -> ps_defctx) \
111: oid_free ((ps) -> ps_defctx), (ps) -> ps_defctx = NULLOID; \
112: for (PSI = (ps) -> ps_ninfo - 1; PSI >= 0; PSI--) \
113: if ((ps) -> ps_info[PSI]) \
114: pe_free ((ps) -> ps_info[PSI]), (ps) -> ps_info[PSI] = NULLPE; \
115: (ps) -> ps_ninfo = 0; \
116: }
117:
118:
119: struct PSAPconnect { /* P-CONNECT.CONFIRMATION */
120: int pc_sd; /* PRESENTATION descriptor */
121:
122: struct PSAPaddr pc_responding;/* address of peer responding */
123:
124: struct PSAPctxlist pc_ctxlist;/* the list of negotiated contexts */
125:
126: int pc_defctxresult; /* result for proposed default context name */
127:
128: int pc_prequirements; /* presentation requirements */
129:
130: int pc_srequirements; /* session requirements */
131: int pc_settings; /* initial settings of tokens */
132: int pc_please; /* tokens requested by PS-user */
133: long pc_isn; /* initial serial number */
134:
135: struct SSAPref pc_connect; /* session connection identifier */
136:
137: int pc_ssdusize; /* largest atomic SSDU */
138:
139: struct QOStype pc_qos; /* quality of service */
140:
141: int pc_result; /* result */
142: #define PC_ACCEPT (-1)
143:
144: #define PC_REJECTED 0 /* Rejected by peer */
145: /* Provider-reason */
146: #define PC_NOTSPECIFIED 1 /* Reason not specified */
147: #define PC_CONGEST 2 /* Temporary congestion */
148: #define PC_EXCEEDED 3 /* Local limit exceeded */
149: #define PC_ADDRESS 4 /* Called presentation address unknown */
150: #define PC_VERSION 5 /* Protocol version not supported */
151: #define PC_DEFAULT 6 /* Default context not supported */
152: #define PC_READABLE 7 /* User-data not readable */
153: #define PC_AVAILABLE 8 /* No PSAP available */
154: /* Abort-reason */
155: #define PC_UNRECOGNIZED 9 /* Unrecognized PPDU */
156: #define PC_UNEXPECTED 10 /* Unexpected PPDU */
157: #define PC_SSPRIMITIVE 11 /* Unexpected session service primitive */
158: #define PC_PPPARAM1 12 /* Unrecognized PPDU parameter */
159: #define PC_PPPARAM2 13 /* Unexpected PPDU parameter */
160: #define PC_INVALID 14 /* Invalid PPDU parameter value */
161: /* Provider-reason */
162: #define PC_ABSTRACT 15 /* Abstract syntax not supported */
163: #define PC_TRANSFER 16 /* Proposed transfer syntaxes not supported */
164: #define PC_DCSLIMIT 17 /* Local limit on DCS exceeded */
165: /* begin UNOFFICIAL */
166: #define PC_REFUSED 18 /* Connect request refused on this network
167: connection */
168: #define PC_SESSION 19 /* Session disconnect */
169: #define PC_PROTOCOL 20 /* Protocol error */
170: #define PC_ABORTED 21 /* Peer aborted connection */
171: #define PC_PARAMETER 22 /* Invalid parameter */
172: #define PC_OPERATION 23 /* Invalid operation */
173: #define PC_TIMER 24 /* Timer expired */
174: #define PC_WAITING 25 /* Indications waiting */
175: /* end UNOFFICIAL */
176:
177: #define PC_FATAL(r) ((r) < PC_PARAMETER)
178: #define PC_OFFICIAL(r) ((r) < PC_REFUSED)
179:
180: /* initial data from peer */
181: int pc_ninfo; /* number of elements */
182: PE pc_info[NPDATA]; /* data */
183: };
184: #define PCFREE(pc) \
185: { \
186: register int PCI; \
187: \
188: for (PCI = (pc) -> pc_ctxlist.pc_nctx - 1; PCI >= 0; PCI--) { \
189: oid_free ((pc) -> pc_ctxlist.pc_ctx[PCI].pc_asn); \
190: oid_free ((pc) -> pc_ctxlist.pc_ctx[PCI].pc_atn); \
191: (pc) -> pc_ctxlist.pc_ctx[PCI].pc_asn = \
192: (pc) -> pc_ctxlist.pc_ctx[PCI].pc_atn = NULLOID; \
193: } \
194: (pc) -> pc_ctxlist.pc_nctx = 0; \
195: for (PCI = (pc) -> pc_ninfo - 1; PCI >= 0; PCI--) \
196: if ((pc) -> pc_info[PCI]) \
197: pe_free ((pc) -> pc_info[PCI]), (pc) -> pc_info[PCI] = NULLPE; \
198: (pc) -> pc_ninfo = 0; \
199: }
200:
201:
202: /* PRESENTATION requirements */
203: #define PR_MANAGEMENT 0x0001 /* context management */
204: #define PR_RESTORATION 0x0002 /* context restoration */
205:
206: #define PR_MYREQUIRE 0x0000
207:
208:
209: struct PSAPdata { /* P-READ.INDICATION */
210: int px_type; /* type of indication */
211: /* same values as sx_type */
212:
213: int px_ninfo; /* number of elements */
214: PE px_info[NPDATA]; /* data */
215: };
216: #define PXFREE(px) \
217: { \
218: register int PXI; \
219: \
220: for (PXI = (px) -> px_ninfo - 1; PXI >= 0; PXI--) \
221: if ((px) -> px_info[PXI]) \
222: pe_free ((px) -> px_info[PXI]), (px) -> px_info[PXI] = NULLPE; \
223: (px) -> px_ninfo = 0; \
224: }
225:
226:
227: struct PSAPtoken { /* P-{TOKEN-*,GIVE-CONTROL}.INDICATION */
228: int pt_type; /* type of indication */
229: /* same values as st_type */
230:
231: u_char pt_tokens; /* tokens offered/wanted */
232: /* same values as st_tokens */
233:
234: u_char pt_owned; /* tokens owned by user */
235:
236:
237: /* PLEASE TOKEN only */
238: int pt_ninfo; /* number of elements */
239: PE pt_info[NPDATA]; /* data */
240: };
241: #define PTFREE(pt) \
242: { \
243: register int PTI; \
244: \
245: for (PTI = (pt) -> pt_ninfo - 1; PTI >= 0; PTI--) \
246: if ((pt) -> pt_info[PTI]) \
247: pe_free ((pt) -> pt_info[PTI]), (pt) -> pt_info[PTI] = NULLPE; \
248: (pt) -> pt_ninfo = 0; \
249: }
250:
251:
252: struct PSAPsync { /* P-*-SYNC.{INDICATION,CONFIRMATION} */
253: int pn_type; /* type of indication/confirmation */
254: /* same values as sn_type */
255:
256: int pn_options; /* options (!!) */
257: /* same values as sn_options */
258:
259: long pn_ssn; /* serial number */
260: /* same values as sn_ssn */
261:
262: int pn_settings; /* new token settings (RESYNC only) */
263:
264: /* sync data from peer */
265: int pn_ninfo; /* number of elements */
266: PE pn_info[NPDATA]; /* data */
267: };
268: #define PNFREE(pn) \
269: { \
270: register int PNI; \
271: \
272: for (PNI = (pn) -> pn_ninfo - 1; PNI >= 0; PNI--) \
273: if ((pn) -> pn_info[PNI]) \
274: pe_free ((pn) -> pn_info[PNI]), (pn) -> pn_info[PNI] = NULLPE; \
275: (pn) -> pn_ninfo = 0; \
276: }
277:
278:
279: struct PSAPactivity { /* P-ACTIVITY-*.{INDICATION,CONFIRMATION} */
280: int pv_type; /* type of indication/confirmation */
281: /* same values as sv_type */
282:
283: struct SSAPactid pv_id; /* START/RESUME activity identifier */
284:
285: struct SSAPactid pv_oid; /* RESUME old activity identifier */
286: struct SSAPref pv_connect;/* old connection identifier */
287:
288: long pv_ssn; /* RESUME/END Serial number */
289:
290: int pv_reason; /* INTERRUPT/DISCARD */
291: /* same values as sp_reason */
292:
293: /* activity DATA from peer */
294: int pv_ninfo; /* number of elements */
295: PE pv_info[NPDATA]; /* data */
296: };
297: #define PVFREE(pv) \
298: { \
299: register int PVI; \
300: \
301: for (PVI = (pv) -> pv_ninfo - 1; PVI >= 0; PVI--) \
302: if ((pv) -> pv_info[PVI]) \
303: pe_free ((pv) -> pv_info[PVI]), (pv) -> pv_info[PVI] = NULLPE; \
304: (pv) -> pv_ninfo = 0; \
305: }
306:
307:
308: struct PSAPreport { /* P-{U,P}-EXCEPTION-REPORT.INDICATION */
309: int pp_peer; /* T = P-U-EXCEPTION-REPORT.INDICATION:
310: pp_reason/pp_info both meaningful
311: NIL = P-P-EXCEPTION-REPORT.INDICATION:
312: pp_reason == SP_NOREASON, or
313: pp_reason == SP_PROTOCOL */
314: int pp_reason; /* same values as sp_reason */
315:
316: /* report DATA from peer */
317: int pp_ninfo; /* number of elements */
318: PE pp_info[NPDATA]; /* data */
319: };
320: #define PPFREE(pp) \
321: { \
322: register int PPI; \
323: \
324: for (PPI = (pp) -> pp_ninfo - 1; PPI >= 0; PPI--) \
325: if ((pp) -> pp_info[PPI]) \
326: pe_free ((pp) -> pp_info[PPI]), (pp) -> pp_info[PPI] = NULLPE; \
327: (pp) -> pp_ninfo = 0; \
328: }
329:
330:
331: struct PSAPfinish { /* P-RELEASE.INDICATION */
332: /* release DATA from peer */
333: int pf_ninfo; /* number of elements */
334: PE pf_info[NPDATA]; /* data */
335: };
336: #define PFFREE(pf) \
337: { \
338: register int PFI; \
339: \
340: for (PFI = (pf) -> pf_ninfo - 1; PFI >= 0; PFI--) \
341: if ((pf) -> pf_info[PFI]) \
342: pe_free ((pf) -> pf_info[PFI]), (pf) -> pf_info[PFI] = NULLPE; \
343: (pf) -> pf_ninfo = 0; \
344: }
345:
346:
347: struct PSAPrelease { /* P-RELEASE.CONFIRMATION */
348: int pr_affirmative; /* T = connection released
349: NIL = request refused */
350:
351: /* release DATA from peer */
352: int pr_ninfo; /* number of elements */
353: PE pr_info[NPDATA]; /* data */
354: };
355: #define PRFREE(pr) \
356: { \
357: register int PRI; \
358: \
359: for (PRI = (pr) -> pr_ninfo - 1; PRI >= 0; PRI--) \
360: if ((pr) -> pr_info[PRI]) \
361: pe_free ((pr) -> pr_info[PRI]), (pr) -> pr_info[PRI] = NULLPE; \
362: (pr) -> pr_ninfo = 0; \
363: }
364:
365:
366: struct PSAPabort { /* P-{U,P}-ABORT.INDICATION */
367: int pa_peer; /* T = P-U-ABORT.INDICATION:
368: pa_info/pa_ninfo is meaningful
369: NIL = P-P-ABORT.INDICATION:
370: pa_reason/pa_ppdu is meaningful,
371: pa_data contains diagnostics */
372:
373: int pa_reason; /* same codes as pc_result */
374:
375: /* abort information from peer */
376: int pa_ninfo; /* number of elements */
377: PE pa_info[NPDATA]; /* data */
378:
379: /* diagnostics from provider */
380: #define PA_SIZE 512
381: int pa_cc; /* length */
382: char pa_data[PA_SIZE]; /* data */
383: };
384: #define PAFREE(pa) \
385: { \
386: register int PAI; \
387: \
388: for (PAI = (pa) -> pa_ninfo - 1; PAI >= 0; PAI--) \
389: if ((pa) -> pa_info[PAI]) \
390: pe_free ((pa) -> pa_info[PAI]), (pa) -> pa_info[PAI] = NULLPE; \
391: (pa) -> pa_ninfo = 0; \
392: }
393:
394:
395: struct PSAPindication {
396: int pi_type; /* the union element present */
397: #define PI_DATA 0x00
398: #define PI_TOKEN 0x01
399: #define PI_SYNC 0x02
400: #define PI_ACTIVITY 0x03
401: #define PI_REPORT 0x04
402: #define PI_FINISH 0x05
403: #define PI_ABORT 0x06
404:
405: union {
406: struct PSAPdata pi_un_data;
407: struct PSAPtoken pi_un_token;
408: struct PSAPsync pi_un_sync;
409: struct PSAPactivity pi_un_activity;
410: struct PSAPreport pi_un_report;
411: struct PSAPfinish pi_un_finish;
412: struct PSAPabort pi_un_abort;
413: } pi_un;
414: #define pi_data pi_un.pi_un_data
415: #define pi_token pi_un.pi_un_token
416: #define pi_sync pi_un.pi_un_sync
417: #define pi_activity pi_un.pi_un_activity
418: #define pi_report pi_un.pi_un_report
419: #define pi_finish pi_un.pi_un_finish
420: #define pi_abort pi_un.pi_un_abort
421: };
422:
423: /* */
424:
425: extern char *psap2version;
426:
427:
428: int PExec (); /* SERVER only */
429: int PInit (); /* P-CONNECT.INDICATION */
430:
431: int PConnResponse (); /* P-CONNECT.RESPONSE */
432: /* P-CONNECT.REQUEST (backwards-compatible) */
433: #define PConnRequest(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14) \
434: PAsynConnRequest (a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,0)
435: int PAsynConnRequest (); /* P-(ASYN-)CONNECT.REQUEST */
436: int PAsynRetryRequest (); /* P-ASYN-RETRY.REQUEST (pseudo) */
437: int PDataRequest (); /* P-DATA.REQUEST */
438: int PDataRequestAux (); /* P-[*-]DATA.REQUEST */
439: #define PPDU_TTD 8
440: #define PPDU_TE 9
441: #define PPDU_TC 10
442: #define PPDU_TCC 11
443:
444: #define PExpdRequest(s,d,n,p) \
445: PDataRequestAux ((s), (d), (n), (p), "expedited", SExpdRequest, \
446: "SExpdRequest", "P-EXPEDITED-DATA user-data", PPDU_TE)
447:
448: #define PTypedRequest(s,d,n,p) \
449: PDataRequestAux ((s), (d), (n), (p), "typed", STypedRequest, \
450: "STypedRequest", "P-TYPED-DATA user-data", PPDU_TTD)
451:
452: #define PCapdRequest(s,d,n,p) \
453: PDataRequestAux ((s), (d), (n), (p), "capability", SCapdRequest, \
454: "SCapdRequest", "P-CAPABILITY-DATA user-data", PPDU_TC)
455:
456: #define PCapdResponse(s,d,n,p) \
457: PDataRequestAux ((s), (d), (n), (p), "capability", SCapdResponse, \
458: "SCapdResponse","P-CAPABILITY-DATA user-data",PPDU_TCC)
459:
460: int PReadRequest (); /* P-READ.REQUEST (pseudo) */
461: int PGTokenRequest (); /* P-TOKEN-GIVE.REQUEST */
462: int PPTokenRequest (); /* P-TOKEN-PLEASE.REQUEST */
463: int PGControlRequest (); /* P-CONTROL-GIVE.REQUEST */
464: int PMajSyncRequestAux (); /* P-{MAJOR-SYNC,ACTIVITY-END}.REQUEST */
465:
466: #define PMajSyncRequest(s,i,d,n,p) \
467: PMajSyncRequestAux ((s), (i), (d), (n), (p), "majorsync", \
468: SMajSyncRequest, "SMajSyncRequest")
469:
470: #define PActEndRequest(s,i,d,n,p) \
471: PMajSyncRequestAux ((s), (i), (d), (n), (p), "activity end", \
472: SActEndRequest, "SActEndRequest")
473:
474: int PMajSyncResponseAux (); /* P-{MAJOR-SYNC,ACTIVITY-END}.RESPONSE */
475:
476: #define PMajSyncResponse(s,d,n,p) \
477: PMajSyncResponseAux ((s), (d), (n), (p), "majorsync", \
478: SMajSyncResponse, "SMajSyncResponse")
479:
480: #define PActEndResponse(s,d,n,p) \
481: PMajSyncResponseAux ((s), (d), (n), (p), "activity end", \
482: SActEndResponse, "SActEndResponse")
483:
484: int PMinSyncRequest (); /* P-MINOR-SYNC.REQUEST */
485: int PMinSyncResponse (); /* P-MINOR-SYNC.RESPONSE */
486: int PReSyncRequest (); /* P-RESYNCHRONIZE.REQUEST */
487: int PReSyncResponse (); /* P-RESYNCHRONIZE.RESPONSE */
488: int PActStartRequest (); /* P-ACTIVITY-START.REQUEST */
489: int PActResumeRequest (); /* P-ACTIVITY-RESUME.REQUEST */
490: int PActIntrRequestAux (); /* P-ACTIVITY-{INTERRUPT,DISCARD}.REQUEST */
491:
492: #define PActIntrRequest(s,r,p) \
493: PActIntrRequestAux ((s), (r), (p), \
494: SActIntrRequest, "SActIntrRequest")
495:
496: #define PActDiscRequest(s,r,p) \
497: PActIntrRequestAux ((s), (r), (p), \
498: SActDiscRequest, "SActDiscRequest")
499:
500: int PActIntrResponseAux (); /* P-ACTIVITY-{INTERRUPT,DISCARD}.RESPONSE */
501:
502: #define PActIntrResponse(s,p) \
503: PActIntrResponseAux ((s), (p), \
504: SActIntrResponse, "SActIntrResponse")
505:
506: #define PActDiscResponse(s,p) \
507: PActIntrResponseAux ((s), (p), \
508: SActDiscResponse, "SActDiscResponse")
509:
510: int PUAbortRequest (); /* P-U-ABORT.REQUEST */
511: int PUReportRequest (); /* P-U-EXCEPTION-REPORT.REQUEST */
512: int PRelRequest (); /* P-RELEASE.REQUEST */
513: int PRelRetryRequest (); /* P-RELEASE-RETRY.REQUEST (pseudo) */
514: int PRelResponse (); /* P-RELEASE.RESPONSE */
515:
516: int PSetIndications (); /* define vectors for INDICATION events */
517: int PSelectMask (); /* map presentation descriptors for select() */
518:
519: char *PErrString (); /* return PSAP error code in string form */
520:
521: #define PLocalHostName getlocalhost
522: char *PLocalHostName (); /* return name of local host (sigh) */
523: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.