1 /* 2 * Declarations of NET/ROM type objects. 3 * 4 * Jonathan Naylor G4KLX 9/4/95 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 /* Define Link State constants. */ 29 enum { 30 NR_STATE_0, 31 NR_STATE_1, 32 NR_STATE_2, 33 NR_STATE_3 34 }; 35 36 #define NR_COND_ACK_PENDING 0x01 37 #define NR_COND_REJECT 0x02 38 #define NR_COND_PEER_RX_BUSY 0x04 39 #define NR_COND_OWN_RX_BUSY 0x08 40 41 #define NR_DEFAULT_T1 (120 * HZ) /* Outstanding frames - 120 seconds */ 42 #define NR_DEFAULT_T2 (5 * HZ) /* Response delay - 5 seconds */ 43 #define NR_DEFAULT_N2 3 /* Number of Retries - 3 */ 44 #define NR_DEFAULT_T4 (180 * HZ) /* Busy Delay - 180 seconds */ 45 #define NR_DEFAULT_IDLE (0 * 60 * HZ) /* No Activity Timeout - none */ 46 #define NR_DEFAULT_WINDOW 4 /* Default Window Size - 4 */ 47 #define NR_DEFAULT_OBS 6 /* Default Obsolescence Count - 6 */ 48 #define NR_DEFAULT_QUAL 10 /* Default Neighbour Quality - 10 */ 49 #define NR_DEFAULT_TTL 16 /* Default Time To Live - 16 */ 50 #define NR_DEFAULT_ROUTING 1 /* Is routing enabled ? */ 51 #define NR_DEFAULT_FAILS 2 /* Link fails until route fails */ 52 53 #define NR_MODULUS 256 54 #define NR_MAX_WINDOW_SIZE 127 /* Maximum Window Allowable - 127 */ 55 #define NR_MAX_PACKET_SIZE 236 /* Maximum Packet Length - 236 */ 56 57 typedef struct { 58 ax25_address user_addr, source_addr, dest_addr; 59 struct net_device *device; 60 unsigned char my_index, my_id; 61 unsigned char your_index, your_id; 62 unsigned char state, condition, bpqext, window; 63 unsigned short vs, vr, va, vl; 64 unsigned char n2, n2count; 65 unsigned long t1, t2, t4, idle; 66 unsigned short fraglen; 67 struct timer_list t1timer; 68 struct timer_list t2timer; 69 struct timer_list t4timer; 70 struct timer_list idletimer; 71 struct sk_buff_head ack_queue; 72 struct sk_buff_head reseq_queue; 73 struct sk_buff_head frag_queue; 74 struct sock *sk; /* Backlink to socket */ 75 } nr_cb; 76 77 struct nr_neigh { 78 struct nr_neigh *next; 79 ax25_address callsign; 80 ax25_digi *digipeat; 81 ax25_cb *ax25; 82 struct net_device *dev; 83 unsigned char quality; 84 unsigned char locked; 85 unsigned short count; 86 unsigned int number; 87 unsigned char failed; 88 }; 89 90 struct nr_route { 91 unsigned char quality; 92 unsigned char obs_count; 93 struct nr_neigh *neighbour; 94 }; 95 96 struct nr_node { 97 struct nr_node *next; 98 ax25_address callsign; 99 char mnemonic[7]; 100 unsigned char which; 101 unsigned char count; 102 struct nr_route routes[3]; 103 }; 104 105 /* af_netrom.c */ 106 extern int sysctl_netrom_default_path_quality; 107 extern int sysctl_netrom_obsolescence_count_initialiser; 108 extern int sysctl_netrom_network_ttl_initialiser; 109 extern int sysctl_netrom_transport_timeout; 110 extern int sysctl_netrom_transport_maximum_tries; 111 extern int sysctl_netrom_transport_acknowledge_delay; 112 extern int sysctl_netrom_transport_busy_delay; 113 extern int sysctl_netrom_transport_requested_window_size; 114 extern int sysctl_netrom_transport_no_activity_timeout; 115 extern int sysctl_netrom_routing_control; 116 extern int sysctl_netrom_link_fails_count; 117 extern int nr_rx_frame(struct sk_buff *, struct net_device *); 118 extern void nr_destroy_socket(struct sock *); 119 120 /* nr_dev.c */ 121 extern int nr_rx_ip(struct sk_buff *, struct net_device *); 122 extern int nr_init(struct net_device *); 123 124 /* nr_in.c */ 125 extern int nr_process_rx_frame(struct sock *, struct sk_buff *); 126 127 /* nr_loopback.c */ 128 extern void nr_loopback_init(void); 129 extern void nr_loopback_clear(void); 130 extern int nr_loopback_queue(struct sk_buff *); 131 132 /* nr_out.c */ 133 extern void nr_output(struct sock *, struct sk_buff *); 134 extern void nr_send_nak_frame(struct sock *); 135 extern void nr_kick(struct sock *); 136 extern void nr_transmit_buffer(struct sock *, struct sk_buff *); 137 extern void nr_establish_data_link(struct sock *); 138 extern void nr_enquiry_response(struct sock *); 139 extern void nr_check_iframes_acked(struct sock *, unsigned short); 140 141 /* nr_route.c */ 142 extern void nr_rt_device_down(struct net_device *); 143 extern struct net_device *nr_dev_first(void); 144 extern struct net_device *nr_dev_get(ax25_address *); 145 extern int nr_rt_ioctl(unsigned int, void *); 146 extern void nr_link_failed(ax25_cb *, int); 147 extern int nr_route_frame(struct sk_buff *, ax25_cb *); 148 extern int nr_nodes_get_info(char *, char **, off_t, int); 149 extern int nr_neigh_get_info(char *, char **, off_t, int); 150 extern void nr_rt_free(void); 151 152 /* nr_subr.c */ 153 extern void nr_clear_queues(struct sock *); 154 extern void nr_frames_acked(struct sock *, unsigned short); 155 extern void nr_requeue_frames(struct sock *); 156 extern int nr_validate_nr(struct sock *, unsigned short); 157 extern int nr_in_rx_window(struct sock *, unsigned short); 158 extern void nr_write_internal(struct sock *, int); 159 extern void nr_transmit_refusal(struct sk_buff *, int); 160 extern void nr_disconnect(struct sock *, int); 161 162 /* nr_timer.c */ 163 extern void nr_start_heartbeat(struct sock *); 164 extern void nr_start_t1timer(struct sock *); 165 extern void nr_start_t2timer(struct sock *); 166 extern void nr_start_t4timer(struct sock *); 167 extern void nr_start_idletimer(struct sock *); 168 extern void nr_stop_heartbeat(struct sock *); 169 extern void nr_stop_t1timer(struct sock *); 170 extern void nr_stop_t2timer(struct sock *); 171 extern void nr_stop_t4timer(struct sock *); 172 extern void nr_stop_idletimer(struct sock *); 173 extern int nr_t1timer_running(struct sock *); 174 175 /* sysctl_net_netrom.c */ 176 extern void nr_register_sysctl(void); 177 extern void nr_unregister_sysctl(void); 178 179 #endif 180