xref: /original-bsd/sys/netccitt/pk_var.h (revision e0c0d005)
1 /*
2  * Copyright (c) University of British Columbia, 1984
3  * Copyright (c) 1990 The Regents of the University of California.
4  * All rights reserved.
5  *
6  * This code is derived from software contributed to Berkeley by
7  * the Laboratory for Computation Vision and the Computer Science Department
8  * of the University of British Columbia.
9  *
10  * %sccs.include.redist.c%
11  *
12  *	@(#)pk_var.h	7.8 (Berkeley) 01/09/91
13  */
14 
15 
16 /*
17  *
18  *  X.25 Logical Channel Descriptor
19  *
20  */
21 
22 struct pklcd {
23 	int	(*lcd_send)();		/* if X.25 front end, direct connect */
24 	int	(*lcd_upper)();		/* switch to socket vs datagram vs ...*/
25 	caddr_t	lcd_upnext;		/* reference for lcd_upper() */
26 	short   lcd_lcn;		/* Logical channel number */
27 	short   lcd_state;		/* Logical Channel state */
28         bool	lcd_intrconf_pending;	/* Interrupt confirmation pending */
29 	octet	lcd_intrdata;		/* Octet of incoming intr data */
30 	short   lcd_timer;		/* Various timer values */
31 	short   lcd_dg_timer;		/* to reclaim idle datagram circuits */
32 	char	lcd_retry;		/* Timer retry count */
33 	char	lcd_rsn;		/* Seq no of last received packet */
34 	char	lcd_ssn;		/* Seq no of next packet to send */
35 	char	lcd_output_window;	/* Output flow control window */
36 	char	lcd_input_window;	/* Input flow control window */
37 	char	lcd_last_transmitted_pr;/* Last Pr value transmitted */
38         bool	lcd_rnr_condition;	/* Remote in busy condition */
39         bool	lcd_window_condition;	/* Output window size exceeded */
40         bool	lcd_reset_condition;	/* True, if waiting reset confirm */
41 	char	lcd_packetsize;		/* Maximum packet size */
42 	char	lcd_windowsize;		/* Window size - both directions */
43         octet	lcd_closed_user_group;	/* Closed user group specification */
44 	char	lcd_flags;		/* copy of sockaddr_x25 op_flags */
45 	struct	mbuf *lcd_template;	/* Address of response packet */
46 	struct	socket *lcd_so;		/* Socket addr for connection */
47 	struct	sockaddr_x25 *lcd_craddr;/* Calling address pointer */
48 	struct	sockaddr_x25 *lcd_ceaddr;/* Called address pointer */
49 	struct	mbuf *lcd_facilities;	/* user supplied facilities for cr */
50 	time_t	lcd_stime;		/* time circuit established */
51 	long    lcd_txcnt;		/* Data packet transmit count */
52 	long    lcd_rxcnt;		/* Data packet receive count */
53 	short   lcd_intrcnt;		/* Interrupt packet transmit count */
54 	struct	pklcd *lcd_listen;	/* Next lcd on listen queue */
55 	struct	pkcb *lcd_pkp;		/* Network this lcd is attached to */
56 	struct	mbuf *lcd_cps;		/* Complete Packet Sequence reassembly*/
57 	long	lcd_cpsmax;		/* Max length for CPS */
58 	struct	sockaddr_x25 lcd_faddr;	/* Remote Address (Calling) */
59 	struct	sockaddr_x25 lcd_laddr;	/* Local Address (Called) */
60 	struct	sockbuf lcd_sb;		/* alternate for datagram service */
61 };
62 
63 /*
64  * Per network information, allocated dynamically
65  * when a new network is configured.
66  */
67 
68 struct	pkcb {
69 	struct	pkcb *pk_next;
70 	struct	x25_ifaddr *pk_ia;	/* backpointer to ifaddr */
71 	int	(*pk_lloutput) ();	/* link level output procedure */
72 	caddr_t pk_llnext;		/* handle for next level down */
73 	int	(*pk_start) ();		/* connect, confirm method */
74 	struct	x25config *pk_xcp;	/* network specific configuration */
75 	short	pk_state;		/* packet level status */
76 	struct	x25config pk_xc;	/* network specific configuration */
77 	struct	pklcd **pk_chan;	/* actual size == xc_maxlcn+1 */
78 #define	pk_maxlcn pk_xc.xc_maxlcn	/* local copy of xc_maxlcn */
79 };
80 /*
81  *	Interface address, x25 version. Exactly one of these structures is
82  *	allocated for each interface with an x25 address.
83  *
84  *	The ifaddr structure conatins the protocol-independent part
85  *	of the structure, and is assumed to be first.
86  */
87 struct x25_ifaddr {
88 	struct	ifaddr ia_ifa;		/* protocol-independent info */
89 #define ia_ifp		ia_ifa.ifa_ifp
90 #define	ia_flags	ia_ifa.ifa_flags
91 	struct	pkcb	ia_pkcb;	/* per network information */
92 #define ia_maxlcn	ia_pkcb.pk_maxlcn
93 #define ia_chan		ia_pkcb.pk_chan
94 #define ia_xc		ia_pkcb.pk_xc
95 #define ia_xcp		ia_pkcb.pk_xcp
96 	struct	sockaddr_x25 ia_sockmask; /* reserve space for netmask */
97 };
98 
99 /*
100  * ``Link-Level'' extension to Routing Entry for upper level
101  * packet switching via X.25 virtual circuits.
102  */
103 struct llinfo_x25 {
104 	struct	llinfo_x25 *lx_next;	/* chain together in linked list */
105 	struct	llinfo_x25 *lx_prev;	/* chain together in linked list */
106 	struct	rtentry *lx_rt;		/* back pointer to route */
107 	struct	pklcd *lx_lcd;		/* local connection block */
108 	struct	x25_ifaddr *lx_ia;	/* may not be same as rt_ifa */
109 	int	lx_state;		/* can't trust lcd->lcd_state */
110 	int	lx_flags;
111 	int	lx_timer;		/* for idle timeout */
112 	int	lx_family;		/* for dispatch */
113 };
114 
115 /* States for lx_state */
116 #define LXS_NEWBORN		0
117 #define LXS_RESOLVING		1
118 #define LXS_FREE		2
119 #define LXS_CONNECTED		3
120 #define LXS_CONNECTING		4
121 #define LXS_DISCONNECTING 	5
122 #define LXS_LISTENING 		6
123 
124 /* flags */
125 #define LXF_VALID	0x1		/* Circuit is live, etc. */
126 #define LXF_RTHELD	0x2		/* this lcb references rtentry */
127 #define LXF_LISTEN	0x4		/* accepting incoming calls */
128 
129 #ifdef KERNEL
130 struct	pkcb *pkcbhead;		/* head of linked list of networks */
131 struct	pklcd *pk_listenhead;
132 struct	pklcd *pk_attach();
133 
134 char	*pk_name[], *pk_state[];
135 int	pk_t20, pk_t21, pk_t22, pk_t23;
136 #endif
137