xref: /original-bsd/sys/netccitt/x25.h (revision 37071c60)
1 /*
2  * Copyright (c) University of British Columbia, 1984
3  * Copyright (c) 1990, 1992, 1993
4  *	The Regents of the University of California.  All rights reserved.
5  * 		 University of Erlangen-Nuremberg, Germany, 1992
6  *
7  * This code is derived from software contributed to Berkeley by the
8  * Laboratory for Computation Vision and the Computer Science Department
9  * of the the University of British Columbia and the Computer Science
10  * Department (IV) of the University of Erlangen-Nuremberg, Germany.
11  *
12  * %sccs.include.redist.c%
13  *
14  *	@(#)x25.h	8.1 (Berkeley) 06/10/93
15  */
16 
17 #ifdef KERNEL
18 #define PRC_IFUP	3
19 #define PRC_LINKUP	4
20 #define PRC_LINKDOWN	5
21 #define PRC_LINKRESET	6
22 #define PRC_LINKDONTCOPY	7
23 #ifndef PRC_DISCONNECT_REQUEST
24 #define PRC_DISCONNECT_REQUEST 10
25 #endif
26 #endif
27 
28 #define CCITTPROTO_HDLC		1
29 #define CCITTPROTO_X25		2	/* packet level protocol */
30 #define IEEEPROTO_802LLC	3	/* doesn't belong here */
31 
32 #define HDLCPROTO_LAP		1
33 #define HDLCPROTO_LAPB		2
34 #define HDLCPROTO_UNSET		3
35 #define HDLCPROTO_LAPD		4
36 
37 /* socket options */
38 #define PK_ACCTFILE		1	/* use level = CCITTPROTO_X25 */
39 #define PK_FACILITIES		2	/* use level = CCITTPROTO_X25 */
40 #define PK_RTATTACH		3	/* use level = CCITTPROTO_X25 */
41 #define PK_PRLISTEN		4	/* use level = CCITTPROTO_X25 */
42 
43 #define MAX_FACILITIES		109     /* maximum size for facilities */
44 
45 /*
46  *  X.25 Socket address structure.  It contains the  X.121 or variation of
47  *  X.121, facilities information, higher level protocol value (first four
48  *  bytes of the User Data field), and the last  12 characters of the User
49  *  Data field.
50  */
51 
52 struct x25_sockaddr {		/* obsolete - use sockaddr_x25 */
53     short  xaddr_len;		/* Length of xaddr_addr.		*/
54     u_char xaddr_addr[15];	/* Network dependent or X.121 address.	*/
55     u_char xaddr_facilities;	/* Facilities information.		*/
56 #define XS_REVERSE_CHARGE	0x01
57 #define XS_HIPRIO		0x02
58     u_char xaddr_proto[4];	/* Protocol ID (4 bytes of user data).	*/
59     u_char xaddr_userdata[12];	/* Remaining User data field.		*/
60 };
61 
62 /*
63  *  X.25 Socket address structure.  It contains the network id, X.121
64  *  address, facilities information, higher level protocol value (first four
65  *  bytes of the User Data field), and up to 12 characters of User Data.
66  */
67 
68 struct	sockaddr_x25 {
69 	u_char	x25_len;
70 	u_char	x25_family;	/* must be AF_CCITT */
71 	short	x25_net;	/* network id code (usually a dnic) */
72 	char	x25_addr[16];	/* X.121 address (null terminated) */
73 	struct	x25opts {
74 		char	op_flags;	/* miscellaneous options */
75 					/* pk_var.h defines other lcd_flags */
76 #define X25_REVERSE_CHARGE	0x01	/* remote DTE pays for call */
77 #define X25_DBIT		0x02	/* not yet supported */
78 #define X25_MQBIT		0x04	/* prepend M&Q bit status byte to packet data */
79 #define X25_OLDSOCKADDR		0x08	/* uses old sockaddr structure */
80 #define X25_DG_CIRCUIT		0x10	/* lcd_flag: used for datagrams */
81 #define X25_DG_ROUTING		0x20	/* lcd_flag: peer addr not yet known */
82 #define X25_MBS_HOLD		0x40	/* lcd_flag: collect m-bit sequences */
83 		char	op_psize;	/* requested packet size */
84 #define X25_PS128		7
85 #define X25_PS256		8
86 #define X25_PS512		9
87 		char	op_wsize;	/* window size (1 .. 7) */
88 		char	op_speed;	/* throughput class */
89 	} x25_opts;
90 	short	x25_udlen;	/* user data field length */
91 	char	x25_udata[16];	/* user data field */
92 };
93 
94 /*
95  * network configuration info
96  * this structure must be 16 bytes long
97  */
98 
99 struct	x25config {
100 	struct	sockaddr_x25 xc_addr;
101 	/* link level parameters */
102 	u_short	xc_lproto:4,	/* link level protocol eg. CCITTPROTO_HDLC */
103 		xc_lptype:4,	/* protocol type eg. HDLCPROTO_LAPB */
104 		xc_ltrace:1,	/* link level tracing flag */
105 		xc_lwsize:7;	/* link level window size */
106 	u_short	xc_lxidxchg:1,  /* link level XID exchange flag - NOT YET */
107 	/* packet level parameters */
108 	        xc_rsvd1:2,
109                 xc_pwsize:3,	/* default window size */
110 		xc_psize:4,	/* default packet size 7=128, 8=256, ... */
111 		xc_type:3,	/* network type */
112 #define X25_1976	0
113 #define X25_1980	1
114 #define X25_1984	2
115 #define X25_DDN		3
116 #define X25_BASIC	4
117 		xc_ptrace:1,	/* packet level tracing flag */
118 		xc_nodnic:1,	/* remove our dnic when calling on net */
119 		xc_prepnd0:1;	/* prepend 0 when making offnet calls */
120 	u_short	xc_maxlcn;	/* max logical channels */
121 	u_short	xc_dg_idletimo;	/* timeout for idle datagram circuits. */
122 };
123 
124 #ifdef IFNAMSIZ
125 struct ifreq_x25 {
126 	char	ifr_name[IFNAMSIZ];		/* if name, e.g. "en0" */
127 	struct	x25config ifr_xc;
128 };
129 #define	SIOCSIFCONF_X25	_IOW('i', 12, struct ifreq_x25)	/* set ifnet config */
130 #define	SIOCGIFCONF_X25	_IOWR('i',13, struct ifreq_x25)	/* get ifnet config */
131 #endif
132