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