Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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