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