Commit | Line | Data |
---|---|---|
2596a09e WJ |
1 | /* fpkt.h - include file for FTAM provider (FS-PROVIDER) */ |
2 | ||
3 | /* | |
4 | * $Header: /f/osi/h/RCS/fpkt.h,v 7.5 91/02/22 09:24:37 mrose Interim $ | |
5 | * | |
6 | * | |
7 | * $Log: fpkt.h,v $ | |
8 | * Revision 7.5 91/02/22 09:24:37 mrose | |
9 | * Interim 6.8 | |
10 | * | |
11 | * Revision 7.4 90/11/21 11:32:05 mrose | |
12 | * sun | |
13 | * | |
14 | * Revision 7.3 90/07/01 21:03:44 mrose | |
15 | * pepsy | |
16 | * | |
17 | * Revision 7.2 90/03/23 10:52:53 mrose | |
18 | * update | |
19 | * | |
20 | * Revision 7.1 89/12/14 10:03:41 mrose | |
21 | * bdt | |
22 | * | |
23 | * Revision 7.0 89/11/23 21:55:40 mrose | |
24 | * Release 6.0 | |
25 | * | |
26 | */ | |
27 | ||
28 | /* | |
29 | * NOTICE | |
30 | * | |
31 | * Acquisition, use, and distribution of this module and related | |
32 | * materials are subject to the restrictions of a license agreement. | |
33 | * Consult the Preface in the User's Manual for the full terms of | |
34 | * this agreement. | |
35 | * | |
36 | */ | |
37 | ||
38 | ||
39 | #include "FTAM-types.h" | |
40 | ||
41 | #ifndef _FTAM_ | |
42 | #include "ftam.h" /* definitions for FS-USERs */ | |
43 | #endif | |
44 | #ifndef _AcSAP_ | |
45 | #include "acsap.h" /* definitions for AcS-USERs */ | |
46 | #endif | |
47 | ||
48 | /* \f */ | |
49 | ||
50 | #define FS_GEN(fsb) \ | |
51 | ((fsb -> fsb_flags & FSB_INIT) ? FS_GEN_INITIATOR : FS_GEN_RESPONDER) | |
52 | ||
53 | #define ftamPsig(fsb, sd) \ | |
54 | { \ | |
55 | if ((fsb = findfsblk (sd)) == NULL) { \ | |
56 | (void) sigiomask (smask); \ | |
57 | return ftamlose (fti, FS_GEN_NOREASON, 0, NULLCP, \ | |
58 | "invalid ftam descriptor"); \ | |
59 | } \ | |
60 | if (!(fsb -> fsb_flags & FSB_CONN)) { \ | |
61 | (void) sigiomask (smask); \ | |
62 | return ftamlose (fti, FS_GEN (fsb), 0, NULLCP, \ | |
63 | "ftam descriptor not connected"); \ | |
64 | } \ | |
65 | if (fsb -> fsb_flags & FSB_FINN) { \ | |
66 | (void) sigiomask (smask); \ | |
67 | return ftamlose (fti, FS_GEN (fsb), 0, NULLCP, \ | |
68 | "ftam descriptor finishing"); \ | |
69 | } \ | |
70 | } | |
71 | ||
72 | #define ftamFsig(fsb, sd) \ | |
73 | { \ | |
74 | if ((fsb = findfsblk (sd)) == NULL) { \ | |
75 | (void) sigiomask (smask); \ | |
76 | return ftamlose (fti, FS_GEN_NOREASON, 0, NULLCP, \ | |
77 | "invalid ftam descriptor"); \ | |
78 | } \ | |
79 | if (!(fsb -> fsb_flags & FSB_CONN)) { \ | |
80 | (void) sigiomask (smask); \ | |
81 | return ftamlose (fti, FS_GEN (fsb), 0, NULLCP, \ | |
82 | "ftam descriptor not connected"); \ | |
83 | } \ | |
84 | if (!(fsb -> fsb_flags & FSB_FINN)) { \ | |
85 | (void) sigiomask (smask); \ | |
86 | return ftamlose (fti, FS_GEN (fsb), 0, NULLCP, \ | |
87 | "ftam descriptor not finishing"); \ | |
88 | } \ | |
89 | } | |
90 | ||
91 | #define toomuchP(b,n,m,p) \ | |
92 | { \ | |
93 | if (b == NULL) \ | |
94 | n = 0; \ | |
95 | else \ | |
96 | if (n > m) \ | |
97 | return ftamlose (fti, FS_GEN_NOREASON, 0, NULLCP, \ | |
98 | "too many %ss", p); \ | |
99 | } | |
100 | ||
101 | #define missingP(p) \ | |
102 | { \ | |
103 | if (p == NULL) \ | |
104 | return ftamlose (fti, FS_GEN_NOREASON, 0, NULLCP, \ | |
105 | "mandatory parameter \"%s\" missing", "p"); \ | |
106 | } | |
107 | ||
108 | #ifndef lint | |
109 | #ifndef __STDC__ | |
110 | #define copyFTAMdata(base,len,d) \ | |
111 | { \ | |
112 | register int i = len; \ | |
113 | if ((d -> d/* */_cc = min (i, sizeof d -> d/* */_data)) > 0) \ | |
114 | bcopy (base, d -> d/* */_data, d -> d/* */_cc); \ | |
115 | } | |
116 | #else | |
117 | #define copyFTAMdata(base,len,d) \ | |
118 | { \ | |
119 | register int i = len; \ | |
120 | if ((d -> d##_cc = min (i, sizeof d -> d##_data)) > 0) \ | |
121 | bcopy (base, d -> d##_data, d -> d##_cc); \ | |
122 | } | |
123 | #endif | |
124 | #else | |
125 | #define copyFTAMdata(base,len,d) bcopy (base, (char *) d, len) | |
126 | #endif | |
127 | ||
128 | ||
129 | int ftamlose (), fpktlose (), ftamoops (); | |
130 | ||
131 | /* \f */ | |
132 | ||
133 | struct ftamblk { | |
134 | struct ftamblk *fsb_forw; /* doubly-linked list */ | |
135 | struct ftamblk *fsb_back; /* .. */ | |
136 | ||
137 | int fsb_fd; /* association descriptor */ | |
138 | ||
139 | short fsb_flags; /* our state */ | |
140 | #define FSB_NULL 0x0000 | |
141 | #define FSB_CONN 0x0001 /* connected */ | |
142 | #define FSB_FINN 0x0002 /* other side wants to finish */ | |
143 | #define FSB_INIT 0x0004 /* this side initiated the association */ | |
144 | #define FSB_ASYN 0x0008 /* asynchronous */ | |
145 | #define FSB_DECHARGE 0x0010 /* responder can using charging on deselect */ | |
146 | #define FSB_CANCEL 0x0020 /* this side started F-CANCEL */ | |
147 | #define FSB_COLLIDE 0x0040 /* collision */ | |
148 | ||
149 | short fsb_state; /* more state */ | |
150 | #define FSB_INITIALIZED 0 /* initialized */ | |
151 | #define FSB_MANAGEMENT 1 /* management */ | |
152 | #define FSB_BULKBEGIN 2 /* bulk data begin */ | |
153 | #define FSB_BULKEND 3 /* bulk data end */ | |
154 | #define FSB_DATAIDLE 4 /* data transfer idle */ | |
155 | #define FSB_LOCATE 5 /* locate in progress */ | |
156 | #define FSB_ERASE 6 /* erase in progress */ | |
157 | #define FSB_DATAREAD 7 /* data transfer read */ | |
158 | #define FSB_DATAWRITE 8 /* data transfer write */ | |
159 | #define FSB_DATAFIN1 9 /* data transfer done */ | |
160 | #define FSB_DATAFIN2 10 /* .. */ | |
161 | #define FSB_DATACANCEL 11 /* cancel in progress */ | |
162 | ||
163 | int fsb_group; /* group flags */ | |
164 | ||
165 | int fsb_srequirements; /* session requirements */ | |
166 | int fsb_owned; /* session tokens we own */ | |
167 | int fsb_avail; /* session tokens available */ | |
168 | int fsb_settings; /* initial and resync settings */ | |
169 | long fsb_ssn; /* serial number */ | |
170 | struct SSAPref fsb_connect; /* session connection reference */ | |
171 | int fsb_ssdusize; /* largest atomic SSDU */ | |
172 | ||
173 | int fsb_id; /* FTAM context id */ | |
174 | int fsb_prequirements; /* presentation requirements */ | |
175 | struct PSAPctxlist fsb_contexts;/* presentation contexts */ | |
176 | struct FTAMcontentlist fsb_contents; /* FTAM document types */ | |
177 | ||
178 | OID fsb_context; /* application context */ | |
179 | ||
180 | int fsb_fqos; /* ftam-QoS */ | |
181 | int fsb_class; /* service-class */ | |
182 | int fsb_units; /* functional-units */ | |
183 | /* mandatory functional-units */ | |
184 | #define FUNITS_TRANSFER (FUNIT_GROUPING) | |
185 | #define FUNITS_ACCESS (FUNIT_READ | FUNIT_WRITE | FUNIT_ACCESS) | |
186 | #define FUNITS_MANAGE (FUNIT_LIMITED | FUNIT_GROUPING) | |
187 | #define FUNITS_TM (FUNIT_LIMITED | FUNIT_GROUPING) | |
188 | #define FUNITS_UNCONS (0) | |
189 | ||
190 | int fsb_attrs; /* attribute-groups */ | |
191 | ||
192 | IFP fsb_indication; /* event handler */ | |
193 | ||
194 | struct PSAPdata fsb_data; /* for screwy BDT stuff */ | |
195 | ||
196 | int fsb_cancelaction; /* handle CANCEL collisions */ | |
197 | PE fsb_cancelshared; | |
198 | struct FTAMdiagnostic *fsb_canceldiags; | |
199 | int fsb_cancelndiag; | |
200 | ||
201 | IFP fsb_trace; /* user-defined tracing function */ | |
202 | }; | |
203 | #define NULLFSB ((struct ftamblk *) 0) | |
204 | ||
205 | int freefsblk (); | |
206 | struct ftamblk *newfsblk (), *findfsblk (); | |
207 | ||
208 | #ifndef lint | |
209 | #define fsbtrace(fsb,a) if ((fsb) -> fsb_trace) (*((fsb) -> fsb_trace)) a | |
210 | #else | |
211 | #define fsbtrace(fsb,a) FTraceHook a | |
212 | #endif | |
213 | ||
214 | /* \f */ | |
215 | ||
216 | struct pair { | |
217 | int p_mask; | |
218 | int p_bitno; | |
219 | }; | |
220 | ||
221 | extern struct pair fclass_pairs[], | |
222 | funit_pairs[], | |
223 | fattr_pairs[], | |
224 | fname_pairs[], | |
225 | fmode_pairs[], | |
226 | frequested_pairs[], | |
227 | fpermitted_pairs[]; | |
228 | /* \f */ | |
229 | ||
230 | struct type_FTAM_Access__Control__List *acl2fpm (); | |
231 | int fpm2acl (); | |
232 | ||
233 | struct type_FTAM_Read__Attributes *attr2fpm (); | |
234 | int fpm2attr (); | |
235 | ||
236 | PE bits2fpm (); | |
237 | int fpm2bits (); | |
238 | ||
239 | struct type_FTAM_Charging *chrg2fpm (); | |
240 | int fpm2chrg (); | |
241 | ||
242 | struct type_FTAM_Concurrency__Access *conacc2fpm (); | |
243 | int fpm2conacc (); | |
244 | ||
245 | struct type_FTAM_Concurrency__Control *conctl2fpm (); | |
246 | int fpm2conctl (); | |
247 | #define conctl_present(fc) \ | |
248 | ((fc) -> fc_readlock != FLOCK_NOTREQD \ | |
249 | || (fc) -> fc_insertlock != FLOCK_NOTREQD \ | |
250 | || (fc) -> fc_replacelock != FLOCK_NOTREQD \ | |
251 | || (fc) -> fc_extendlock != FLOCK_NOTREQD \ | |
252 | || (fc) -> fc_eraselock != FLOCK_NOTREQD \ | |
253 | || (fc) -> fc_readattrlock != FLOCK_NOTREQD \ | |
254 | || (fc) -> fc_chngattrlock != FLOCK_NOTREQD \ | |
255 | || (fc) -> fc_deletelock != FLOCK_NOTREQD) \ | |
256 | ||
257 | ||
258 | struct type_FTAM_Diagnostic *diag2fpm (); | |
259 | int fpm2diag (); | |
260 | ||
261 | struct type_FTAM_FADU__Identity *faduid2fpm (); | |
262 | int fpm2faduid (); | |
263 | ||
264 | struct type_FTAM_Access__Passwords *pass2fpm (); | |
265 | int fpm2pass (); | |
266 | #define passes_present(fp) \ | |
267 | ((fp) -> fp_read || (fp) -> fp_insert || (fp) -> fp_replace \ | |
268 | || (fp) -> fp_extend || (fp) -> fp_erase || (fp) -> fp_readattr \ | |
269 | || (fp) -> fp_chngattr || (fp) -> fp_delete) \ | |
270 | ||
271 | struct type_FTAM_Shared__ASE__Information *shared2fpm (); | |
272 | int fpm2shared (); | |
273 | ||
274 | /* \f */ | |
275 | ||
276 | int acs2ftamlose (), acs2ftamabort (); | |
277 | int ps2ftamlose (); |