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