source: svn/trunk/newcon3bcm2_21bu/toolchain/mips-linux-uclibc/include/linux/wanrouter.h @ 2

Last change on this file since 2 was 2, checked in by phkim, 11 years ago

1.phkim

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