|
|
1.1 root 1: /* tsapmisc.c - miscellany tsap functions */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/tsap/RCS/tsapmisc.c,v 7.2 90/03/23 17:31:47 mrose Exp $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/tsap/RCS/tsapmisc.c,v 7.2 90/03/23 17:31:47 mrose Exp $
9: *
10: *
11: * $Log: tsapmisc.c,v $
12: * Revision 7.2 90/03/23 17:31:47 mrose
13: * 8
14: *
15: * Revision 7.1 90/03/06 09:34:18 mrose
16: * update
17: *
18: * Revision 7.0 89/11/23 22:30:54 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 <signal.h>
38: #include "tpkt.h"
39: #include <sys/ioctl.h>
40:
41: /* estimate of octets that might be returned */
42:
43: int TSelectOctets (sd, nbytes, td)
44: int sd;
45: long *nbytes;
46: register struct TSAPdisconnect *td;
47: {
48: int result;
49: long value;
50: SBV smask;
51: register struct tsapblk *tb;
52:
53: missingP (nbytes);
54: missingP (td);
55:
56: smask = sigioblock ();
57:
58: tsapPsig (tb, sd);
59:
60: result = OK;
61: if (tb -> tb_nreadfnx) {
62: if ((result = (*tb -> tb_nreadfnx) (tb, &value)) == NOTOK)
63: value = 0L;
64: }
65: else {
66: #ifdef FIONREAD
67: if (ioctl (tb -> tb_fd, FIONREAD, (char *) &value) == NOTOK)
68: value = 0L;
69: #endif
70:
71: switch (tb -> tb_flags & (TB_TP0 | TB_TP4)) {
72: case TB_TCP:
73: case TB_X25:
74: case TB_BRG:
75: if (value > DT_MAGIC && tb -> tb_len == 0)
76: value -= DT_MAGIC;
77: break;
78:
79: default:
80: break;
81: }
82: }
83:
84: if (result == OK)
85: value += (long) tb -> tb_len;
86: *nbytes = value;
87:
88: (void) sigiomask (smask);
89:
90: return result;
91: }
92:
93: /* get TSAPs */
94:
95: int TGetAddresses (sd, initiating, responding, td)
96: int sd;
97: struct TSAPaddr *initiating,
98: *responding;
99: register struct TSAPdisconnect *td;
100: {
101: SBV smask;
102: register struct tsapblk *tb;
103:
104: missingP (td);
105:
106: smask = sigioblock ();
107:
108: tsapPsig (tb, sd);
109:
110: if (initiating)
111: copyTSAPaddrX (&tb -> tb_initiating, initiating);
112: if (responding)
113: copyTSAPaddrX (&tb -> tb_responding, responding);
114:
115: (void) sigiomask (smask);
116:
117: return OK;
118: }
119:
120: /* define transport manager */
121:
122: #ifdef MGMT
123: int TSetManager (sd, fnx, td)
124: int sd;
125: IFP fnx;
126: register struct TSAPdisconnect *td;
127: {
128: SBV smask;
129: register struct tsapblk *tb;
130:
131: missingP (td);
132:
133: smask = sigioblock ();
134:
135: tsapPsig (tb, sd);
136:
137: tb -> tb_manfnx = fnx;
138:
139: (void) sigiomask (smask);
140:
141: return OK;
142: }
143: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.