|
|
1.1 root 1: /* ryopinvoke.c - ROSY: invoke */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/rosy/RCS/ryopinvoke.c,v 7.1 90/07/01 21:06:38 mrose Exp $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/rosy/RCS/ryopinvoke.c,v 7.1 90/07/01 21:06:38 mrose Exp $
9: *
10: *
11: * $Log: ryopinvoke.c,v $
12: * Revision 7.1 90/07/01 21:06:38 mrose
13: * pepsy
14: *
15: * Revision 7.0 89/11/23 22:22:03 mrose
16: * Release 6.0
17: *
18: */
19:
20: /*
21: * NOTICE
22: *
23: * Acquisition, use, and distribution of this module and related
24: * materials are subject to the restrictions of a license agreement.
25: * Consult the Preface in the User's Manual for the full terms of
26: * this agreement.
27: *
28: */
29:
30:
31: /* LINTLIBRARY */
32:
33: #include <stdio.h>
34: #include "rosy.h"
35:
36:
37: #define missingP(p) \
38: { \
39: if (p == NULL) \
40: return rosaplose (roi, ROS_PARAMETER, NULLCP, \
41: "mandatory parameter \"%s\" missing", "p"); \
42: }
43:
44: /* INVOKE */
45:
46: int RyOpInvoke (sd, ryo, op, in, out, rfx, efx, class, invokeID, linkedID,
47: priority, roi)
48: int sd;
49: register struct RyOperation *ryo;
50: int op,
51: class,
52: invokeID,
53: *linkedID,
54: priority;
55: caddr_t in,
56: *out;
57: IFP rfx,
58: efx;
59: struct RoSAPindication *roi;
60: {
61: int result;
62: PE pe;
63: register struct opsblk *opb;
64:
65: missingP (ryo);
66: missingP (roi);
67:
68: if (opb = findopblk (sd, invokeID, OPB_INITIATOR))
69: return rosaplose (roi, ROS_IP_DUP, NULLCP, NULLCP);
70:
71: for (; ryo -> ryo_name; ryo++)
72: if (ryo -> ryo_op == op)
73: break;
74: if (!ryo -> ryo_name)
75: return rosaplose (roi, ROS_PARAMETER, NULLCP,
76: "unknown operation code %d", op);
77:
78: #ifdef PEPSY_DEFINITIONS
79: if (ryo -> ryo_arg_mod) {
80: #else
81: if (ryo -> ryo_arg_encode) {
82: #endif
83: #ifdef notdef
84: missingP (in);
85: #endif
86: PY_pepy[0] = 0;
87: #ifdef PEPSY_DEFINITIONS
88: if (enc_f (ryo -> ryo_arg_index, ryo -> ryo_arg_mod, &pe, 1, NULL,
89: NULLCP, in) == NOTOK)
90: #else
91: if ((*ryo -> ryo_arg_encode) (&pe, 1, NULL, NULLCP, in) == NOTOK)
92: #endif
93: return rosaplose (roi, ROS_CONGEST, NULLCP,
94: "error encoding argument for invocation %d operation %s/%d [%s]",
95: invokeID, ryo -> ryo_name, ryo -> ryo_op, PY_pepy);
96: }
97: else {
98: if (in)
99: return rosaplose (roi, ROS_PARAMETER, NULLCP,
100: "argument not permitted with operation %s/%d",
101: ryo -> ryo_name, ryo -> ryo_op);
102:
103: pe = NULLPE;
104: }
105:
106: if (ryo -> ryo_result || ryo -> ryo_errors) {
107: if (out) {
108: if (rfx || efx)
109: return rosaplose (roi, ROS_PARAMETER, NULLCP,
110: "out is exclusive with rfx/efx parameters");
111: }
112: else {
113: if (ryo -> ryo_result) {
114: missingP (rfx);
115: }
116: missingP (efx);
117: }
118:
119: if ((opb = newopblk (sd, invokeID)) == NULLOPB) {
120: if (pe)
121: pe_free (pe);
122: return rosaplose (roi, ROS_CONGEST, NULLCP, NULLCP);
123: }
124:
125: opb -> opb_ryo = ryo;
126: opb -> opb_resfnx = rfx, opb -> opb_errfnx = efx;
127: }
128: else {
129: if (class != ROS_ASYNC) {
130: if (pe)
131: pe_free (pe);
132: return rosaplose (roi, ROS_PARAMETER, NULLCP,
133: "ASYNC class must be used with operation %s/%d",
134: ryo -> ryo_name, ryo -> ryo_op);
135: }
136:
137: opb = NULLOPB;
138: }
139:
140: result = RoInvokeRequest (sd, ryo -> ryo_op, class, pe, invokeID, linkedID,
141: priority, roi);
142:
143: if (pe)
144: pe_free (pe);
145:
146: switch (result) {
147: case NOTOK:
148: case DONE:
149: break;
150:
151: case OK:
152: if (class == ROS_ASYNC)
153: return OK;
154: return RyWaitAux (sd, opb, out, NOTOK, roi);
155:
156: default:
157: result = rosaplose (roi, ROS_PROTOCOL, NULLCP,
158: "unknown return from RoInvokeRequest=%d", result);
159: break;
160: }
161:
162: freeopblk (opb);
163:
164: return result;
165: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.