wanrouter.h 21 KB

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