OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uClinux-2.0.x/] [include/] [linux/] [isdn.h] - Blame information for rev 199

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/* $Id: isdn.h,v 1.1.1.1 2001-09-10 07:44:43 simons Exp $
2
 *
3
 * Main header for the Linux ISDN subsystem (linklevel).
4
 *
5
 * Copyright 1994-1998  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.
13
 *
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.
18
 *
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.
22
 *
23
 * $Log: not supported by cvs2svn $
24
 * Revision 1.1.1.1  2001/07/02 17:57:57  simons
25
 * Initial revision
26
 *
27
 * Revision 1.31.2.17  1998/11/05 22:13:28  fritz
28
 * Changed mail-address.
29
 *
30
 * Revision 1.31.2.16  1998/11/04 17:22:53  fritz
31
 * Replaced broken lowlevel-driver locking.
32
 *
33
 * Revision 1.31.2.15  1998/11/03 14:31:57  fritz
34
 * Reduced stack usage in various functions.
35
 * Adapted statemachine to work with certified HiSax.
36
 * Some fixes in callback handling.
37
 *
38
 * Revision 1.31.2.14  1998/10/25 14:37:37  fritz
39
 * Backported from MIPS (Cobalt).
40
 *
41
 * Revision 1.31.2.13  1998/10/23 10:14:25  paul
42
 * Implementation of "dialmode" (successor of "status")
43
 * You also need current isdnctrl for this!
44
 *
45
 * Revision 1.31.2.12  1998/08/22 16:41:25  armin
46
 * Added silence detection in audio receive mode (AT+VSD).
47
 *
48
 * Revision 1.31.2.11  1998/07/15 15:04:19  calle
49
 * make isdn4k-utils compile again.
50
 *
51
 * Revision 1.31.2.10  1998/06/07 13:48:30  fritz
52
 * ABC cleanup
53
 *
54
 * Revision 1.31.2.9  1998/06/02 12:12:49  detabc
55
 * wegen einer einstweiliger verfuegung gegen DW ist zur zeit
56
 * die abc-extension bis zur klaerung der rechtslage nicht verfuegbar
57
 *
58
 * Revision 1.31.2.8  1998/05/06 08:30:44  detabc
59
 * add Item to stop icmp-unreach (max. 6 times of dialwait delay)
60
 *
61
 * Revision 1.31.2.7  1998/04/26 19:51:40  detabc
62
 * removed unused code
63
 *
64
 * Revision 1.31.2.6  1998/04/26 11:10:46  detabc
65
 * add items for the abc_tx_queus and the abc_delayed_hangup
66
 * only used if the abc-extension is enabled
67
 *
68
 * Revision 1.31.2.5  1998/04/18 17:39:45  detabc
69
 * remove some unused abc-lines
70
 * added defines und items for abc-secure callback (only used with abc-extenrsion)
71
 *
72
 * Revision 1.31.2.4  1998/04/08 21:42:25  keil
73
 * Blocksize default 1024
74
 *
75
 * Revision 1.31.2.3  1998/03/16 09:56:28  cal
76
 * Merged in TimRu-patches. Still needs validation in conjunction with ABC-patches.
77
 *
78
 * Revision 1.31.2.2  1998/03/07 23:35:45  detabc
79
 * added the abc-extension to the linux isdn-kernel
80
 * for kernel-version 2.0.xx
81
 * DO NOT USE FOR HIGHER KERNELS-VERSIONS
82
 * all source-lines are switched with the define  CONFIG_ISDN_WITH_ABC
83
 * (make config and answer ABC-Ext. Support (Compress,TCP-Keepalive ...) with yes
84
 *
85
 * you need also a modified isdnctrl-source the switch on the
86
 * features of the abc-extension
87
 *
88
 * please use carefully. more detail will be follow.
89
 * thanks
90
 *
91
 * Revision 1.31.2.1  1997/08/21 15:57:04  fritz
92
 * Synchronized 2.0.X branch with 2.0.31-pre7
93
 *
94
 * Revision 1.31  1997/06/22 11:57:07  fritz
95
 * Added ability to adjust slave triggerlevel.
96
 *
97
 * Revision 1.30  1997/06/17 13:07:23  hipp
98
 * compression changes , MP changes
99
 *
100
 * Revision 1.29  1997/05/27 15:18:02  fritz
101
 * Added changes for recent 2.1.x kernels:
102
 *   changed return type of isdn_close
103
 *   queue_task_* -> queue_task
104
 *   clear/set_bit -> test_and_... where apropriate.
105
 *   changed type of hard_header_cache parameter.
106
 *
107
 * Revision 1.28  1997/03/07 01:33:01  fritz
108
 * Added proper ifdef's for CONFIG_ISDN_AUDIO
109
 *
110
 * Revision 1.27  1997/03/05 21:11:49  fritz
111
 * Minor fixes.
112
 *
113
 * Revision 1.26  1997/02/28 02:37:53  fritz
114
 * Added some comments.
115
 *
116
 * Revision 1.25  1997/02/23 16:54:23  hipp
117
 * some initial changes for future PPP compresion
118
 *
119
 * Revision 1.24  1997/02/18 09:42:45  fritz
120
 * Bugfix: Increased ISDN_MODEM_ANZREG.
121
 * Increased TTY_DV.
122
 *
123
 * Revision 1.23  1997/02/10 22:07:13  fritz
124
 * Added 2 modem registers for numbering plan and screening info.
125
 *
126
 * Revision 1.22  1997/02/03 23:42:08  fritz
127
 * Added ISDN_TIMER_RINGING
128
 * Misc. changes for Kernel 2.1.X compatibility
129
 *
130
 * Revision 1.21  1997/01/17 01:19:10  fritz
131
 * Applied chargeint patch.
132
 *
133
 * Revision 1.20  1997/01/17 00:41:19  fritz
134
 * Increased TTY_DV.
135
 *
136
 * Revision 1.19  1997/01/14 01:41:07  fritz
137
 * Added ATI2 related variables.
138
 * Added variables for audio support in skbuffs.
139
 *
140
 * Revision 1.18  1996/11/06 17:37:50  keil
141
 * more changes for 2.1.X
142
 *
143
 * Revision 1.17  1996/09/07 12:53:57  hipp
144
 * moved a few isdn_ppp.c specific defines to drives/isdn/isdn_ppp.h
145
 *
146
 * Revision 1.16  1996/08/12 16:20:56  hipp
147
 * renamed ppp_minor to ppp_slot
148
 *
149
 * Revision 1.15  1996/06/15 14:56:57  fritz
150
 * Added version signatures for data structures used
151
 * by userlevel programs.
152
 *
153
 * Revision 1.14  1996/06/06 21:24:23  fritz
154
 * Started adding support for suspend/resume.
155
 *
156
 * Revision 1.13  1996/06/05 02:18:20  fritz
157
 * Added DTMF decoding stuff.
158
 *
159
 * Revision 1.12  1996/06/03 19:55:08  fritz
160
 * Fixed typos.
161
 *
162
 * Revision 1.11  1996/05/31 01:37:47  fritz
163
 * Minor changes, due to changes in isdn_tty.c
164
 *
165
 * Revision 1.10  1996/05/18 01:37:18  fritz
166
 * Added spelling corrections and some minor changes
167
 * to stay in sync with kernel.
168
 *
169
 * Revision 1.9  1996/05/17 03:58:20  fritz
170
 * Added flags for DLE handling.
171
 *
172
 * Revision 1.8  1996/05/11 21:49:55  fritz
173
 * Removed queue management variables.
174
 * Changed queue management to use sk_buffs.
175
 *
176
 * Revision 1.7  1996/05/07 09:10:06  fritz
177
 * Reorganized tty-related structs.
178
 *
179
 * Revision 1.6  1996/05/06 11:38:27  hipp
180
 * minor change in ippp struct
181
 *
182
 * Revision 1.5  1996/04/30 11:03:16  fritz
183
 * Added Michael's ippp-bind patch.
184
 *
185
 * Revision 1.4  1996/04/29 23:00:02  fritz
186
 * Added variables for voice-support.
187
 *
188
 * Revision 1.3  1996/04/20 16:54:58  fritz
189
 * Increased maximum number of channels.
190
 * Added some flags for isdn_net to handle callback more reliable.
191
 * Fixed delay-definitions to be more accurate.
192
 * Misc. typos
193
 *
194
 * Revision 1.2  1996/02/11 02:10:02  fritz
195
 * Changed IOCTL-names
196
 * Added rx_netdev, st_netdev, first_skb, org_hcb, and org_hcu to
197
 * Netdevice-local struct.
198
 *
199
 * Revision 1.1  1996/01/10 20:55:07  fritz
200
 * Initial revision
201
 *
202
 */
