|
|
1.1 root 1: /* ronotbind2.c - RONOT: ABSTRACT-BIND mapping onto A-ASSOCIATE.RESPONSE */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/ronot/RCS/ronotbind2.c,v 7.1 90/07/26 14:33:57 mrose Exp $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/ronot/RCS/ronotbind2.c,v 7.1 90/07/26 14:33:57 mrose Exp $
9: *
10: *
11: * $Log: ronotbind2.c,v $
12: * Revision 7.1 90/07/26 14:33:57 mrose
13: * template
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 "tailor.h"
31: #include "logger.h"
32: #include "ronot.h"
33: #include "RONOT-types.h"
34:
35:
36: /* RO-BIND.INDICATION */
37:
38: /* ARGSUSED */
39:
40: int RoBindInit (vecp, vec, acs, rni)
41: int vecp;
42: char **vec;
43: struct AcSAPstart * acs;
44: struct RoNOTindication * rni;
45: {
46: int result;
47: struct AcSAPindication aci_s;
48: struct AcSAPindication * aci = &(aci_s);
49: struct AcSAPabort * aca = &(aci->aci_abort);
50:
51: result = AcInit (vecp, vec, acs, aci);
52:
53: if (result != OK)
54: {
55: LLOG (rosap_log, LLOG_EXCEPTIONS, ("RoBindInit: RO-BIND.INDICATION: failed"));
56: /* Have an AcSAPindication, need to return RoNOTindication */
57: (void) acs2ronotlose (rni, "RO-BIND.INDICATION", aca);
58: ACAFREE (aca);
59: return (NOTOK);
60: }
61: else
62: {
63: struct RoSAPindication roi_s;
64:
65: if (RoSetService (acs->acs_sd, RoPService, &(roi_s)) == NOTOK)
66: {
67: LLOG (rosap_log, LLOG_EXCEPTIONS, ("RoBindInit: RoSetService failed"));
68: return (ronotlose (rni, RBI_SET_ROSE_PRES, NULLCP, NULLCP));
69: }
70:
71: if (ParseRoBindArgument (acs, rni) != OK)
72: {
73: LLOG (rosap_log, LLOG_EXCEPTIONS, ("RoBindInit: ParseRoBindArgument failed"));
74: ACSFREE (acs);
75: return (NOTOK);
76: }
77: }
78:
79: return (result);
80: }
81:
82: int ParseRoBindArgument (acs, rni)
83: struct AcSAPstart * acs;
84: struct RoNOTindication * rni;
85: {
86: PE pe;
87:
88: if (acs->acs_ninfo == 0)
89: return (OK);
90:
91: if (acs->acs_ninfo != 1)
92: return (ronotlose (rni, RBI_DEC_NINFO, NULLCP, NULLCP));
93:
94: if (acs->acs_info[0] == NULLPE)
95: return (ronotlose (rni, RBI_DEC_NINFO, NULLCP, NULLCP));
96:
97: pe = acs->acs_info[0];
98: acs->acs_info[0] = NULLPE;
99: if (decode_RONOT_BindArgumentValue (pe, 1, NULLIP, NULLVP, &acs->acs_info[0]) != OK)
100: {
101: LLOG (rosap_log, LLOG_EXCEPTIONS, ("ParseRoBindArgument: decode_RONOT_BindArgumentValue failed"));
102: acs->acs_ninfo = 0;
103: pe_free (pe);
104: (void) RoBindReject (acs, ACS_TRANSIENT, ACS_USER_NOREASON, rni);
105: return (ronotlose (rni, RBI_DEC_BIND_ARG, NULLCP, NULLCP));
106: }
107: pe_free (pe);
108:
109: return (OK);
110: }
111:
112: /* RO-BIND.RESULT */
113:
114: int RoBindResult (sd, context, respondtitle, respondaddr, ctxlist,
115: defctxresult, prequirements, srequirements, isn, settings,
116: ref, bindrespe, rni)
117: int sd;
118: OID context;
119: AEI respondtitle;
120: struct PSAPaddr * respondaddr;
121: struct PSAPctxlist * ctxlist;
122: int defctxresult;
123: int prequirements;
124: int srequirements;
125: long isn;
126: int settings;
127: struct SSAPref * ref;
128: PE bindrespe;
129: struct RoNOTindication * rni;
130: {
131: int result;
132: PE user_data;
133: PE * user_data_p = &(user_data);
134: int ndata;
135: struct AcSAPindication aci_s;
136: struct AcSAPindication * aci = &(aci_s);
137: struct AcSAPabort * aca = &(aci->aci_abort);
138:
139:
140: /* Wrap the user data with the remote operations BIND RESULT tag */
141:
142: if (bindrespe != NULLPE)
143: {
144: if (encode_RONOT_BindResultValue (user_data_p, 1, 0, NULLCP, bindrespe) == NOTOK)
145: {
146: LLOG (rosap_log, LLOG_EXCEPTIONS, ("RoBindResult: encode_RONOT_BindResultValue failed"));
147: return (ronotlose (rni, RBI_ENC_BIND_RES, NULLCP, NULLCP));
148: }
149: (*user_data_p)->pe_context = bindrespe->pe_context;
150: ndata = 1;
151: }
152: else
153: {
154: (*user_data_p) = NULLPE;
155: ndata = 0;
156: }
157:
158: result = AcAssocResponse (sd, ACS_ACCEPT, ACS_USER_NULL, context,
159: respondtitle, respondaddr, ctxlist, defctxresult,
160: prequirements, srequirements, isn, settings, ref,
161: user_data_p, ndata, aci);
162:
163: if ((*user_data_p) != NULLPE)
164: {
165: pe_free ((*user_data_p));
166: }
167:
168: if (result == NOTOK)
169: {
170: LLOG (rosap_log, LLOG_EXCEPTIONS, ("RoBindResult: AcAssocResponse failed"));
171: /* Have an AcSAPindication, need to return RoNOTindication */
172: (void) acs2ronotlose (rni, "RO-BIND.RESULT", aca);
173: ACAFREE (aca);
174: return (NOTOK);
175: }
176:
177: return (result);
178: }
179:
180: /* RO-BIND.ERROR */
181:
182: int RoBindError (sd, context, respondtitle,
183: respondaddr, ctxlist, defctxresult, prequirements,
184: srequirements, isn, settings, ref, binderrpe, rni)
185: int sd;
186: OID context;
187: AEI respondtitle;
188: struct PSAPaddr * respondaddr;
189: struct PSAPctxlist * ctxlist;
190: int defctxresult;
191: int prequirements;
192: int srequirements;
193: long isn;
194: int settings;
195: struct SSAPref * ref;
196: PE binderrpe;
197: struct RoNOTindication * rni;
198: {
199: int result;
200: PE user_data;
201: PE * user_data_p = &(user_data);
202: int ndata;
203: struct AcSAPindication aci_s;
204: struct AcSAPindication * aci = &(aci_s);
205: struct AcSAPabort * aca = &(aci->aci_abort);
206:
207:
208: /* Wrap the user data with the remote operations BIND ARGUMENT tag */
209:
210: if (binderrpe != NULLPE)
211: {
212: if (encode_RONOT_BindErrorValue (user_data_p, 1, 0, NULLCP, binderrpe) == NOTOK)
213: {
214: LLOG (rosap_log, LLOG_EXCEPTIONS, ("RoBindError: encode_RONOT_BindErrorValue failed"));
215: return (ronotlose (rni, RBI_ENC_BIND_ERR, NULLCP, NULLCP));
216: }
217: (*user_data_p)->pe_context = binderrpe->pe_context;
218: ndata = 1;
219: }
220: else
221: {
222: (*user_data_p) = NULLPE;
223: ndata = 0;
224: }
225:
226: result = AcAssocResponse (sd, ACS_PERMANENT, ACS_USER_NOREASON,
227: context, respondtitle, respondaddr, ctxlist, defctxresult,
228: prequirements, srequirements, isn, settings, ref,
229: user_data_p, ndata, aci);
230:
231: if ((*user_data_p) != NULLPE)
232: {
233: pe_free ((*user_data_p));
234: }
235:
236: if (result == NOTOK)
237: {
238: LLOG (rosap_log, LLOG_EXCEPTIONS, ("RoBindError: AcAssocResponse failed"));
239: /* Have an AcSAPindication, need to return RoNOTindication */
240: (void) acs2ronotlose (rni, "RO-BIND.ERROR", aca);
241: ACAFREE (aca);
242: return (NOTOK);
243: }
244:
245: return (result);
246: }
247:
248: int RoBindReject (acs, status, reason, rni)
249: struct AcSAPstart * acs;
250: int status;
251: int reason;
252: struct RoNOTindication * rni;
253: {
254: struct PSAPstart * ps = &(acs->acs_start);
255: struct AcSAPindication aci_s;
256: struct AcSAPindication * aci = &(aci_s);
257: struct AcSAPabort * aca = &(aci->aci_abort);
258:
259: LLOG (rosap_log, LLOG_EXCEPTIONS, ("RO-BIND.REJECT called on %d", acs->acs_sd));
260:
261: if (AcAssocResponse (acs->acs_sd, status,
262: reason, acs->acs_context, NULLAEI,
263: NULLPA, &(ps->ps_ctxlist), ps->ps_defctxresult,
264: PR_MYREQUIRE, ps->ps_srequirements, SERIAL_NONE,
265: ps->ps_settings, &(ps->ps_connect), NULLPEP, 0,
266: aci) == OK)
267: {
268: LLOG (rosap_log, LLOG_EXCEPTIONS, ("RoBindReject OK"));
269: return (OK);
270: }
271: else
272: {
273: LLOG (rosap_log, LLOG_EXCEPTIONS, ("RoBindReject NOTOK"));
274: return (acs2ronotlose (rni, "RO-BIND.REJECT", aca));
275: }
276: }
277:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.