Commit | Line | Data |
---|---|---|
15637ed4 RG |
1 | /*- |
2 | * Copyright (c) 1991 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * Redistribution and use in source and binary forms, with or without | |
6 | * modification, are permitted provided that the following conditions | |
7 | * are met: | |
8 | * 1. Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * 2. Redistributions in binary form must reproduce the above copyright | |
11 | * notice, this list of conditions and the following disclaimer in the | |
12 | * documentation and/or other materials provided with the distribution. | |
13 | * 3. All advertising materials mentioning features or use of this software | |
14 | * must display the following acknowledgement: | |
15 | * This product includes software developed by the University of | |
16 | * California, Berkeley and its contributors. | |
17 | * 4. Neither the name of the University nor the names of its contributors | |
18 | * may be used to endorse or promote products derived from this software | |
19 | * without specific prior written permission. | |
20 | * | |
21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
31 | * SUCH DAMAGE. | |
32 | * | |
33 | * @(#)cons_pcb.h 7.4 (Berkeley) 5/6/91 | |
34 | */ | |
35 | ||
36 | /*********************************************************** | |
37 | Copyright IBM Corporation 1987 | |
38 | ||
39 | All Rights Reserved | |
40 | ||
41 | Permission to use, copy, modify, and distribute this software and its | |
42 | documentation for any purpose and without fee is hereby granted, | |
43 | provided that the above copyright notice appear in all copies and that | |
44 | both that copyright notice and this permission notice appear in | |
45 | supporting documentation, and that the name of IBM not be | |
46 | used in advertising or publicity pertaining to distribution of the | |
47 | software without specific, written prior permission. | |
48 | ||
49 | IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING | |
50 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL | |
51 | IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR | |
52 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | |
53 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | |
54 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | |
55 | SOFTWARE. | |
56 | ||
57 | ******************************************************************/ | |
58 | ||
59 | /* | |
60 | * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison | |
61 | */ | |
62 | /* $Header: cons_pcb.h,v 4.2 88/06/29 14:59:08 hagens Exp $ */ | |
63 | /* $Source: /usr/argo/sys/netiso/RCS/cons_pcb.h,v $ */ | |
64 | ||
65 | /* | |
66 | * protocol control block for the connection oriented network service | |
67 | */ | |
68 | ||
69 | /* | |
70 | * legit port #s for cons "transport" are 0..23 for su users only, and | |
71 | * 1024..1099 for public users | |
72 | */ | |
73 | #define X25_SBSIZE 512 | |
74 | #define X25_PORT_RESERVED 24 | |
75 | #define X25_PORT_USERMAX 1099 | |
76 | #define X25_FACIL_LEN_MAX 109 | |
77 | #define X25_PARTIAL_PKT_LEN_MAX (MLEN - sizeof(struct cons_pcb)) | |
78 | ||
79 | #ifndef ARGO_DEBUG | |
80 | #define X25_TTL 600 /* 5 min */ | |
81 | #else ARGO_DEBUG | |
82 | #define X25_TTL 120 /* 1 min */ | |
83 | #endif ARGO_DEBUG | |
84 | ||
85 | struct cons_pcb { | |
86 | struct isopcb _co_isopcb; | |
87 | #define co_next _co_isopcb.isop_next | |
88 | /* prev used for netstat only */ | |
89 | #define co_prev _co_isopcb.isop_prev | |
90 | #define co_head _co_isopcb.isop_head | |
91 | #define co_laddr _co_isopcb.isop_laddr | |
92 | #define co_faddr _co_isopcb.isop_faddr | |
93 | #define co_lport _co_isopcb.isop_laddr.siso_tsuffix | |
94 | #define co_fport _co_isopcb.isop_faddr.siso_tsuffix | |
95 | #define co_route _co_isopcb.isop_route | |
96 | #define co_socket _co_isopcb.isop_socket | |
97 | #define co_chanmask _co_isopcb.isop_chanmask | |
98 | #define co_negchanmask _co_isopcb.isop_negchanmask | |
99 | #define co_x25crud _co_isopcb.isop_x25crud | |
100 | #define co_x25crud_len _co_isopcb.isop_x25crud_len | |
101 | u_short co_state; | |
102 | u_char co_flags; | |
103 | u_short co_ttl; /* time to live timer */ | |
104 | u_short co_init_ttl; /* initial value of ttl */ | |
105 | int co_channel; /* logical channel */ | |
106 | struct ifnet * co_ifp; /* interface */ | |
107 | struct protosw *co_proto; | |
108 | ||
109 | struct ifqueue co_pending; /* queue data to send when connection | |
110 | completes*/ | |
111 | #define MAX_DTE_LEN 0x7 /* 17 bcd digits */ | |
112 | struct dte_addr co_peer_dte; | |
113 | struct cons_pcb *co_myself; /* DEBUGGING AID */ | |
114 | }; | |
115 | ||
116 | /* | |
117 | * X.25 Packet types | |
118 | */ | |
119 | #define XPKT_DATA 1 | |
120 | #define XPKT_INTERRUPT 2 | |
121 | #define XPKT_FLOWCONTROL 3 /* not delivered? */ | |
122 | ||
123 | /* | |
124 | * pcb xtates | |
125 | */ | |
126 | ||
127 | #define CLOSED 0x0 | |
128 | #define LISTENING 0x1 | |
129 | #define CLOSING 0x2 | |
130 | /* USABLE STATES MUST BE LAST */ | |
131 | #define CONNECTING 0x3 | |
132 | #define ACKWAIT 0x4 | |
133 | #define OPEN 0x5 | |
134 | #define MIN_USABLE_STATE CONNECTING | |
135 | ||
136 | #define cons_NSTATES 0x6 | |
137 | ||
138 | ||
139 | /* type */ | |
140 | #define CONSF_OCRE 0x40 /* created on OUTPUT */ | |
141 | #define CONSF_ICRE 0x20 /* created on INPUT */ | |
142 | #define CONSF_unused 0x10 /* not used */ | |
143 | #define CONSF_unused2 0x08 /* not used */ | |
144 | #define CONSF_DGM 0x04 /* for dgm use only */ | |
145 | #define CONSF_XTS 0x02 /* for cons-as-transport-service */ | |
146 | #define CONSF_LOOPBACK 0x01 /* loopback was on when connection commenced */ | |
147 | ||
148 | #define X_NOCHANNEL 0x80 | |
149 | ||
150 | ||
151 | struct cons_stat { | |
152 | u_int co_intr; /* input from eicon board */ | |
153 | u_int co_restart; /* ecn_restart() request issued to board */ | |
154 | u_int co_slowtimo; /* times slowtimo called */ | |
155 | u_int co_timedout; /* connections closed by slowtimo */ | |
156 | u_int co_ack; /* ECN_ACK indication came from eicon board */ | |
157 | u_int co_receive; /* ECN_RECEIVE indication came from eicon board */ | |
158 | u_int co_send; /* ECN_SEND request issued to board */ | |
159 | u_int co_reset_in; /* ECN_RESET indication came from eicon board */ | |
160 | u_int co_reset_out; /* ECN_RESET issued to the eicon board */ | |
161 | u_int co_clear_in; /* ECN_CLEAR indication came from eicon board */ | |
162 | u_int co_clear_out; /* ECN_CLEAR request issued to board */ | |
163 | u_int co_refuse; /* ECN_REFUSE indication came from eicon board */ | |
164 | u_int co_accept; /* ECN_ACCEPT indication came from eicon board */ | |
165 | u_int co_connect; /* ECN_CONNECT indication came from eicon board */ | |
166 | u_int co_call; /* ECN_CALL request issued to board */ | |
167 | u_int co_Rdrops; /* bad pkt came from ll */ | |
168 | u_int co_Xdrops; /* can't keep up */ | |
169 | ||
170 | u_int co_intrpt_pkts_in; /* interrupt packets in */ | |
171 | u_int co_avg_qlen; | |
172 | u_int co_avg_qdrop; | |
173 | u_int co_active; | |
174 | ||
175 | u_int co_noresources; | |
176 | u_int co_parse_facil_err; | |
177 | u_int co_addr_proto_consist_err; | |
178 | u_int co_no_copcb; | |
179 | } cons_stat; | |
180 | ||
181 | u_char x25_error_stats[CONL_ERROR_MAX + 1]; | |
182 | ||
183 | struct ifqueue consintrq; | |
184 | ||
185 | /* reasons for clear are in a data mbuf chained to a clear ecn_request */ | |
186 | struct e_clear_data { | |
187 | u_char ecd_cause; | |
188 | u_char ecd_diagnostic; | |
189 | }; | |
190 | ||
191 | #ifdef KERNEL | |
192 | #define IncStat(XYZ) cons_stat.XYZ++ | |
193 | #endif KERNEL |