203
 
204
#ifndef isdn_h
205
#define isdn_h
206
 
207
#include <linux/config.h>
208
#include <linux/ioctl.h>
209
 
210
#define ISDN_TTY_MAJOR    43
211
#define ISDN_TTYAUX_MAJOR 44
212
#define ISDN_MAJOR        45
213
 
214
/* The minor-devicenumbers for Channel 0 and 1 are used as arguments for
215
 * physical Channel-Mapping, so they MUST NOT be changed without changing
216
 * the correspondent code in isdn.c
217
 */
218
 
219
#ifdef CONFIG_COBALT_MICRO_SERVER
220
/* Save memory */
221
#define ISDN_MAX_DRIVERS    2
222
#define ISDN_MAX_CHANNELS   8
223
#else
224
#define ISDN_MAX_DRIVERS    32
225
#define ISDN_MAX_CHANNELS   64
226
#endif
227
#define ISDN_MINOR_B        0
228
#define ISDN_MINOR_BMAX     (ISDN_MAX_CHANNELS-1)
229
#define ISDN_MINOR_CTRL     64
230
#define ISDN_MINOR_CTRLMAX  (64 + (ISDN_MAX_CHANNELS-1))
231
#define ISDN_MINOR_PPP      128
232
#define ISDN_MINOR_PPPMAX   (128 + (ISDN_MAX_CHANNELS-1))
233
#define ISDN_MINOR_STATUS   255
234
 
