|
|
1.1 root 1: /* dapwait.c - DAP: Deal with incoming activity */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/dsap/net/RCS/dapwait.c,v 7.0 90/07/26 14:45:31 mrose Exp $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/dsap/net/RCS/dapwait.c,v 7.0 90/07/26 14:45:31 mrose Exp $
9: *
10: *
11: * $Log: dapwait.c,v $
12: * Revision 7.0 90/07/26 14:45:31 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 "logger.h"
31: #include "quipu/util.h"
32: #include "quipu/dap2.h"
33:
34:
35: extern LLog * log_dsap;
36:
37: #ifdef PDU_DUMP
38: #define DUMP_ARG "arg"
39: #define DUMP_RES "res"
40: #define DUMP_ERR "err"
41: #endif
42:
43: /*
44: * Wait routine for a DAP initiator.
45: */
46:
47: /* ARGSUSED */
48:
49: int DapInitWaitRequest (sd, secs, di)
50: int sd;
51: int secs;
52: struct DAPindication * di;
53: {
54: int result;
55: struct RoSAPindication roi_s;
56: struct RoSAPindication * roi = &(roi_s);
57:
58: DLOG (log_dsap,LLOG_TRACE,( "DapInitWaitRequest()"));
59:
60: result = RoWaitRequest(sd, secs, roi);
61:
62: if (result == NOTOK)
63: {
64: return (ros2daplose (di, "RoBindWaitRequest", &(roi->roi_preject)));
65: }
66:
67: switch(roi->roi_type)
68: {
69: case ROI_INVOKE:
70: LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapInitWaitRequest: Invocation received"));
71: DRejectRequest (sd, ROS_IP_UNRECOG, roi->roi_invoke.rox_id);
72: return (daplose (di, DP_ROS, NULLCP, "DAP initiator cannot accept invokes"));
73:
74: case ROI_RESULT:
75: return (DapDecodeResult (sd, &(roi->roi_result), di));
76:
77: case ROI_ERROR:
78: return (DapDecodeError (sd, &(roi->roi_error), di));
79:
80: case ROI_UREJECT:
81: LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapInitWaitRequest: Operation (%d) user rejected (%d)", roi->roi_ureject.rou_id, roi->roi_ureject.rou_reason));
82: return (ros2dapreject(di, "ROI_UREJECT", &(roi->roi_ureject)));
83:
84: case ROI_PREJECT:
85: LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapInitWaitRequest: Operation (%d) provider rejected", roi->roi_preject.rop_id));
86: return (ros2daplose (di, "ROI_PREJECT", &(roi->roi_preject)));
87:
88: case ROI_FINISH:
89: LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapInitWaitRequest: Unbind request received"));
90: return (daplose (di, DP_ROS, NULLCP, "DAP initiator cannot accept unbind requests"));
91:
92: default:
93: LLOG (log_dsap,LLOG_EXCEPTIONS,( "Unknown indication type : %d", roi->roi_type));
94: return (daplose (di, DP_ROS, NULLCP, "DapInitWaitRequest(): RoWaitRequest error"));
95: }
96: /* NOT REACHED */
97: }
98:
99: int DapDecodeResult (sd, ror, di)
100: int sd;
101: struct RoSAPresult * ror;
102: struct DAPindication * di;
103: {
104: int success;
105: PE pe = ror->ror_result;
106: struct DSResult * res = &(di->di_result.dr_res);
107:
108: di->di_type = DI_RESULT;
109: di->di_result.dr_id = ror->ror_id;
110:
111: #ifdef PDU_DUMP
112: pdu_dump (pe,DUMP_RES,ror->ror_op);
113: #endif
114:
115: #ifdef HEAVY_DEBUG
116: pdu_res_log (pe, ror->ror_op);
117: #endif
118:
119: switch(res->result_type = ror->ror_op)
120: {
121: case OP_READ :
122: success = decode_DAS_ReadResult(pe,1,NULLIP,NULLVP,&(res->res_rd));
123: break;
124: case OP_COMPARE :
125: success = decode_DAS_CompareResult(pe,1,NULLIP,NULLVP,&(res->res_cm));
126: break;
127: case OP_ABANDON :
128: success = decode_DAS_AbandonResult(pe,1,NULLIP,NULLVP,NULLCP);
129: break;
130: case OP_LIST :
131: success = decode_DAS_ListResult(pe,1,NULLIP,NULLVP,&(res->res_ls));
132: break;
133: case OP_SEARCH :
134: success = decode_DAS_SearchResult(pe,1,NULLIP,NULLVP,&(res->res_sr));
135: break;
136: case OP_ADDENTRY :
137: success = decode_DAS_AddEntryResult(pe,1,NULLIP,NULLVP,NULLCP);
138: break;
139: case OP_REMOVEENTRY :
140: success = decode_DAS_RemoveEntryResult(pe,1,NULLIP,NULLVP,NULLCP);
141: break;
142: case OP_MODIFYENTRY :
143: success = decode_DAS_ModifyEntryResult(pe,1,NULLIP,NULLVP,NULLCP);
144: break;
145: case OP_MODIFYRDN :
146: success = decode_DAS_ModifyRDNResult(pe,1,NULLIP,NULLVP,NULLCP);
147: break;
148:
149: default:
150: LLOG(log_dsap, LLOG_EXCEPTIONS, ("DapDecodeResult: op id %d unknown!", ror->ror_op));
151: DRejectRequest (sd, ROS_RRP_UNRECOG, ror->ror_id);
152: return (daplose (di, DP_RESULT, NULLCP, "Unknown operation identifier"));
153: }
154:
155: if (success == NOTOK)
156: {
157: LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapDecodeResult: Unable to parse argument"));
158: DRejectRequest (sd, ROS_RRP_MISTYPED, ror->ror_id);
159: return (daplose (di, DP_RESULT, NULLCP, "Undecodable argument"));
160: }
161:
162: return(success);
163: }
164:
165: int DapDecodeError (sd, roe, di)
166: int sd;
167: struct RoSAPerror * roe;
168: struct DAPindication * di;
169: {
170: int success;
171: PE pe = roe->roe_param;
172: struct DSError * err = &(di->di_error.de_err);
173:
174: #ifdef PDU_DUMP
175: pdu_dump (pe,DUMP_ERR,roe->roe_id);
176: #endif
177:
178: di->di_type = DI_ERROR;
179: di->di_error.de_id = roe->roe_id;
180:
181: switch(err->dse_type = roe->roe_error)
182: {
183: case DSE_ABANDON_FAILED :
184: success = decode_DAS_AbandonFailedParm(pe,1,NULLIP,NULLVP,&(err->dse_un.dse_un_abandon_fail));
185: break;
186: case DSE_ATTRIBUTEERROR :
187: success = decode_DAS_AttributeErrorParm(pe,1,NULLIP,NULLVP,&(err->dse_un.dse_un_attribute));
188: break;
189: case DSE_NAMEERROR :
190: success = decode_DAS_NameErrorParm(pe,1,NULLIP,NULLVP,&(err->dse_un.dse_un_name));
191: break;
192: case DSE_REFERRAL :
193: success = decode_DAS_ReferralParm(pe,1,NULLIP,NULLVP,&(err->dse_un.dse_un_referral));
194: break;
195: case DSE_SECURITYERROR :
196: success = decode_DAS_SecurityErrorParm(pe,1,NULLIP,NULLVP,&(err->dse_un.dse_un_security));
197: break;
198: case DSE_SERVICEERROR :
199: success = decode_DAS_ServiceErrorParm(pe,1,NULLIP,NULLVP,&(err->dse_un.dse_un_service));
200: break;
201: case DSE_UPDATEERROR :
202: success = decode_DAS_UpdateErrorParm(pe,1,NULLIP,NULLVP,&(err->dse_un.dse_un_update));
203: break;
204: case DSE_ABANDONED :
205: success = ((pe == NULLPE) ? OK : NOTOK);
206: break;
207: case DSE_DSAREFERRAL :
208: success = decode_DO_DSAReferralParm(pe, 1, NULLIP, NULLVP, &(err->dse_un.dse_un_referral));
209: break;
210:
211: default:
212: LLOG(log_dsap, LLOG_EXCEPTIONS, ("DapDecodeError: op id %d unknown!", roe->roe_error));
213: DRejectRequest (sd, ROS_REP_UNRECOG, roe->roe_id);
214: return (daplose (di, DP_ERROR, NULLCP, "Unknown operation identifier"));
215: }
216:
217: if (success == NOTOK)
218: {
219: LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapDecodeError: Unable to parse argument"));
220: DRejectRequest (sd, ROS_RRP_MISTYPED, roe->roe_id);
221: return (daplose (di, DP_ERROR, NULLCP, "Undecodable argument"));
222: }
223:
224: return(success);
225: }
226:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.