Blame view
include/net/x25.h
9.43 KB
b24413180 License cleanup: ... |
1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4c Linux-2.6.12-rc2 |
2 3 4 5 6 7 8 9 10 11 12 13 |
/* * Declarations of X.25 Packet Layer type objects. * * History * nov/17/96 Jonathan Naylor Initial version. * mar/20/00 Daniela Squassoni Disabling/enabling of facilities * negotiation. */ #ifndef _X25_H #define _X25_H #include <linux/x25.h> |
5a0e3ad6a include cleanup: ... |
14 |
#include <linux/slab.h> |
5f9ccf6f3 net, x25: convert... |
15 |
#include <linux/refcount.h> |
1da177e4c Linux-2.6.12-rc2 |
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
#include <net/sock.h> #define X25_ADDR_LEN 16 #define X25_MAX_L2_LEN 18 /* 802.2 LLC */ #define X25_STD_MIN_LEN 3 #define X25_EXT_MIN_LEN 4 #define X25_GFI_SEQ_MASK 0x30 #define X25_GFI_STDSEQ 0x10 #define X25_GFI_EXTSEQ 0x20 #define X25_Q_BIT 0x80 #define X25_D_BIT 0x40 #define X25_STD_M_BIT 0x10 #define X25_EXT_M_BIT 0x01 #define X25_CALL_REQUEST 0x0B #define X25_CALL_ACCEPTED 0x0F #define X25_CLEAR_REQUEST 0x13 #define X25_CLEAR_CONFIRMATION 0x17 #define X25_DATA 0x00 #define X25_INTERRUPT 0x23 #define X25_INTERRUPT_CONFIRMATION 0x27 #define X25_RR 0x01 #define X25_RNR 0x05 #define X25_REJ 0x09 #define X25_RESET_REQUEST 0x1B #define X25_RESET_CONFIRMATION 0x1F #define X25_REGISTRATION_REQUEST 0xF3 #define X25_REGISTRATION_CONFIRMATION 0xF7 #define X25_RESTART_REQUEST 0xFB #define X25_RESTART_CONFIRMATION 0xFF #define X25_DIAGNOSTIC 0xF1 #define X25_ILLEGAL 0xFD /* Define the various conditions that may exist */ #define X25_COND_ACK_PENDING 0x01 #define X25_COND_OWN_RX_BUSY 0x02 #define X25_COND_PEER_RX_BUSY 0x04 /* Define Link State constants. */ enum { X25_STATE_0, /* Ready */ X25_STATE_1, /* Awaiting Call Accepted */ X25_STATE_2, /* Awaiting Clear Confirmation */ X25_STATE_3, /* Data Transfer */ X25_STATE_4 /* Awaiting Reset Confirmation */ }; enum { X25_LINK_STATE_0, X25_LINK_STATE_1, X25_LINK_STATE_2, X25_LINK_STATE_3 }; #define X25_DEFAULT_T20 (180 * HZ) /* Default T20 value */ #define X25_DEFAULT_T21 (200 * HZ) /* Default T21 value */ #define X25_DEFAULT_T22 (180 * HZ) /* Default T22 value */ #define X25_DEFAULT_T23 (180 * HZ) /* Default T23 value */ #define X25_DEFAULT_T2 (3 * HZ) /* Default ack holdback value */ #define X25_DEFAULT_WINDOW_SIZE 2 /* Default Window Size */ #define X25_DEFAULT_PACKET_SIZE X25_PS128 /* Default Packet Size */ #define X25_DEFAULT_THROUGHPUT 0x0A /* Deafult Throughput */ #define X25_DEFAULT_REVERSE 0x00 /* Default Reverse Charging */ #define X25_SMODULUS 8 #define X25_EMODULUS 128 /* * X.25 Facilities constants. */ #define X25_FAC_CLASS_MASK 0xC0 #define X25_FAC_CLASS_A 0x00 #define X25_FAC_CLASS_B 0x40 #define X25_FAC_CLASS_C 0x80 #define X25_FAC_CLASS_D 0xC0 |
ebc3f64b8 [X25]: Fast selec... |
99 |
#define X25_FAC_REVERSE 0x01 /* also fast select */ |
1da177e4c Linux-2.6.12-rc2 |
100 101 102 |
#define X25_FAC_THROUGHPUT 0x02 #define X25_FAC_PACKET_SIZE 0x42 #define X25_FAC_WINDOW_SIZE 0x43 |
a64b7b936 [X25]: allow ITU-... |
103 |
#define X25_MAX_FAC_LEN 60 |
1da177e4c Linux-2.6.12-rc2 |
104 |
#define X25_MAX_CUD_LEN 128 |
a64b7b936 [X25]: allow ITU-... |
105 106 107 108 109 110 111 |
#define X25_FAC_CALLING_AE 0xCB #define X25_FAC_CALLED_AE 0xC9 #define X25_MARKER 0x00 #define X25_DTE_SERVICES 0x0F #define X25_MAX_AE_LEN 40 /* Max num of semi-octets in AE - OSI Nw */ #define X25_MAX_DTE_FACIL_LEN 21 /* Max length of DTE facility params */ |
cb863ffd4 X25: Move qbit fl... |
112 113 |
/* Bitset in x25_sock->flags for misc flags */ #define X25_Q_BIT_FLAG 0 |
b7792e34c X25: Move interru... |
114 |
#define X25_INTERRUPT_FLAG 1 |
37cda7874 X25: Move accept ... |
115 |
#define X25_ACCPT_APPRV_FLAG 2 |
cb863ffd4 X25: Move qbit fl... |
116 |
|
1da177e4c Linux-2.6.12-rc2 |
117 118 119 120 121 122 123 124 125 126 127 128 129 |
/** * struct x25_route - x25 routing entry * @node - entry in x25_list_lock * @address - Start of address range * @sigdigits - Number of sig digits * @dev - More than one for MLP * @refcnt - reference counter */ struct x25_route { struct list_head node; struct x25_address address; unsigned int sigdigits; struct net_device *dev; |
5f9ccf6f3 net, x25: convert... |
130 |
refcount_t refcnt; |
1da177e4c Linux-2.6.12-rc2 |
131 132 133 134 135 136 137 138 139 140 141 |
}; struct x25_neigh { struct list_head node; struct net_device *dev; unsigned int state; unsigned int extended; struct sk_buff_head queue; unsigned long t20; struct timer_list t20timer; unsigned long global_facil_mask; |
5534a51ab net, x25: convert... |
142 |
refcount_t refcnt; |
1da177e4c Linux-2.6.12-rc2 |
143 144 145 146 147 148 |
}; struct x25_sock { struct sock sk; struct x25_address source_addr, dest_addr; struct x25_neigh *neighbour; |
cb65d506c [X25]: Selective ... |
149 |
unsigned int lci, cudmatchlength; |
37cda7874 X25: Move accept ... |
150 |
unsigned char state, condition; |
1da177e4c Linux-2.6.12-rc2 |
151 152 153 |
unsigned short vs, vr, va, vl; unsigned long t2, t21, t22, t23; unsigned short fraglen; |
cb863ffd4 X25: Move qbit fl... |
154 |
unsigned long flags; |
1da177e4c Linux-2.6.12-rc2 |
155 156 157 158 159 160 161 |
struct sk_buff_head ack_queue; struct sk_buff_head fragment_queue; struct sk_buff_head interrupt_in_queue; struct sk_buff_head interrupt_out_queue; struct timer_list timer; struct x25_causediag causediag; struct x25_facilities facilities; |
a64b7b936 [X25]: allow ITU-... |
162 |
struct x25_dte_facilities dte_facilities; |
1da177e4c Linux-2.6.12-rc2 |
163 164 165 |
struct x25_calluserdata calluserdata; unsigned long vc_facil_mask; /* inc_call facilities mask */ }; |
95a9dc439 [X.25]: Add call ... |
166 167 168 169 170 171 172 |
struct x25_forward { struct list_head node; unsigned int lci; struct net_device *dev1; struct net_device *dev2; atomic_t refcnt; }; |
1da177e4c Linux-2.6.12-rc2 |
173 174 175 176 177 178 179 180 181 182 183 |
static inline struct x25_sock *x25_sk(const struct sock *sk) { return (struct x25_sock *)sk; } /* af_x25.c */ extern int sysctl_x25_restart_request_timeout; extern int sysctl_x25_call_request_timeout; extern int sysctl_x25_reset_request_timeout; extern int sysctl_x25_clear_request_timeout; extern int sysctl_x25_ack_holdback_timeout; |
39e21c0d3 [X.25]: Adds /pro... |
184 |
extern int sysctl_x25_forward; |
1da177e4c Linux-2.6.12-rc2 |
185 |
|
5db50ee6e x25.h: Remove ext... |
186 187 188 189 190 191 192 193 194 195 |
int x25_parse_address_block(struct sk_buff *skb, struct x25_address *called_addr, struct x25_address *calling_addr); int x25_addr_ntoa(unsigned char *, struct x25_address *, struct x25_address *); int x25_addr_aton(unsigned char *, struct x25_address *, struct x25_address *); struct sock *x25_find_socket(unsigned int, struct x25_neigh *); void x25_destroy_socket_from_timer(struct sock *); int x25_rx_call_request(struct sk_buff *, struct x25_neigh *, unsigned int); void x25_kill_by_neigh(struct x25_neigh *); |
1da177e4c Linux-2.6.12-rc2 |
196 197 |
/* x25_dev.c */ |
5db50ee6e x25.h: Remove ext... |
198 199 200 201 202 |
void x25_send_frame(struct sk_buff *, struct x25_neigh *); int x25_lapb_receive_frame(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *); void x25_establish_link(struct x25_neigh *); void x25_terminate_link(struct x25_neigh *); |
1da177e4c Linux-2.6.12-rc2 |
203 204 |
/* x25_facilities.c */ |
5db50ee6e x25.h: Remove ext... |
205 206 207 208 209 210 211 212 |
int x25_parse_facilities(struct sk_buff *, struct x25_facilities *, struct x25_dte_facilities *, unsigned long *); int x25_create_facilities(unsigned char *, struct x25_facilities *, struct x25_dte_facilities *, unsigned long); int x25_negotiate_facilities(struct sk_buff *, struct sock *, struct x25_facilities *, struct x25_dte_facilities *); void x25_limit_facilities(struct x25_facilities *, struct x25_neigh *); |
1da177e4c Linux-2.6.12-rc2 |
213 |
|
95a9dc439 [X.25]: Add call ... |
214 |
/* x25_forward.c */ |
5db50ee6e x25.h: Remove ext... |
215 216 217 218 219 |
void x25_clear_forward_by_lci(unsigned int lci); void x25_clear_forward_by_dev(struct net_device *); int x25_forward_data(int, struct x25_neigh *, struct sk_buff *); int x25_forward_call(struct x25_address *, struct x25_neigh *, struct sk_buff *, int); |
95a9dc439 [X.25]: Add call ... |
220 |
|
1da177e4c Linux-2.6.12-rc2 |
221 |
/* x25_in.c */ |
5db50ee6e x25.h: Remove ext... |
222 223 |
int x25_process_rx_frame(struct sock *, struct sk_buff *); int x25_backlog_rcv(struct sock *, struct sk_buff *); |
1da177e4c Linux-2.6.12-rc2 |
224 225 |
/* x25_link.c */ |
5db50ee6e x25.h: Remove ext... |
226 227 228 229 230 231 232 233 234 235 236 |
void x25_link_control(struct sk_buff *, struct x25_neigh *, unsigned short); void x25_link_device_up(struct net_device *); void x25_link_device_down(struct net_device *); void x25_link_established(struct x25_neigh *); void x25_link_terminated(struct x25_neigh *); void x25_transmit_clear_request(struct x25_neigh *, unsigned int, unsigned char); void x25_transmit_link(struct sk_buff *, struct x25_neigh *); int x25_subscr_ioctl(unsigned int, void __user *); struct x25_neigh *x25_get_neigh(struct net_device *); void x25_link_free(void); |
1da177e4c Linux-2.6.12-rc2 |
237 238 239 240 |
/* x25_neigh.c */ static __inline__ void x25_neigh_hold(struct x25_neigh *nb) { |
5534a51ab net, x25: convert... |
241 |
refcount_inc(&nb->refcnt); |
1da177e4c Linux-2.6.12-rc2 |
242 243 244 245 |
} static __inline__ void x25_neigh_put(struct x25_neigh *nb) { |
5534a51ab net, x25: convert... |
246 |
if (refcount_dec_and_test(&nb->refcnt)) |
1da177e4c Linux-2.6.12-rc2 |
247 248 249 250 |
kfree(nb); } /* x25_out.c */ |
5db50ee6e x25.h: Remove ext... |
251 252 253 |
int x25_output(struct sock *, struct sk_buff *); void x25_kick(struct sock *); void x25_enquiry_response(struct sock *); |
1da177e4c Linux-2.6.12-rc2 |
254 255 |
/* x25_route.c */ |
5db50ee6e x25.h: Remove ext... |
256 257 258 259 260 |
struct x25_route *x25_get_route(struct x25_address *addr); struct net_device *x25_dev_get(char *); void x25_route_device_down(struct net_device *dev); int x25_route_ioctl(unsigned int, void __user *); void x25_route_free(void); |
1da177e4c Linux-2.6.12-rc2 |
261 262 263 |
static __inline__ void x25_route_hold(struct x25_route *rt) { |
5f9ccf6f3 net, x25: convert... |
264 |
refcount_inc(&rt->refcnt); |
1da177e4c Linux-2.6.12-rc2 |
265 266 267 268 |
} static __inline__ void x25_route_put(struct x25_route *rt) { |
5f9ccf6f3 net, x25: convert... |
269 |
if (refcount_dec_and_test(&rt->refcnt)) |
1da177e4c Linux-2.6.12-rc2 |
270 271 272 273 |
kfree(rt); } /* x25_subr.c */ |
5db50ee6e x25.h: Remove ext... |
274 275 276 277 278 279 280 281 |
void x25_clear_queues(struct sock *); void x25_frames_acked(struct sock *, unsigned short); void x25_requeue_frames(struct sock *); int x25_validate_nr(struct sock *, unsigned short); void x25_write_internal(struct sock *, int); int x25_decode(struct sock *, struct sk_buff *, int *, int *, int *, int *, int *); void x25_disconnect(struct sock *, int, unsigned char, unsigned char); |
1da177e4c Linux-2.6.12-rc2 |
282 283 |
/* x25_timer.c */ |
5db50ee6e x25.h: Remove ext... |
284 285 286 287 288 289 290 291 292 293 |
void x25_init_timers(struct sock *sk); void x25_start_heartbeat(struct sock *); void x25_start_t2timer(struct sock *); void x25_start_t21timer(struct sock *); void x25_start_t22timer(struct sock *); void x25_start_t23timer(struct sock *); void x25_stop_heartbeat(struct sock *); void x25_stop_timer(struct sock *); unsigned long x25_display_timer(struct sock *); void x25_check_rbuf(struct sock *); |
1da177e4c Linux-2.6.12-rc2 |
294 295 |
/* sysctl_net_x25.c */ |
2f5517aef X25: Move SYSCTL ... |
296 |
#ifdef CONFIG_SYSCTL |
64df6d525 net: x25: fix one... |
297 |
int x25_register_sysctl(void); |
5db50ee6e x25.h: Remove ext... |
298 |
void x25_unregister_sysctl(void); |
2f5517aef X25: Move SYSCTL ... |
299 |
#else |
64df6d525 net: x25: fix one... |
300 |
static inline int x25_register_sysctl(void) { return 0; }; |
2f5517aef X25: Move SYSCTL ... |
301 302 |
static inline void x25_unregister_sysctl(void) {}; #endif /* CONFIG_SYSCTL */ |
1da177e4c Linux-2.6.12-rc2 |
303 |
struct x25_skb_cb { |
95c961747 net: cleanup unsi... |
304 |
unsigned int flags; |
1da177e4c Linux-2.6.12-rc2 |
305 306 307 308 309 310 311 |
}; #define X25_SKB_CB(s) ((struct x25_skb_cb *) ((s)->cb)) extern struct hlist_head x25_list; extern rwlock_t x25_list_lock; extern struct list_head x25_route_list; extern rwlock_t x25_route_list_lock; |
95a9dc439 [X.25]: Add call ... |
312 313 |
extern struct list_head x25_forward_list; extern rwlock_t x25_forward_list_lock; |
5595a1a59 X25 remove bkl in... |
314 315 |
extern struct list_head x25_neigh_list; extern rwlock_t x25_neigh_list_lock; |
1da177e4c Linux-2.6.12-rc2 |
316 |
|
5db50ee6e x25.h: Remove ext... |
317 318 |
int x25_proc_init(void); void x25_proc_exit(void); |
1da177e4c Linux-2.6.12-rc2 |
319 |
#endif |