at v2.6.13 22 kB view raw
1/***************************************************************************** 2* wanrouter.h Definitions for the WAN Multiprotocol Router Module. 3* This module provides API and common services for WAN Link 4* Drivers and is completely hardware-independent. 5* 6* Author: Nenad Corbic <ncorbic@sangoma.com> 7* Gideon Hack 8* Additions: Arnaldo Melo 9* 10* Copyright: (c) 1995-2000 Sangoma Technologies Inc. 11* 12* This program is free software; you can redistribute it and/or 13* modify it under the terms of the GNU General Public License 14* as published by the Free Software Foundation; either version 15* 2 of the License, or (at your option) any later version. 16* ============================================================================ 17* Jul 21, 2000 Nenad Corbic Added WAN_FT1_READY State 18* Feb 24, 2000 Nenad Corbic Added support for socket based x25api 19* Jan 28, 2000 Nenad Corbic Added support for the ASYNC protocol. 20* Oct 04, 1999 Nenad Corbic Updated for 2.1.0 release 21* Jun 02, 1999 Gideon Hack Added support for the S514 adapter. 22* May 23, 1999 Arnaldo Melo Added local_addr to wanif_conf_t 23* WAN_DISCONNECTING state added 24* Jul 20, 1998 David Fong Added Inverse ARP options to 'wanif_conf_t' 25* Jun 12, 1998 David Fong Added Cisco HDLC support. 26* Dec 16, 1997 Jaspreet Singh Moved 'enable_IPX' and 'network_number' to 27* 'wanif_conf_t' 28* Dec 05, 1997 Jaspreet Singh Added 'pap', 'chap' to 'wanif_conf_t' 29* Added 'authenticator' to 'wan_ppp_conf_t' 30* Nov 06, 1997 Jaspreet Singh Changed Router Driver version to 1.1 from 1.0 31* Oct 20, 1997 Jaspreet Singh Added 'cir','bc','be' and 'mc' to 'wanif_conf_t' 32* Added 'enable_IPX' and 'network_number' to 33* 'wan_device_t'. Also added defines for 34* UDP PACKET TYPE, Interrupt test, critical values 35* for RACE conditions. 36* Oct 05, 1997 Jaspreet Singh Added 'dlci_num' and 'dlci[100]' to 37* 'wan_fr_conf_t' to configure a list of dlci(s) 38* for a NODE 39* Jul 07, 1997 Jaspreet Singh Added 'ttl' to 'wandev_conf_t' & 'wan_device_t' 40* May 29, 1997 Jaspreet Singh Added 'tx_int_enabled' to 'wan_device_t' 41* May 21, 1997 Jaspreet Singh Added 'udp_port' to 'wan_device_t' 42* Apr 25, 1997 Farhan Thawar Added 'udp_port' to 'wandev_conf_t' 43* Jan 16, 1997 Gene Kozin router_devlist made public 44* Jan 02, 1997 Gene Kozin Initial version (based on wanpipe.h). 45*****************************************************************************/ 46 47#include <linux/spinlock.h> /* Support for SMP Locking */ 48 49#ifndef _ROUTER_H 50#define _ROUTER_H 51 52#define ROUTER_NAME "wanrouter" /* in case we ever change it */ 53#define ROUTER_VERSION 1 /* version number */ 54#define ROUTER_RELEASE 1 /* release (minor version) number */ 55#define ROUTER_IOCTL 'W' /* for IOCTL calls */ 56#define ROUTER_MAGIC 0x524D4157L /* signature: 'WANR' reversed */ 57 58/* IOCTL codes for /proc/router/<device> entries (up to 255) */ 59enum router_ioctls 60{ 61 ROUTER_SETUP = ROUTER_IOCTL<<8, /* configure device */ 62 ROUTER_DOWN, /* shut down device */ 63 ROUTER_STAT, /* get device status */ 64 ROUTER_IFNEW, /* add interface */ 65 ROUTER_IFDEL, /* delete interface */ 66 ROUTER_IFSTAT, /* get interface status */ 67 ROUTER_USER = (ROUTER_IOCTL<<8)+16, /* driver-specific calls */ 68 ROUTER_USER_MAX = (ROUTER_IOCTL<<8)+31 69}; 70 71/* identifiers for displaying proc file data for dual port adapters */ 72#define PROC_DATA_PORT_0 0x8000 /* the data is for port 0 */ 73#define PROC_DATA_PORT_1 0x8001 /* the data is for port 1 */ 74 75/* NLPID for packet encapsulation (ISO/IEC TR 9577) */ 76#define NLPID_IP 0xCC /* Internet Protocol Datagram */ 77#define NLPID_SNAP 0x80 /* IEEE Subnetwork Access Protocol */ 78#define NLPID_CLNP 0x81 /* ISO/IEC 8473 */ 79#define NLPID_ESIS 0x82 /* ISO/IEC 9542 */ 80#define NLPID_ISIS 0x83 /* ISO/IEC ISIS */ 81#define NLPID_Q933 0x08 /* CCITT Q.933 */ 82 83/* Miscellaneous */ 84#define WAN_IFNAME_SZ 15 /* max length of the interface name */ 85#define WAN_DRVNAME_SZ 15 /* max length of the link driver name */ 86#define WAN_ADDRESS_SZ 31 /* max length of the WAN media address */ 87#define USED_BY_FIELD 8 /* max length of the used by field */ 88 89/* Defines for UDP PACKET TYPE */ 90#define UDP_PTPIPE_TYPE 0x01 91#define UDP_FPIPE_TYPE 0x02 92#define UDP_CPIPE_TYPE 0x03 93#define UDP_DRVSTATS_TYPE 0x04 94#define UDP_INVALID_TYPE 0x05 95 96/* Command return code */ 97#define CMD_OK 0 /* normal firmware return code */ 98#define CMD_TIMEOUT 0xFF /* firmware command timed out */ 99 100/* UDP Packet Management */ 101#define UDP_PKT_FRM_STACK 0x00 102#define UDP_PKT_FRM_NETWORK 0x01 103 104/* Maximum interrupt test counter */ 105#define MAX_INTR_TEST_COUNTER 100 106 107/* Critical Values for RACE conditions*/ 108#define CRITICAL_IN_ISR 0xA1 109#define CRITICAL_INTR_HANDLED 0xB1 110 111/****** Data Types **********************************************************/ 112 113/*---------------------------------------------------------------------------- 114 * X.25-specific link-level configuration. 115 */ 116typedef struct wan_x25_conf 117{ 118 unsigned lo_pvc; /* lowest permanent circuit number */ 119 unsigned hi_pvc; /* highest permanent circuit number */ 120 unsigned lo_svc; /* lowest switched circuit number */ 121 unsigned hi_svc; /* highest switched circuit number */ 122 unsigned hdlc_window; /* HDLC window size (1..7) */ 123 unsigned pkt_window; /* X.25 packet window size (1..7) */ 124 unsigned t1; /* HDLC timer T1, sec (1..30) */ 125 unsigned t2; /* HDLC timer T2, sec (0..29) */ 126 unsigned t4; /* HDLC supervisory frame timer = T4 * T1 */ 127 unsigned n2; /* HDLC retransmission limit (1..30) */ 128 unsigned t10_t20; /* X.25 RESTART timeout, sec (1..255) */ 129 unsigned t11_t21; /* X.25 CALL timeout, sec (1..255) */ 130 unsigned t12_t22; /* X.25 RESET timeout, sec (1..255) */ 131 unsigned t13_t23; /* X.25 CLEAR timeout, sec (1..255) */ 132 unsigned t16_t26; /* X.25 INTERRUPT timeout, sec (1..255) */ 133 unsigned t28; /* X.25 REGISTRATION timeout, sec (1..255) */ 134 unsigned r10_r20; /* RESTART retransmission limit (0..250) */ 135 unsigned r12_r22; /* RESET retransmission limit (0..250) */ 136 unsigned r13_r23; /* CLEAR retransmission limit (0..250) */ 137 unsigned ccitt_compat; /* compatibility mode: 1988/1984/1980 */ 138 unsigned x25_conf_opt; /* User defined x25 config optoins */ 139 unsigned char LAPB_hdlc_only; /* Run in HDLC only mode */ 140 unsigned char logging; /* Control connection logging */ 141 unsigned char oob_on_modem; /* Whether to send modem status to the user app */ 142} wan_x25_conf_t; 143 144/*---------------------------------------------------------------------------- 145 * Frame relay specific link-level configuration. 146 */ 147typedef struct wan_fr_conf 148{ 149 unsigned signalling; /* local in-channel signalling type */ 150 unsigned t391; /* link integrity verification timer */ 151 unsigned t392; /* polling verification timer */ 152 unsigned n391; /* full status polling cycle counter */ 153 unsigned n392; /* error threshold counter */ 154 unsigned n393; /* monitored events counter */ 155 unsigned dlci_num; /* number of DLCs (access node) */ 156 unsigned dlci[100]; /* List of all DLCIs */ 157} wan_fr_conf_t; 158 159/*---------------------------------------------------------------------------- 160 * PPP-specific link-level configuration. 161 */ 162typedef struct wan_ppp_conf 163{ 164 unsigned restart_tmr; /* restart timer */ 165 unsigned auth_rsrt_tmr; /* authentication timer */ 166 unsigned auth_wait_tmr; /* authentication timer */ 167 unsigned mdm_fail_tmr; /* modem failure timer */ 168 unsigned dtr_drop_tmr; /* DTR drop timer */ 169 unsigned connect_tmout; /* connection timeout */ 170 unsigned conf_retry; /* max. retry */ 171 unsigned term_retry; /* max. retry */ 172 unsigned fail_retry; /* max. retry */ 173 unsigned auth_retry; /* max. retry */ 174 unsigned auth_options; /* authentication opt. */ 175 unsigned ip_options; /* IP options */ 176 char authenticator; /* AUTHENTICATOR or not */ 177 char ip_mode; /* Static/Host/Peer */ 178} wan_ppp_conf_t; 179 180/*---------------------------------------------------------------------------- 181 * CHDLC-specific link-level configuration. 182 */ 183typedef struct wan_chdlc_conf 184{ 185 unsigned char ignore_dcd; /* Protocol options: */ 186 unsigned char ignore_cts; /* Ignore these to determine */ 187 unsigned char ignore_keepalive; /* link status (Yes or No) */ 188 unsigned char hdlc_streaming; /* hdlc_streaming mode (Y/N) */ 189 unsigned char receive_only; /* no transmit buffering (Y/N) */ 190 unsigned keepalive_tx_tmr; /* transmit keepalive timer */ 191 unsigned keepalive_rx_tmr; /* receive keepalive timer */ 192 unsigned keepalive_err_margin; /* keepalive_error_tolerance */ 193 unsigned slarp_timer; /* SLARP request timer */ 194} wan_chdlc_conf_t; 195 196 197/*---------------------------------------------------------------------------- 198 * WAN device configuration. Passed to ROUTER_SETUP IOCTL. 199 */ 200typedef struct wandev_conf 201{ 202 unsigned magic; /* magic number (for verification) */ 203 unsigned config_id; /* configuration structure identifier */ 204 /****** hardware configuration ******/ 205 unsigned ioport; /* adapter I/O port base */ 206 unsigned long maddr; /* dual-port memory address */ 207 unsigned msize; /* dual-port memory size */ 208 int irq; /* interrupt request level */ 209 int dma; /* DMA request level */ 210 char S514_CPU_no[1]; /* S514 PCI adapter CPU number ('A' or 'B') */ 211 unsigned PCI_slot_no; /* S514 PCI adapter slot number */ 212 char auto_pci_cfg; /* S515 PCI automatic slot detection */ 213 char comm_port; /* Communication Port (PRI=0, SEC=1) */ 214 unsigned bps; /* data transfer rate */ 215 unsigned mtu; /* maximum transmit unit size */ 216 unsigned udp_port; /* UDP port for management */ 217 unsigned char ttl; /* Time To Live for UDP security */ 218 unsigned char ft1; /* FT1 Configurator Option */ 219 char interface; /* RS-232/V.35, etc. */ 220 char clocking; /* external/internal */ 221 char line_coding; /* NRZ/NRZI/FM0/FM1, etc. */ 222 char station; /* DTE/DCE, primary/secondary, etc. */ 223 char connection; /* permanent/switched/on-demand */ 224 char read_mode; /* read mode: Polling or interrupt */ 225 char receive_only; /* disable tx buffers */ 226 char tty; /* Create a fake tty device */ 227 unsigned tty_major; /* Major number for wanpipe tty device */ 228 unsigned tty_minor; /* Minor number for wanpipe tty device */ 229 unsigned tty_mode; /* TTY operation mode SYNC or ASYNC */ 230 char backup; /* Backup Mode */ 231 unsigned hw_opt[4]; /* other hardware options */ 232 unsigned reserved[4]; 233 /****** arbitrary data ***************/ 234 unsigned data_size; /* data buffer size */ 235 void* data; /* data buffer, e.g. firmware */ 236 union /****** protocol-specific ************/ 237 { 238 wan_x25_conf_t x25; /* X.25 configuration */ 239 wan_ppp_conf_t ppp; /* PPP configuration */ 240 wan_fr_conf_t fr; /* frame relay configuration */ 241 wan_chdlc_conf_t chdlc; /* Cisco HDLC configuration */ 242 } u; 243} wandev_conf_t; 244 245/* 'config_id' definitions */ 246#define WANCONFIG_X25 101 /* X.25 link */ 247#define WANCONFIG_FR 102 /* frame relay link */ 248#define WANCONFIG_PPP 103 /* synchronous PPP link */ 249#define WANCONFIG_CHDLC 104 /* Cisco HDLC Link */ 250#define WANCONFIG_BSC 105 /* BiSync Streaming */ 251#define WANCONFIG_HDLC 106 /* HDLC Support */ 252#define WANCONFIG_MPPP 107 /* Multi Port PPP over RAW CHDLC */ 253 254/* 255 * Configuration options defines. 256 */ 257/* general options */ 258#define WANOPT_OFF 0 259#define WANOPT_ON 1 260#define WANOPT_NO 0 261#define WANOPT_YES 1 262 263/* intercace options */ 264#define WANOPT_RS232 0 265#define WANOPT_V35 1 266 267/* data encoding options */ 268#define WANOPT_NRZ 0 269#define WANOPT_NRZI 1 270#define WANOPT_FM0 2 271#define WANOPT_FM1 3 272 273/* link type options */ 274#define WANOPT_POINTTOPOINT 0 /* RTS always active */ 275#define WANOPT_MULTIDROP 1 /* RTS is active when transmitting */ 276 277/* clocking options */ 278#define WANOPT_EXTERNAL 0 279#define WANOPT_INTERNAL 1 280 281/* station options */ 282#define WANOPT_DTE 0 283#define WANOPT_DCE 1 284#define WANOPT_CPE 0 285#define WANOPT_NODE 1 286#define WANOPT_SECONDARY 0 287#define WANOPT_PRIMARY 1 288 289/* connection options */ 290#define WANOPT_PERMANENT 0 /* DTR always active */ 291#define WANOPT_SWITCHED 1 /* use DTR to setup link (dial-up) */ 292#define WANOPT_ONDEMAND 2 /* activate DTR only before sending */ 293 294/* frame relay in-channel signalling */ 295#define WANOPT_FR_ANSI 1 /* ANSI T1.617 Annex D */ 296#define WANOPT_FR_Q933 2 /* ITU Q.933A */ 297#define WANOPT_FR_LMI 3 /* LMI */ 298 299/* PPP IP Mode Options */ 300#define WANOPT_PPP_STATIC 0 301#define WANOPT_PPP_HOST 1 302#define WANOPT_PPP_PEER 2 303 304/* ASY Mode Options */ 305#define WANOPT_ONE 1 306#define WANOPT_TWO 2 307#define WANOPT_ONE_AND_HALF 3 308 309#define WANOPT_NONE 0 310#define WANOPT_ODD 1 311#define WANOPT_EVEN 2 312 313/* CHDLC Protocol Options */ 314/* DF Commmented out for now. 315 316#define WANOPT_CHDLC_NO_DCD IGNORE_DCD_FOR_LINK_STAT 317#define WANOPT_CHDLC_NO_CTS IGNORE_CTS_FOR_LINK_STAT 318#define WANOPT_CHDLC_NO_KEEPALIVE IGNORE_KPALV_FOR_LINK_STAT 319*/ 320 321/* Port options */ 322#define WANOPT_PRI 0 323#define WANOPT_SEC 1 324/* read mode */ 325#define WANOPT_INTR 0 326#define WANOPT_POLL 1 327 328 329#define WANOPT_TTY_SYNC 0 330#define WANOPT_TTY_ASYNC 1 331/*---------------------------------------------------------------------------- 332 * WAN Link Status Info (for ROUTER_STAT IOCTL). 333 */ 334typedef struct wandev_stat 335{ 336 unsigned state; /* link state */ 337 unsigned ndev; /* number of configured interfaces */ 338 339 /* link/interface configuration */ 340 unsigned connection; /* permanent/switched/on-demand */ 341 unsigned media_type; /* Frame relay/PPP/X.25/SDLC, etc. */ 342 unsigned mtu; /* max. transmit unit for this device */ 343 344 /* physical level statistics */ 345 unsigned modem_status; /* modem status */ 346 unsigned rx_frames; /* received frames count */ 347 unsigned rx_overruns; /* receiver overrun error count */ 348 unsigned rx_crc_err; /* receive CRC error count */ 349 unsigned rx_aborts; /* received aborted frames count */ 350 unsigned rx_bad_length; /* unexpetedly long/short frames count */ 351 unsigned rx_dropped; /* frames discarded at device level */ 352 unsigned tx_frames; /* transmitted frames count */ 353 unsigned tx_underruns; /* aborted transmissions (underruns) count */ 354 unsigned tx_timeouts; /* transmission timeouts */ 355 unsigned tx_rejects; /* other transmit errors */ 356 357 /* media level statistics */ 358 unsigned rx_bad_format; /* frames with invalid format */ 359 unsigned rx_bad_addr; /* frames with invalid media address */ 360 unsigned tx_retries; /* frames re-transmitted */ 361 unsigned reserved[16]; /* reserved for future use */ 362} wandev_stat_t; 363 364/* 'state' defines */ 365enum wan_states 366{ 367 WAN_UNCONFIGURED, /* link/channel is not configured */ 368 WAN_DISCONNECTED, /* link/channel is disconnected */ 369 WAN_CONNECTING, /* connection is in progress */ 370 WAN_CONNECTED, /* link/channel is operational */ 371 WAN_LIMIT, /* for verification only */ 372 WAN_DUALPORT, /* for Dual Port cards */ 373 WAN_DISCONNECTING, 374 WAN_FT1_READY /* FT1 Configurator Ready */ 375}; 376 377enum { 378 WAN_LOCAL_IP, 379 WAN_POINTOPOINT_IP, 380 WAN_NETMASK_IP, 381 WAN_BROADCAST_IP 382}; 383 384/* 'modem_status' masks */ 385#define WAN_MODEM_CTS 0x0001 /* CTS line active */ 386#define WAN_MODEM_DCD 0x0002 /* DCD line active */ 387#define WAN_MODEM_DTR 0x0010 /* DTR line active */ 388#define WAN_MODEM_RTS 0x0020 /* RTS line active */ 389 390/*---------------------------------------------------------------------------- 391 * WAN interface (logical channel) configuration (for ROUTER_IFNEW IOCTL). 392 */ 393typedef struct wanif_conf 394{ 395 unsigned magic; /* magic number */ 396 unsigned config_id; /* configuration identifier */ 397 char name[WAN_IFNAME_SZ+1]; /* interface name, ASCIIZ */ 398 char addr[WAN_ADDRESS_SZ+1]; /* media address, ASCIIZ */ 399 char usedby[USED_BY_FIELD]; /* used by API or WANPIPE */ 400 unsigned idle_timeout; /* sec, before disconnecting */ 401 unsigned hold_timeout; /* sec, before re-connecting */ 402 unsigned cir; /* Committed Information Rate fwd,bwd*/ 403 unsigned bc; /* Committed Burst Size fwd, bwd */ 404 unsigned be; /* Excess Burst Size fwd, bwd */ 405 unsigned char enable_IPX; /* Enable or Disable IPX */ 406 unsigned char inarp; /* Send Inverse ARP requests Y/N */ 407 unsigned inarp_interval; /* sec, between InARP requests */ 408 unsigned long network_number; /* Network Number for IPX */ 409 char mc; /* Multicast on or off */ 410 char local_addr[WAN_ADDRESS_SZ+1];/* local media address, ASCIIZ */ 411 unsigned char port; /* board port */ 412 unsigned char protocol; /* prococol used in this channel (TCPOX25 or X25) */ 413 char pap; /* PAP enabled or disabled */ 414 char chap; /* CHAP enabled or disabled */ 415 unsigned char userid[511]; /* List of User Id */ 416 unsigned char passwd[511]; /* List of passwords */ 417 unsigned char sysname[31]; /* Name of the system */ 418 unsigned char ignore_dcd; /* Protocol options: */ 419 unsigned char ignore_cts; /* Ignore these to determine */ 420 unsigned char ignore_keepalive; /* link status (Yes or No) */ 421 unsigned char hdlc_streaming; /* Hdlc streaming mode (Y/N) */ 422 unsigned keepalive_tx_tmr; /* transmit keepalive timer */ 423 unsigned keepalive_rx_tmr; /* receive keepalive timer */ 424 unsigned keepalive_err_margin; /* keepalive_error_tolerance */ 425 unsigned slarp_timer; /* SLARP request timer */ 426 unsigned char ttl; /* Time To Live for UDP security */ 427 char interface; /* RS-232/V.35, etc. */ 428 char clocking; /* external/internal */ 429 unsigned bps; /* data transfer rate */ 430 unsigned mtu; /* maximum transmit unit size */ 431 unsigned char if_down; /* brind down interface when disconnected */ 432 unsigned char gateway; /* Is this interface a gateway */ 433 unsigned char true_if_encoding; /* Set the dev->type to true board protocol */ 434 435 unsigned char asy_data_trans; /* async API options */ 436 unsigned char rts_hs_for_receive; /* async Protocol options */ 437 unsigned char xon_xoff_hs_for_receive; 438 unsigned char xon_xoff_hs_for_transmit; 439 unsigned char dcd_hs_for_transmit; 440 unsigned char cts_hs_for_transmit; 441 unsigned char async_mode; 442 unsigned tx_bits_per_char; 443 unsigned rx_bits_per_char; 444 unsigned stop_bits; 445 unsigned char parity; 446 unsigned break_timer; 447 unsigned inter_char_timer; 448 unsigned rx_complete_length; 449 unsigned xon_char; 450 unsigned xoff_char; 451 unsigned char receive_only; /* no transmit buffering (Y/N) */ 452} wanif_conf_t; 453 454#ifdef __KERNEL__ 455/****** Kernel Interface ****************************************************/ 456 457#include <linux/fs.h> /* support for device drivers */ 458#include <linux/proc_fs.h> /* proc filesystem pragmatics */ 459#include <linux/netdevice.h> /* support for network drivers */ 460/*---------------------------------------------------------------------------- 461 * WAN device data space. 462 */ 463struct wan_device { 464 unsigned magic; /* magic number */ 465 char* name; /* -> WAN device name (ASCIIZ) */ 466 void* private; /* -> driver private data */ 467 unsigned config_id; /* Configuration ID */ 468 /****** hardware configuration ******/ 469 unsigned ioport; /* adapter I/O port base #1 */ 470 char S514_cpu_no[1]; /* PCI CPU Number */ 471 unsigned char S514_slot_no; /* PCI Slot Number */ 472 unsigned long maddr; /* dual-port memory address */ 473 unsigned msize; /* dual-port memory size */ 474 int irq; /* interrupt request level */ 475 int dma; /* DMA request level */ 476 unsigned bps; /* data transfer rate */ 477 unsigned mtu; /* max physical transmit unit size */ 478 unsigned udp_port; /* UDP port for management */ 479 unsigned char ttl; /* Time To Live for UDP security */ 480 unsigned enable_tx_int; /* Transmit Interrupt enabled or not */ 481 char interface; /* RS-232/V.35, etc. */ 482 char clocking; /* external/internal */ 483 char line_coding; /* NRZ/NRZI/FM0/FM1, etc. */ 484 char station; /* DTE/DCE, primary/secondary, etc. */ 485 char connection; /* permanent/switched/on-demand */ 486 char signalling; /* Signalling RS232 or V35 */ 487 char read_mode; /* read mode: Polling or interrupt */ 488 char new_if_cnt; /* Number of interfaces per wanpipe */ 489 char del_if_cnt; /* Number of times del_if() gets called */ 490 unsigned char piggyback; /* Piggibacking a port */ 491 unsigned hw_opt[4]; /* other hardware options */ 492 /****** status and statistics *******/ 493 char state; /* device state */ 494 char api_status; /* device api status */ 495 struct net_device_stats stats; /* interface statistics */ 496 unsigned reserved[16]; /* reserved for future use */ 497 unsigned long critical; /* critical section flag */ 498 spinlock_t lock; /* Support for SMP Locking */ 499 500 /****** device management methods ***/ 501 int (*setup) (struct wan_device *wandev, wandev_conf_t *conf); 502 int (*shutdown) (struct wan_device *wandev); 503 int (*update) (struct wan_device *wandev); 504 int (*ioctl) (struct wan_device *wandev, unsigned cmd, 505 unsigned long arg); 506 int (*new_if)(struct wan_device *wandev, struct net_device *dev, 507 wanif_conf_t *conf); 508 int (*del_if)(struct wan_device *wandev, struct net_device *dev); 509 /****** maintained by the router ****/ 510 struct wan_device* next; /* -> next device */ 511 struct net_device* dev; /* list of network interfaces */ 512 unsigned ndev; /* number of interfaces */ 513 struct proc_dir_entry *dent; /* proc filesystem entry */ 514}; 515 516/* Public functions available for device drivers */ 517extern int register_wan_device(struct wan_device *wandev); 518extern int unregister_wan_device(char *name); 519__be16 wanrouter_type_trans(struct sk_buff *skb, struct net_device *dev); 520int wanrouter_encapsulate(struct sk_buff *skb, struct net_device *dev, 521 unsigned short type); 522 523/* Proc interface functions. These must not be called by the drivers! */ 524extern int wanrouter_proc_init(void); 525extern void wanrouter_proc_cleanup(void); 526extern int wanrouter_proc_add(struct wan_device *wandev); 527extern int wanrouter_proc_delete(struct wan_device *wandev); 528extern int wanrouter_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); 529 530extern void lock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags); 531extern void unlock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags); 532 533 534 535/* Public Data */ 536/* list of registered devices */ 537extern struct wan_device *wanrouter_router_devlist; 538 539#endif /* __KERNEL__ */ 540#endif /* _ROUTER_H */