Removed definition "LIB= rpc". We want libc.a to contain librpc.a, not
[unix-history] / .ref-BSD-4_3_Net_2 / usr / src / contrib / isode / ftam / ftamrelease2.c
CommitLineData
c54994d8
WJ
1/* ftamrelease2.c - FPM: respond to release */
2
3#ifndef lint
4static char *rcsid = "$Header: /f/osi/ftam/RCS/ftamrelease2.c,v 7.1 91/02/22 09:23:11 mrose Interim $";
5#endif
6
7/*
8 * $Header: /f/osi/ftam/RCS/ftamrelease2.c,v 7.1 91/02/22 09:23:11 mrose Interim $
9 *
10 *
11 * $Log: ftamrelease2.c,v $
12 * Revision 7.1 91/02/22 09:23:11 mrose
13 * Interim 6.8
14 *
15 * Revision 7.0 89/11/23 21:53:50 mrose
16 * Release 6.0
17 *
18 */
19
20/*
21 * NOTICE
22 *
23 * Acquisition, use, and distribution of this module and related
24 * materials are subject to the restrictions of a license agreement.
25 * Consult the Preface in the User's Manual for the full terms of
26 * this agreement.
27 *
28 */
29
30
31/* LINTLIBRARY */
32
33#include <stdio.h>
34#include <signal.h>
35#include "fpkt.h"
36
37/* \f F-TERMINATE.RESPONSE */
38
39int FTerminateResponse (sd, sharedASE, charging, fti)
40int sd;
41PE sharedASE;
42struct FTAMcharging *charging;
43struct FTAMindication *fti;
44{
45 SBV smask;
46 int result;
47 register struct ftamblk *fsb;
48
49 if (charging && charging -> fc_ncharge > NFCHRG)
50 return ftamlose (fti, FS_GEN_NOREASON, 0, NULLCP,
51 "too many charges");
52 missingP (fti);
53
54 smask = sigioblock ();
55
56 ftamFsig (fsb, sd);
57
58 result = FTerminateResponseAux (fsb, sharedASE, charging, fti);
59
60 (void) sigiomask (smask);
61
62 return result;
63}
64
65/* \f */
66
67static int FTerminateResponseAux (fsb, sharedASE, charging, fti)
68register struct ftamblk *fsb;
69PE sharedASE;
70struct FTAMcharging *charging;
71struct FTAMindication *fti;
72{
73 int result;
74 PE pe;
75 struct AcSAPindication acis;
76 register struct AcSAPindication *aci = &acis;
77 register struct AcSAPabort *aca = &aci -> aci_abort;
78 register struct type_FTAM_PDU *pdu;
79 register struct type_FTAM_F__TERMINATE__response *rsp;
80
81 pe = NULLPE;
82 if ((pdu = (struct type_FTAM_PDU *) calloc (1, sizeof *pdu)) == NULL) {
83no_mem: ;
84 (void) ftamlose (fti, FS_GEN (fsb), 1, NULLCP, "out of memory");
85out: ;
86 if (pe)
87 pe_free (pe);
88 if (pdu)
89 free_FTAM_PDU (pdu);
90 if (fti -> fti_abort.fta_action == FACTION_PERM)
91 freefsblk (fsb);
92 return NOTOK;
93 }
94 pdu -> offset = type_FTAM_PDU_f__terminate__response;
95 if ((rsp = (struct type_FTAM_F__TERMINATE__response *)
96 calloc (1, sizeof *rsp)) == NULL)
97 goto no_mem;
98 pdu -> un.f__terminate__response = rsp;
99 if (sharedASE
100 && (rsp -> shared__ASE__information =
101 shared2fpm (fsb, sharedASE, fti)) == NULL)
102 goto out;
103 if (charging
104 && charging -> fc_ncharge > 0
105 && (rsp -> charging = chrg2fpm (fsb, charging, fti)) == NULL)
106 goto out;
107
108 if (encode_FTAM_PDU (&pe, 1, 0, NULLCP, pdu) == NOTOK) {
109 (void) ftamlose (fti, FS_GEN (fsb), 1, NULLCP,
110 "error encoding PDU: %s", PY_pepy);
111 goto out;
112 }
113
114 pe -> pe_context = fsb -> fsb_id;
115
116 fsbtrace (fsb, (fsb -> fsb_fd, "A-RELEASE.RESPONSE",
117 "F-TERMINATE-response", pe, 0));
118
119 result = AcRelResponse (fsb -> fsb_fd, ACS_ACCEPT, ACR_NORMAL, &pe, 1,
120 aci);
121
122 pe_free (pe);
123 pe = NULLPE;
124 free_FTAM_PDU (pdu);
125 pdu = NULL;
126
127 if (result == NOTOK) {
128 (void) acs2ftamlose (fsb, fti, "AcRelResponse", aca);
129 goto out;
130 }
131
132 fsb -> fsb_fd = NOTOK;
133 freefsblk (fsb);
134
135 return OK;
136}