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