2.2.0-final
[davej-history.git] / include / linux / isdn.h
blob0b61899c0c924cde2636039136017349dd610fa4
1 /* $Id: isdn.h,v 1.37 1998/02/22 19:45:24 fritz 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 * Note: This file differs from the corresponding revision as present in the
24 * isdn4linux CVS repository because some later bug fixes have been extracted
25 * from the repository and merged into this file. -- Henner Eisen
27 * $Log: isdn.h,v $
28 * Revision 1.37 1998/02/22 19:45:24 fritz
29 * Some changes regarding V.110
31 * Revision 1.36 1998/02/20 17:35:55 fritz
32 * Added V.110 stuff.
34 * Revision 1.35 1998/01/31 22:14:14 keil
35 * changes for 2.1.82
37 * Revision 1.34 1997/10/09 21:28:11 fritz
38 * New HL<->LL interface:
39 * New BSENT callback with nr. of bytes included.
40 * Sending without ACK.
41 * New L1 error status (not yet in use).
42 * Cleaned up obsolete structures.
43 * Implemented Cisco-SLARP.
44 * Changed local net-interface data to be dynamically allocated.
45 * Removed old 2.0 compatibility stuff.
47 * Revision 1.33 1997/08/21 14:44:22 fritz
48 * Moved triggercps to end of struct for backwards-compatibility.
50 * Revision 1.32 1997/08/21 09:49:46 fritz
51 * Increased NET_DV
53 * Revision 1.31 1997/06/22 11:57:07 fritz
54 * Added ability to adjust slave triggerlevel.
56 * Revision 1.30 1997/06/17 13:07:23 hipp
57 * compression changes , MP changes
59 * Revision 1.29 1997/05/27 15:18:02 fritz
60 * Added changes for recent 2.1.x kernels:
61 * changed return type of isdn_close
62 * queue_task_* -> queue_task
63 * clear/set_bit -> test_and_... where apropriate.
64 * changed type of hard_header_cache parameter.
66 * Revision 1.28 1997/03/07 01:33:01 fritz
67 * Added proper ifdef's for CONFIG_ISDN_AUDIO
69 * Revision 1.27 1997/03/05 21:11:49 fritz
70 * Minor fixes.
72 * Revision 1.26 1997/02/28 02:37:53 fritz
73 * Added some comments.
75 * Revision 1.25 1997/02/23 16:54:23 hipp
76 * some initial changes for future PPP compresion
78 * Revision 1.24 1997/02/18 09:42:45 fritz
79 * Bugfix: Increased ISDN_MODEM_ANZREG.
80 * Increased TTY_DV.
82 * Revision 1.23 1997/02/10 22:07:13 fritz
83 * Added 2 modem registers for numbering plan and screening info.
85 * Revision 1.22 1997/02/03 23:42:08 fritz
86 * Added ISDN_TIMER_RINGING
87 * Misc. changes for Kernel 2.1.X compatibility
89 * Revision 1.21 1997/01/17 01:19:10 fritz
90 * Applied chargeint patch.
92 * Revision 1.20 1997/01/17 00:41:19 fritz
93 * Increased TTY_DV.
95 * Revision 1.19 1997/01/14 01:41:07 fritz
96 * Added ATI2 related variables.
97 * Added variables for audio support in skbuffs.
99 * Revision 1.18 1996/11/06 17:37:50 keil
100 * more changes for 2.1.X
102 * Revision 1.17 1996/09/07 12:53:57 hipp
103 * moved a few isdn_ppp.c specific defines to drives/isdn/isdn_ppp.h
105 * Revision 1.16 1996/08/12 16:20:56 hipp
106 * renamed ppp_minor to ppp_slot
108 * Revision 1.15 1996/06/15 14:56:57 fritz
109 * Added version signatures for data structures used
110 * by userlevel programs.
112 * Revision 1.14 1996/06/06 21:24:23 fritz
113 * Started adding support for suspend/resume.
115 * Revision 1.13 1996/06/05 02:18:20 fritz
116 * Added DTMF decoding stuff.
118 * Revision 1.12 1996/06/03 19:55:08 fritz
119 * Fixed typos.
121 * Revision 1.11 1996/05/31 01:37:47 fritz
122 * Minor changes, due to changes in isdn_tty.c
124 * Revision 1.10 1996/05/18 01:37:18 fritz
125 * Added spelling corrections and some minor changes
126 * to stay in sync with kernel.
128 * Revision 1.9 1996/05/17 03:58:20 fritz
129 * Added flags for DLE handling.
131 * Revision 1.8 1996/05/11 21:49:55 fritz
132 * Removed queue management variables.
133 * Changed queue management to use sk_buffs.
135 * Revision 1.7 1996/05/07 09:10:06 fritz
136 * Reorganized tty-related structs.
138 * Revision 1.6 1996/05/06 11:38:27 hipp
139 * minor change in ippp struct
141 * Revision 1.5 1996/04/30 11:03:16 fritz
142 * Added Michael's ippp-bind patch.
144 * Revision 1.4 1996/04/29 23:00:02 fritz
145 * Added variables for voice-support.
147 * Revision 1.3 1996/04/20 16:54:58 fritz
148 * Increased maximum number of channels.
149 * Added some flags for isdn_net to handle callback more reliable.
150 * Fixed delay-definitions to be more accurate.
151 * Misc. typos
153 * Revision 1.2 1996/02/11 02:10:02 fritz
154 * Changed IOCTL-names
155 * Added rx_netdev, st_netdev, first_skb, org_hcb, and org_hcu to
156 * Netdevice-local struct.
158 * Revision 1.1 1996/01/10 20:55:07 fritz
159 * Initial revision
163 #ifndef isdn_h
164 #define isdn_h
166 #include <linux/ioctl.h>
168 #define ISDN_TTY_MAJOR 43
169 #define ISDN_TTYAUX_MAJOR 44
170 #define ISDN_MAJOR 45
172 /* The minor-devicenumbers for Channel 0 and 1 are used as arguments for
173 * physical Channel-Mapping, so they MUST NOT be changed without changing
174 * the correspondent code in isdn.c
177 #define ISDN_MAX_DRIVERS 32
178 #define ISDN_MAX_CHANNELS 64
179 #define ISDN_MINOR_B 0
180 #define ISDN_MINOR_BMAX (ISDN_MAX_CHANNELS-1)
181 #define ISDN_MINOR_CTRL ISDN_MAX_CHANNELS
182 #define ISDN_MINOR_CTRLMAX (2*ISDN_MAX_CHANNELS-1)
183 #define ISDN_MINOR_PPP (2*ISDN_MAX_CHANNELS)
184 #define ISDN_MINOR_PPPMAX (3*ISDN_MAX_CHANNELS-1)
185 #define ISDN_MINOR_STATUS 255
187 /* New ioctl-codes */
188 #define IIOCNETAIF _IO('I',1)
189 #define IIOCNETDIF _IO('I',2)
190 #define IIOCNETSCF _IO('I',3)
191 #define IIOCNETGCF _IO('I',4)
192 #define IIOCNETANM _IO('I',5)
193 #define IIOCNETDNM _IO('I',6)
194 #define IIOCNETGNM _IO('I',7)
195 #define IIOCGETSET _IO('I',8)
196 #define IIOCSETSET _IO('I',9)
197 #define IIOCSETVER _IO('I',10)
198 #define IIOCNETHUP _IO('I',11)
199 #define IIOCSETGST _IO('I',12)
200 #define IIOCSETBRJ _IO('I',13)
201 #define IIOCSIGPRF _IO('I',14)
202 #define IIOCGETPRF _IO('I',15)
203 #define IIOCSETPRF _IO('I',16)
204 #define IIOCGETMAP _IO('I',17)
205 #define IIOCSETMAP _IO('I',18)
206 #define IIOCNETASL _IO('I',19)
207 #define IIOCNETDIL _IO('I',20)
208 #define IIOCGETCPS _IO('I',21)
209 #define IIOCGETDVR _IO('I',22)
211 #define IIOCNETALN _IO('I',32)
212 #define IIOCNETDLN _IO('I',33)
214 #define IIOCDBGVAR _IO('I',127)
216 #define IIOCDRVCTL _IO('I',128)
218 /* Packet encapsulations for net-interfaces */
219 #define ISDN_NET_ENCAP_ETHER 0
220 #define ISDN_NET_ENCAP_RAWIP 1
221 #define ISDN_NET_ENCAP_IPTYP 2
222 #define ISDN_NET_ENCAP_CISCOHDLC 3 /* Without SLARP and keepalive */
223 #define ISDN_NET_ENCAP_SYNCPPP 4
224 #define ISDN_NET_ENCAP_UIHDLC 5
225 #define ISDN_NET_ENCAP_CISCOHDLCK 6 /* With SLARP and keepalive */
226 #define ISDN_NET_ENCAP_X25IFACE 7 /* Documentation/networking/x25-iface.txt*/
227 #define ISDN_NET_ENCAP_MAX_ENCAP ISDN_NET_ENCAP_X25IFACE
228 /* Facility which currently uses an ISDN-channel */
229 #define ISDN_USAGE_NONE 0
230 #define ISDN_USAGE_RAW 1
231 #define ISDN_USAGE_MODEM 2
232 #define ISDN_USAGE_NET 3
233 #define ISDN_USAGE_VOICE 4
234 #define ISDN_USAGE_FAX 5
235 #define ISDN_USAGE_MASK 7 /* Mask to get plain usage */
236 #define ISDN_USAGE_EXCLUSIVE 64 /* This bit is set, if channel is exclusive */
237 #define ISDN_USAGE_OUTGOING 128 /* This bit is set, if channel is outgoing */
239 #define ISDN_MODEM_ANZREG 23 /* Number of Modem-Registers */
240 #define ISDN_MSNLEN 20
242 typedef struct {
243 char drvid[25];
244 unsigned long arg;
245 } isdn_ioctl_struct;
247 typedef struct {
248 unsigned long isdndev;
249 unsigned long atmodem[ISDN_MAX_CHANNELS];
250 unsigned long info[ISDN_MAX_CHANNELS];
251 } debugvar_addr;
253 typedef struct {
254 char name[10];
255 char phone[ISDN_MSNLEN];
256 int outgoing;
257 } isdn_net_ioctl_phone;
259 #define NET_DV 0x04 /* Data version for net_cfg */
260 #define TTY_DV 0x04 /* Data version for iprofd etc. */
262 typedef struct {
263 char name[10]; /* Name of interface */
264 char master[10]; /* Name of Master for Bundling */
265 char slave[10]; /* Name of Slave for Bundling */
266 char eaz[256]; /* EAZ/MSN */
267 char drvid[25]; /* DriverId for Bindings */
268 int onhtime; /* Hangup-Timeout */
269 int charge; /* Charge-Units */
270 int l2_proto; /* Layer-2 protocol */
271 int l3_proto; /* Layer-3 protocol */
272 int p_encap; /* Encapsulation */
273 int exclusive; /* Channel, if bound exclusive */
274 int dialmax; /* Dial Retry-Counter */
275 int slavedelay; /* Delay until slave starts up */
276 int cbdelay; /* Delay before Callback */
277 int chargehup; /* Flag: Charge-Hangup */
278 int ihup; /* Flag: Hangup-Timeout on incoming line */
279 int secure; /* Flag: Secure */
280 int callback; /* Flag: Callback */
281 int cbhup; /* Flag: Reject Call before Callback */
282 int pppbind; /* ippp device for bindings */
283 int chargeint; /* Use fixed charge interval length */
284 int triggercps; /* BogoCPS needed for triggering slave */
285 } isdn_net_ioctl_cfg;
287 #ifdef __KERNEL__
289 #ifndef STANDALONE
290 #include <linux/config.h>
291 #endif
292 #include <linux/errno.h>
293 #include <linux/fs.h>
294 #include <linux/major.h>
295 #include <asm/segment.h>
296 #include <asm/io.h>
297 #include <linux/kernel.h>
298 #include <linux/signal.h>
299 #include <linux/malloc.h>
300 #include <linux/timer.h>
301 #include <linux/wait.h>
302 #include <linux/tty.h>
303 #include <linux/tty_flip.h>
304 #include <linux/serial_reg.h>
305 #include <linux/fcntl.h>
306 #include <linux/types.h>
307 #include <linux/interrupt.h>
308 #include <linux/ip.h>
309 #include <linux/in.h>
310 #include <linux/netdevice.h>
311 #include <linux/etherdevice.h>
312 #include <linux/skbuff.h>
313 #include <linux/tcp.h>
315 #ifdef CONFIG_ISDN_PPP
317 #ifdef CONFIG_ISDN_PPP_VJ
318 # include <net/slhc_vj.h>
319 #endif
321 #include <linux/ppp_defs.h>
322 #include <linux/if_ppp.h>
323 #include <linux/if_pppvar.h>
325 #include <linux/isdn_ppp.h>
326 #endif
328 #ifdef CONFIG_ISDN_X25
329 # include <linux/concap.h>
330 #endif
332 #include <linux/isdnif.h>
334 #define ISDN_DRVIOCTL_MASK 0x7f /* Mask for Device-ioctl */
336 /* Until now unused */
337 #define ISDN_SERVICE_VOICE 1
338 #define ISDN_SERVICE_AB 1<<1
339 #define ISDN_SERVICE_X21 1<<2
340 #define ISDN_SERVICE_G4 1<<3
341 #define ISDN_SERVICE_BTX 1<<4
342 #define ISDN_SERVICE_DFUE 1<<5
343 #define ISDN_SERVICE_X25 1<<6
344 #define ISDN_SERVICE_TTX 1<<7
345 #define ISDN_SERVICE_MIXED 1<<8
346 #define ISDN_SERVICE_FW 1<<9
347 #define ISDN_SERVICE_GTEL 1<<10
348 #define ISDN_SERVICE_BTXN 1<<11
349 #define ISDN_SERVICE_BTEL 1<<12
351 /* Macros checking plain usage */
352 #define USG_NONE(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NONE)
353 #define USG_RAW(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_RAW)
354 #define USG_MODEM(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM)
355 #define USG_VOICE(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE)
356 #define USG_NET(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NET)
357 #define USG_OUTGOING(x) ((x & ISDN_USAGE_OUTGOING)==ISDN_USAGE_OUTGOING)
358 #define USG_MODEMORVOICE(x) (((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM) || \
359 ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE) )
361 /* Timer-delays and scheduling-flags */
362 #define ISDN_TIMER_RES 3 /* Main Timer-Resolution */
363 #define ISDN_TIMER_02SEC (HZ/(ISDN_TIMER_RES+1)/5) /* Slow-Timer1 .2 sec */
364 #define ISDN_TIMER_1SEC (HZ/(ISDN_TIMER_RES+1)) /* Slow-Timer2 1 sec */
365 #define ISDN_TIMER_RINGING 5 /* tty RINGs = ISDN_TIMER_1SEC * this factor */
366 #define ISDN_TIMER_KEEPINT 10 /* Cisco-Keepalive = ISDN_TIMER_1SEC * this factor */
367 #define ISDN_TIMER_MODEMREAD 1
368 #define ISDN_TIMER_MODEMPLUS 2
369 #define ISDN_TIMER_MODEMRING 4
370 #define ISDN_TIMER_MODEMXMIT 8
371 #define ISDN_TIMER_NETDIAL 16
372 #define ISDN_TIMER_NETHANGUP 32
373 #define ISDN_TIMER_IPPP 64
374 #define ISDN_TIMER_KEEPALIVE 128 /* Cisco-Keepalive */
375 #define ISDN_TIMER_FAST (ISDN_TIMER_MODEMREAD | ISDN_TIMER_MODEMPLUS | \
376 ISDN_TIMER_MODEMXMIT)
377 #define ISDN_TIMER_SLOW (ISDN_TIMER_MODEMRING | ISDN_TIMER_NETHANGUP | \
378 ISDN_TIMER_NETDIAL | ISDN_TIMER_KEEPALIVE)
380 /* Timeout-Values for isdn_net_dial() */
381 #define ISDN_TIMER_DTIMEOUT10 (10*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
382 #define ISDN_TIMER_DTIMEOUT15 (15*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
384 /* GLOBAL_FLAGS */
385 #define ISDN_GLOBAL_STOPPED 1
387 /*=================== Start of ip-over-ISDN stuff =========================*/
389 /* Feature- and status-flags for a net-interface */
390 #define ISDN_NET_CONNECTED 0x01 /* Bound to ISDN-Channel */
391 #define ISDN_NET_SECURE 0x02 /* Accept calls from phonelist only */
392 #define ISDN_NET_CALLBACK 0x04 /* activate callback */
393 #define ISDN_NET_CBHUP 0x08 /* hangup before callback */
394 #define ISDN_NET_CBOUT 0x10 /* remote machine does callback */
395 #if 0
396 /* Unused??? */
397 #define ISDN_NET_CLONE 0x08 /* clone a tmp interface when called */
398 #define ISDN_NET_TMP 0x10 /* tmp interface until getting an IP */
399 #define ISDN_NET_DYNAMIC 0x20 /* this link is dynamically allocated */
400 #endif
401 #define ISDN_NET_MAGIC 0x49344C02 /* for paranoia-checking */
403 /* Phone-list-element */
404 typedef struct {
405 void *next;
406 char num[ISDN_MSNLEN];
407 } isdn_net_phone;
410 Principles when extending structures for generic encapsulation protocol
411 ("concap") support:
412 - Stuff which is hardware specific (here i4l-specific) goes in
413 the netdev -> local structure (here: isdn_net_local)
414 - Stuff which is encapsulation protocol specific goes in the structure
415 which holds the linux device structure (here: isdn_net_device)
418 /* Local interface-data */
419 typedef struct isdn_net_local_s {
420 ulong magic;
421 char name[10]; /* Name of device */
422 struct enet_statistics stats; /* Ethernet Statistics */
423 int isdn_device; /* Index to isdn-device */
424 int isdn_channel; /* Index to isdn-channel */
425 int ppp_slot; /* PPPD device slot number */
426 int pre_device; /* Preselected isdn-device */
427 int pre_channel; /* Preselected isdn-channel */
428 int exclusive; /* If non-zero idx to reserved chan.*/
429 int flags; /* Connection-flags */
430 int dialretry; /* Counter for Dialout-retries */
431 int dialmax; /* Max. Number of Dial-retries */
432 int cbdelay; /* Delay before Callback starts */
433 int dtimer; /* Timeout-counter for dialing */
434 char msn[ISDN_MSNLEN]; /* MSNs/EAZs for this interface */
435 u_char cbhup; /* Flag: Reject Call before Callback*/
436 u_char dialstate; /* State for dialing */
437 u_char p_encap; /* Packet encapsulation */
438 /* 0 = Ethernet over ISDN */
439 /* 1 = RAW-IP */
440 /* 2 = IP with type field */
441 u_char l2_proto; /* Layer-2-protocol */
442 /* See ISDN_PROTO_L2..-constants in */
443 /* isdnif.h */
444 /* 0 = X75/LAPB with I-Frames */
445 /* 1 = X75/LAPB with UI-Frames */
446 /* 2 = X75/LAPB with BUI-Frames */
447 /* 3 = HDLC */
448 u_char l3_proto; /* Layer-3-protocol */
449 /* See ISDN_PROTO_L3..-constants in */
450 /* isdnif.h */
451 /* 0 = Transparent */
452 int huptimer; /* Timeout-counter for auto-hangup */
453 int charge; /* Counter for charging units */
454 int chargetime; /* Timer for Charging info */
455 int hupflags; /* Flags for charge-unit-hangup: */
456 /* bit0: chargeint is invalid */
457 /* bit1: Getting charge-interval */
458 /* bit2: Do charge-unit-hangup */
459 /* bit3: Do hangup even on incoming */
460 int outgoing; /* Flag: outgoing call */
461 int onhtime; /* Time to keep link up */
462 int chargeint; /* Interval between charge-infos */
463 int onum; /* Flag: at least 1 outgoing number */
464 int cps; /* current speed of this interface */
465 int transcount; /* byte-counter for cps-calculation */
466 int sqfull; /* Flag: netdev-queue overloaded */
467 ulong sqfull_stamp; /* Start-Time of overload */
468 ulong slavedelay; /* Dynamic bundling delaytime */
469 int triggercps; /* BogoCPS needed for trigger slave */
470 struct device *srobin; /* Ptr to Master device for slaves */
471 isdn_net_phone *phone[2]; /* List of remote-phonenumbers */
472 /* phone[0] = Incoming Numbers */
473 /* phone[1] = Outgoing Numbers */
474 isdn_net_phone *dial; /* Pointer to dialed number */
475 struct device *master; /* Ptr to Master device for slaves */
476 struct device *slave; /* Ptr to Slave device for masters */
477 struct isdn_net_local_s *next; /* Ptr to next link in bundle */
478 struct isdn_net_local_s *last; /* Ptr to last link in bundle */
479 struct isdn_net_dev_s *netdev; /* Ptr to netdev */
480 struct sk_buff *first_skb; /* Ptr to skb that triggers dialing */
481 struct sk_buff *sav_skb; /* Ptr to skb, rejected by LL-driver*/
482 /* Ptr to orig. hard_header_cache */
483 int (*org_hhc)(
484 struct neighbour *neigh,
485 struct hh_cache *hh);
486 /* Ptr to orig. header_cache_update */
487 void (*org_hcu)(struct hh_cache *,
488 struct device *,
489 unsigned char *);
490 int pppbind; /* ippp device for bindings */
491 #ifdef CONFIG_ISDN_X25
492 struct concap_device_ops *dops; /* callbacks used by encapsulator */
493 #endif
494 int cisco_loop; /* Loop counter for Cisco-SLARP */
495 ulong cisco_myseq; /* Local keepalive seq. for Cisco */
496 ulong cisco_yourseq; /* Remote keepalive seq. for Cisco */
497 } isdn_net_local;
499 #ifdef CONFIG_ISDN_PPP
500 struct ippp_bundle {
501 int mp_mrru; /* unused */
502 struct mpqueue *last; /* currently defined in isdn_net_dev */
503 int min; /* currently calculated 'on the fly' */
504 long next_num; /* we wanna see this seq.-number next */
505 struct sqqueue *sq;
506 int modify:1; /* set to 1 while modifying sqqueue */
507 int bundled:1; /* bundle active ? */
509 #endif
511 /* the interface itself */
512 typedef struct isdn_net_dev_s {
513 isdn_net_local *local;
514 isdn_net_local *queue;
515 void *next; /* Pointer to next isdn-interface */
516 struct device dev; /* interface to upper levels */
517 #ifdef CONFIG_ISDN_PPP
518 struct mpqueue *mp_last;
519 struct ippp_bundle ib;
520 #endif
521 #ifdef CONFIG_ISDN_X25
522 struct concap_proto *cprot; /* connection oriented encapsulation protocol */
523 #endif
525 } isdn_net_dev;
527 /*===================== End of ip-over-ISDN stuff ===========================*/
529 /*======================= Start of ISDN-tty stuff ===========================*/
531 #define ISDN_ASYNC_MAGIC 0x49344C01 /* for paranoia-checking */
532 #define ISDN_ASYNC_INITIALIZED 0x80000000 /* port was initialized */
533 #define ISDN_ASYNC_CALLOUT_ACTIVE 0x40000000 /* Call out device active */
534 #define ISDN_ASYNC_NORMAL_ACTIVE 0x20000000 /* Normal device active */
535 #define ISDN_ASYNC_CLOSING 0x08000000 /* Serial port is closing */
536 #define ISDN_ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */
537 #define ISDN_ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */
538 #define ISDN_ASYNC_HUP_NOTIFY 0x0001 /* Notify tty on hangups/closes */
539 #define ISDN_ASYNC_SESSION_LOCKOUT 0x0100 /* Lock cua opens on session */
540 #define ISDN_ASYNC_PGRP_LOCKOUT 0x0200 /* Lock cua opens on pgrp */
541 #define ISDN_ASYNC_CALLOUT_NOHUP 0x0400 /* No hangup for cui */
542 #define ISDN_ASYNC_SPLIT_TERMIOS 0x0008 /* Sep. termios for dialin/out */
543 #define ISDN_SERIAL_XMIT_SIZE 1024 /* Default bufsize for write */
544 #define ISDN_SERIAL_XMIT_MAX 4000 /* Maximum bufsize for write */
545 #define ISDN_SERIAL_TYPE_NORMAL 1
546 #define ISDN_SERIAL_TYPE_CALLOUT 2
548 #ifdef CONFIG_ISDN_AUDIO
549 /* For using sk_buffs with audio we need some private variables
550 * within each sk_buff. For this purpose, we declare a struct here,
551 * and put it always at skb->head. A few macros help accessing the
552 * variables. Of course, we need to check skb_headroom prior to
553 * any access.
555 typedef struct isdn_audio_skb {
556 unsigned short dle_count;
557 unsigned char lock;
558 } isdn_audio_skb;
560 #define ISDN_AUDIO_SKB_DLECOUNT(skb) (((isdn_audio_skb*)skb->head)->dle_count)
561 #define ISDN_AUDIO_SKB_LOCK(skb) (((isdn_audio_skb*)skb->head)->lock)
562 #endif
564 /* Private data of AT-command-interpreter */
565 typedef struct atemu {
566 u_char profile[ISDN_MODEM_ANZREG]; /* Modem-Regs. Profile 0 */
567 u_char mdmreg[ISDN_MODEM_ANZREG]; /* Modem-Registers */
568 char pmsn[ISDN_MSNLEN]; /* EAZ/MSNs Profile 0 */
569 char msn[ISDN_MSNLEN]; /* EAZ/MSN */
570 #ifdef CONFIG_ISDN_AUDIO
571 u_char vpar[10]; /* Voice-parameters */
572 int lastDLE; /* Flag for voice-coding: DLE seen */
573 #endif
574 int mdmcmdl; /* Length of Modem-Commandbuffer */
575 int pluscount; /* Counter for +++ sequence */
576 int lastplus; /* Timestamp of last + */
577 char mdmcmd[255]; /* Modem-Commandbuffer */
578 unsigned int charge; /* Charge units of current connection */
579 } atemu;
581 /* Private data (similar to async_struct in <linux/serial.h>) */
582 typedef struct modem_info {
583 int magic;
584 int flags; /* defined in tty.h */
585 int x_char; /* xon/xoff character */
586 int mcr; /* Modem control register */
587 int msr; /* Modem status register */
588 int lsr; /* Line status register */
589 int line;
590 int count; /* # of fd on device */
591 int blocked_open; /* # of blocked opens */
592 long session; /* Session of opening process */
593 long pgrp; /* pgrp of opening process */
594 int online; /* 1 = B-Channel is up, drop data */
595 /* 2 = B-Channel is up, deliver d.*/
596 int dialing; /* Dial in progress */
597 int rcvsched; /* Receive needs schedule */
598 int isdn_driver; /* Index to isdn-driver */
599 int isdn_channel; /* Index to isdn-channel */
600 int drv_index; /* Index to dev->usage */
601 int ncarrier; /* Flag: schedule NO CARRIER */
602 unsigned char last_cause[8]; /* Last cause message */
603 unsigned char last_num[ISDN_MSNLEN];
604 /* Last phone-number */
605 unsigned char last_l2; /* Last layer-2 protocol */
606 unsigned char last_si; /* Last service */
607 unsigned char last_lhup; /* Last hangup local? */
608 unsigned char last_dir; /* Last direction (in or out) */
609 struct timer_list nc_timer; /* Timer for delayed NO CARRIER */
610 int send_outstanding;/* # of outstanding send-requests */
611 int xmit_size; /* max. # of chars in xmit_buf */
612 int xmit_count; /* # of chars in xmit_buf */
613 unsigned char *xmit_buf; /* transmit buffer */
614 struct sk_buff_head xmit_queue; /* transmit queue */
615 #ifdef CONFIG_ISDN_AUDIO
616 int vonline; /* Voice-channel status */
617 /* Bit 0 = recording */
618 /* Bit 1 = playback */
619 /* Bit 2 = playback, DLE-ETX seen */
620 struct sk_buff_head dtmf_queue; /* queue for dtmf results */
621 void *adpcms; /* state for adpcm decompression */
622 void *adpcmr; /* state for adpcm compression */
623 void *dtmf_state; /* state for dtmf decoder */
624 #endif
625 struct tty_struct *tty; /* Pointer to corresponding tty */
626 atemu emu; /* AT-emulator data */
627 struct termios normal_termios; /* For saving termios structs */
628 struct termios callout_termios;
629 struct wait_queue *open_wait;
630 struct wait_queue *close_wait;
631 } modem_info;
633 #define ISDN_MODEM_WINSIZE 8
635 /* Description of one ISDN-tty */
636 typedef struct {
637 int refcount; /* Number of opens */
638 struct tty_driver tty_modem; /* tty-device */
639 struct tty_driver cua_modem; /* cua-device */
640 struct tty_struct *modem_table[ISDN_MAX_CHANNELS]; /* ?? copied from Orig */
641 struct termios *modem_termios[ISDN_MAX_CHANNELS];
642 struct termios *modem_termios_locked[ISDN_MAX_CHANNELS];
643 modem_info info[ISDN_MAX_CHANNELS]; /* Private data */
644 } modem;
646 /*======================= End of ISDN-tty stuff ============================*/
648 /*======================= Start of sync-ppp stuff ==========================*/
651 #define NUM_RCV_BUFFS 64
652 #define PPP_HARD_HDR_LEN 4
654 #ifdef CONFIG_ISDN_PPP
656 struct sqqueue {
657 struct sqqueue *next;
658 long sqno_start;
659 long sqno_end;
660 struct sk_buff *skb;
661 long timer;
664 struct mpqueue {
665 struct mpqueue *next;
666 struct mpqueue *last;
667 long sqno;
668 struct sk_buff *skb;
669 int BEbyte;
670 unsigned long time;
673 struct ippp_buf_queue {
674 struct ippp_buf_queue *next;
675 struct ippp_buf_queue *last;
676 char *buf; /* NULL here indicates end of queue */
677 int len;
680 struct ippp_struct {
681 struct ippp_struct *next_link;
682 int state;
683 struct ippp_buf_queue rq[NUM_RCV_BUFFS]; /* packet queue for isdn_ppp_read() */
684 struct ippp_buf_queue *first; /* pointer to (current) first packet */
685 struct ippp_buf_queue *last; /* pointer to (current) last used packet in queue */
686 struct wait_queue *wq;
687 struct wait_queue *wq1;
688 struct task_struct *tk;
689 unsigned int mpppcfg;
690 unsigned int pppcfg;
691 unsigned int mru;
692 unsigned int mpmru;
693 unsigned int mpmtu;
694 unsigned int maxcid;
695 isdn_net_local *lp;
696 int unit;
697 int minor;
698 long last_link_seqno;
699 long mp_seqno;
700 long range;
701 #ifdef CONFIG_ISDN_PPP_VJ
702 unsigned char *cbuf;
703 struct slcompress *slcomp;
704 #endif
705 unsigned long debug;
706 struct isdn_ppp_compressor *compressor,*link_compressor;
707 void *decomp_stat,*comp_stat,*link_decomp_stat,*link_comp_stat;
710 #endif
712 /*======================== End of sync-ppp stuff ===========================*/
714 /*======================== Start of V.110 stuff ============================*/
715 #define V110_BUFSIZE 1024
717 typedef struct {
718 int nbytes; /* 1 Matrixbyte -> nbytes in stream */
719 int nbits; /* Number of used bits in streambyte */
720 unsigned char key; /* Bitmask in stream eg. 11 (nbits=2) */
721 int decodelen; /* Amount of data in decodebuf */
722 int SyncInit; /* Number of sync frames to send */
723 unsigned char *OnlineFrame; /* Precalculated V110 idle frame */
724 unsigned char *OfflineFrame; /* Precalculated V110 sync Frame */
725 int framelen; /* Length of frames */
726 int skbuser; /* Number of unacked userdata skbs */
727 int skbidle; /* Number of unacked idle/sync skbs */
728 int introducer; /* Local vars for decoder */
729 int dbit;
730 unsigned char b;
731 int skbres; /* space to reserve in outgoing skb */
732 int maxsize; /* maxbufsize of lowlevel driver */
733 unsigned char *encodebuf; /* temporary buffer for encoding */
734 unsigned char decodebuf[V110_BUFSIZE]; /* incomplete V110 matrices */
735 } isdn_v110_stream;
737 /*========================= End of V.110 stuff =============================*/
739 /*======================= Start of general stuff ===========================*/
741 typedef struct {
742 char *next;
743 char *private;
744 } infostruct;
746 /* Description of hardware-level-driver */
747 typedef struct {
748 ulong flags; /* Flags */
749 int channels; /* Number of channels */
750 int reject_bus; /* Flag: Reject rejected call on bus*/
751 struct wait_queue *st_waitq; /* Wait-Queue for status-read's */
752 int maxbufsize; /* Maximum Buffersize supported */
753 unsigned long pktcount; /* Until now: unused */
754 int running; /* Flag: Protocolcode running */
755 int loaded; /* Flag: Driver loaded */
756 int stavail; /* Chars avail on Status-device */
757 isdn_if *interface; /* Interface to driver */
758 int *rcverr; /* Error-counters for B-Ch.-receive */
759 int *rcvcount; /* Byte-counters for B-Ch.-receive */
760 #ifdef CONFIG_ISDN_AUDIO
761 unsigned long DLEflag; /* Flags: Insert DLE at next read */
762 #endif
763 struct sk_buff_head *rpqueue; /* Pointers to start of Rcv-Queue */
764 struct wait_queue **rcv_waitq; /* Wait-Queues for B-Channel-Reads */
765 struct wait_queue **snd_waitq; /* Wait-Queue for B-Channel-Send's */
766 char msn2eaz[10][ISDN_MSNLEN]; /* Mapping-Table MSN->EAZ */
767 } driver;
769 /* Main driver-data */
770 typedef struct isdn_devt {
771 unsigned short flags; /* Bitmapped Flags: */
772 /* */
773 int drivers; /* Current number of drivers */
774 int channels; /* Current number of channels */
775 int net_verbose; /* Verbose-Flag */
776 int modempoll; /* Flag: tty-read active */
777 int tflags; /* Timer-Flags: */
778 /* see ISDN_TIMER_..defines */
779 int global_flags;
780 infostruct *infochain; /* List of open info-devs. */
781 struct wait_queue *info_waitq; /* Wait-Queue for isdninfo */
782 struct timer_list timer; /* Misc.-function Timer */
783 int chanmap[ISDN_MAX_CHANNELS];/* Map minor->device-channel */
784 int drvmap[ISDN_MAX_CHANNELS]; /* Map minor->driver-index */
785 int usage[ISDN_MAX_CHANNELS]; /* Used by tty/ip/voice */
786 char num[ISDN_MAX_CHANNELS][ISDN_MSNLEN];
787 /* Remote number of active ch.*/
788 int m_idx[ISDN_MAX_CHANNELS]; /* Index for mdm.... */
789 driver *drv[ISDN_MAX_DRIVERS]; /* Array of drivers */
790 isdn_net_dev *netdev; /* Linked list of net-if's */
791 char drvid[ISDN_MAX_DRIVERS][20];/* Driver-ID */
792 struct task_struct *profd; /* For iprofd */
793 modem mdm; /* tty-driver-data */
794 isdn_net_dev *rx_netdev[ISDN_MAX_CHANNELS]; /* rx netdev-pointers */
795 isdn_net_dev *st_netdev[ISDN_MAX_CHANNELS]; /* stat netdev-pointers */
796 ulong ibytes[ISDN_MAX_CHANNELS]; /* Statistics incoming bytes */
797 ulong obytes[ISDN_MAX_CHANNELS]; /* Statistics outgoing bytes */
798 int v110emu[ISDN_MAX_CHANNELS];/* V.110 emulator-mode 0=none */
799 atomic_t v110use[ISDN_MAX_CHANNELS];/* Usage-Semaphore for stream */
800 isdn_v110_stream *v110[ISDN_MAX_CHANNELS]; /* V.110 private data */
801 struct semaphore sem; /* serialize list access*/
802 } isdn_dev;
804 extern isdn_dev *dev;
806 /* Utility-Macros */
807 #define MIN(a,b) ((a<b)?a:b)
808 #define MAX(a,b) ((a>b)?a:b)
810 #endif /* __KERNEL__ */
811 #endif /* isdn_h */