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