|
|
1.1 root 1: /* dsaperror.c - DSAP : Return operation errors */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/dsap/net/RCS/dsaperror.c,v 7.0 90/07/26 14:45:52 mrose Exp $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/dsap/net/RCS/dsaperror.c,v 7.0 90/07/26 14:45:52 mrose Exp $
9: *
10: *
11: * $Log: dsaperror.c,v $
12: * Revision 7.0 90/07/26 14:45:52 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 DapErrorRequest (sd, id, err, di)
37: int sd;
38: int id;
39: struct DSError * err;
40: struct DSAPindication * di;
41: {
42: int result;
43: PE err_pe;
44: struct RoSAPindication roi_s;
45: struct RoSAPindication * roi = &(roi_s);
46: struct RoSAPpreject * rop = &(roi->roi_preject);
47:
48: if (DEncodeError (&(err_pe), err) != OK)
49: {
50: LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapErrorRequest: Encoding failed"));
51: return (dsapreject (di, DP_INVOKE, id, NULLCP, "Failed to encode operation error"));
52: }
53:
54: result = RoErrorRequest (sd, id, err->dse_type, err_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, ("DapErrorRequest(): Fatal rejection"));
61: return (dsaplose (di, DP_INVOKE, NULLCP, "RoErrorRequest failed"));
62: }
63: else
64: {
65: LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapErrorRequest(): Non-Fatal rejection"));
66: return (dsapreject (di, DP_INVOKE, id, NULLCP, "RoErrorRequest failed"));
67: }
68: }
69:
70: if (err_pe != NULLPE)
71: pe_free (err_pe);
72:
73: return (OK);
74: }
75:
76: int DspErrorRequest (sd, id, err, di)
77: int sd;
78: int id;
79: struct DSError * err;
80: struct DSAPindication * di;
81: {
82: int result;
83: PE err_pe;
84: struct RoSAPindication roi_s;
85: struct RoSAPindication * roi = &(roi_s);
86: struct RoSAPpreject * rop = &(roi->roi_preject);
87:
88: if (DEncodeError (&(err_pe), err) != OK)
89: {
90: LLOG (log_dsap, LLOG_EXCEPTIONS, ("DspErrorRequest: Encoding failed"));
91: return (dsapreject (di, DP_INVOKE, id, NULLCP, "Failed to encode operation error"));
92: }
93:
94: result = RoErrorRequest (sd, id, err->dse_type, err_pe, ROS_NOPRIO, roi);
95:
96: if (result != OK)
97: {
98: if (ROS_FATAL (rop->rop_reason) || (rop->rop_reason == ROS_PARAMETER))
99: {
100: LLOG (log_dsap, LLOG_EXCEPTIONS, ("DspErrorRequest(): Fatal rejection"));
101: return (dsaplose (di, DP_INVOKE, NULLCP, "RoErrorRequest failed"));
102: }
103: else
104: {
105: LLOG (log_dsap, LLOG_EXCEPTIONS, ("DspErrorRequest(): Non-Fatal rejection"));
106: return (dsapreject (di, DP_INVOKE, id, NULLCP, "RoErrorRequest failed"));
107: }
108: }
109:
110: if (err_pe != NULLPE)
111: pe_free (err_pe);
112:
113: return (OK);
114: }
115:
116: int QspErrorRequest (sd, id, err, di)
117: int sd;
118: int id;
119: struct DSError * err;
120: struct DSAPindication * di;
121: {
122: int result;
123: PE err_pe;
124: struct RoSAPindication roi_s;
125: struct RoSAPindication * roi = &(roi_s);
126: struct RoSAPpreject * rop = &(roi->roi_preject);
127:
128: if (DEncodeError (&(err_pe), err) != OK)
129: {
130: LLOG (log_dsap, LLOG_EXCEPTIONS, ("QspErrorRequest: Encoding failed"));
131: return (dsapreject (di, DP_INVOKE, id, NULLCP, "Failed to encode operation error"));
132: }
133:
134: result = RoErrorRequest (sd, id, err->dse_type, err_pe, ROS_NOPRIO, roi);
135:
136: if (result != OK)
137: {
138: if (ROS_FATAL (rop->rop_reason) || (rop->rop_reason == ROS_PARAMETER))
139: {
140: LLOG (log_dsap, LLOG_EXCEPTIONS, ("QspErrorRequest(): Fatal rejection"));
141: return (dsaplose (di, DP_INVOKE, NULLCP, "RoErrorRequest failed"));
142: }
143: else
144: {
145: LLOG (log_dsap, LLOG_EXCEPTIONS, ("QspErrorRequest(): Non-Fatal rejection"));
146: return (dsapreject (di, DP_INVOKE, id, NULLCP, "RoErrorRequest failed"));
147: }
148: }
149:
150: if (err_pe != NULLPE)
151: pe_free (err_pe);
152:
153: return (OK);
154: }
155:
156: int DEncodeError(pep, err)
157: PE *pep;
158: struct DSError *err;
159: {
160: int success;
161:
162: switch(err->dse_type)
163: {
164: case DSE_NOERROR :
165: LLOG(log_dsap, LLOG_EXCEPTIONS, ("DEncodeError(): no error"));
166: (*pep) = NULLPE;
167: success = NOTOK;
168: break;
169: case DSE_ABANDON_FAILED :
170: success = encode_DAS_AbandonFailedParm(pep,1,0,NULLCP,&(err->dse_un.dse_un_abandon_fail));
171: break;
172: case DSE_ATTRIBUTEERROR :
173: success = encode_DAS_AttributeErrorParm(pep,1,0,NULLCP,&(err->dse_un.dse_un_attribute));
174: break;
175: case DSE_NAMEERROR :
176: success = encode_DAS_NameErrorParm(pep,1,0,NULLCP,&(err->dse_un.dse_un_name));
177: break;
178: case DSE_REFERRAL :
179: success = encode_DAS_ReferralParm(pep,1,0,NULLCP,&(err->dse_un.dse_un_referral));
180: break;
181: case DSE_SECURITYERROR :
182: success = encode_DAS_SecurityErrorParm(pep,1,0,NULLCP,&(err->dse_un.dse_un_security));
183: break;
184: case DSE_SERVICEERROR :
185: success = encode_DAS_ServiceErrorParm(pep,1,0,NULLCP,&(err->dse_un.dse_un_service));
186: break;
187: case DSE_UPDATEERROR :
188: success = encode_DAS_UpdateErrorParm(pep,1,0,NULLCP,&(err->dse_un.dse_un_update));
189: break;
190: case DSE_ABANDONED :
191: (*pep) = NULLPE;
192: success = OK;
193: break;
194: case DSE_DSAREFERRAL :
195: success = encode_DO_DSAReferralParm(pep,1,0,NULLCP,&(err->dse_un.dse_un_referral));
196: break;
197: default :
198: (*pep) = NULLPE;
199: success = NOTOK;
200: LLOG(log_dsap, LLOG_EXCEPTIONS, ("DEncodeError(): unknown error %d", err->dse_type));
201: break;
202: }
203:
204: return(success);
205: }
206:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.