]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - sys/i4b/include/i4b_ioctl.h
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.git] / sys / i4b / include / i4b_ioctl.h
1 /*-
2  * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23  * SUCH DAMAGE.
24  */
25
26 /*---------------------------------------------------------------------------
27  *
28  *      i4b_ioctl.h - messages kernel <--> userland
29  *      -------------------------------------------
30  *
31  * $FreeBSD$
32  *
33  *      last edit-date: [Sun Aug 11 19:19:08 2002]
34  *
35  *---------------------------------------------------------------------------*/
36
37 #ifndef _I4B_IOCTL_H_
38 #define _I4B_IOCTL_H_
39
40 /*---------------------------------------------------------------------------*
41  *      version and release number for isdn4bsd package
42  *---------------------------------------------------------------------------*/
43 #define VERSION         1               /* version number       */
44 #define REL             4               /* release number       */
45 #define STEP            1               /* release step         */
46
47 /*---------------------------------------------------------------------------*
48  * date/time format in i4b log messages
49  * ------------------------------------
50  * Being year 2000 clean is not easy with the current state of the
51  * ANSI C library standard and it's implementation for some locales.
52  * You might like to use the "%c" format of "strftime" sometimes,
53  * but this breaks Y2K in some locales. Also the old standard logfile
54  * format "%d.%m.%y %H:%M:%S" is non compliant.
55  * NetBSD's current toolset warns about this problems, and we compile
56  * with -Werror, so this problems need to be resolved.
57  *---------------------------------------------------------------------------*/
58 #define I4B_TIME_FORMAT "%d.%m.%Y %H:%M:%S"
59
60 /*---------------------------------------------------------------------------*
61  *      max number of controllers in system
62  *---------------------------------------------------------------------------*/
63 #define MAX_CONTROLLERS 8               /* max number of controllers    */
64
65 /*---------------------------------------------------------------------------*
66  *      ISDN D-channel protocols 
67  *---------------------------------------------------------------------------*/
68 #define PROTOCOL_DSS1   0               /* default, Euro-ISDN/DSS1 */
69 #define PROTOCOL_D64S   1               /* 64k leased line, no protocol */
70
71 /*---------------------------------------------------------------------------*
72  *      controller types
73  *---------------------------------------------------------------------------*/
74 #define CTRL_INVALID    (-1)            /* invalid, error               */
75 #define CTRL_UNKNOWN    0               /* unknown controller type      */
76 #define CTRL_PASSIVE    1               /* passive ISDN controller cards*/
77 #define CTRL_DAIC       2               /* Diehl active controller cards*/
78 #define CTRL_TINADD     3               /* Stollmann Tina-dd active card*/
79 #define CTRL_AVMB1      4               /* AVM B1 active card           */
80 #define CTRL_CAPI       5               /* cards seen via the CAPI layer*/
81 #define CTRL_CAPIMGR    6               /* boards accessed through the CAPI manager */
82 #define CTRL_NUMTYPES   7               /* number of controller types   */
83
84 /*---------------------------------------------------------------------------*
85  *      CTRL_PASSIVE: driver types
86  *---------------------------------------------------------------------------*/
87 #define MAXL1UNITS      8               /* max number of units  */
88
89 #define L1DRVR_ISIC     0               /* isic - driver        */
90 #define L1DRVR_IWIC     1               /* iwic - driver        */
91 #define L1DRVR_IFPI     2               /* ifpi - driver        */
92 #define L1DRVR_IHFC     3               /* ihfc - driver        */
93 #define L1DRVR_IFPNP    4               /* ifpnp - driver       */
94 #define L1DRVR_ICCHP    5               /* icchp - driver       */
95 #define L1DRVR_ITJC     6               /* itjc - driver        */
96 #define L1DRVR_IFPI2    7               /* ifpi2 - driver       */
97
98 /* MAXL1DRVR MUST be updated when more passive drivers are added !!! */
99 #define MAXL1DRVR       (L1DRVR_IFPI2 + 1)
100
101 /*---------------------------------------------------------------------------*
102  *      card types for CTRL_PASSIVE 
103  *---------------------------------------------------------------------------*/
104 #define CARD_TYPEP_INVAL        (-1)    /* invalid, error               */
105 #define CARD_TYPEP_UNK          0       /* unknown                      */
106 #define CARD_TYPEP_8            1       /* Teles, S0/8                  */
107 #define CARD_TYPEP_16           2       /* Teles, S0/16                 */
108 #define CARD_TYPEP_16_3         3       /* Teles, S0/16.3               */
109 #define CARD_TYPEP_AVMA1        4       /* AVM A1 or AVM Fritz!Card     */
110 #define CARD_TYPEP_163P         5       /* Teles, S0/16.3 PnP           */
111 #define CARD_TYPEP_CS0P         6       /* Creatix, S0 PnP              */
112 #define CARD_TYPEP_USRTA        7       /* US Robotics ISDN TA internal */
113 #define CARD_TYPEP_DRNNGO       8       /* Dr. Neuhaus Niccy GO@        */
114 #define CARD_TYPEP_SWS          9       /* Sedlbauer Win Speed          */
115 #define CARD_TYPEP_DYNALINK     10      /* Dynalink IS64PH              */
116 #define CARD_TYPEP_BLMASTER     11      /* ISDN Blaster / ISDN Master   */
117 #define CARD_TYPEP_PCFRITZ      12      /* AVM PCMCIA Fritz!Card        */
118 #define CARD_TYPEP_ELSAQS1ISA   13      /* ELSA QuickStep 1000pro ISA   */
119 #define CARD_TYPEP_ELSAQS1PCI   14      /* ELSA QuickStep 1000pro PCI   */
120 #define CARD_TYPEP_SIEMENSITALK 15      /* Siemens I-Talk               */
121 #define CARD_TYPEP_ELSAMLIMC    16      /* ELSA MicroLink ISDN/MC       */
122 #define CARD_TYPEP_ELSAMLMCALL  17      /* ELSA MicroLink MCall         */
123 #define CARD_TYPEP_ITKIX1       18      /* ITK ix1 micro                */
124 #define CARD_TYPEP_AVMA1PCI     19      /* AVM FRITZ!CARD PCI           */
125 #define CARD_TYPEP_PCC16        20      /* ELSA PCC-16                  */
126 #define CARD_TYPEP_AVM_PNP      21      /* AVM FRITZ!CARD PnP           */
127 #define CARD_TYPEP_SIE_ISURF2   22      /* Siemens I-Surf 2 PnP         */
128 #define CARD_TYPEP_ASUSCOMIPAC  23      /* Asuscom ISDNlink 128 K PnP   */
129 #define CARD_TYPEP_WINB6692     24      /* Winbond W6692 based          */
130 #define CARD_TYPEP_16_3C        25      /* Teles S0/16.3c PnP (HFC-S/SP */
131 #define CARD_TYPEP_ACERP10      26      /* Acer ISDN P10 (HFC-S)        */
132 #define CARD_TYPEP_TELEINT_NO_1 27      /* TELEINT ISDN SPEED No. 1 (HFC-1) */
133 #define CARD_TYPEP_CCD_HFCS_PCI 28      /* Cologne Chip HFC-S PCI based */
134 #define CARD_TYPEP_NETJET_S     29      /* Traverse NetJet-S (Tiger300) */
135 #define CARD_TYPEP_DIVA_ISA     30      /* Eicon DIVA ISA PnP 2.0 or 2.02 */
136 #define CARD_TYPEP_COMPAQ_M610  31      /* Compaq Microcom 610          */
137 #define CARD_TYPEP_AVMA1PCI_V2  32      /* AVM FRITZ!CARD PCI Ver. 2    */
138 /*
139  * in case you add support for more cards, please update:
140  *
141  *      isdnd:          controller.c, name_of_controller()
142  *
143  * and adjust CARD_TYPEP_MAX below.
144  */
145
146 #define CARD_TYPEP_MAX          32      /* max type */
147
148 /*---------------------------------------------------------------------------*
149  *      card types for CTRL_DAIC
150  *---------------------------------------------------------------------------*/
151 #define CARD_TYPEA_DAIC_UNK     0
152 #define CARD_TYPEA_DAIC_S       1
153 #define CARD_TYPEA_DAIC_SX      2
154 #define CARD_TYPEA_DAIC_SCOM    3
155 #define CARD_TYPEA_DAIC_QUAD    4
156
157 /*---------------------------------------------------------------------------*
158  *      card types for CTRL_CAPI
159  *---------------------------------------------------------------------------*/
160 #define CARD_TYPEC_CAPI_UNK     0
161 #define CARD_TYPEC_AVM_T1_PCI   1
162 #define CARD_TYPEC_AVM_B1_PCI   2
163 #define CARD_TYPEC_AVM_B1_ISA   3
164
165 /*---------------------------------------------------------------------------*
166  *      max length of some strings
167  *---------------------------------------------------------------------------*/
168 #define TELNO_MAX       41  /* max length of a telephone number (+ '\0')  */
169 #define SUBADDR_MAX     21  /* max length of a subaddress (+ '\0')        */
170 #define DISPLAY_MAX     91  /* max length of display information (+ '\0') */
171 #define DATETIME_MAX    21  /* max length of datetime information (+ '\0')*/
172 #define KEYPAD_MAX      35  /* max length of a keypad string (+ '\0')     */
173
174 /*---------------------------------------------------------------------------*
175  *      in case the src or dst telephone number is empty
176  *---------------------------------------------------------------------------*/
177 #define TELNO_EMPTY     "NotAvailable"  
178
179 /*---------------------------------------------------------------------------*
180  *      B channel parameters
181  *---------------------------------------------------------------------------*/
182 #define BCH_MAX_DATALEN 2048    /* max length of a B channel frame */
183
184 /*---------------------------------------------------------------------------*
185  * userland driver types
186  * ---------------------
187  * a "driver" is defined here as a piece of software interfacing an 
188  * ISDN B channel with a userland service, such as IP, Telephony etc.
189  *---------------------------------------------------------------------------*/
190 #define BDRV_RBCH       0       /* raw b-channel interface driver       */
191 #define BDRV_TEL        1       /* telephone (speech) interface driver  */
192 #define BDRV_IPR        2       /* IP over raw HDLC interface driver    */
193 #define BDRV_ISPPP      3       /* sync Kernel PPP interface driver     */
194 #define BDRV_IBC        4       /* BSD/OS point to point driver         */
195 #define BDRV_ING        5       /* NetGraph ing driver                  */
196
197 /*---------------------------------------------------------------------------*
198  * B channel protocol
199  *---------------------------------------------------------------------------*/
200 #define BPROT_NONE      0       /* no protocol at all, raw data         */
201 #define BPROT_RHDLC     1       /* raw HDLC: flag, data, crc, flag      */
202
203 /*---------------------------------------------------------------------------*
204  * special bearer capability settings (i.e. Data over Voice)
205  *---------------------------------------------------------------------------*/
206 #define BCAP_NONE       0       /* no special bearer capability         */
207 #define BCAP_DOV        1       /* Data over Voice                      */
208
209 /*---------------------------------------------------------------------------*
210  * causes data type
211  *---------------------------------------------------------------------------*/
212 typedef unsigned int cause_t;           /* 32 bit unsigned int  */
213
214 /*---------------------------------------------------------------------------*
215  * call descriptor id (cdid) definitions
216  *---------------------------------------------------------------------------*/
217 #define CDID_UNUSED     0       /* cdid is invalid and unused           */
218 #define CDID_MAX        99999   /* highest valid cdid, wraparound to 1  */
219
220 /*---------------------------------------------------------------------------*
221  *      The shorthold algorithm to use
222  *---------------------------------------------------------------------------*/
223 #define SHA_FIXU        0    /* timeout algorithm for fix unit charging */
224 #define SHA_VARU        1    /* timeout algorithm for variable unit charging */
225
226 /*---------------------------------------------------------------------------*
227  *      The shorthold data struct
228  *---------------------------------------------------------------------------*/
229 typedef struct {
230         int     shorthold_algorithm;    /* shorthold algorithm to use   */
231         int     unitlen_time;           /* length of a charging unit    */
232         int     idle_time;              /* time without activity on b ch*/
233         int     earlyhup_time;          /* safety area at end of unit   */
234 } msg_shorthold_t;
235
236
237 /****************************************************************************
238
239         outgoing call:
240         --------------
241
242                 userland                kernel
243                 --------                ------
244
245                 CDID_REQ ----------------->
246
247                     <------------------ cdid
248         
249                 CONNECT_REQ -------------->
250
251                     <------------------ PROCEEDING_IND (if connect req ok)
252
253                     <------------------ CONNECT_ACTIVE_IND (if connection ok)
254
255                 or
256
257                     <------------------ DISCONNECT_IND (if connection failed)
258                     
259                 
260
261         incoming call:
262         --------------
263
264                 userland                kernel
265                 --------                ------
266
267                     <------------------ CONNECT_IND
268
269                 CONNECT_RESP ------------->
270
271                     <------------------ CONNECT_ACTIVE_IND (if accepted)
272
273
274
275         active disconnect:
276         ------------------
277
278                 userland                kernel
279                 --------                ------
280
281                 DISCONNECT_REQ ------------>
282
283                     <------------------ DISCONNECT_IND
284                     
285
286         passive disconnect:
287         -------------------
288
289                 userland                kernel
290                 --------                ------
291
292                     <------------------ DISCONNECT_IND
293                     
294
295 ****************************************************************************/
296
297
298 /*===========================================================================*
299  *===========================================================================*
300  *      "read" messages from kernel -> userland
301  *===========================================================================* 
302  *===========================================================================*/
303
304  
305 /*---------------------------------------------------------------------------*
306  *      message header, included in every message
307  *---------------------------------------------------------------------------*/
308 typedef struct {
309         char            type;           /* message identifier           */
310 #define MSG_CONNECT_IND         'a'
311 #define MSG_CONNECT_ACTIVE_IND  'b'
312 #define MSG_DISCONNECT_IND      'c'
313 #define MSG_DIALOUT_IND         'd'
314 #define MSG_IDLE_TIMEOUT_IND    'e'
315 #define MSG_ACCT_IND            'f'
316 #define MSG_CHARGING_IND        'g'
317 #define MSG_PROCEEDING_IND      'h'
318 #define MSG_ALERT_IND           'i'
319 #define MSG_DRVRDISC_REQ        'j'
320 #define MSG_L12STAT_IND         'k'
321 #define MSG_TEIASG_IND          'l'
322 #define MSG_PDEACT_IND          'm'
323 #define MSG_NEGCOMP_IND         'n'
324 #define MSG_IFSTATE_CHANGED_IND 'o'
325 #define MSG_DIALOUTNUMBER_IND   'p'
326 #define MSG_PACKET_IND          'q'
327 #define MSG_KEYPAD_IND          'r'
328         int             cdid;           /* call descriptor id           */
329 } msg_hdr_t;
330
331 /*---------------------------------------------------------------------------*
332  *      connect indication
333  *              indicates incoming connection
334  *---------------------------------------------------------------------------*/
335 typedef struct {
336         msg_hdr_t       header;         /* common header                */
337         int             controller;     /* controller number            */
338         int             channel;        /* channel number               */
339 #define  CHAN_B1  0             /* this _must_ be 0, HSCX B1 is also 0  */
340 #define  CHAN_B2  1             /* this _must_ be 1, HSCX B2 is also 1  */
341 #define  CHAN_ANY (-1)          /* outgoing, not possible for incoming  */
342 #define  CHAN_NO  (-2)          /* call waiting (CW) for incoming       */
343         int             bprot;  /* b channel protocot, see BPROT_XXX    */
344         int             bcap;   /* special bearer capability, see BCAP_XXX */
345         char            dst_telno[TELNO_MAX];   /* destination telno    */
346         char            dst_subaddr[SUBADDR_MAX];       /* dest subaddr */
347         char            src_telno[TELNO_MAX];   /* source telno         */
348         char            src_subaddr[SUBADDR_MAX];       /* src subaddr  */
349         int             dst_ton;                /* dest. type of number */
350         int             src_ton;                /* src. type of number  */
351 #define  TON_OTHER    0         /* other type of number                 */
352 #define  TON_INTERNAT 1         /* international number                 */
353 #define  TON_NATIONAL 2         /* national number                      */
354         int             scr_ind;/* screening indicator                  */
355 #define  SCR_NONE     0         /* no screening indicator transmitted   */
356 #define  SCR_USR_NOSC 1         /* screening user provided, not screened*/
357 #define  SCR_USR_PASS 2         /* screening user provided, verified & passed */
358 #define  SCR_USR_FAIL 3         /* screening user provided, verified & failed */
359 #define  SCR_NET      4         /* screening network provided           */
360         int             prs_ind;/* presentation indicator               */
361 #define  PRS_NONE     0         /* no presentation indicator transmitted*/
362 #define  PRS_ALLOWED  1         /* presentation allowed                 */
363 #define  PRS_RESTRICT 2         /* presentation restricted              */
364 #define  PRS_NNINTERW 3         /* number not available due to interworking */
365 #define  PRS_RESERVED 4         /* reserved                             */
366         char            display[DISPLAY_MAX];   /* content of display IE*/
367 } msg_connect_ind_t;
368
369 /*---------------------------------------------------------------------------*
370  *      connect active indication
371  *              indicates active connection
372  *---------------------------------------------------------------------------*/
373 typedef struct {
374         msg_hdr_t       header;         /* common header                   */
375         int             controller;     /* controller number actually used */
376         int             channel;        /* channel number actually used    */
377         char            datetime[DATETIME_MAX]; /* content of date/time IE */
378 } msg_connect_active_ind_t;
379
380 /*---------------------------------------------------------------------------*
381  *      disconnect indication
382  *              indicates a disconnect
383  *---------------------------------------------------------------------------*/
384 typedef struct {
385         msg_hdr_t       header;         /* common header        */
386         cause_t         cause;          /* cause code           */
387 } msg_disconnect_ind_t;
388
389 /*---------------------------------------------------------------------------*
390  *      negotiation complete
391  *              indicates an interface is completely up & running
392  *---------------------------------------------------------------------------*/
393 typedef struct {
394         msg_hdr_t       header;         /* common header        */
395 } msg_negcomplete_ind_t;
396
397 /*---------------------------------------------------------------------------*
398  *      interface changes internal state
399  *              indicates an interface has somehow switched its FSM
400  *---------------------------------------------------------------------------*/
401 typedef struct {
402         msg_hdr_t       header;         /* common header        */
403         int state;                      /* new interface state */
404 } msg_ifstatechg_ind_t;
405
406 /*---------------------------------------------------------------------------*
407  *      initiate a call to a remote site
408  *              i.e. the IP driver got a packet and wants a connection
409  *---------------------------------------------------------------------------*/
410 typedef struct {
411         msg_hdr_t       header;         /* common header        */
412         int             driver;         /* driver type          */
413         int             driver_unit;    /* driver unit number   */
414 } msg_dialout_ind_t;
415
416 /*---------------------------------------------------------------------------*
417  *      dial a number
418  *---------------------------------------------------------------------------*/
419 typedef struct {
420         msg_hdr_t       header;         /* common header        */
421         int             driver;         /* driver type          */
422         int             driver_unit;    /* driver unit number   */
423         int             cmdlen;         /* length of string     */
424         int             subaddrlen;     /* length of subaddr    */
425         char            cmd[TELNO_MAX]; /* the number to dial   */      
426         char            subaddr[SUBADDR_MAX];   /* dest subaddr */      
427 } msg_dialoutnumber_ind_t;
428
429 /*---------------------------------------------------------------------------*
430  *      send keypad string
431  *---------------------------------------------------------------------------*/
432 typedef struct {
433         msg_hdr_t       header;         /* common header        */
434         int             driver;         /* driver type          */
435         int             driver_unit;    /* driver unit number   */
436         int             cmdlen;         /* length of string     */
437         char            cmd[KEYPAD_MAX];/* keypad string        */      
438 } msg_keypad_ind_t;
439
440 /*---------------------------------------------------------------------------*
441  *      idle timeout disconnect sent indication
442  *              kernel has sent disconnect request because of b-ch idle
443  *---------------------------------------------------------------------------*/
444 typedef struct {
445         msg_hdr_t       header;         /* common header        */
446 } msg_idle_timeout_ind_t;
447
448 /*---------------------------------------------------------------------------*
449  *      accounting information from userland interface driver to daemon
450  *---------------------------------------------------------------------------*/
451 typedef struct {
452         msg_hdr_t       header;         /* common header                */
453         int             accttype;       /* accounting type              */
454 #define  ACCT_DURING 0
455 #define  ACCT_FINAL  1
456         int             driver;         /* driver type                  */
457         int             driver_unit;    /* driver unit number           */
458         int             ioutbytes;      /* ISDN # of bytes sent         */
459         int             iinbytes;       /* ISDN # of bytes received     */
460         int             outbps;         /* bytes per sec out            */
461         int             inbps;          /* bytes per sec in             */
462         int             outbytes;       /* driver # of bytes sent       */
463         int             inbytes;        /* driver # of bytes received   */
464 } msg_accounting_ind_t;
465
466 /*---------------------------------------------------------------------------*
467  *      charging information from isdn driver to daemon
468  *---------------------------------------------------------------------------*/
469 typedef struct {
470         msg_hdr_t       header;         /* common header                */
471         int             units;          /* number of units              */
472         int             units_type;     /* type of units info           */
473 #define  CHARGE_INVALID 0       /* invalid, unknown */
474 #define  CHARGE_AOCD    1       /* advice of charge during call */
475 #define  CHARGE_AOCE    2       /* advice of charge at end of call */
476 #define  CHARGE_CALC    3       /* locally calculated from rates information */
477 } msg_charging_ind_t;
478
479 /*---------------------------------------------------------------------------*
480  *      call proceeding indication
481  *              indicates outgoing SETUP has been acknowleged
482  *---------------------------------------------------------------------------*/
483 typedef struct {
484         msg_hdr_t       header;         /* common header                   */
485         int             controller;     /* controller number actually used */
486         int             channel;        /* channel number actually used    */
487 } msg_proceeding_ind_t;
488
489 /*---------------------------------------------------------------------------*
490  *      alert indication
491  *              indicates remote user side "rings"
492  *---------------------------------------------------------------------------*/
493 typedef struct {
494         msg_hdr_t       header;         /* common header                   */
495 } msg_alert_ind_t;
496
497 /*---------------------------------------------------------------------------*
498  *      driver requests to disconnect line
499  *---------------------------------------------------------------------------*/
500 typedef struct {
501         msg_hdr_t       header;         /* common header        */
502         int             driver;         /* driver type          */
503         int             driver_unit;    /* driver unit number   */
504 } msg_drvrdisc_req_t;
505
506 /*---------------------------------------------------------------------------*
507  *      connect packet logging
508  *---------------------------------------------------------------------------*/
509
510 typedef struct {
511         msg_hdr_t       header;         /* common header        */
512         int             driver;         /* driver type          */
513         int             driver_unit;    /* driver unit number   */
514         int             direction;      /* 0=in 1=out           */
515 #define DIRECTION_IN    0               /* sending packet to remote     */
516 #define DIRECTION_OUT   1               /* received packet from remote  */
517 #define MAX_PACKET_LOG  40              /* space for IP and TCP header  */
518         u_int8_t        pktdata[MAX_PACKET_LOG];
519 } msg_packet_ind_t;
520
521 /*---------------------------------------------------------------------------*
522  *      state of layer 1/2
523  *---------------------------------------------------------------------------*/
524 typedef struct {
525         msg_hdr_t       header;         /* common header        */
526         int             controller;     /* controller unit      */
527         int             layer;          /* layer number (1/2)   */
528 #define LAYER_ONE       1
529 #define LAYER_TWO       2
530         int             state;          /* state info           */
531 #define LAYER_IDLE      0
532 #define LAYER_ACTIVE    1
533 } msg_l12stat_ind_t;
534
535 /*---------------------------------------------------------------------------*
536  *      TEI assignment messages
537  *---------------------------------------------------------------------------*/
538 typedef struct {
539         msg_hdr_t       header;         /* common header        */
540         int             controller;     /* controller unit      */
541         int             tei;            /* TEI or -1 if invalid */
542 } msg_teiasg_ind_t;
543
544 /*---------------------------------------------------------------------------*
545  *      persistent deactivation state of stack
546  *---------------------------------------------------------------------------*/
547 typedef struct {
548         msg_hdr_t       header;         /* common header        */
549         int             controller;     /* controller unit      */
550         int             numactive;      /* number of active connections */
551 } msg_pdeact_ind_t;
552
553
554 /*===========================================================================*
555  *===========================================================================*
556  *      "ioctl" messages from userland -> kernel
557  *===========================================================================* 
558  *===========================================================================*/
559
560 /*---------------------------------------------------------------------------*
561  *      request a unique cdid (to setup an outgoing call)
562  *---------------------------------------------------------------------------*/
563 typedef struct {
564         int             cdid;                   /* call descriptor id   */
565 } msg_cdid_req_t;
566  
567 #define I4B_CDID_REQ            _IOWR('4', 0, int)
568
569 /*---------------------------------------------------------------------------*
570  *      connect request
571  *              requests an outgoing connection
572  *---------------------------------------------------------------------------*/
573 typedef struct {
574         int             cdid;           /* call descriptor id                */
575         int             controller;     /* controller to use                 */
576         int             channel;        /* channel to use                    */
577         int             txdelay;        /* tx delay after connect            */
578         int             bprot;          /* b channel protocol                */
579         int             bcap;           /* special bearer capability         */ 
580         int             driver;         /* driver to route b channel data to */
581         int             driver_unit;    /*      unit number for above driver */
582         msg_shorthold_t shorthold_data; /* the shorthold data                */
583         int             unitlen_method; /* how to calculate the unitlength   */
584 #define  ULEN_METHOD_STATIC  0  /* use unitlen_time value (see above) */
585 #define  ULEN_METHOD_DYNAMIC 1  /* use AOCD */  
586         char            dst_telno[TELNO_MAX];   /* destination telephone no  */
587         char            dst_subaddr[SUBADDR_MAX];       /* dest subaddr      */
588         char            src_telno[TELNO_MAX];   /* source telephone number   */
589         char            src_subaddr[SUBADDR_MAX];       /* source subaddr    */
590         char            keypad[KEYPAD_MAX];     /* keypad string             */ 
591 } msg_connect_req_t;
592
593 #define I4B_CONNECT_REQ _IOW('4', 1, msg_connect_req_t)
594
595 /*---------------------------------------------------------------------------*
596  *      connect response
597  *              this is the answer to an incoming connect indication
598  *---------------------------------------------------------------------------*/
599 typedef struct {
600         int     cdid;           /* call descriptor id                   */
601         int     response;       /* what to do with incoming call        */
602 #define  SETUP_RESP_DNTCRE 0    /* dont care, call is not for me        */
603 #define  SETUP_RESP_REJECT 1    /* reject call                          */
604 #define  SETUP_RESP_ACCEPT 2    /* accept call                          */
605         cause_t cause;          /* cause for case SETUP_RESP_REJECT     */
606                 /* the following are only used for SETUP_RESP_ACCEPT !! */
607         int     txdelay;        /* tx delay after connect               */
608         int     bprot;          /* B chan protocol                      */
609         int     bcap;           /* special bearer capability            */      
610         int     driver;         /* driver to route b channel data to    */
611         int     driver_unit;    /*      unit number for above driver    */
612         int     max_idle_time;  /* max time without activity on b ch    */      
613 } msg_connect_resp_t;
614         
615 #define I4B_CONNECT_RESP        _IOW('4', 2, msg_connect_resp_t)
616
617 /*---------------------------------------------------------------------------*
618  *      disconnect request
619  *              active disconnect request
620  *---------------------------------------------------------------------------*/
621 typedef struct {
622         int     cdid;           /* call descriptor id                   */
623         cause_t cause;          /* protocol independent cause           */
624 } msg_discon_req_t;
625         
626 #define I4B_DISCONNECT_REQ      _IOW('4', 3, msg_discon_req_t)
627
628 /*---------------------------------------------------------------------------*
629  *      controller info request
630  *---------------------------------------------------------------------------*/
631 typedef struct {
632         int     controller;     /* controller number                    */
633         int     ncontroller;    /* number of controllers in system      */
634         int     ctrl_type;      /* controller type passive/active       */
635         int     card_type;      /* brand / version                      */
636         int     tei;            /* tei controller probably has          */
637         int     nbch;           /* number of b channels provided        */
638 } msg_ctrl_info_req_t;
639         
640 #define I4B_CTRL_INFO_REQ       _IOWR('4', 4, msg_ctrl_info_req_t)
641
642 /*---------------------------------------------------------------------------*
643  *      dialout response
644  *              status report to driver who requested a dialout
645  *---------------------------------------------------------------------------*/
646 typedef struct {
647         int             driver;         /* driver to route b channel data to */
648         int             driver_unit;    /*      unit number for above driver */
649         int             stat;           /* state of dialout request          */
650 #define  DSTAT_NONE     0
651 #define  DSTAT_TFAIL    1               /* transient failure */
652 #define  DSTAT_PFAIL    2               /* permanent failure */
653 #define  DSTAT_INONLY   3               /* no outgoing dials allowed */
654         cause_t         cause;          /* exact i4b cause */
655 } msg_dialout_resp_t;
656
657 #define I4B_DIALOUT_RESP        _IOW('4', 5, msg_dialout_resp_t)
658         
659 /*---------------------------------------------------------------------------*
660  *      timeout value update
661  *---------------------------------------------------------------------------*/
662 typedef struct {
663         int     cdid;           /* call descriptor id                   */
664         msg_shorthold_t shorthold_data;
665 } msg_timeout_upd_t;
666         
667 #define I4B_TIMEOUT_UPD         _IOW('4', 6, msg_timeout_upd_t)
668
669 /*---------------------------------------------------------------------------*
670  *      soft enable/disable
671  *---------------------------------------------------------------------------*/
672 typedef struct {
673         int             driver;         /* driver to route b channel data to */
674         int             driver_unit;    /*      unit number for above driver */
675         int             updown;         /* what to do                        */
676 #define  SOFT_ENA       0       /* enable interface */
677 #define  SOFT_DIS       1       /* disable interface */
678 } msg_updown_ind_t;
679
680 #define I4B_UPDOWN_IND          _IOW('4', 7, msg_updown_ind_t)
681
682 /*---------------------------------------------------------------------------*
683  *      send alert request
684  *---------------------------------------------------------------------------*/
685 typedef struct {
686         int     cdid;           /* call descriptor id                   */
687 } msg_alert_req_t;
688         
689 #define I4B_ALERT_REQ           _IOW('4', 8, msg_alert_req_t)
690
691 /*---------------------------------------------------------------------------*
692  *      request version and release info from kernel part
693  *      (msg_vr_req_t is also used by tel & rbch drivers)
694  *---------------------------------------------------------------------------*/
695 typedef struct {
696         int     version;        /* version number */
697         int     release;        /* release number */
698         int     step;           /* release step number */       
699 } msg_vr_req_t;
700
701 #define I4B_VR_REQ              _IOR('4', 9, msg_vr_req_t)
702
703 /*---------------------------------------------------------------------------*
704  *      set ISDN protocol used by a controller
705  *---------------------------------------------------------------------------*/
706 typedef struct {
707         int     controller;     /* controller number            */
708         int     protocol;       /* ISDN D-channel protocol type */
709 } msg_prot_ind_t;
710
711 #define I4B_PROT_IND            _IOW('4', 10, msg_prot_ind_t)
712
713 /*---------------------------------------------------------------------------*
714  *      Protocol download to active cards
715  *---------------------------------------------------------------------------*/
716 struct isdn_dr_prot {
717         size_t bytecount;       /* length of code */
718         u_int8_t *microcode;    /* pointer to microcode */
719 };
720
721 struct isdn_download_request {
722         int controller;         /* controller number */
723         int numprotos;          /* number of protocols in 'protocols' */
724         struct isdn_dr_prot *protocols;
725 };
726
727 #define I4B_CTRL_DOWNLOAD       _IOW('4', 100, struct isdn_download_request)
728
729 /*---------------------------------------------------------------------------*
730  *      Generic diagnostic interface for active cards
731  *---------------------------------------------------------------------------*/
732 struct isdn_diagnostic_request {
733         int controller;         /* controller number */
734         u_int32_t cmd;          /* diagnostic command to execute */
735         size_t in_param_len;    /* length of additional input parameter */
736 #define I4B_ACTIVE_DIAGNOSTIC_MAXPARAMLEN       65536
737         void *in_param;         /* optional input parameter */
738         size_t out_param_len;   /* available output space */
739         void *out_param;        /* output data goes here */
740 };
741
742 #define I4B_ACTIVE_DIAGNOSTIC   _IOW('4', 102, struct isdn_diagnostic_request)
743
744 #endif /* _I4B_IOCTL_H_ */