1 /* $Id: isdn.h,v 1.125.2.3 2004/02/10 01:07:14 keil Exp $
3 * Main header for the Linux ISDN subsystem (linklevel).
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)
9 * This software may be used and distributed according to the terms
10 * of the GNU General Public License, incorporated herein by reference.
17 #include <linux/ioctl.h>
19 #ifdef CONFIG_COBALT_MICRO_SERVER
21 #define ISDN_MAX_DRIVERS 2
22 #define ISDN_MAX_CHANNELS 8
24 #define ISDN_MAX_DRIVERS 32
25 #define ISDN_MAX_CHANNELS 64
29 #define IIOCNETAIF _IO('I',1)
30 #define IIOCNETDIF _IO('I',2)
31 #define IIOCNETSCF _IO('I',3)
32 #define IIOCNETGCF _IO('I',4)
33 #define IIOCNETANM _IO('I',5)
34 #define IIOCNETDNM _IO('I',6)
35 #define IIOCNETGNM _IO('I',7)
36 #define IIOCGETSET _IO('I',8) /* no longer supported */
37 #define IIOCSETSET _IO('I',9) /* no longer supported */
38 #define IIOCSETVER _IO('I',10)
39 #define IIOCNETHUP _IO('I',11)
40 #define IIOCSETGST _IO('I',12)
41 #define IIOCSETBRJ _IO('I',13)
42 #define IIOCSIGPRF _IO('I',14)
43 #define IIOCGETPRF _IO('I',15)
44 #define IIOCSETPRF _IO('I',16)
45 #define IIOCGETMAP _IO('I',17)
46 #define IIOCSETMAP _IO('I',18)
47 #define IIOCNETASL _IO('I',19)
48 #define IIOCNETDIL _IO('I',20)
49 #define IIOCGETCPS _IO('I',21)
50 #define IIOCGETDVR _IO('I',22)
51 #define IIOCNETLCR _IO('I',23) /* dwabc ioctl for LCR from isdnlog */
52 #define IIOCNETDWRSET _IO('I',24) /* dwabc ioctl to reset abc-values to default on a net-interface */
54 #define IIOCNETALN _IO('I',32)
55 #define IIOCNETDLN _IO('I',33)
57 #define IIOCNETGPN _IO('I',34)
59 #define IIOCDBGVAR _IO('I',127)
61 #define IIOCDRVCTL _IO('I',128)
63 /* cisco hdlck device private ioctls */
64 #define SIOCGKEEPPERIOD (SIOCDEVPRIVATE + 0)
65 #define SIOCSKEEPPERIOD (SIOCDEVPRIVATE + 1)
66 #define SIOCGDEBSERINT (SIOCDEVPRIVATE + 2)
67 #define SIOCSDEBSERINT (SIOCDEVPRIVATE + 3)
69 /* Packet encapsulations for net-interfaces */
70 #define ISDN_NET_ENCAP_ETHER 0
71 #define ISDN_NET_ENCAP_RAWIP 1
72 #define ISDN_NET_ENCAP_IPTYP 2
73 #define ISDN_NET_ENCAP_CISCOHDLC 3 /* Without SLARP and keepalive */
74 #define ISDN_NET_ENCAP_SYNCPPP 4
75 #define ISDN_NET_ENCAP_UIHDLC 5
76 #define ISDN_NET_ENCAP_CISCOHDLCK 6 /* With SLARP and keepalive */
77 #define ISDN_NET_ENCAP_X25IFACE 7 /* Documentation/networking/x25-iface.txt*/
78 #define ISDN_NET_ENCAP_MAX_ENCAP ISDN_NET_ENCAP_X25IFACE
80 /* Facility which currently uses an ISDN-channel */
81 #define ISDN_USAGE_NONE 0
82 #define ISDN_USAGE_RAW 1
83 #define ISDN_USAGE_MODEM 2
84 #define ISDN_USAGE_NET 3
85 #define ISDN_USAGE_VOICE 4
86 #define ISDN_USAGE_FAX 5
87 #define ISDN_USAGE_MASK 7 /* Mask to get plain usage */
88 #define ISDN_USAGE_DISABLED 32 /* This bit is set, if channel is disabled */
89 #define ISDN_USAGE_EXCLUSIVE 64 /* This bit is set, if channel is exclusive */
90 #define ISDN_USAGE_OUTGOING 128 /* This bit is set, if channel is outgoing */
92 #define ISDN_MODEM_NUMREG 24 /* Number of Modem-Registers */
93 #define ISDN_LMSNLEN 255 /* Length of tty's Listen-MSN string */
94 #define ISDN_CMSGLEN 50 /* Length of CONNECT-Message to add for Modem */
96 #define ISDN_MSNLEN 32
97 #define NET_DV 0x06 /* Data version for isdn_net_ioctl_cfg */
98 #define TTY_DV 0x06 /* Data version for iprofd etc. */
100 #define INF_DV 0x01 /* Data version for /dev/isdninfo */
109 char phone[ISDN_MSNLEN];
111 } isdn_net_ioctl_phone;
114 char name[10]; /* Name of interface */
115 char master[10]; /* Name of Master for Bundling */
116 char slave[10]; /* Name of Slave for Bundling */
117 char eaz[256]; /* EAZ/MSN */
118 char drvid[25]; /* DriverId for Bindings */
119 int onhtime; /* Hangup-Timeout */
120 int charge; /* Charge-Units */
121 int l2_proto; /* Layer-2 protocol */
122 int l3_proto; /* Layer-3 protocol */
123 int p_encap; /* Encapsulation */
124 int exclusive; /* Channel, if bound exclusive */
125 int dialmax; /* Dial Retry-Counter */
126 int slavedelay; /* Delay until slave starts up */
127 int cbdelay; /* Delay before Callback */
128 int chargehup; /* Flag: Charge-Hangup */
129 int ihup; /* Flag: Hangup-Timeout on incoming line */
130 int secure; /* Flag: Secure */
131 int callback; /* Flag: Callback */
132 int cbhup; /* Flag: Reject Call before Callback */
133 int pppbind; /* ippp device for bindings */
134 int chargeint; /* Use fixed charge interval length */
135 int triggercps; /* BogoCPS needed for triggering slave */
136 int dialtimeout; /* Dial-Timeout */
137 int dialwait; /* Time to wait after failed dial */
138 int dialmode; /* Flag: off / on / auto */
139 } isdn_net_ioctl_cfg;
141 #define ISDN_NET_DIALMODE_MASK 0xC0 /* bits for status */
142 #define ISDN_NET_DM_OFF 0x00 /* this interface is stopped */
143 #define ISDN_NET_DM_MANUAL 0x40 /* this interface is on (manual) */
144 #define ISDN_NET_DM_AUTO 0x80 /* this interface is autodial */
145 #define ISDN_NET_DIALMODE(x) ((&(x))->flags & ISDN_NET_DIALMODE_MASK)
149 #include <linux/errno.h>
150 #include <linux/fs.h>
151 #include <linux/major.h>
153 #include <linux/kernel.h>
154 #include <linux/signal.h>
155 #include <linux/slab.h>
156 #include <linux/timer.h>
157 #include <linux/wait.h>
158 #include <linux/tty.h>
159 #include <linux/tty_flip.h>
160 #include <linux/serial_reg.h>
161 #include <linux/fcntl.h>
162 #include <linux/types.h>
163 #include <linux/interrupt.h>
164 #include <linux/ip.h>
165 #include <linux/in.h>
166 #include <linux/netdevice.h>
167 #include <linux/etherdevice.h>
168 #include <linux/skbuff.h>
169 #include <linux/tcp.h>
171 #define ISDN_TTY_MAJOR 43
172 #define ISDN_TTYAUX_MAJOR 44
173 #define ISDN_MAJOR 45
175 /* The minor-devicenumbers for Channel 0 and 1 are used as arguments for
176 * physical Channel-Mapping, so they MUST NOT be changed without changing
177 * the correspondent code in isdn.c
180 #define ISDN_MINOR_B 0
181 #define ISDN_MINOR_BMAX (ISDN_MAX_CHANNELS-1)
182 #define ISDN_MINOR_CTRL 64
183 #define ISDN_MINOR_CTRLMAX (64 + (ISDN_MAX_CHANNELS-1))
184 #define ISDN_MINOR_PPP 128
185 #define ISDN_MINOR_PPPMAX (128 + (ISDN_MAX_CHANNELS-1))
186 #define ISDN_MINOR_STATUS 255
188 #ifdef CONFIG_ISDN_PPP
190 #ifdef CONFIG_ISDN_PPP_VJ
191 # include <net/slhc_vj.h>
194 #include <linux/ppp_defs.h>
195 #include <linux/if_ppp.h>
197 #include <linux/isdn_ppp.h>
200 #ifdef CONFIG_ISDN_X25
201 # include <linux/concap.h>
204 #include <linux/isdnif.h>
206 #define ISDN_DRVIOCTL_MASK 0x7f /* Mask for Device-ioctl */
208 /* Until now unused */
209 #define ISDN_SERVICE_VOICE 1
210 #define ISDN_SERVICE_AB 1<<1
211 #define ISDN_SERVICE_X21 1<<2
212 #define ISDN_SERVICE_G4 1<<3
213 #define ISDN_SERVICE_BTX 1<<4
214 #define ISDN_SERVICE_DFUE 1<<5
215 #define ISDN_SERVICE_X25 1<<6
216 #define ISDN_SERVICE_TTX 1<<7
217 #define ISDN_SERVICE_MIXED 1<<8
218 #define ISDN_SERVICE_FW 1<<9
219 #define ISDN_SERVICE_GTEL 1<<10
220 #define ISDN_SERVICE_BTXN 1<<11
221 #define ISDN_SERVICE_BTEL 1<<12
223 /* Macros checking plain usage */
224 #define USG_NONE(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NONE)
225 #define USG_RAW(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_RAW)
226 #define USG_MODEM(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM)
227 #define USG_VOICE(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE)
228 #define USG_NET(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NET)
229 #define USG_FAX(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_FAX)
230 #define USG_OUTGOING(x) ((x & ISDN_USAGE_OUTGOING)==ISDN_USAGE_OUTGOING)
231 #define USG_MODEMORVOICE(x) (((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM) || \
232 ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE) )
234 /* Timer-delays and scheduling-flags */
235 #define ISDN_TIMER_RES 4 /* Main Timer-Resolution */
236 #define ISDN_TIMER_02SEC (HZ/ISDN_TIMER_RES/5) /* Slow-Timer1 .2 sec */
237 #define ISDN_TIMER_1SEC (HZ/ISDN_TIMER_RES) /* Slow-Timer2 1 sec */
238 #define ISDN_TIMER_RINGING 5 /* tty RINGs = ISDN_TIMER_1SEC * this factor */
239 #define ISDN_TIMER_KEEPINT 10 /* Cisco-Keepalive = ISDN_TIMER_1SEC * this factor */
240 #define ISDN_TIMER_MODEMREAD 1
241 #define ISDN_TIMER_MODEMPLUS 2
242 #define ISDN_TIMER_MODEMRING 4
243 #define ISDN_TIMER_MODEMXMIT 8
244 #define ISDN_TIMER_NETDIAL 16
245 #define ISDN_TIMER_NETHANGUP 32
246 #define ISDN_TIMER_CARRIER 256 /* Wait for Carrier */
247 #define ISDN_TIMER_FAST (ISDN_TIMER_MODEMREAD | ISDN_TIMER_MODEMPLUS | \
248 ISDN_TIMER_MODEMXMIT)
249 #define ISDN_TIMER_SLOW (ISDN_TIMER_MODEMRING | ISDN_TIMER_NETHANGUP | \
250 ISDN_TIMER_NETDIAL | ISDN_TIMER_CARRIER)
252 /* Timeout-Values for isdn_net_dial() */
253 #define ISDN_TIMER_DTIMEOUT10 (10*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
254 #define ISDN_TIMER_DTIMEOUT15 (15*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
255 #define ISDN_TIMER_DTIMEOUT60 (60*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
258 #define ISDN_GLOBAL_STOPPED 1
260 /*=================== Start of ip-over-ISDN stuff =========================*/
262 /* Feature- and status-flags for a net-interface */
263 #define ISDN_NET_CONNECTED 0x01 /* Bound to ISDN-Channel */
264 #define ISDN_NET_SECURE 0x02 /* Accept calls from phonelist only */
265 #define ISDN_NET_CALLBACK 0x04 /* activate callback */
266 #define ISDN_NET_CBHUP 0x08 /* hangup before callback */
267 #define ISDN_NET_CBOUT 0x10 /* remote machine does callback */
269 #define ISDN_NET_MAGIC 0x49344C02 /* for paranoia-checking */
271 /* Phone-list-element */
274 char num[ISDN_MSNLEN];
278 Principles when extending structures for generic encapsulation protocol
280 - Stuff which is hardware specific (here i4l-specific) goes in
281 the netdev -> local structure (here: isdn_net_local)
282 - Stuff which is encapsulation protocol specific goes in the structure
283 which holds the linux device structure (here: isdn_net_device)
286 /* Local interface-data */
287 typedef struct isdn_net_local_s {
289 struct net_device_stats stats; /* Ethernet Statistics */
290 int isdn_device; /* Index to isdn-device */
291 int isdn_channel; /* Index to isdn-channel */
292 int ppp_slot; /* PPPD device slot number */
293 int pre_device; /* Preselected isdn-device */
294 int pre_channel; /* Preselected isdn-channel */
295 int exclusive; /* If non-zero idx to reserved chan.*/
296 int flags; /* Connection-flags */
297 int dialretry; /* Counter for Dialout-retries */
298 int dialmax; /* Max. Number of Dial-retries */
299 int cbdelay; /* Delay before Callback starts */
300 int dtimer; /* Timeout-counter for dialing */
301 char msn[ISDN_MSNLEN]; /* MSNs/EAZs for this interface */
302 u_char cbhup; /* Flag: Reject Call before Callback*/
303 u_char dialstate; /* State for dialing */
304 u_char p_encap; /* Packet encapsulation */
305 /* 0 = Ethernet over ISDN */
307 /* 2 = IP with type field */
308 u_char l2_proto; /* Layer-2-protocol */
309 /* See ISDN_PROTO_L2..-constants in */
311 /* 0 = X75/LAPB with I-Frames */
312 /* 1 = X75/LAPB with UI-Frames */
313 /* 2 = X75/LAPB with BUI-Frames */
315 u_char l3_proto; /* Layer-3-protocol */
316 /* See ISDN_PROTO_L3..-constants in */
318 /* 0 = Transparent */
319 int huptimer; /* Timeout-counter for auto-hangup */
320 int charge; /* Counter for charging units */
321 ulong chargetime; /* Timer for Charging info */
322 int hupflags; /* Flags for charge-unit-hangup: */
323 /* bit0: chargeint is invalid */
324 /* bit1: Getting charge-interval */
325 /* bit2: Do charge-unit-hangup */
326 /* bit3: Do hangup even on incoming */
327 int outgoing; /* Flag: outgoing call */
328 int onhtime; /* Time to keep link up */
329 int chargeint; /* Interval between charge-infos */
330 int onum; /* Flag: at least 1 outgoing number */
331 int cps; /* current speed of this interface */
332 int transcount; /* byte-counter for cps-calculation */
333 int sqfull; /* Flag: netdev-queue overloaded */
334 ulong sqfull_stamp; /* Start-Time of overload */
335 ulong slavedelay; /* Dynamic bundling delaytime */
336 int triggercps; /* BogoCPS needed for trigger slave */
337 isdn_net_phone *phone[2]; /* List of remote-phonenumbers */
338 /* phone[0] = Incoming Numbers */
339 /* phone[1] = Outgoing Numbers */
340 isdn_net_phone *dial; /* Pointer to dialed number */
341 struct net_device *master; /* Ptr to Master device for slaves */
342 struct net_device *slave; /* Ptr to Slave device for masters */
343 struct isdn_net_local_s *next; /* Ptr to next link in bundle */
344 struct isdn_net_local_s *last; /* Ptr to last link in bundle */
345 struct isdn_net_dev_s *netdev; /* Ptr to netdev */
346 struct sk_buff_head super_tx_queue; /* List of supervisory frames to */
347 /* be transmitted asap */
348 atomic_t frame_cnt; /* number of frames currently */
349 /* queued in HL driver */
350 /* Ptr to orig. hard_header_cache */
351 spinlock_t xmit_lock; /* used to protect the xmit path of */
352 /* a particular channel (including */
355 int pppbind; /* ippp device for bindings */
356 int dialtimeout; /* How long shall we try on dialing? (jiffies) */
357 int dialwait; /* How long shall we wait after failed attempt? (jiffies) */
358 ulong dialstarted; /* jiffies of first dialing-attempt */
359 ulong dialwait_timer; /* jiffies of earliest next dialing-attempt */
360 int huptimeout; /* How long will the connection be up? (seconds) */
361 #ifdef CONFIG_ISDN_X25
362 struct concap_device_ops *dops; /* callbacks used by encapsulator */
364 /* use an own struct for that in later versions */
365 ulong cisco_myseq; /* Local keepalive seq. for Cisco */
366 ulong cisco_mineseen; /* returned keepalive seq. from remote */
367 ulong cisco_yourseq; /* Remote keepalive seq. for Cisco */
368 int cisco_keepalive_period; /* keepalive period */
369 ulong cisco_last_slarp_in; /* jiffie of last keepalive packet we received */
370 char cisco_line_state; /* state of line according to keepalive packets */
371 char cisco_debserint; /* debugging flag of cisco hdlc with slarp */
372 struct timer_list cisco_timer;
373 struct work_struct tqueue;
376 /* the interface itself */
377 typedef struct isdn_net_dev_s {
378 isdn_net_local *local;
379 isdn_net_local *queue; /* circular list of all bundled
380 channels, which are currently
382 spinlock_t queue_lock; /* lock to protect queue */
383 void *next; /* Pointer to next isdn-interface */
384 struct net_device *dev; /* interface to upper levels */
385 #ifdef CONFIG_ISDN_PPP
386 ippp_bundle * pb; /* pointer to the common bundle structure
387 * with the per-bundle data */
389 #ifdef CONFIG_ISDN_X25
390 struct concap_proto *cprot; /* connection oriented encapsulation protocol */
395 /*===================== End of ip-over-ISDN stuff ===========================*/
397 /*======================= Start of ISDN-tty stuff ===========================*/
399 #define ISDN_ASYNC_MAGIC 0x49344C01 /* for paranoia-checking */
400 #define ISDN_ASYNC_INITIALIZED 0x80000000 /* port was initialized */
401 #define ISDN_ASYNC_CALLOUT_ACTIVE 0x40000000 /* Call out device active */
402 #define ISDN_ASYNC_NORMAL_ACTIVE 0x20000000 /* Normal device active */
403 #define ISDN_ASYNC_CLOSING 0x08000000 /* Serial port is closing */
404 #define ISDN_ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */
405 #define ISDN_ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */
406 #define ISDN_ASYNC_HUP_NOTIFY 0x0001 /* Notify tty on hangups/closes */
407 #define ISDN_ASYNC_SESSION_LOCKOUT 0x0100 /* Lock cua opens on session */
408 #define ISDN_ASYNC_PGRP_LOCKOUT 0x0200 /* Lock cua opens on pgrp */
409 #define ISDN_ASYNC_CALLOUT_NOHUP 0x0400 /* No hangup for cui */
410 #define ISDN_ASYNC_SPLIT_TERMIOS 0x0008 /* Sep. termios for dialin/out */
411 #define ISDN_SERIAL_XMIT_SIZE 1024 /* Default bufsize for write */
412 #define ISDN_SERIAL_XMIT_MAX 4000 /* Maximum bufsize for write */
413 #define ISDN_SERIAL_TYPE_NORMAL 1
414 #define ISDN_SERIAL_TYPE_CALLOUT 2
416 #ifdef CONFIG_ISDN_AUDIO
417 /* For using sk_buffs with audio we need some private variables
418 * within each sk_buff. For this purpose, we declare a struct here,
419 * and put it always at the private skb->cb data array. A few macros help
420 * accessing the variables.
422 typedef struct _isdn_audio_data {
423 unsigned short dle_count;
427 #define ISDN_AUDIO_SKB_DLECOUNT(skb) (((isdn_audio_data_t *)&skb->cb[0])->dle_count)
428 #define ISDN_AUDIO_SKB_LOCK(skb) (((isdn_audio_data_t *)&skb->cb[0])->lock)
431 /* Private data of AT-command-interpreter */
432 typedef struct atemu {
433 u_char profile[ISDN_MODEM_NUMREG]; /* Modem-Regs. Profile 0 */
434 u_char mdmreg[ISDN_MODEM_NUMREG]; /* Modem-Registers */
435 char pmsn[ISDN_MSNLEN]; /* EAZ/MSNs Profile 0 */
436 char msn[ISDN_MSNLEN]; /* EAZ/MSN */
437 char plmsn[ISDN_LMSNLEN]; /* Listening MSNs Profile 0 */
438 char lmsn[ISDN_LMSNLEN]; /* Listening MSNs */
439 char cpn[ISDN_MSNLEN]; /* CalledPartyNumber on incoming call */
440 char connmsg[ISDN_CMSGLEN]; /* CONNECT-Msg from HL-Driver */
441 #ifdef CONFIG_ISDN_AUDIO
442 u_char vpar[10]; /* Voice-parameters */
443 int lastDLE; /* Flag for voice-coding: DLE seen */
445 int mdmcmdl; /* Length of Modem-Commandbuffer */
446 int pluscount; /* Counter for +++ sequence */
447 u_long lastplus; /* Timestamp of last + */
448 int carrierwait; /* Seconds of carrier waiting */
449 char mdmcmd[255]; /* Modem-Commandbuffer */
450 unsigned int charge; /* Charge units of current connection */
453 /* Private data (similar to async_struct in <linux/serial.h>) */
454 typedef struct modem_info {
456 struct module *owner;
457 int flags; /* defined in tty.h */
458 int x_char; /* xon/xoff character */
459 int mcr; /* Modem control register */
460 int msr; /* Modem status register */
461 int lsr; /* Line status register */
463 int count; /* # of fd on device */
464 int blocked_open; /* # of blocked opens */
465 long session; /* Session of opening process */
466 long pgrp; /* pgrp of opening process */
467 int online; /* 1 = B-Channel is up, drop data */
468 /* 2 = B-Channel is up, deliver d.*/
469 int dialing; /* Dial in progress or ATA */
470 int rcvsched; /* Receive needs schedule */
471 int isdn_driver; /* Index to isdn-driver */
472 int isdn_channel; /* Index to isdn-channel */
473 int drv_index; /* Index to dev->usage */
474 int ncarrier; /* Flag: schedule NO CARRIER */
475 unsigned char last_cause[8]; /* Last cause message */
476 unsigned char last_num[ISDN_MSNLEN];
477 /* Last phone-number */
478 unsigned char last_l2; /* Last layer-2 protocol */
479 unsigned char last_si; /* Last service */
480 unsigned char last_lhup; /* Last hangup local? */
481 unsigned char last_dir; /* Last direction (in or out) */
482 struct timer_list nc_timer; /* Timer for delayed NO CARRIER */
483 int send_outstanding;/* # of outstanding send-requests */
484 int xmit_size; /* max. # of chars in xmit_buf */
485 int xmit_count; /* # of chars in xmit_buf */
486 unsigned char *xmit_buf; /* transmit buffer */
487 struct sk_buff_head xmit_queue; /* transmit queue */
488 atomic_t xmit_lock; /* Semaphore for isdn_tty_write */
489 #ifdef CONFIG_ISDN_AUDIO
490 int vonline; /* Voice-channel status */
491 /* Bit 0 = recording */
492 /* Bit 1 = playback */
493 /* Bit 2 = playback, DLE-ETX seen */
494 struct sk_buff_head dtmf_queue; /* queue for dtmf results */
495 void *adpcms; /* state for adpcm decompression */
496 void *adpcmr; /* state for adpcm compression */
497 void *dtmf_state; /* state for dtmf decoder */
498 void *silence_state; /* state for silence detection */
500 #ifdef CONFIG_ISDN_TTY_FAX
501 struct T30_s *fax; /* T30 Fax Group 3 data/interface */
502 int faxonline; /* Fax-channel status */
504 struct tty_struct *tty; /* Pointer to corresponding tty */
505 atemu emu; /* AT-emulator data */
506 struct ktermios normal_termios; /* For saving termios structs */
507 struct ktermios callout_termios;
508 wait_queue_head_t open_wait, close_wait;
509 struct semaphore write_sem;
513 #define ISDN_MODEM_WINSIZE 8
515 /* Description of one ISDN-tty */
516 typedef struct _isdn_modem {
517 int refcount; /* Number of opens */
518 struct tty_driver *tty_modem; /* tty-device */
519 struct tty_struct *modem_table[ISDN_MAX_CHANNELS]; /* ?? copied from Orig */
520 struct ktermios *modem_termios[ISDN_MAX_CHANNELS];
521 struct ktermios *modem_termios_locked[ISDN_MAX_CHANNELS];
522 modem_info info[ISDN_MAX_CHANNELS]; /* Private data */
525 /*======================= End of ISDN-tty stuff ============================*/
527 /*======================== Start of V.110 stuff ============================*/
528 #define V110_BUFSIZE 1024
531 int nbytes; /* 1 Matrixbyte -> nbytes in stream */
532 int nbits; /* Number of used bits in streambyte */
533 unsigned char key; /* Bitmask in stream eg. 11 (nbits=2) */
534 int decodelen; /* Amount of data in decodebuf */
535 int SyncInit; /* Number of sync frames to send */
536 unsigned char *OnlineFrame; /* Precalculated V110 idle frame */
537 unsigned char *OfflineFrame; /* Precalculated V110 sync Frame */
538 int framelen; /* Length of frames */
539 int skbuser; /* Number of unacked userdata skbs */
540 int skbidle; /* Number of unacked idle/sync skbs */
541 int introducer; /* Local vars for decoder */
544 int skbres; /* space to reserve in outgoing skb */
545 int maxsize; /* maxbufsize of lowlevel driver */
546 unsigned char *encodebuf; /* temporary buffer for encoding */
547 unsigned char decodebuf[V110_BUFSIZE]; /* incomplete V110 matrices */
550 /*========================= End of V.110 stuff =============================*/
552 /*======================= Start of general stuff ===========================*/
559 #define DRV_FLAG_RUNNING 1
560 #define DRV_FLAG_REJBUS 2
561 #define DRV_FLAG_LOADED 4
563 /* Description of hardware-level-driver */
564 typedef struct _isdn_driver {
565 ulong online; /* Channel-Online flags */
566 ulong flags; /* Misc driver Flags */
567 int locks; /* Number of locks for this driver */
568 int channels; /* Number of channels */
569 wait_queue_head_t st_waitq; /* Wait-Queue for status-read's */
570 int maxbufsize; /* Maximum Buffersize supported */
571 unsigned long pktcount; /* Until now: unused */
572 int stavail; /* Chars avail on Status-device */
573 isdn_if *interface; /* Interface to driver */
574 int *rcverr; /* Error-counters for B-Ch.-receive */
575 int *rcvcount; /* Byte-counters for B-Ch.-receive */
576 #ifdef CONFIG_ISDN_AUDIO
577 unsigned long DLEflag; /* Flags: Insert DLE at next read */
579 struct sk_buff_head *rpqueue; /* Pointers to start of Rcv-Queue */
580 wait_queue_head_t *rcv_waitq; /* Wait-Queues for B-Channel-Reads */
581 wait_queue_head_t *snd_waitq; /* Wait-Queue for B-Channel-Send's */
582 char msn2eaz[10][ISDN_MSNLEN]; /* Mapping-Table MSN->EAZ */
585 /* Main driver-data */
586 typedef struct isdn_devt {
587 struct module *owner;
589 unsigned short flags; /* Bitmapped Flags: */
590 int drivers; /* Current number of drivers */
591 int channels; /* Current number of channels */
592 int net_verbose; /* Verbose-Flag */
593 int modempoll; /* Flag: tty-read active */
594 spinlock_t timerlock;
595 int tflags; /* Timer-Flags: */
596 /* see ISDN_TIMER_..defines */
598 infostruct *infochain; /* List of open info-devs. */
599 wait_queue_head_t info_waitq; /* Wait-Queue for isdninfo */
600 struct timer_list timer; /* Misc.-function Timer */
601 int chanmap[ISDN_MAX_CHANNELS]; /* Map minor->device-channel */
602 int drvmap[ISDN_MAX_CHANNELS]; /* Map minor->driver-index */
603 int usage[ISDN_MAX_CHANNELS]; /* Used by tty/ip/voice */
604 char num[ISDN_MAX_CHANNELS][ISDN_MSNLEN];
605 /* Remote number of active ch.*/
606 int m_idx[ISDN_MAX_CHANNELS]; /* Index for mdm.... */
607 isdn_driver_t *drv[ISDN_MAX_DRIVERS]; /* Array of drivers */
608 isdn_net_dev *netdev; /* Linked list of net-if's */
609 char drvid[ISDN_MAX_DRIVERS][20];/* Driver-ID */
610 struct task_struct *profd; /* For iprofd */
611 isdn_modem_t mdm; /* tty-driver-data */
612 isdn_net_dev *rx_netdev[ISDN_MAX_CHANNELS]; /* rx netdev-pointers */
613 isdn_net_dev *st_netdev[ISDN_MAX_CHANNELS]; /* stat netdev-pointers */
614 ulong ibytes[ISDN_MAX_CHANNELS]; /* Statistics incoming bytes */
615 ulong obytes[ISDN_MAX_CHANNELS]; /* Statistics outgoing bytes */
616 int v110emu[ISDN_MAX_CHANNELS]; /* V.110 emulator-mode 0=none */
617 atomic_t v110use[ISDN_MAX_CHANNELS]; /* Usage-Semaphore for stream */
618 isdn_v110_stream *v110[ISDN_MAX_CHANNELS]; /* V.110 private data */
619 struct semaphore sem; /* serialize list access*/
620 unsigned long global_features;
623 extern isdn_dev *dev;
626 #endif /* __KERNEL__ */
628 #endif /* __ISDN_H__ */