1
2
3
4
5
6
7 #ifndef _NETROM_H
8 #define _NETROM_H
9 #include <linux/netrom.h>
10
11 #define NR_T1CLAMPLO (1 * PR_SLOWHZ)
12 #define NR_T1CLAMPHI (300 * PR_SLOWHZ)
13
14 #define NR_NETWORK_LEN 15
15 #define NR_TRANSPORT_LEN 5
16
17 #define NR_PROTO_IP 0x0C
18
19 #define NR_PROTOEXT 0x00
20 #define NR_CONNREQ 0x01
21 #define NR_CONNACK 0x02
22 #define NR_DISCREQ 0x03
23 #define NR_DISCACK 0x04
24 #define NR_INFO 0x05
25 #define NR_INFOACK 0x06
26
27 #define NR_CHOKE_FLAG 0x80
28 #define NR_NAK_FLAG 0x40
29 #define NR_MORE_FLAG 0x20
30
31
32
33 #define NR_STATE_0 0
34 #define NR_STATE_1 1
35 #define NR_STATE_2 2
36 #define NR_STATE_3 3
37
38 #define NR_DEFAULT_T1 (120 * PR_SLOWHZ)
39 #define NR_DEFAULT_T2 (5 * PR_SLOWHZ)
40 #define NR_DEFAULT_N2 3
41 #define NR_DEFAULT_T4 (180 * PR_SLOWHZ)
42 #define NR_DEFAULT_WINDOW 4
43 #define NR_DEFAULT_OBS 6
44 #define NR_DEFAULT_QUAL 10
45 #define NR_DEFAULT_TTL 16
46 #define NR_MODULUS 256
47 #define NR_MAX_WINDOW_SIZE 127
48
49 typedef struct {
50 ax25_address user_addr, source_addr, dest_addr;
51 struct device *device;
52 unsigned char my_index, my_id;
53 unsigned char your_index, your_id;
54 unsigned char state, condition, bpqext, hdrincl;
55 unsigned short vs, vr, va, vl;
56 unsigned char n2, n2count;
57 unsigned short t1, t2, rtt;
58 unsigned short t1timer, t2timer, t4timer;
59 unsigned short fraglen;
60 struct sk_buff_head ack_queue;
61 struct sk_buff_head reseq_queue;
62 struct sk_buff_head frag_queue;
63 struct sock *sk;
64 } nr_cb;
65
66 struct nr_route {
67 unsigned char quality;
68 unsigned char obs_count;
69 unsigned short neighbour;
70 };
71
72 struct nr_node {
73 struct nr_node *next;
74 ax25_address callsign;
75 char mnemonic[7];
76 unsigned char which;
77 unsigned char count;
78 struct nr_route routes[3];
79 };
80
81 struct nr_neigh {
82 struct nr_neigh *next;
83 ax25_address callsign;
84 ax25_digi *digipeat;
85 struct device *dev;
86 unsigned char quality;
87 unsigned char locked;
88 unsigned short count;
89 unsigned short number;
90 };
91
92
93 extern struct nr_parms_struct nr_default;
94 extern int nr_rx_frame(struct sk_buff *, struct device *);
95 extern void nr_destroy_socket(struct sock *);
96
97
98 extern int nr_rx_ip(struct sk_buff *, struct device *);
99 extern int nr_init(struct device *);
100
101 #include <net/nrcall.h>
102
103
104 extern int nr_process_rx_frame(struct sock *, struct sk_buff *);
105
106
107 extern void nr_output(struct sock *, struct sk_buff *);
108 extern void nr_send_nak_frame(struct sock *);
109 extern void nr_kick(struct sock *);
110 extern void nr_transmit_buffer(struct sock *, struct sk_buff *);
111 extern void nr_establish_data_link(struct sock *);
112 extern void nr_enquiry_response(struct sock *);
113 extern void nr_check_iframes_acked(struct sock *, unsigned short);
114
115
116 extern void nr_rt_device_down(struct device *);
117 extern struct device *nr_dev_first(void);
118 extern struct device *nr_dev_get(ax25_address *);
119 extern int nr_rt_ioctl(unsigned int, void *);
120 extern void nr_link_failed(ax25_address *, struct device *);
121 extern int nr_route_frame(struct sk_buff *, ax25_cb *);
122 extern int nr_nodes_get_info(char *, char **, off_t, int, int);
123 extern int nr_neigh_get_info(char *, char **, off_t, int, int);
124
125
126 extern void nr_clear_queues(struct sock *);
127 extern void nr_frames_acked(struct sock *, unsigned short);
128 extern void nr_requeue_frames(struct sock *);
129 extern int nr_validate_nr(struct sock *, unsigned short);
130 extern int nr_in_rx_window(struct sock *, unsigned short);
131 extern void nr_write_internal(struct sock *, int);
132 extern void nr_transmit_dm(struct sk_buff *);
133 extern unsigned short nr_calculate_t1(struct sock *);
134 extern void nr_calculate_rtt(struct sock *);
135
136
137 extern void nr_set_timer(struct sock *);
138
139 #endif