|
|
1.1 root 1: /* tsaplose.c - TPM: you lose */
2:
3:
4: #ifndef lint
5: static char *rcsid = "$Header: /f/osi/tsap/RCS/tsaplose.c,v 7.1 89/12/07 22:15:50 mrose Exp $";
6: #endif
7:
8: /*
9: * $Header: /f/osi/tsap/RCS/tsaplose.c,v 7.1 89/12/07 22:15:50 mrose Exp $
10: *
11: *
12: * $Log: tsaplose.c,v $
13: * Revision 7.1 89/12/07 22:15:50 mrose
14: * touch-up
15: *
16: * Revision 7.0 89/11/23 22:30:51 mrose
17: * Release 6.0
18: *
19: */
20:
21: /*
22: * NOTICE
23: *
24: * Acquisition, use, and distribution of this module and related
25: * materials are subject to the restrictions of a license agreement.
26: * Consult the Preface in the User's Manual for the full terms of
27: * this agreement.
28: *
29: */
30:
31:
32: /* LINTLIBRARY */
33:
34: #include <stdio.h>
35: #include <varargs.h>
36: #include "tpkt.h"
37: #include "mpkt.h"
38: #include "tailor.h"
39:
40:
41: #ifdef LPP
42: #undef MGMT
43: #endif
44:
45: /* */
46:
47: #ifndef lint
48: int tpktlose (va_alist)
49: va_dcl
50: {
51: int reason,
52: result;
53: register struct tsapblk *tb;
54: struct TSAPdisconnect tds;
55: register struct TSAPdisconnect *td;
56: va_list ap;
57:
58: va_start (ap);
59:
60: tb = va_arg (ap, struct tsapblk *);
61:
62: td = va_arg (ap, struct TSAPdisconnect *);
63: if (td == NULL)
64: td = &tds;
65:
66: reason = va_arg (ap, int);
67:
68: result = _tsaplose (td, reason, ap);
69:
70: va_end (ap);
71:
72: if (td -> td_cc > 0) {
73: SLOG (tsap_log, LLOG_EXCEPTIONS, NULLCP,
74: ("tpktlose [%s] %*.*s", TErrString (td -> td_reason), td -> td_cc,
75: td -> td_cc, td -> td_data));
76: }
77: else
78: SLOG (tsap_log, LLOG_EXCEPTIONS, NULLCP,
79: ("tpktlose [%s]", TErrString (td -> td_reason)));
80:
81: #ifdef MGMT
82: if (tb -> tb_manfnx)
83: switch (reason) {
84: case DR_REMOTE:
85: case DR_CONGEST:
86: (*tb -> tb_manfnx) (CONGEST, tb);
87: break;
88:
89: case DR_PROTOCOL:
90: case DR_MISMATCH:
91: (*tb -> tb_manfnx) (PROTERR, tb);
92: break;
93:
94: case DR_SESSION:
95: case DR_ADDRESS:
96: case DR_CONNECT:
97: case DR_DUPLICATE:
98: case DR_OVERFLOW:
99: case DR_REFUSED:
100: (*tb -> tb_manfnx) (CONFIGBAD, tb);
101: break;
102:
103: default:
104: (*tb -> tb_manfnx) (OPREQINBAD, tb);
105: }
106: #endif
107:
108: (*tb -> tb_losePfnx) (tb, reason, td);
109:
110: return result;
111: }
112: #else
113: /* VARARGS5 */
114:
115: int tpktlose (tb, td, reason, what, fmt)
116: struct tsapblk *tb;
117: struct TSAPdisconnect *td;
118: int reason;
119: char *what,
120: *fmt;
121: {
122: return tpktlose (tb, td, reason, what, fmt);
123: }
124: #endif
125:
126: /* */
127:
128: #ifndef lint
129: int tsaplose (va_alist)
130: va_dcl
131: {
132: int reason,
133: result;
134: struct TSAPdisconnect *td;
135: va_list ap;
136:
137: va_start (ap);
138:
139: td = va_arg (ap, struct TSAPdisconnect *);
140: reason = va_arg (ap, int);
141:
142: result = _tsaplose (td, reason, ap);
143:
144: va_end (ap);
145:
146: return result;
147:
148: }
149: #else
150: /* VARARGS4 */
151:
152: int tsaplose (td, reason, what, fmt)
153: struct TSAPdisconnect *td;
154: int reason;
155: char *what,
156: *fmt;
157: {
158: return tsaplose (td, reason, what, fmt);
159: }
160: #endif
161:
162: /* */
163:
164: #ifndef lint
165: static int _tsaplose (td, reason, ap) /* what, fmt, args ... */
166: register struct TSAPdisconnect *td;
167: int reason;
168: va_list ap;
169: {
170: register char *bp;
171: char buffer[BUFSIZ];
172:
173: if (td) {
174: bzero ((char *) td, sizeof *td);
175:
176: asprintf (bp = buffer, ap);
177: bp += strlen (bp);
178:
179: td -> td_reason = reason;
180: copyTSAPdata (buffer, bp - buffer, td);
181: }
182:
183: return NOTOK;
184: }
185: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.