2 * Declarations of Rose type objects.
4 * Jonathan Naylor G4KLX 25/8/96
9 #include <linux/rose.h>
11 #define ROSE_ADDR_LEN 5
13 #define ROSE_MIN_LEN 3
16 #define ROSE_Q_BIT 0x80
17 #define ROSE_D_BIT 0x40
18 #define ROSE_M_BIT 0x10
20 #define ROSE_CALL_REQUEST 0x0B
21 #define ROSE_CALL_ACCEPTED 0x0F
22 #define ROSE_CLEAR_REQUEST 0x13
23 #define ROSE_CLEAR_CONFIRMATION 0x17
24 #define ROSE_DATA 0x00
25 #define ROSE_INTERRUPT 0x23
26 #define ROSE_INTERRUPT_CONFIRMATION 0x27
30 #define ROSE_RESET_REQUEST 0x1B
31 #define ROSE_RESET_CONFIRMATION 0x1F
32 #define ROSE_REGISTRATION_REQUEST 0xF3
33 #define ROSE_REGISTRATION_CONFIRMATION 0xF7
34 #define ROSE_RESTART_REQUEST 0xFB
35 #define ROSE_RESTART_CONFIRMATION 0xFF
36 #define ROSE_DIAGNOSTIC 0xF1
37 #define ROSE_ILLEGAL 0xFD
39 /* Define Link State constants. */
42 ROSE_STATE_0
, /* Ready */
43 ROSE_STATE_1
, /* Awaiting Call Accepted */
44 ROSE_STATE_2
, /* Awaiting Clear Confirmation */
45 ROSE_STATE_3
, /* Data Transfer */
46 ROSE_STATE_4
, /* Awaiting Reset Confirmation */
47 ROSE_STATE_5
/* Deferred Call Acceptance */
50 #define ROSE_DEFAULT_T0 (180 * HZ) /* Default T10 T20 value */
51 #define ROSE_DEFAULT_T1 (200 * HZ) /* Default T11 T21 value */
52 #define ROSE_DEFAULT_T2 (180 * HZ) /* Default T12 T22 value */
53 #define ROSE_DEFAULT_T3 (180 * HZ) /* Default T13 T23 value */
54 #define ROSE_DEFAULT_HB (5 * HZ) /* Default Holdback value */
55 #define ROSE_DEFAULT_IDLE (0 * 60 * HZ) /* No Activity Timeout - none */
56 #define ROSE_DEFAULT_ROUTING 1 /* Default routing flag */
57 #define ROSE_DEFAULT_FAIL_TIMEOUT (120 * HZ) /* 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 size */
61 #define ROSE_MODULUS 8
62 #define ROSE_MAX_PACKET_SIZE 251 /* Maximum packet size */
64 #define ROSE_COND_ACK_PENDING 0x01
65 #define ROSE_COND_PEER_RX_BUSY 0x02
66 #define ROSE_COND_OWN_RX_BUSY 0x04
68 #define FAC_NATIONAL 0x00
69 #define FAC_CCITT 0x0F
71 #define FAC_NATIONAL_RAND 0x7F
72 #define FAC_NATIONAL_FLAGS 0x3F
73 #define FAC_NATIONAL_DEST_DIGI 0xE9
74 #define FAC_NATIONAL_SRC_DIGI 0xEB
75 #define FAC_NATIONAL_FAIL_CALL 0xED
76 #define FAC_NATIONAL_FAIL_ADD 0xEE
77 #define FAC_NATIONAL_DIGIS 0xEF
79 #define FAC_CCITT_DEST_NSAP 0xC9
80 #define FAC_CCITT_SRC_NSAP 0xCB
83 struct rose_neigh
*next
;
84 ax25_address callsign
;
87 struct net_device
*dev
;
94 struct sk_buff_head queue
;
95 struct timer_list t0timer
;
96 struct timer_list ftimer
;
100 struct rose_node
*next
;
101 rose_address address
;
105 struct rose_neigh
*neighbour
[3];
109 struct rose_route
*next
;
110 unsigned int lci1
, lci2
;
111 rose_address src_addr
, dest_addr
;
112 ax25_address src_call
, dest_call
;
113 struct rose_neigh
*neigh1
, *neigh2
;
118 rose_address source_addr
, dest_addr
;
119 ax25_address source_call
, dest_call
;
120 unsigned char source_ndigis
, dest_ndigis
;
121 ax25_address source_digis
[ROSE_MAX_DIGIS
];
122 ax25_address dest_digis
[ROSE_MAX_DIGIS
];
123 struct rose_neigh
*neighbour
;
124 struct net_device
*device
;
125 unsigned int lci
, rand
;
126 unsigned char state
, condition
, qbitincl
, defer
;
127 unsigned char cause
, diagnostic
;
128 unsigned short vs
, vr
, va
, vl
;
129 unsigned long t1
, t2
, t3
, hb
, idle
;
131 unsigned short fraglen
;
132 struct sk_buff_head frag_queue
;
134 struct sk_buff_head ack_queue
;
135 struct rose_facilities_struct facilities
;
136 struct timer_list timer
;
137 struct timer_list idletimer
;
138 struct sock
*sk
; /* Backlink to socket */
142 extern ax25_address rose_callsign
;
143 extern int sysctl_rose_restart_request_timeout
;
144 extern int sysctl_rose_call_request_timeout
;
145 extern int sysctl_rose_reset_request_timeout
;
146 extern int sysctl_rose_clear_request_timeout
;
147 extern int sysctl_rose_no_activity_timeout
;
148 extern int sysctl_rose_ack_hold_back_timeout
;
149 extern int sysctl_rose_routing_control
;
150 extern int sysctl_rose_link_fail_timeout
;
151 extern int sysctl_rose_maximum_vcs
;
152 extern int sysctl_rose_window_size
;
153 extern int rosecmp(rose_address
*, rose_address
*);
154 extern int rosecmpm(rose_address
*, rose_address
*, unsigned short);
155 extern char *rose2asc(rose_address
*);
156 extern struct sock
*rose_find_socket(unsigned int, struct rose_neigh
*);
157 extern void rose_kill_by_neigh(struct rose_neigh
*);
158 extern unsigned int rose_new_lci(struct rose_neigh
*);
159 extern int rose_rx_call_request(struct sk_buff
*, struct net_device
*, struct rose_neigh
*, unsigned int);
160 extern void rose_destroy_socket(struct sock
*);
163 extern int rose_rx_ip(struct sk_buff
*, struct net_device
*);
164 extern int rose_init(struct net_device
*);
166 #include <net/rosecall.h>
169 extern int rose_process_rx_frame(struct sock
*, struct sk_buff
*);
172 extern void rose_start_ftimer(struct rose_neigh
*);
173 extern void rose_start_t0timer(struct rose_neigh
*);
174 extern void rose_stop_ftimer(struct rose_neigh
*);
175 extern void rose_stop_t0timer(struct rose_neigh
*);
176 extern int rose_ftimer_running(struct rose_neigh
*);
177 extern int rose_t0timer_running(struct rose_neigh
*);
178 extern void rose_link_rx_restart(struct sk_buff
*, struct rose_neigh
*, unsigned short);
179 extern void rose_transmit_restart_request(struct rose_neigh
*);
180 extern void rose_transmit_restart_confirmation(struct rose_neigh
*);
181 extern void rose_transmit_diagnostic(struct rose_neigh
*, unsigned char);
182 extern void rose_transmit_clear_request(struct rose_neigh
*, unsigned int, unsigned char, unsigned char);
183 extern void rose_transmit_link(struct sk_buff
*, struct rose_neigh
*);
185 /* rose_loopback.c */
186 extern void rose_loopback_init(void);
187 extern void rose_loopback_clear(void);
188 extern int rose_loopback_queue(struct sk_buff
*, struct rose_neigh
*);
191 extern void rose_kick(struct sock
*);
192 extern void rose_enquiry_response(struct sock
*);
195 extern struct rose_neigh
*rose_loopback_neigh
;
197 extern int rose_add_loopback_neigh(void);
198 extern int rose_add_loopback_node(rose_address
*);
199 extern void rose_del_loopback_node(rose_address
*);
200 extern void rose_rt_device_down(struct net_device
*);
201 extern void rose_link_device_down(struct net_device
*);
202 extern struct net_device
*rose_dev_first(void);
203 extern struct net_device
*rose_dev_get(rose_address
*);
204 extern struct rose_route
*rose_route_free_lci(unsigned int, struct rose_neigh
*);
205 extern struct net_device
*rose_ax25_dev_get(char *);
206 extern struct rose_neigh
*rose_get_neigh(rose_address
*, unsigned char *, unsigned char *);
207 extern int rose_rt_ioctl(unsigned int, void *);
208 extern void rose_link_failed(ax25_cb
*, int);
209 extern int rose_route_frame(struct sk_buff
*, ax25_cb
*);
210 extern int rose_nodes_get_info(char *, char **, off_t
, int, int);
211 extern int rose_neigh_get_info(char *, char **, off_t
, int, int);
212 extern int rose_routes_get_info(char *, char **, off_t
, int, int);
213 extern void rose_rt_free(void);
216 extern void rose_clear_queues(struct sock
*);
217 extern void rose_frames_acked(struct sock
*, unsigned short);
218 extern void rose_requeue_frames(struct sock
*);
219 extern int rose_validate_nr(struct sock
*, unsigned short);
220 extern void rose_write_internal(struct sock
*, int);
221 extern int rose_decode(struct sk_buff
*, int *, int *, int *, int *, int *);
222 extern int rose_parse_facilities(unsigned char *, struct rose_facilities_struct
*);
223 extern int rose_create_facilities(unsigned char *, rose_cb
*);
224 extern void rose_disconnect(struct sock
*, int, int, int);
227 extern void rose_start_heartbeat(struct sock
*);
228 extern void rose_start_t1timer(struct sock
*);
229 extern void rose_start_t2timer(struct sock
*);
230 extern void rose_start_t3timer(struct sock
*);
231 extern void rose_start_hbtimer(struct sock
*);
232 extern void rose_start_idletimer(struct sock
*);
233 extern void rose_stop_heartbeat(struct sock
*);
234 extern void rose_stop_timer(struct sock
*);
235 extern void rose_stop_idletimer(struct sock
*);
237 /* sysctl_net_rose.c */
238 extern void rose_register_sysctl(void);
239 extern void rose_unregister_sysctl(void);