235
/* New ioctl-codes */
236
#define IIOCNETAIF  _IO('I',1)
237
#define IIOCNETDIF  _IO('I',2)
238
#define IIOCNETSCF  _IO('I',3)
239
#define IIOCNETGCF  _IO('I',4)
240
#define IIOCNETANM  _IO('I',5)
241
#define IIOCNETDNM  _IO('I',6)
242
#define IIOCNETGNM  _IO('I',7)
243
/* #define IIOCGETSET  _IO('I',8) obsolete */
244
/* #define IIOCSETSET  _IO('I',9) obsolete */
245
#define IIOCSETVER  _IO('I',10)
246
#define IIOCNETHUP  _IO('I',11)
247
#define IIOCSETGST  _IO('I',12)
248
#define IIOCSETBRJ  _IO('I',13)
249
#define IIOCSIGPRF  _IO('I',14)
250
#define IIOCGETPRF  _IO('I',15)
251
#define IIOCSETPRF  _IO('I',16)
252
#define IIOCGETMAP  _IO('I',17)
253
#define IIOCSETMAP  _IO('I',18)
254
#define IIOCNETASL  _IO('I',19)
255
#define IIOCNETDIL  _IO('I',20)
256
#define IIOCGETCPS  _IO('I',21)
257
#define IIOCGETDVR  _IO('I',22)
258
 
259
#define IIOCNETALN  _IO('I',32)
260
#define IIOCNETDLN  _IO('I',33)
261
 
262
#define IIOCDBGVAR  _IO('I',127)
263
 
264
#define IIOCDRVCTL  _IO('I',128)
265
 
266
/* Packet encapsulations for net-interfaces */
267
#define ISDN_NET_ENCAP_ETHER     0
268
#define ISDN_NET_ENCAP_RAWIP     1
269
#define ISDN_NET_ENCAP_IPTYP     2
270
#define ISDN_NET_ENCAP_CISCOHDLC 3
271
#define ISDN_NET_ENCAP_SYNCPPP   4
272
#define ISDN_NET_ENCAP_UIHDLC    5
273
 
274
/* Facility which currently uses an ISDN-channel */
275
#define ISDN_USAGE_NONE       0
276
#define ISDN_USAGE_RAW        1
277
#define ISDN_USAGE_MODEM      2
278
#define ISDN_USAGE_NET        3
279
#define ISDN_USAGE_VOICE      4
280
#define ISDN_USAGE_FAX        5
281
#define ISDN_USAGE_MASK       7 /* Mask to get plain usage */
282
#define ISDN_USAGE_EXCLUSIVE 64 /* This bit is set, if channel is exclusive */
283
#define ISDN_USAGE_OUTGOING 128 /* This bit is set, if channel is outgoing  */
284
 
285
#define ISDN_MODEM_ANZREG    23        /* Number of Modem-Registers        */
286
#define ISDN_MSNLEN          20
287
#define ISDN_LMSNLEN         255 /* Length of tty's Listen-MSN string */
288
 
289
typedef struct {
290
  char drvid[25];
291
  unsigned long arg;
292
} isdn_ioctl_struct;
293
 
294
typedef struct {
295
  unsigned long isdndev;
296
  unsigned long atmodem[ISDN_MAX_CHANNELS];
297
  unsigned long info[ISDN_MAX_CHANNELS];
298
} debugvar_addr;
299
 
300
typedef struct {
301
  char name[10];
302
  char phone[ISDN_MSNLEN];
303
  int  outgoing;
304
} isdn_net_ioctl_phone;
305
 
306
#define NET_DV 0x04 /* Data version for net_cfg     */
307
#define TTY_DV 0x04 /* Data version for iprofd etc. */
308
#define INF_DV 0x01 /* Data version for /dev/isdninfo */
309
 
310
typedef struct {
311
  char name[10];     /* Name of interface                     */
312
  char master[10];   /* Name of Master for Bundling           */
313
  char slave[10];    /* Name of Slave for Bundling            */
314
  char eaz[256];     /* EAZ/MSN                               */
315
  char drvid[25];    /* DriverId for Bindings                 */
316
  int  onhtime;      /* Hangup-Timeout                        */
317
  int  charge;       /* Charge-Units                          */
318
  int  l2_proto;     /* Layer-2 protocol                      */
319
  int  l3_proto;     /* Layer-3 protocol                      */
320
  int  p_encap;      /* Encapsulation                         */
321
  int  exclusive;    /* Channel, if bound exclusive           */
322
  int  dialmax;      /* Dial Retry-Counter                    */
323
  int  slavedelay;   /* Delay until slave starts up           */
324
  int  cbdelay;      /* Delay before Callback                 */
325
  int  chargehup;    /* Flag: Charge-Hangup                   */
326
  int  ihup;         /* Flag: Hangup-Timeout on incoming line */
327
  int  secure;       /* Flag: Secure                          */
328
  int  callback;     /* Flag: Callback                        */
329
  int  cbhup;        /* Flag: Reject Call before Callback     */
330
  int  pppbind;      /* ippp device for bindings              */
331
  int  chargeint;    /* Use fixed charge interval length      */
332
  int  triggercps;   /* BogoCPS needed for triggering slave   */
333
  int  dialtimeout;  /* Dial-Timeout                          */
334
  int  dialwait;     /* Time to wait after failed dial        */
335
  int  dialmode;     /* Flag: off / on / auto                 */
336
} isdn_net_ioctl_cfg;
337
 
338
#define ISDN_NET_DIALMODE_MASK 0xC0  /* bits for status                   */
339
#define  ISDN_NET_DM_OFF        0x00    /* this interface is stopped      */
340
#define  ISDN_NET_DM_MANUAL     0x40    /* this interface is on (manual)  */
341
#define  ISDN_NET_DM_AUTO       0x80    /* this interface is autodial     */
342
#define ISDN_NET_DIALMODE(x) ((&(x))->flags & ISDN_NET_DIALMODE_MASK)
343
 
344
#ifdef __KERNEL__
345
 
