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