Removed definition "LIB= rpc". We want libc.a to contain librpc.a, not
[unix-history] / .ref-386BSD-0.1-patchkit / usr / othersrc / contrib / isode / dsap / net / dsapinvoke.c
CommitLineData
04c6839a
WJ
1/* dsapinvoke.c - DSAP : Invoke DAP operations */
2
3#ifndef lint
4static char *rcsid = "$Header: /f/osi/dsap/net/RCS/dsapinvoke.c,v 7.1 91/02/22 09:21:20 mrose Interim $";
5#endif
6
7/*
8 * $Header: /f/osi/dsap/net/RCS/dsapinvoke.c,v 7.1 91/02/22 09:21:20 mrose Interim $
9 *
10 *
11 * $Log: dsapinvoke.c,v $
12 * Revision 7.1 91/02/22 09:21:20 mrose
13 * Interim 6.8
14 *
15 * Revision 7.0 90/07/26 14:45:54 mrose
16 * *** empty log message ***
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 "logger.h"
35#include "quipu/dsap.h"
36#include "../x500as/DAS-types.h"
37#include "../x500as/Quipu-types.h"
38
39extern LLog * log_dsap;
40
41int DapInvokeRequest (sd, id, arg, di)
42int sd;
43int id;
44struct DSArgument * arg;
45struct DSAPindication * di;
46{
47 int result;
48 PE arg_pe;
49 struct RoSAPindication roi_s;
50 struct RoSAPindication * roi = &(roi_s);
51 struct RoSAPpreject * rop = &(roi->roi_preject);
52
53 if (DapEncodeInvoke (&(arg_pe), arg) != OK)
54 {
55 LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapInvokeRequest: Encoding failed"));
56 return (dsapreject (di, DP_INVOKE, id, NULLCP, "Failed to encode operation argument"));
57 }
58
59 result = RoInvokeRequest (sd, arg->arg_type, ROS_ASYNC, arg_pe,
60 id, NULLIP, ROS_NOPRIO, roi);
61
62 if (result != OK)
63 {
64 if (ROS_FATAL (rop->rop_reason) || (rop->rop_reason == ROS_PARAMETER))
65 {
66 LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapInvokeRequest(): Fatal rejection"));
67 return (dsaplose (di, DP_INVOKE, NULLCP, "RoInvokeRequest failed"));
68 }
69 else
70 {
71 LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapInvokeRequest(): Non-Fatal rejection"));
72 return (dsapreject (di, DP_INVOKE, id, NULLCP, "RoInvokeRequest failed"));
73 }
74 }
75
76 if (arg_pe != NULLPE)
77 pe_free (arg_pe);
78 return (OK);
79}
80
81int DapEncodeInvoke (pep, arg)
82PE * pep;
83struct DSArgument * arg;
84{
85 int success;
86
87 switch(arg->arg_type)
88 {
89 case OP_READ :
90 success = encode_DAS_ReadArgument(pep,1,0,NULLCP,&(arg->arg_rd));
91 break;
92 case OP_COMPARE :
93 success = encode_DAS_CompareArgument(pep,1,0,NULLCP,&(arg->arg_cm));
94 break;
95 case OP_ABANDON :
96 success = encode_DAS_AbandonArgument(pep,1,0,NULLCP,&(arg->arg_ab));
97 break;
98 case OP_LIST :
99 success = encode_DAS_ListArgument(pep,1,0,NULLCP,&(arg->arg_ls));
100 break;
101 case OP_SEARCH :
102 success = encode_DAS_SearchArgument(pep,1,0,NULLCP,&(arg->arg_sr));
103 break;
104 case OP_ADDENTRY :
105 success = encode_DAS_AddEntryArgument(pep,1,0,NULLCP,&(arg->arg_ad));
106 break;
107 case OP_REMOVEENTRY :
108 success = encode_DAS_RemoveEntryArgument(pep,1,0,NULLCP,&(arg->arg_rm));
109 break;
110 case OP_MODIFYENTRY :
111 success = encode_DAS_ModifyEntryArgument(pep,1,0,NULLCP,&(arg->arg_me));
112 break;
113 case OP_MODIFYRDN :
114 success = encode_DAS_ModifyRDNArgument(pep,1,0,NULLCP,&(arg->arg_mr));
115 break;
116 default :
117 success = NOTOK;
118 LLOG(log_dsap, LLOG_EXCEPTIONS, ("DapEncodeInvoke(): unknown op type %d", arg->arg_type));
119 break;
120 }
121
122 return(success);
123}
124
125int DspInvokeRequest (sd, id, arg, di)
126int sd;
127int id;
128struct ds_op_arg * arg;
129struct DSAPindication * di;
130{
131 int result;
132 PE arg_pe;
133 struct RoSAPindication roi_s;
134 struct RoSAPindication * roi = &(roi_s);
135 struct RoSAPpreject * rop = &(roi->roi_preject);
136
137 if (DspEncodeInvoke (&(arg_pe), arg) != OK)
138 {
139 LLOG (log_dsap, LLOG_EXCEPTIONS, ("DspInvokeRequest: Encoding failed"));
140 return (dsapreject (di, DP_INVOKE, id, NULLCP, "Failed to encode operation argument"));
141 }
142
143 watch_dog("RoInvokeRequest (DSP)");
144 result = RoInvokeRequest (sd, arg->dca_dsarg.arg_type, ROS_ASYNC, arg_pe,
145 id, NULLIP, ROS_NOPRIO, roi);
146 watch_dog_reset();
147
148 if (result != OK)
149 {
150 if (ROS_FATAL (rop->rop_reason) || (rop->rop_reason == ROS_PARAMETER))
151 {
152 LLOG (log_dsap, LLOG_EXCEPTIONS, ("DspInvokeRequest(): Fatal rejection"));
153 return (dsaplose (di, DP_INVOKE, NULLCP, "RoInvokeRequest failed"));
154 }
155 else
156 {
157 LLOG (log_dsap, LLOG_EXCEPTIONS, ("DspInvokeRequest(): Non-Fatal rejection"));
158 return (dsapreject (di, DP_INVOKE, id, NULLCP, "RoInvokeRequest failed"));
159 }
160 }
161
162 if (arg_pe != NULLPE)
163 pe_free (arg_pe);
164 return (OK);
165}
166
167int DspEncodeInvoke (pep, arg)
168PE * pep;
169struct ds_op_arg * arg;
170{
171 int success;
172
173 switch(arg->dca_dsarg.arg_type)
174 {
175 case OP_READ :
176 success = encode_DO_ChainedReadArgument(pep,1,0,NULLCP,arg);
177 break;
178 case OP_COMPARE :
179 success = encode_DO_ChainedCompareArgument(pep,1,0,NULLCP,arg);
180 break;
181 case OP_ABANDON :
182 success = encode_DAS_AbandonArgument(pep,1,0,NULLCP,&(arg->dca_dsarg.arg_ab));
183 break;
184 case OP_LIST :
185 success = encode_DO_ChainedListArgument(pep,1,0,NULLCP,arg);
186 break;
187 case OP_SEARCH :
188 success = encode_DO_ChainedSearchArgument(pep,1,0,NULLCP,arg);
189 break;
190 case OP_ADDENTRY :
191 success = encode_DO_ChainedAddEntryArgument(pep,1,0,NULLCP,arg);
192 break;
193 case OP_REMOVEENTRY :
194 success = encode_DO_ChainedRemoveEntryArgument(pep,1,0,NULLCP,arg);
195 break;
196 case OP_MODIFYENTRY :
197 success = encode_DO_ChainedModifyEntryArgument(pep,1,0,NULLCP,arg);
198 break;
199 case OP_MODIFYRDN :
200 success = encode_DO_ChainedModifyRDNArgument(pep,1,0,NULLCP,arg);
201 break;
202 default :
203 success = NOTOK;
204 LLOG(log_dsap, LLOG_EXCEPTIONS, ("DspEncodeInvoke(): unknown op type %d", arg->dca_dsarg.arg_type));
205 break;
206 }
207
208 return(success);
209}
210
211int QspInvokeRequest (sd, id, arg, di)
212int sd;
213int id;
214struct ds_op_arg * arg;
215struct DSAPindication * di;
216{
217 int result;
218 PE arg_pe;
219 struct RoSAPindication roi_s;
220 struct RoSAPindication * roi = &(roi_s);
221 struct RoSAPpreject * rop = &(roi->roi_preject);
222
223 if (QspEncodeInvoke (&(arg_pe), arg) != OK)
224 {
225 LLOG (log_dsap, LLOG_EXCEPTIONS, ("QspInvokeRequest: Encoding failed"));
226 return (dsapreject (di, DP_INVOKE, id, NULLCP, "Failed to encode operation argument"));
227 }
228
229 watch_dog("RoInvokeRequest (QSP)");
230 result = RoInvokeRequest (sd, arg->dca_dsarg.arg_type, ROS_ASYNC, arg_pe,
231 id, NULLIP, ROS_NOPRIO, roi);
232 watch_dog_reset();
233
234 if (result != OK)
235 {
236 if (ROS_FATAL (rop->rop_reason) || (rop->rop_reason == ROS_PARAMETER))
237 {
238 LLOG (log_dsap, LLOG_EXCEPTIONS, ("QspInvokeRequest(): Fatal rejection"));
239 return (dsaplose (di, DP_INVOKE, NULLCP, "RoInvokeRequest failed"));
240 }
241 else
242 {
243 LLOG (log_dsap, LLOG_EXCEPTIONS, ("QspInvokeRequest(): Non-Fatal rejection"));
244 return (dsapreject (di, DP_INVOKE, id, NULLCP, "RoInvokeRequest failed"));
245 }
246 }
247
248 if (arg_pe != NULLPE)
249 pe_free (arg_pe);
250 return (OK);
251}
252
253int QspEncodeInvoke (pep, arg)
254PE * pep;
255struct ds_op_arg * arg;
256{
257 int success;
258
259 switch(arg->dca_dsarg.arg_type)
260 {
261 case OP_READ :
262 success = encode_DO_ChainedReadArgument(pep,1,0,NULLCP,arg);
263 break;
264 case OP_COMPARE :
265 success = encode_DO_ChainedCompareArgument(pep,1,0,NULLCP,arg);
266 break;
267 case OP_ABANDON :
268 success = encode_DAS_AbandonArgument(pep,1,0,NULLCP,&(arg->dca_dsarg.arg_ab));
269 break;
270 case OP_LIST :
271 success = encode_DO_ChainedListArgument(pep,1,0,NULLCP,arg);
272 break;
273 case OP_SEARCH :
274 success = encode_DO_ChainedSearchArgument(pep,1,0,NULLCP,arg);
275 break;
276 case OP_ADDENTRY :
277 success = encode_DO_ChainedAddEntryArgument(pep,1,0,NULLCP,arg);
278 break;
279 case OP_REMOVEENTRY :
280 success = encode_DO_ChainedRemoveEntryArgument(pep,1,0,NULLCP,arg);
281 break;
282 case OP_MODIFYENTRY :
283 success = encode_DO_ChainedModifyEntryArgument(pep,1,0,NULLCP,arg);
284 break;
285 case OP_MODIFYRDN :
286 success = encode_DO_ChainedModifyRDNArgument(pep,1,0,NULLCP,arg);
287 break;
288 case OP_GETEDB :
289 success = encode_Quipu_GetEntryDataBlockArgument(pep,1,0,NULLCP,&(arg->dca_dsarg.arg_ge));
290 break;
291 default :
292 success = NOTOK;
293 LLOG(log_dsap, LLOG_EXCEPTIONS, ("QspEncodeInvoke(): unknown op type %d", arg->dca_dsarg.arg_type));
294 break;
295 }
296
297 return(success);
298}
299