~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/linux/isdn.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* $Id: isdn.h,v 1.111 2000/11/25 17:01:02 kai Exp $
  2 
  3  * Main header for the Linux ISDN subsystem (linklevel).
  4  *
  5  * Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de)
  6  * Copyright 1995,96    by Thinking Objects Software GmbH Wuerzburg
  7  * Copyright 1995,96    by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de)
  8  * 
  9  * This program is free software; you can redistribute it and/or modify
 10  * it under the terms of the GNU General Public License as published by
 11  * the Free Software Foundation; either version 2, or (at your option)
 12  * any later version.
 13  *
 14  * This program is distributed in the hope that it will be useful,
 15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 17  * GNU General Public License for more details.
 18  *
 19  * You should have received a copy of the GNU General Public License
 20  * along with this program; if not, write to the Free Software
 21  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
 22  *
 23  */
 24 
 25 #ifndef isdn_h
 26 #define isdn_h
 27 
 28 #include <linux/config.h>
 29 #include <linux/ioctl.h>
 30 
 31 #define ISDN_TTY_MAJOR    43
 32 #define ISDN_TTYAUX_MAJOR 44
 33 #define ISDN_MAJOR        45
 34 
 35 /* The minor-devicenumbers for Channel 0 and 1 are used as arguments for
 36  * physical Channel-Mapping, so they MUST NOT be changed without changing
 37  * the correspondent code in isdn.c
 38  */
 39 
 40 #ifdef CONFIG_COBALT_MICRO_SERVER
 41 /* Save memory */
 42 #define ISDN_MAX_DRIVERS    2
 43 #define ISDN_MAX_CHANNELS   8
 44 #else
 45 #define ISDN_MAX_DRIVERS    32
 46 #define ISDN_MAX_CHANNELS   64
 47 #endif
 48 #define ISDN_MINOR_B        0
 49 #define ISDN_MINOR_BMAX     (ISDN_MAX_CHANNELS-1)
 50 #define ISDN_MINOR_CTRL     64
 51 #define ISDN_MINOR_CTRLMAX  (64 + (ISDN_MAX_CHANNELS-1))
 52 #define ISDN_MINOR_PPP      128
 53 #define ISDN_MINOR_PPPMAX   (128 + (ISDN_MAX_CHANNELS-1))
 54 #define ISDN_MINOR_STATUS   255
 55 
 56 #undef CONFIG_ISDN_WITH_ABC_CALLB
 57 #undef CONFIG_ISDN_WITH_ABC_UDP_CHECK
 58 #undef CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP
 59 #undef CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL
 60 #undef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
 61 #undef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
 62 #undef CONFIG_ISDN_WITH_ABC_IPV4_TCP_KEEPALIVE
 63 #undef CONFIG_ISDN_WITH_ABC_IPV4_DYNADDR
 64 #undef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER
 65 #undef CONFIG_ISDN_WITH_ABC_ICALL_BIND
 66 #undef CONFIG_ISDN_WITH_ABC_CH_EXTINUSE
 67 #undef CONFIG_ISDN_WITH_ABC_CONN_ERROR
 68 #undef CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS
 69 #undef CONFIG_ISDN_WITH_ABC_IPTABLES_NETFILTER
 70 
 71 
 72 /* New ioctl-codes */
 73 #define IIOCNETAIF  _IO('I',1)
 74 #define IIOCNETDIF  _IO('I',2)
 75 #define IIOCNETSCF  _IO('I',3)
 76 #define IIOCNETGCF  _IO('I',4)
 77 #define IIOCNETANM  _IO('I',5)
 78 #define IIOCNETDNM  _IO('I',6)
 79 #define IIOCNETGNM  _IO('I',7)
 80 #define IIOCGETSET  _IO('I',8) /* no longer supported */
 81 #define IIOCSETSET  _IO('I',9) /* no longer supported */
 82 #define IIOCSETVER  _IO('I',10)
 83 #define IIOCNETHUP  _IO('I',11)
 84 #define IIOCSETGST  _IO('I',12)
 85 #define IIOCSETBRJ  _IO('I',13)
 86 #define IIOCSIGPRF  _IO('I',14)
 87 #define IIOCGETPRF  _IO('I',15)
 88 #define IIOCSETPRF  _IO('I',16)
 89 #define IIOCGETMAP  _IO('I',17)
 90 #define IIOCSETMAP  _IO('I',18)
 91 #define IIOCNETASL  _IO('I',19)
 92 #define IIOCNETDIL  _IO('I',20)
 93 #define IIOCGETCPS  _IO('I',21)
 94 #define IIOCGETDVR  _IO('I',22)
 95 #define IIOCNETLCR  _IO('I',23) /* dwabc ioctl for LCR from isdnlog */
 96 #define IIOCNETDWRSET  _IO('I',24) /* dwabc ioctl to reset abc-values to default on a net-interface */
 97 
 98 #define IIOCNETALN  _IO('I',32)
 99 #define IIOCNETDLN  _IO('I',33)
