|
|
1.1 root 1: /* rtsaplose.c - RTPM: you lose */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/rtsap/RCS/rtsaplose.c,v 6.0 89/03/18 23:43:29 mrose Rel $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/rtsap/RCS/rtsaplose.c,v 6.0 89/03/18 23:43:29 mrose Rel $
9: *
10: *
11: * $Log: rtsaplose.c,v $
12: * Revision 6.0 89/03/18 23:43:29 mrose
13: * Release 5.0
14: *
15: */
16:
17: /*
18: * NOTICE
19: *
20: * Acquisition, use, and distribution of this module and related
21: * materials are subject to the restrictions of a license agreement.
22: * Consult the Preface in the User's Manual for the full terms of
23: * this agreement.
24: *
25: */
26:
27:
28: /* LINTLIBRARY */
29:
30: #include <stdio.h>
31: #include <varargs.h>
32: #include "rtpkt.h"
33: #include "tailor.h"
34:
35: /* */
36:
37: #ifndef lint
38: int rtpktlose (va_alist)
39: va_dcl
40: {
41: int reason,
42: result,
43: value;
44: register struct assocblk *acb;
45: register struct RtSAPindication *rti;
46: register struct RtSAPabort *rta;
47: va_list ap;
48:
49: va_start (ap);
50:
51: acb = va_arg (ap, struct assocblk *);
52: rti = va_arg (ap, struct RtSAPindication *);
53: reason = va_arg (ap, int);
54:
55: result = _rtsaplose (rti, reason, ap);
56:
57: va_end (ap);
58:
59: if ((rta = &rti -> rti_abort) -> rta_cc > 0) {
60: SLOG (rtsap_log, LLOG_EXCEPTIONS, NULLCP,
61: ("rtpktlose [%s] %*.*s", RtErrString (rta -> rta_reason),
62: rta -> rta_cc, rta -> rta_cc, rta -> rta_data));
63: }
64: else
65: SLOG (rtsap_log, LLOG_EXCEPTIONS, NULLCP,
66: ("rtpktlose [%s]", RtErrString (rta -> rta_reason)));
67:
68: if (acb == NULLACB
69: || acb -> acb_fd == NOTOK
70: || acb -> acb_rtpktlose == NULLIFP)
71: return result;
72:
73: switch (reason) {
74: case RTS_PROTOCOL:
75: value = ABORT_PROTO;
76: break;
77:
78: case RTS_CONGEST:
79: value = ABORT_TMP;
80: break;
81:
82: default:
83: value = ABORT_LSP;
84: break;
85: }
86:
87: (*acb -> acb_rtpktlose) (acb, value);
88:
89: return result;
90: }
91: #else
92: /* VARARGS5 */
93:
94: int rtpktlose (acb, rti, reason, what, fmt)
95: struct assocblk *acb;
96: struct RtSAPindication *rti;
97: int reason;
98: char *what,
99: *fmt;
100: {
101: return rtpktlose (acb, rti, reason, what, fmt);
102: }
103: #endif
104:
105: /* */
106:
107: #ifndef lint
108: int rtsaplose (va_alist)
109: va_dcl
110: {
111: int reason,
112: result;
113: struct RtSAPindication *rti;
114: va_list ap;
115:
116: va_start (ap);
117:
118: rti = va_arg (ap, struct RtSAPindication *);
119: reason = va_arg (ap, int);
120:
121: result = _rtsaplose (rti, reason, ap);
122:
123: va_end (ap);
124:
125: return result;
126: }
127: #else
128: /* VARARGS4 */
129:
130: int rtsaplose (rti, reason, what, fmt)
131: struct RtSAPindication *rti;
132: int reason;
133: char *what,
134: *fmt;
135: {
136: return rtsaplose (rti, reason, what, fmt);
137: }
138: #endif
139:
140: /* */
141:
142: #ifndef lint
143: static int _rtsaplose (rti, reason, ap) /* what, fmt, args ... */
144: register struct RtSAPindication *rti;
145: int reason;
146: va_list ap;
147: {
148: register char *bp;
149: char buffer[BUFSIZ];
150: register struct RtSAPabort *rta;
151:
152: if (rti) {
153: bzero ((char *) rti, sizeof *rti);
154: rti -> rti_type = RTI_ABORT;
155: rta = &rti -> rti_abort;
156:
157: asprintf (bp = buffer, ap);
158: bp += strlen (bp);
159:
160: rta -> rta_peer = 0;
161: rta -> rta_reason = reason;
162: copyRtSAPdata (buffer, bp - buffer, rta);
163: }
164:
165: return NOTOK;
166: }
167: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.