1/*
2 * These are the public elements of the Linux kernel X.25 implementation.
3 *
4 * 	History
5 *	mar/20/00	Daniela Squassoni Disabling/enabling of facilities
6 *					  negotiation.
7 *	apr/02/05	Shaun Pereira Selective sub address matching with
8 *					call user data
9 */
10
11#ifndef	X25_KERNEL_H
12#define	X25_KERNEL_H
13
14#include <linux/types.h>
15
16#define	SIOCX25GSUBSCRIP	(SIOCPROTOPRIVATE + 0)
17#define	SIOCX25SSUBSCRIP	(SIOCPROTOPRIVATE + 1)
18#define	SIOCX25GFACILITIES	(SIOCPROTOPRIVATE + 2)
19#define	SIOCX25SFACILITIES	(SIOCPROTOPRIVATE + 3)
20#define	SIOCX25GCALLUSERDATA	(SIOCPROTOPRIVATE + 4)
21#define	SIOCX25SCALLUSERDATA	(SIOCPROTOPRIVATE + 5)
22#define	SIOCX25GCAUSEDIAG	(SIOCPROTOPRIVATE + 6)
23#define SIOCX25SCUDMATCHLEN	(SIOCPROTOPRIVATE + 7)
24#define SIOCX25CALLACCPTAPPRV   (SIOCPROTOPRIVATE + 8)
25#define SIOCX25SENDCALLACCPT    (SIOCPROTOPRIVATE + 9)
26#define SIOCX25GDTEFACILITIES (SIOCPROTOPRIVATE + 10)
27#define SIOCX25SDTEFACILITIES (SIOCPROTOPRIVATE + 11)
28
29/*
30 *	Values for {get,set}sockopt.
31 */
32#define	X25_QBITINCL		1
33
34/*
35 *	X.25 Packet Size values.
36 */
37#define	X25_PS16		4
38#define	X25_PS32		5
39#define	X25_PS64		6
40#define	X25_PS128		7
41#define	X25_PS256		8
42#define	X25_PS512		9
43#define	X25_PS1024		10
44#define	X25_PS2048		11
45#define	X25_PS4096		12
46
47/*
48 * An X.121 address, it is held as ASCII text, null terminated, up to 15
49 * digits and a null terminator.
50 */
51struct x25_address {
52	char x25_addr[16];
53};
54
55/*
56 *	Linux X.25 Address structure, used for bind, and connect mostly.
57 */
58struct sockaddr_x25 {
59	sa_family_t	   sx25_family;		/* Must be AF_X25 */
60	struct x25_address sx25_addr;		/* X.121 Address */
61};
62
63/*
64 *	DTE/DCE subscription options.
65 *
66 *      As this is missing lots of options, user should expect major
67 *	changes of this structure in 2.5.x which might break compatibilty.
68 *      The somewhat ugly dimension 200-sizeof() is needed to maintain
69 *	backward compatibility.
70 */
71struct x25_subscrip_struct {
72	char device[200-sizeof(unsigned long)];
73	unsigned long	global_facil_mask;	/* 0 to disable negotiation */
74	unsigned int	extended;
75};
76
77/* values for above global_facil_mask */
78
79#define	X25_MASK_REVERSE	0x01
80#define	X25_MASK_THROUGHPUT	0x02
81#define	X25_MASK_PACKET_SIZE	0x04
82#define	X25_MASK_WINDOW_SIZE	0x08
83
84#define X25_MASK_CALLING_AE 0x10
85#define X25_MASK_CALLED_AE 0x20
86
87
88/*
89 *	Routing table control structure.
90 */
91struct x25_route_struct {
92	struct x25_address address;
93	unsigned int	   sigdigits;
94	char		   device[200];
95};
96
97/*
98 *	Facilities structure.
99 */
100struct x25_facilities {
101	unsigned int	winsize_in, winsize_out;
102	unsigned int	pacsize_in, pacsize_out;
103	unsigned int	throughput;
104	unsigned int	reverse;
105};
106
107/*
108* ITU DTE facilities
109* Only the called and calling address
110* extension are currently implemented.
111* The rest are in place to avoid the struct
112* changing size if someone needs them later
113*/
114
115struct x25_dte_facilities {
116	__u16 delay_cumul;
117	__u16 delay_target;
118	__u16 delay_max;
119	__u8 min_throughput;
120	__u8 expedited;
121	__u8 calling_len;
122	__u8 called_len;
123	__u8 calling_ae[20];
124	__u8 called_ae[20];
125};
126
127/*
128 *	Call User Data structure.
129 */
130struct x25_calluserdata {
131	unsigned int	cudlength;
132	unsigned char	cuddata[128];
133};
134
135/*
136 *	Call clearing Cause and Diagnostic structure.
137 */
138struct x25_causediag {
139	unsigned char	cause;
140	unsigned char	diagnostic;
141};
142
143/*
144 *	Further optional call user data match length selection
145 */
146struct x25_subaddr {
147	unsigned int cudmatchlength;
148};
149
150#endif
151