Start development on 386BSD 0.0
[unix-history] / .ref-BSD-4_3_Net_2 / usr / src / contrib / isode / rosy / rydserror.c
CommitLineData
9e8e5516
C
1/* rydserror.c - ROSY: return error to invocation */
2
3#ifndef lint
4static char *rcsid = "$Header: /f/osi/rosy/RCS/rydserror.c,v 7.2 91/02/22 09:41:57 mrose Interim $";
5#endif
6
7/*
8 * $Header: /f/osi/rosy/RCS/rydserror.c,v 7.2 91/02/22 09:41:57 mrose Interim $
9 *
10 *
11 * $Log: rydserror.c,v $
12 * Revision 7.2 91/02/22 09:41:57 mrose
13 * Interim 6.8
14 *
15 * Revision 7.1 90/07/01 21:06:31 mrose
16 * pepsy
17 *
18 * Revision 7.0 89/11/23 22:21:56 mrose
19 * Release 6.0
20 *
21 */
22
23/*
24 * NOTICE
25 *
26 * Acquisition, use, and distribution of this module and related
27 * materials are subject to the restrictions of a license agreement.
28 * Consult the Preface in the User's Manual for the full terms of
29 * this agreement.
30 *
31 */
32
33
34/* LINTLIBRARY */
35
36#include <stdio.h>
37#include "rosy.h"
38
39
40#define missingP(p) \
41{ \
42 if (p == NULL) \
43 return rosaplose (roi, ROS_PARAMETER, NULLCP, \
44 "mandatory parameter \"%s\" missing", "p"); \
45}
46
47/* \f ERROR */
48
49int RyDsError (sd, id, err, out, priority, roi)
50int sd;
51int id,
52 err,
53 priority;
54caddr_t out;
55struct RoSAPindication *roi;
56{
57 int result;
58 PE pe;
59 register struct opsblk *opb;
60 register struct RyError **ryep,
61 *rye;
62 register struct RyOperation *ryo;
63
64 missingP (roi);
65
66 if ((opb = findopblk (sd, id, OPB_RESPONDER)) == NULLOPB)
67 return rosaplose (roi, ROS_PARAMETER, NULLCP,
68 "invocation %d not in progress on association %d",
69 id, sd);
70
71 ryo = opb -> opb_ryo;
72 if (!(ryep = ryo -> ryo_errors))
73 return rosaplose (roi, ROS_PARAMETER, NULLCP,
74 "error not permitted with operation %s/%d",
75 ryo -> ryo_name, ryo -> ryo_op);
76
77 for (; *ryep; ryep++)
78 if ((*ryep) -> rye_err == err)
79 break;
80
81 if (!(rye = *ryep))
82 return rosaplose (roi, ROS_PARAMETER, NULLCP,
83 "error %d not permitted with operation %s/%d",
84 err, ryo -> ryo_name, ryo -> ryo_op);
85
86#ifdef PEPSY_DEFINITIONS
87 if (rye -> rye_param_mod) {
88#else
89 if (rye -> rye_param_encode) {
90#endif
91#ifdef notdef
92 missingP (out);
93#endif
94 PY_pepy[0] = 0;
95#ifdef PEPSY_DEFINITIONS
96 if (enc_f (rye -> rye_param_index, rye -> rye_param_mod, &pe, 1, NULL,
97 NULLCP, out) == NOTOK)
98#else
99 if ((*rye -> rye_param_encode) (&pe, 1, NULL, NULLCP, out) == NOTOK)
100#endif
101 return rosaplose (roi, ROS_CONGEST, NULLCP,
102 "error encoding parameter for invocation %d having %s/%d [%s]",
103 opb -> opb_id, rye -> rye_name, rye -> rye_err,
104 PY_pepy);
105 }
106 else {
107 if (out)
108 return rosaplose (roi, ROS_PARAMETER, NULLCP,
109 "error parameter not permitted with operation %s/%d",
110 rye -> rye_name, rye -> rye_err);
111
112 pe = NULLPE;
113 }
114
115 if ((result = RoErrorRequest (sd, id, err, pe, priority, roi)) != NOTOK)
116 freeopblk (opb);
117
118 if (pe)
119 pe_free (pe);
120
121 return result;
122
123}