|
|
1.1 root 1: /* ronotbind1.c - RONOT: ABSTRACT-BIND mapping onto A-ASSOCIATE.REQUEST */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/ronot/RCS/ronotbind1.c,v 7.1 90/07/26 14:33:55 mrose Exp $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/ronot/RCS/ronotbind1.c,v 7.1 90/07/26 14:33:55 mrose Exp $
9: *
10: *
11: * $Log: ronotbind1.c,v $
12: * Revision 7.1 90/07/26 14:33:55 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.REQUEST */
37:
38: /* ARGSUSED */
39:
40: int RoAsynBindRequest (context, callingtitle, calledtitle,
41: callingaddr, calledaddr, ctxlist, defctxname,
42: prequirements, srequirements, isn, settings, ref,
43: bindargpe, qos, acc, rni, async)
44: OID context;
45: AEI callingtitle;
46: AEI calledtitle;
47: struct PSAPaddr * callingaddr;
48: struct PSAPaddr * calledaddr;
49: struct PSAPctxlist * ctxlist;
50: OID defctxname;
51: int prequirements;
52: int srequirements;
53: long isn;
54: int settings;
55: struct SSAPref * ref;
56: PE bindargpe;
57: struct QOStype * qos;
58: struct AcSAPconnect * acc;
59: struct RoNOTindication * rni;
60: int async;
61: {
62: int result;
63: PE user_data;
64: PE * user_data_p = &(user_data);
65: int ndata;
66: struct AcSAPindication aci_s;
67: struct AcSAPindication * aci = &(aci_s);
68: struct AcSAPabort * aca = &(aci->aci_abort);
69:
70:
71: /* Wrap the user data with the remote operations BIND ARGUMENT tag */
72:
73: if (bindargpe != NULLPE)
74: {
75: if (encode_RONOT_BindArgumentValue (user_data_p, 1, 0, NULLCP, bindargpe) == NOTOK)
76: {
77: LLOG (rosap_log, LLOG_NOTICE, ("RO-BIND.REQUEST : encode_RONOT_BindArgumentValue failed"));
78: return (ronotlose (rni, RBI_ENC_BIND_ARG, NULLCP, NULLCP));
79: }
80:
81: /*
82: * Set the context of the user data presentation element
83: * from the context of the bind argument presentation element
84: */
85: (*user_data_p)->pe_context = bindargpe->pe_context;
86: ndata = 1;
87: }
88: else
89: {
90: (*user_data_p) = NULLPE;
91: ndata = 0;
92: }
93:
94: result = AcAsynAssocRequest (context, callingtitle, calledtitle,
95: callingaddr, calledaddr, ctxlist, defctxname,
96: prequirements, srequirements, isn, settings, ref,
97: user_data_p, ndata, qos, acc, aci, async);
98:
99: if ((*user_data_p) != NULLPE)
100: {
101: pe_free ((*user_data_p));
102: }
103:
104: if (result == NOTOK)
105: {
106: LLOG (rosap_log, LLOG_NOTICE, ("RO-BIND.REQUEST : RoAsynBindRequest failed"));
107: /* Have an AcSAPindication, need to return RoNOTindication */
108: (void) acs2ronotlose (rni, "RO-BIND.REQUEST", aca);
109: ACAFREE (aca);
110: return (NOTOK);
111: }
112: else
113: {
114: struct RoSAPindication roi_s;
115:
116: if (RoSetService (acc->acc_sd, RoPService, &(roi_s)) == NOTOK)
117: {
118: LLOG (rosap_log, LLOG_NOTICE, ("RO-BIND.REQUEST : RoSetService failed"));
119: return (ronotlose (rni, RBI_SET_ROSE_PRES, NULLCP, NULLCP));
120: }
121: }
122:
123: if (((!async) && (result == OK)) || (async && (result == DONE)))
124: {
125: if (ParseRoBindResponse (acc, rni) != OK)
126: {
127: LLOG (rosap_log, LLOG_NOTICE, ("RO-BIND.REQUEST : ParseRoBindResponse failed"));
128: ACCFREE (acc);
129: return (NOTOK);
130: }
131: }
132:
133: return (result);
134: }
135:
136: /* RO-BIND.RETRY */
137:
138: /* ARGSUSED */
139:
140: int RoAsynBindRetry (ad, do_next_nsap, acc, rni)
141: int ad;
142: int do_next_nsap;
143: struct AcSAPconnect * acc;
144: struct RoNOTindication * rni;
145: {
146: int result;
147: struct AcSAPindication aci_s;
148: struct AcSAPindication * aci = &aci_s;
149: struct AcSAPabort * aca = &(aci->aci_abort);
150:
151: if (do_next_nsap)
152: {
153: result = AcAsynNextRequest (ad, acc, aci);
154: }
155: else
156: {
157: result = AcAsynRetryRequest (ad, acc, aci);
158: }
159:
160: if (result == NOTOK)
161: {
162: LLOG (rosap_log, LLOG_NOTICE, ("RO-BIND.RETRY : AcAsynRetryRequest failed"));
163: (void) acs2ronotlose (rni, "RO-BIND.RETRY", aca);
164: ACAFREE (aca);
165: return (NOTOK);
166: }
167:
168: if (result == DONE)
169: {
170: if (ParseRoBindResponse (acc, rni) != OK)
171: {
172: LLOG (rosap_log, LLOG_NOTICE, ("RO-BIND.RETRY : ParseRoBindResponse failed"));
173: ACCFREE (acc);
174: return (NOTOK);
175: }
176: }
177:
178: return (result);
179: }
180:
181: int ParseRoBindResponse (acc, rni)
182: struct AcSAPconnect *acc;
183: struct RoNOTindication * rni;
184: {
185: PE pe;
186:
187: if (acc->acc_ninfo == 0)
188: return (OK);
189:
190: if (acc->acc_ninfo != 1)
191: return (ronotlose (rni, RBI_DEC_NINFO, NULLCP, NULLCP));
192:
193: if (acc->acc_info[0] == NULLPE)
194: return (ronotlose (rni, RBI_DEC_NINFO, NULLCP, NULLCP));
195:
196: pe = acc->acc_info[0];
197: acc->acc_info[0] = NULLPE;
198: if (acc->acc_result == ACS_ACCEPT)
199: {
200: if (decode_RONOT_BindResultValue (pe, 1, NULLIP, NULLVP, &acc->acc_info[0]) != OK)
201: {
202: /* ADT: Should end association here !?! */
203: LLOG (rosap_log, LLOG_EXCEPTIONS, ("ParseRoBindResponse: decode_RONOT_BindResultValue failed"));
204: acc->acc_ninfo = 0;
205: pe_free (pe);
206: return (ronotlose (rni, RBI_DEC_BIND_RES, NULLCP, NULLCP));
207: }
208: }
209: else
210: {
211: if (decode_RONOT_BindErrorValue (pe, 1, NULLIP, NULLVP, &acc->acc_info[0]) != OK)
212: {
213: LLOG (rosap_log, LLOG_EXCEPTIONS, ("ParseRoBindResponse: decode_RONOT_BindErrorValue failed"));
214: acc->acc_ninfo = 0;
215: pe_free (pe);
216: return (ronotlose (rni, RBI_DEC_BIND_ERR, NULLCP, NULLCP));
217: }
218: }
219: pe_free (pe);
220:
221: return (OK);
222: }
223:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.