|
|
1.1 root 1: /* dsapresult.c - DSAP : Send operation results */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/dsap/net/RCS/dsapresult.c,v 7.0 90/07/26 14:45:58 mrose Exp $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/dsap/net/RCS/dsapresult.c,v 7.0 90/07/26 14:45:58 mrose Exp $
9: *
10: *
11: * $Log: dsapresult.c,v $
12: * Revision 7.0 90/07/26 14:45:58 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 DapResultRequest (sd, id, res, di)
37: int sd;
38: int id;
39: struct DSResult * res;
40: struct DSAPindication * di;
41: {
42: int result;
43: PE res_pe;
44: struct RoSAPindication roi_s;
45: struct RoSAPindication * roi = &(roi_s);
46: struct RoSAPpreject * rop = &(roi->roi_preject);
47:
48: if (DapEncodeResult (&(res_pe), res) != OK)
49: {
50: LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapResultRequest: Encoding failed"));
51: return (dsapreject (di, DP_INVOKE, id, NULLCP, "Failed to encode operation result"));
52: }
53:
54: result = RoResultRequest (sd, id, res->result_type, res_pe, ROS_NOPRIO, roi);
55:
56: if (result != OK)
57: {
58: if (ROS_FATAL (rop->rop_reason) || (rop->rop_reason == ROS_PARAMETER))
59: {
60: LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapResultRequest(): Fatal rejection"));
61: return (dsaplose (di, DP_INVOKE, NULLCP, "RoResultRequest failed"));
62: }
63: else
64: {
65: LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapResultRequest(): Non-Fatal rejection"));
66: return (dsapreject (di, DP_INVOKE, id, NULLCP, "RoResultRequest failed"));
67: }
68: }
69:
70: if (res_pe != NULLPE)
71: pe_free (res_pe);
72: return (OK);
73: }
74:
75: int DapEncodeResult (pep, res)
76: PE * pep;
77: struct DSResult * res;
78: {
79: int success;
80:
81: switch(res->result_type)
82: {
83: case OP_READ :
84: success = encode_DAS_ReadResult(pep,1,0,NULLCP,&(res->res_rd));
85: break;
86: case OP_COMPARE :
87: success = encode_DAS_CompareResult(pep,1,0,NULLCP,&(res->res_cm));
88: break;
89: case OP_ABANDON :
90: success = encode_DAS_AbandonResult(pep,1,0,NULLCP,NULLCP);
91: break;
92: case OP_LIST :
93: success = encode_DAS_ListResult(pep,1,0,NULLCP,&(res->res_ls));
94: break;
95: case OP_SEARCH :
96: merge_search_results (&res->res_sr,res->res_sr.srr_next);
97: success = encode_DAS_SearchResult(pep,1,0,NULLCP,&(res->res_sr));
98: break;
99: case OP_ADDENTRY :
100: success = encode_DAS_AddEntryResult(pep,1,0,NULLCP,NULLCP);
101: break;
102: case OP_REMOVEENTRY :
103: success = encode_DAS_RemoveEntryResult(pep,1,0,NULLCP,NULLCP);
104: break;
105: case OP_MODIFYENTRY :
106: success = encode_DAS_ModifyEntryResult(pep,1,0,NULLCP,NULLCP);
107: break;
108: case OP_MODIFYRDN :
109: success = encode_DAS_ModifyRDNResult(pep,1,0,NULLCP,NULLCP);
110: break;
111: default :
112: success = NOTOK;
113: LLOG(log_dsap, LLOG_EXCEPTIONS, ("DapEncodeResult(): unknown op type %d", res->result_type));
114: break;
115: }
116:
117: return(success);
118: }
119:
120: int DspResultRequest (sd, id, res, di)
121: int sd;
122: int id;
123: struct ds_op_res * res;
124: struct DSAPindication * di;
125: {
126: int result;
127: PE res_pe;
128: struct RoSAPindication roi_s;
129: struct RoSAPindication * roi = &(roi_s);
130: struct RoSAPpreject * rop = &(roi->roi_preject);
131:
132: if (DspEncodeResult (&(res_pe), res) != OK)
133: {
134: LLOG (log_dsap, LLOG_EXCEPTIONS, ("DspResultRequest: Encoding failed"));
135: return (dsapreject (di, DP_INVOKE, id, NULLCP, "Failed to encode operation result"));
136: }
137:
138: result = RoResultRequest (sd, id, res->dcr_dsres.result_type, res_pe,
139: 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, ("DspResultRequest(): Fatal rejection"));
146: return (dsaplose (di, DP_INVOKE, NULLCP, "RoResultRequest failed"));
147: }
148: else
149: {
150: LLOG (log_dsap, LLOG_EXCEPTIONS, ("DspResultRequest(): Non-Fatal rejection"));
151: return (dsapreject (di, DP_INVOKE, id, NULLCP, "RoResultRequest failed"));
152: }
153: }
154:
155: if (res_pe != NULLPE)
156: pe_free (res_pe);
157: return (OK);
158: }
159:
160: int DspEncodeResult (pep, res)
161: PE * pep;
162: struct ds_op_res * res;
163: {
164: int success;
165:
166: switch(res->dcr_dsres.result_type)
167: {
168: case OP_READ :
169: success = encode_DO_ChainedReadResult(pep,1,0,NULLCP,res);
170: break;
171: case OP_COMPARE :
172: success = encode_DO_ChainedCompareResult(pep,1,0,NULLCP,res);
173: break;
174: case OP_ABANDON :
175: success = encode_DAS_AbandonResult(pep,1,0,NULLCP,NULLCP);
176: break;
177: case OP_LIST :
178: success = encode_DO_ChainedListResult(pep,1,0,NULLCP,res);
179: break;
180: case OP_SEARCH :
181: merge_search_results (&res->dcr_dsres.res_sr,res->dcr_dsres.res_sr.srr_next);
182: success = encode_DO_ChainedSearchResult(pep,1,0,NULLCP,res);
183: break;
184: case OP_ADDENTRY :
185: success = encode_DO_ChainedAddEntryResult(pep,1,0,NULLCP,res);
186: break;
187: case OP_REMOVEENTRY :
188: success = encode_DO_ChainedRemoveEntryResult(pep,1,0,NULLCP,res);
189: break;
190: case OP_MODIFYENTRY :
191: success = encode_DO_ChainedModifyEntryResult(pep,1,0,NULLCP,res);
192: break;
193: case OP_MODIFYRDN :
194: success = encode_DO_ChainedModifyRDNResult(pep,1,0,NULLCP,res);
195: break;
196: default:
197: success = NOTOK;
198: LLOG(log_dsap, LLOG_EXCEPTIONS, ("DspEncodeResult(): unknown op type %d", res->dcr_dsres.result_type));
199: break;
200: }
201:
202: return(success);
203: }
204:
205: int QspResultRequest (sd, id, res, di)
206: int sd;
207: int id;
208: struct ds_op_res * res;
209: struct DSAPindication * di;
210: {
211: int result;
212: PE res_pe;
213: struct RoSAPindication roi_s;
214: struct RoSAPindication * roi = &(roi_s);
215: struct RoSAPpreject * rop = &(roi->roi_preject);
216:
217: if (QspEncodeResult (&(res_pe), res) != OK)
218: {
219: LLOG (log_dsap, LLOG_EXCEPTIONS, ("QspResultRequest: Encoding failed"));
220: return (dsapreject (di, DP_INVOKE, id, NULLCP, "Failed to encode operation result"));
221: }
222:
223: result = RoResultRequest (sd, id, res->dcr_dsres.result_type, res_pe,
224: ROS_NOPRIO, roi);
225:
226: if (result != OK)
227: {
228: if (ROS_FATAL (rop->rop_reason) || (rop->rop_reason == ROS_PARAMETER))
229: {
230: LLOG (log_dsap, LLOG_EXCEPTIONS, ("QspResultRequest(): Fatal rejection"));
231: return (dsaplose (di, DP_INVOKE, NULLCP, "RoResultRequest failed"));
232: }
233: else
234: {
235: LLOG (log_dsap, LLOG_EXCEPTIONS, ("QspResultRequest(): Non-Fatal rejection"));
236: return (dsapreject (di, DP_INVOKE, id, NULLCP, "RoResultRequest failed"));
237: }
238: }
239:
240: if (res_pe != NULLPE)
241: pe_free (res_pe);
242: return (OK);
243: }
244:
245: int QspEncodeResult (pep, res)
246: PE * pep;
247: struct ds_op_res * res;
248: {
249: int success;
250:
251: switch(res->dcr_dsres.result_type)
252: {
253: case OP_READ :
254: success = encode_DO_ChainedReadResult(pep,1,0,NULLCP,res);
255: break;
256: case OP_COMPARE :
257: success = encode_DO_ChainedCompareResult(pep,1,0,NULLCP,res);
258: break;
259: case OP_ABANDON :
260: success = encode_DAS_AbandonResult(pep,1,0,NULLCP,NULLCP);
261: break;
262: case OP_LIST :
263: success = encode_DO_ChainedListResult(pep,1,0,NULLCP,res);
264: break;
265: case OP_SEARCH :
266: merge_search_results (&res->dcr_dsres.res_sr,res->dcr_dsres.res_sr.srr_next);
267: success = encode_DO_ChainedSearchResult(pep,1,0,NULLCP,res);
268: break;
269: case OP_ADDENTRY :
270: success = encode_DO_ChainedAddEntryResult(pep,1,0,NULLCP,res);
271: break;
272: case OP_REMOVEENTRY :
273: success = encode_DO_ChainedRemoveEntryResult(pep,1,0,NULLCP,res);
274: break;
275: case OP_MODIFYENTRY :
276: success = encode_DO_ChainedModifyEntryResult(pep,1,0,NULLCP,res);
277: break;
278: case OP_MODIFYRDN :
279: success = encode_DO_ChainedModifyRDNResult(pep,1,0,NULLCP,res);
280: break;
281: case OP_GETEDB :
282: success = encode_Quipu_GetEntryDataBlockResult(pep,1,0,NULLCP,&(res->dcr_dsres.res_ge));
283: break;
284: default:
285: success = NOTOK;
286: LLOG(log_dsap, LLOG_EXCEPTIONS, ("QspEncodeResult(): unknown op type %d", res->dcr_dsres.result_type));
287: break;
288: }
289:
290: return(success);
291: }
292:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.