346
#ifndef STANDALONE
347
#include <linux/config.h>
348
#endif
349
#include <linux/errno.h>
350
#include <linux/fs.h>
351
#include <linux/major.h>
352
#include <asm/segment.h>
353
#include <asm/io.h>
354
#include <linux/kernel.h>
355
#include <linux/signal.h>
356
#include <linux/malloc.h>
357
#include <linux/timer.h>
358
#include <linux/wait.h>
359
#include <linux/tty.h>
360
#include <linux/tty_flip.h>
361
#include <linux/serial_reg.h>
362
#include <linux/fcntl.h>
363
#include <linux/types.h>
364
#include <linux/interrupt.h>
365
#include <linux/ip.h>
366
#include <linux/in.h>
367
#include <linux/netdevice.h>
368
#include <linux/etherdevice.h>
369
#include <linux/skbuff.h>
370
#include <linux/tcp.h>
371
 
372
#ifdef CONFIG_ISDN_PPP
373
 
374
#ifdef CONFIG_ISDN_PPP_VJ
375
#  include <net/slhc_vj.h>
376
#endif
377
 
378
#include <linux/ppp_defs.h>
379
#include <linux/if_ppp.h>
380
#include <linux/if_pppvar.h>
381
 
382
#include <linux/isdn_ppp.h>
383
#endif
384
 
385
#include <linux/isdnif.h>
386
 
387
#define ISDN_DRVIOCTL_MASK       0x7f  /* Mask for Device-ioctl */
388
 
389
/* Until now unused */
390
#define ISDN_SERVICE_VOICE 1
391
#define ISDN_SERVICE_AB    1<<1 
392
#define ISDN_SERVICE_X21   1<<2
393
#define ISDN_SERVICE_G4    1<<3
394
#define ISDN_SERVICE_BTX   1<<4
395
#define ISDN_SERVICE_DFUE  1<<5
396
#define ISDN_SERVICE_X25   1<<6
397
#define ISDN_SERVICE_TTX   1<<7
398
#define ISDN_SERVICE_MIXED 1<<8
399
#define ISDN_SERVICE_FW    1<<9
400
#define ISDN_SERVICE_GTEL  1<<10
401
#define ISDN_SERVICE_BTXN  1<<11
402
#define ISDN_SERVICE_BTEL  1<<12
403
 
404
/* Macros checking plain usage */
405
#define USG_NONE(x)         ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NONE)
406
#define USG_RAW(x)          ((x & ISDN_USAGE_MASK)==ISDN_USAGE_RAW)
407
#define USG_MODEM(x)        ((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM)
408
#define USG_VOICE(x)        ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE)
409
#define USG_NET(x)          ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NET)
410
#define USG_OUTGOING(x)     ((x & ISDN_USAGE_OUTGOING)==ISDN_USAGE_OUTGOING)
411
#define USG_MODEMORVOICE(x) (((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM) || \
412
                             ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE)     )
413
 
414
/* Timer-delays and scheduling-flags */
415
#define ISDN_TIMER_RES       3                     /* Main Timer-Resolution  */
416
#define ISDN_TIMER_02SEC     (HZ/(ISDN_TIMER_RES+1)/5) /* Slow-Timer1 .2 sec */
417
#define ISDN_TIMER_1SEC      (HZ/(ISDN_TIMER_RES+1)) /* Slow-Timer2 1 sec   */
418
#define ISDN_TIMER_RINGING   5 /* tty RINGs = ISDN_TIMER_1SEC * this factor */
419
#define ISDN_TIMER_MODEMREAD 1
420
#define ISDN_TIMER_MODEMPLUS 2
421
#define ISDN_TIMER_MODEMRING 4
422
#define ISDN_TIMER_MODEMXMIT 8
423
#define ISDN_TIMER_NETDIAL   16
424
#define ISDN_TIMER_NETHANGUP 32
425
#define ISDN_TIMER_IPPP      64
426
#define ISDN_TIMER_FAST      (ISDN_TIMER_MODEMREAD | ISDN_TIMER_MODEMPLUS | \
427
                              ISDN_TIMER_MODEMXMIT)
428
#define ISDN_TIMER_SLOW      (ISDN_TIMER_MODEMRING | ISDN_TIMER_NETHANGUP | \
429
                              ISDN_TIMER_NETDIAL)
430
 
431
/* Timeout-Values for isdn_net_dial() */
432
#define ISDN_TIMER_DTIMEOUT10 (10*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
433
#define ISDN_TIMER_DTIMEOUT15 (15*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
434
#define ISDN_TIMER_DTIMEOUT60 (60*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
435
 
436
/* GLOBAL_FLAGS */
437
#define ISDN_GLOBAL_STOPPED 1
438
 
439
/*=================== Start of ip-over-ISDN stuff =========================*/
440
 
441
/* Feature- and status-flags for a net-interface */
442
#define ISDN_NET_CONNECTED  0x01       /* Bound to ISDN-Channel             */
443
#define ISDN_NET_SECURE     0x02       /* Accept calls from phonelist only  */
444
#define ISDN_NET_CALLBACK   0x04       /* activate callback                 */
445
#define ISDN_NET_CBHUP      0x08       /* hangup before callback            */
446
#define ISDN_NET_CBOUT      0x10       /* remote machine does callback      */
447
#if 0
448
/* Unused??? */
449
#define ISDN_NET_CLONE      0x08       /* clone a tmp interface when called */
450
#define ISDN_NET_TMP        0x10       /* tmp interface until getting an IP */
451
#define ISDN_NET_DYNAMIC    0x20       /* this link is dynamically allocated */
452
#endif
453
 
