|
|
1.1 root 1: /* rosapuerror.c - ROPM: error */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/rosap/RCS/rosapuerror.c,v 6.0 89/03/18 23:42:31 mrose Rel $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/rosap/RCS/rosapuerror.c,v 6.0 89/03/18 23:42:31 mrose Rel $
9: *
10: * Based on an TCP-based implementation by George Michaelson of University
11: * College London.
12: *
13: *
14: * $Log: rosapuerror.c,v $
15: * Revision 6.0 89/03/18 23:42:31 mrose
16: * Release 5.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 <signal.h>
35: #include "ropkt.h"
36:
37: /* RO-ERROR.REQUEST */
38:
39: int RoErrorRequest (sd, invokeID, error, params, priority, roi)
40: int sd;
41: int invokeID,
42: error,
43: priority;
44: PE params;
45: struct RoSAPindication *roi;
46: {
47: SBV smask;
48: int result;
49: register struct assocblk *acb;
50:
51: missingP (roi);
52:
53: smask = sigioblock ();
54:
55: rosapPsig (acb, sd);
56:
57: result = RoErrorRequestAux (acb, invokeID, error, params, priority, roi);
58:
59: (void) sigiomask (smask);
60:
61: return result;
62: }
63:
64: /* */
65:
66: static int RoErrorRequestAux (acb, invokeID, error, params, priority, roi)
67: register struct assocblk *acb;
68: int invokeID,
69: error,
70: priority;
71: PE params;
72: struct RoSAPindication *roi;
73: {
74: register PE pe,
75: p;
76:
77: if ((acb -> acb_flags & ACB_INIT) && (acb -> acb_flags & ACB_ROS))
78: return rosaplose (roi, ROS_OPERATION, NULLCP, "not responder");
79: if (!(acb -> acb_flags & ACB_ACS)) {
80: missingP (params);
81: }
82:
83: if (acb -> acb_ready
84: && !(acb -> acb_flags & ACB_TURN)
85: && (*acb -> acb_ready) (acb, priority, roi) == NOTOK)
86: return NOTOK;
87:
88: /* begin Error APDU */
89: if ((pe = pe_alloc (PE_CLASS_CONT, PE_FORM_CONS, APDU_ERROR)) == NULLPE
90: || ((acb -> acb_flags & ACB_ACS)
91: ? (p = pe, 0)
92: : set_add (pe, p = pe_alloc (PE_CLASS_UNIV, PE_FORM_CONS,
93: PE_CONS_SEQ)) == NOTOK)
94: || seq_add (p, int2prim (invokeID), -1) == NOTOK
95: || seq_add (p, int2prim (error), -1) == NOTOK
96: || (params && seq_add (p, params, -1) == NOTOK)) {
97: if (pe) {
98: if (params)
99: (void) pe_extract (pe, params);
100: pe_free (pe);
101: }
102: freeacblk (acb);
103: return rosaplose (roi, ROS_CONGEST, NULLCP, "out of memory");
104: }
105: /* end Error APDU */
106:
107: return (*acb -> acb_putosdu) (acb, pe, params, priority, roi);
108: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.