xref: /csrg-svn/sys/netiso/cons_pcb.h (revision 63222)
149267Sbostic /*-
2*63222Sbostic  * Copyright (c) 1991, 1993
3*63222Sbostic  *	The Regents of the University of California.  All rights reserved.
449267Sbostic  *
549267Sbostic  * %sccs.include.redist.c%
649267Sbostic  *
7*63222Sbostic  *	@(#)cons_pcb.h	8.1 (Berkeley) 06/10/93
849267Sbostic  */
949267Sbostic 
1036377Ssklower /***********************************************************
1136377Ssklower 		Copyright IBM Corporation 1987
1236377Ssklower 
1336377Ssklower                       All Rights Reserved
1436377Ssklower 
1536377Ssklower Permission to use, copy, modify, and distribute this software and its
1636377Ssklower documentation for any purpose and without fee is hereby granted,
1736377Ssklower provided that the above copyright notice appear in all copies and that
1836377Ssklower both that copyright notice and this permission notice appear in
1936377Ssklower supporting documentation, and that the name of IBM not be
2036377Ssklower used in advertising or publicity pertaining to distribution of the
2136377Ssklower software without specific, written prior permission.
2236377Ssklower 
2336377Ssklower IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
2436377Ssklower ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
2536377Ssklower IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
2636377Ssklower ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
2736377Ssklower WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
2836377Ssklower ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
2936377Ssklower SOFTWARE.
3036377Ssklower 
3136377Ssklower ******************************************************************/
3236377Ssklower 
3336377Ssklower /*
3436377Ssklower  * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
3536377Ssklower  */
3636377Ssklower /* $Header: cons_pcb.h,v 4.2 88/06/29 14:59:08 hagens Exp $ */
3736377Ssklower /* $Source: /usr/argo/sys/netiso/RCS/cons_pcb.h,v $ */
3836377Ssklower 
3936377Ssklower /*
4036377Ssklower  * protocol control block for the connection oriented network service
4136377Ssklower  */
4236377Ssklower 
4336377Ssklower /*
4436377Ssklower  * legit port #s for cons "transport" are 0..23 for su users only, and
4536377Ssklower  * 1024..1099 for public users
4636377Ssklower  */
4736377Ssklower #define X25_SBSIZE 	512
4836377Ssklower #define	X25_PORT_RESERVED 24
4936377Ssklower #define	X25_PORT_USERMAX 1099
5036377Ssklower #define X25_FACIL_LEN_MAX  109
5136377Ssklower #define X25_PARTIAL_PKT_LEN_MAX (MLEN - sizeof(struct cons_pcb))
5236377Ssklower 
5336377Ssklower #ifndef ARGO_DEBUG
5436377Ssklower #define X25_TTL 600 /* 5 min */
5560359Sbostic #else /* ARGO_DEBUG */
5636377Ssklower #define X25_TTL 120 /* 1 min */
5760359Sbostic #endif /* ARGO_DEBUG */
5836377Ssklower 
5936377Ssklower struct cons_pcb {
6036377Ssklower 	struct isopcb 	_co_isopcb;
6136377Ssklower #define co_next	_co_isopcb.isop_next
6236377Ssklower /* prev used for netstat only */
6336377Ssklower #define co_prev	_co_isopcb.isop_prev
6436377Ssklower #define co_head	_co_isopcb.isop_head
6536377Ssklower #define co_laddr _co_isopcb.isop_laddr
6636377Ssklower #define co_faddr _co_isopcb.isop_faddr
6736377Ssklower #define co_lport _co_isopcb.isop_laddr.siso_tsuffix
6836377Ssklower #define co_fport _co_isopcb.isop_faddr.siso_tsuffix
6936377Ssklower #define co_route _co_isopcb.isop_route
7036377Ssklower #define co_socket _co_isopcb.isop_socket
7136377Ssklower #define	co_chanmask _co_isopcb.isop_chanmask
7236377Ssklower #define	co_negchanmask _co_isopcb.isop_negchanmask
7336377Ssklower #define	co_x25crud _co_isopcb.isop_x25crud
7436377Ssklower #define	co_x25crud_len _co_isopcb.isop_x25crud_len
7536377Ssklower 	u_short 		co_state;
7636377Ssklower 	u_char 			co_flags;
7736377Ssklower 	u_short			co_ttl; /* time to live timer */
7836377Ssklower 	u_short			co_init_ttl; /* initial value of ttl  */
7936377Ssklower 	int 			co_channel; /* logical channel */
8036377Ssklower 	struct ifnet *	co_ifp; /* interface */
8136377Ssklower 	struct protosw *co_proto;
8236377Ssklower 
8336377Ssklower 	struct ifqueue 	co_pending; /* queue data to send when connection
8436377Ssklower 						completes*/
8536377Ssklower #define MAX_DTE_LEN 0x7 /* 17 bcd digits */
8636377Ssklower 	struct dte_addr	co_peer_dte;
8736377Ssklower 	struct	cons_pcb *co_myself; /* DEBUGGING AID */
8836377Ssklower };
8936377Ssklower 
9036377Ssklower /*
9136377Ssklower  * X.25 Packet types
9236377Ssklower  */
9336377Ssklower #define XPKT_DATA		1
9436377Ssklower #define XPKT_INTERRUPT	2
9536377Ssklower #define XPKT_FLOWCONTROL 3 /* not delivered? */
9636377Ssklower 
9736377Ssklower /*
9836377Ssklower  * pcb xtates
9936377Ssklower  */
10036377Ssklower 
10136377Ssklower #define	CLOSED		0x0
10236377Ssklower #define	LISTENING	0x1
10336377Ssklower #define	CLOSING		0x2
10436377Ssklower /* USABLE STATES MUST BE LAST */
10536377Ssklower #define	CONNECTING	0x3
10636377Ssklower #define	ACKWAIT		0x4
10736377Ssklower #define	OPEN		0x5
10836377Ssklower #define MIN_USABLE_STATE CONNECTING
10936377Ssklower 
11036377Ssklower #define	cons_NSTATES		0x6
11136377Ssklower 
11236377Ssklower 
11336377Ssklower /* type */
11436377Ssklower #define CONSF_OCRE	0x40 /* created on OUTPUT */
11536377Ssklower #define CONSF_ICRE	0x20 /* created on INPUT */
11636377Ssklower #define CONSF_unused	0x10 /* not used */
11736377Ssklower #define CONSF_unused2	0x08 /* not used */
11836377Ssklower #define CONSF_DGM		0x04 /* for dgm use only */
11936377Ssklower #define CONSF_XTS		0x02 /* for cons-as-transport-service */
12036377Ssklower #define CONSF_LOOPBACK	0x01 /* loopback was on when connection commenced */
12136377Ssklower 
12236377Ssklower #define X_NOCHANNEL 0x80
12336377Ssklower 
12436377Ssklower 
12536377Ssklower struct cons_stat {
12636377Ssklower 	u_int co_intr;	/* input from eicon board */
12736377Ssklower 	u_int co_restart; /* ecn_restart() request issued to board */
12836377Ssklower 	u_int co_slowtimo; /* times slowtimo called */
12936377Ssklower 	u_int co_timedout; /* connections closed by slowtimo */
13036377Ssklower 	u_int co_ack; /* ECN_ACK indication came from eicon board */
13136377Ssklower 	u_int co_receive; /* ECN_RECEIVE indication came from eicon board */
13236377Ssklower 	u_int co_send; /* ECN_SEND request issued to board */
13336377Ssklower 	u_int co_reset_in; /* ECN_RESET indication came from eicon board */
13436377Ssklower 	u_int co_reset_out; /* ECN_RESET issued to the eicon board */
13536377Ssklower 	u_int co_clear_in; /* ECN_CLEAR indication came from eicon board */
13636377Ssklower 	u_int co_clear_out; /* ECN_CLEAR request issued to board */
13736377Ssklower 	u_int co_refuse; /* ECN_REFUSE indication came from eicon board */
13836377Ssklower 	u_int co_accept; /* ECN_ACCEPT indication came from eicon board */
13936377Ssklower 	u_int co_connect; /* ECN_CONNECT indication came from eicon board */
14036377Ssklower 	u_int co_call; /* ECN_CALL request issued to board */
14136377Ssklower 	u_int co_Rdrops; /* bad pkt came from ll */
14236377Ssklower 	u_int co_Xdrops; /* can't keep up */
14336377Ssklower 
14436377Ssklower 	u_int	co_intrpt_pkts_in; /* interrupt packets in */
14536377Ssklower 	u_int co_avg_qlen;
14636377Ssklower 	u_int co_avg_qdrop;
14736377Ssklower 	u_int co_active;
14836377Ssklower 
14936377Ssklower 	u_int co_noresources;
15036377Ssklower 	u_int co_parse_facil_err;
15136377Ssklower 	u_int co_addr_proto_consist_err;
15236377Ssklower 	u_int co_no_copcb;
15336377Ssklower } cons_stat;
15436377Ssklower 
15536377Ssklower u_char x25_error_stats[CONL_ERROR_MAX + 1];
15636377Ssklower 
15736377Ssklower struct ifqueue consintrq;
15836377Ssklower 
15936377Ssklower /* reasons for clear are in a data mbuf chained to a clear ecn_request */
16036377Ssklower struct e_clear_data 				{
16136377Ssklower 	u_char ecd_cause;
16236377Ssklower 	u_char ecd_diagnostic;
16336377Ssklower };
16436377Ssklower 
16536377Ssklower #ifdef KERNEL
16636377Ssklower #define IncStat(XYZ) cons_stat.XYZ++
16760359Sbostic #endif /* KERNEL */
168