|
|
1.1 root 1: /* rosapresult.c - ROPM: result */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/rosap/RCS/rosapresult.c,v 7.1 90/07/01 21:06:04 mrose Exp $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/rosap/RCS/rosapresult.c,v 7.1 90/07/01 21:06:04 mrose Exp $
9: *
10: * Based on an TCP-based implementation by George Michaelson of University
11: * College London.
12: *
13: *
14: * $Log: rosapresult.c,v $
15: * Revision 7.1 90/07/01 21:06:04 mrose
16: * pepsy
17: *
18: * Revision 6.0 89/03/18 23:42:28 mrose
19: * Release 5.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 <signal.h>
38: #include "ROS-types.h"
39: #include "ropkt.h"
40:
41: /* RO-RESULT.REQUEST */
42:
43: int RoResultRequest (sd, invokeID, op, result, priority, roi)
44: int sd;
45: int invokeID,
46: op,
47: priority;
48: PE result;
49: struct RoSAPindication *roi;
50: {
51: SBV smask;
52: int status;
53: register struct assocblk *acb;
54:
55: missingP (roi);
56:
57: smask = sigioblock ();
58:
59: rosapPsig (acb, sd);
60:
61: status = RoResultRequestAux (acb, invokeID, op, result, priority, roi);
62:
63: (void) sigiomask (smask);
64:
65: return status;
66: }
67:
68: /* */
69:
70: static int RoResultRequestAux (acb, invokeID, op, result, priority, roi)
71: register struct assocblk *acb;
72: int invokeID,
73: op,
74: priority;
75: PE result;
76: struct RoSAPindication *roi;
77: {
78: register PE pe,
79: p,
80: q;
81:
82: if ((acb -> acb_flags & ACB_INIT) && (acb -> acb_flags & ACB_ROS))
83: return rosaplose (roi, ROS_OPERATION, NULLCP, "not responder");
84: if (!(acb -> acb_flags & ACB_ACS)) {
85: missingP (result);
86: }
87:
88: if (acb -> acb_ready
89: && !(acb -> acb_flags & ACB_TURN)
90: && (*acb -> acb_ready) (acb, priority, roi) == NOTOK)
91: return NOTOK;
92:
93: #ifdef notyet
94: if (!(acb -> acb_flags & ACB_ACS)) { /* want OPDU */
95: struct type_ROS_OPDU opdu;
96: struct type_ROS_ReturnResult rrs;
97: struct type_ROS_InvokeIDType idtyp;
98:
99: opdu.offset = type_ROS_OPDU_2;
100: opdu.un.choice_ROS_9 = &rrs;
101: rrs.invokeID = &idtyp;
102: rrs.result = result;
103: idtyp.parm = invokeID;
104:
105: if (encode_ROS_OPDU(&pe, 1, 0, NULL, &opdu) == NOTOK) {
106: abort();
107: goto fail;
108: }
109: } else {
110: struct type_ROS_ROSEapdus apdu;
111: struct type_ROS_RORSapdu ras;
112: struct type_ROS_InvokeIDType idtyp;
113: struct element_ROS_1 el1;
114: struct type_ROS_Operation ops;
115:
116: apdu.offset = type_ROS_ROSEapdus_rors__apdu;
117: apdu.un.rors__apdu = &ras;
118: idtyp.parm = invokeID;
119: ras.invokeID = &idtyp;
120: if (result) {
121: ras.element_ROS_0 = &el1;
122: el1.operation__value = &ops;
123: ops.parm = op;
124: el1.result = result;
125: } else
126: ras.element_ROS_0 = (struct element_ROS_1 *)0;
127:
128: if (encode_ROS_ROSEapdus(&pe, 1, 0, NULL, &apdu) == NOTOK) {
129: fail:
130: if (pe) {
131: (void) pe_extract (pe, result);
132: pe_free (pe);
133: }
134: freeacblk (acb);
135: return rosaplose (roi, ROS_CONGEST, NULLCP, "out of memory");
136: }
137: }
138:
139: #endif
140:
141: /* begin Result APDU */
142: if ((pe = pe_alloc (PE_CLASS_CONT, PE_FORM_CONS, APDU_RESULT)) == NULLPE
143: || ((acb -> acb_flags & ACB_ACS)
144: ? (p = pe, 0)
145: : set_add (pe, p = pe_alloc (PE_CLASS_UNIV, PE_FORM_CONS,
146: PE_CONS_SEQ)) == NOTOK)
147: || seq_add (p, int2prim (invokeID), -1) == NOTOK
148: || ((acb -> acb_flags & ACB_ACS)
149: ? (result
150: && (seq_add (p, q = pe_alloc (PE_CLASS_UNIV,
151: PE_FORM_CONS,
152: PE_CONS_SEQ),
153: -1) == NOTOK
154: || seq_add (q, int2prim (op), -1) == NOTOK
155: || seq_add (q, result, -1) == NOTOK))
156: : seq_add (p, result, -1) == NOTOK)) {
157: if (pe) {
158: (void) pe_extract (pe, result);
159: pe_free (pe);
160: }
161: freeacblk (acb);
162: return rosaplose (roi, ROS_CONGEST, NULLCP, "out of memory");
163: }
164: /* end Result APDU */
165:
166: return (*acb -> acb_putosdu) (acb, pe, result, priority, roi);
167: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.