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