1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * These are the public elements of the Linux kernel AX.25 code. A similar
4  * file netrom.h exists for the NET/ROM protocol.
5  */
6 
7 #ifndef	AX25_KERNEL_H
8 #define	AX25_KERNEL_H
9 
10 #include <linux/socket.h>
11 
12 #define AX25_MTU	256
13 #define AX25_MAX_DIGIS  8
14 
15 #define AX25_WINDOW	1
16 #define AX25_T1		2
17 #define AX25_N2		3
18 #define AX25_T3		4
19 #define AX25_T2		5
20 #define	AX25_BACKOFF	6
21 #define	AX25_EXTSEQ	7
22 #define	AX25_PIDINCL	8
23 #define AX25_IDLE	9
24 #define AX25_PACLEN	10
25 #define AX25_IAMDIGI	12
26 
27 #define AX25_KILL	99
28 
29 #define SIOCAX25GETUID		(SIOCPROTOPRIVATE+0)
30 #define SIOCAX25ADDUID		(SIOCPROTOPRIVATE+1)
31 #define SIOCAX25DELUID		(SIOCPROTOPRIVATE+2)
32 #define SIOCAX25NOUID		(SIOCPROTOPRIVATE+3)
33 #define SIOCAX25OPTRT		(SIOCPROTOPRIVATE+7)
34 #define SIOCAX25CTLCON		(SIOCPROTOPRIVATE+8)
35 #define SIOCAX25GETINFOOLD	(SIOCPROTOPRIVATE+9)
36 #define SIOCAX25ADDFWD		(SIOCPROTOPRIVATE+10)
37 #define SIOCAX25DELFWD		(SIOCPROTOPRIVATE+11)
38 #define SIOCAX25DEVCTL          (SIOCPROTOPRIVATE+12)
39 #define SIOCAX25GETINFO         (SIOCPROTOPRIVATE+13)
40 
41 #define AX25_SET_RT_IPMODE	2
42 
43 #define AX25_NOUID_DEFAULT	0
44 #define AX25_NOUID_BLOCK	1
45 
46 typedef struct {
47 	char		ax25_call[7];	/* 6 call + SSID (shifted ascii!) */
48 } ax25_address;
49 
50 struct sockaddr_ax25 {
51 	__kernel_sa_family_t sax25_family;
52 	ax25_address	sax25_call;
53 	int		sax25_ndigis;
54 	/* Digipeater ax25_address sets follow */
55 };
56 
57 #define sax25_uid	sax25_ndigis
58 
59 struct full_sockaddr_ax25 {
60 	struct sockaddr_ax25 fsa_ax25;
61 	ax25_address	fsa_digipeater[AX25_MAX_DIGIS];
62 };
63 
64 struct ax25_routes_struct {
65 	ax25_address	port_addr;
66 	ax25_address	dest_addr;
67 	unsigned char	digi_count;
68 	ax25_address	digi_addr[AX25_MAX_DIGIS];
69 };
70 
71 struct ax25_route_opt_struct {
72 	ax25_address	port_addr;
73 	ax25_address	dest_addr;
74 	int		cmd;
75 	int		arg;
76 };
77 
78 struct ax25_ctl_struct {
79         ax25_address            port_addr;
80         ax25_address            source_addr;
81         ax25_address            dest_addr;
82         unsigned int            cmd;
83         unsigned long           arg;
84         unsigned char           digi_count;
85         ax25_address            digi_addr[AX25_MAX_DIGIS];
86 };
87 
88 /* this will go away. Please do not export to user land */
89 struct ax25_info_struct_deprecated {
90 	unsigned int	n2, n2count;
91 	unsigned int	t1, t1timer;
92 	unsigned int	t2, t2timer;
93 	unsigned int	t3, t3timer;
94 	unsigned int	idle, idletimer;
95 	unsigned int	state;
96 	unsigned int	rcv_q, snd_q;
97 };
98 
99 struct ax25_info_struct {
100 	unsigned int	n2, n2count;
101 	unsigned int	t1, t1timer;
102 	unsigned int	t2, t2timer;
103 	unsigned int	t3, t3timer;
104 	unsigned int	idle, idletimer;
105 	unsigned int	state;
106 	unsigned int	rcv_q, snd_q;
107 	unsigned int	vs, vr, va, vs_max;
108 	unsigned int	paclen;
109 	unsigned int	window;
110 };
111 
112 struct ax25_fwd_struct {
113 	ax25_address	port_from;
114 	ax25_address	port_to;
115 };
116 
117 #endif