1 |
1633 |
jcastillo |
/*
|
2 |
|
|
* Declarations of Rose type objects.
|
3 |
|
|
*
|
4 |
|
|
* Jonathan Naylor G4KLX 25/8/96
|
5 |
|
|
*/
|
6 |
|
|
|
7 |
|
|
#ifndef _ROSE_H
|
8 |
|
|
#define _ROSE_H
|
9 |
|
|
#include <linux/rose.h>
|
10 |
|
|
|
11 |
|
|
#define ROSE_SLOWHZ 10 /* Run timing at 1/10 second */
|
12 |
|
|
|
13 |
|
|
#define ROSE_ADDR_LEN 5
|
14 |
|
|
|
15 |
|
|
#define ROSE_MIN_LEN 3
|
16 |
|
|
|
17 |
|
|
#define ROSE_GFI 0x10
|
18 |
|
|
#define ROSE_Q_BIT 0x80
|
19 |
|
|
#define ROSE_D_BIT 0x40
|
20 |
|
|
#define ROSE_M_BIT 0x10
|
21 |
|
|
#define M_BIT 0x10
|
22 |
|
|
|
23 |
|
|
#define ROSE_CALL_REQUEST 0x0B
|
24 |
|
|
#define ROSE_CALL_ACCEPTED 0x0F
|
25 |
|
|
#define ROSE_CLEAR_REQUEST 0x13
|
26 |
|
|
#define ROSE_CLEAR_CONFIRMATION 0x17
|
27 |
|
|
#define ROSE_DATA 0x00
|
28 |
|
|
#define ROSE_INTERRUPT 0x23
|
29 |
|
|
#define ROSE_INTERRUPT_CONFIRMATION 0x27
|
30 |
|
|
#define ROSE_RR 0x01
|
31 |
|
|
#define ROSE_RNR 0x05
|
32 |
|
|
#define ROSE_REJ 0x09
|
33 |
|
|
#define ROSE_RESET_REQUEST 0x1B
|
34 |
|
|
#define ROSE_RESET_CONFIRMATION 0x1F
|
35 |
|
|
#define ROSE_REGISTRATION_REQUEST 0xF3
|
36 |
|
|
#define ROSE_REGISTRATION_CONFIRMATION 0xF7
|
37 |
|
|
#define ROSE_RESTART_REQUEST 0xFB
|
38 |
|
|
#define ROSE_RESTART_CONFIRMATION 0xFF
|
39 |
|
|
#define ROSE_DIAGNOSTIC 0xF1
|
40 |
|
|
#define ROSE_ILLEGAL 0xFD
|
41 |
|
|
|
42 |
|
|
/* Define Link State constants. */
|
43 |
|
|
|
44 |
|
|
#define ROSE_STATE_0 0 /* Ready */
|
45 |
|
|
#define ROSE_STATE_1 1 /* Awaiting Call Accepted */
|
46 |
|
|
#define ROSE_STATE_2 2 /* Awaiting Clear Confirmation */
|
47 |
|
|
#define ROSE_STATE_3 3 /* Data Transfer */
|
48 |
|
|
#define ROSE_STATE_4 4 /* Awaiting Reset Confirmation */
|
49 |
|
|
#define ROSE_STATE_5 5 /* Deferred Call Acceptance */
|
50 |
|
|
|
51 |
|
|
#define ROSE_DEFAULT_T0 (180 * ROSE_SLOWHZ) /* Default T10 T20 value */
|
52 |
|
|
#define ROSE_DEFAULT_T1 (200 * ROSE_SLOWHZ) /* Default T11 T21 value */
|
53 |
|
|
#define ROSE_DEFAULT_T2 (180 * ROSE_SLOWHZ) /* Default T12 T22 value */
|
54 |
|
|
#define ROSE_DEFAULT_T3 (180 * ROSE_SLOWHZ) /* Default T13 T23 value */
|
55 |
|
|
#define ROSE_DEFAULT_HB (5 * ROSE_SLOWHZ) /* Default Holdback value */
|
56 |
|
|
#define ROSE_DEFAULT_ROUTING 1 /* Default routing flag */
|
57 |
|
|
#define ROSE_DEFAULT_FAIL_TIMEOUT (120 * ROSE_SLOWHZ) /* Time until link considered usable */
|
58 |
|
|
#define ROSE_DEFAULT_MAXVC 50 /* Maximum number of VCs per neighbour */
|
59 |
|
|
#define ROSE_DEFAULT_WINDOW_SIZE 7 /* Default window value */
|
60 |
|
|
|
61 |
|
|
#define ROSE_MODULUS 8
|
62 |
|
|
#define ROSE_MAX_PACKET_SIZE 251 /* Maximum Packet Size */
|
63 |
|
|
|
64 |
|
|
#define ROSE_MAX_WINDOW_LEN ((AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + ROSE_MIN_LEN + 300) * 7)
|
65 |
|
|
|
66 |
|
|
#define ROSE_COND_ACK_PENDING 0x01
|
67 |
|
|
#define ROSE_COND_PEER_RX_BUSY 0x02
|
68 |
|
|
#define ROSE_COND_OWN_RX_BUSY 0x04
|
69 |
|
|
|
70 |
|
|
#define FAC_NATIONAL 0x00
|
71 |
|
|
#define FAC_CCITT 0x0F
|
72 |
|
|
|
73 |
|
|
#define FAC_NATIONAL_RAND 0x7F
|
74 |
|
|
#define FAC_NATIONAL_FLAGS 0x3F
|
75 |
|
|
#define FAC_NATIONAL_DEST_DIGI 0xE9
|
76 |
|
|
#define FAC_NATIONAL_SRC_DIGI 0xEB
|
77 |
|
|
#define FAC_NATIONAL_FAIL_CALL 0xED
|
78 |
|
|
#define FAC_NATIONAL_FAIL_ADD 0xEE
|
79 |
|
|
#define FAC_NATIONAL_DIGIS 0xEF
|
80 |
|
|
|
81 |
|
|
#define FAC_CCITT_DEST_NSAP 0xC9
|
82 |
|
|
#define FAC_CCITT_SRC_NSAP 0xCB
|
83 |
|
|
|
84 |
|
|
struct rose_neigh {
|
85 |
|
|
struct rose_neigh *next;
|
86 |
|
|
ax25_address callsign;
|
87 |
|
|
ax25_digi *digipeat;
|
88 |
|
|
ax25_cb *ax25;
|
89 |
|
|
struct device *dev;
|
90 |
|
|
unsigned short count;
|
91 |
|
|
unsigned short use;
|
92 |
|
|
unsigned int number;
|
93 |
|
|
char restarted;
|
94 |
|
|
char dce_mode;
|
95 |
|
|
struct sk_buff_head queue;
|
96 |
|
|
unsigned short t0timer, ftimer;
|
97 |
|
|
struct timer_list timer;
|
98 |
|
|
};
|
99 |
|
|
|
100 |
|
|
#define ROSE_MAX_ALTERNATE 3
|
101 |
|
|
struct rose_node {
|
102 |
|
|
struct rose_node *next;
|
103 |
|
|
rose_address address;
|
104 |
|
|
unsigned short mask;
|
105 |
|
|
unsigned char count;
|
106 |
|
|
struct rose_neigh *neighbour[ROSE_MAX_ALTERNATE];
|
107 |
|
|
};
|
108 |
|
|
|
109 |
|
|
typedef struct {
|
110 |
|
|
unsigned int lci;
|
111 |
|
|
struct rose_neigh *neigh;
|
112 |
|
|
unsigned short vs, vr, va, vl;
|
113 |
|
|
unsigned short pending;
|
114 |
|
|
unsigned char state, condition;
|
115 |
|
|
struct timer_list timer;
|
116 |
|
|
} rose_tr;
|
117 |
|
|
|
118 |
|
|
struct rose_route {
|
119 |
|
|
struct rose_route *next;
|
120 |
|
|
rose_address src_addr, dest_addr;
|
121 |
|
|
ax25_address src_call, dest_call;
|
122 |
|
|
rose_tr tr1, tr2;
|
123 |
|
|
unsigned int rand;
|
124 |
|
|
};
|
125 |
|
|
|
126 |
|
|
typedef struct {
|
127 |
|
|
rose_address source_addr, dest_addr;
|
128 |
|
|
ax25_address source_call, dest_call;
|
129 |
|
|
unsigned char source_ndigis, dest_ndigis;
|
130 |
|
|
ax25_address source_digis[ROSE_MAX_DIGIS];
|
131 |
|
|
ax25_address dest_digis[ROSE_MAX_DIGIS];
|
132 |
|
|
struct rose_neigh *neighbour;
|
133 |
|
|
struct device *device;
|
134 |
|
|
unsigned int lci, rand;
|
135 |
|
|
unsigned char state, condition, qbitincl, defer;
|
136 |
|
|
unsigned char cause, diagnostic;
|
137 |
|
|
unsigned short vs, vr, va, vl;
|
138 |
|
|
unsigned short timer;
|
139 |
|
|
unsigned short t1, t2, t3, hb;
|
140 |
|
|
#ifdef M_BIT
|
141 |
|
|
unsigned short fraglen;
|
142 |
|
|
struct sk_buff_head frag_queue;
|
143 |
|
|
#endif
|
144 |
|
|
struct sk_buff_head ack_queue;
|
145 |
|
|
struct rose_facilities_struct facilities;
|
146 |
|
|
struct sock *sk; /* Backlink to socket */
|
147 |
|
|
} rose_cb;
|
148 |
|
|
|
149 |
|
|
/* af_rose.c */
|
150 |
|
|
extern ax25_address rose_callsign;
|
151 |
|
|
extern int sysctl_rose_restart_request_timeout;
|
152 |
|
|
extern int sysctl_rose_call_request_timeout;
|
153 |
|
|
extern int sysctl_rose_reset_request_timeout;
|
154 |
|
|
extern int sysctl_rose_clear_request_timeout;
|
155 |
|
|
extern int sysctl_rose_ack_hold_back_timeout;
|
156 |
|
|
extern int sysctl_rose_routing_control;
|
157 |
|
|
extern int sysctl_rose_link_fail_timeout;
|
158 |
|
|
extern int sysctl_rose_maximum_vcs;
|
159 |
|
|
extern int sysctl_rose_window_size;
|
160 |
|
|
extern int rosecmp(rose_address *, rose_address *);
|
161 |
|
|
extern int rosecmpm(rose_address *, rose_address *, unsigned short);
|
162 |
|
|
extern char *rose2asc(rose_address *);
|
163 |
|
|
extern void rose_kill_by_neigh(struct rose_neigh *);
|
164 |
|
|
extern struct sock *rose_find_socket(unsigned int, struct rose_neigh *);
|
165 |
|
|
extern unsigned int rose_new_lci(struct rose_neigh *);
|
166 |
|
|
extern int rose_rx_call_request(struct sk_buff *, struct device *, struct rose_neigh *, unsigned int);
|
167 |
|
|
extern void rose_destroy_socket(struct sock *);
|
168 |
|
|
|
169 |
|
|
/* rose_dev.c */
|
170 |
|
|
extern int rose_rx_ip(struct sk_buff *, struct device *);
|
171 |
|
|
extern int rose_init(struct device *);
|
172 |
|
|
|
173 |
|
|
#include <net/rosecall.h>
|
174 |
|
|
|
175 |
|
|
/* rose_in.c */
|
176 |
|
|
extern int rose_process_rx_frame(struct sock *, struct sk_buff *);
|
177 |
|
|
|
178 |
|
|
/* rose_link.c */
|
179 |
|
|
extern void rose_link_set_timer(struct rose_neigh *);
|
180 |
|
|
extern void rose_link_rx_restart(struct sk_buff *, struct rose_neigh *, unsigned short);
|
181 |
|
|
extern void rose_transmit_restart_request(struct rose_neigh *);
|
182 |
|
|
extern void rose_transmit_restart_confirmation(struct rose_neigh *);
|
183 |
|
|
extern void rose_transmit_diagnostic(struct rose_neigh *, unsigned char);
|
184 |
|
|
extern void rose_transmit_clear_request(struct rose_neigh *, unsigned int, unsigned char, unsigned char);
|
185 |
|
|
extern void rose_transmit_link(struct sk_buff *, struct rose_neigh *);
|
186 |
|
|
|
187 |
|
|
/* rose_loopback.c */
|
188 |
|
|
extern void rose_loopback_init(void);
|
189 |
|
|
extern void rose_loopback_clear(void);
|
190 |
|
|
extern int rose_loopback_queue(struct sk_buff *, struct rose_neigh *);
|
191 |
|
|
|
192 |
|
|
/* rose_out.c */
|
193 |
|
|
extern void rose_kick(struct sock *);
|
194 |
|
|
extern void rose_enquiry_response(struct sock *);
|
195 |
|
|
|
196 |
|
|
/* rose_route.c */
|
197 |
|
|
extern void rose_rt_device_down(struct device *);
|
198 |
|
|
extern void rose_link_device_down(struct device *);
|
199 |
|
|
extern void rose_clean_neighbour(struct rose_neigh *);
|
200 |
|
|
extern struct device *rose_dev_first(void);
|
201 |
|
|
extern struct device *rose_dev_get(rose_address *);
|
202 |
|
|
extern struct rose_route *rose_route_free_lci(unsigned int, struct rose_neigh *);
|
203 |
|
|
extern struct device *rose_ax25_dev_get(char *);
|
204 |
|
|
extern struct rose_neigh *rose_get_neigh(rose_address *, unsigned char *, unsigned char *);
|
205 |
|
|
extern int rose_rt_ioctl(unsigned int, void *);
|
206 |
|
|
extern void rose_link_failed(ax25_cb *, int);
|
207 |
|
|
extern int rose_route_frame(struct sk_buff *, ax25_cb *);
|
208 |
|
|
extern int rose_nodes_get_info(char *, char **, off_t, int, int);
|
209 |
|
|
extern int rose_neigh_get_info(char *, char **, off_t, int, int);
|
210 |
|
|
extern int rose_routes_get_info(char *, char **, off_t, int, int);
|
211 |
|
|
extern void rose_rt_free(void);
|
212 |
|
|
|
213 |
|
|
/* rose_subr.c */
|
214 |
|
|
extern void rose_clear_queues(struct sock *);
|
215 |
|
|
extern void rose_frames_acked(struct sock *, unsigned short);
|
216 |
|
|
extern int rose_validate_nr(struct sock *, unsigned short);
|
217 |
|
|
extern void rose_write_internal(struct sock *, int);
|
218 |
|
|
extern int rose_decode(struct sk_buff *, int *, int *, int *, int *, int *);
|
219 |
|
|
extern int rose_parse_facilities(unsigned char *, struct rose_facilities_struct *);
|
220 |
|
|
extern int rose_create_facilities(unsigned char *, rose_cb *);
|
221 |
|
|
|
222 |
|
|
/* rose_timer.c */
|
223 |
|
|
extern void rose_set_timer(struct sock *);
|
224 |
|
|
|
225 |
|
|
/* sysctl_net_rose.c */
|
226 |
|
|
extern void rose_register_sysctl(void);
|
227 |
|
|
extern void rose_unregister_sysctl(void);
|
228 |
|
|
|
229 |
|
|
/* rose_transit.c */
|
230 |
|
|
void rose_transit(struct sk_buff *, rose_tr *, rose_tr *);
|
231 |
|
|
void rose_init_transit(rose_tr *, unsigned int, struct rose_neigh *);
|
232 |
|
|
|
233 |
|
|
#endif
|