|
|
1.1 root 1: /* ftamgroup1.c - FPM: initiate a grouped transaction */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/ftam/RCS/ftamgroup1.c,v 7.0 89/11/23 21:53:37 mrose Rel $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/ftam/RCS/ftamgroup1.c,v 7.0 89/11/23 21:53:37 mrose Rel $
9: *
10: *
11: * $Log: ftamgroup1.c,v $
12: * Revision 7.0 89/11/23 21:53:37 mrose
13: * Release 6.0
14: *
15: */
16:
17: /*
18: * NOTICE
19: *
20: * Acquisition, use, and distribution of this module and related
21: * materials are subject to the restrictions of a license agreement.
22: * Consult the Preface in the User's Manual for the full terms of
23: * this agreement.
24: *
25: */
26:
27:
28: /* LINTLIBRARY */
29:
30: #include <stdio.h>
31: #include <signal.h>
32: #include "fpkt.h"
33:
34: /* F-{MANAGE,BULK-{BEGIN,END}}.REQUEST (group) */
35:
36: int FManageRequest (sd, ftg, fti)
37: int sd;
38: struct FTAMgroup *ftg;
39: struct FTAMindication *fti;
40: {
41: return FGroupRequest (sd, ftg, FTI_MANAGEMENT, FSB_MANAGEMENT, fti);
42: }
43:
44:
45: int FBulkBeginRequest (sd, ftg, fti)
46: int sd;
47: struct FTAMgroup *ftg;
48: struct FTAMindication *fti;
49: {
50: return FGroupRequest (sd, ftg, FTI_BULKBEGIN, FSB_BULKBEGIN, fti);
51: }
52:
53:
54: int FBulkEndRequest (sd, ftg, fti)
55: int sd;
56: struct FTAMgroup *ftg;
57: struct FTAMindication *fti;
58: {
59: return FGroupRequest (sd, ftg, FTI_BULKEND, FSB_BULKEND, fti);
60: }
61:
62: /* F-GROUP.REQUEST (group) */
63:
64: static int FGroupRequest (sd, ftg, type, state, fti)
65: int sd;
66: struct FTAMgroup *ftg;
67: int type,
68: state;
69: struct FTAMindication *fti;
70: {
71: SBV smask;
72: int result;
73: register struct ftamblk *fsb;
74:
75: missingP (ftg);
76: missingP (fti);
77:
78: smask = sigioblock ();
79:
80: ftamPsig (fsb, sd);
81:
82: if ((result = figrpchk (fsb, ftg, type, fti)) != NOTOK)
83: result = FGroupRequestAux (fsb, ftg, state, fti);
84:
85: (void) sigiomask (smask);
86:
87: return result;
88: }
89:
90: /* */
91:
92: static int FGroupRequestAux (fsb, ftg, state, fti)
93: register struct ftamblk *fsb;
94: register struct FTAMgroup *ftg;
95: int state;
96: struct FTAMindication *fti;
97: {
98: register int i;
99: int did_loop,
100: npdu,
101: result;
102: char **txp,
103: *texts[NPDATA];
104: PE pe,
105: *pep,
106: info[NPDATA];
107: struct PSAPindication pis;
108: struct PSAPindication *pi = &pis;
109: struct PSAPabort *pa = &pi -> pi_abort;
110: struct type_FTAM_PDU **pdup,
111: *pdus[NPDATA];
112:
113: bzero ((char *) texts, sizeof texts);
114: bzero ((char *) info, sizeof info);
115: bzero ((char *) pdus, sizeof pdus);
116:
117: did_loop = 0;
118: if ((result = figrp2pdus (fsb, ftg, pdus, texts, &npdu, fti)) == NOTOK)
119: goto out;
120:
121: for (pdup = pdus, pep = info, txp = texts, i = npdu - 1;
122: i >= 0;
123: pdup++, pep++, txp++, i--) {
124: pe = NULLPE;
125: if (encode_FTAM_PDU (&pe, 1, 0, NULLCP, *pdup) == NOTOK) {
126: result = ftamlose (fti, FS_GEN (fsb), 1, NULLCP,
127: "error encoding PDU: %s", PY_pepy);
128: goto out;
129: }
130: (*pep = pe) -> pe_context = fsb -> fsb_id;
131:
132: fsbtrace (fsb, (fsb -> fsb_fd, "P-DATA.REQUEST", *txp, pe, 0));
133: }
134: did_loop = 1;
135:
136: result = PDataRequest (fsb -> fsb_fd, info, npdu, pi);
137:
138: out: ;
139: for (pdup = pdus, pep = info, i = NPDATA - 1;
140: i >= 0;
141: pdup++, pep++, i--) {
142: if (*pep)
143: pe_free (*pep);
144: if (*pdup)
145: free_FTAM_PDU (*pdup);
146: }
147:
148: if (result == NOTOK) {
149: if (did_loop)
150: (void) ps2ftamlose (fsb, fti, "PDataRequest", pa);
151: if (fti -> fti_abort.fta_action == FACTION_PERM)
152: freefsblk (fsb);
153:
154: return NOTOK;
155: }
156:
157: fsb -> fsb_state = state;
158: fsb -> fsb_group = ftg -> ftg_flags;
159:
160: return FWaitRequestAux (fsb, NOTOK, fti);
161: }
162:
163: /* */
164:
165: static int figrpchk (fsb, ftg, type, fti)
166: register struct ftamblk *fsb;
167: register struct FTAMgroup *ftg;
168: int type;
169: struct FTAMindication *fti;
170: {
171: int i,
172: request;
173: register struct FTAMpasswords *fp;
174: register struct FTAMconcurrency *fc;
175:
176: if (!(fsb -> fsb_flags & FSB_INIT))
177: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP, "not initiator");
178: switch (fsb -> fsb_state) {
179: case FSB_INITIALIZED:
180: if (type == FTI_BULKEND)
181: goto wrong_state;
182: break;
183:
184: case FSB_DATAIDLE:
185: if (type != FTI_BULKEND)
186: goto wrong_state;
187: break;
188:
189: default:
190: wrong_state: ;
191: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP, "wrong state");
192: }
193:
194: switch (fsb -> fsb_class) {
195: case FCLASS_TRANSFER:
196: if (type != FTI_MANAGEMENT)
197: break;
198: goto bad_class;
199:
200: case FCLASS_MANAGE:
201: if (type == FTI_MANAGEMENT)
202: break;
203: goto bad_class;
204:
205: case FCLASS_TM:
206: case FCLASS_ACCESS:
207: break;
208:
209: default:
210: bad_class: ;
211: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
212: "file management not permitted");
213: }
214:
215: if (!(ftg -> ftg_flags & FTG_BEGIN) || !(ftg -> ftg_flags & FTG_END))
216: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP, "must be grouped");
217:
218: switch (type) {
219: case FTI_MANAGEMENT:
220: case FTI_BULKBEGIN:
221: if ((ftg -> ftg_flags & (FTG_SELECT | FTG_CREATE)) == 0
222: || (ftg -> ftg_flags & (FTG_SELECT | FTG_CREATE))
223: == (FTG_SELECT | FTG_CREATE))
224: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
225: "missing/duplicate select/create request");
226: if (type == FTI_MANAGEMENT) {
227: if (ftg -> ftg_flags & (FTG_OPEN | FTG_CLOSE))
228: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
229: "file transfer not permitted");
230: goto finish_end;
231: }
232: if (!(ftg -> ftg_flags & FTG_OPEN))
233: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
234: "missing open request");
235: if (ftg -> ftg_flags & (FTG_CLOSE | FTG_DESELECT | FTG_DELETE))
236: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
237: "file management/close not permitted");
238: break;
239:
240: case FTI_BULKEND:
241: if (ftg -> ftg_flags & (FTG_SELECT | FTG_CREATE | FTG_OPEN))
242: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
243: "file management/open not permitted");
244: if ((ftg -> ftg_flags & FTG_CLOSE) == 0)
245: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
246: "missing close request");
247:
248: finish_end: ;
249: if ((ftg -> ftg_flags & (FTG_DESELECT | FTG_DELETE)) == 0
250: || (ftg -> ftg_flags & (FTG_DESELECT | FTG_DELETE))
251: == (FTG_DESELECT | FTG_DELETE))
252: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
253: "missing/duplicate deselect/delete request");
254: break;
255: }
256:
257: if (!(fsb -> fsb_units & FUNIT_GROUPING)
258: && (ftg -> ftg_flags & (FTG_BEGIN | FTG_END)))
259: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
260: "grouping not permitted");
261: if (!(fsb -> fsb_units & FUNIT_LIMITED)
262: && (ftg -> ftg_flags & (FTG_CREATE | FTG_RDATTR | FTG_DELETE)))
263: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
264: "limited file management not permitted");
265: if (!(fsb -> fsb_units & FUNIT_ENHANCED)
266: && (ftg -> ftg_flags & FTG_CHATTR))
267: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
268: "enhanced file management not permitted");
269:
270: i = 0;
271:
272: if (ftg -> ftg_flags & FTG_SELECT) {
273: register struct FTAMselect *ftse = &ftg -> ftg_select;
274:
275: if (ftse -> ftse_attrs.fa_present != FA_FILENAME)
276: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
277: "only filename should be present");
278: if (ftse -> ftse_access & ~FA_REQ_MASK)
279: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
280: "FADU-Identity groups not permitted");
281:
282: request = ftse -> ftse_access;
283: fp = &ftse -> ftse_pwds;
284: fc = &ftse -> ftse_conctl;
285:
286: goto finish_create;
287: }
288:
289: if (ftg -> ftg_flags & FTG_CREATE) {
290: register struct FTAMcreate *ftce = &ftg -> ftg_create;
291:
292: switch (ftce -> ftce_override) {
293: case FOVER_FAIL:
294: case FOVER_SELECT:
295: case FOVER_WRITE:
296: case FOVER_DELETE:
297: break;
298:
299: default:
300: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
301: "bad value for creation mode");
302: }
303: if (!(ftce -> ftce_attrs.fa_present & FA_FILENAME))
304: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
305: "filename not present");
306: if (!(ftce -> ftce_attrs.fa_present & FA_ACTIONS))
307: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
308: "permitted-actions not present");
309: if (!(ftce -> ftce_attrs.fa_present & FA_CONTENTS))
310: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
311: "contents-type not present");
312: if (ftce -> ftce_attrs.fa_present & ~FA_CRE_ATTRS)
313: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
314: "illegal attributes present");
315: if (!(fsb -> fsb_attrs & FATTR_STORAGE)
316: && (ftce -> ftce_attrs.fa_present & FA_STORAGE))
317: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
318: "storage attributes not permitted");
319: if (!(fsb -> fsb_attrs & FATTR_SECURITY)
320: && (ftce -> ftce_attrs.fa_present & FA_SECURITY))
321: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
322: "security attributes not permitted");
323: if (ftce -> ftce_access & ~FA_REQ_MASK)
324: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
325: "FADU-Identity groups not permitted");
326:
327: request = ftce -> ftce_access;
328: fp = &ftce -> ftce_pwds;
329: fc = &ftce -> ftce_conctl;
330:
331: finish_create: ;
332: if (!(fsb -> fsb_attrs & FATTR_SECURITY) && passes_present (fp))
333: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
334: "access passwords not permitted");
335: if (fsb -> fsb_attrs & FATTR_STORAGE) {
336: if ((!(request & FA_PERM_READ)
337: && fc -> fc_readlock < FLOCK_PRESENT)
338: || (!(request & FA_PERM_INSERT)
339: && fc -> fc_insertlock < FLOCK_PRESENT)
340: || (!(request & FA_PERM_REPLACE)
341: && fc -> fc_replacelock < FLOCK_PRESENT)
342: || (!(request & FA_PERM_ERASE)
343: && fc -> fc_eraselock < FLOCK_PRESENT)
344: || (!(request & FA_PERM_EXTEND)
345: && fc -> fc_extendlock < FLOCK_PRESENT)
346: || (!(request & FA_PERM_READATTR)
347: && fc -> fc_readattrlock < FLOCK_PRESENT)
348: || (!(request & FA_PERM_CHNGATTR)
349: && fc -> fc_chngattrlock < FLOCK_PRESENT)
350: || (!(request & FA_PERM_DELETE)
351: && fc -> fc_deletelock < FLOCK_PRESENT))
352: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
353: "bad settings for select/create concurrency control");
354: }
355:
356: i++;
357: }
358:
359: if (ftg -> ftg_flags & FTG_CLOSE) {
360: register struct FTAMclose *ftcl = &ftg -> ftg_close;
361:
362: switch (ftcl -> ftcl_action) {
363: case FACTION_SUCCESS:
364: case FACTION_TRANS:
365: case FACTION_PERM:
366: break;
367:
368: default:
369: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
370: "bad value for close action parameter");
371: }
372:
373: if (ftcl -> ftcl_ndiag > NFDIAG)
374: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
375: "too many close diagnostics");
376:
377: i++;
378: }
379:
380: if (ftg -> ftg_flags & FTG_RDATTR) {
381: register struct FTAMreadattr *ftra = &ftg -> ftg_readattr;
382:
383: if (!(fsb -> fsb_attrs & FATTR_STORAGE)
384: && (ftra -> ftra_attrnames & FA_STORAGE))
385: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
386: "storage attributes not permitted");
387: if (!(fsb -> fsb_attrs & FATTR_SECURITY)
388: && (ftra -> ftra_attrnames & FA_SECURITY))
389: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
390: "security attributes not permitted");
391:
392: i++;
393: }
394:
395: if (ftg -> ftg_flags & FTG_CHATTR) {
396: register struct FTAMchngattr *ftca = &ftg -> ftg_chngattr;
397:
398: if (ftca -> ftca_attrs.fa_present & ftca -> ftca_attrs.fa_novalue)
399: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
400: "attributes can not be changed to no-value-available");
401: if (!(fsb -> fsb_attrs & FATTR_STORAGE)
402: && (ftca -> ftca_attrs.fa_present & FA_STORAGE))
403: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
404: "storage attributes not permitted");
405: if (!(fsb -> fsb_attrs & FATTR_SECURITY)
406: && (ftca -> ftca_attrs.fa_present & FA_SECURITY))
407: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
408: "security attributes not permitted");
409: if (ftca -> ftca_attrs.fa_present & FA_CONTROL)
410: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
411: "encoding of access-control not supported (yet)");
412:
413: i++;
414: }
415:
416: if (ftg -> ftg_flags & FTG_DESELECT)
417: i++;
418:
419: if (ftg -> ftg_flags & FTG_DELETE)
420: i++;
421:
422: if (ftg -> ftg_flags & FTG_OPEN) {
423: register struct FTAMopen *ftop = &ftg -> ftg_open;
424:
425: if ((request = ftop -> ftop_mode) & ~FA_MODE_MASK)
426: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
427: "bad open mode");
428: #ifdef notdef
429: if (ftop -> ftop_contents == NULLOID)
430: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
431: "missing contents type in open");
432: #endif
433: if (fsb -> fsb_attrs & FATTR_STORAGE) {
434: fc = &ftop -> ftop_conctl;
435: if ((!(request & FA_PERM_READ)
436: && fc -> fc_readlock < FLOCK_PRESENT)
437: || (!(request & FA_PERM_INSERT)
438: && fc -> fc_insertlock < FLOCK_PRESENT)
439: || (!(request & FA_PERM_REPLACE)
440: && fc -> fc_replacelock < FLOCK_PRESENT)
441: || (!(request & FA_PERM_ERASE)
442: && fc -> fc_eraselock < FLOCK_PRESENT)
443: || (!(request & FA_PERM_EXTEND)
444: && fc -> fc_extendlock < FLOCK_PRESENT)
445: || fc -> fc_readattrlock != FLOCK_NOTREQD
446: || fc -> fc_chngattrlock != FLOCK_NOTREQD
447: || fc -> fc_deletelock != FLOCK_NOTREQD)
448: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
449: "bad settings for open concurrency control");
450: }
451:
452: i++;
453: }
454:
455: if (i != ftg -> ftg_threshold)
456: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
457: "threshold mismatch; expecting %d, found %d",
458: ftg -> ftg_threshold, i);
459:
460: return OK;
461: }
462:
463: /* */
464:
465: static int figrp2pdus (fsb, ftg, pdus, texts, npdu, fti)
466: register struct ftamblk *fsb;
467: register struct FTAMgroup *ftg;
468: struct type_FTAM_PDU *pdus[];
469: char *texts[];
470: int *npdu;
471: struct FTAMindication *fti;
472: {
473: int i;
474: register struct type_FTAM_PDU *pdu;
475:
476: i = 0;
477:
478: #define new_pdu(t,o,u,x) \
479: register struct t *req; \
480: \
481: if ((pdu = (struct type_FTAM_PDU *) calloc (1, sizeof *pdu)) == NULL) \
482: goto no_mem; \
483: pdus[i] = pdu; \
484: pdu -> offset = o; \
485: texts[i++] = x; \
486: if ((req = (struct t *) calloc (1, sizeof *req)) == NULL) \
487: goto no_mem; \
488: pdu -> un.u = req;
489:
490: #define new_action(a) \
491: if (a != int_FTAM_Action__Result_success) { \
492: if ((req -> action__result = \
493: (struct type_FTAM_Action__Result *) \
494: calloc (1, sizeof *req -> action__result)) \
495: == NULL) \
496: goto no_mem; \
497: req -> action__result -> parm = a; \
498: }
499:
500: if (ftg -> ftg_flags & FTG_BEGIN) {
501: new_pdu (type_FTAM_F__BEGIN__GROUP__request,
502: type_FTAM_PDU_f__begin__group__request,
503: f__begin__group__request, "F-BEGIN-GROUP-request");
504: req -> parm = ftg -> ftg_threshold;
505: }
506:
507: if (ftg -> ftg_flags & FTG_SELECT) {
508: register struct FTAMselect *ftse = &ftg -> ftg_select;
509:
510: new_pdu (type_FTAM_F__SELECT__request,
511: type_FTAM_PDU_f__select__request,
512: f__select__request, "F-SELECT-request");
513: if ((req -> attributes = attr2fpm (fsb, &ftse -> ftse_attrs, fti))
514: == NULL)
515: return NOTOK;
516: if ((req -> requested__access = bits2fpm (fsb, frequested_pairs,
517: ftse -> ftse_access, fti))
518: == NULL)
519: return NOTOK;
520: if (passes_present (&ftse -> ftse_pwds)
521: && (req -> access__passwords = pass2fpm (fsb,
522: &ftse -> ftse_pwds,
523: fti)) == NULL)
524: return NOTOK;
525: if (conctl_present (&ftse -> ftse_conctl)
526: && (req -> concurrency__control =
527: conctl2fpm (fsb, &ftse -> ftse_conctl, fti))
528: == NULL)
529: return NOTOK;
530: if (ftse -> ftse_sharedASE
531: && (req -> shared__ASE__information =
532: shared2fpm (fsb, ftse -> ftse_sharedASE, fti)) == NULL)
533: return NOTOK;
534: if (ftse -> ftse_account
535: && (req -> account = str2qb (ftse -> ftse_account,
536: strlen (ftse -> ftse_account), 1))
537: == NULL)
538: goto no_mem;
539: }
540:
541: if (ftg -> ftg_flags & FTG_CREATE) {
542: register struct FTAMcreate *ftce = &ftg -> ftg_create;
543:
544: new_pdu (type_FTAM_F__CREATE__request,
545: type_FTAM_PDU_f__create__request,
546: f__create__request, "F-CREATE-request");
547: req -> override = ftce -> ftce_override;
548: if ((req -> initial__attributes = attr2fpm (fsb, &ftce -> ftce_attrs,
549: fti)) == NULL)
550: return NOTOK;
551: if (ftce -> ftce_create) {
552: register struct type_FTAM_Password *p;
553:
554: if ((p = (struct type_FTAM_Password *) calloc (1, sizeof *p))
555: == NULL)
556: goto no_mem;
557: req -> create__password = p;
558: p -> offset = type_FTAM_Password_binary;
559: if ((p -> un.binary = str2qb (ftce -> ftce_create,
560: ftce -> ftce_crelen, 1)) == NULL)
561: goto no_mem;
562: }
563: if ((req -> requested__access = bits2fpm (fsb, frequested_pairs,
564: ftce -> ftce_access, fti))
565: == NULL)
566: return NOTOK;
567: if (passes_present (&ftce -> ftce_pwds)
568: && (req -> access__passwords = pass2fpm (fsb,
569: &ftce -> ftce_pwds,
570: fti)) == NULL)
571: return NOTOK;
572: if (conctl_present (&ftce -> ftce_conctl)
573: && (req -> concurrency__control =
574: conctl2fpm (fsb, &ftce -> ftce_conctl, fti))
575: == NULL)
576: return NOTOK;
577: if (ftce -> ftce_sharedASE
578: && (req -> shared__ASE__information =
579: shared2fpm (fsb, ftce -> ftce_sharedASE, fti)) == NULL)
580: return NOTOK;
581: if (ftce -> ftce_account
582: && (req -> account = str2qb (ftce -> ftce_account,
583: strlen (ftce -> ftce_account), 1))
584: == NULL)
585: goto no_mem;
586: }
587:
588: if (ftg -> ftg_flags & FTG_CLOSE) {
589: register struct FTAMclose *ftcl = &ftg -> ftg_close;
590:
591: new_pdu (type_FTAM_F__CLOSE__request, type_FTAM_PDU_f__close__request,
592: f__close__request, "F-CLOSE-request");
593: new_action (ftcl -> ftcl_action);
594: if (ftcl -> ftcl_sharedASE
595: && (req -> shared__ASE__information =
596: shared2fpm (fsb, ftcl -> ftcl_sharedASE, fti))
597: == NULL)
598: return NOTOK;
599: if (ftcl -> ftcl_ndiag > 0
600: && (req -> diagnostic = diag2fpm (fsb, 0, ftcl -> ftcl_diags,
601: ftcl -> ftcl_ndiag, fti))
602: == NULL)
603: return NOTOK;
604: }
605:
606: if (ftg -> ftg_flags & FTG_RDATTR) {
607: register struct FTAMreadattr *ftra = &ftg -> ftg_readattr;
608:
609: if ((pdu = (struct type_FTAM_PDU *) calloc (1, sizeof *pdu)) == NULL)
610: goto no_mem;
611: pdus[i] = pdu;
612: pdu -> offset = type_FTAM_PDU_f__read__attrib__request;
613: texts[i++] = "F-READ-ATTRIB-request";
614: if ((pdu -> un.f__read__attrib__request =
615: bits2fpm (fsb, fname_pairs, ftra -> ftra_attrnames,
616: fti)) == NULLPE)
617: return NOTOK;
618: }
619:
620: if (ftg -> ftg_flags & FTG_CHATTR) {
621: register struct FTAMchngattr *ftca = &ftg -> ftg_chngattr;
622:
623: if ((pdu = (struct type_FTAM_PDU *) calloc (1, sizeof *pdu)) == NULL)
624: goto no_mem;
625: pdus[i] = pdu;
626: pdu -> offset = type_FTAM_PDU_f__change__attrib__request;
627: texts[i++] = "F-CHANGE-ATTRIB-request";
628: if ((pdu -> un.f__change__attrib__request =
629: attr2fpm (fsb, &ftca -> ftca_attrs, fti)) == NULL)
630: return NOTOK;
631: }
632:
633: if (ftg -> ftg_flags & FTG_DESELECT) {
634: register struct FTAMdeselect *ftde = &ftg -> ftg_deselect;
635:
636: if ((pdu = (struct type_FTAM_PDU *) calloc (1, sizeof *pdu)) == NULL)
637: goto no_mem;
638: pdus[i] = pdu;
639: pdu -> offset = type_FTAM_PDU_f__deselect__request;
640: texts[i++] = "F-DESELECT-request";
641: if (ftde -> ftde_sharedASE
642: && (pdu -> un.f__deselect__request =
643: shared2fpm (fsb, ftde -> ftde_sharedASE, fti)) == NULL)
644: return NOTOK;
645: }
646:
647: if (ftg -> ftg_flags & FTG_DELETE) {
648: register struct FTAMdelete *ftxe = &ftg -> ftg_delete;
649:
650: if ((pdu = (struct type_FTAM_PDU *) calloc (1, sizeof *pdu)) == NULL)
651: goto no_mem;
652: pdus[i] = pdu;
653: pdu -> offset = type_FTAM_PDU_f__delete__request;
654: texts[i++] = "F-DELETE-request";
655: if (ftxe -> ftxe_sharedASE
656: && (pdu -> un.f__deselect__request =
657: shared2fpm (fsb, ftxe -> ftxe_sharedASE, fti)) == NULL)
658: return NOTOK;
659: }
660:
661: if (ftg -> ftg_flags & FTG_OPEN) {
662: register struct FTAMopen *ftop = &ftg -> ftg_open;
663:
664: new_pdu (type_FTAM_F__OPEN__request, type_FTAM_PDU_f__open__request,
665: f__open__request, "F-OPEN-request");
666: if (ftop -> ftop_mode != FA_PERM_READ
667: && (req -> processing__mode = bits2fpm (fsb, fmode_pairs,
668: ftop -> ftop_mode,
669: fti)) == NULL)
670: return NOTOK;
671: if ((req -> contents__type =
672: (struct choice_FTAM_0 *)
673: calloc (1, sizeof *req -> contents__type))
674: == NULL)
675: goto no_mem;
676: if (ftop -> ftop_contents) {
677: register struct type_FTAM_Contents__Type__Attribute *proposed;
678:
679: req -> contents__type -> offset = choice_FTAM_0_proposed;
680: if ((proposed = (struct type_FTAM_Contents__Type__Attribute *)
681: calloc (1, sizeof *proposed)) == NULL)
682: goto no_mem;
683: req -> contents__type -> un.proposed = proposed;
684: if ((proposed -> document__type__name =
685: oid_cpy (ftop -> ftop_contents)) == NULLOID)
686: goto no_mem;
687: if (proposed -> parameter = ftop -> ftop_parameter)
688: proposed -> parameter -> pe_refcnt++;
689: }
690: else
691: req -> contents__type -> offset = choice_FTAM_0_unknown;
692: if (conctl_present (&ftop -> ftop_conctl)
693: && (req -> concurrency__control =
694: conctl2fpm (fsb, &ftop -> ftop_conctl, fti))
695: == NULL)
696: return NOTOK;
697: if (ftop -> ftop_sharedASE
698: && (req -> shared__ASE__information =
699: shared2fpm (fsb, ftop -> ftop_sharedASE, fti)) == NULL)
700: return NOTOK;
701: if (fsb -> fsb_units & FUNIT_FADULOCK)
702: req -> enable__fadu__locking = ftop -> ftop_locking
703: ? int_FTAM_FADU__Lock_on
704: : int_FTAM_FADU__Lock_off;
705: }
706:
707: if (ftg -> ftg_flags & FTG_END) {
708: if ((pdu = (struct type_FTAM_PDU *) calloc (1, sizeof *pdu)) == NULL)
709: goto no_mem;
710: pdus[i] = pdu;
711: pdu -> offset = type_FTAM_PDU_f__end__group__request;
712: texts[i++] = "F-END-GROUP-request";
713: }
714:
715: *npdu = i;
716: return OK;
717:
718: #undef new_pdu
719: #undef new_action
720:
721: no_mem: ;
722: return ftamlose (fti, FS_GEN (fsb), 1, NULLCP, "out of memory");
723: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.