| 1 | /* ppkt.h - include file for presentation providers (PS-PROVIDER) */ |
| 2 | |
| 3 | /* |
| 4 | * $Header: /f/osi/h/RCS/ppkt.h,v 7.1 91/02/22 09:24:53 mrose Interim $ |
| 5 | * |
| 6 | * RFC1085 (LPP) support contributed by the Wollongong Group, Inc. |
| 7 | * |
| 8 | * |
| 9 | * $Log: ppkt.h,v $ |
| 10 | * Revision 7.1 91/02/22 09:24:53 mrose |
| 11 | * Interim 6.8 |
| 12 | * |
| 13 | * Revision 7.0 89/11/23 21:55:51 mrose |
| 14 | * Release 6.0 |
| 15 | * |
| 16 | */ |
| 17 | |
| 18 | /* |
| 19 | * NOTICE |
| 20 | * |
| 21 | * Acquisition, use, and distribution of this module and related |
| 22 | * materials are subject to the restrictions of a license agreement. |
| 23 | * Consult the Preface in the User's Manual for the full terms of |
| 24 | * this agreement. |
| 25 | * |
| 26 | */ |
| 27 | |
| 28 | |
| 29 | #ifndef _PSAP2_ |
| 30 | #include "psap2.h" /* definitions for PS-USERs */ |
| 31 | #endif |
| 32 | |
| 33 | #include "ssap.h" /* definitinos for SS-USERs */ |
| 34 | |
| 35 | /* \f */ |
| 36 | |
| 37 | #define psapPsig(pb, sd) \ |
| 38 | { \ |
| 39 | if ((pb = findpblk (sd)) == NULL) { \ |
| 40 | (void) sigiomask (smask); \ |
| 41 | return psaplose (pi, PC_PARAMETER, NULLCP, \ |
| 42 | "invalid presentation descriptor"); \ |
| 43 | } \ |
| 44 | if (!(pb -> pb_flags & PB_CONN)) { \ |
| 45 | (void) sigiomask (smask); \ |
| 46 | return psaplose (pi, PC_OPERATION, NULLCP, \ |
| 47 | "presentation descriptor not connected"); \ |
| 48 | } \ |
| 49 | if (pb -> pb_flags & PB_FINN) { \ |
| 50 | (void) sigiomask (smask); \ |
| 51 | return psaplose (pi, PC_OPERATION, NULLCP, \ |
| 52 | "presentation descriptor finishing"); \ |
| 53 | } \ |
| 54 | if (pb -> pb_flags & PB_RELEASE) { \ |
| 55 | (void) sigiomask (smask); \ |
| 56 | return psaplose (pi, PC_OPERATION, NULLCP, \ |
| 57 | "release in progress"); \ |
| 58 | } \ |
| 59 | } |
| 60 | |
| 61 | #define psapFsig(pb, sd) \ |
| 62 | { \ |
| 63 | if ((pb = findpblk (sd)) == NULL) { \ |
| 64 | (void) sigiomask (smask); \ |
| 65 | return psaplose (pi, PC_PARAMETER, NULLCP, \ |
| 66 | "invalid presentation descriptor"); \ |
| 67 | } \ |
| 68 | if (!(pb -> pb_flags & PB_CONN)) { \ |
| 69 | (void) sigiomask (smask); \ |
| 70 | return psaplose (pi, PC_OPERATION, NULLCP, \ |
| 71 | "presentation descriptor not connected"); \ |
| 72 | } \ |
| 73 | if (!(pb -> pb_flags & PB_FINN)) { \ |
| 74 | (void) sigiomask (smask); \ |
| 75 | return psaplose (pi, PC_OPERATION, NULLCP, \ |
| 76 | "presentation descriptor not finishing"); \ |
| 77 | } \ |
| 78 | if (pb -> pb_flags & PB_RELEASE) { \ |
| 79 | (void) sigiomask (smask); \ |
| 80 | return psaplose (pi, PC_OPERATION, NULLCP, \ |
| 81 | "release in progress"); \ |
| 82 | } \ |
| 83 | } |
| 84 | |
| 85 | #define toomuchP(b,n,m,p) \ |
| 86 | { \ |
| 87 | if (b == NULL) \ |
| 88 | n = 0; \ |
| 89 | else \ |
| 90 | if (n > m) \ |
| 91 | return psaplose (pi, PC_PARAMETER, NULLCP, \ |
| 92 | "too many %s user data elements", p); \ |
| 93 | } |
| 94 | |
| 95 | #define missingP(p) \ |
| 96 | { \ |
| 97 | if (p == NULL) \ |
| 98 | return psaplose (pi, PC_PARAMETER, NULLCP, \ |
| 99 | "mandatory parameter \"%s\" missing", "p"); \ |
| 100 | } |
| 101 | |
| 102 | #ifndef lint |
| 103 | #ifndef __STDC__ |
| 104 | #define copyPSAPdata(base,len,d) \ |
| 105 | { \ |
| 106 | register int i = len; \ |
| 107 | if ((d -> d/* */_cc = min (i, sizeof d -> d/* */_data)) > 0) \ |
| 108 | bcopy (base, d -> d/* */_data, d -> d/* */_cc); \ |
| 109 | } |
| 110 | #else |
| 111 | #define copyPSAPdata(base,len,d) \ |
| 112 | { \ |
| 113 | register int i = len; \ |
| 114 | if ((d -> d##_cc = min (i, sizeof d -> d##_data)) > 0) \ |
| 115 | bcopy (base, d -> d##_data, d -> d##_cc); \ |
| 116 | } |
| 117 | #endif |
| 118 | #else |
| 119 | #define copyPSAPdata(base,len,d) bcopy (base, (char *) d, len) |
| 120 | #endif |
| 121 | |
| 122 | |
| 123 | #define pylose(p) \ |
| 124 | ppktlose (pb, pi, PC_UNRECOGNIZED, (p), NULLCP, "%s", PY_pepy) |
| 125 | |
| 126 | |
| 127 | int ppktlose (), psaplose (); |
| 128 | |
| 129 | /* \f */ |
| 130 | |
| 131 | #define DFLT_ASN "iso asn.1 abstract syntax" |
| 132 | #define DFLT_ATN BER |
| 133 | |
| 134 | #define atn_is_ok(pb,atn) atn_is_ber ((pb), (atn)) |
| 135 | #define atn_is_ber(pb,atn) (!oid_cmp (pb -> pb_ber, atn)) |
| 136 | |
| 137 | |
| 138 | struct psapblk { |
| 139 | struct psapblk *pb_forw; /* doubly-linked list */ |
| 140 | struct psapblk *pb_back; /* .. */ |
| 141 | |
| 142 | int pb_fd; /* session descriptor */ |
| 143 | |
| 144 | short pb_flags; /* our state */ |
| 145 | #define PB_NULL 0x00 |
| 146 | #define PB_CONN 0x01 /* connected */ |
| 147 | #define PB_FINN 0x02 /* other side wants to finish */ |
| 148 | #define PB_ASYN 0x04 /* asynchronous */ |
| 149 | #define PB_DFLT 0x10 /* respond with default context result */ |
| 150 | #define PB_RELEASE 0x20 /* release in progress */ |
| 151 | |
| 152 | #ifndef LPP |
| 153 | char *pb_retry; /* initial/final ppkt */ |
| 154 | char *pb_realbase; |
| 155 | int pb_len; |
| 156 | #else |
| 157 | PE pb_retry; |
| 158 | PE pb_response; |
| 159 | |
| 160 | struct type_PS_SessionConnectionIdentifier *pb_reference; |
| 161 | |
| 162 | PS pb_stream; |
| 163 | |
| 164 | int pb_reliability; |
| 165 | |
| 166 | int pb_maxtries; |
| 167 | int pb_tries; |
| 168 | #endif |
| 169 | |
| 170 | int pb_ncontext; /* presentation context set */ |
| 171 | struct PSAPcontext pb_contexts[NPCTX]; |
| 172 | |
| 173 | OID pb_asn; /* default: abstract syntax name */ |
| 174 | OID pb_atn; /* .. abstract transfer name */ |
| 175 | int pb_result; /* response */ |
| 176 | |
| 177 | OID pb_ber; /* BER */ |
| 178 | |
| 179 | int pb_prequirements; /* presentation requirements */ |
| 180 | |
| 181 | int pb_srequirements; /* our session requirements */ |
| 182 | int pb_urequirements; /* user's session requirements */ |
| 183 | int pb_owned; /* session tokens we own */ |
| 184 | int pb_avail; /* session tokens available */ |
| 185 | int pb_ssdusize; /* largest atomic SSDU */ |
| 186 | |
| 187 | #ifdef LPP |
| 188 | struct NSAPaddr pb_initiating; /* initiator */ |
| 189 | #endif |
| 190 | struct PSAPaddr pb_responding; /* responder */ |
| 191 | |
| 192 | IFP pb_DataIndication; /* INDICATION handlers */ |
| 193 | IFP pb_TokenIndication; /* .. */ |
| 194 | IFP pb_SyncIndication; /* .. */ |
| 195 | IFP pb_ActivityIndication; /* .. */ |
| 196 | IFP pb_ReportIndication; /* .. */ |
| 197 | IFP pb_ReleaseIndication; /* .. */ |
| 198 | IFP pb_AbortIndication; /* .. */ |
| 199 | |
| 200 | #ifdef LPP |
| 201 | IFP pb_retryfnx; |
| 202 | IFP pb_closefnx; |
| 203 | IFP pb_selectfnx; |
| 204 | IFP pb_checkfnx; |
| 205 | #endif |
| 206 | }; |
| 207 | #define NULLPB ((struct psapblk *) 0) |
| 208 | |
| 209 | int freepblk (); |
| 210 | struct psapblk *newpblk (), *findpblk (); |
| 211 | |
| 212 | #ifndef LPP |
| 213 | #define PC_PROV_BASE PC_NOTSPECIFIED |
| 214 | #define PC_ABORT_BASE \ |
| 215 | (PC_UNRECOGNIZED - int_PS_Abort__reason_unrecognized__ppdu) |
| 216 | #define PC_REASON_BASE \ |
| 217 | (PC_ABSTRACT - int_PS_provider__reason_abstract__syntax__not__supported) |
| 218 | |
| 219 | |
| 220 | struct type_PS_User__data *info2ppdu (); |
| 221 | int ppdu2info (); |
| 222 | |
| 223 | int info2ssdu (), ssdu2info (), qbuf2info (); |
| 224 | |
| 225 | struct qbuf *info2qb (); |
| 226 | int qb2info (); |
| 227 | |
| 228 | struct type_PS_Identifier__list *silly_list (); |
| 229 | |
| 230 | int ss2pslose (), ss2psabort (); |
| 231 | |
| 232 | |
| 233 | struct pair { |
| 234 | int p_mask; |
| 235 | int p_bitno; |
| 236 | }; |
| 237 | |
| 238 | extern struct pair preq_pairs[], sreq_pairs[]; |
| 239 | #endif |
| 240 | |
| 241 | /* \f */ |
| 242 | |
| 243 | #define REASON_BASE PC_NOTSPECIFIED |
| 244 | |
| 245 | #ifndef LPP |
| 246 | #define PPDU_NONE (-1) |
| 247 | #define PPDU_CP 0 |
| 248 | #define PPDU_CPA 1 |
| 249 | #define PPDU_CPR 2 |
| 250 | #define PPDU_ARU 3 |
| 251 | #define PPDU_ARP 4 |
| 252 | #define PPDU_TD 7 |
| 253 | #define PPDU_RS 12 |
| 254 | #define PPDU_RSA 13 |
| 255 | #else |
| 256 | #define PR_KERNEL 0x0000 /* kernel (yuk) */ |
| 257 | |
| 258 | #define NPCTX_PS 2 /* maximum number of contexts */ |
| 259 | #define NPDATA_PS 1 /* maximum number of PDVs in a request */ |
| 260 | #define PCI_ROSE 1 /* PCI for SASE using ROSE */ |
| 261 | #define PCI_ACSE 3 /* PCI for ACSE */ |
| 262 | |
| 263 | #define PT_TCP 'T' /* TCP providing backing */ |
| 264 | #define PT_UDP 'U' /* UDP providing backing */ |
| 265 | |
| 266 | #define NULLRF ((struct type_PS_SessionConnectionIdentifier *) 0) |
| 267 | |
| 268 | |
| 269 | #define pslose(pi,reason) \ |
| 270 | (reason != PS_ERR_NONE && reason != PS_ERR_IO \ |
| 271 | ? psaplose ((pi), PC_CONGEST, NULLCP, "%s", ps_error (reason)) \ |
| 272 | : psaplose ((pi), PC_SESSION, NULLCP, NULLCP)) |
| 273 | |
| 274 | |
| 275 | int pdu2sel (), refcmp (); |
| 276 | struct SSAPref *pdu2ref (); |
| 277 | #endif |