xref: /original-bsd/sys/netccitt/x25_var.h (revision da818fbb)
1 /*
2  * Copyright (c) 1989 Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that the above copyright notice and this paragraph are
7  * duplicated in all such forms and that any documentation,
8  * advertising materials, and other materials related to such
9  * distribution and use acknowledge that the software was developed
10  * by the University of California, Berkeley.  The name of the
11  * University may not be used to endorse or promote products derived
12  * from this software without specific prior written permission.
13  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  *	@(#)x25_var.h	7.1 (Berkeley) 05/11/90
18  */
19 
20 
21 /*
22  * Device-independent x25 driver data.
23  */
24 struct	x25com {
25 	struct 	ifnet xc_if;		/* network-visible interface */
26 /*	int	(*xc_if.if_start)()	/* connect, confirm procedure */
27 	u_char	xc_addrlen;		/* length of X.121 address */
28 	u_char	xc_addr[16];		/* X.121 address */
29 	u_short xc_flags;		/* X.25 specific flags */
30 	u_short	xc_nchan;		/* number of logical channels */
31 	u_short xc_nactive;		/* number of live logical channels */
32 	u_short xc_npvc;		/* # of permanent virt. circuits */
33 	u_short xc_pvcx;		/* index of first pcv */
34 	u_short xc_svcx;		/* index of first svc */
35 	u_short xc_dg_idletimo;		/* timeout to close idle dg channel */
36 	u_short xc_rslvtimo;		/* if name translation fails, rid */
37 	struct	x25lcb **xc_lcbvec;	/* where to dispatch data */
38 	int	(*xc_disconnect)();	/* to delete idle dg circuits */
39 };
40 #define	XCF_HSL3	0x1		/* Hardware support for level 3 */
41 #define XCF_HSL2	0x2		/* Hardware support for level 2 */
42 
43 
44 /*
45  * Local Connection Block.
46  */
47 
48 struct x25lcb {
49 	struct	xq	{
50 		int	(*xq_put)();	/* How to process data */
51 		struct	mbuf *xq_data;	/* Queued data */
52 		int	xq_space;	/* For accounting */
53 		int	xq_flags;
54 		int	(*xq_unblock)();/* called & cleared when unblocking */
55 		caddr_t xq_proto;	/* for other service entries */
56 		caddr_t xq_next;	/* next q, or route, or pcb */
57 	}	xl_downq, xl_upq;
58 /*	(*xl_downq.xq_next->xq_put)()	/* LAPB put when using pk_output() */
59 	int	xl_flags;		/* valid, c-o versus dg */
60 	int	xl_timer;		/* figure out what to close */
61 	int	xl_state;		/* connecting, connected, resolving */
62 	int	xl_index;		/* which entry we are in device table */
63 	struct	x25com *xl_xc;		/* back pointer to device */
64 	/*
65 	 * x25pkb (packet-level control block) would follow immediately
66 	 * for devices only supplying LAPB or less.
67 	 */
68 };
69 /* flags */
70 #define XL_VALID	0x1		/* Circuit is live, etc. */
71 #define XL_DGRAM	0x2		/* not connection oriented, can close */
72 #define XL_RTHELD	0x4		/* this lcb references rtentry */
73 
74 #define XQ_UP		0x1		/* I am an up queue */
75 #define XQ_DOWN		0x2		/* I am a down queue */
76 
77 /* states for LCB */
78 #define XLS_NEWBORN	0x0
79 #define XLS_CONNECTED	0x1
80 #define XLS_CONNECTING	0x2
81 #define XLS_RESOLVING	0x3
82 #define XLS_DISCONNECTING 0x4
83 #define XLS_FREE	0x5
84 
85 #ifdef KERNEL
86 int	x25_ifinput();
87 #endif
88