xref: /original-bsd/sys/netccitt/x25.h (revision 9052d23a)
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  *	@(#)x25.h	7.4 (Berkeley) 08/30/90
13  */
14 
15 #ifdef KERNEL
16 #define PRC_IFUP	3
17 #define PRC_LINKUP	4
18 #define PRC_LINKDOWN	5
19 #define PRC_LINKRESET	6
20 #define PRC_LINKDONTCOPY	7
21 #endif
22 
23 #define CCITTPROTO_HDLC		1
24 #define CCITTPROTO_X25		2	/* packet level protocol */
25 #define IEEEPROTO_802LLC	3	/* doesn't belong here */
26 
27 #define HDLCPROTO_LAP		1
28 #define HDLCPROTO_LAPB		2
29 #define HDLCPROTO_UNSET		3
30 #define HDLCPROTO_LAPD		4
31 
32 /* socket options */
33 #define PK_ACCTFILE		1	/* use level = CCITTPROTO_X25 */
34 
35 /*
36  *  X.25 Socket address structure.  It contains the  X.121 or variation of
37  *  X.121, facilities information, higher level protocol value (first four
38  *  bytes of the User Data field), and the last  12 characters of the User
39  *  Data field.
40  */
41 
42 struct x25_sockaddr {		/* obsolete - use sockaddr_x25 */
43     short  xaddr_len;		/* Length of xaddr_addr.		*/
44     u_char xaddr_addr[15];	/* Network dependent or X.121 address.	*/
45     u_char xaddr_facilities;	/* Facilities information.		*/
46 #define XS_REVERSE_CHARGE	0x01
47 #define XS_HIPRIO		0x02
48     u_char xaddr_proto[4];	/* Protocol ID (4 bytes of user data).	*/
49     u_char xaddr_userdata[12];	/* Remaining User data field.		*/
50 };
51 
52 /*
53  *  X.25 Socket address structure.  It contains the network id, X.121
54  *  address, facilities information, higher level protocol value (first four
55  *  bytes of the User Data field), and up to 12 characters of User Data.
56  */
57 
58 struct	sockaddr_x25 {
59 	u_char	x25_len;
60 	u_char	x25_family;	/* must be AF_CCITT */
61 	short	x25_net;	/* network id code (usually a dnic) */
62 	char	x25_addr[16];	/* X.121 address (null terminated) */
63 	struct	x25opts {
64 		char	op_flags;	/* miscellaneous options */
65 					/* pk_var.h defines other lcd_flags */
66 #define X25_REVERSE_CHARGE	0x01	/* remote DTE pays for call */
67 #define X25_DBIT		0x02	/* not yet supported */
68 #define X25_MQBIT		0x04	/* prepend M&Q bit status byte to packet data */
69 #define X25_OLDSOCKADDR		0x08	/* uses old sockaddr structure */
70 		char	op_psize;	/* requested packet size */
71 #define X25_PS128		7
72 #define X25_PS256		8
73 #define X25_PS512		9
74 		char	op_wsize;	/* window size (1 .. 7) */
75 		char	op_speed;	/* throughput class */
76 	} x25_opts;
77 	short	x25_udlen;	/* user data field length */
78 	char	x25_udata[16];	/* user data field */
79 };
80 
81 /*
82  * network configuration info
83  * this structure must be 16 bytes long
84  */
85 
86 struct	x25config {
87 	struct	sockaddr_x25 xc_addr;
88 	/* link level parameters */
89 	u_short	xc_lproto:4,	/* link level protocol eg. CCITTPROTO_HDLC */
90 		xc_lptype:4,	/* protocol type eg. HDLCPROTO_LAPB */
91 		xc_lwsize:5,	/* link level window size */
92 		xc_ltrace:1,	/* link level tracing flag */
93 		xc_rsvd1:2;	/* for use by other link-level protocols */
94 	/* packet level parameters */
95 	u_short	xc_pwsize:3,	/* default window size */
96 		xc_psize:4,	/* default packet size 7=128, 8=256, ... */
97 		xc_type:3,	/* network type */
98 #define X25_1976	0
99 #define X25_1980	1
100 #define X25_1984	2
101 #define X25_DDN		3
102 #define X25_BASIC	4
103 		xc_ptrace:1,	/* packet level tracing flag */
104 		xc_rsvd2:5;
105 	u_short	xc_maxlcn;	/* max logical channels */
106 	u_short	xc_dg_idletimo;	/* timeout for idle datagram circuits. */
107 };
108 
109 #ifdef IFNAMSIZ
110 struct ifreq_x25 {
111 	char	ifr_name[IFNAMSIZ];		/* if name, e.g. "en0" */
112 	struct	x25config ifr_xc;
113 };
114 #define	SIOCSIFCONF_X25	_IOW('i', 12, struct ifreq_x25)	/* set ifnet config */
115 #define	SIOCGIFCONF_X25	_IOWR('i',13, struct ifreq_x25)	/* get ifnet config */
116 #endif
117