Commit | Line | Data |
---|---|---|
d626f7a5 C |
1 | /* ronotunbind1.c - RONOT: Maps ABSTRACT-UNBIND onto A-RELEASE.REQUEST */ |
2 | ||
3 | #ifndef lint | |
4 | static char *rcsid = "$Header: /f/osi/ronot/RCS/ronotunbind1.c,v 7.2 91/02/22 09:50:34 mrose Interim $"; | |
5 | #endif | |
6 | ||
7 | /* | |
8 | * $Header: /f/osi/ronot/RCS/ronotunbind1.c,v 7.2 91/02/22 09:50:34 mrose Interim $ | |
9 | * | |
10 | * | |
11 | * $Log: ronotunbind1.c,v $ | |
12 | * Revision 7.2 91/02/22 09:50:34 mrose | |
13 | * Interim 6.8 | |
14 | * | |
15 | * Revision 7.1 90/07/26 14:34:01 mrose | |
16 | * template | |
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 "tailor.h" | |
34 | #include "logger.h" | |
35 | #include "ronot.h" | |
36 | #include "RONOT-types.h" | |
37 | ||
38 | ||
39 | /* \f RO-UNBIND.REQUEST */ | |
40 | ||
41 | /* ARGSUSED */ | |
42 | ||
43 | int RoUnBindRequest (sd, unbindargpe, secs, acr, rni) | |
44 | int sd; | |
45 | PE unbindargpe; | |
46 | int secs; | |
47 | struct AcSAPrelease * acr; | |
48 | struct RoNOTindication * rni; | |
49 | { | |
50 | int result; | |
51 | PE user_data; | |
52 | PE * user_data_p = &(user_data); | |
53 | int ndata; | |
54 | struct AcSAPindication aci_s; | |
55 | struct AcSAPindication * aci = &aci_s; | |
56 | struct AcSAPabort * aca = &(aci->aci_abort); | |
57 | ||
58 | ||
59 | if (unbindargpe != NULLPE) | |
60 | { | |
61 | if (encode_RONOT_UnBindArgumentValue (user_data_p, 1, 0, NULLCP, unbindargpe) == NOTOK) | |
62 | { | |
63 | LLOG (rosap_log, LLOG_EXCEPTIONS, ("RoUnbindRequest: encode_RONOT_UnBindArgumentValue failed")); | |
64 | return (ronotlose (rni, RBI_ENC_UNBIND_ARG, NULLCP, NULLCP)); | |
65 | } | |
66 | (*user_data_p)->pe_context = unbindargpe->pe_context; | |
67 | ndata = 1; | |
68 | } | |
69 | else | |
70 | { | |
71 | (*user_data_p) = NULLPE; | |
72 | ndata = 0; | |
73 | } | |
74 | ||
75 | result = AcRelRequest (sd, ACF_NORMAL, user_data_p, ndata, secs, acr, aci); | |
76 | ||
77 | if ((*user_data_p) != NULLPE) | |
78 | { | |
79 | pe_free ((*user_data_p)); | |
80 | } | |
81 | ||
82 | if (result == NOTOK) | |
83 | { | |
84 | if (aci->aci_abort.aca_reason == ACS_TIMER) | |
85 | { | |
86 | /* ADT: Watch this !! */ | |
87 | /* more work needed !!! */ | |
88 | ACAFREE (aca); | |
89 | return (DONE); | |
90 | } | |
91 | else | |
92 | { | |
93 | LLOG (rosap_log, LLOG_EXCEPTIONS, ("RoUnbindRequest: AcRelRequest failed")); | |
94 | (void) acs2ronotlose (rni, "RO-UNBIND.REQUEST", aca); | |
95 | ACAFREE (aca); | |
96 | return (NOTOK); | |
97 | } | |
98 | } | |
99 | else | |
100 | { | |
101 | if (ParseRoUnBindResponse (acr, rni) != OK) | |
102 | { | |
103 | LLOG (rosap_log, LLOG_EXCEPTIONS, ("RoUnbindRequest: ParseRoUnBindResponse failed")); | |
104 | ACRFREE (acr); | |
105 | return (NOTOK); | |
106 | } | |
107 | } | |
108 | ||
109 | return (result); | |
110 | } | |
111 | ||
112 | /* \f RO-UNBIND.RETRY */ | |
113 | ||
114 | /* ARGSUSED */ | |
115 | ||
116 | int RoUnBindRetry (sd, secs, acr, rni) | |
117 | int sd; | |
118 | int secs; | |
119 | struct AcSAPrelease * acr; | |
120 | struct RoNOTindication * rni; | |
121 | { | |
122 | int result; | |
123 | struct AcSAPindication aci_s; | |
124 | struct AcSAPindication * aci = &(aci_s); | |
125 | struct AcSAPabort * aca = &(aci->aci_abort); | |
126 | ||
127 | result = AcRelRetryRequest (sd, secs, acr, aci); | |
128 | ||
129 | if (result == NOTOK) | |
130 | { | |
131 | if (aci->aci_abort.aca_reason == ACS_TIMER) | |
132 | { | |
133 | /* ADT: Watch out for this */ | |
134 | /* more work needed !!! */ | |
135 | ACAFREE (aca); | |
136 | return (DONE); | |
137 | } | |
138 | else | |
139 | { | |
140 | LLOG (rosap_log, LLOG_EXCEPTIONS, ("RoUnbindRetry: AcRelRetryRequest failed")); | |
141 | (void) acs2ronotlose (rni, "RO-UNBIND.RETRY", aca); | |
142 | ACAFREE (aca); | |
143 | return (NOTOK); | |
144 | } | |
145 | } | |
146 | else | |
147 | { | |
148 | if (ParseRoUnBindResponse (acr, rni) != OK) | |
149 | { | |
150 | LLOG (rosap_log, LLOG_EXCEPTIONS, ("RoUnbindRetry: ParseRoUnBindResponse failed")); | |
151 | ACRFREE (acr); | |
152 | return (NOTOK); | |
153 | } | |
154 | } | |
155 | ||
156 | return (result); | |
157 | } | |
158 | ||
159 | int ParseRoUnBindResponse (acr, rni) | |
160 | struct AcSAPrelease * acr; | |
161 | struct RoNOTindication * rni; | |
162 | { | |
163 | PE pe; | |
164 | ||
165 | if (acr->acr_ninfo == 0) | |
166 | return (OK); | |
167 | ||
168 | if (acr->acr_ninfo != 1) | |
169 | return (ronotlose (rni, RBI_DEC_NINFO, NULLCP, NULLCP)); | |
170 | ||
171 | if (acr->acr_info[0] == NULLPE) | |
172 | return (ronotlose (rni, RBI_DEC_NINFO, NULLCP, NULLCP)); | |
173 | ||
174 | /* ADT: Can we get rid of this copy? */ | |
175 | pe = acr->acr_info[0]; | |
176 | acr->acr_info[0] = NULLPE; | |
177 | if (acr->acr_affirmative == ACS_ACCEPT) | |
178 | { | |
179 | if (decode_RONOT_UnBindResultValue (pe, 1, NULLIP, NULLVP, &acr->acr_info[0]) != OK) | |
180 | { | |
181 | LLOG (rosap_log, LLOG_EXCEPTIONS, ("ParseRoUnBindResponse: decode_RONOT_UnBindResultValue failed")); | |
182 | acr->acr_ninfo = 0; | |
183 | pe_free (pe); | |
184 | return (ronotlose (rni, RBI_DEC_UNBIND_RES, NULLCP, NULLCP)); | |
185 | } | |
186 | } | |
187 | else | |
188 | { | |
189 | if (decode_RONOT_UnBindErrorValue (pe, 1, NULLIP, NULLVP, &acr->acr_info[0]) != OK) | |
190 | { | |
191 | LLOG (rosap_log, LLOG_EXCEPTIONS, ("ParseRoUnBindResponse: decode_RONOT_UnBindErrorValue failed")); | |
192 | acr->acr_ninfo = 0; | |
193 | pe_free (pe); | |
194 | return (ronotlose (rni, RBI_DEC_UNBIND_RES, NULLCP, NULLCP)); | |
195 | } | |
196 | } | |
197 | pe_free (pe); | |
198 | ||
199 | return (OK); | |
200 | } | |
201 |