100 
101 #define IIOCNETGPN  _IO('I',34)
102 
103 #define IIOCDBGVAR  _IO('I',127)
104 
105 #define IIOCDRVCTL  _IO('I',128)
106 
107 /* Packet encapsulations for net-interfaces */
108 #define ISDN_NET_ENCAP_ETHER      0
109 #define ISDN_NET_ENCAP_RAWIP      1
110 #define ISDN_NET_ENCAP_IPTYP      2
111 #define ISDN_NET_ENCAP_CISCOHDLC  3 /* Without SLARP and keepalive */
112 #define ISDN_NET_ENCAP_SYNCPPP    4
113 #define ISDN_NET_ENCAP_UIHDLC     5
114 #define ISDN_NET_ENCAP_CISCOHDLCK 6 /* With SLARP and keepalive    */
115 #define ISDN_NET_ENCAP_X25IFACE   7 /* Documentation/networking/x25-iface.txt*/
116 #define ISDN_NET_ENCAP_MAX_ENCAP  ISDN_NET_ENCAP_X25IFACE
117 /* Facility which currently uses an ISDN-channel */
118 #define ISDN_USAGE_NONE       0
119 #define ISDN_USAGE_RAW        1
120 #define ISDN_USAGE_MODEM      2
121 #define ISDN_USAGE_NET        3
122 #define ISDN_USAGE_VOICE      4
123 #define ISDN_USAGE_FAX        5
124 #define ISDN_USAGE_MASK       7 /* Mask to get plain usage */
125 #define ISDN_USAGE_DISABLED  32 /* This bit is set, if channel is disabled */
126 #define ISDN_USAGE_EXCLUSIVE 64 /* This bit is set, if channel is exclusive */
127 #define ISDN_USAGE_OUTGOING 128 /* This bit is set, if channel is outgoing  */
128 
129 #define ISDN_MODEM_NUMREG    24        /* Number of Modem-Registers        */
130 #define ISDN_LMSNLEN         255 /* Length of tty's Listen-MSN string */
131 #define ISDN_CMSGLEN         50  /* Length of CONNECT-Message to add for Modem */
132 
133 #define ISDN_MSNLEN          32
134 #define NET_DV 0x06  /* Data version for isdn_net_ioctl_cfg   */
135 #define TTY_DV 0x06  /* Data version for iprofd etc.          */
136 
137 #define INF_DV 0x01  /* Data version for /dev/isdninfo        */
138 
139 typedef struct {
140   char drvid[25];
141   unsigned long arg;
142 } isdn_ioctl_struct;
143 
144 typedef struct {
145   unsigned long isdndev;
146   unsigned long atmodem[ISDN_MAX_CHANNELS];
147   unsigned long info[ISDN_MAX_CHANNELS];
148 } debugvar_addr;
149 
150 typedef struct {
151   char name[10];
152   char phone[ISDN_MSNLEN];
153   int  outgoing;
154 } isdn_net_ioctl_phone;
155 
156 typedef struct {
157   char name[10];     /* Name of interface                     */
158   char master[10];   /* Name of Master for Bundling           */
159   char slave[10];    /* Name of Slave for Bundling            */
160   char eaz[256];     /* EAZ/MSN                               */
161   char drvid[25];    /* DriverId for Bindings                 */
162   int  onhtime;      /* Hangup-Timeout                        */
163   int  charge;       /* Charge-Units                          */
164   int  l2_proto;     /* Layer-2 protocol                      */
165   int  l3_proto;     /* Layer-3 protocol                      */
166   int  p_encap;      /* Encapsulation                         */
167   int  exclusive;    /* Channel, if bound exclusive           */
168   int  dialmax;      /* Dial Retry-Counter                    */
169   int  slavedelay;   /* Delay until slave starts up           */
170   int  cbdelay;      /* Delay before Callback                 */
171   int  chargehup;    /* Flag: Charge-Hangup                   */
172   int  ihup;         /* Flag: Hangup-Timeout on incoming line */
173   int  secure;       /* Flag: Secure                          */
174   int  callback;     /* Flag: Callback                        */
175   int  cbhup;        /* Flag: Reject Call before Callback     */
176   int  pppbind;      /* ippp device for bindings              */
177   int  chargeint;    /* Use fixed charge interval length      */
178   int  triggercps;   /* BogoCPS needed for triggering slave   */
179   int  dialtimeout;  /* Dial-Timeout                          */
180   int  dialwait;     /* Time to wait after failed dial        */
181   int  dialmode;     /* Flag: off / on / auto                 */
182 } isdn_net_ioctl_cfg;
183 
184 #define ISDN_NET_DIALMODE_MASK 0xC0  /* bits for status                   */
185 #define  ISDN_NET_DM_OFF        0x00    /* this interface is stopped      */
186 #define  ISDN_NET_DM_MANUAL     0x40    /* this interface is on (manual)  */
187 #define  ISDN_NET_DM_AUTO       0x80    /* this interface is autodial     */
188 #define ISDN_NET_DIALMODE(x) ((&(x))->flags & ISDN_NET_DIALMODE_MASK)
189 
190 #ifdef __KERNEL__
191 
192 #include <linux/errno.h>
193 #include <linux/fs.h>
194 #include <linux/major.h>
195 #include <asm/segment.h>
196 #include <asm/io.h>
197 #include <linux/kernel.h>
198 #include <linux/signal.h>
199 #include <linux/malloc.h>
200 #include <linux/timer.h>
201 #include <linux/wait.h>
202 #include <linux/tty.h>
203 #include <linux/tty_flip.h>
204 #include <linux/serial_reg.h>
205 #include <linux/fcntl.h>
206 #include <linux/types.h>
207 #include <linux/interrupt.h>
208 #include <linux/ip.h>
209 #include <linux/in.h>
210 #include <linux/netdevice.h>
211 #include <linux/etherdevice.h>
212 #include <linux/skbuff.h>
213 #include <linux/tcp.h>
214 
215 #ifdef CONFIG_ISDN_PPP
216 
217 #ifdef CONFIG_ISDN_PPP_VJ
218 #  include <net/slhc_vj.h>
219 #endif
220 
221 #include <linux/ppp_defs.h>
222 #include <linux/if_ppp.h>
223 #include <linux/if_pppvar.h>
224 
225 #include <linux/isdn_ppp.h>
226 #endif
227 
228 #ifdef CONFIG_ISDN_X25
229 #  include <linux/concap.h>
230 #endif
231 
232 #ifdef CONFIG_DEVFS_FS
233 #  include <linux/devfs_fs_kernel.h>
234 #endif
235 
236 #include <linux/isdnif.h>
237 
238 #define ISDN_DRVIOCTL_MASK       0x7f  /* Mask for Device-ioctl */
239 
240 /* Until now unused */
241 #define ISDN_SERVICE_VOICE 1
242 #define ISDN_SERVICE_AB    1<<1 
243 #define ISDN_SERVICE_X21   1<<2
244 #define ISDN_SERVICE_G4    1<<3
245 #define ISDN_SERVICE_BTX   1<<4
246 #define ISDN_SERVICE_DFUE  1<<5
247 #define ISDN_SERVICE_X25   1<<6
248 #define ISDN_SERVICE_TTX   1<<7
249 #define ISDN_SERVICE_MIXED 1<<8
250 #define ISDN_SERVICE_FW    1<<9
251 #define ISDN_SERVICE_GTEL  1<<10
252 #define ISDN_SERVICE_BTXN  1<<11
253 #define ISDN_SERVICE_BTEL  1<<12
254 
255 /* Macros checking plain usage */
256 #define USG_NONE(x)         ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NONE)
257 #define USG_RAW(x)          ((x & ISDN_USAGE_MASK)==ISDN_USAGE_RAW)
258 #define USG_MODEM(x)        ((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM)
259 #define USG_VOICE(x)        ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE)
260 #define USG_NET(x)          ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NET)
261 #define USG_FAX(x)          ((x & ISDN_USAGE_MASK)==ISDN_USAGE_FAX)
262 #define USG_OUTGOING(x)     ((x & ISDN_USAGE_OUTGOING)==ISDN_USAGE_OUTGOING)
263 #define USG_MODEMORVOICE(x) (((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM) || \
264                              ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE)     )
265 
266 /* Timer-delays and scheduling-flags */
267 #define ISDN_TIMER_RES         3                         /* Main Timer-Resolution   */
268 #define ISDN_TIMER_02SEC       (HZ/(ISDN_TIMER_RES+1)/5) /* Slow-Timer1 .2 sec      */
269 #define ISDN_TIMER_1SEC        (HZ/(ISDN_TIMER_RES+1))   /* Slow-Timer2 1 sec       */
270 #define ISDN_TIMER_RINGING     5 /* tty RINGs = ISDN_TIMER_1SEC * this factor       */
271 #define ISDN_TIMER_KEEPINT    10 /* Cisco-Keepalive = ISDN_TIMER_1SEC * this factor */
272 #define ISDN_TIMER_MODEMREAD   1
273 #define ISDN_TIMER_MODEMPLUS   2
274 #define ISDN_TIMER_MODEMRING   4
275 #define ISDN_TIMER_MODEMXMIT   8
276 #define ISDN_TIMER_NETDIAL    16 
277 #define ISDN_TIMER_NETHANGUP  32
278 #define ISDN_TIMER_KEEPALIVE 128 /* Cisco-Keepalive */
279 #define ISDN_TIMER_CARRIER   256 /* Wait for Carrier */
280 #define ISDN_TIMER_FAST      (ISDN_TIMER_MODEMREAD | ISDN_TIMER_MODEMPLUS | \
281                               ISDN_TIMER_MODEMXMIT)
282 #define ISDN_TIMER_SLOW      (ISDN_TIMER_MODEMRING | ISDN_TIMER_NETHANGUP | \
283                               ISDN_TIMER_NETDIAL | ISDN_TIMER_KEEPALIVE | \
284                               ISDN_TIMER_CARRIER)
285 
286 /* Timeout-Values for isdn_net_dial() */
287 #define ISDN_TIMER_DTIMEOUT10 (10*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
288 #define ISDN_TIMER_DTIMEOUT15 (15*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
289 #define ISDN_TIMER_DTIMEOUT60 (60*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
290 
291 /* GLOBAL_FLAGS */
292 #define ISDN_GLOBAL_STOPPED 1
293 
294 /*=================== Start of ip-over-ISDN stuff =========================*/
295 
296 /* Feature- and status-flags for a net-interface */
297 #define ISDN_NET_CONNECTED  0x01       /* Bound to ISDN-Channel             */
298 #define ISDN_NET_SECURE     0x02       /* Accept calls from phonelist only  */
299 #define ISDN_NET_CALLBACK   0x04       /* activate callback                 */
300 #define ISDN_NET_CBHUP      0x08       /* hangup before callback            */
301 #define ISDN_NET_CBOUT      0x10       /* remote machine does callback      */
302 
303 #define ISDN_NET_MAGIC      0x49344C02 /* for paranoia-checking             */
304 
305 /* Phone-list-element */
306 typedef struct {
307   void *next;
308   char num[ISDN_MSNLEN];
309 } isdn_net_phone;
310 
311 /*
312    Principles when extending structures for generic encapsulation protocol
313    ("concap") support:
314    - Stuff which is hardware specific (here i4l-specific) goes in 
315      the netdev -> local structure (here: isdn_net_local)
316    - Stuff which is encapsulation protocol specific goes in the structure
317      which holds the linux device structure (here: isdn_net_device)
318 */
319 
320 /* Local interface-data */
321 typedef struct isdn_net_local_s {
322   ulong                  magic;
323   char                   name[10];     /* Name of device                   */
324   struct net_device_stats stats;       /* Ethernet Statistics              */
325   int                    isdn_device;  /* Index to isdn-device             */
326   int                    isdn_channel; /* Index to isdn-channel            */
327   int                    ppp_slot;     /* PPPD device slot number          */
328   int                    pre_device;   /* Preselected isdn-device          */
329   int                    pre_channel;  /* Preselected isdn-channel         */
330   int                    exclusive;    /* If non-zero idx to reserved chan.*/
331   int                    flags;        /* Connection-flags                 */
332   int                    dialretry;    /* Counter for Dialout-retries      */
333   int                    dialmax;      /* Max. Number of Dial-retries      */
334   int                    cbdelay;      /* Delay before Callback starts     */
335   int                    dtimer;       /* Timeout-counter for dialing      */
336   char                   msn[ISDN_MSNLEN]; /* MSNs/EAZs for this interface */
337   u_char                 cbhup;        /* Flag: Reject Call before Callback*/
338   u_char                 dialstate;    /* State for dialing                */
339   u_char                 p_encap;      /* Packet encapsulation             */
340                                        /*   0 = Ethernet over ISDN         */
341                                        /*   1 = RAW-IP                     */
342                                        /*   2 = IP with type field         */
343   u_char                 l2_proto;     /* Layer-2-protocol                 */
344                                        /* See ISDN_PROTO_L2..-constants in */
345                                        /* isdnif.h                         */
346                                        /*   0 = X75/LAPB with I-Frames     */
347                                        /*   1 = X75/LAPB with UI-Frames    */
348                                        /*   2 = X75/LAPB with BUI-Frames   */
349                                        /*   3 = HDLC                       */
350   u_char                 l3_proto;     /* Layer-3-protocol                 */
351                                        /* See ISDN_PROTO_L3..-constants in */
352                                        /* isdnif.h                         */
353                                        /*   0 = Transparent                */
354   int                    huptimer;     /* Timeout-counter for auto-hangup  */
355   int                    charge;       /* Counter for charging units       */
356   ulong                  chargetime;   /* Timer for Charging info          */
357   int                    hupflags;     /* Flags for charge-unit-hangup:    */
358                                        /* bit0: chargeint is invalid       */
359                                        /* bit1: Getting charge-interval    */
360                                        /* bit2: Do charge-unit-hangup      */
361                                        /* bit3: Do hangup even on incoming */
362   int                    outgoing;     /* Flag: outgoing call              */
363   int                    onhtime;      /* Time to keep link up             */
364   int                    chargeint;    /* Interval between charge-infos    */
365   int                    onum;         /* Flag: at least 1 outgoing number */
366   int                    cps;          /* current speed of this interface  */
367   int                    transcount;   /* byte-counter for cps-calculation */
368   int                    sqfull;       /* Flag: netdev-queue overloaded    */
369   ulong                  sqfull_stamp; /* Start-Time of overload           */
370   ulong                  slavedelay;   /* Dynamic bundling delaytime       */
371   int                    triggercps;   /* BogoCPS needed for trigger slave */
372   isdn_net_phone         *phone[2];    /* List of remote-phonenumbers      */
373                                        /* phone[0] = Incoming Numbers      */
374                                        /* phone[1] = Outgoing Numbers      */
375   isdn_net_phone         *dial;        /* Pointer to dialed number         */
376   struct net_device      *master;      /* Ptr to Master device for slaves  */
377   struct net_device      *slave;       /* Ptr to Slave device for masters  */
378   struct isdn_net_local_s *next;       /* Ptr to next link in bundle       */
379   struct isdn_net_local_s *last;       /* Ptr to last link in bundle       */
380   struct isdn_net_dev_s  *netdev;      /* Ptr to netdev                    */
381   struct sk_buff_head    super_tx_queue; /* List of supervisory frames to  */
382                                        /* be transmitted asap              */
383   atomic_t frame_cnt;                  /* number of frames currently       */
384                                        /* queued in HL driver              */    
385                                        /* Ptr to orig. hard_header_cache   */
386   spinlock_t             xmit_lock;    /* used to protect the xmit path of */
387                                        /* a particular channel (including  */
388                                        /* the frame_cnt                    */
389 
390   int                    (*org_hhc)(
391                                     struct neighbour *neigh,
392                                     struct hh_cache *hh);
393                                        /* Ptr to orig. header_cache_update */
394   void                   (*org_hcu)(struct hh_cache *,
395                                     struct net_device *,
396                                     unsigned char *);
397   int  pppbind;                        /* ippp device for bindings         */
398   int                                   dialtimeout;    /* How long shall we try on dialing? (jiffies) */
399   int                                   dialwait;               /* How long shall we wait after failed attempt? (jiffies) */
400   ulong                                 dialstarted;    /* jiffies of first dialing-attempt */
401   ulong                                 dialwait_timer; /* jiffies of earliest next dialing-attempt */
402   int                                   huptimeout;             /* How long will the connection be up? (seconds) */
403 #ifdef CONFIG_ISDN_X25
404   struct concap_device_ops *dops;      /* callbacks used by encapsulator   */
405 #endif
406   int  cisco_loop;                     /* Loop counter for Cisco-SLARP     */
407   ulong cisco_myseq;                   /* Local keepalive seq. for Cisco   */
408   ulong cisco_yourseq;                 /* Remote keepalive seq. for Cisco  */
409   struct tq_struct tqueue;
410 } isdn_net_local;
411 
412 /* the interface itself */
413 typedef struct isdn_net_dev_s {
414   isdn_net_local *local;
415   isdn_net_local *queue;               /* circular list of all bundled
416                                           channels, which are currently
417                                           online                           */
418   spinlock_t queue_lock;               /* lock to protect queue            */
419   void *next;                          /* Pointer to next isdn-interface   */
420   struct net_device dev;               /* interface to upper levels        */
421 #ifdef CONFIG_ISDN_PPP
422   ippp_bundle * pb;             /* pointer to the common bundle structure
423                                  * with the the per-bundle data */
424 #endif
425 #ifdef CONFIG_ISDN_X25
426   struct concap_proto  *cprot; /* connection oriented encapsulation protocol */
427 #endif
428 
429 } isdn_net_dev;
430 
431 /*===================== End of ip-over-ISDN stuff ===========================*/
432 
433 /*======================= Start of ISDN-tty stuff ===========================*/
434 
435 #define ISDN_ASYNC_MAGIC          0x49344C01 /* for paranoia-checking        */
436 #define ISDN_ASYNC_INITIALIZED    0x80000000 /* port was initialized         */
437 #define ISDN_ASYNC_CALLOUT_ACTIVE 0x40000000 /* Call out device active       */
438 #define ISDN_ASYNC_NORMAL_ACTIVE  0x20000000 /* Normal device active         */
439 #define ISDN_ASYNC_CLOSING        0x08000000 /* Serial port is closing       */
440 #define ISDN_ASYNC_CTS_FLOW       0x04000000 /* Do CTS flow control          */
441 #define ISDN_ASYNC_CHECK_CD       0x02000000 /* i.e., CLOCAL                 */
442 #define ISDN_ASYNC_HUP_NOTIFY         0x0001 /* Notify tty on hangups/closes */
443 #define ISDN_ASYNC_SESSION_LOCKOUT    0x0100 /* Lock cua opens on session    */
444 #define ISDN_ASYNC_PGRP_LOCKOUT       0x0200 /* Lock cua opens on pgrp       */
445 #define ISDN_ASYNC_CALLOUT_NOHUP      0x0400 /* No hangup for cui            */
446 #define ISDN_ASYNC_SPLIT_TERMIOS      0x0008 /* Sep. termios for dialin/out  */
447 #define ISDN_SERIAL_XMIT_SIZE           1024 /* Default bufsize for write    */
448 #define ISDN_SERIAL_XMIT_MAX            4000 /* Maximum bufsize for write    */
449 #define ISDN_SERIAL_TYPE_NORMAL            1
450 #define ISDN_SERIAL_TYPE_CALLOUT           2
451 
452 #ifdef CONFIG_ISDN_AUDIO
453 /* For using sk_buffs with audio we need some private variables
454  * within each sk_buff. For this purpose, we declare a struct here,
455  * and put it always at skb->head. A few macros help accessing the
456  * variables. Of course, we need to check skb_headroom prior to
457  * any access.
458  */
459 typedef struct isdn_audio_skb {
460   unsigned short dle_count;
461   unsigned char  lock;
462 } isdn_audio_skb;
463 
464 #define ISDN_AUDIO_SKB_DLECOUNT(skb) (((isdn_audio_skb*)skb->head)->dle_count)
465 #define ISDN_AUDIO_SKB_LOCK(skb) (((isdn_audio_skb*)skb->head)->lock)
466 #endif
467 
468 /* Private data of AT-command-interpreter */
469 typedef struct atemu {
470         u_char       profile[ISDN_MODEM_NUMREG]; /* Modem-Regs. Profile 0              */
471         u_char       mdmreg[ISDN_MODEM_NUMREG];  /* Modem-Registers                    */
472         char         pmsn[ISDN_MSNLEN];          /* EAZ/MSNs Profile 0                 */
473         char         msn[ISDN_MSNLEN];           /* EAZ/MSN                            */
474         char         plmsn[ISDN_LMSNLEN];        /* Listening MSNs Profile 0           */
475         char         lmsn[ISDN_LMSNLEN];         /* Listening MSNs                     */
476         char         cpn[ISDN_MSNLEN];           /* CalledPartyNumber on incoming call */
477         char         connmsg[ISDN_CMSGLEN];      /* CONNECT-Msg from HL-Driver         */
478 #ifdef CONFIG_ISDN_AUDIO
479         u_char       vpar[10];                   /* Voice-parameters                   */
480         int          lastDLE;                    /* Flag for voice-coding: DLE seen    */
481 #endif
482         int          mdmcmdl;                    /* Length of Modem-Commandbuffer      */
483         int          pluscount;                  /* Counter for +++ sequence           */
484         int          lastplus;                   /* Timestamp of last +                */
485         int          carrierwait;                /* Seconds of carrier waiting         */
486         char         mdmcmd[255];                /* Modem-Commandbuffer                */
487         unsigned int charge;                     /* Charge units of current connection */
488 } atemu;
489 
490 /* Private data (similar to async_struct in <linux/serial.h>) */
491 typedef struct modem_info {
492   int                   magic;
493   int                   flags;           /* defined in tty.h               */
494   int                   x_char;          /* xon/xoff character             */
495   int                   mcr;             /* Modem control register         */
496   int                   msr;             /* Modem status register          */
497   int                   lsr;             /* Line status register           */
498   int                   line;
499   int                   count;           /* # of fd on device              */
500   int                   blocked_open;    /* # of blocked opens             */
501   long                  session;         /* Session of opening process     */
502   long                  pgrp;            /* pgrp of opening process        */
503   int                   online;          /* 1 = B-Channel is up, drop data */
504                                          /* 2 = B-Channel is up, deliver d.*/
505   int                   dialing;         /* Dial in progress or ATA        */
506   int                   rcvsched;        /* Receive needs schedule         */
507   int                   isdn_driver;     /* Index to isdn-driver           */
508   int                   isdn_channel;    /* Index to isdn-channel          */
509   int                   drv_index;       /* Index to dev->usage            */
510   int                   ncarrier;        /* Flag: schedule NO CARRIER      */
511   unsigned char         last_cause[8];   /* Last cause message             */
512   unsigned char         last_num[ISDN_MSNLEN];
513                                          /* Last phone-number              */
514   unsigned char         last_l2;         /* Last layer-2 protocol          */
515   unsigned char         last_si;         /* Last service                   */
516   unsigned char         last_lhup;       /* Last hangup local?             */
517   unsigned char         last_dir;        /* Last direction (in or out)     */
518   struct timer_list     nc_timer;        /* Timer for delayed NO CARRIER   */
519   int                   send_outstanding;/* # of outstanding send-requests */
520   int                   xmit_size;       /* max. # of chars in xmit_buf    */
521   int                   xmit_count;      /* # of chars in xmit_buf         */
522   unsigned char         *xmit_buf;       /* transmit buffer                */
523   struct sk_buff_head   xmit_queue;      /* transmit queue                 */
524   atomic_t              xmit_lock;       /* Semaphore for isdn_tty_write   */
525 #ifdef CONFIG_ISDN_AUDIO
526   int                   vonline;         /* Voice-channel status           */
527                                          /* Bit 0 = recording              */
528                                          /* Bit 1 = playback               */
529                                          /* Bit 2 = playback, DLE-ETX seen */
530   struct sk_buff_head   dtmf_queue;      /* queue for dtmf results         */
531   void                  *adpcms;         /* state for adpcm decompression  */
532   void                  *adpcmr;         /* state for adpcm compression    */
533   void                  *dtmf_state;     /* state for dtmf decoder         */
534   void                  *silence_state;  /* state for silence detection    */
535 #endif
536 #ifdef CONFIG_ISDN_TTY_FAX
537   struct T30_s          *fax;            /* T30 Fax Group 3 data/interface */
538   int                   faxonline;       /* Fax-channel status             */
539 #endif
540   struct tty_struct     *tty;            /* Pointer to corresponding tty   */
541   atemu                 emu;             /* AT-emulator data               */
542   struct termios        normal_termios;  /* For saving termios structs     */
543   struct termios        callout_termios;
544   wait_queue_head_t     open_wait, close_wait;
545   struct semaphore      write_sem;
546 } modem_info;
547 
548 #define ISDN_MODEM_WINSIZE 8
549 
550 /* Description of one ISDN-tty */
551 typedef struct {
552   int                refcount;                     /* Number of opens        */
553   struct tty_driver  tty_modem;                    /* tty-device             */
554   struct tty_driver  cua_modem;                    /* cua-device             */
555   struct tty_struct  *modem_table[ISDN_MAX_CHANNELS]; /* ?? copied from Orig */
556   struct termios     *modem_termios[ISDN_MAX_CHANNELS];
557   struct termios     *modem_termios_locked[ISDN_MAX_CHANNELS];
558   modem_info         info[ISDN_MAX_CHANNELS];      /* Private data           */
559 } modem;
560 
561 /*======================= End of ISDN-tty stuff ============================*/
562 
563 /*======================== Start of V.110 stuff ============================*/
564 #define V110_BUFSIZE 1024
565 
566 typedef struct {
567         int nbytes;                    /* 1 Matrixbyte -> nbytes in stream     */
568         int nbits;                     /* Number of used bits in streambyte    */
569         unsigned char key;             /* Bitmask in stream eg. 11 (nbits=2)   */
570         int decodelen;                 /* Amount of data in decodebuf          */
571         int SyncInit;                  /* Number of sync frames to send        */
572         unsigned char *OnlineFrame;    /* Precalculated V110 idle frame        */
573         unsigned char *OfflineFrame;   /* Precalculated V110 sync Frame        */
574         int framelen;                  /* Length of frames                     */
575         int skbuser;                   /* Number of unacked userdata skbs      */
576         int skbidle;                   /* Number of unacked idle/sync skbs     */
577         int introducer;                /* Local vars for decoder               */
578         int dbit;
579         unsigned char b;
580         int skbres;                    /* space to reserve in outgoing skb     */
581         int maxsize;                   /* maxbufsize of lowlevel driver        */
582         unsigned char *encodebuf;      /* temporary buffer for encoding        */
583         unsigned char decodebuf[V110_BUFSIZE]; /* incomplete V110 matrices     */
584 } isdn_v110_stream;
585 
586 /*========================= End of V.110 stuff =============================*/
587 
588 /*======================= Start of general stuff ===========================*/
589 
590 typedef struct {
591         char *next;
592         char *private;
593 } infostruct;
594 
595 typedef struct isdn_module {
596         struct isdn_module *prev;
597         struct isdn_module *next;
598         char *name;
599         int (*get_free_channel)(int, int, int, int, int);
600         int (*free_channel)(int, int, int);
601         int (*status_callback)(isdn_ctrl *);
602         int (*command)(isdn_ctrl *);
603         int (*receive_callback)(int, int, struct sk_buff *);
604         int (*writebuf_skb)(int, int, int, struct sk_buff *);
605         int (*net_start_xmit)(struct sk_buff *, struct net_device *);
606         int (*net_receive)(struct net_device *, struct sk_buff *);
607         int (*net_open)(struct net_device *);
608         int (*net_close)(struct net_device *);
609         int priority;
610 } isdn_module;
611 
612 #define DRV_FLAG_RUNNING 1
613 #define DRV_FLAG_REJBUS  2
614 #define DRV_FLAG_LOADED  4
615 
616 /* Description of hardware-level-driver */
617 typedef struct {
618         ulong               online;           /* Channel-Online flags             */
619         ulong               flags;            /* Misc driver Flags                */
620         int                 locks;            /* Number of locks for this driver  */
621         int                 channels;         /* Number of channels               */
622         wait_queue_head_t   st_waitq;         /* Wait-Queue for status-read's     */
623         int                 maxbufsize;       /* Maximum Buffersize supported     */
624         unsigned long       pktcount;         /* Until now: unused                */
625         int                 stavail;          /* Chars avail on Status-device     */
626         isdn_if            *interface;        /* Interface to driver              */
627         int                *rcverr;           /* Error-counters for B-Ch.-receive */
628         int                *rcvcount;         /* Byte-counters for B-Ch.-receive  */
629 #ifdef CONFIG_ISDN_AUDIO
630         unsigned long      DLEflag;           /* Flags: Insert DLE at next read   */
631 #endif
632         struct sk_buff_head *rpqueue;         /* Pointers to start of Rcv-Queue   */
633         wait_queue_head_t  *rcv_waitq;       /* Wait-Queues for B-Channel-Reads  */
634         wait_queue_head_t  *snd_waitq;       /* Wait-Queue for B-Channel-Send's  */
635         char               msn2eaz[10][ISDN_MSNLEN];  /* Mapping-Table MSN->EAZ   */
636 } driver;
637 
638 /* Main driver-data */
639 typedef struct isdn_devt {
640         unsigned short    flags;                       /* Bitmapped Flags:           */
641         /*                            */
642         int               drivers;                     /* Current number of drivers  */
643         int               channels;                    /* Current number of channels */
644         int               net_verbose;               /* Verbose-Flag               */
645         int               modempoll;                   /* Flag: tty-read active      */
646         int               tflags;                    /* Timer-Flags:               */
647         /*  see ISDN_TIMER_..defines  */
648         int               global_flags;
649         infostruct        *infochain;                /* List of open info-devs.    */
650         wait_queue_head_t info_waitq;               /* Wait-Queue for isdninfo    */
651         struct timer_list timer;                       /* Misc.-function Timer       */
652         int               chanmap[ISDN_MAX_CHANNELS];/* Map minor->device-channel  */
653         int               drvmap[ISDN_MAX_CHANNELS]; /* Map minor->driver-index    */
654         int               usage[ISDN_MAX_CHANNELS];  /* Used by tty/ip/voice       */
655         char              num[ISDN_MAX_CHANNELS][ISDN_MSNLEN];
656         /* Remote number of active ch.*/
657         int               m_idx[ISDN_MAX_CHANNELS];  /* Index for mdm....          */
658         driver            *drv[ISDN_MAX_DRIVERS];    /* Array of drivers           */
659         isdn_net_dev      *netdev;                     /* Linked list of net-if's    */
660         char              drvid[ISDN_MAX_DRIVERS][20];/* Driver-ID                 */
661         struct task_struct *profd;                   /* For iprofd                 */
662         modem             mdm;                 /* tty-driver-data            */
663         isdn_net_dev      *rx_netdev[ISDN_MAX_CHANNELS]; /* rx netdev-pointers     */
664         isdn_net_dev      *st_netdev[ISDN_MAX_CHANNELS]; /* stat netdev-pointers   */
665         ulong             ibytes[ISDN_MAX_CHANNELS]; /* Statistics incoming bytes  */
666         ulong             obytes[ISDN_MAX_CHANNELS]; /* Statistics outgoing bytes  */
667         int               v110emu[ISDN_MAX_CHANNELS];/* V.110 emulator-mode 0=none */
668         atomic_t          v110use[ISDN_MAX_CHANNELS];/* Usage-Semaphore for stream */
669         isdn_v110_stream  *v110[ISDN_MAX_CHANNELS];  /* V.110 private data         */
670         struct semaphore  sem;                       /* serialize list access*/
671         isdn_module       *modules;
672         unsigned long     global_features;
673 #ifdef CONFIG_DEVFS_FS
674         devfs_handle_t devfs_handle_isdninfo;
675         devfs_handle_t devfs_handle_isdnctrl;
676         devfs_handle_t devfs_handle_isdnX[ISDN_MAX_CHANNELS];
677         devfs_handle_t devfs_handle_isdnctrlX[ISDN_MAX_CHANNELS];
678 #ifdef CONFIG_ISDN_PPP
679         devfs_handle_t devfs_handle_ipppX[ISDN_MAX_CHANNELS];
680 #endif
681 #endif /* CONFIG_DEVFS_FS */
682 } isdn_dev;
683 
684 extern isdn_dev *dev;
685 
686 
687 /* Utility-Macros */
688 #define MIN(a,b) ((a<b)?a:b)
689 #define MAX(a,b) ((a>b)?a:b)
690 #endif /* __KERNEL__ */
691 #endif /* isdn_h */
692 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.