1
2
3
4
5
6
7 #ifndef _AX25_H
8 #define _AX25_H
9 #include <linux/ax25.h>
10
11 #define PR_SLOWHZ 10
12
13 #define AX25_T1CLAMPLO (1 * PR_SLOWHZ)
14 #define AX25_T1CLAMPHI (30 * PR_SLOWHZ)
15
16 #define AX25_BROKEN_NETMAC
17
18 #define AX25_BPQ_HEADER_LEN 16
19 #define AX25_KISS_HEADER_LEN 1
20
21 #define AX25_HEADER_LEN 17
22 #define AX25_ADDR_LEN 7
23 #define AX25_DIGI_HEADER_LEN (AX25_MAX_DIGIS * AX25_ADDR_LEN)
24 #define AX25_MAX_HEADER_LEN (AX25_HEADER_LEN + AX25_DIGI_HEADER_LEN)
25
26 #define AX25_P_IP 0xCC
27 #define AX25_P_ARP 0xCD
28 #define AX25_P_TEXT 0xF0
29 #define AX25_P_NETROM 0xCF
30 #define AX25_P_SEGMENT 0x08
31
32 #define SEG_REM 0x7F
33 #define SEG_FIRST 0x80
34
35 #define LAPB_UI 0x03
36 #define LAPB_C 0x80
37 #define LAPB_E 0x01
38
39 #define SSSID_SPARE 0x60
40 #define ESSID_SPARE 0x20
41 #define DAMA_FLAG 0x20
42
43 #define AX25_REPEATED 0x80
44
45 #define ACK_PENDING_CONDITION 0x01
46 #define REJECT_CONDITION 0x02
47 #define PEER_RX_BUSY_CONDITION 0x04
48 #define OWN_RX_BUSY_CONDITION 0x08
49
50 #ifndef _LINUX_NETDEVICE_H
51 #include <linux/netdevice.h>
52 #endif
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78 #define I 0x00
79 #define S 0x01
80 #define RR 0x01
81 #define RNR 0x05
82 #define REJ 0x09
83 #define U 0x03
84 #define SABM 0x2f
85 #define SABME 0x6f
86 #define DISC 0x43
87 #define DM 0x0f
88 #define UA 0x63
89 #define FRMR 0x87
90 #define UI 0x03
91 #define PF 0x10
92 #define EPF 0x01
93
94 #define ILLEGAL 0x100
95
96 #define POLLOFF 0
97 #define POLLON 1
98
99
100
101 #define C_COMMAND 1
102 #define C_RESPONSE 2
103
104
105
106 #define AX25_STATE_0 0
107 #define AX25_STATE_1 1
108 #define AX25_STATE_2 2
109 #define AX25_STATE_3 3
110 #define AX25_STATE_4 4
111
112 #define MODULUS 8
113 #define EMODULUS 128
114
115 #define AX25_DEF_IPDEFMODE 'D'
116 #define AX25_DEF_AXDEFMODE 8
117 #define AX25_DEF_NETROM 1
118 #define AX25_DEF_TEXT 1
119 #define AX25_DEF_BACKOFF 'E'
120 #define AX25_DEF_CONMODE 1
121 #define AX25_DEF_WINDOW 2
122 #define AX25_DEF_EWINDOW 32
123 #define AX25_DEF_T1 10
124 #define AX25_DEF_T2 3
125 #define AX25_DEF_T3 300
126 #define AX25_DEF_N2 10
127 #define AX25_DEF_IDLE 20
128 #define AX25_DEF_PACLEN 256
129 #define AX25_DEF_IPMAXQUEUE 1
130 #define AX25_DEF_DIGI (AX25_DIGI_INBAND|AX25_DIGI_XBAND)
131
132 typedef struct ax25_uid_assoc {
133 struct ax25_uid_assoc *next;
134 uid_t uid;
135 ax25_address call;
136 } ax25_uid_assoc;
137
138 typedef struct {
139 ax25_address calls[AX25_MAX_DIGIS];
140 unsigned char repeated[AX25_MAX_DIGIS];
141 unsigned char ndigi;
142 char lastrepeat;
143 } ax25_digi;
144
145 typedef struct ax25_cb {
146 struct ax25_cb *next;
147 ax25_address source_addr, dest_addr;
148 struct device *device;
149 unsigned char dama_slave;
150 unsigned char state, modulus, hdrincl;
151 unsigned short vs, vr, va;
152 unsigned char condition, backoff;
153 unsigned char n2, n2count;
154 unsigned short t1, t2, t3, idle, rtt;
155 unsigned short t1timer, t2timer, t3timer, idletimer;
156 unsigned short paclen;
157 unsigned short maxqueue;
158 unsigned short fragno, fraglen;
159 ax25_digi *digipeat;
160 struct sk_buff_head write_queue;
161 struct sk_buff_head reseq_queue;
162 struct sk_buff_head ack_queue;
163 struct sk_buff_head frag_queue;
164 unsigned char window;
165 struct timer_list timer;
166 struct sock *sk;
167 } ax25_cb;
168
169
170 extern ax25_address null_ax25_address;
171 extern char *ax2asc(ax25_address *);
172 extern int ax25cmp(ax25_address *, ax25_address *);
173 extern int ax25_send_frame(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *, struct device *);
174 extern void ax25_destroy_socket(ax25_cb *);
175 extern struct device *ax25rtr_get_dev(ax25_address *);
176 extern int ax25_encapsulate(struct sk_buff *, struct device *, unsigned short,
177 void *, void *, unsigned int);
178 extern int ax25_rebuild_header(unsigned char *, struct device *, unsigned long, struct sk_buff *);
179 extern ax25_uid_assoc *ax25_uid_list;
180 extern int ax25_uid_policy;
181 extern ax25_address *ax25_findbyuid(uid_t);
182 extern void ax25_queue_xmit(struct sk_buff *, struct device *, int);
183 extern int ax25_dev_is_dama_slave(struct device *);
184
185 #include <net/ax25call.h>
186
187
188 extern int ax25_process_rx_frame(ax25_cb *, struct sk_buff *, int, int);
189
190
191 extern void ax25_output(ax25_cb *, struct sk_buff *);
192 extern void ax25_kick(ax25_cb *);
193 extern void ax25_transmit_buffer(ax25_cb *, struct sk_buff *, int);
194 extern void ax25_nr_error_recovery(ax25_cb *);
195 extern void ax25_establish_data_link(ax25_cb *);
196 extern void ax25_transmit_enquiry(ax25_cb *);
197 extern void ax25_enquiry_response(ax25_cb *);
198 extern void ax25_timeout_response(ax25_cb *);
199 extern void ax25_check_iframes_acked(ax25_cb *, unsigned short);
200 extern void ax25_check_need_response(ax25_cb *, int, int);
201 extern void dama_enquiry_response(ax25_cb *);
202 extern void dama_check_need_response(ax25_cb *, int, int);
203 extern void dama_establish_data_link(ax25_cb *);
204
205
206 extern void ax25_rt_rx_frame(ax25_address *, struct device *, ax25_digi *);
207 extern int ax25_rt_get_info(char *, char **, off_t, int, int);
208 extern int ax25_cs_get_info(char *, char **, off_t, int, int);
209 extern int ax25_rt_autobind(ax25_cb *, ax25_address *);
210 extern void ax25_rt_build_path(ax25_cb *, ax25_address *);
211 extern void ax25_dg_build_path(struct sk_buff *, ax25_address *, struct device *);
212 extern void ax25_rt_device_down(struct device *);
213 extern int ax25_rt_ioctl(unsigned int, void *);
214 extern void ax25_ip_mode_set(ax25_address *, struct device *, char);
215 extern char ax25_ip_mode_get(ax25_address *, struct device *);
216 extern unsigned short ax25_dev_get_value(struct device *, int);
217 extern void ax25_dev_device_up(struct device *);
218 extern void ax25_dev_device_down(struct device *);
219 extern int ax25_dev_ioctl(unsigned int, void *);
220 extern int ax25_bpq_get_info(char *, char **, off_t, int, int);
221 extern ax25_address *ax25_bpq_get_addr(struct device *);
222 extern int ax25_bpq_ioctl(unsigned int, void *);
223
224
225 extern void ax25_clear_queues(ax25_cb *);
226 extern void ax25_frames_acked(ax25_cb *, unsigned short);
227 extern void ax25_requeue_frames(ax25_cb *);
228 extern int ax25_validate_nr(ax25_cb *, unsigned short);
229 extern int ax25_decode(ax25_cb *, struct sk_buff *, int *, int *, int *);
230 extern void ax25_send_control(ax25_cb *, int, int, int);
231 extern unsigned short ax25_calculate_t1(ax25_cb *);
232 extern void ax25_calculate_rtt(ax25_cb *);
233 extern unsigned char *ax25_parse_addr(unsigned char *, int, ax25_address *,
234 ax25_address *, ax25_digi *, int *, int *);
235 extern int build_ax25_addr(unsigned char *, ax25_address *, ax25_address *,
236 ax25_digi *, int, int);
237 extern int size_ax25_addr(ax25_digi *);
238 extern void ax25_digi_invert(ax25_digi *, ax25_digi *);
239 extern void ax25_return_dm(struct device *, ax25_address *, ax25_address *, ax25_digi *);
240 extern int ax25_queue_length(ax25_cb *, struct sk_buff *);
241 extern void ax25_dama_on(ax25_cb *);
242 extern void ax25_dama_off(ax25_cb *);
243
244
245 extern void ax25_set_timer(ax25_cb *);
246 extern void ax25_t1_timeout(ax25_cb *);
247
248
249
250 extern ax25_cb * volatile ax25_list;
251
252 #endif