From Bruce:
[unix-history] / sys / netiso / cons_pcb.h
CommitLineData
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 *
43371f85 33 * from: @(#)cons_pcb.h 7.4 (Berkeley) 5/6/91
8ace4366 34 * $Id: cons_pcb.h,v 1.2 1993/10/16 21:05:03 rgrimes Exp $
15637ed4
RG
35 */
36
37/***********************************************************
38 Copyright IBM Corporation 1987
39
40 All Rights Reserved
41
42Permission to use, copy, modify, and distribute this software and its
43documentation for any purpose and without fee is hereby granted,
44provided that the above copyright notice appear in all copies and that
45both that copyright notice and this permission notice appear in
46supporting documentation, and that the name of IBM not be
47used in advertising or publicity pertaining to distribution of the
48software without specific, written prior permission.
49
50IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
51ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
52IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
53ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
54WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
55ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
56SOFTWARE.
57
58******************************************************************/
59
60/*
61 * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
62 */
15637ed4 63
8ace4366
GW
64#ifndef _NETISO_CONS_PCB_H_
65#define _NETISO_CONS_PCB_H_ 1
66
15637ed4
RG
67/*
68 * protocol control block for the connection oriented network service
69 */
70
71/*
72 * legit port #s for cons "transport" are 0..23 for su users only, and
73 * 1024..1099 for public users
74 */
75#define X25_SBSIZE 512
76#define X25_PORT_RESERVED 24
77#define X25_PORT_USERMAX 1099
78#define X25_FACIL_LEN_MAX 109
79#define X25_PARTIAL_PKT_LEN_MAX (MLEN - sizeof(struct cons_pcb))
80
81#ifndef ARGO_DEBUG
82#define X25_TTL 600 /* 5 min */
83#else ARGO_DEBUG
84#define X25_TTL 120 /* 1 min */
85#endif ARGO_DEBUG
86
87struct cons_pcb {
88 struct isopcb _co_isopcb;
89#define co_next _co_isopcb.isop_next
90/* prev used for netstat only */
91#define co_prev _co_isopcb.isop_prev
92#define co_head _co_isopcb.isop_head
93#define co_laddr _co_isopcb.isop_laddr
94#define co_faddr _co_isopcb.isop_faddr
95#define co_lport _co_isopcb.isop_laddr.siso_tsuffix
96#define co_fport _co_isopcb.isop_faddr.siso_tsuffix
97#define co_route _co_isopcb.isop_route
98#define co_socket _co_isopcb.isop_socket
99#define co_chanmask _co_isopcb.isop_chanmask
100#define co_negchanmask _co_isopcb.isop_negchanmask
101#define co_x25crud _co_isopcb.isop_x25crud
102#define co_x25crud_len _co_isopcb.isop_x25crud_len
103 u_short co_state;
104 u_char co_flags;
105 u_short co_ttl; /* time to live timer */
106 u_short co_init_ttl; /* initial value of ttl */
107 int co_channel; /* logical channel */
108 struct ifnet * co_ifp; /* interface */
109 struct protosw *co_proto;
110
111 struct ifqueue co_pending; /* queue data to send when connection
112 completes*/
113#define MAX_DTE_LEN 0x7 /* 17 bcd digits */
114 struct dte_addr co_peer_dte;
115 struct cons_pcb *co_myself; /* DEBUGGING AID */
116};
117
118/*
119 * X.25 Packet types
120 */
121#define XPKT_DATA 1
122#define XPKT_INTERRUPT 2
123#define XPKT_FLOWCONTROL 3 /* not delivered? */
124
125/*
126 * pcb xtates
127 */
128
129#define CLOSED 0x0
130#define LISTENING 0x1
131#define CLOSING 0x2
132/* USABLE STATES MUST BE LAST */
133#define CONNECTING 0x3
134#define ACKWAIT 0x4
135#define OPEN 0x5
136#define MIN_USABLE_STATE CONNECTING
137
138#define cons_NSTATES 0x6
139
140
141/* type */
142#define CONSF_OCRE 0x40 /* created on OUTPUT */
143#define CONSF_ICRE 0x20 /* created on INPUT */
144#define CONSF_unused 0x10 /* not used */
145#define CONSF_unused2 0x08 /* not used */
146#define CONSF_DGM 0x04 /* for dgm use only */
147#define CONSF_XTS 0x02 /* for cons-as-transport-service */
148#define CONSF_LOOPBACK 0x01 /* loopback was on when connection commenced */
149
150#define X_NOCHANNEL 0x80
151
152
153struct cons_stat {
154 u_int co_intr; /* input from eicon board */
155 u_int co_restart; /* ecn_restart() request issued to board */
156 u_int co_slowtimo; /* times slowtimo called */
157 u_int co_timedout; /* connections closed by slowtimo */
158 u_int co_ack; /* ECN_ACK indication came from eicon board */
159 u_int co_receive; /* ECN_RECEIVE indication came from eicon board */
160 u_int co_send; /* ECN_SEND request issued to board */
161 u_int co_reset_in; /* ECN_RESET indication came from eicon board */
162 u_int co_reset_out; /* ECN_RESET issued to the eicon board */
163 u_int co_clear_in; /* ECN_CLEAR indication came from eicon board */
164 u_int co_clear_out; /* ECN_CLEAR request issued to board */
165 u_int co_refuse; /* ECN_REFUSE indication came from eicon board */
166 u_int co_accept; /* ECN_ACCEPT indication came from eicon board */
167 u_int co_connect; /* ECN_CONNECT indication came from eicon board */
168 u_int co_call; /* ECN_CALL request issued to board */
169 u_int co_Rdrops; /* bad pkt came from ll */
170 u_int co_Xdrops; /* can't keep up */
171
172 u_int co_intrpt_pkts_in; /* interrupt packets in */
173 u_int co_avg_qlen;
174 u_int co_avg_qdrop;
175 u_int co_active;
176
177 u_int co_noresources;
178 u_int co_parse_facil_err;
179 u_int co_addr_proto_consist_err;
180 u_int co_no_copcb;
8ace4366
GW
181};
182
183extern struct cons_stat cons_stat;
15637ed4 184
8ace4366 185extern u_char x25_error_stats[CONL_ERROR_MAX + 1];
15637ed4 186
8ace4366 187extern struct ifqueue consintrq;
15637ed4
RG
188
189/* reasons for clear are in a data mbuf chained to a clear ecn_request */
190struct e_clear_data {
191 u_char ecd_cause;
192 u_char ecd_diagnostic;
193};
194
195#ifdef KERNEL
196#define IncStat(XYZ) cons_stat.XYZ++
197#endif KERNEL
8ace4366 198#endif /* _NETISO_CONS_PCB_H_ */