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