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