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