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 #define NR_DEFAULT_PACLEN 236
49
50 typedef struct {
51 ax25_address user_addr, source_addr, dest_addr;
52 struct device *device;
53 unsigned char my_index, my_id;
54 unsigned char your_index, your_id;
55 unsigned char state, condition, bpqext, hdrincl;
56 unsigned short vs, vr, va, vl;
57 unsigned char n2, n2count;
58 unsigned short t1, t2, rtt;
59 unsigned short t1timer, t2timer, t4timer;
60 unsigned short fraglen, paclen;
61 struct sk_buff_head ack_queue;
62 struct sk_buff_head reseq_queue;
63 struct sk_buff_head frag_queue;
64 struct sock *sk;
65 } nr_cb;
66
67 struct nr_route {
68 unsigned char quality;
69 unsigned char obs_count;
70 unsigned short neighbour;
71 };
72
73 struct nr_node {
74 struct nr_node *next;
75 ax25_address callsign;
76 char mnemonic[7];
77 unsigned char which;
78 unsigned char count;
79 struct nr_route routes[3];
80 };
81
82 struct nr_neigh {
83 struct nr_neigh *next;
84 ax25_address callsign;
85 ax25_digi *digipeat;
86 struct device *dev;
87 unsigned char quality;
88 unsigned char locked;
89 unsigned short count;
90 unsigned short number;
91 };
92
93
94 extern struct nr_parms_struct nr_default;
95 extern int nr_rx_frame(struct sk_buff *, struct device *);
96 extern void nr_destroy_socket(struct sock *);
97
98
99 extern int nr_rx_ip(struct sk_buff *, struct device *);
100 extern int nr_init(struct device *);
101
102 #include <net/nrcall.h>
103
104
105 extern int nr_process_rx_frame(struct sock *, struct sk_buff *);
106
107
108 extern void nr_output(struct sock *, struct sk_buff *);
109 extern void nr_send_nak_frame(struct sock *);
110 extern void nr_kick(struct sock *);
111 extern void nr_transmit_buffer(struct sock *, struct sk_buff *);
112 extern void nr_establish_data_link(struct sock *);
113 extern void nr_enquiry_response(struct sock *);
114 extern void nr_check_iframes_acked(struct sock *, unsigned short);
115
116
117 extern void nr_rt_device_down(struct device *);
118 extern struct device *nr_dev_first(void);
119 extern struct device *nr_dev_get(ax25_address *);
120 extern int nr_rt_ioctl(unsigned int, void *);
121 extern void nr_link_failed(ax25_address *, struct device *);
122 extern int nr_route_frame(struct sk_buff *, ax25_cb *);
123 extern int nr_nodes_get_info(char *, char **, off_t, int, int);
124 extern int nr_neigh_get_info(char *, char **, off_t, int, int);
125
126
127 extern void nr_clear_queues(struct sock *);
128 extern void nr_frames_acked(struct sock *, unsigned short);
129 extern void nr_requeue_frames(struct sock *);
130 extern int nr_validate_nr(struct sock *, unsigned short);
131 extern int nr_in_rx_window(struct sock *, unsigned short);
132 extern void nr_write_internal(struct sock *, int);
133 extern void nr_transmit_dm(struct sk_buff *);
134 extern unsigned short nr_calculate_t1(struct sock *);
135 extern void nr_calculate_rtt(struct sock *);
136
137
138 extern void nr_set_timer(struct sock *);
139
140 #endif