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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [linux/] [isdn.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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