|
|
1.1 root 1: /* ftambulk2.c - FPM: respond to bulk data transfer */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/ftam/RCS/ftambulk2.c,v 7.0 89/11/23 21:53:28 mrose Rel $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/ftam/RCS/ftambulk2.c,v 7.0 89/11/23 21:53:28 mrose Rel $
9: *
10: *
11: * $Log: ftambulk2.c,v $
12: * Revision 7.0 89/11/23 21:53:28 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-TRANSFER-END.RESPONSE */
35:
36: int FTransEndResponse (sd, action, sharedASE, diag, ndiag, fti)
37: int sd;
38: int action;
39: PE sharedASE;
40: struct FTAMdiagnostic diag[];
41: int ndiag;
42: struct FTAMindication *fti;
43: {
44: SBV smask;
45: int result;
46: register struct ftamblk *fsb;
47:
48: switch (action) {
49: case FACTION_SUCCESS:
50: case FACTION_TRANS:
51: case FACTION_PERM:
52: break;
53:
54: default:
55: return ftamlose (fti, FS_GEN_NOREASON, 0, NULLCP,
56: "bad value for action parameter");
57: }
58: toomuchP (diag, ndiag, NFDIAG, "diagnostic");
59: missingP (fti);
60:
61: smask = sigioblock ();
62:
63: ftamPsig (fsb, sd);
64:
65: result = FTransEndResponseAux (fsb, action, sharedASE, diag, ndiag, fti);
66:
67: (void) sigiomask (smask);
68:
69: return result;
70: }
71:
72: /* */
73:
74: static int FTransEndResponseAux (fsb, action, sharedASE, diag, ndiag, fti)
75: register struct ftamblk *fsb;
76: int action;
77: PE sharedASE;
78: struct FTAMdiagnostic diag[];
79: int ndiag;
80: struct FTAMindication *fti;
81: {
82: int result;
83: PE pe;
84: struct PSAPindication pis;
85: struct PSAPindication *pi = &pis;
86: struct PSAPabort *pa = &pi -> pi_abort;
87: register struct type_FTAM_PDU *pdu;
88: register struct type_FTAM_F__TRANSFER__END__response *rsp;
89:
90: if (fsb -> fsb_flags & FSB_INIT)
91: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP, "not responder");
92: if (fsb -> fsb_state != FSB_DATAFIN2)
93: return ftamlose (fti, FS_GEN (fsb), 0, NULLCP, "wrong state");
94:
95: pe = NULLPE;
96: if ((pdu = (struct type_FTAM_PDU *) calloc (1, sizeof *pdu)) == NULL) {
97: no_mem: ;
98: (void) ftamlose (fti, FS_GEN (fsb), 1, NULLCP, "out of memory");
99: out: ;
100: if (pe)
101: pe_free (pe);
102: if (pdu)
103: free_FTAM_PDU (pdu);
104: if (fti -> fti_abort.fta_action == FACTION_PERM)
105: freefsblk (fsb);
106: return NOTOK;
107: }
108: pdu -> offset = type_FTAM_PDU_f__transfer__end__response;
109: if ((rsp = (struct type_FTAM_F__TRANSFER__END__response *)
110: calloc (1, sizeof *rsp)) == NULL)
111: goto no_mem;
112: pdu -> un.f__transfer__end__response = rsp;
113: if ((rsp -> action__result =
114: (struct type_FTAM_Action__Result *)
115: calloc (1, sizeof *rsp -> action__result)) == NULL)
116: goto no_mem;
117: rsp -> action__result -> parm = action;
118: if (sharedASE
119: && (rsp -> shared__ASE__information =
120: shared2fpm (fsb, sharedASE, fti)) == NULL)
121: goto out;
122: if (ndiag > 0
123: && (rsp -> diagnostic = diag2fpm (fsb, 0, diag, ndiag, fti))
124: == NULL)
125: goto out;
126:
127: if (encode_FTAM_PDU (&pe, 1, 0, NULLCP, pdu) == NOTOK) {
128: (void) ftamlose (fti, FS_GEN (fsb), 1, NULLCP,
129: "error encoding PDU: %s", PY_pepy);
130: goto out;
131: }
132:
133: pe -> pe_context = fsb -> fsb_id;
134:
135: fsbtrace (fsb, (fsb -> fsb_fd, "P-DATA.REQUEST", "F-TRANSFER-END-response",
136: pe, 0));
137:
138: result = PDataRequest (fsb -> fsb_fd, &pe, 1, pi);
139:
140: pe_free (pe);
141: pe = NULLPE;
142: free_FTAM_PDU (pdu);
143: pdu = NULL;
144:
145: if (result == NOTOK) {
146: (void) ps2ftamlose (fsb, fti, "PDataRequest", pa);
147: goto out;
148: }
149:
150: fsb -> fsb_state = FSB_DATAIDLE;
151:
152: return OK;
153: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.