xref: /csrg-svn/sys/netiso/cons_pcb.h (revision 37469)
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 
30 /*
31  * protocol control block for the connection oriented network service
32  */
33 
34 /*
35  * legit port #s for cons "transport" are 0..23 for su users only, and
36  * 1024..1099 for public users
37  */
38 #define X25_SBSIZE 	512
39 #define	X25_PORT_RESERVED 24
40 #define	X25_PORT_USERMAX 1099
41 #define X25_FACIL_LEN_MAX  109
42 #define X25_PARTIAL_PKT_LEN_MAX (MLEN - sizeof(struct cons_pcb))
43 
44 #ifndef ARGO_DEBUG
45 #define X25_TTL 600 /* 5 min */
46 #else ARGO_DEBUG
47 #define X25_TTL 120 /* 1 min */
48 #endif ARGO_DEBUG
49 
50 struct cons_pcb {
51 	struct isopcb 	_co_isopcb;
52 #define co_next	_co_isopcb.isop_next
53 /* prev used for netstat only */
54 #define co_prev	_co_isopcb.isop_prev
55 #define co_head	_co_isopcb.isop_head
56 #define co_laddr _co_isopcb.isop_laddr
57 #define co_faddr _co_isopcb.isop_faddr
58 #define co_lport _co_isopcb.isop_laddr.siso_tsuffix
59 #define co_fport _co_isopcb.isop_faddr.siso_tsuffix
60 #define co_route _co_isopcb.isop_route
61 #define co_socket _co_isopcb.isop_socket
62 #define	co_chanmask _co_isopcb.isop_chanmask
63 #define	co_negchanmask _co_isopcb.isop_negchanmask
64 #define	co_x25crud _co_isopcb.isop_x25crud
65 #define	co_x25crud_len _co_isopcb.isop_x25crud_len
66 	u_short 		co_state;
67 	u_char 			co_flags;
68 	u_short			co_ttl; /* time to live timer */
69 	u_short			co_init_ttl; /* initial value of ttl  */
70 	int 			co_channel; /* logical channel */
71 	struct ifnet *	co_ifp; /* interface */
72 	struct protosw *co_proto;
73 
74 	struct ifqueue 	co_pending; /* queue data to send when connection
75 						completes*/
76 #define MAX_DTE_LEN 0x7 /* 17 bcd digits */
77 	struct dte_addr	co_peer_dte;
78 	struct	cons_pcb *co_myself; /* DEBUGGING AID */
79 };
80 
81 /*
82  * X.25 Packet types
83  */
84 #define XPKT_DATA		1
85 #define XPKT_INTERRUPT	2
86 #define XPKT_FLOWCONTROL 3 /* not delivered? */
87 
88 /*
89  * pcb xtates
90  */
91 
92 #define	CLOSED		0x0
93 #define	LISTENING	0x1
94 #define	CLOSING		0x2
95 /* USABLE STATES MUST BE LAST */
96 #define	CONNECTING	0x3
97 #define	ACKWAIT		0x4
98 #define	OPEN		0x5
99 #define MIN_USABLE_STATE CONNECTING
100 
101 #define	cons_NSTATES		0x6
102 
103 
104 /* type */
105 #define CONSF_OCRE	0x40 /* created on OUTPUT */
106 #define CONSF_ICRE	0x20 /* created on INPUT */
107 #define CONSF_unused	0x10 /* not used */
108 #define CONSF_unused2	0x08 /* not used */
109 #define CONSF_DGM		0x04 /* for dgm use only */
110 #define CONSF_XTS		0x02 /* for cons-as-transport-service */
111 #define CONSF_LOOPBACK	0x01 /* loopback was on when connection commenced */
112 
113 #define X_NOCHANNEL 0x80
114 
115 
116 struct cons_stat {
117 	u_int co_intr;	/* input from eicon board */
118 	u_int co_restart; /* ecn_restart() request issued to board */
119 	u_int co_slowtimo; /* times slowtimo called */
120 	u_int co_timedout; /* connections closed by slowtimo */
121 	u_int co_ack; /* ECN_ACK indication came from eicon board */
122 	u_int co_receive; /* ECN_RECEIVE indication came from eicon board */
123 	u_int co_send; /* ECN_SEND request issued to board */
124 	u_int co_reset_in; /* ECN_RESET indication came from eicon board */
125 	u_int co_reset_out; /* ECN_RESET issued to the eicon board */
126 	u_int co_clear_in; /* ECN_CLEAR indication came from eicon board */
127 	u_int co_clear_out; /* ECN_CLEAR request issued to board */
128 	u_int co_refuse; /* ECN_REFUSE indication came from eicon board */
129 	u_int co_accept; /* ECN_ACCEPT indication came from eicon board */
130 	u_int co_connect; /* ECN_CONNECT indication came from eicon board */
131 	u_int co_call; /* ECN_CALL request issued to board */
132 	u_int co_Rdrops; /* bad pkt came from ll */
133 	u_int co_Xdrops; /* can't keep up */
134 
135 	u_int	co_intrpt_pkts_in; /* interrupt packets in */
136 	u_int co_avg_qlen;
137 	u_int co_avg_qdrop;
138 	u_int co_active;
139 
140 	u_int co_noresources;
141 	u_int co_parse_facil_err;
142 	u_int co_addr_proto_consist_err;
143 	u_int co_no_copcb;
144 } cons_stat;
145 
146 u_char x25_error_stats[CONL_ERROR_MAX + 1];
147 
148 struct ifqueue consintrq;
149 
150 /* reasons for clear are in a data mbuf chained to a clear ecn_request */
151 struct e_clear_data 				{
152 	u_char ecd_cause;
153 	u_char ecd_diagnostic;
154 };
155 
156 #ifdef KERNEL
157 #define IncStat(XYZ) cons_stat.XYZ++
158 #endif KERNEL
159