454
/*
455
 * also see the ISDN_NET_DM_* defines earlier
456
 * (they are not here, as we need access to those in userspace)
457
 */
458
 
459
#define ISDN_NET_MAGIC      0x49344C02 /* for paranoia-checking             */
460
 
461
/* Phone-list-element */
462
typedef struct {
463
  void *next;
464
  char num[ISDN_MSNLEN];
465
} isdn_net_phone;
466
 
467
 
468
/* Local interface-data */
469
typedef struct isdn_net_local_s {
470
  ulong                  magic;
471
  char                   name[10];     /* Name of device                   */
472
  struct enet_statistics stats;        /* Ethernet Statistics              */
473
  int                    isdn_device;  /* Index to isdn-device             */
474
  int                    isdn_channel; /* Index to isdn-channel            */
475
  int                    ppp_slot;     /* PPPD device slot number          */
476
  int                    pre_device;   /* Preselected isdn-device          */
477
  int                    pre_channel;  /* Preselected isdn-channel         */
478
  int                    exclusive;    /* If non-zero idx to reserved chan.*/
479
  int                    flags;        /* Connection-flags                 */
480
  int                    dialretry;    /* Counter for Dialout-retries      */
481
  int                    dialmax;      /* Max. Number of Dial-retries      */
482
  int                    cbdelay;      /* Delay before Callback starts     */
483
  int                    dtimer;       /* Timeout-counter for dialing      */
484
  char                   msn[ISDN_MSNLEN]; /* MSNs/EAZs for this interface */
485
  u_char                 cbhup;        /* Flag: Reject Call before Callback*/
486
  u_char                 dialstate;    /* State for dialing                */
487
  u_char                 p_encap;      /* Packet encapsulation             */
488
                                       /*   0 = Ethernet over ISDN         */
489
                                       /*   1 = RAW-IP                     */
490
                                       /*   2 = IP with type field         */
491
  u_char                 l2_proto;     /* Layer-2-protocol                 */
492
                                       /* See ISDN_PROTO_L2..-constants in */
493
                                       /* isdnif.h                         */
494
                                       /*   0 = X75/LAPB with I-Frames     */
495
                                       /*   1 = X75/LAPB with UI-Frames    */
496
                                       /*   2 = X75/LAPB with BUI-Frames   */
497
                                       /*   3 = HDLC                       */
498
  u_char                 l3_proto;     /* Layer-3-protocol                 */
499
                                       /* See ISDN_PROTO_L3..-constants in */
500
                                       /* isdnif.h                         */
501
                                       /*   0 = Transparent                */
502
  int                    huptimer;     /* Timeout-counter for auto-hangup  */
503
  int                    charge;       /* Counter for charging units       */
504
  int                    chargetime;   /* Timer for Charging info          */
505
  int                    hupflags;     /* Flags for charge-unit-hangup:    */
506
                                       /* bit0: chargeint is invalid       */
507
                                       /* bit1: Getting charge-interval    */
508
                                       /* bit2: Do charge-unit-hangup      */
509
                                       /* bit3: Do hangup even on incoming */
510
  int                    outgoing;     /* Flag: outgoing call              */
511
  int                    onhtime;      /* Time to keep link up             */
512
  int                    chargeint;    /* Interval between charge-infos    */
513
  int                    onum;         /* Flag: at least 1 outgoing number */
514
  int                    cps;          /* current speed of this interface  */
515
  int                    transcount;   /* byte-counter for cps-calculation */
516
  int                    sqfull;       /* Flag: netdev-queue overloaded    */
517
  ulong                  sqfull_stamp; /* Start-Time of overload           */
518
  ulong                  slavedelay;   /* Dynamic bundling delaytime       */
519
  int                                   triggercps;     /* BogoCPS needed for triggering slave   */
520
  struct device          *srobin;      /* Ptr to Master device for slaves  */
521
  isdn_net_phone         *phone[2];    /* List of remote-phonenumbers      */
522
                                       /* phone[0] = Incoming Numbers      */
523
                                       /* phone[1] = Outgoing Numbers      */
524
  isdn_net_phone         *dial;        /* Pointer to dialed number         */
525
  struct device          *master;      /* Ptr to Master device for slaves  */
526
  struct device          *slave;       /* Ptr to Slave device for masters  */
527
  struct isdn_net_local_s *next;       /* Ptr to next link in bundle       */
528
  struct isdn_net_local_s *last;       /* Ptr to last link in bundle       */
529
  struct isdn_net_dev_s  *netdev;      /* Ptr to netdev                    */
530
  struct sk_buff         *first_skb;   /* Ptr to skb that triggers dialing */
531
  struct sk_buff         *sav_skb;     /* Ptr to skb, rejected by LL-driver*/
532
#if (LINUX_VERSION_CODE < 0x02010F)
533
                                       /* Ptr to orig. header_cache_bind   */
534
  void                   (*org_hcb)(struct hh_cache **,
535
                                    struct device *,
536
                                    unsigned short,
537
                                    __u32);
538
#else
539
#if (LINUX_VERSION_CODE < 0x2011E)
540
                                       /* Ptr to orig. hard_header_cache   */
541
  int                    (*org_hhc)(struct dst_entry *dst,
542
                                    struct dst_entry *neigh,
543
                                    struct hh_cache *hh);
544
#else
545
                                       /* Ptr to orig. hard_header_cache   */
546
  int                    (*org_hhc)(struct dst_entry *dst,
547
                                    struct neighbour *neigh,
548
                                    struct hh_cache *hh);
549
#endif
550
#endif
551
                                       /* Ptr to orig. header_cache_update */
552
  void                   (*org_hcu)(struct hh_cache *,
553
                                    struct device *,
554
                                    unsigned char *);
555
  int  pppbind;                        /* ippp device for bindings         */
556
  int                                   dialtimeout;    /* How long shall we try on dialing? (jiffies) */
557
  int                   dialwait;               /* How long shall we wait after failed attempt? (jiffies) */
558
  ulong                 dialstarted;    /* jiffies of first dialing-attempt */
559
  ulong                 dialwait_timer; /* jiffies of earliest next dialing-attempt */
560
  int                   huptimeout;     /* How long will the connection be up? (seconds) */
561
} isdn_net_local;
562
 
