xref: /csrg-svn/sys/netccitt/x25.h (revision 41709)
1*41709Ssklower /*
2*41709Ssklower  * Copyright (c) University of British Columbia, 1984
3*41709Ssklower  * Copyright (c) 1990 The Regents of the University of California.
4*41709Ssklower  * All rights reserved.
5*41709Ssklower  *
6*41709Ssklower  * This code is derived from software contributed to Berkeley by
7*41709Ssklower  * the Laboratory for Computation Vision and the Computer Science Department
8*41709Ssklower  * of the University of British Columbia.
9*41709Ssklower  *
10*41709Ssklower  * %sccs.include.redist.c%
11*41709Ssklower  *
12*41709Ssklower  *	@(#)x25.h	7.2 (Berkeley) 05/11/90
13*41709Ssklower  */
14*41709Ssklower 
1541596Ssklower #ifdef KERNEL
1641596Ssklower #define PRC_IFUP	3
1741596Ssklower #define PRC_LINKUP	4
1841596Ssklower #define PRC_LINKDOWN	5
1941596Ssklower #define PRC_LINKRESET	6
2041596Ssklower #define PRC_LINKDONTCOPY	7
2141596Ssklower #endif
2241596Ssklower 
2341596Ssklower #define CCITTPROTO_HDLC		1
2441596Ssklower #define CCITTPROTO_X25		2	/* packet level protocol */
2541596Ssklower #define IEEEPROTO_802LLC	3	/* doesn't belong here */
2641596Ssklower 
2741596Ssklower #define HDLCPROTO_LAP		1
2841596Ssklower #define HDLCPROTO_LAPB		2
2941596Ssklower #define HDLCPROTO_UNSET		3
3041596Ssklower #define HDLCPROTO_LAPD		4
3141596Ssklower 
3241596Ssklower /*
3341596Ssklower  *  X.25 Socket address structure.  It contains the  X.121 or variation of
3441596Ssklower  *  X.121, facilities information, higher level protocol value (first four
3541596Ssklower  *  bytes of the User Data field), and the last  12 characters of the User
3641596Ssklower  *  Data field.
3741596Ssklower  */
3841596Ssklower 
3941596Ssklower struct x25_sockaddr {		/* obsolete - use sockaddr_x25 */
4041596Ssklower     short  xaddr_len;		/* Length of xaddr_addr.		*/
4141596Ssklower     u_char xaddr_addr[15];	/* Network dependent or X.121 address.	*/
4241596Ssklower     u_char xaddr_facilities;	/* Facilities information.		*/
4341596Ssklower #define XS_REVERSE_CHARGE	0x01
4441596Ssklower #define XS_HIPRIO		0x02
4541596Ssklower     u_char xaddr_proto[4];	/* Protocol ID (4 bytes of user data).	*/
4641596Ssklower     u_char xaddr_userdata[12];	/* Remaining User data field.		*/
4741596Ssklower };
4841596Ssklower 
4941596Ssklower /*
5041596Ssklower  * network configuration info
5141596Ssklower  * this structure must be 16 bytes long
5241596Ssklower  */
5341596Ssklower 
5441596Ssklower struct	x25config {
5541596Ssklower 	u_short	xc_family;	/* always AF_CCITT */
5641596Ssklower 	u_short	xc_net;		/* network id (usually a dnic) */
5741596Ssklower 	char	xc_ntnlen;
5841596Ssklower 	char	xc_ntn[5];	/* network specific address (in bcd) */
5941596Ssklower 	/* link level parameters */
6041596Ssklower 	u_short	xc_lproto:4,	/* link level protocol eg. CCITTPROTO_HDLC */
6141596Ssklower 		xc_lptype:4,	/* protocol type eg. HDLCPROTO_LAPB */
6241596Ssklower 		xc_lwsize:5,	/* link level window size */
6341596Ssklower 		xc_ltrace:1,	/* link level tracing flag */
6441596Ssklower 		xc_rsvd1:2;	/* for use by other link-level protocols */
6541596Ssklower 	/* packet level parameters */
6641596Ssklower 	u_short	xc_pwsize:3,	/* default window size */
6741596Ssklower 		xc_psize:4,	/* default packet size 7=128, 8=256, ... */
68*41709Ssklower 		xc_type:3,	/* network type */
6941596Ssklower #define X25_1976	0
7041596Ssklower #define X25_1980	1
7141596Ssklower #define X25_1984	2
72*41709Ssklower #define X25_DDN		3
73*41709Ssklower #define X25_BASIC	4
7441596Ssklower 		xc_ptrace:1,	/* packet level tracing flag */
75*41709Ssklower 		xc_rsvd2:5;
7641596Ssklower 	u_char	xc_maxlcn;	/* max logical channels */
7741596Ssklower 	u_char	xc_rsvd3;
7841596Ssklower };
7941596Ssklower 
8041596Ssklower /*
8141596Ssklower  *  X.25 Socket address structure.  It contains the network id, X.121
8241596Ssklower  *  address, facilities information, higher level protocol value (first four
8341596Ssklower  *  bytes of the User Data field), and up to 12 characters of User Data.
8441596Ssklower  */
8541596Ssklower 
8641596Ssklower struct	sockaddr_x25 {
87*41709Ssklower 	u_char	x25_len;
88*41709Ssklower 	u_char	x25_family;	/* must be AF_CCITT */
8941596Ssklower 	short	x25_net;	/* network id code (usually a dnic) */
9041596Ssklower 	struct	x25opts {
9141596Ssklower 		char	op_flags;	/* miscellaneous options */
9241596Ssklower #define X25_REVERSE_CHARGE	0x01	/* remote DTE pays for call */
9341596Ssklower #define X25_DBIT		0x02	/* not yet supported */
9441596Ssklower #define X25_MQBIT		0x04	/* prepend M&Q bit status byte to packet data */
9541596Ssklower #define X25_OLDSOCKADDR		0x08	/* uses old sockaddr structure */
9641596Ssklower 		char	op_psize;	/* requested packet size */
9741596Ssklower #define X25_PS128		7
9841596Ssklower #define X25_PS256		8
9941596Ssklower #define X25_PS512		9
10041596Ssklower 		char	op_wsize;	/* window size (1 .. 7) */
10141596Ssklower 		char	op_speed;	/* throughput class */
10241596Ssklower 	} x25_opts;
10341596Ssklower 	char	x25_addr[16];	/* X.121 address (null terminated) */
10441596Ssklower 	short	x25_udlen;	/* user data field length */
10541596Ssklower 	char	x25_udata[16];	/* user data field */
10641596Ssklower };
107