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.
6 * Author: Nenad Corbic <ncorbic@sangoma.com>
8 * Additions: Arnaldo Melo
10 * Copyright: (c) 1995-2000 Sangoma Technologies Inc.
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
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)
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 *****************************************************************************/
49 #include <uapi/linux/wanrouter.h>
51 /****** Kernel Interface ****************************************************/
53 #include <linux/fs.h> /* support for device drivers */
54 #include <linux/proc_fs.h> /* proc filesystem pragmatics */
55 #include <linux/netdevice.h> /* support for network drivers */
56 #include <linux/spinlock.h> /* Support for SMP Locking */
58 /*----------------------------------------------------------------------------
59 * WAN device data space.
62 unsigned magic; /* magic number */
63 char* name; /* -> WAN device name (ASCIIZ) */
64 void* private; /* -> driver private data */
65 unsigned config_id; /* Configuration ID */
66 /****** hardware configuration ******/
67 unsigned ioport; /* adapter I/O port base #1 */
68 char S514_cpu_no[1]; /* PCI CPU Number */
69 unsigned char S514_slot_no; /* PCI Slot Number */
70 unsigned long maddr; /* dual-port memory address */
71 unsigned msize; /* dual-port memory size */
72 int irq; /* interrupt request level */
73 int dma; /* DMA request level */
74 unsigned bps; /* data transfer rate */
75 unsigned mtu; /* max physical transmit unit size */
76 unsigned udp_port; /* UDP port for management */
77 unsigned char ttl; /* Time To Live for UDP security */
78 unsigned enable_tx_int; /* Transmit Interrupt enabled or not */
79 char interface; /* RS-232/V.35, etc. */
80 char clocking; /* external/internal */
81 char line_coding; /* NRZ/NRZI/FM0/FM1, etc. */
82 char station; /* DTE/DCE, primary/secondary, etc. */
83 char connection; /* permanent/switched/on-demand */
84 char signalling; /* Signalling RS232 or V35 */
85 char read_mode; /* read mode: Polling or interrupt */
86 char new_if_cnt; /* Number of interfaces per wanpipe */
87 char del_if_cnt; /* Number of times del_if() gets called */
88 unsigned char piggyback; /* Piggibacking a port */
89 unsigned hw_opt[4]; /* other hardware options */
90 /****** status and statistics *******/
91 char state; /* device state */
92 char api_status; /* device api status */
93 struct net_device_stats stats; /* interface statistics */
94 unsigned reserved[16]; /* reserved for future use */
95 unsigned long critical; /* critical section flag */
96 spinlock_t lock; /* Support for SMP Locking */
98 /****** device management methods ***/
99 int (*setup) (struct wan_device *wandev, wandev_conf_t *conf);
100 int (*shutdown) (struct wan_device *wandev);
101 int (*update) (struct wan_device *wandev);
102 int (*ioctl) (struct wan_device *wandev, unsigned cmd,
104 int (*new_if)(struct wan_device *wandev, struct net_device *dev,
106 int (*del_if)(struct wan_device *wandev, struct net_device *dev);
107 /****** maintained by the router ****/
108 struct wan_device* next; /* -> next device */
109 struct net_device* dev; /* list of network interfaces */
110 unsigned ndev; /* number of interfaces */
111 struct proc_dir_entry *dent; /* proc filesystem entry */
114 /* Public functions available for device drivers */
115 extern int register_wan_device(struct wan_device *wandev);
116 extern int unregister_wan_device(char *name);
118 /* Proc interface functions. These must not be called by the drivers! */
119 extern int wanrouter_proc_init(void);
120 extern void wanrouter_proc_cleanup(void);
121 extern int wanrouter_proc_add(struct wan_device *wandev);
122 extern int wanrouter_proc_delete(struct wan_device *wandev);
123 extern long wanrouter_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
126 /* list of registered devices */
127 extern struct wan_device *wanrouter_router_devlist;
129 #endif /* _ROUTER_H */