|
|
1.1 root 1: /* ro2ssreleas1.c - initiate release */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/rosap/RCS/ro2ssreleas1.c,v 6.0 89/03/18 23:42:17 mrose Rel $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/rosap/RCS/ro2ssreleas1.c,v 6.0 89/03/18 23:42:17 mrose Rel $
9: *
10: * Based on an TCP-based implementation by George Michaelson of University
11: * College London.
12: *
13: *
14: * $Log: ro2ssreleas1.c,v $
15: * Revision 6.0 89/03/18 23:42:17 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-END.REQUEST */
38:
39: int RoEndRequest (sd, priority, roi)
40: int sd;
41: int priority;
42: struct RoSAPindication *roi;
43: {
44: SBV smask;
45: int result;
46: register struct assocblk *acb;
47:
48: missingP (roi);
49:
50: smask = sigioblock ();
51:
52: rosapPsig (acb, sd);
53:
54: result = RoEndRequestAux (acb, priority, roi);
55:
56: (void) sigiomask (smask);
57:
58: return result;
59:
60: }
61:
62: /* */
63:
64: static int RoEndRequestAux (acb, priority, roi)
65: register struct assocblk *acb;
66: int priority;
67: struct RoSAPindication *roi;
68: {
69: int result;
70: struct SSAPindication sis;
71: register struct SSAPindication *si = &sis;
72: register struct SSAPabort *sa = &si -> si_abort;
73: struct SSAPrelease srs;
74: register struct SSAPrelease *sr = &srs;
75:
76: if (acb -> acb_apdu) /* ACB_CLOSING tested earlier in rosapPsig */
77: return rosaplose (roi, ROS_WAITING, NULLCP, NULLCP);
78:
79: if (!(acb -> acb_flags & ACB_ROS))
80: return rosaplose (roi, ROS_OPERATION, NULLCP,
81: "not an association descriptor for ROS");
82:
83: if (!(acb -> acb_flags & ACB_INIT))
84: return rosaplose (roi, ROS_OPERATION, NULLCP, "not initiator");
85:
86: if (acb -> acb_ready
87: && !(acb -> acb_flags & ACB_TURN)
88: && (*acb -> acb_ready) (acb, priority, roi) == NOTOK)
89: return NOTOK;
90:
91: if (SRelRequest (acb -> acb_fd, NULLCP, 0, NOTOK, sr, si) == NOTOK) {
92: if (sa -> sa_peer)
93: return ss2rosabort (acb, sa, roi);
94:
95: result = ss2roslose (acb, roi, "SRelRequest", sa);
96: }
97: else
98: if (!sr -> sr_affirmative)
99: result = ropktlose (acb, roi, ROS_PROTOCOL, NULLCP,
100: "other side refused to release connection");
101: else {
102: acb -> acb_fd = NOTOK;
103: result = OK;
104: }
105:
106: freeacblk (acb);
107:
108: return result;
109: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.