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