1 |
1275 |
phoenix |
/*
|
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_ADDR_LEN 5
|
12 |
|
|
|
13 |
|
|
#define ROSE_MIN_LEN 3
|
14 |
|
|
|
15 |
|
|
#define ROSE_GFI 0x10
|
16 |
|
|
#define ROSE_Q_BIT 0x80
|
17 |
|
|
#define ROSE_D_BIT 0x40
|
18 |
|
|
#define ROSE_M_BIT 0x10
|
19 |
|
|
|
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
|
27 |
|
|
#define ROSE_RR 0x01
|
28 |
|
|
#define ROSE_RNR 0x05
|
29 |
|
|
#define ROSE_REJ 0x09
|
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
|
38 |
|
|
|
39 |
|
|
/* Define Link State constants. */
|
40 |
|
|
|
41 |
|
|
enum {
|
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 */
|
48 |
|
|
};
|
49 |
|
|
|
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 */
|
60 |
|
|
|
61 |
|
|
#define ROSE_MODULUS 8
|
62 |
|
|
#define ROSE_MAX_PACKET_SIZE 251 /* Maximum packet size */
|
63 |
|
|
|
64 |
|
|
#define ROSE_COND_ACK_PENDING 0x01
|
65 |
|
|
#define ROSE_COND_PEER_RX_BUSY 0x02
|
66 |
|
|
#define ROSE_COND_OWN_RX_BUSY 0x04
|
67 |
|
|
|
68 |
|
|
#define FAC_NATIONAL 0x00
|
69 |
|
|
#define FAC_CCITT 0x0F
|
70 |
|
|
|
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
|
78 |
|
|
|
79 |
|
|
#define FAC_CCITT_DEST_NSAP 0xC9
|
80 |
|
|
#define FAC_CCITT_SRC_NSAP 0xCB
|
81 |
|
|
|
82 |
|
|
struct rose_neigh {
|
83 |
|
|
struct rose_neigh *next;
|
84 |
|
|
ax25_address callsign;
|
85 |
|
|
ax25_digi *digipeat;
|
86 |
|
|
ax25_cb *ax25;
|
87 |
|
|
struct net_device *dev;
|
88 |
|
|
unsigned short count;
|
89 |
|
|
unsigned short use;
|
90 |
|
|
unsigned int number;
|
91 |
|
|
char restarted;
|
92 |
|
|
char dce_mode;
|
93 |
|
|
char loopback;
|
94 |
|
|
struct sk_buff_head queue;
|
95 |
|
|
struct timer_list t0timer;
|
96 |
|
|
struct timer_list ftimer;
|
97 |
|
|
};
|
98 |
|
|
|
99 |
|
|
struct rose_node {
|
100 |
|
|
struct rose_node *next;
|
101 |
|
|
rose_address address;
|
102 |
|
|
unsigned short mask;
|
103 |
|
|
unsigned char count;
|
104 |
|
|
char loopback;
|
105 |
|
|
struct rose_neigh *neighbour[3];
|
106 |
|
|
};
|
107 |
|
|
|
108 |
|
|
struct rose_route {
|
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;
|
114 |
|
|
unsigned int rand;
|
115 |
|
|
};
|
116 |
|
|
|
117 |
|
|
typedef struct {
|
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;
|
130 |
|
|
#ifdef M_BIT
|
131 |
|
|
unsigned short fraglen;
|
132 |
|
|
struct sk_buff_head frag_queue;
|
133 |
|
|
#endif
|
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 */
|
139 |
|
|
} rose_cb;
|
140 |
|
|
|
141 |
|
|
/* af_rose.c */
|
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 *);
|
161 |
|
|
|
162 |
|
|
/* rose_dev.c */
|
163 |
|
|
extern int rose_rx_ip(struct sk_buff *, struct net_device *);
|
164 |
|
|
extern int rose_init(struct net_device *);
|
165 |
|
|
|
166 |
|
|
/* rose_in.c */
|
167 |
|
|
extern int rose_process_rx_frame(struct sock *, struct sk_buff *);
|
168 |
|
|
|
169 |
|
|
/* rose_link.c */
|
170 |
|
|
extern void rose_start_ftimer(struct rose_neigh *);
|
171 |
|
|
extern void rose_start_t0timer(struct rose_neigh *);
|
172 |
|
|
extern void rose_stop_ftimer(struct rose_neigh *);
|
173 |
|
|
extern void rose_stop_t0timer(struct rose_neigh *);
|
174 |
|
|
extern int rose_ftimer_running(struct rose_neigh *);
|
175 |
|
|
extern int rose_t0timer_running(struct rose_neigh *);
|
176 |
|
|
extern void rose_link_rx_restart(struct sk_buff *, struct rose_neigh *, unsigned short);
|
177 |
|
|
extern void rose_transmit_restart_request(struct rose_neigh *);
|
178 |
|
|
extern void rose_transmit_restart_confirmation(struct rose_neigh *);
|
179 |
|
|
extern void rose_transmit_diagnostic(struct rose_neigh *, unsigned char);
|
180 |
|
|
extern void rose_transmit_clear_request(struct rose_neigh *, unsigned int, unsigned char, unsigned char);
|
181 |
|
|
extern void rose_transmit_link(struct sk_buff *, struct rose_neigh *);
|
182 |
|
|
|
183 |
|
|
/* rose_loopback.c */
|
184 |
|
|
extern void rose_loopback_init(void);
|
185 |
|
|
extern void rose_loopback_clear(void);
|
186 |
|
|
extern int rose_loopback_queue(struct sk_buff *, struct rose_neigh *);
|
187 |
|
|
|
188 |
|
|
/* rose_out.c */
|
189 |
|
|
extern void rose_kick(struct sock *);
|
190 |
|
|
extern void rose_enquiry_response(struct sock *);
|
191 |
|
|
|
192 |
|
|
/* rose_route.c */
|
193 |
|
|
extern struct rose_neigh *rose_loopback_neigh;
|
194 |
|
|
|
195 |
|
|
extern int rose_add_loopback_neigh(void);
|
196 |
|
|
extern int rose_add_loopback_node(rose_address *);
|
197 |
|
|
extern void rose_del_loopback_node(rose_address *);
|
198 |
|
|
extern void rose_rt_device_down(struct net_device *);
|
199 |
|
|
extern void rose_link_device_down(struct net_device *);
|
200 |
|
|
extern struct net_device *rose_dev_first(void);
|
201 |
|
|
extern struct net_device *rose_dev_get(rose_address *);
|
202 |
|
|
extern struct rose_route *rose_route_free_lci(unsigned int, struct rose_neigh *);
|
203 |
|
|
extern struct net_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);
|
209 |
|
|
extern int rose_neigh_get_info(char *, char **, off_t, int);
|
210 |
|
|
extern int rose_routes_get_info(char *, char **, off_t, 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 void rose_requeue_frames(struct sock *);
|
217 |
|
|
extern int rose_validate_nr(struct sock *, unsigned short);
|
218 |
|
|
extern void rose_write_internal(struct sock *, int);
|
219 |
|
|
extern int rose_decode(struct sk_buff *, int *, int *, int *, int *, int *);
|
220 |
|
|
extern int rose_parse_facilities(unsigned char *, struct rose_facilities_struct *);
|
221 |
|
|
extern int rose_create_facilities(unsigned char *, rose_cb *);
|
222 |
|
|
extern void rose_disconnect(struct sock *, int, int, int);
|
223 |
|
|
|
224 |
|
|
/* rose_timer.c */
|
225 |
|
|
extern void rose_start_heartbeat(struct sock *);
|
226 |
|
|
extern void rose_start_t1timer(struct sock *);
|
227 |
|
|
extern void rose_start_t2timer(struct sock *);
|
228 |
|
|
extern void rose_start_t3timer(struct sock *);
|
229 |
|
|
extern void rose_start_hbtimer(struct sock *);
|
230 |
|
|
extern void rose_start_idletimer(struct sock *);
|
231 |
|
|
extern void rose_stop_heartbeat(struct sock *);
|
232 |
|
|
extern void rose_stop_timer(struct sock *);
|
233 |
|
|
extern void rose_stop_idletimer(struct sock *);
|
234 |
|
|
|
235 |
|
|
/* sysctl_net_rose.c */
|
236 |
|
|
extern void rose_register_sysctl(void);
|
237 |
|
|
extern void rose_unregister_sysctl(void);
|
238 |
|
|
|
239 |
|
|
#endif
|