|
|
1.1 root 1: /* ftamgroup2.c - FPM: respond to a grouped transaction */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/ftam/RCS/ftamgroup2.c,v 7.0 89/11/23 21:53:39 mrose Rel $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/ftam/RCS/ftamgroup2.c,v 7.0 89/11/23 21:53:39 mrose Rel $
9: *
10: *
11: * $Log: ftamgroup2.c,v $
12: * Revision 7.0 89/11/23 21:53:39 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}}.RESPONSE (group) */
35:
36: int FManageResponse (sd, ftg, fti)
37: int sd;
38: struct FTAMgroup *ftg;
39: struct FTAMindication *fti;
40: {
41: return FGroupResponse (sd, ftg, FTI_MANAGEMENT, FSB_INITIALIZED, fti);
42: }
43:
44:
45: int FBulkBeginResponse (sd, ftg, fti)
46: int sd;
47: struct FTAMgroup *ftg;
48: struct FTAMindication *fti;
49: {
50: return FGroupResponse (sd, ftg, FTI_BULKBEGIN, FSB_DATAIDLE, fti);
51: }
52:
53:
54: int FBulkEndResponse (sd, ftg, fti)
55: int sd;
56: struct FTAMgroup *ftg;
57: struct FTAMindication *fti;
58: {
59: return FGroupResponse (sd, ftg, FTI_BULKEND, FSB_INITIALIZED, fti);
60: }
61:
62: /* F-GROUP.RESPONSE (group) */
63:
64: static int FGroupResponse (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 = frgrpchk (fsb, ftg, type, fti)) != NOTOK)
83: result = FGroupResponseAux (fsb, ftg, state, fti);
84:
85: (void) sigiomask (smask);
86:
87: return result;
88: }
89:
90: /* */
91:
92: static int FGroupResponseAux (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: okstate;
103: char **txp,
104: *texts[NPDATA];
105: PE pe,
106: *pep,
107: info[NPDATA];
108: struct PSAPindication pis;
109: struct PSAPindication *pi = &pis;
110: struct PSAPabort *pa = &pi -> pi_abort;
111: struct type_FTAM_PDU **pdup,
112: *pdus[NPDATA];
113:
114: bzero ((char *) texts, sizeof texts);
115: bzero ((char *) info, sizeof info);
116: bzero ((char *) pdus, sizeof pdus);
117:
118: did_loop = 0;
119: if ((result = frgrp2pdus (fsb, ftg, pdus, texts, &npdu, fti)) == NOTOK)
120: goto out;
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: switch (state) {
158: case FSB_DATAIDLE:
159: if (ftg -> ftg_flags & FTG_SELECT)
160: okstate = ftg -> ftg_select.ftse_state;
161: else
162: okstate = ftg -> ftg_create.ftce_state;
163: if (okstate != FSTATE_SUCCESS
164: || ftg -> ftg_open.ftop_state != FSTATE_SUCCESS) {
165: fsb -> fsb_state = FSB_INITIALIZED;
166: break;
167: } /* else fall */
168:
169: default:
170: fsb -> fsb_state = state;
171: break;
172: }
173:
174: return OK;
175: }
176:
177: /* */
178:
179: static int frgrpchk (fsb, ftg, type, fti)
180: register struct ftamblk *fsb;
181: register struct FTAMgroup *ftg;
182: int type;
183: struct FTAMindication *fti;
184: {
185: if (fsb -> fsb_flags & FSB_INIT)
186: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP, "not responder");
187: switch (fsb -> fsb_state) {
188: case FSB_MANAGEMENT:
189: if (type != FTI_MANAGEMENT)
190: goto wrong_state;
191: if (ftg -> ftg_flags & ~fsb -> fsb_group) {
192: reply_mismatch: ;
193: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
194: "group reply mismatch; expecting 0x%x, found 0x%x",
195: fsb -> fsb_group, ftg -> ftg_flags);
196: }
197: break;
198:
199: case FSB_BULKBEGIN:
200: if (type != FTI_BULKBEGIN)
201: goto wrong_state;
202: if (ftg -> ftg_flags & ~fsb -> fsb_group)
203: goto reply_mismatch;
204: break;
205:
206: case FSB_BULKEND:
207: if (type != FTI_BULKEND)
208: goto wrong_state;
209: if (ftg -> ftg_flags & ~fsb -> fsb_group)
210: goto reply_mismatch;
211: break;
212:
213: default:
214: wrong_state: ;
215: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP, "wrong state");
216: }
217:
218: if (ftg -> ftg_flags & FTG_SELECT) {
219: register struct FTAMselect *ftse = &ftg -> ftg_select;
220:
221: switch (ftse -> ftse_state) {
222: case FSTATE_SUCCESS:
223: case FSTATE_FAILURE:
224: break;
225:
226: default:
227: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
228: "bad value for select state parameter");
229: }
230: switch (ftse -> ftse_action) {
231: case FACTION_SUCCESS:
232: case FACTION_TRANS:
233: case FACTION_PERM:
234: break;
235:
236: default:
237: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
238: "bad value for select action parameter");
239: }
240: if (ftse -> ftse_attrs.fa_present != FA_FILENAME)
241: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
242: "only filename should be present");
243: if (ftse -> ftse_ndiag > NFDIAG)
244: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
245: "too many select diagnostics");
246: }
247:
248: if (ftg -> ftg_flags & FTG_CREATE) {
249: register struct FTAMcreate *ftce = &ftg -> ftg_create;
250:
251: switch (ftce -> ftce_state) {
252: case FSTATE_SUCCESS:
253: case FSTATE_FAILURE:
254: break;
255:
256: default:
257: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
258: "bad value for create state parameter");
259: }
260: switch (ftce -> ftce_action) {
261: case FACTION_SUCCESS:
262: case FACTION_TRANS:
263: case FACTION_PERM:
264: break;
265:
266: default:
267: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
268: "bad value for create action parameter");
269: }
270: if (!(ftce -> ftce_attrs.fa_present & FA_FILENAME))
271: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
272: "filename not present");
273: if (!(ftce -> ftce_attrs.fa_present & FA_ACTIONS))
274: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
275: "permitted-actions not present");
276: if (!(ftce -> ftce_attrs.fa_present & FA_CONTENTS))
277: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
278: "contents-type not present");
279: if (ftce -> ftce_attrs.fa_present & ~FA_CRE_ATTRS)
280: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
281: "illegal attributes present");
282: if (!(fsb -> fsb_attrs & FATTR_STORAGE)
283: && (ftce -> ftce_attrs.fa_present & FA_STORAGE))
284: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
285: "storage attributes not permitted");
286: if (!(fsb -> fsb_attrs & FATTR_SECURITY)
287: && (ftce -> ftce_attrs.fa_present & FA_SECURITY))
288: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
289: "security attributes not permitted");
290: if (ftce -> ftce_ndiag > NFDIAG)
291: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
292: "too many create diagnostics");
293: }
294:
295: if (ftg -> ftg_flags & FTG_CLOSE) {
296: register struct FTAMclose *ftcl = &ftg -> ftg_close;
297:
298: switch (ftcl -> ftcl_action) {
299: case FACTION_SUCCESS:
300: case FACTION_TRANS:
301: case FACTION_PERM:
302: break;
303:
304: default:
305: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
306: "bad value for close action parameter");
307: }
308: if (ftcl -> ftcl_ndiag > NFDIAG)
309: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
310: "too many close diagnostics");
311: }
312:
313: if (ftg -> ftg_flags & FTG_RDATTR) {
314: register struct FTAMreadattr *ftra = &ftg -> ftg_readattr;
315:
316: switch (ftra -> ftra_action) {
317: case FACTION_SUCCESS:
318: case FACTION_TRANS:
319: case FACTION_PERM:
320: break;
321:
322: default:
323: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
324: "bad value for read attribute action parameter");
325: }
326: if (!(fsb -> fsb_attrs & FATTR_STORAGE)
327: && (ftra -> ftra_attrs.fa_present & FA_STORAGE))
328: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
329: "storage attributes not permitted");
330: if (!(fsb -> fsb_attrs & FATTR_SECURITY)
331: && (ftra -> ftra_attrs.fa_present & FA_SECURITY))
332: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
333: "security attributes not permitted");
334: if (ftra -> ftra_ndiag > NFDIAG)
335: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
336: "too many read attribute diagnostics");
337: }
338:
339: if (ftg -> ftg_flags & FTG_CHATTR) {
340: register struct FTAMchngattr *ftca = &ftg -> ftg_chngattr;
341:
342: switch (ftca -> ftca_action) {
343: case FACTION_SUCCESS:
344: case FACTION_TRANS:
345: case FACTION_PERM:
346: break;
347:
348: default:
349: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
350: "bad value for change attribute action parameter");
351: }
352: if (!(fsb -> fsb_attrs & FATTR_STORAGE)
353: && (ftca -> ftca_attrs.fa_present & FA_STORAGE))
354: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
355: "storage attributes not permitted");
356: if (!(fsb -> fsb_attrs & FATTR_SECURITY)
357: && (ftca -> ftca_attrs.fa_present & FA_SECURITY))
358: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
359: "security attributes not permitted");
360: if (ftca -> ftca_attrs.fa_present & FA_CONTROL)
361: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
362: "encoding of access-control not supported (yet)");
363: if (ftca -> ftca_ndiag > NFDIAG)
364: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
365: "too many change attribute diagnostics");
366: }
367:
368: if (ftg -> ftg_flags & FTG_DESELECT) {
369: register struct FTAMdeselect *ftde = &ftg -> ftg_deselect;
370:
371: switch (ftde -> ftde_action) {
372: case FACTION_SUCCESS:
373: case FACTION_TRANS:
374: case FACTION_PERM:
375: break;
376:
377: default:
378: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
379: "bad value for deselect action parameter");
380: }
381: if (!(fsb -> fsb_flags & FSB_DECHARGE)
382: && ftde -> ftde_charges.fc_ncharge > 0)
383: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
384: "deselect not permitted to include charges");
385: if (ftde -> ftde_charges.fc_ncharge > NFCHRG)
386: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
387: "too many deselect charges");
388: if (ftde -> ftde_ndiag > NFDIAG)
389: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
390: "too many deselect diagnostics");
391: }
392:
393: if (ftg -> ftg_flags & FTG_DELETE) {
394: register struct FTAMdelete *ftxe = &ftg -> ftg_delete;
395:
396: switch (ftxe -> ftxe_action) {
397: case FACTION_SUCCESS:
398: case FACTION_TRANS:
399: case FACTION_PERM:
400: break;
401:
402: default:
403: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
404: "bad value for delete action parameter");
405: }
406: if (ftxe -> ftxe_charges.fc_ncharge > NFCHRG)
407: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
408: "too many delete charges");
409: if (ftxe -> ftxe_ndiag > NFDIAG)
410: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
411: "too many delete diagnostics");
412: }
413:
414: if (ftg -> ftg_flags & FTG_OPEN) {
415: register struct FTAMopen *ftop = &ftg -> ftg_open;
416: register struct FTAMconcurrency *fc;
417:
418: switch (ftop -> ftop_state) {
419: case FSTATE_SUCCESS:
420: case FSTATE_FAILURE:
421: break;
422:
423: default:
424: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
425: "bad value for open state parameter");
426: }
427: switch (ftop -> ftop_action) {
428: case FACTION_SUCCESS:
429: case FACTION_TRANS:
430: case FACTION_PERM:
431: break;
432:
433: default:
434: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
435: "bad value for open action parameter");
436: }
437: if (ftop -> ftop_contents == NULLOID)
438: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
439: "missing open contents type parameter");
440: if (fsb -> fsb_attrs & FATTR_STORAGE) {
441: fc = &ftop -> ftop_conctl;
442: if (fc -> fc_readattrlock != FLOCK_NOTREQD
443: || fc -> fc_chngattrlock != FLOCK_NOTREQD
444: || fc -> fc_deletelock != FLOCK_NOTREQD)
445: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
446: "bad settings for open concurrency control");
447: }
448: if (ftop -> ftop_ndiag > NFDIAG)
449: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
450: "too many open diagnostics");
451: }
452:
453: return OK;
454: }
455:
456: /* */
457:
458: static int frgrp2pdus (fsb, ftg, pdus, texts, npdu, fti)
459: register struct ftamblk *fsb;
460: register struct FTAMgroup *ftg;
461: struct type_FTAM_PDU *pdus[];
462: char *texts[];
463: int *npdu;
464: struct FTAMindication *fti;
465: {
466: int flags,
467: i;
468: register struct type_FTAM_PDU *pdu;
469:
470: i = 0;
471:
472: #define new_pdu(t,o,u,x) \
473: register struct t *req; \
474: \
475: if ((pdu = (struct type_FTAM_PDU *) calloc (1, sizeof *pdu)) == NULL) \
476: goto no_mem; \
477: pdus[i] = pdu; \
478: pdu -> offset = o; \
479: texts[i++] = x; \
480: if ((req = (struct t *) calloc (1, sizeof *req)) == NULL) \
481: goto no_mem; \
482: pdu -> un.u = req;
483:
484: #define new_state(s) \
485: if (s != int_FTAM_State__Result_success) { \
486: if ((req -> state__result = \
487: (struct type_FTAM_State__Result *) \
488: calloc (1, sizeof *req -> state__result)) \
489: == NULL) \
490: goto no_mem; \
491: req -> state__result -> parm = s; \
492: }
493:
494: #define new_action(a) \
495: if (a != int_FTAM_Action__Result_success) { \
496: if ((req -> action__result = \
497: (struct type_FTAM_Action__Result *) \
498: calloc (1, sizeof *req -> action__result)) \
499: == NULL) \
500: goto no_mem; \
501: req -> action__result -> parm = a; \
502: }
503:
504: if ((flags = ftg -> ftg_flags) & FTG_SELECT) {
505: if (ftg -> ftg_select.ftse_state == FSTATE_FAILURE)
506: flags &= FTG_BEGIN | FTG_SELECT | FTG_END;
507: }
508: else
509: if (flags & FTG_CREATE) {
510: if (ftg -> ftg_create.ftce_state == FSTATE_FAILURE)
511: flags &= FTG_BEGIN | FTG_CREATE | FTG_END;
512: }
513:
514: if (flags & FTG_BEGIN) {
515: if ((pdu = (struct type_FTAM_PDU *) calloc (1, sizeof *pdu)) == NULL)
516: goto no_mem;
517: pdus[i] = pdu;
518: pdu -> offset = type_FTAM_PDU_f__begin__group__response;
519: texts[i++] = "F-BEGIN-GROUP-response";
520: }
521:
522: if (flags & FTG_SELECT) {
523: register struct FTAMselect *ftse = &ftg -> ftg_select;
524:
525: new_pdu (type_FTAM_F__SELECT__response,
526: type_FTAM_PDU_f__select__response,
527: f__select__response, "F-SELECT-response");
528: new_state (ftse -> ftse_state);
529: new_action (ftse -> ftse_action);
530: if ((req -> attributes = attr2fpm (fsb, &ftse -> ftse_attrs, fti))
531: == NULL)
532: return NOTOK;
533: if (ftse -> ftse_sharedASE
534: && (req -> shared__ASE__information =
535: shared2fpm (fsb, ftse -> ftse_sharedASE, fti)) == NULL)
536: return NOTOK;
537: if (ftse -> ftse_ndiag > 0
538: && (req -> diagnostic = diag2fpm (fsb, 0, ftse -> ftse_diags,
539: ftse -> ftse_ndiag, fti))
540: == NULL)
541: return NOTOK;
542: }
543:
544: if (flags & FTG_CREATE) {
545: register struct FTAMcreate *ftce = &ftg -> ftg_create;
546:
547: new_pdu (type_FTAM_F__CREATE__response,
548: type_FTAM_PDU_f__create__response,
549: f__create__response, "F-CREATE-response");
550: new_state (ftce -> ftce_state);
551: new_action (ftce -> ftce_action);
552: if ((req -> initial__attributes = attr2fpm (fsb, &ftce -> ftce_attrs,
553: fti)) == NULL)
554: return NOTOK;
555: if (ftce -> ftce_sharedASE
556: && (req -> shared__ASE__information =
557: shared2fpm (fsb, ftce -> ftce_sharedASE, fti)) == NULL)
558: return NOTOK;
559: if (ftce -> ftce_ndiag > 0
560: && (req -> diagnostic = diag2fpm (fsb, 0, ftce -> ftce_diags,
561: ftce -> ftce_ndiag, fti))
562: == NULL)
563: return NOTOK;
564: }
565:
566: if (flags & FTG_CLOSE) {
567: register struct FTAMclose *ftcl = &ftg -> ftg_close;
568:
569: new_pdu (type_FTAM_F__CLOSE__response,
570: type_FTAM_PDU_f__close__response,
571: f__close__response, "F-CLOSE-response");
572: new_action (ftcl -> ftcl_action);
573: if (ftcl -> ftcl_sharedASE
574: && (req -> shared__ASE__information =
575: shared2fpm (fsb, ftcl -> ftcl_sharedASE, fti)) == NULL)
576: return NOTOK;
577: if (ftcl -> ftcl_ndiag > 0
578: && (req -> diagnostic = diag2fpm (fsb, 0, ftcl -> ftcl_diags,
579: ftcl -> ftcl_ndiag, fti))
580: == NULL)
581: return NOTOK;
582: }
583:
584: if (flags & FTG_RDATTR) {
585: register struct FTAMreadattr *ftra = &ftg -> ftg_readattr;
586:
587: new_pdu (type_FTAM_F__READ__ATTRIB__response,
588: type_FTAM_PDU_f__read__attrib__response,
589: f__read__attrib__response, "F-READ-ATTRIB-response");
590: new_action (ftra -> ftra_action);
591: if (ftra -> ftra_attrs.fa_present
592: && (req -> attributes = attr2fpm (fsb, &ftra -> ftra_attrs,
593: fti)) == NULL)
594: return NOTOK;
595: if (ftra -> ftra_ndiag > 0
596: && (req -> diagnostic = diag2fpm (fsb, 0, ftra -> ftra_diags,
597: ftra -> ftra_ndiag, fti))
598: == NULL)
599: return NOTOK;
600: }
601:
602: if (flags & FTG_CHATTR) {
603: register struct FTAMchngattr *ftca = &ftg -> ftg_chngattr;
604:
605: new_pdu (type_FTAM_F__CHANGE__ATTRIB__response,
606: type_FTAM_PDU_f__change__attrib__response,
607: f__change__attrib__response, "F-CHANGE-ATTRIB-response");
608: new_action (ftca -> ftca_action);
609: if (ftca -> ftca_attrs.fa_present
610: && (req -> attributes = attr2fpm (fsb, &ftca -> ftca_attrs,
611: fti)) == NULL)
612: return NOTOK;
613: if (ftca -> ftca_ndiag > 0
614: && (req -> diagnostic = diag2fpm (fsb, 0, ftca -> ftca_diags,
615: ftca -> ftca_ndiag, fti))
616: == NULL)
617: return NOTOK;
618: }
619:
620: if (flags & FTG_DESELECT) {
621: register struct FTAMdeselect *ftde = &ftg -> ftg_deselect;
622:
623: new_pdu (type_FTAM_F__DESELECT__response,
624: type_FTAM_PDU_f__deselect__response,
625: f__deselect__response, "F-DESELECT-response");
626: new_action (ftde -> ftde_action);
627: if (ftde -> ftde_sharedASE
628: && (req -> shared__ASE__information =
629: shared2fpm (fsb, ftde -> ftde_sharedASE, fti)) == NULL)
630: return NOTOK;
631: if (ftde -> ftde_charges.fc_ncharge
632: && (req -> charging = chrg2fpm (fsb, &ftde -> ftde_charges,
633: fti)) == NULL)
634: return NOTOK;
635: if (ftde -> ftde_ndiag > 0
636: && (req -> diagnostic = diag2fpm (fsb, 0, ftde -> ftde_diags,
637: ftde -> ftde_ndiag, fti))
638: == NULL)
639: return NOTOK;
640: }
641:
642: if (flags & FTG_DELETE) {
643: register struct FTAMdelete *ftxe = &ftg -> ftg_delete;
644:
645: new_pdu (type_FTAM_F__DELETE__response,
646: type_FTAM_PDU_f__delete__response,
647: f__delete__response, "F-DELETE-response");
648: new_action (ftxe -> ftxe_action);
649: if (ftxe -> ftxe_sharedASE
650: && (req -> shared__ASE__information =
651: shared2fpm (fsb, ftxe -> ftxe_sharedASE, fti)) == NULL)
652: return NOTOK;
653: if (ftxe -> ftxe_charges.fc_ncharge
654: && (req -> charging = chrg2fpm (fsb, &ftxe -> ftxe_charges,
655: fti)) == NULL)
656: return NOTOK;
657: if (ftxe -> ftxe_ndiag > 0
658: && (req -> diagnostic = diag2fpm (fsb, 0, ftxe -> ftxe_diags,
659: ftxe -> ftxe_ndiag, fti))
660: == NULL)
661: return NOTOK;
662: }
663:
664: if (flags & FTG_OPEN) {
665: register struct FTAMopen *ftop = &ftg -> ftg_open;
666: register struct type_FTAM_Contents__Type__Attribute *proposed;
667:
668: new_pdu (type_FTAM_F__OPEN__response,
669: type_FTAM_PDU_f__open__response,
670: f__open__response, "F-OPEN-response");
671: new_state (ftop -> ftop_state);
672: new_action (ftop -> ftop_action);
673: if ((proposed = (struct type_FTAM_Contents__Type__Attribute *)
674: calloc (1, sizeof *proposed)) == NULL)
675: goto no_mem;
676: req -> contents__type = proposed;
677: if ((proposed -> document__type__name =
678: oid_cpy (ftop -> ftop_contents)) == NULLOID)
679: goto no_mem;
680: if (proposed -> parameter = ftop -> ftop_parameter)
681: proposed -> parameter -> pe_refcnt++;
682: if (conctl_present (&ftop -> ftop_conctl)
683: && (req -> concurrency__control =
684: conctl2fpm (fsb, &ftop -> ftop_conctl, fti))
685: == NULL)
686: return NOTOK;
687: if (ftop -> ftop_sharedASE
688: && (req -> shared__ASE__information =
689: shared2fpm (fsb, ftop -> ftop_sharedASE, fti)) == NULL)
690: return NOTOK;
691: if (ftop -> ftop_ndiag > 0
692: && (req -> diagnostic = diag2fpm (fsb, 0, ftop -> ftop_diags,
693: ftop -> ftop_ndiag, fti))
694: == NULL)
695: return NOTOK;
696: }
697:
698: if (flags & FTG_END) {
699: if ((pdu = (struct type_FTAM_PDU *) calloc (1, sizeof *pdu)) == NULL)
700: goto no_mem;
701: pdus[i] = pdu;
702: pdu -> offset = type_FTAM_PDU_f__end__group__response;
703: texts[i++] = "F-END-GROUP-response";
704: }
705:
706: *npdu = i;
707: return OK;
708:
709: #undef new_pdu
710: #undef new_state
711: #undef new_action
712:
713: no_mem: ;
714: return ftamlose (fti, FS_GEN (fsb), 1, NULLCP, "out of memory");
715: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.