563
#ifdef CONFIG_ISDN_PPP
564
struct ippp_bundle {
565
  int mp_mrru;                        /* unused                             */
566
  struct mpqueue *last;               /* currently defined in isdn_net_dev  */
567
  int min;                            /* currently calculated 'on the fly'  */
568
  long next_num;                      /* we wanna see this seq.-number next */
569
  struct sqqueue *sq;
570
  int modify:1;                       /* set to 1 while modifying sqqueue   */
571
  int bundled:1;                      /* bundle active ?                    */
572
};
573
#endif
574
 
575
/* the interface itself */
576
typedef struct isdn_net_dev_s {
577
  isdn_net_local  local;
578
  isdn_net_local *queue;
579
  void           *next;                /* Pointer to next isdn-interface   */
580
  struct device   dev;                 /* interface to upper levels        */
581
#ifdef CONFIG_ISDN_PPP
582
  struct mpqueue *mp_last;
583
  struct ippp_bundle ib;
584
#endif
585
} isdn_net_dev;
586
 
587
/*===================== End of ip-over-ISDN stuff ===========================*/
588
 
589
/*======================= Start of ISDN-tty stuff ===========================*/
590
 
591
#define ISDN_ASYNC_MAGIC          0x49344C01 /* for paranoia-checking        */
592
#define ISDN_ASYNC_INITIALIZED    0x80000000 /* port was initialized         */
593
#define ISDN_ASYNC_CALLOUT_ACTIVE 0x40000000 /* Call out device active       */
594
#define ISDN_ASYNC_NORMAL_ACTIVE  0x20000000 /* Normal device active         */
595
#define ISDN_ASYNC_CLOSING        0x08000000 /* Serial port is closing       */
596
#define ISDN_ASYNC_CTS_FLOW       0x04000000 /* Do CTS flow control          */
597
#define ISDN_ASYNC_CHECK_CD       0x02000000 /* i.e., CLOCAL                 */
598
#define ISDN_ASYNC_HUP_NOTIFY         0x0001 /* Notify tty on hangups/closes */
599
#define ISDN_ASYNC_SESSION_LOCKOUT    0x0100 /* Lock cua opens on session    */
600
#define ISDN_ASYNC_PGRP_LOCKOUT       0x0200 /* Lock cua opens on pgrp       */
601
#define ISDN_ASYNC_CALLOUT_NOHUP      0x0400 /* No hangup for cui            */
602
#define ISDN_ASYNC_SPLIT_TERMIOS      0x0008 /* Sep. termios for dialin/out  */
603
#define ISDN_SERIAL_XMIT_SIZE           1024 /* default bufsize for write    */
604
#define ISDN_SERIAL_XMIT_MAX            4000 /* Maximum bufsize for write    */
605
#define ISDN_SERIAL_TYPE_NORMAL            1
606
#define ISDN_SERIAL_TYPE_CALLOUT           2
607
 
608
#ifdef CONFIG_ISDN_AUDIO
609
/* For using sk_buffs with audio we need some private variables
610
 * within each sk_buff. For this purpose, we declare a struct here,
611
 * and put it always at skb->head. A few macros help accessing the
612
 * variables. Of course, we need to check skb_headroom prior to
613
 * any access.
614
 */
615
typedef struct isdn_audio_skb {
616
  unsigned short dle_count;
617
  unsigned char  lock;
618
} isdn_audio_skb;
619
 
620
#define ISDN_AUDIO_SKB_DLECOUNT(skb) (((isdn_audio_skb*)skb->head)->dle_count)
621
#define ISDN_AUDIO_SKB_LOCK(skb) (((isdn_audio_skb*)skb->head)->lock)
622
#endif
623
 
624
/* Private data of AT-command-interpreter */
625
typedef struct atemu {
626
  u_char              profile[ISDN_MODEM_ANZREG]; /* Modem-Regs. Profile 0 */
627
  u_char              mdmreg[ISDN_MODEM_ANZREG];  /* Modem-Registers       */
628
  char                pmsn[ISDN_MSNLEN]; /* EAZ/MSNs Profile 0             */
629
  char                msn[ISDN_MSNLEN];/* EAZ/MSN                          */
630
#ifdef CONFIG_ISDN_AUDIO
631
  u_char              vpar[10];        /* Voice-parameters                 */
632
  int                 lastDLE;         /* Flag for voice-coding: DLE seen  */
633
#endif
634
  int                 mdmcmdl;         /* Length of Modem-Commandbuffer    */
635
  int                 pluscount;       /* Counter for +++ sequence         */
636
  int                 lastplus;        /* Timestamp of last +              */
637
  char                mdmcmd[255];     /* Modem-Commandbuffer              */
638
} atemu;
639
 
