|
|
1.1 root 1: /* spkt.h - include file for session providers (SS-PROVIDER) */
2:
3: /*
4: * $Header: /f/osi/h/RCS/spkt.h,v 7.1 89/11/27 10:30:35 mrose Exp $
5: *
6: *
7: * $Log: spkt.h,v $
8: * Revision 7.1 89/11/27 10:30:35 mrose
9: * sync
10: *
11: * Revision 7.0 89/11/23 21:56:00 mrose
12: * Release 6.0
13: *
14: */
15:
16: /*
17: * NOTICE
18: *
19: * Acquisition, use, and distribution of this module and related
20: * materials are subject to the restrictions of a license agreement.
21: * Consult the Preface in the User's Manual for the full terms of
22: * this agreement.
23: *
24: */
25:
26:
27: #ifndef _SSAP_
28: #include "ssap.h" /* definitions for SS-USERs */
29: #endif
30:
31: #include "tsap.h" /* definitions for TS-USERs */
32:
33:
34: /* */
35:
36: #define ssapPsig(sb, sd) \
37: { \
38: if ((sb = findsblk (sd)) == NULL) { \
39: (void) sigiomask (smask); \
40: return ssaplose (si, SC_PARAMETER, NULLCP, \
41: "invalid session descriptor"); \
42: } \
43: if (!(sb -> sb_flags & SB_CONN)) {\
44: (void) sigiomask (smask); \
45: return ssaplose (si, SC_PARAMETER, NULLCP, \
46: "session descriptor not connected"); \
47: } \
48: if (sb -> sb_flags & SB_FINN) { \
49: (void) sigiomask (smask); \
50: return ssaplose (si, SC_OPERATION, NULLCP, \
51: "session descriptor finishing"); \
52: } \
53: if (sb -> sb_flags & SB_RELEASE) { \
54: (void) sigiomask (smask); \
55: return ssaplose (si, SC_OPERATION, NULLCP, \
56: "release in progress"); \
57: } \
58: if (sb -> sb_flags & SB_MAP) { \
59: (void) sigiomask (smask); \
60: return ssaplose (si, SC_OPERATION, NULLCP, \
61: "majorsync in progress"); \
62: } \
63: if (sb -> sb_flags & SB_RS) { \
64: (void) sigiomask (smask); \
65: return ssaplose (si, SC_OPERATION, NULLCP, \
66: "resync in progress"); \
67: } \
68: if (sb -> sb_flags & SB_RA) { \
69: (void) sigiomask (smask); \
70: return ssaplose (si, SC_OPERATION, NULLCP, \
71: "awaiting your resync response"); \
72: } \
73: if (sb -> sb_flags & SB_AI) { \
74: (void) sigiomask (smask); \
75: return ssaplose (si, SC_OPERATION, NULLCP, \
76: "activity interrupt/discard in progress"); \
77: } \
78: if (sb -> sb_flags & SB_AIA) { \
79: (void) sigiomask (smask); \
80: return ssaplose (si, SC_OPERATION, NULLCP, \
81: "awaiting your activity interrupt/discard response"); \
82: } \
83: if (sb -> sb_flags & (SB_ED | SB_EDACK | SB_ERACK)) { \
84: (void) sigiomask (smask); \
85: return ssaplose (si, SC_OPERATION, NULLCP, \
86: "exception in progress"); \
87: } \
88: }
89:
90: #define ssapXsig(sb, sd) \
91: { \
92: if ((sb = findsblk (sd)) == NULL) { \
93: (void) sigiomask (smask); \
94: return ssaplose (si, SC_PARAMETER, NULLCP, \
95: "invalid session descriptor"); \
96: } \
97: if (!(sb -> sb_flags & SB_CONN)) {\
98: (void) sigiomask (smask); \
99: return ssaplose (si, SC_PARAMETER, NULLCP, \
100: "session descriptor not connected"); \
101: } \
102: if (sb -> sb_flags & SB_FINN) { \
103: (void) sigiomask (smask); \
104: return ssaplose (si, SC_OPERATION, NULLCP, \
105: "session descriptor finishing"); \
106: } \
107: if (sb -> sb_flags & SB_RELEASE) { \
108: (void) sigiomask (smask); \
109: return ssaplose (si, SC_OPERATION, NULLCP, \
110: "release in progress"); \
111: } \
112: if (sb -> sb_flags & SB_RS) { \
113: (void) sigiomask (smask); \
114: return ssaplose (si, SC_OPERATION, NULLCP, \
115: "resync in progress"); \
116: } \
117: if (sb -> sb_flags & SB_RA) { \
118: (void) sigiomask (smask); \
119: return ssaplose (si, SC_OPERATION, NULLCP, \
120: "awaiting your resync response"); \
121: } \
122: if (sb -> sb_flags & SB_AI) { \
123: (void) sigiomask (smask); \
124: return ssaplose (si, SC_OPERATION, NULLCP, \
125: "activity interrupt/discard in progress"); \
126: } \
127: if (sb -> sb_flags & SB_AIA) { \
128: (void) sigiomask (smask); \
129: return ssaplose (si, SC_OPERATION, NULLCP, \
130: "awaiting your activity interrupt/discard response"); \
131: } \
132: if (sb -> sb_flags & SB_ED) { \
133: (void) sigiomask (smask); \
134: return ssaplose (si, SC_OPERATION, NULLCP, \
135: "exception in progress"); \
136: } \
137: }
138:
139: #define ssapRsig(sb, sd) \
140: { \
141: if ((sb = findsblk (sd)) == NULL) { \
142: (void) sigiomask (smask); \
143: return ssaplose (si, SC_PARAMETER, NULLCP, \
144: "invalid session descriptor"); \
145: } \
146: if (!(sb -> sb_flags & SB_CONN)) {\
147: (void) sigiomask (smask); \
148: return ssaplose (si, SC_PARAMETER, NULLCP, \
149: "session descriptor not connected"); \
150: } \
151: if (sb -> sb_flags & SB_FINN) { \
152: (void) sigiomask (smask); \
153: return ssaplose (si, SC_OPERATION, NULLCP, \
154: "session descriptor finishing"); \
155: } \
156: if (sb -> sb_flags & SB_RELEASE) { \
157: (void) sigiomask (smask); \
158: return ssaplose (si, SC_OPERATION, NULLCP, \
159: "release in progress"); \
160: } \
161: if (sb -> sb_flags & SB_RS) { \
162: (void) sigiomask (smask); \
163: return ssaplose (si, SC_OPERATION, NULLCP, \
164: "resync in progress"); \
165: } \
166: if (sb -> sb_flags & SB_AI) { \
167: (void) sigiomask (smask); \
168: return ssaplose (si, SC_OPERATION, NULLCP, \
169: "activity interrupt/discard in progress"); \
170: } \
171: if (sb -> sb_flags & SB_AIA) { \
172: (void) sigiomask (smask); \
173: return ssaplose (si, SC_OPERATION, NULLCP, \
174: "awaiting your activity interrupt/discard response"); \
175: } \
176: if (sb -> sb_flags & SB_AE) { \
177: (void) sigiomask (smask); \
178: return ssaplose (si, SC_OPERATION, NULLCP, \
179: "activity end in progress"); \
180: } \
181: if (sb -> sb_flags & SB_ED) { \
182: (void) sigiomask (smask); \
183: return ssaplose (si, SC_OPERATION, NULLCP, \
184: "exception in progress"); \
185: } \
186: }
187:
188: #define ssapAsig(sb, sd) \
189: { \
190: if ((sb = findsblk (sd)) == NULL) { \
191: (void) sigiomask (smask); \
192: return ssaplose (si, SC_PARAMETER, NULLCP, \
193: "invalid session descriptor"); \
194: } \
195: if (!(sb -> sb_flags & SB_CONN)) {\
196: (void) sigiomask (smask); \
197: return ssaplose (si, SC_PARAMETER, NULLCP, \
198: "session descriptor not connected"); \
199: } \
200: if (sb -> sb_flags & SB_FINN) { \
201: (void) sigiomask (smask); \
202: return ssaplose (si, SC_OPERATION, NULLCP, \
203: "session descriptor finishing"); \
204: } \
205: if (sb -> sb_flags & SB_RELEASE) { \
206: (void) sigiomask (smask); \
207: return ssaplose (si, SC_OPERATION, NULLCP, \
208: "release in progress"); \
209: } \
210: if (sb -> sb_flags & SB_MAA) { \
211: (void) sigiomask (smask); \
212: return ssaplose (si, SC_OPERATION, NULLCP, \
213: "awaiting your majorsync response"); \
214: } \
215: if (sb -> sb_flags & SB_RS) { \
216: (void) sigiomask (smask); \
217: return ssaplose (si, SC_OPERATION, NULLCP, \
218: "resync in progress"); \
219: } \
220: if (sb -> sb_flags & SB_AI) { \
221: (void) sigiomask (smask); \
222: return ssaplose (si, SC_OPERATION, NULLCP, \
223: "activity interrupt/discard in response"); \
224: } \
225: if (sb -> sb_flags & (SB_ED | SB_EDACK | SB_ERACK)) { \
226: (void) sigiomask (smask); \
227: return ssaplose (si, SC_OPERATION, NULLCP, \
228: "exception in progress"); \
229: } \
230: }
231:
232: #define ssapFsig(sb, sd) \
233: { \
234: if ((sb = findsblk (sd)) == NULL) { \
235: (void) sigiomask (smask); \
236: return ssaplose (si, SC_PARAMETER, NULLCP, \
237: "invalid session descriptor"); \
238: } \
239: if (!(sb -> sb_flags & SB_CONN)) {\
240: (void) sigiomask (smask); \
241: return ssaplose (si, SC_PARAMETER, NULLCP, \
242: "session descriptor not connected"); \
243: } \
244: if (!(sb -> sb_flags & SB_FINN)) { \
245: (void) sigiomask (smask); \
246: return ssaplose (si, SC_OPERATION, NULLCP, \
247: "session descriptor not finishing"); \
248: } \
249: if (sb -> sb_flags & SB_RELEASE) { \
250: (void) sigiomask (smask); \
251: return ssaplose (si, SC_OPERATION, NULLCP, \
252: "release in progress"); \
253: } \
254: if (sb -> sb_flags & SB_MAA) { \
255: (void) sigiomask (smask); \
256: return ssaplose (si, SC_OPERATION, NULLCP, \
257: "awaiting your majorsync response"); \
258: } \
259: if (sb -> sb_flags & SB_RS) { \
260: (void) sigiomask (smask); \
261: return ssaplose (si, SC_OPERATION, NULLCP, \
262: "resync in progress"); \
263: } \
264: if (sb -> sb_flags & SB_RA) { \
265: (void) sigiomask (smask); \
266: return ssaplose (si, SC_OPERATION, NULLCP, \
267: "awaiting your resync response"); \
268: } \
269: if (sb -> sb_flags & SB_AI) { \
270: (void) sigiomask (smask); \
271: return ssaplose (si, SC_OPERATION, NULLCP, \
272: "activity interrupt/discard in progress"); \
273: } \
274: if (sb -> sb_flags & SB_AIA) { \
275: (void) sigiomask (smask); \
276: return ssaplose (si, SC_OPERATION, NULLCP, \
277: "awaiting your activity interrupt/discard response"); \
278: } \
279: if (sb -> sb_flags & (SB_ED | SB_EDACK | SB_ERACK)) { \
280: (void) sigiomask (smask); \
281: return ssaplose (si, SC_OPERATION, NULLCP, \
282: "exception in progress"); \
283: } \
284: }
285:
286: #define missingP(p) \
287: { \
288: if (p == NULL) \
289: return ssaplose (si, SC_PARAMETER, NULLCP, \
290: "mandatory parameter \"%s\" missing", "p"); \
291: }
292:
293: #define refmuchP(sr) \
294: { \
295: if ((sr) -> sr_ulen > SREF_USER_SIZE \
296: || (sr) -> sr_clen > SREF_COMM_SIZE \
297: || (sr) -> sr_alen > SREF_ADDT_SIZE \
298: || (sr) -> sr_vlen > SREF_USER_SIZE) \
299: return ssaplose (si, SC_PARAMETER, NULLCP, \
300: "bad format for reference"); \
301: }
302:
303: #define idmuchP(sd) \
304: { \
305: if ((sd) -> sd_len > SID_DATA_SIZE) \
306: return ssaplose (si, SC_PARAMETER, NULLCP, \
307: "bad format for activity ID"); \
308: }
309:
310: #define toomuchP(sb,b,n,m,p) \
311: { \
312: if (b == NULL) \
313: n = 0; \
314: else \
315: if (n > (sb -> sb_version < SB_VRSN2 ? m : ENCLOSE_MAX)) { \
316: (void) sigiomask (smask); \
317: return ssaplose (si, SC_PARAMETER, NULLCP, \
318: "too much %s user data, %d octets", p, n); \
319: } \
320: }
321:
322:
323: #define NULLTX ((struct TSAPdata *) 0)
324: #define NULLSD ((struct SSAPactid *) 0)
325: #define NULLSR ((struct SSAPref *) 0)
326:
327:
328: #ifndef lint
329: #ifndef __STDC__
330: #define copySSAPdata(base,len,d) \
331: { \
332: register int i = len; \
333: if ((d -> d/* */_cc = min (i, sizeof d -> d/* */_data)) > 0) \
334: bcopy (base, d -> d/* */_data, d -> d/* */_cc); \
335: }
336:
337: #define copySPKTdata(s,d) \
338: { \
339: d -> d/* */_data = s -> s_udata, d -> d/* */_cc = s -> s_ulen; \
340: s -> s_udata = NULL; \
341: }
342: #else
343: #define copySSAPdata(base,len,d) \
344: { \
345: register int i = len; \
346: if ((d -> d##_cc = min (i, sizeof d -> d##_data)) > 0) \
347: bcopy (base, d -> d##_data, d -> d##_cc); \
348: }
349:
350: #define copySPKTdata(s, d) \
351: { \
352: d -> d##_data = s -> s_udata, d -> d##_cc = s -> s_ulen; \
353: s -> s_udata = NULL; \
354: }
355: #endif
356: #else
357: #define copySSAPdata(base,len,d) bcopy (base, (char *) d, len)
358:
359: #define copySPKTdata(s,d) bcopy (s -> s_udata, (char *) d, s -> s_ulen)
360: #endif
361:
362:
363: #define AB_TIM 30 /* drain for 30 seconds on ABORTs */
364: #define RF_TIM 30 /* drain for 30 seconds on REFUSEs */
365:
366:
367: #define SC_REFUSE (SC_BASE << 1) /* larger than any sc_reason */
368:
369:
370: int spktlose (), ssaplose ();
371:
372: /* */
373:
374: struct ssapblk {
375: struct ssapblk *sb_forw; /* doubly-linked list */
376: struct ssapblk *sb_back; /* .. */
377:
378: int sb_fd; /* transport descriptor */
379:
380: int sb_version; /* version number of protocol */
381: #define SB_VRSN1 0 /* 1 */
382: #define SB_VRSN2 1 /* 2 */
383: #define SB_ALLVRSNS ((1 << SB_VRSN1) | (1 << SB_VRSN2))
384: int sb_vrsnmask; /* for initiating SPM... */
385:
386: long sb_flags; /* our state */
387: #define SB_NULL 0x000000
388: #define SB_CONN 0x000001/* connected */
389: #define SB_FINN 0x000002/* other side wants to finish */
390: #define SB_INIT 0x000004/* this side initiated the session */
391: #define SB_ASYN 0x000008/* asynchronous */
392: #define SB_EXPD 0x000010/* expedited service available on transport */
393: #define SB_CD 0x000020/* CD request in progress */
394: #define SB_CDA 0x000040/* awaiting CD response from user */
395: #define SB_GTC 0x000080/* GTC request in progress */
396: #define SB_MAP 0x000100/* MAP request in progress */
397: #define SB_MAA 0x000200/* awaiting MAP response from user */
398: #define SB_AE 0x000400/* MAP is really AE */
399: #define SB_RS 0x000800/* RS request in progress */
400: #define SB_RA 0x001000/* awaiting RS response from user */
401: #define SB_AI 0x002000/* AI request in progress */
402: #define SB_AIA 0x004000/* awaiting AI response from user */
403: #define SB_ED 0x008000/* user exception in progress */
404: #define SB_EDACK 0x010000/* awaiting user exception to be cleared */
405: #define SB_ERACK 0x020000/* awaiting provider exception to be cleared */
406: #define SB_Vact 0x040000/* activity in progress */
407: #define SB_Vsc 0x080000/* okay to reply to minorsync */
408: #define SB_Vnextact 0x100000/* activity MAP sent/received */
409: #define SB_RELEASE 0x200000/* release in progress */
410:
411: struct ssapkt *sb_retry; /* initial/final spkt */
412:
413: long sb_V_A; /* lowest unconfirmed ssn */
414: long sb_V_M; /* next ssn */
415: long sb_V_R; /* lowest ssn for resynchronization */
416: int sb_rs; /* resynchronization type
417: (an SYNC_xxx code, plus...) */
418: #define SYNC_INTR 3 /* Activity Interrupt */
419: #define SYNC_DISC 4 /* Activity Discard */
420: long sb_rsn; /* resync serial number */
421: u_char sb_rsettings; /* proposed token settings */
422:
423: int sb_pr; /* SPDU to prepare for (an SPDU code) */
424: struct ssapkt *sb_xspdu; /* saved expedited SPDU
425: (really should be a linked list!) */
426:
427: struct ssapkt *sb_spdu; /* for concatenated SPDUs */
428:
429: struct qbuf sb_qbuf; /* for segmented (T)SSDUs */
430: int sb_len; /* .. */
431: int sb_code; /* .. */
432:
433: u_char sb_options; /* connect options */
434: u_char sb_settings; /* tokens settings on connect */
435:
436: u_short sb_tsdu_us; /* our max TSDU size */
437: u_short sb_tsdu_them; /* their max TSDU size */
438: #define BAD_TSDU_SIZE(s) ((s) ? (s) < DT_MINSIZE : 0)
439: #define GET_TSDU_SIZE(s) ((s) < DT_MINSIZE ? 0 : (s))
440:
441: u_char sb_owned; /* tokens we own */
442: u_short sb_requirements; /* functional units selected */
443:
444: struct SSAPaddr sb_initiating; /* initiator */
445: struct SSAPaddr sb_responding; /* responder */
446:
447: int sb_maxtime; /* for SPM response during S-CONNECT */
448:
449: IFP sb_DataIndication; /* INDICATION handlers */
450: IFP sb_TokenIndication; /* .. */
451: IFP sb_SyncIndication; /* .. */
452: IFP sb_ActivityIndication; /* .. */
453: IFP sb_ReportIndication; /* .. */
454: IFP sb_ReleaseIndication; /* .. */
455: IFP sb_AbortIndication; /* .. */
456: };
457: #define NULLBP ((struct ssapblk *) 0)
458:
459: int freesblk ();
460: struct ssapblk *newsblk (), *findsblk ();
461:
462:
463: int ts2sslose ();
464:
465: int spkt2sd ();
466: struct ssapkt *sb2spkt ();
467:
468: /* SPKT datastructure */
469:
470: struct ssapkt {
471: int s_errno;
472:
473: int s_mask;
474:
475: u_char s_code;
476: #define SPDU_CN 0x0d /* CONNECT */
477: #define SPDU_AC 0x0e /* ACCEPT */
478: #define SPDU_RF 0x0c /* REFUSE */
479: #define SPDU_FN 0x09 /* FINISH */
480: #define SPDU_DN 0x0a /* DISCONNECT */
481: #define SPDU_NF 0x08 /* NOT FINISHED */
482: #define SPDU_AB 0x19 /* ABORT */
483: #define SPDU_AA 0x1a /* ABORT ACCEPT */
484: #define SPDU_DT SPDU_GT /* DATA TRANSFER */
485: #define SPDU_EX 0x05 /* EXPEDITED */
486: #define SPDU_TD 0x21 /* TYPED DATA */
487: #define SPDU_CD 0x3d /* CAPABILITY DATA */
488: #define SPDU_CDA 0x3e /* CAPABILITY DATA ACK */
489: #define SPDU_GT 0x01 /* GIVE TOKENS */
490: #define SPDU_PT 0x02 /* PLEASE TOKENS */
491: #define SPDU_GTC 0x15 /* GIVE TOKENS CONFIRM */
492: #define SPDU_GTA 0x16 /* GIVE TOKENS ACK */
493: #define SPDU_MIP 0x31 /* MINOR SYNCHRONIZATION POINT */
494: #define SPDU_MIA 0x32 /* MINOR SYNC ACK */
495: #define SPDU_MAP 0x29 /* MAJOR SYNCHRONIZATION POINT */
496: #define SPDU_MAA 0x2a /* MAJOR SYNC ACK */
497: #define SPDU_RS 0x35 /* RESYNCHRONIZE */
498: #define SPDU_RA 0x22 /* RESYNCHRONIZE ACK */
499: #define SPDU_PR 0x07 /* PREPARE */
500: #define SPDU_ER 0x00 /* EXCEPTION REPORT */
501: #define SPDU_ED 0x30 /* EXCEPTION DATA */
502: #define SPDU_AS 0x2d /* ACTIVITY START */
503: #define SPDU_AR 0x1d /* ACTIVITY RESUME */
504: #define SPDU_AI SPDU_AB /* ACTIVITY INTERRUPT */
505: #define SPDU_AIA SPDU_AA /* ACTIVITY INTERRUPT ACK */
506: #define SPDU_AD 0x39 /* ACTIVITY DISCARD */
507: #define SPDU_ADA 0x3a /* ACTIVITY DISCARD ACK */
508: #define SPDU_AE SPDU_MAP/* ACTIVITY END */
509: #define SPDU_AEA SPDU_MAA/* ACTIVITY END ACK */
510:
511: u_long s_li;
512: #define SPDU_MAXLEN 65535 /* segment if SSDU larger */
513:
514: /* A nice magic number:
515: for the GT SPDU, 2 octets
516: for the DT SPDU, 2 octets + 3 octets for the enclosure option
517:
518: 2 + 2 + 3 = 7
519: */
520: #define SSDU_MAGIC 7
521:
522: union {
523: struct { /* CONNECT/ACCEPT SPDU */
524: #define SMASK_CN_REF 0x0001
525: struct SSAPref un_cn_reference;
526:
527: struct {
528: #define SMASK_CN_OPT 0x0002
529: u_char un_cn_options;
530: #define CR_OPT_NULL 0x00
531: #define CR_OPT_EXTD 0x01 /* will receive extended concatenated SPDUs,
532: this implementation DOESN'T; segmenting is
533: enough... */
534: #define CR_OPT_MASK CR_OPT_EXTD
535:
536: #define SMASK_CN_TSDU 0x0004
537: u_short un_cn_tsdu_init;
538: u_short un_cn_tsdu_resp;
539:
540: #define SMASK_CN_VRSN 0x0008
541: u_char un_cn_version;
542:
543: #define SMASK_CN_ISN 0x0010
544: #define SIZE_CN_ISN 6
545: u_long un_cn_isn;
546:
547: #define SMASK_CN_SET 0x0020
548: u_char un_settings;
549: } un_cn_item;
550:
551: #define SMASK_AC_TOKEN 0x0040
552: u_char un_ac_token;/* ACCEPT SPDU only */
553:
554: #define SMASK_CN_REQ 0x0080
555: u_short un_cn_requirements;
556:
557: #define SMASK_CN_CALLING 0x0100
558: char un_cn_calling[SSSIZE];
559: int un_cn_callinglen;
560:
561: #define SMASK_CN_CALLED 0x0200
562: char un_cn_called[SSSIZE];
563: int un_cn_calledlen;
564: } un_cn;
565: #define CN_SIZE 512
566: #define CONNECT_MAX 10240 /* someday support CDO/OA SPDUs and Data
567: Overflow PI... */
568: #define CN_BASE_SIZE 56
569: #define AC_SIZE 512
570: #define AC_BASE_SIZE 62
571:
572: struct { /* REFUSE SPDU */
573: #define SMASK_RF_REF 0x0001
574: struct SSAPref un_rf_reference;
575:
576: #define SMASK_RF_DISC 0x0002
577: u_char un_rf_disconnect;
578: #define RF_DISC_RELEASE 0x01 /* release transport connection */
579: #define RF_DISC_MASK RF_DISC_RELEASE
580:
581: #define SMASK_RF_REQ 0x0004
582: u_short un_rf_requirements;
583:
584: #define SMASK_RF_VRSN 0x0008
585: u_char un_rf_version;
586:
587: char *un_rf_rdata;
588: int un_rf_rlen;
589: } un_rf;
590: #define RF_SIZE 513
591: #define RF_BASE_SIZE 13
592:
593: struct { /* FINISH SPDU */
594: #define SMASK_FN_DISC 0x0001
595: u_char un_fn_disconnect;
596: #define FN_DISC_RELEASE 0x01 /* release transport connection */
597: #define FN_DISC_MASK FN_DISC_RELEASE
598: } un_fn;
599: #define FN_SIZE 512
600: #define FN_BASE_SIZE 6
601:
602: /* DISCONNECT SPDU */
603: #define DN_SIZE 512
604: #define DN_BASE_SIZE 3
605:
606: /* NOT FINISHED SPDU */
607: #define NF_SIZE 512
608: #define NF_BASE_SIZE 3
609:
610: struct { /* ABORT SPDU */
611: #define SMASK_AB_DISC 0x0001
612: u_char un_ab_disconnect;
613: #define AB_DISC_RELEASE 0x01 /* release transport connection */
614: #define AB_DISC_USER 0x02 /* user abort */
615: #define AB_DISC_PROTO 0x04 /* protocol error */
616: #define AB_DISC_UNKNOWN 0x08 /* no reason */
617: #define AB_DISC_MASK (AB_DISC_RELEASE | AB_DISC_USER | AB_DISC_PROTO \
618: | AB_DISC_UNKNOWN)
619:
620: #define SMASK_AB_REFL 0x0002
621: #define AB_REFL_SIZE 9
622: u_char un_ab_reflect[AB_REFL_SIZE];
623: } un_ab;
624: #define AB_SIZE 9
625: #define AB_BASE_SIZE 17
626: #define SMASK_SPDU_AB 0x0004
627: /* to distinguish between AB and AI SPDUs */
628:
629:
630: /* ABORT ACCEPT SPDU */
631: #define AA_SIZE 0
632: #define AA_BASE_SIZE 0
633: #define SMASK_SPDU_AA 0x0001 /* to distinguish between AA and AIA SPDUs */
634:
635:
636: /* DATA TRANSFER SPDU */
637: #define DT_SIZE 65535
638: #define DT_MINSIZE 64 /* don't segment if MSS < this */
639: #define DT_BASE_SIZE 3
640:
641: /* EXPEDITED DATA SPDU */
642: #define EX_SIZE SX_EXSIZE
643: #define EX_BASE_SIZE 0
644:
645: /* TYPED DATA SPDU */
646: #define TD_SIGHS 65535 /* should be TD_SIZE, but <tsap.h>
647: got there first */
648: #define TD_MINSIZE 64 /* don't segment if MSS < this */
649: #define TD_BASE_SIZE 3
650:
651: /* CAPABILITY DATA SPDU */
652: #define CD_SIZE SX_CDSIZE
653: #define CD_BASE_SIZE 3
654:
655: /* CAPABILITY DATA ACK SPDU */
656: #define CDA_SIZE SX_CDASIZE
657: #define CDA_BASE_SIZE 3
658:
659: struct { /* GIVE TOKENS SPDU */
660: #define SMASK_GT_TOKEN 0x0001
661: u_char un_gt_token;
662: } un_gt;
663: #define GT_SIZE 0
664: #define GT_BASE_SIZE 3
665: #define SMASK_SPDU_GT 0x0002 /* to distinguish between DT and GT SPDUs */
666:
667: struct { /* PLEASE TOKENS SPDU */
668: #define SMASK_PT_TOKEN 0x0001
669: u_char un_pt_token;
670: } un_pt;
671: #define PT_SIZE 512
672: #define PT_BASE_SIZE 6
673:
674: /* GIVE TOKENS CONFIRM SPDU */
675: #define GTC_SIZE 0
676: #define GTC_BASE_SIZE 0
677:
678: /* GIVE TOKENS ACK SPDU */
679: #define GTA_SIZE 0
680: #define GTA_BASE_SIZE 0
681:
682: struct { /* MINOR SYNC POINT SPDU */
683: #define SMASK_MIP_SYNC 0x0001
684: u_char un_mip_sync;
685: #define MIP_SYNC_NOEXPL 0x01 /* NO EXPLICIT ACK REQUIRED */
686: #define MIP_SYNC_MASK MIP_SYNC_NOEXPL
687:
688: #define SMASK_MIP_SERIAL 0x0002
689: u_long un_mip_serial;
690: } un_mip;
691: #define MIP_SIZE 512
692: #define MIP_BASE_SIZE 14
693:
694: struct { /* MINOR SYNC ACK SPDU */
695: #define SMASK_MIA_SERIAL 0x0001
696: u_long un_mia_serial;
697: } un_mia;
698: #define MIA_SIZE 512
699: #define MIA_BASE_SIZE 11
700:
701: struct { /* MAJOR SYNC POINT SPDU */
702: #define SMASK_MAP_SYNC 0x0001
703: u_char un_map_sync;
704: #define MAP_SYNC_NOEND 0x01 /* ACTIVITY NOT ENDED (i.e., MAP not AE) */
705: #define MAP_SYNC_MASK MAP_SYNC_NOEND
706:
707: #define SMASK_MAP_SERIAL 0x0002
708: u_long un_map_serial;
709: } un_map;
710: #define MAP_SIZE 512
711: #define MAP_BASE_SIZE 14
712:
713: struct { /* MAJOR SYNC ACK SPDU */
714: #define SMASK_MAA_SERIAL 0x0001
715: u_long un_maa_serial;
716: } un_maa;
717: #define MAA_SIZE 512
718: #define MAA_BASE_SIZE 11
719:
720: struct { /* RESYNCHRONIZE SPDU */
721: #define SMASK_RS_SET 0x0001
722: u_char un_rs_settings;
723:
724: #define SMASK_RS_TYPE 0x0002
725: u_char un_rs_type;
726: #define SYNC_OK(r) (((unsigned) (r)) <= SYNC_SET)
727:
728: #define SMASK_RS_SSN 0x0004
729: u_long un_rs_serial;
730: } un_rs;
731: #define RS_SIZE 512
732: #define RS_BASE_SIZE 17
733:
734: struct { /* RESYNCHRONIZE ACK SPDU */
735: #define SMASK_RA_SET 0x0001
736: u_char un_ra_settings;
737:
738: #define SMASK_RA_SSN 0x0002
739: u_long un_ra_serial;
740: } un_ra;
741: #define RA_SIZE 512
742: #define RA_BASE_SIZE 14
743:
744: struct { /* PREPARE SPDU */
745: #define SMASK_PR_TYPE 0x0001
746: u_char un_pr_type;
747: #define PR_MAA 1 /* expect SPDU_MAA */
748: #define PR_RS 2 /* expect SPDU_RS */
749: #define PR_RA 3 /* expect SPDU_RA */
750: #define PR_AB 4 /* expect SPDU_AB */
751: #define PR_MAX PR_AB
752: } un_pr;
753: #define PR_SIZE 0
754: #define PR_BASE_SIZE 3
755:
756: /* EXCEPTION REPORT SPDU */
757: #define ER_SIZE 0
758: #define ER_BASE_SIZE 0
759:
760: struct { /* EXCEPTION DATA SPDU */
761: #define SMASK_ED_REASON 0x0001
762: u_char un_ed_reason;
763: #define SP_OK(r) (((r) < SP_PROCEDURAL \
764: && (r) != SP_RSVD1 \
765: && (r) != SP_RSVD2) \
766: || (r) == SP_DEMAND)
767: } un_ed;
768: #define ED_SIZE 512
769: #define ED_BASE_SIZE 6
770:
771: struct { /* ACTIVITY START SPDU */
772: #define SMASK_AS_ID 0x0001
773: struct SSAPactid un_as_id;
774: } un_as;
775: #define AS_SIZE 512
776: #define AS_BASE_SIZE 11
777:
778: struct { /* ACTIVITY RESUME SPDU */
779: struct {
780: #define SMASK_AR_REF 0x0001
781: struct SSAPref un_ar_reference;
782:
783: #define SMASK_AR_OID 0x0002
784: struct SSAPactid un_ar_oid;
785:
786: #define SMASK_AR_SSN 0x0004
787: u_long un_ar_serial;
788: } un_ar_link;
789:
790: #define SMASK_AR_ID 0x0008
791: struct SSAPactid un_ar_id;
792: } un_ar;
793: #define AR_SIZE 512
794: #define AR_BASE_SIZE 29
795:
796: struct { /* ACTIVITY INTERRUPT (ABORT) SPDU */
797: #define SMASK_AI_REASON 0x0001 /* don't collide with SMASK_AB_DISC */
798: u_char un_ai_reason;
799: } un_ai;
800: #define AI_SIZE 0
801: #define AI_BASE_SIZE 3
802:
803: /* ACTIVITY INTERRUPT (ABORT) ACK SPDU */
804: #define AIA_SIZE 0
805: #define AIA_BASE_SIZE 0
806:
807:
808: struct { /* ACTIVITY DISCARD SPDU */
809: #define SMASK_AD_REASON 0x0001
810: u_char un_ad_reason;
811: } un_ad;
812: #define AD_SIZE 0
813: #define AD_BASE_SIZE 3
814:
815: /* ACTIVITY DISCARD ACK SPDU */
816: #define ADA_SIZE 0
817: #define ADA_BASE_SIZE 0
818:
819: /* ACTIVITY END (MAJOR SYNC) SPDU */
820: #define AE_SIZE 512
821: #define AE_BASE_SIZE 8
822:
823: /* ACTIVITY END (MAJOR SYNC) ACK SPDU */
824: #define AEA_SIZE MAA_SIZE
825: #define AEA_BASE_SIZE MAA_BASE_SIZE
826: } s_un;
827: #define s_cn_reference s_un.un_cn.un_cn_reference
828: #define s_options s_un.un_cn.un_cn_item.un_cn_options
829: #define s_tsdu_init s_un.un_cn.un_cn_item.un_cn_tsdu_init
830: #define s_tsdu_resp s_un.un_cn.un_cn_item.un_cn_tsdu_resp
831: #define s_cn_version s_un.un_cn.un_cn_item.un_cn_version
832: #define s_isn s_un.un_cn.un_cn_item.un_cn_isn
833: #define s_settings s_un.un_cn.un_cn_item.un_settings
834: #define s_ac_token s_un.un_cn.un_ac_token
835: #define s_cn_require s_un.un_cn.un_cn_requirements
836: #define s_calling s_un.un_cn.un_cn_calling
837: #define s_callinglen s_un.un_cn.un_cn_callinglen
838: #define s_called s_un.un_cn.un_cn_called
839: #define s_calledlen s_un.un_cn.un_cn_calledlen
840:
841: #define s_rf_reference s_un.un_rf.un_rf_reference
842: #define s_rf_disconnect s_un.un_rf.un_rf_disconnect
843: #define s_rf_require s_un.un_rf.un_rf_requirements
844: #define s_rf_version s_un.un_rf.un_rf_version
845: #define s_rdata s_un.un_rf.un_rf_rdata
846: #define s_rlen s_un.un_rf.un_rf_rlen
847:
848: #define s_fn_disconnect s_un.un_fn.un_fn_disconnect
849:
850: #define s_ab_disconnect s_un.un_ab.un_ab_disconnect
851: #define s_reflect s_un.un_ab.un_ab_reflect
852:
853: #define s_gt_token s_un.un_gt.un_gt_token
854:
855: #define s_pt_token s_un.un_pt.un_pt_token
856:
857: #define s_mip_sync s_un.un_mip.un_mip_sync
858: #define s_mip_serial s_un.un_mip.un_mip_serial
859:
860: #define s_mia_serial s_un.un_mia.un_mia_serial
861:
862: #define s_map_sync s_un.un_map.un_map_sync
863: #define s_map_serial s_un.un_map.un_map_serial
864:
865: #define s_maa_serial s_un.un_maa.un_maa_serial
866:
867: #define s_rs_settings s_un.un_rs.un_rs_settings
868: #define s_rs_type s_un.un_rs.un_rs_type
869: #define s_rs_serial s_un.un_rs.un_rs_serial
870:
871: #define s_ra_settings s_un.un_ra.un_ra_settings
872: #define s_ra_serial s_un.un_ra.un_ra_serial
873:
874: #define s_pr_type s_un.un_pr.un_pr_type
875:
876: #define s_ed_reason s_un.un_ed.un_ed_reason
877:
878: #define s_as_id s_un.un_as.un_as_id
879:
880: #define s_ar_reference s_un.un_ar.un_ar_link.un_ar_reference
881: #define s_ar_oid s_un.un_ar.un_ar_link.un_ar_oid
882: #define s_ar_serial s_un.un_ar.un_ar_link.un_ar_serial
883: #define s_ar_id s_un.un_ar.un_ar_id
884:
885: #define s_ai_reason s_un.un_ai.un_ai_reason
886:
887: #define s_ad_reason s_un.un_ad.un_ad_reason
888:
889:
890: #define SMASK_ENCLOSE 0x2000
891: u_char s_enclose;
892: #define ENCL_BEGIN 0x01 /* beginning of SSDU */
893: #define ENCL_END 0x02 /* end of SSDU */
894: #define ENCL_MASK (ENCL_BEGIN | ENCL_END)
895: #define ENCLOSE_MAX 65400 /* maximum size of enclosure per segment
896: less slop; slop varies based on SPDU, but
897: we'll always assume the worst case */
898: #define SEGMENT_MAX 65528 /* for things other than S-DATA and
899: S-TYPED-DATA under version 2 we allow only
900: ONE enclosure */
901:
902: #define SMASK_UDATA_PGI 0x4000
903: char *s_udata; /* user data PGI */
904: int s_ulen; /* .. */
905:
906: #define SMASK_SPDU_EXPD 0x8000 /* SPDU arrived on the expedited connection */
907:
908: struct qbuf s_qbuf; /* user info */
909: int s_qlen; /* .. */
910: };
911: #define NULLSPKT ((struct ssapkt *) 0)
912:
913:
914: int freespkt ();
915: struct ssapkt *newspkt ();
916:
917: void text2spkt (), spkt2text ();
918:
919: int spkt2tsdu ();
920: struct ssapkt *tsdu2spkt ();
921:
922: char *spkt2str ();
923: struct ssapkt *str2spkt ();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.