Import 2.3.25pre1
[davej-history.git] / include / linux / isdn.h
blobd1d7350b1cc6481ffb404f939110521c32b2b555
1 /* $Id: isdn.h,v 1.71 1999/08/23 15:54:22 keil Exp $
3 * Main header for the Linux ISDN subsystem (linklevel).
5 * Copyright 1994,95,96 by Fritz Elfert (fritz@wuemaus.franken.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.
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.
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.
23 * $Log: isdn.h,v $
24 * Revision 1.71 1999/08/23 15:54:22 keil
25 * more backported changes from kernel 2.3.14
27 * Revision 1.70 1999/07/31 12:59:58 armin
28 * Added tty fax capabilities.
30 * Revision 1.69 1999/07/13 20:47:53 werner
31 * added channel bit ISDN_USAGE_DISABLED for limiting b-channel access.
33 * Revision 1.68 1999/07/11 17:07:37 armin
34 * Added tty modem register S23.
35 * Added new layer 2 and 3 protocols for Fax and DSP functions.
37 * Revision 1.67 1999/07/07 10:17:24 detabc
38 * remove unused messages
40 * Revision 1.66 1999/07/01 08:35:37 keil
41 * compatibility to 2.3
43 * Revision 1.65 1999/06/10 11:51:27 paul
44 * fixed comment for NET_DV
46 * Revision 1.64 1999/04/18 14:57:14 fritz
47 * Removed TIMRU stuff
49 * Revision 1.63 1999/04/18 14:07:18 fritz
50 * Removed TIMRU stuff.
52 * Revision 1.62 1999/04/12 13:16:54 fritz
53 * Changes from 2.0 tree.
55 * Revision 1.61 1999/03/02 11:43:21 armin
56 * Added variable to store connect-message of Modem.
57 * Added Timer-define for RegS7 (Wait for Carrier).
59 * Revision 1.60 1998/10/25 14:50:29 fritz
60 * Backported from MIPS (Cobalt).
62 * Revision 1.59 1998/10/23 10:18:55 paul
63 * Implementation of "dialmode" (successor of "status")
64 * You also need current isdnctrl for this!
66 * Revision 1.58 1998/10/23 10:10:06 fritz
67 * Test-Checkin
69 * Revision 1.57 1998/08/31 21:10:01 he
70 * new ioctl IIOCNETGPN for /dev/isdninfo (get network interface'
71 * peer phone number)
73 * Revision 1.56 1998/07/26 18:46:52 armin
74 * Added silence detection in voice receive mode.
76 * Revision 1.55 1998/06/26 15:13:17 fritz
77 * Added handling of STAT_ICALL with incomplete CPN.
78 * Added AT&L for ttyI emulator.
79 * Added more locking stuff in tty_write.
81 * Revision 1.54 1998/06/18 23:32:01 fritz
82 * Replaced cli()/restore_flags() in isdn_tty_write() by locking.
83 * Removed direct-senddown feature in isdn_tty_write because it will
84 * never succeed with locking and is useless anyway.
86 * Revision 1.53 1998/06/17 19:51:51 he
87 * merged with 2.1.10[34] (cosmetics and udelay() -> mdelay())
88 * brute force fix to avoid Ugh's in isdn_tty_write()
89 * cleaned up some dead code
91 * Revision 1.46 1998/04/14 16:28:59 he
92 * Fixed user space access with interrupts off and remaining
93 * copy_{to,from}_user() -> -EFAULT return codes
95 * Revision 1.45 1998/03/24 16:33:12 hipp
96 * More CCP changes. BSD compression now "works" on a local loopback link.
97 * Moved some isdn_ppp stuff from isdn.h to isdn_ppp.h
99 * Revision 1.44 1998/03/22 18:50:56 hipp
100 * Added BSD Compression for syncPPP .. UNTESTED at the moment
102 * Revision 1.43 1998/03/09 17:46:44 he
103 * merged in 2.1.89 changes
106 * Revision 1.40 1998/03/08 01:08:29 fritz
107 * Increased NET_DV because of TIMRU
109 * Revision 1.39 1998/03/07 22:42:49 fritz
110 * Starting generic module support (Nothing usable yet).
112 * Revision 1.38 1998/03/07 18:21:29 cal
113 * Dynamic Timeout-Rule-Handling vs. 971110 included
115 * Revision 1.37 1998/02/22 19:45:24 fritz
116 * Some changes regarding V.110
118 * Revision 1.36 1998/02/20 17:35:55 fritz
119 * Added V.110 stuff.
121 * Revision 1.35 1998/01/31 22:14:14 keil
122 * changes for 2.1.82
124 * Revision 1.34 1997/10/09 21:28:11 fritz
125 * New HL<->LL interface:
126 * New BSENT callback with nr. of bytes included.
127 * Sending without ACK.
128 * New L1 error status (not yet in use).
129 * Cleaned up obsolete structures.
130 * Implemented Cisco-SLARP.
131 * Changed local net-interface data to be dynamically allocated.
132 * Removed old 2.0 compatibility stuff.
134 * Revision 1.33 1997/08/21 14:44:22 fritz
135 * Moved triggercps to end of struct for backwards-compatibility.
137 * Revision 1.32 1997/08/21 09:49:46 fritz
138 * Increased NET_DV
140 * Revision 1.31 1997/06/22 11:57:07 fritz
141 * Added ability to adjust slave triggerlevel.
143 * Revision 1.30 1997/06/17 13:07:23 hipp
144 * compression changes , MP changes
146 * Revision 1.29 1997/05/27 15:18:02 fritz
147 * Added changes for recent 2.1.x kernels:
148 * changed return type of isdn_close
149 * queue_task_* -> queue_task
150 * clear/set_bit -> test_and_... where apropriate.
151 * changed type of hard_header_cache parameter.
153 * Revision 1.28 1997/03/07 01:33:01 fritz
154 * Added proper ifdef's for CONFIG_ISDN_AUDIO
156 * Revision 1.27 1997/03/05 21:11:49 fritz
157 * Minor fixes.
159 * Revision 1.26 1997/02/28 02:37:53 fritz
160 * Added some comments.
162 * Revision 1.25 1997/02/23 16:54:23 hipp
163 * some initial changes for future PPP compresion
165 * Revision 1.24 1997/02/18 09:42:45 fritz
166 * Bugfix: Increased ISDN_MODEM_ANZREG.
167 * Increased TTY_DV.
169 * Revision 1.23 1997/02/10 22:07:13 fritz
170 * Added 2 modem registers for numbering plan and screening info.
172 * Revision 1.22 1997/02/03 23:42:08 fritz
173 * Added ISDN_TIMER_RINGING
174 * Misc. changes for Kernel 2.1.X compatibility
176 * Revision 1.21 1997/01/17 01:19:10 fritz
177 * Applied chargeint patch.
179 * Revision 1.20 1997/01/17 00:41:19 fritz
180 * Increased TTY_DV.
182 * Revision 1.19 1997/01/14 01:41:07 fritz
183 * Added ATI2 related variables.
184 * Added variables for audio support in skbuffs.
186 * Revision 1.18 1996/11/06 17:37:50 keil
187 * more changes for 2.1.X
189 * Revision 1.17 1996/09/07 12:53:57 hipp
190 * moved a few isdn_ppp.c specific defines to drives/isdn/isdn_ppp.h
192 * Revision 1.16 1996/08/12 16:20:56 hipp
193 * renamed ppp_minor to ppp_slot
195 * Revision 1.15 1996/06/15 14:56:57 fritz
196 * Added version signatures for data structures used
197 * by userlevel programs.
199 * Revision 1.14 1996/06/06 21:24:23 fritz
200 * Started adding support for suspend/resume.
202 * Revision 1.13 1996/06/05 02:18:20 fritz
203 * Added DTMF decoding stuff.
205 * Revision 1.12 1996/06/03 19:55:08 fritz
206 * Fixed typos.
208 * Revision 1.11 1996/05/31 01:37:47 fritz
209 * Minor changes, due to changes in isdn_tty.c
211 * Revision 1.10 1996/05/18 01:37:18 fritz
212 * Added spelling corrections and some minor changes
213 * to stay in sync with kernel.
215 * Revision 1.9 1996/05/17 03:58:20 fritz
216 * Added flags for DLE handling.
218 * Revision 1.8 1996/05/11 21:49:55 fritz
219 * Removed queue management variables.
220 * Changed queue management to use sk_buffs.
222 * Revision 1.7 1996/05/07 09:10:06 fritz
223 * Reorganized tty-related structs.
225 * Revision 1.6 1996/05/06 11:38:27 hipp
226 * minor change in ippp struct
228 * Revision 1.5 1996/04/30 11:03:16 fritz
229 * Added Michael's ippp-bind patch.
231 * Revision 1.4 1996/04/29 23:00:02 fritz
232 * Added variables for voice-support.
234 * Revision 1.3 1996/04/20 16:54:58 fritz
235 * Increased maximum number of channels.
236 * Added some flags for isdn_net to handle callback more reliable.
237 * Fixed delay-definitions to be more accurate.
238 * Misc. typos
240 * Revision 1.2 1996/02/11 02:10:02 fritz
241 * Changed IOCTL-names
242 * Added rx_netdev, st_netdev, first_skb, org_hcb, and org_hcu to
243 * Netdevice-local struct.
245 * Revision 1.1 1996/01/10 20:55:07 fritz
246 * Initial revision
250 #ifndef isdn_h
251 #define isdn_h
253 #include <linux/isdn_compat.h>
254 #include <linux/config.h>
255 #include <linux/ioctl.h>
257 #define ISDN_TTY_MAJOR 43
258 #define ISDN_TTYAUX_MAJOR 44
259 #define ISDN_MAJOR 45
261 /* The minor-devicenumbers for Channel 0 and 1 are used as arguments for
262 * physical Channel-Mapping, so they MUST NOT be changed without changing
263 * the correspondent code in isdn.c
266 #ifdef CONFIG_COBALT_MICRO_SERVER
267 /* Save memory */
268 #define ISDN_MAX_DRIVERS 2
269 #define ISDN_MAX_CHANNELS 8
270 #else
271 #define ISDN_MAX_DRIVERS 32
272 #define ISDN_MAX_CHANNELS 64
273 #endif
274 #define ISDN_MINOR_B 0
275 #define ISDN_MINOR_BMAX (ISDN_MAX_CHANNELS-1)
276 #define ISDN_MINOR_CTRL 64
277 #define ISDN_MINOR_CTRLMAX (64 + (ISDN_MAX_CHANNELS-1))
278 #define ISDN_MINOR_PPP 128
279 #define ISDN_MINOR_PPPMAX (128 + (ISDN_MAX_CHANNELS-1))
280 #define ISDN_MINOR_STATUS 255
282 /* New ioctl-codes */
283 #define IIOCNETAIF _IO('I',1)
284 #define IIOCNETDIF _IO('I',2)
285 #define IIOCNETSCF _IO('I',3)
286 #define IIOCNETGCF _IO('I',4)
287 #define IIOCNETANM _IO('I',5)
288 #define IIOCNETDNM _IO('I',6)
289 #define IIOCNETGNM _IO('I',7)
290 #define IIOCGETSET _IO('I',8) /* no longer supported */
291 #define IIOCSETSET _IO('I',9) /* no longer supported */
292 #define IIOCSETVER _IO('I',10)
293 #define IIOCNETHUP _IO('I',11)
294 #define IIOCSETGST _IO('I',12)
295 #define IIOCSETBRJ _IO('I',13)
296 #define IIOCSIGPRF _IO('I',14)
297 #define IIOCGETPRF _IO('I',15)
298 #define IIOCSETPRF _IO('I',16)
299 #define IIOCGETMAP _IO('I',17)
300 #define IIOCSETMAP _IO('I',18)
301 #define IIOCNETASL _IO('I',19)
302 #define IIOCNETDIL _IO('I',20)
303 #define IIOCGETCPS _IO('I',21)
304 #define IIOCGETDVR _IO('I',22)
306 #define IIOCNETALN _IO('I',32)
307 #define IIOCNETDLN _IO('I',33)
309 #define IIOCNETGPN _IO('I',34)
311 #define IIOCDBGVAR _IO('I',127)
313 #define IIOCDRVCTL _IO('I',128)
315 /* Packet encapsulations for net-interfaces */
316 #define ISDN_NET_ENCAP_ETHER 0
317 #define ISDN_NET_ENCAP_RAWIP 1
318 #define ISDN_NET_ENCAP_IPTYP 2
319 #define ISDN_NET_ENCAP_CISCOHDLC 3 /* Without SLARP and keepalive */
320 #define ISDN_NET_ENCAP_SYNCPPP 4
321 #define ISDN_NET_ENCAP_UIHDLC 5
322 #define ISDN_NET_ENCAP_CISCOHDLCK 6 /* With SLARP and keepalive */
323 #define ISDN_NET_ENCAP_X25IFACE 7 /* Documentation/networking/x25-iface.txt*/
324 #define ISDN_NET_ENCAP_MAX_ENCAP ISDN_NET_ENCAP_X25IFACE
325 /* Facility which currently uses an ISDN-channel */
326 #define ISDN_USAGE_NONE 0
327 #define ISDN_USAGE_RAW 1
328 #define ISDN_USAGE_MODEM 2
329 #define ISDN_USAGE_NET 3
330 #define ISDN_USAGE_VOICE 4
331 #define ISDN_USAGE_FAX 5
332 #define ISDN_USAGE_MASK 7 /* Mask to get plain usage */
333 #define ISDN_USAGE_DISABLED 32 /* This bit is set, if channel is disabled */
334 #define ISDN_USAGE_EXCLUSIVE 64 /* This bit is set, if channel is exclusive */
335 #define ISDN_USAGE_OUTGOING 128 /* This bit is set, if channel is outgoing */
337 #define ISDN_MODEM_ANZREG 24 /* Number of Modem-Registers */
338 #define ISDN_MSNLEN 20
339 #define ISDN_LMSNLEN 255 /* Length of tty's Listen-MSN string */
340 #define ISDN_CMSGLEN 50 /* Length of CONNECT-Message to add for Modem */
342 typedef struct {
343 char drvid[25];
344 unsigned long arg;
345 } isdn_ioctl_struct;
347 typedef struct {
348 unsigned long isdndev;
349 unsigned long atmodem[ISDN_MAX_CHANNELS];
350 unsigned long info[ISDN_MAX_CHANNELS];
351 } debugvar_addr;
353 typedef struct {
354 char name[10];
355 char phone[ISDN_MSNLEN];
356 int outgoing;
357 } isdn_net_ioctl_phone;
359 #define NET_DV 0x05 /* Data version for isdn_net_ioctl_cfg */
360 #define TTY_DV 0x05 /* Data version for iprofd etc. */
361 #define INF_DV 0x01 /* Data version for /dev/isdninfo */
363 typedef struct {
364 char name[10]; /* Name of interface */
365 char master[10]; /* Name of Master for Bundling */
366 char slave[10]; /* Name of Slave for Bundling */
367 char eaz[256]; /* EAZ/MSN */
368 char drvid[25]; /* DriverId for Bindings */
369 int onhtime; /* Hangup-Timeout */
370 int charge; /* Charge-Units */
371 int l2_proto; /* Layer-2 protocol */
372 int l3_proto; /* Layer-3 protocol */
373 int p_encap; /* Encapsulation */
374 int exclusive; /* Channel, if bound exclusive */
375 int dialmax; /* Dial Retry-Counter */
376 int slavedelay; /* Delay until slave starts up */
377 int cbdelay; /* Delay before Callback */
378 int chargehup; /* Flag: Charge-Hangup */
379 int ihup; /* Flag: Hangup-Timeout on incoming line */
380 int secure; /* Flag: Secure */
381 int callback; /* Flag: Callback */
382 int cbhup; /* Flag: Reject Call before Callback */
383 int pppbind; /* ippp device for bindings */
384 int chargeint; /* Use fixed charge interval length */
385 int triggercps; /* BogoCPS needed for triggering slave */
386 int dialtimeout; /* Dial-Timeout */
387 int dialwait; /* Time to wait after failed dial */
388 int dialmode; /* Flag: off / on / auto */
389 } isdn_net_ioctl_cfg;
391 #define ISDN_NET_DIALMODE_MASK 0xC0 /* bits for status */
392 #define ISDN_NET_DM_OFF 0x00 /* this interface is stopped */
393 #define ISDN_NET_DM_MANUAL 0x40 /* this interface is on (manual) */
394 #define ISDN_NET_DM_AUTO 0x80 /* this interface is autodial */
395 #define ISDN_NET_DIALMODE(x) ((&(x))->flags & ISDN_NET_DIALMODE_MASK)
397 #ifdef __KERNEL__
399 #include <linux/errno.h>
400 #include <linux/fs.h>
401 #include <linux/major.h>
402 #include <asm/segment.h>
403 #include <asm/io.h>
404 #include <linux/kernel.h>
405 #include <linux/signal.h>
406 #include <linux/malloc.h>
407 #include <linux/timer.h>
408 #include <linux/wait.h>
409 #include <linux/tty.h>
410 #include <linux/tty_flip.h>
411 #include <linux/serial_reg.h>
412 #include <linux/fcntl.h>
413 #include <linux/types.h>
414 #include <linux/interrupt.h>
415 #include <linux/ip.h>
416 #include <linux/in.h>
417 #include <linux/netdevice.h>
418 #include <linux/etherdevice.h>
419 #include <linux/skbuff.h>
420 #include <linux/tcp.h>
422 #ifdef CONFIG_ISDN_PPP
424 #ifdef CONFIG_ISDN_PPP_VJ
425 # include <net/slhc_vj.h>
426 #endif
428 #include <linux/ppp_defs.h>
429 #include <linux/if_ppp.h>
430 #include <linux/if_pppvar.h>
432 #include <linux/isdn_ppp.h>
433 #endif
435 #ifdef CONFIG_ISDN_X25
436 # include <linux/concap.h>
437 #endif
439 #include <linux/isdnif.h>
442 #define ISDN_DRVIOCTL_MASK 0x7f /* Mask for Device-ioctl */
444 /* Until now unused */
445 #define ISDN_SERVICE_VOICE 1
446 #define ISDN_SERVICE_AB 1<<1
447 #define ISDN_SERVICE_X21 1<<2
448 #define ISDN_SERVICE_G4 1<<3
449 #define ISDN_SERVICE_BTX 1<<4
450 #define ISDN_SERVICE_DFUE 1<<5
451 #define ISDN_SERVICE_X25 1<<6
452 #define ISDN_SERVICE_TTX 1<<7
453 #define ISDN_SERVICE_MIXED 1<<8
454 #define ISDN_SERVICE_FW 1<<9
455 #define ISDN_SERVICE_GTEL 1<<10
456 #define ISDN_SERVICE_BTXN 1<<11
457 #define ISDN_SERVICE_BTEL 1<<12
459 /* Macros checking plain usage */
460 #define USG_NONE(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NONE)
461 #define USG_RAW(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_RAW)
462 #define USG_MODEM(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM)
463 #define USG_VOICE(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE)
464 #define USG_NET(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NET)
465 #define USG_FAX(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_FAX)
466 #define USG_OUTGOING(x) ((x & ISDN_USAGE_OUTGOING)==ISDN_USAGE_OUTGOING)
467 #define USG_MODEMORVOICE(x) (((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM) || \
468 ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE) )
470 /* Timer-delays and scheduling-flags */
471 #define ISDN_TIMER_RES 3 /* Main Timer-Resolution */
472 #define ISDN_TIMER_02SEC (HZ/(ISDN_TIMER_RES+1)/5) /* Slow-Timer1 .2 sec */
473 #define ISDN_TIMER_1SEC (HZ/(ISDN_TIMER_RES+1)) /* Slow-Timer2 1 sec */
474 #define ISDN_TIMER_RINGING 5 /* tty RINGs = ISDN_TIMER_1SEC * this factor */
475 #define ISDN_TIMER_KEEPINT 10 /* Cisco-Keepalive = ISDN_TIMER_1SEC * this factor */
476 #define ISDN_TIMER_MODEMREAD 1
477 #define ISDN_TIMER_MODEMPLUS 2
478 #define ISDN_TIMER_MODEMRING 4
479 #define ISDN_TIMER_MODEMXMIT 8
480 #define ISDN_TIMER_NETDIAL 16
481 #define ISDN_TIMER_NETHANGUP 32
482 #define ISDN_TIMER_IPPP 64
483 #define ISDN_TIMER_KEEPALIVE 128 /* Cisco-Keepalive */
484 #define ISDN_TIMER_CARRIER 256 /* Wait for Carrier */
485 #define ISDN_TIMER_FAST (ISDN_TIMER_MODEMREAD | ISDN_TIMER_MODEMPLUS | \
486 ISDN_TIMER_MODEMXMIT)
487 #define ISDN_TIMER_SLOW (ISDN_TIMER_MODEMRING | ISDN_TIMER_NETHANGUP | \
488 ISDN_TIMER_NETDIAL | ISDN_TIMER_KEEPALIVE | \
489 ISDN_TIMER_CARRIER)
491 /* Timeout-Values for isdn_net_dial() */
492 #define ISDN_TIMER_DTIMEOUT10 (10*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
493 #define ISDN_TIMER_DTIMEOUT15 (15*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
494 #define ISDN_TIMER_DTIMEOUT60 (60*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
496 /* GLOBAL_FLAGS */
497 #define ISDN_GLOBAL_STOPPED 1
499 /*=================== Start of ip-over-ISDN stuff =========================*/
501 /* Feature- and status-flags for a net-interface */
502 #define ISDN_NET_CONNECTED 0x01 /* Bound to ISDN-Channel */
503 #define ISDN_NET_SECURE 0x02 /* Accept calls from phonelist only */
504 #define ISDN_NET_CALLBACK 0x04 /* activate callback */
505 #define ISDN_NET_CBHUP 0x08 /* hangup before callback */
506 #define ISDN_NET_CBOUT 0x10 /* remote machine does callback */
507 #if 0
508 /* Unused??? */
509 #define ISDN_NET_CLONE 0x08 /* clone a tmp interface when called */
510 #define ISDN_NET_TMP 0x10 /* tmp interface until getting an IP */
511 #define ISDN_NET_DYNAMIC 0x20 /* this link is dynamically allocated */
512 #endif
514 #define ISDN_NET_MAGIC 0x49344C02 /* for paranoia-checking */
516 /* Phone-list-element */
517 typedef struct {
518 void *next;
519 char num[ISDN_MSNLEN];
520 } isdn_net_phone;
523 Principles when extending structures for generic encapsulation protocol
524 ("concap") support:
525 - Stuff which is hardware specific (here i4l-specific) goes in
526 the netdev -> local structure (here: isdn_net_local)
527 - Stuff which is encapsulation protocol specific goes in the structure
528 which holds the linux device structure (here: isdn_net_device)
531 /* Local interface-data */
532 typedef struct isdn_net_local_s {
533 ulong magic;
534 char name[10]; /* Name of device */
535 struct enet_statistics stats; /* Ethernet Statistics */
536 int isdn_device; /* Index to isdn-device */
537 int isdn_channel; /* Index to isdn-channel */
538 int ppp_slot; /* PPPD device slot number */
539 int pre_device; /* Preselected isdn-device */
540 int pre_channel; /* Preselected isdn-channel */
541 int exclusive; /* If non-zero idx to reserved chan.*/
542 int flags; /* Connection-flags */
543 int dialretry; /* Counter for Dialout-retries */
544 int dialmax; /* Max. Number of Dial-retries */
545 int cbdelay; /* Delay before Callback starts */
546 int dtimer; /* Timeout-counter for dialing */
547 char msn[ISDN_MSNLEN]; /* MSNs/EAZs for this interface */
548 u_char cbhup; /* Flag: Reject Call before Callback*/
549 u_char dialstate; /* State for dialing */
550 u_char p_encap; /* Packet encapsulation */
551 /* 0 = Ethernet over ISDN */
552 /* 1 = RAW-IP */
553 /* 2 = IP with type field */
554 u_char l2_proto; /* Layer-2-protocol */
555 /* See ISDN_PROTO_L2..-constants in */
556 /* isdnif.h */
557 /* 0 = X75/LAPB with I-Frames */
558 /* 1 = X75/LAPB with UI-Frames */
559 /* 2 = X75/LAPB with BUI-Frames */
560 /* 3 = HDLC */
561 u_char l3_proto; /* Layer-3-protocol */
562 /* See ISDN_PROTO_L3..-constants in */
563 /* isdnif.h */
564 /* 0 = Transparent */
565 int huptimer; /* Timeout-counter for auto-hangup */
566 int charge; /* Counter for charging units */
567 int chargetime; /* Timer for Charging info */
568 int hupflags; /* Flags for charge-unit-hangup: */
569 /* bit0: chargeint is invalid */
570 /* bit1: Getting charge-interval */
571 /* bit2: Do charge-unit-hangup */
572 /* bit3: Do hangup even on incoming */
573 int outgoing; /* Flag: outgoing call */
574 int onhtime; /* Time to keep link up */
575 int chargeint; /* Interval between charge-infos */
576 int onum; /* Flag: at least 1 outgoing number */
577 int cps; /* current speed of this interface */
578 int transcount; /* byte-counter for cps-calculation */
579 int sqfull; /* Flag: netdev-queue overloaded */
580 ulong sqfull_stamp; /* Start-Time of overload */
581 ulong slavedelay; /* Dynamic bundling delaytime */
582 int triggercps; /* BogoCPS needed for trigger slave */
583 struct net_device *srobin; /* Ptr to Master device for slaves */
584 isdn_net_phone *phone[2]; /* List of remote-phonenumbers */
585 /* phone[0] = Incoming Numbers */
586 /* phone[1] = Outgoing Numbers */
587 isdn_net_phone *dial; /* Pointer to dialed number */
588 struct net_device *master; /* Ptr to Master device for slaves */
589 struct net_device *slave; /* Ptr to Slave device for masters */
590 struct isdn_net_local_s *next; /* Ptr to next link in bundle */
591 struct isdn_net_local_s *last; /* Ptr to last link in bundle */
592 struct isdn_net_dev_s *netdev; /* Ptr to netdev */
593 struct sk_buff *first_skb; /* Ptr to skb that triggers dialing */
594 struct sk_buff *sav_skb; /* Ptr to skb, rejected by LL-driver*/
595 /* Ptr to orig. hard_header_cache */
596 int (*org_hhc)(
597 struct neighbour *neigh,
598 struct hh_cache *hh);
599 /* Ptr to orig. header_cache_update */
600 void (*org_hcu)(struct hh_cache *,
601 struct net_device *,
602 unsigned char *);
603 int pppbind; /* ippp device for bindings */
604 int dialtimeout; /* How long shall we try on dialing? (jiffies) */
605 int dialwait; /* How long shall we wait after failed attempt? (jiffies) */
606 ulong dialstarted; /* jiffies of first dialing-attempt */
607 ulong dialwait_timer; /* jiffies of earliest next dialing-attempt */
608 int huptimeout; /* How long will the connection be up? (seconds) */
609 #ifdef CONFIG_ISDN_X25
610 struct concap_device_ops *dops; /* callbacks used by encapsulator */
611 #endif
612 int cisco_loop; /* Loop counter for Cisco-SLARP */
613 ulong cisco_myseq; /* Local keepalive seq. for Cisco */
614 ulong cisco_yourseq; /* Remote keepalive seq. for Cisco */
615 } isdn_net_local;
617 /* the interface itself */
618 typedef struct isdn_net_dev_s {
619 isdn_net_local *local;
620 isdn_net_local *queue;
621 void *next; /* Pointer to next isdn-interface */
622 struct net_device dev; /* interface to upper levels */
623 #ifdef CONFIG_ISDN_PPP
624 struct mpqueue *mp_last;
625 struct ippp_bundle ib;
626 #endif
627 #ifdef CONFIG_ISDN_X25
628 struct concap_proto *cprot; /* connection oriented encapsulation protocol */
629 #endif
631 } isdn_net_dev;
633 /*===================== End of ip-over-ISDN stuff ===========================*/
635 /*======================= Start of ISDN-tty stuff ===========================*/
637 #define ISDN_ASYNC_MAGIC 0x49344C01 /* for paranoia-checking */
638 #define ISDN_ASYNC_INITIALIZED 0x80000000 /* port was initialized */
639 #define ISDN_ASYNC_CALLOUT_ACTIVE 0x40000000 /* Call out device active */
640 #define ISDN_ASYNC_NORMAL_ACTIVE 0x20000000 /* Normal device active */
641 #define ISDN_ASYNC_CLOSING 0x08000000 /* Serial port is closing */
642 #define ISDN_ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */
643 #define ISDN_ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */
644 #define ISDN_ASYNC_HUP_NOTIFY 0x0001 /* Notify tty on hangups/closes */
645 #define ISDN_ASYNC_SESSION_LOCKOUT 0x0100 /* Lock cua opens on session */
646 #define ISDN_ASYNC_PGRP_LOCKOUT 0x0200 /* Lock cua opens on pgrp */
647 #define ISDN_ASYNC_CALLOUT_NOHUP 0x0400 /* No hangup for cui */
648 #define ISDN_ASYNC_SPLIT_TERMIOS 0x0008 /* Sep. termios for dialin/out */
649 #define ISDN_SERIAL_XMIT_SIZE 1024 /* Default bufsize for write */
650 #define ISDN_SERIAL_XMIT_MAX 4000 /* Maximum bufsize for write */
651 #define ISDN_SERIAL_TYPE_NORMAL 1
652 #define ISDN_SERIAL_TYPE_CALLOUT 2
654 #ifdef CONFIG_ISDN_AUDIO
655 /* For using sk_buffs with audio we need some private variables
656 * within each sk_buff. For this purpose, we declare a struct here,
657 * and put it always at skb->head. A few macros help accessing the
658 * variables. Of course, we need to check skb_headroom prior to
659 * any access.
661 typedef struct isdn_audio_skb {
662 unsigned short dle_count;
663 unsigned char lock;
664 } isdn_audio_skb;
666 #define ISDN_AUDIO_SKB_DLECOUNT(skb) (((isdn_audio_skb*)skb->head)->dle_count)
667 #define ISDN_AUDIO_SKB_LOCK(skb) (((isdn_audio_skb*)skb->head)->lock)
668 #endif
670 /* Private data of AT-command-interpreter */
671 typedef struct atemu {
672 u_char profile[ISDN_MODEM_ANZREG]; /* Modem-Regs. Profile 0 */
673 u_char mdmreg[ISDN_MODEM_ANZREG]; /* Modem-Registers */
674 char pmsn[ISDN_MSNLEN]; /* EAZ/MSNs Profile 0 */
675 char msn[ISDN_MSNLEN]; /* EAZ/MSN */
676 char plmsn[ISDN_LMSNLEN]; /* Listening MSNs Profile 0 */
677 char lmsn[ISDN_LMSNLEN]; /* Listening MSNs */
678 char cpn[ISDN_MSNLEN]; /* CalledPartyNumber on incoming call */
679 char connmsg[ISDN_CMSGLEN]; /* CONNECT-Msg from HL-Driver */
680 #ifdef CONFIG_ISDN_AUDIO
681 u_char vpar[10]; /* Voice-parameters */
682 int lastDLE; /* Flag for voice-coding: DLE seen */
683 #endif
684 int mdmcmdl; /* Length of Modem-Commandbuffer */
685 int pluscount; /* Counter for +++ sequence */
686 int lastplus; /* Timestamp of last + */
687 int carrierwait; /* Seconds of carrier waiting */
688 char mdmcmd[255]; /* Modem-Commandbuffer */
689 unsigned int charge; /* Charge units of current connection */
690 } atemu;
692 /* Private data (similar to async_struct in <linux/serial.h>) */
693 typedef struct modem_info {
694 int magic;
695 int flags; /* defined in tty.h */
696 int x_char; /* xon/xoff character */
697 int mcr; /* Modem control register */
698 int msr; /* Modem status register */
699 int lsr; /* Line status register */
700 int line;
701 int count; /* # of fd on device */
702 int blocked_open; /* # of blocked opens */
703 long session; /* Session of opening process */
704 long pgrp; /* pgrp of opening process */
705 int online; /* 1 = B-Channel is up, drop data */
706 /* 2 = B-Channel is up, deliver d.*/
707 int dialing; /* Dial in progress or ATA */
708 int rcvsched; /* Receive needs schedule */
709 int isdn_driver; /* Index to isdn-driver */
710 int isdn_channel; /* Index to isdn-channel */
711 int drv_index; /* Index to dev->usage */
712 int ncarrier; /* Flag: schedule NO CARRIER */
713 unsigned char last_cause[8]; /* Last cause message */
714 unsigned char last_num[ISDN_MSNLEN];
715 /* Last phone-number */
716 unsigned char last_l2; /* Last layer-2 protocol */
717 unsigned char last_si; /* Last service */
718 unsigned char last_lhup; /* Last hangup local? */
719 unsigned char last_dir; /* Last direction (in or out) */
720 struct timer_list nc_timer; /* Timer for delayed NO CARRIER */
721 int send_outstanding;/* # of outstanding send-requests */
722 int xmit_size; /* max. # of chars in xmit_buf */
723 int xmit_count; /* # of chars in xmit_buf */
724 unsigned char *xmit_buf; /* transmit buffer */
725 struct sk_buff_head xmit_queue; /* transmit queue */
726 atomic_t xmit_lock; /* Semaphore for isdn_tty_write */
727 #ifdef CONFIG_ISDN_AUDIO
728 int vonline; /* Voice-channel status */
729 /* Bit 0 = recording */
730 /* Bit 1 = playback */
731 /* Bit 2 = playback, DLE-ETX seen */
732 struct sk_buff_head dtmf_queue; /* queue for dtmf results */
733 void *adpcms; /* state for adpcm decompression */
734 void *adpcmr; /* state for adpcm compression */
735 void *dtmf_state; /* state for dtmf decoder */
736 void *silence_state; /* state for silence detection */
737 #endif
738 #ifdef CONFIG_ISDN_TTY_FAX
739 struct T30_s *fax; /* T30 Fax Group 3 data/interface */
740 int faxonline; /* Fax-channel status */
741 #endif
742 struct tty_struct *tty; /* Pointer to corresponding tty */
743 atemu emu; /* AT-emulator data */
744 struct termios normal_termios; /* For saving termios structs */
745 struct termios callout_termios;
746 #ifdef COMPAT_HAS_NEW_WAITQ
747 wait_queue_head_t open_wait, close_wait;
748 #else
749 struct wait_queue *open_wait;
750 struct wait_queue *close_wait;
751 #endif
752 struct semaphore write_sem;
753 } modem_info;
755 #define ISDN_MODEM_WINSIZE 8
757 /* Description of one ISDN-tty */
758 typedef struct {
759 int refcount; /* Number of opens */
760 struct tty_driver tty_modem; /* tty-device */
761 struct tty_driver cua_modem; /* cua-device */
762 struct tty_struct *modem_table[ISDN_MAX_CHANNELS]; /* ?? copied from Orig */
763 struct termios *modem_termios[ISDN_MAX_CHANNELS];
764 struct termios *modem_termios_locked[ISDN_MAX_CHANNELS];
765 modem_info info[ISDN_MAX_CHANNELS]; /* Private data */
766 } modem;
768 /*======================= End of ISDN-tty stuff ============================*/
770 /*======================== Start of V.110 stuff ============================*/
771 #define V110_BUFSIZE 1024
773 typedef struct {
774 int nbytes; /* 1 Matrixbyte -> nbytes in stream */
775 int nbits; /* Number of used bits in streambyte */
776 unsigned char key; /* Bitmask in stream eg. 11 (nbits=2) */
777 int decodelen; /* Amount of data in decodebuf */
778 int SyncInit; /* Number of sync frames to send */
779 unsigned char *OnlineFrame; /* Precalculated V110 idle frame */
780 unsigned char *OfflineFrame; /* Precalculated V110 sync Frame */
781 int framelen; /* Length of frames */
782 int skbuser; /* Number of unacked userdata skbs */
783 int skbidle; /* Number of unacked idle/sync skbs */
784 int introducer; /* Local vars for decoder */
785 int dbit;
786 unsigned char b;
787 int skbres; /* space to reserve in outgoing skb */
788 int maxsize; /* maxbufsize of lowlevel driver */
789 unsigned char *encodebuf; /* temporary buffer for encoding */
790 unsigned char decodebuf[V110_BUFSIZE]; /* incomplete V110 matrices */
791 } isdn_v110_stream;
793 /*========================= End of V.110 stuff =============================*/
795 /*======================= Start of general stuff ===========================*/
797 typedef struct {
798 char *next;
799 char *private;
800 } infostruct;
802 typedef struct isdn_module {
803 struct isdn_module *prev;
804 struct isdn_module *next;
805 char *name;
806 int (*get_free_channel)(int, int, int, int, int);
807 int (*free_channel)(int, int, int);
808 int (*status_callback)(isdn_ctrl *);
809 int (*command)(isdn_ctrl *);
810 int (*receive_callback)(int, int, struct sk_buff *);
811 int (*writebuf_skb)(int, int, int, struct sk_buff *);
812 int (*net_start_xmit)(struct sk_buff *, struct net_device *);
813 int (*net_receive)(struct net_device *, struct sk_buff *);
814 int (*net_open)(struct net_device *);
815 int (*net_close)(struct net_device *);
816 int priority;
817 } isdn_module;
819 #define DRV_FLAG_RUNNING 1
820 #define DRV_FLAG_REJBUS 2
821 #define DRV_FLAG_LOADED 4
823 /* Description of hardware-level-driver */
824 typedef struct {
825 ulong online; /* Channel-Online flags */
826 ulong flags; /* Misc driver Flags */
827 int locks; /* Number of locks for this driver */
828 int channels; /* Number of channels */
829 #ifdef COMPAT_HAS_NEW_WAITQ
830 wait_queue_head_t st_waitq; /* Wait-Queue for status-read's */
831 #else
832 struct wait_queue *st_waitq; /* Wait-Queue for status-read's */
833 #endif
834 int maxbufsize; /* Maximum Buffersize supported */
835 unsigned long pktcount; /* Until now: unused */
836 int stavail; /* Chars avail on Status-device */
837 isdn_if *interface; /* Interface to driver */
838 int *rcverr; /* Error-counters for B-Ch.-receive */
839 int *rcvcount; /* Byte-counters for B-Ch.-receive */
840 #ifdef CONFIG_ISDN_AUDIO
841 unsigned long DLEflag; /* Flags: Insert DLE at next read */
842 #endif
843 struct sk_buff_head *rpqueue; /* Pointers to start of Rcv-Queue */
844 #ifdef COMPAT_HAS_NEW_WAITQ
845 wait_queue_head_t *rcv_waitq; /* Wait-Queues for B-Channel-Reads */
846 wait_queue_head_t *snd_waitq; /* Wait-Queue for B-Channel-Send's */
847 #else
848 struct wait_queue **rcv_waitq; /* Wait-Queues for B-Channel-Reads */
849 struct wait_queue **snd_waitq; /* Wait-Queue for B-Channel-Send's */
850 #endif
851 char msn2eaz[10][ISDN_MSNLEN]; /* Mapping-Table MSN->EAZ */
852 } driver;
854 /* Main driver-data */
855 typedef struct isdn_devt {
856 unsigned short flags; /* Bitmapped Flags: */
857 /* */
858 int drivers; /* Current number of drivers */
859 int channels; /* Current number of channels */
860 int net_verbose; /* Verbose-Flag */
861 int modempoll; /* Flag: tty-read active */
862 int tflags; /* Timer-Flags: */
863 /* see ISDN_TIMER_..defines */
864 int global_flags;
865 infostruct *infochain; /* List of open info-devs. */
866 #ifdef COMPAT_HAS_NEW_WAITQ
867 wait_queue_head_t info_waitq; /* Wait-Queue for isdninfo */
868 #else
869 struct wait_queue *info_waitq; /* Wait-Queue for isdninfo */
870 #endif
871 struct timer_list timer; /* Misc.-function Timer */
872 int chanmap[ISDN_MAX_CHANNELS];/* Map minor->device-channel */
873 int drvmap[ISDN_MAX_CHANNELS]; /* Map minor->driver-index */
874 int usage[ISDN_MAX_CHANNELS]; /* Used by tty/ip/voice */
875 char num[ISDN_MAX_CHANNELS][ISDN_MSNLEN];
876 /* Remote number of active ch.*/
877 int m_idx[ISDN_MAX_CHANNELS]; /* Index for mdm.... */
878 driver *drv[ISDN_MAX_DRIVERS]; /* Array of drivers */
879 isdn_net_dev *netdev; /* Linked list of net-if's */
880 char drvid[ISDN_MAX_DRIVERS][20];/* Driver-ID */
881 struct task_struct *profd; /* For iprofd */
882 modem mdm; /* tty-driver-data */
883 isdn_net_dev *rx_netdev[ISDN_MAX_CHANNELS]; /* rx netdev-pointers */
884 isdn_net_dev *st_netdev[ISDN_MAX_CHANNELS]; /* stat netdev-pointers */
885 ulong ibytes[ISDN_MAX_CHANNELS]; /* Statistics incoming bytes */
886 ulong obytes[ISDN_MAX_CHANNELS]; /* Statistics outgoing bytes */
887 int v110emu[ISDN_MAX_CHANNELS];/* V.110 emulator-mode 0=none */
888 atomic_t v110use[ISDN_MAX_CHANNELS];/* Usage-Semaphore for stream */
889 isdn_v110_stream *v110[ISDN_MAX_CHANNELS]; /* V.110 private data */
890 struct semaphore sem; /* serialize list access*/
891 isdn_module *modules;
892 } isdn_dev;
894 extern isdn_dev *dev;
897 /* Utility-Macros */
898 #define MIN(a,b) ((a<b)?a:b)
899 #define MAX(a,b) ((a>b)?a:b)
900 #endif /* __KERNEL__ */
901 #endif /* isdn_h */