640
/* Private data (similar to async_struct in <linux/serial.h>) */
641
typedef struct modem_info {
642
  int                   magic;
643
  int                   flags;           /* defined in tty.h               */
644
  int                   x_char;          /* xon/xoff character             */
645
  int                   mcr;             /* Modem control register         */
646
  int                   msr;             /* Modem status register          */
647
  int                   lsr;             /* Line status register           */
648
  int                   line;
649
  int                   count;           /* # of fd on device              */
650
  int                   blocked_open;    /* # of blocked opens             */
651
  long                  session;         /* Session of opening process     */
652
  long                  pgrp;            /* pgrp of opening process        */
653
  int                   online;          /* 1 = B-Channel is up, drop data */
654
                                         /* 2 = B-Channel is up, deliver d.*/
655
  int                   dialing;         /* Dial in progress               */
656
  int                   rcvsched;        /* Receive needs schedule         */
657
  int                   isdn_driver;     /* Index to isdn-driver           */
658
  int                   isdn_channel;    /* Index to isdn-channel          */
659
  int                   drv_index;       /* Index to dev->usage            */
660
  int                   ncarrier;        /* Flag: schedule NO CARRIER      */
661
  unsigned char         last_cause[8];   /* Last cause message             */
662
  unsigned char         last_num[ISDN_MSNLEN];
663
                                         /* Last phone-number              */
664
  unsigned char         last_l2;         /* Last layer-2 protocol          */
665
  unsigned char         last_si;         /* Last service                   */
666
  unsigned char         last_lhup;       /* Last hangup local?             */
667
  unsigned char         last_dir;        /* Last direction (in or out)     */
668
  struct timer_list     nc_timer;        /* Timer for delayed NO CARRIER   */
669
  int                   send_outstanding;/* # of outstanding send-requests */
670
  int                   xmit_size;       /* max. # of chars in xmit_buf    */
671
  int                   xmit_count;      /* # of chars in xmit_buf         */
672
  unsigned char         *xmit_buf;       /* transmit buffer                */
673
  struct sk_buff_head   xmit_queue;      /* transmit queue                 */
674
#ifdef CONFIG_ISDN_AUDIO
675
  int                   vonline;         /* Voice-channel status           */
676
                                         /* Bit 0 = recording              */
677
                                         /* Bit 1 = playback               */
678
                                         /* Bit 2 = playback, DLE-ETX seen */
679
  struct sk_buff_head   dtmf_queue;      /* queue for dtmf results         */
680
  void                  *adpcms;         /* state for adpcm decompression  */
681
  void                  *adpcmr;         /* state for adpcm compression    */
682
  void                  *dtmf_state;     /* state for dtmf decoder         */
683
  void                  *silence_state;  /* state for silence detection    */
684
#endif
685
  struct tty_struct     *tty;            /* Pointer to corresponding tty   */
686
  atemu                 emu;             /* AT-emulator data               */
687
  struct termios        normal_termios;  /* For saving termios structs     */
688
  struct termios        callout_termios;
689
  struct wait_queue     *open_wait;
690
  struct wait_queue     *close_wait;
691
} modem_info;
692
 
693
#define ISDN_MODEM_WINSIZE 8
694
 
695
/* Description of one ISDN-tty */
696
typedef struct {
697
  int                refcount;                     /* Number of opens        */
698
  struct tty_driver  tty_modem;                    /* tty-device             */
699
  struct tty_driver  cua_modem;                    /* cua-device             */
700
  struct tty_struct  *modem_table[ISDN_MAX_CHANNELS]; /* ?? copied from Orig */
701
  struct termios     *modem_termios[ISDN_MAX_CHANNELS];
702
  struct termios     *modem_termios_locked[ISDN_MAX_CHANNELS];
703
  modem_info         info[ISDN_MAX_CHANNELS];      /* Private data           */
704
} modem;
705
 
706
/*======================= End of ISDN-tty stuff ============================*/
707
 
708
/*======================= Start of sync-ppp stuff ==========================*/
709
 
710
 
711
#define NUM_RCV_BUFFS     64
712
#define PPP_HARD_HDR_LEN 4
713
 
714
#ifdef CONFIG_ISDN_PPP
715
 
716
struct sqqueue {
717
  struct sqqueue *next;
718
  long sqno_start;
719
  long sqno_end;
720
  struct sk_buff *skb;
721
  long timer;
722
};
723
 
724
struct mpqueue {
725
  struct mpqueue *next;
726
  struct mpqueue *last;
727
  long    sqno;
728
  struct sk_buff *skb;
729
  int BEbyte;
730
  unsigned long time;
731
};
732
 
733
struct ippp_buf_queue {
734
  struct ippp_buf_queue *next;
735
  struct ippp_buf_queue *last;
736
  char *buf;                 /* NULL here indicates end of queue */
737
  int len;
738
};
739
 
740
struct ippp_struct {
741
  struct ippp_struct *next_link;
742
  int state;
743
  struct ippp_buf_queue rq[NUM_RCV_BUFFS]; /* packet queue for isdn_ppp_read() */
744
  struct ippp_buf_queue *first;  /* pointer to (current) first packet */
745
  struct ippp_buf_queue *last;   /* pointer to (current) last used packet in queue */
746
  struct wait_queue *wq;
747
  struct wait_queue *wq1;
748
  struct task_struct *tk;
749
  unsigned int mpppcfg;
750
  unsigned int pppcfg;
751
  unsigned int mru;
752
  unsigned int mpmru;
753
  unsigned int mpmtu;
754
  unsigned int maxcid;
755
  isdn_net_local *lp;
756
  int unit;
757
  int minor;
758
  long last_link_seqno;
759
  long mp_seqno;
760
  long range;
761
#ifdef CONFIG_ISDN_PPP_VJ
762
  unsigned char *cbuf;
763
  struct slcompress *slcomp;
764
#endif
765
  unsigned long debug;
766
  struct isdn_ppp_compressor *compressor, *link_compressor;
767
  void *decomp_stat,*comp_stat,*link_decomp_stat,*link_comp_stat;
768
#ifdef ISDN_SYNCPPP_READDRESS
769
  unsigned long old_pa_addr;
770
  unsigned long old_pa_dstaddr;
771
#endif
772
};
773
 
774
#endif
775
 
776
/*======================== End of sync-ppp stuff ===========================*/
777
 
778
/*======================= Start of general stuff ===========================*/
779
 
780
typedef struct {
781
  char *next;
782
  char *private;
783
} infostruct;
784
 
785
#define DRV_FLAG_RUNNING 1
786
#define DRV_FLAG_REJBUS  2
787
#define DRV_FLAG_LOADED  4
788
 
789
/* Description of hardware-level-driver */
790
typedef struct {
791
  ulong               online;           /* Channel-Online flags             */
792
  ulong               flags;            /* Misc driver flags                */
793
  int                 locks;            /* Number of locks for this driver  */
794
  int                 channels;         /* Number of channels               */
795
  struct wait_queue  *st_waitq;         /* Wait-Queue for status-read's     */
796
  int                 maxbufsize;       /* Maximum Buffersize supported     */
797
  unsigned long       pktcount;         /* Until now: unused                */
798
  int                 stavail;          /* Chars avail on Status-device     */
799
  isdn_if            *interface;        /* Interface to driver              */
800
  int                *rcverr;           /* Error-counters for B-Ch.-receive */
801
  int                *rcvcount;         /* Byte-counters for B-Ch.-receive  */
802
#ifdef CONFIG_ISDN_AUDIO
803
  unsigned long      DLEflag;           /* Flags: Insert DLE at next read   */
804
#endif
805
  struct sk_buff_head *rpqueue;         /* Pointers to start of Rcv-Queue   */
806
  struct wait_queue  **rcv_waitq;       /* Wait-Queues for B-Channel-Reads  */
807
  struct wait_queue  **snd_waitq;       /* Wait-Queue for B-Channel-Send's  */
808
  char               msn2eaz[10][ISDN_MSNLEN];  /* Mapping-Table MSN->EAZ   */
809
} driver;
810
 
811
/* Main driver-data */
812
typedef struct isdn_devt {
813
  unsigned short    flags;                     /* Bitmapped Flags:           */
814
                                               /*                            */
815
  int               drivers;                   /* Current number of drivers  */
816
  int               channels;                  /* Current number of channels */
817
  int               net_verbose;               /* Verbose-Flag               */
818
  int               modempoll;                 /* Flag: tty-read active      */
819
  int               tflags;                    /* Timer-Flags:               */
820
                                               /*  see ISDN_TIMER_..defines  */
821
  int               global_flags;
822
  infostruct        *infochain;                /* List of open info-devs.    */
823
  struct wait_queue *info_waitq;               /* Wait-Queue for isdninfo    */
824
  struct timer_list timer;                     /* Misc.-function Timer       */
825
  int               chanmap[ISDN_MAX_CHANNELS];/* Map minor->device-channel  */
826
  int               drvmap[ISDN_MAX_CHANNELS]; /* Map minor->driver-index    */
827
  int               usage[ISDN_MAX_CHANNELS];  /* Used by tty/ip/voice       */
828
  char              num[ISDN_MAX_CHANNELS][ISDN_MSNLEN];
829
                                               /* Remote number of active ch.*/
830
  int               m_idx[ISDN_MAX_CHANNELS];  /* Index for mdm....          */
831
  driver            *drv[ISDN_MAX_DRIVERS];    /* Array of drivers           */
832
  isdn_net_dev      *netdev;                   /* Linked list of net-if's    */
833
  char              drvid[ISDN_MAX_DRIVERS][20];/* Driver-ID                 */
834
  struct task_struct *profd;                   /* For iprofd                 */
835
  modem             mdm;                       /* tty-driver-data            */
836
  isdn_net_dev      *rx_netdev[ISDN_MAX_CHANNELS]; /* rx netdev-pointers     */
837
  isdn_net_dev      *st_netdev[ISDN_MAX_CHANNELS]; /* stat netdev-pointers   */
838
  ulong             ibytes[ISDN_MAX_CHANNELS]; /* Statistics incoming bytes  */
839
  ulong             obytes[ISDN_MAX_CHANNELS]; /* Statistics outgoing bytes  */
840
} isdn_dev;
841
 
842
extern isdn_dev *dev;
843
 
844
/* Utility-Macros */
845
#define MIN(a,b) ((a<b)?a:b)
846
#define MAX(a,b) ((a>b)?a:b)
847
 
848
#endif /* __KERNEL__ */
849
#endif /* isdn_h */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.