summaryrefslogtreecommitdiffstats
path: root/sys/i4b/include
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1998-12-27 21:47:14 +0000
committerphk <phk@FreeBSD.org>1998-12-27 21:47:14 +0000
commitc7ecc129d72ba32b5d83c9a6019e93fd181d719c (patch)
tree8d5099bc7ef24151b4f6deb00d1d34a7e7ac694a /sys/i4b/include
parent3f431df8ec46b86090ad59ee153872c45d4d429d (diff)
downloadFreeBSD-src-c7ecc129d72ba32b5d83c9a6019e93fd181d719c.zip
FreeBSD-src-c7ecc129d72ba32b5d83c9a6019e93fd181d719c.tar.gz
Initial entry of ISDN4BSD into the FreeBSD tree.
ISDN4BSD is the work of our brand-new comitter: Hellmuth Michaelis, who has done a tremendous amount of work to bring us this far. There are still some outstanding issues and files to bring into the tree, and for now it will be needed to pick up all the extra docs from the isdn4bsd release. It is probably also a very good idea to subscribe to the isdn@freebsd.org mailing list before you try this out. These files correspond to release "beta Version 0.70.00 / December 1998" from Hellmuth.
Diffstat (limited to 'sys/i4b/include')
-rw-r--r--sys/i4b/include/i4b_cause.h144
-rw-r--r--sys/i4b/include/i4b_debug.h219
-rw-r--r--sys/i4b/include/i4b_global.h95
-rw-r--r--sys/i4b/include/i4b_ioctl.h606
-rw-r--r--sys/i4b/include/i4b_isdnq931.h166
-rw-r--r--sys/i4b/include/i4b_l1l2.h99
-rw-r--r--sys/i4b/include/i4b_l2l3.h116
-rw-r--r--sys/i4b/include/i4b_l3l4.h260
-rw-r--r--sys/i4b/include/i4b_mbuf.h51
-rw-r--r--sys/i4b/include/i4b_tel_ioctl.h52
-rw-r--r--sys/i4b/include/i4b_trace.h91
11 files changed, 1899 insertions, 0 deletions
diff --git a/sys/i4b/include/i4b_cause.h b/sys/i4b/include/i4b_cause.h
new file mode 100644
index 0000000..439db4e
--- /dev/null
+++ b/sys/i4b/include/i4b_cause.h
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *---------------------------------------------------------------------------
+ *
+ * i4b_cause.h - causes and cause handling for i4b
+ * -----------------------------------------------
+ *
+ * $Id: i4b_cause.h,v 1.8 1998/12/05 18:05:55 hm Exp $
+ *
+ * last edit-date: [Sat Dec 5 18:36:30 1998]
+ *
+ *---------------------------------------------------------------------------*/
+
+#ifndef _I4B_CAUSE_H_
+#define _I4B_CAUSE_H_
+
+/*---------------------------------------------------------------------------*
+ * ISDN4BSD internal causes specification
+ *---------------------------------------------------------------------------*/
+
+#define CAUSE_VAL 0x000000ff /* cause value */
+#define CAUSE_TYPE 0x0000ff00 /* cause type */
+#define CAUSET_Q850 0 /* value coded according to Q.850 */
+#define CAUSET_I4B 1 /* i4b protocol independent causes*/
+
+#define GET_CAUSE_VAL(cause) ((cause) & 0xff)
+#define SET_CAUSE_VAL(dest, val) ((dest) = ((dest & 0xffffff00) | \
+ (val & 0x000000ff)))
+
+#define GET_CAUSE_TYPE(cause) (((cause) >> 8) & 0xff)
+#define SET_CAUSE_TYPE(dest, type) ((dest) = ((dest & 0xffff00ff) | \
+ ((type << 8) & 0x0000ff00)))
+
+#define SET_CAUSE_TV(dest, type, val) ((dest) = ((val & 0x000000ff) | \
+ ((type << 8) & 0x0000ff00)))
+
+/* CAUSET_I4B - protocol independent cause values */
+
+#define CAUSE_I4B_NORMAL 0 /* normal call clearing */
+#define CAUSE_I4B_BUSY 1 /* user busy */
+#define CAUSE_I4B_NOCHAN 2 /* circuit/channel not available*/
+#define CAUSE_I4B_INCOMP 3 /* incompatible source/dest */
+#define CAUSE_I4B_REJECT 4 /* call rejected */
+#define CAUSE_I4B_OOO 5 /* destination out of order */
+#define CAUSE_I4B_TMPFAIL 6 /* temporary failure */
+#define CAUSE_I4B_L1ERROR 7 /* L1 error / persistent deact */
+#define CAUSE_I4B_MAX 8
+
+/* CAUSET_Q850 - causes defined in Q.850 */
+
+#define CAUSE_Q850_SHUTDN 0x00 /* normal D-channel shutdown */
+#define CAUSE_Q850_NUNALLC 0x01 /* Unallocated (unassigned) number */
+#define CAUSE_Q850_NRTTN 0x02 /* No route to specified transit network */
+#define CAUSE_Q850_NRTDST 0x03 /* No route to destination */
+#define CAUSE_Q850_SSINFTN 0x04 /* Send special information tone */
+#define CAUSE_Q850_MDIALTP 0x05 /* Misdialled trunk prefix */
+#define CAUSE_Q850_CHUNACC 0x06 /* Channel unacceptable */
+#define CAUSE_Q850_CALLAWD 0x07 /* Call awarded and being delivered in an established channel */
+#define CAUSE_Q850_PREEMPT 0x08 /* Preemption */
+#define CAUSE_Q850_PREECRR 0x09 /* Preemption - circuit reserved for reuse */
+#define CAUSE_Q850_NCCLR 0x10 /* Normal call clearing */
+#define CAUSE_Q850_USRBSY 0x11 /* User busy */
+#define CAUSE_Q850_NOUSRRSP 0x12 /* No user responding */
+#define CAUSE_Q850_NOANSWR 0x13 /* No answer from user (user alerted) */
+#define CAUSE_Q850_SUBSABS 0x14 /* Subscriber absent */
+#define CAUSE_Q850_CALLREJ 0x15 /* Call rejected */
+#define CAUSE_Q850_NUCHNG 0x16 /* Number changed */
+#define CAUSE_Q850_NONSELUC 0x1A /* Non-selected user clearing */
+#define CAUSE_Q850_DSTOOORDR 0x1B /* Destination out of order */
+#define CAUSE_Q850_INVNUFMT 0x1C /* Invalid number format */
+#define CAUSE_Q850_FACREJ 0x1D /* Facility rejected */
+#define CAUSE_Q850_STENQRSP 0x1E /* Response to STATUS ENQUIRY */
+#define CAUSE_Q850_NORMUNSP 0x1F /* Normal, unspecified */
+#define CAUSE_Q850_NOCAVAIL 0x22 /* No circuit / channel available */
+#define CAUSE_Q850_NETOOORDR 0x26 /* Network out of order */
+#define CAUSE_Q850_PFMCDOOSERV 0x27 /* Permanent frame mode connection out of service */
+#define CAUSE_Q850_PFMCOPER 0x28 /* Permanent frame mode connection operational */
+#define CAUSE_Q850_TMPFAIL 0x29 /* Temporary failure */
+#define CAUSE_Q850_SWEQCONG 0x2A /* Switching equipment congestion */
+#define CAUSE_Q850_ACCINFDIS 0x2B /* Access information discarded */
+#define CAUSE_Q850_REQCNOTAV 0x2C /* Requested circuit/channel not available */
+#define CAUSE_Q850_PRECALBLK 0x2E /* Precedence call blocked */
+#define CAUSE_Q850_RESUNAVAIL 0x2F /* Resources unavailable, unspecified */
+#define CAUSE_Q850_QOSUNAVAIL 0x31 /* Quality of service unavailable */
+#define CAUSE_Q850_REQSERVNS 0x32 /* Requested facility not subscribed */
+#define CAUSE_Q850_OCBARRCUG 0x35 /* Outgoing calls barred within CUG */
+#define CAUSE_Q850_ICBARRCUG 0x36 /* Incoming calls barred within CUG */
+#define CAUSE_Q850_BCAPNAUTH 0x39 /* Bearer capability not authorized */
+#define CAUSE_Q850_BCAPNAVAIL 0x3A /* Bearer capability not presently available */
+#define CAUSE_Q850_INCSTOACISC 0x3E /* Inconsistenciy in designated outgoing access information and subscriber class */
+#define CAUSE_Q850_SOONOTAVAIL 0x3F /* Service or option not available, unspecified */
+#define CAUSE_Q850_BCAPNOTIMPL 0x41 /* Bearer capability not implemented */
+#define CAUSE_Q850_CHTYPNIMPL 0x42 /* Channel type not implemented */
+#define CAUSE_Q850_REQFACNIMPL 0x45 /* Requested facility not implemented */
+#define CAUSE_Q850_ORDINBCAVL 0x46 /* Only restricted digital information bearer capability is available */
+#define CAUSE_Q850_SOONOTIMPL 0x4F /* Service or option not implemented, unspecified */
+#define CAUSE_Q850_INVCLRFVAL 0x51 /* Invalid call reference value */
+#define CAUSE_Q850_IDCHDNOEX 0x52 /* Identified channel does not exist */
+#define CAUSE_Q850_SUSCAEXIN 0x53 /* A suspended call exists, but this call identity does not */
+#define CAUSE_Q850_CLIDINUSE 0x54 /* Call identity in use */
+#define CAUSE_Q850_NOCLSUSP 0x55 /* No call suspended */
+#define CAUSE_Q850_CLIDCLRD 0x56 /* Call having the requested call identity has been cleared */
+#define CAUSE_Q850_UNOTMEMCUG 0x57 /* User not member of CUG */
+#define CAUSE_Q850_INCDEST 0x58 /* Incompatible destination */
+#define CAUSE_Q850_NONEXCUG 0x5A /* Non-existent CUG */
+#define CAUSE_Q850_INVNTWSEL 0x5B /* Invalid transit network selection */
+#define CAUSE_Q850_INVMSG 0x5F /* Invalid message, unspecified */
+#define CAUSE_Q850_MIEMISS 0x60 /* Mandatory information element is missing */
+#define CAUSE_Q850_MSGTNI 0x61 /* Message type non-existent or not implemented */
+#define CAUSE_Q850_MSGNCMPT 0x62 /* Message not compatible with call state or message type non-existent or not implemented */
+#define CAUSE_Q850_IENENI 0x63 /* Information element/parameter non-existent or not implemented */
+#define CAUSE_Q850_INVIEC 0x64 /* Invalid information element contents */
+#define CAUSE_Q850_MSGNCWCS 0x65 /* Message not compatible with call state */
+#define CAUSE_Q850_RECOTIMEXP 0x66 /* Recovery on timer expiry */
+#define CAUSE_Q850_PARMNENIPO 0x67 /* Parameter non-existent or not implemented, passed on */
+#define CAUSE_Q850_MSGUNRDPRM 0x6E /* Message with unrecognized parameter, discarded */
+#define CAUSE_Q850_PROTERR 0x6F /* Protocol error, unspecified */
+#define CAUSE_Q850_INTWRKU 0x7F /* Interworking, unspecified */
+
+#define CAUSE_Q850_MAX 128
+
+#endif /* _I4B_CAUSE_H_ */
diff --git a/sys/i4b/include/i4b_debug.h b/sys/i4b/include/i4b_debug.h
new file mode 100644
index 0000000..33e6315
--- /dev/null
+++ b/sys/i4b/include/i4b_debug.h
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *---------------------------------------------------------------------------
+ *
+ * i4b_debug.h - i4b debug header file
+ * -----------------------------------
+ *
+ * $Id: i4b_debug.h,v 1.14 1998/12/05 18:05:57 hm Exp $
+ *
+ * last edit-date: [Sat Dec 5 18:36:47 1998]
+ *
+ *---------------------------------------------------------------------------*/
+
+#define DO_I4B_DEBUG /* enable debugging code inclusion */
+
+#undef DO_I4B_MAXDEBUG /* enable ALL debug messages by default */
+
+#ifdef DO_I4B_DEBUG
+
+extern unsigned int i4b_l1_debug;
+extern unsigned int i4b_l2_debug;
+extern unsigned int i4b_l3_debug;
+extern unsigned int i4b_l4_debug;
+
+#define DBGL1(bits, routine, what) \
+ if(bits & i4b_l1_debug) \
+ { \
+ printf("i4b-L1-%s: ", routine); \
+ printf what ; \
+ }
+
+#define DBGL2(bits, routine, what) \
+ if(bits & i4b_l2_debug) \
+ { \
+ printf("i4b-L2-%s: ", routine); \
+ printf what ; \
+ }
+
+#define DBGL3(bits, routine, what) \
+ if(bits & i4b_l3_debug) \
+ { \
+ printf("i4b-L3-%s: ", routine); \
+ printf what ; \
+ }
+
+#define DBGL4(bits, routine, what) \
+ if(bits & i4b_l4_debug) \
+ { \
+ printf("i4b-L4-%s: ", routine); \
+ printf what ; \
+ }
+#else /* !DO_I4B_DEBUG */
+
+#define DBGL1(bits, routine, what);
+#define DBGL2(bits, routine, what);
+#define DBGL3(bits, routine, what);
+#define DBGL4(bits, routine, what);
+
+#endif /* DO_I4B_DEBUG */
+
+/* Layer 1 */
+
+#define L1_ERROR 0x0001 /* general error message*/
+#define L1_PRIM 0x0002 /* interlayer primitives*/
+#define L1_BCHAN 0x0004 /* B channel action */
+#define L1_H_ERR 0x0008 /* HSCX errors */
+#define L1_H_IRQ 0x0010 /* HSCX IRQ messages */
+#define L1_I_ERR 0x0020 /* ISAC errors */
+#define L1_I_MSG 0x0040 /* ISAC messages */
+#define L1_I_SETUP 0x0080 /* ISAC setup messages */
+#define L1_F_MSG 0x0100 /* FSM messages */
+#define L1_F_ERR 0x0200 /* FSM error messages */
+#define L1_T_MSG 0x0400 /* Timer messages */
+#define L1_T_ERR 0x0800 /* Timer error messages */
+#define L1_H_XFRERR 0x1000 /* HSCX data xfer error */
+#define L1_I_CICO 0x2000 /* ISAC command in/out */
+
+#define L1_DEBUG_MAX 0x3fef /* all messages on except IRQ! */
+#define L1_DEBUG_ERR (L1_H_ERR | L1_I_ERR | L1_F_ERR | L1_T_ERR | L1_ERROR)
+
+#ifndef L1_DEBUG_DEFAULT
+#ifdef DO_I4B_MAXDEBUG
+#define L1_DEBUG_DEFAULT L1_DEBUG_MAX
+#else
+#define L1_DEBUG_DEFAULT L1_DEBUG_ERR
+#endif
+#endif
+
+/* Layer 2 */
+
+#define L2_ERROR 0x0001 /* general error message */
+#define L2_PRIM 0x0002 /* interlayer primitives */
+#define L2_U_MSG 0x0004 /* U frame messages */
+#define L2_U_ERR 0x0008 /* U frame error messages */
+#define L2_S_MSG 0x0010 /* S frame messages */
+#define L2_S_ERR 0x0020 /* S frame error messages */
+#define L2_I_MSG 0x0040 /* I frame messages */
+#define L2_I_ERR 0x0080 /* I frame error messages */
+#define L2_F_MSG 0x0100 /* FSM messages */
+#define L2_F_ERR 0x0200 /* FSM error messages */
+#define L2_T_MSG 0x0400 /* timer messages */
+#define L2_T_ERR 0x0800 /* timer error messages */
+#define L2_TEI_MSG 0x1000 /* TEI messages */
+#define L2_TEI_ERR 0x2000 /* TEI error messages */
+
+#define L2_DEBUG_MAX 0x3fff /* all messages on */
+#define L2_DEBUG_ERR (L2_ERROR | L2_I_ERR | L2_F_ERR | L2_T_ERR | L2_S_ERR | L2_TEI_ERR | L2_U_ERR )
+
+#ifndef L2_DEBUG_DEFAULT
+#ifdef DO_I4B_MAXDEBUG
+#define L2_DEBUG_DEFAULT L2_DEBUG_MAX
+#else
+#define L2_DEBUG_DEFAULT L2_DEBUG_ERR
+#endif
+#endif
+
+/* Layer 3 */
+
+#define L3_ERR 0x0001 /* general error message */
+#define L3_MSG 0x0002 /* general message */
+#define L3_F_MSG 0x0004 /* FSM messages */
+#define L3_F_ERR 0x0008 /* FSM error messages */
+#define L3_T_MSG 0x0010 /* timer messages */
+#define L3_T_ERR 0x0020 /* timer error messages */
+#define L3_P_MSG 0x0040 /* protocol messages */
+#define L3_P_ERR 0x0080 /* protocol error messages */
+#define L3_A_MSG 0x0100 /* AOC messages */
+#define L3_A_ERR 0x0200 /* AOC error messages */
+#define L3_PRIM 0x0400 /* messages exchanged */
+
+#define L3_DEBUG_MAX 0x07ff /* all messages on */
+#define L3_DEBUG_ERR (L3_ERR | L3_F_ERR | L3_T_ERR | L3_P_ERR | L3_A_ERR)
+
+#ifndef L3_DEBUG_DEFAULT
+#ifdef DO_I4B_MAXDEBUG
+#define L3_DEBUG_DEFAULT L3_DEBUG_MAX
+#else
+#define L3_DEBUG_DEFAULT L3_DEBUG_ERR
+#endif
+#endif
+
+/* Layer 4 */
+
+#define L4_ERR 0x0001 /* general error message */
+#define L4_MSG 0x0002 /* general message */
+#define L4_TIMO 0x0004 /* b channel idle timeout msgs */
+#define L4_DIALST 0x0008 /* network driver dial states */
+#define L4_IPRDBG 0x0010 /* ipr driver debug messages */
+#define L4_RBCHDBG 0x0020 /* rbch driver debug messages */
+
+#define L4_DEBUG_MAX 0x003f /* all messages on */
+#define L4_DEBUG_ERR (L4_ERR)
+
+#ifndef L4_DEBUG_DEFAULT
+#ifdef DO_I4B_MAXDEBUG
+#define L4_DEBUG_DEFAULT L4_DEBUG_MAX
+#else
+#define L4_DEBUG_DEFAULT L4_DEBUG_ERR
+#endif
+#endif
+
+/*---------------------------------------------------------------------------*
+ * ioctl via /dev/i4bctl:
+ * get/set current debug bits settings
+ *---------------------------------------------------------------------------*/
+
+typedef struct {
+ unsigned int l1;
+ unsigned int l2;
+ unsigned int l3;
+ unsigned int l4;
+} ctl_debug_t;
+
+#define I4B_CTL_GET_DEBUG _IOR('C', 0, ctl_debug_t)
+
+#define I4B_CTL_SET_DEBUG _IOW('C', 1, ctl_debug_t)
+
+/*---------------------------------------------------------------------------*
+ * get hscx statistics
+ *---------------------------------------------------------------------------*/
+
+typedef struct {
+ int unit; /* controller number */
+ int chan; /* channel number */
+ int vfr;
+ int rdo;
+ int crc;
+ int rab;
+ int xdu;
+ int rfo;
+} hscxstat_t;
+
+#define I4B_CTL_GET_HSCXSTAT _IOWR('C', 2, hscxstat_t)
+
+#define I4B_CTL_CLR_HSCXSTAT _IOW('C', 3, hscxstat_t)
+
+/* EOF */
diff --git a/sys/i4b/include/i4b_global.h b/sys/i4b/include/i4b_global.h
new file mode 100644
index 0000000..739d78d
--- /dev/null
+++ b/sys/i4b/include/i4b_global.h
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *---------------------------------------------------------------------------
+ *
+ * i4b_global.h - i4b global include file
+ * --------------------------------------
+ *
+ * $Id: i4b_global.h,v 1.17 1998/12/05 18:02:53 hm Exp $
+ *
+ * last edit-date: [Sat Dec 5 18:03:41 1998]
+ *
+ *---------------------------------------------------------------------------*/
+
+#ifndef _I4B_GLOBAL_H_
+#define _I4B_GLOBAL_H_
+
+#define SPLI4B() splimp() /* spl for i4b */
+
+#define TIMER_IDLE 1 /* a timer is running */
+#define TIMER_ACTIVE 2 /* a timer is idle */
+
+#ifdef __FreeBSD__
+#include <sys/param.h>
+#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
+
+#define TIMEOUT_FUNC_T timeout_t *
+#define SECOND time_second
+#define MICROTIME(x) getmicrotime(&(x))
+
+#else /* FreeBSD < 3 */
+
+#define TIMEOUT_FUNC_T timeout_func_t
+#define SECOND time.tv_sec
+#define MICROTIME(x) microtime(&(x))
+
+#endif /* >= 3 */
+#endif /* __FreeBSD__ */
+
+#if defined(__NetBSD__) || defined (__OpenBSD__)
+
+#define TIMEOUT_FUNC_T void *
+#define SECOND time.tv_sec
+#define MICROTIME(x) (x) = time
+
+#endif /* __NetBSD__ */
+
+/* definitions for the STATUS indications L1 -> L2 -> L3 */
+
+#define STI_ATTACH 0 /* attach at boot time */
+#define STI_L1STAT 1 /* layer 1 status */
+#define STI_L2STAT 2 /* layer 2 status */
+#define STI_TEIASG 3 /* TEI assignments */
+#define STI_PDEACT 4 /* Layer 1 T4 expired = persistent deactivation */
+#define STI_NOL1ACC 5 /* no outgoing L1 access possible */
+
+/* definitions for the COMMAND requests L3 -> L2 -> L1 */
+
+#define CMR_DOPEN 0 /* daemon opened /dev/i4b */
+#define CMR_DCLOSE 1 /* daemon closed /dev/i4b */
+
+/*---------------------------------------------------------------------------
+ *
+ * Number of max supported passive card units
+ *
+ * Teles/Creatix/Neuhaus cards have a hardware limitation
+ * as one is able to set 3 (sometimes 4) different configurations by
+ * jumpers so a maximum of 3 (4) cards per ISA bus is possible.
+ * (Note: there are multiple ISA buses on some architectures)
+ *
+ *---------------------------------------------------------------------------*/
+#define ISIC_MAXUNIT 3 /* max no of supported units 0..3 */
+
+#endif /* _I4B_GLOBAL_H_ */
diff --git a/sys/i4b/include/i4b_ioctl.h b/sys/i4b/include/i4b_ioctl.h
new file mode 100644
index 0000000..17e945f
--- /dev/null
+++ b/sys/i4b/include/i4b_ioctl.h
@@ -0,0 +1,606 @@
+/*
+ * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *---------------------------------------------------------------------------
+ *
+ * i4b_ioctl.h - messages kernel <--> userland
+ * -------------------------------------------
+ *
+ * $Id: i4b_ioctl.h,v 1.58 1998/12/22 19:48:24 hm Exp $
+ *
+ * last edit-date: [Tue Dec 22 20:33:46 1998]
+ *
+ *---------------------------------------------------------------------------*/
+
+#ifndef _I4B_IOCTL_H_
+#define _I4B_IOCTL_H_
+
+#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+#ifndef _MACHINE_TYPES_H_
+#include <machine/types.h>
+#endif /* _MACHINE_TYPES_H_ */
+#endif /* __FreeBSD__ */
+
+/*---------------------------------------------------------------------------*
+ * version and release number for isdn4bsd package
+ *---------------------------------------------------------------------------*/
+#define VERSION 0 /* version number */
+#define REL 70 /* release number */
+#define STEP 00 /* release step */
+
+/*---------------------------------------------------------------------------*
+ * date/time format in i4b log messages
+ * ------------------------------------
+ * Being year 2000 clean is not easy with the current state of the
+ * ANSI C library standard and it's implementation for some locales.
+ * You might like to use the "%c" format of "strftime" sometimes,
+ * but this breaks Y2K in some locales. Also the old standard logfile
+ * format "%d.%m.%y %H:%M:%S" is non compliant.
+ * NetBSD's current toolset warns about this problems, and we compile
+ * with -Werror, so this problems need to be resolved.
+ *---------------------------------------------------------------------------*/
+#define I4B_TIME_FORMAT "%d.%m.%Y %H:%M:%S"
+
+/*---------------------------------------------------------------------------*
+ * max number of controllers in system
+ *---------------------------------------------------------------------------*/
+#define MAX_CONTROLLERS 8 /* max number of controllers */
+
+/*---------------------------------------------------------------------------*
+ * controller types
+ *---------------------------------------------------------------------------*/
+#define CTRL_INVALID (-1) /* invalid, error */
+#define CTRL_UNKNOWN 0 /* unknown controller type */
+#define CTRL_PASSIVE 1 /* passive ISDN controller cards*/
+#define CTRL_DAIC 2 /* Diehl active controller cards*/
+#define CTRL_NUMTYPES 3 /* number of controller types */
+
+/*---------------------------------------------------------------------------*
+ * card types for CTRL_PASSIVE
+ *---------------------------------------------------------------------------*/
+#define CARD_TYPEP_INVAL (-1) /* invalid, error */
+#define CARD_TYPEP_UNK 0 /* unknown */
+#define CARD_TYPEP_8 1 /* Teles, S0/8 */
+#define CARD_TYPEP_16 2 /* Teles, S0/16 */
+#define CARD_TYPEP_16_3 3 /* Teles, S0/16.3 */
+#define CARD_TYPEP_AVMA1 4 /* AVM A1 or AVM Fritz!Card */
+#define CARD_TYPEP_163P 5 /* Teles, S0/16.3 PnP */
+#define CARD_TYPEP_CS0P 6 /* Creatix, S0 PnP */
+#define CARD_TYPEP_USRTA 7 /* US Robotics ISDN TA internal */
+#define CARD_TYPEP_DRNNGO 8 /* Dr. Neuhaus Niccy GO@ */
+#define CARD_TYPEP_SWS 9 /* Sedlbauer Win Speed */
+#define CARD_TYPEP_DYNALINK 10 /* Dynalink IS64PH */
+#define CARD_TYPEP_BLMASTER 11 /* ISDN Blaster / ISDN Master */
+#define CARD_TYPEP_PCFRITZ 12 /* AVM PCMCIA Fritz!Card */
+#define CARD_TYPEP_ELSAQS1ISA 13 /* ELSA QuickStep 1000pro ISA */
+#define CARD_TYPEP_ELSAQS1PCI 14 /* ELSA QuickStep 1000pro PCI */
+#define CARD_TYPEP_SIEMENSITALK 15 /* Siemens I-Talk */
+#define CARD_TYPEP_ELSAMLIMC 16 /* ELSA MicroLink ISDN/MC */
+#define CARD_TYPEP_ELSAMLMCALL 17 /* ELSA MicroLink MCall */
+#define CARD_TYPEP_ITKIX1 18 /* ITK ix1 micro */
+
+/*
+ * in case you add support for more cards, please update:
+ *
+ * isdnd: support.c, name_of_controller()
+ * diehl/diehlctl: main.c, listall()
+ *
+ * and adjust CARD_TYPEP_MAX below.
+ */
+
+#define CARD_TYPEP_MAX 18 /* max type */
+
+/*---------------------------------------------------------------------------*
+ * card types for CTRL_DAIC
+ *---------------------------------------------------------------------------*/
+#define CARD_TYPEA_DAIC_UNK 0
+#define CARD_TYPEA_DAIC_S 1
+#define CARD_TYPEA_DAIC_SX 2
+#define CARD_TYPEA_DAIC_SCOM 3
+#define CARD_TYPEA_DAIC_QUAD 4
+
+/*---------------------------------------------------------------------------*
+ * max length of some strings
+ *---------------------------------------------------------------------------*/
+#define TELNO_MAX 41 /* max length of a telephone number (+ '\0') */
+#define DISPLAY_MAX 91 /* max length of display information (+ '\0') */
+#define DATETIME_MAX 21 /* max length of datetime information (+ '\0')*/
+
+/*---------------------------------------------------------------------------*
+ * in case the src or dst telephone number is empty
+ *---------------------------------------------------------------------------*/
+#define TELNO_EMPTY "NotAvailable"
+
+/*---------------------------------------------------------------------------*
+ * B channel parameters
+ *---------------------------------------------------------------------------*/
+#define BCH_MAX_DATALEN 2048 /* max length of a B channel frame */
+
+/*---------------------------------------------------------------------------*
+ * userland driver types
+ * ---------------------
+ * a "driver" is defined here as a piece of software interfacing an
+ * ISDN B channel with a userland service, such as IP, Telephony etc.
+ *---------------------------------------------------------------------------*/
+#define BDRV_RBCH 0 /* raw b-channel interface driver */
+#define BDRV_TEL 1 /* telephone (speech) interface driver */
+#define BDRV_IPR 2 /* IP over raw HDLC interface driver */
+#define BDRV_ISPPP 3 /* sync Kernel PPP interface driver */
+
+/*---------------------------------------------------------------------------*
+ * B channel protocol
+ *---------------------------------------------------------------------------*/
+#define BPROT_NONE 0 /* no protocol at all, raw data */
+#define BPROT_RHDLC 1 /* raw HDLC: flag, data, crc, flag */
+
+/*---------------------------------------------------------------------------*
+ * causes data type
+ *---------------------------------------------------------------------------*/
+typedef unsigned int cause_t; /* 32 bit unsigned int */
+
+/*---------------------------------------------------------------------------*
+ * call descriptor id (cdid) definitions
+ *---------------------------------------------------------------------------*/
+#define CDID_UNUSED 0 /* cdid is invalid and unused */
+#define CDID_MAX 99999 /* highest valid cdid, wraparound to 1 */
+
+
+/****************************************************************************
+
+ outgoing call:
+ --------------
+
+ userland kernel
+ -------- ------
+
+ CDID_REQ ----------------->
+
+ <------------------ cdid
+
+ CONNECT_REQ -------------->
+
+ <------------------ PROCEEDING_IND (if connect req ok)
+
+ <------------------ CONNECT_ACTIVE_IND (if connection ok)
+
+ or
+
+ <------------------ DISCONNECT_IND (if connection failed)
+
+
+
+ incoming call:
+ --------------
+
+ userland kernel
+ -------- ------
+
+ <------------------ CONNECT_IND
+
+ CONNECT_RESP ------------->
+
+ <------------------ CONNECT_ACTIVE_IND (if accepted)
+
+
+
+ active disconnect:
+ ------------------
+
+ userland kernel
+ -------- ------
+
+ DISCONNECT_REQ ------------>
+
+ <------------------ DISCONNECT_IND
+
+
+ passive disconnect:
+ -------------------
+
+ userland kernel
+ -------- ------
+
+ <------------------ DISCONNECT_IND
+
+
+****************************************************************************/
+
+
+/*===========================================================================*
+ *===========================================================================*
+ * "read" messages from kernel -> userland
+ *===========================================================================*
+ *===========================================================================*/
+
+
+/*---------------------------------------------------------------------------*
+ * message header, included in every message
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ char type; /* message identifier */
+#define MSG_CONNECT_IND 'a'
+#define MSG_CONNECT_ACTIVE_IND 'b'
+#define MSG_DISCONNECT_IND 'c'
+#define MSG_DIALOUT_IND 'd'
+#define MSG_IDLE_TIMEOUT_IND 'e'
+#define MSG_ACCT_IND 'f'
+#define MSG_CHARGING_IND 'g'
+#define MSG_PROCEEDING_IND 'h'
+#define MSG_ALERT_IND 'i'
+#define MSG_DRVRDISC_REQ 'j'
+#define MSG_L12STAT_IND 'k'
+#define MSG_TEIASG_IND 'l'
+#define MSG_PDEACT_IND 'm'
+#define MSG_NEGCOMP_IND 'n'
+#define MSG_IFSTATE_CHANGED_IND 'o'
+ int cdid; /* call descriptor id */
+} msg_hdr_t;
+
+/*---------------------------------------------------------------------------*
+ * connect indication
+ * indicates incoming connection
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ msg_hdr_t header; /* common header */
+ int controller; /* controller number */
+ int channel; /* channel number */
+#define CHAN_B1 0 /* this _must_ be 0, HSCX B1 is also 0 */
+#define CHAN_B2 1 /* this _must_ be 1, HSCX B2 is also 1 */
+#define CHAN_ANY (-1) /* outgoing, not possible for incoming */
+#define CHAN_NO (-2) /* call waiting (CW) for incoming */
+ int bprot; /* b channel protocot, see BPROT_XXX */
+ char dst_telno[TELNO_MAX]; /* destination telno */
+ char src_telno[TELNO_MAX]; /* source telno */
+ int scr_ind;/* screening indicator */
+#define SCR_NONE 0 /* no screening indicator transmitted */
+#define SCR_USR_NOSC 1 /* screening user provided, not screened*/
+#define SCR_USR_PASS 2 /* screening user provided, verified & passed */
+#define SCR_USR_FAIL 3 /* screening user provided, verified & failed */
+#define SCR_NET 4 /* screening network provided */
+ char display[DISPLAY_MAX]; /* content of display IE*/
+} msg_connect_ind_t;
+
+/*---------------------------------------------------------------------------*
+ * connect active indication
+ * indicates active connection
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ msg_hdr_t header; /* common header */
+ int controller; /* controller number actually used */
+ int channel; /* channel number actually used */
+ char datetime[DATETIME_MAX]; /* content of date/time IE */
+} msg_connect_active_ind_t;
+
+/*---------------------------------------------------------------------------*
+ * disconnect indication
+ * indicates a disconnect
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ msg_hdr_t header; /* common header */
+ cause_t cause; /* cause code */
+} msg_disconnect_ind_t;
+
+/*---------------------------------------------------------------------------*
+ * negotiation complete
+ * indicates an interface is completely up & running
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ msg_hdr_t header; /* common header */
+} msg_negcomplete_ind_t;
+
+/*---------------------------------------------------------------------------*
+ * interface changes internal state
+ * indicates an interface has somehow switched its FSM
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ msg_hdr_t header; /* common header */
+ int state; /* new interface state */
+} msg_ifstatechg_ind_t;
+
+/*---------------------------------------------------------------------------*
+ * initiate a call to a remote site
+ * i.e. the IP driver got a packet and wants a connection
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ msg_hdr_t header; /* common header */
+ int driver; /* driver type */
+ int driver_unit; /* driver unit number */
+} msg_dialout_ind_t;
+
+/*---------------------------------------------------------------------------*
+ * idle timeout disconnect sent indication
+ * kernel has sent disconnect request because of b-ch idle
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ msg_hdr_t header; /* common header */
+} msg_idle_timeout_ind_t;
+
+/*---------------------------------------------------------------------------*
+ * accounting information from userland interface driver to daemon
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ msg_hdr_t header; /* common header */
+ int accttype; /* accounting type */
+#define ACCT_DURING 0
+#define ACCT_FINAL 1
+ int driver; /* driver type */
+ int driver_unit; /* driver unit number */
+ int ioutbytes; /* ISDN # of bytes sent */
+ int iinbytes; /* ISDN # of bytes received */
+ int outbps; /* bytes per sec out */
+ int inbps; /* bytes per sec in */
+ int outbytes; /* driver # of bytes sent */
+ int inbytes; /* driver # of bytes received */
+} msg_accounting_ind_t;
+
+/*---------------------------------------------------------------------------*
+ * charging information from isdn driver to daemon
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ msg_hdr_t header; /* common header */
+ int units; /* number of units */
+ int units_type; /* type of units info */
+#define CHARGE_INVALID 0 /* invalid, unknown */
+#define CHARGE_AOCD 1 /* advice of charge during call */
+#define CHARGE_AOCE 2 /* advice of charge at end of call */
+#define CHARGE_CALC 3 /* locally calculated from rates information */
+} msg_charging_ind_t;
+
+/*---------------------------------------------------------------------------*
+ * call proceeding indication
+ * indicates outgoing SETUP has been acknowleged
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ msg_hdr_t header; /* common header */
+ int controller; /* controller number actually used */
+ int channel; /* channel number actually used */
+} msg_proceeding_ind_t;
+
+/*---------------------------------------------------------------------------*
+ * alert indication
+ * indicates remote user side "rings"
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ msg_hdr_t header; /* common header */
+} msg_alert_ind_t;
+
+/*---------------------------------------------------------------------------*
+ * driver requests to disconnect line
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ msg_hdr_t header; /* common header */
+ int driver; /* driver type */
+ int driver_unit; /* driver unit number */
+} msg_drvrdisc_req_t;
+
+/*---------------------------------------------------------------------------*
+ * state of layer 1/2
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ msg_hdr_t header; /* common header */
+ int controller; /* controller unit */
+ int layer; /* layer number (1/2) */
+#define LAYER_ONE 1
+#define LAYER_TWO 2
+ int state; /* state info */
+#define LAYER_IDLE 0
+#define LAYER_ACTIVE 1
+} msg_l12stat_ind_t;
+
+/*---------------------------------------------------------------------------*
+ * TEI assignment messages
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ msg_hdr_t header; /* common header */
+ int controller; /* controller unit */
+ int tei; /* TEI or -1 if invalid */
+} msg_teiasg_ind_t;
+
+/*---------------------------------------------------------------------------*
+ * persistent deactivation state of stack
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ msg_hdr_t header; /* common header */
+ int controller; /* controller unit */
+ int numactive; /* number of active connections */
+} msg_pdeact_ind_t;
+
+
+/*===========================================================================*
+ *===========================================================================*
+ * "ioctl" messages from userland -> kernel
+ *===========================================================================*
+ *===========================================================================*/
+
+
+/*---------------------------------------------------------------------------*
+ * request a unique cdid (to setup an outgoing call)
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ int cdid; /* call descriptor id */
+} msg_cdid_req_t;
+
+#define I4B_CDID_REQ _IOWR('4', 0, int)
+
+/*---------------------------------------------------------------------------*
+ * connect request
+ * requests an outgoing connection
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ int cdid; /* call descriptor id */
+ int controller; /* controller to use */
+ int channel; /* channel to use */
+ int txdelay; /* tx delay after connect */
+ int bprot; /* b channel protocol */
+ int driver; /* driver to route b channel data to */
+ int driver_unit; /* unit number for above driver */
+ int unitlen_time; /* length of a charging unit */
+ int idle_time; /* time without activity on b ch */
+ int earlyhup_time; /* safety area at end of unit */
+ int unitlen_method; /* how to calculate the unitlength */
+#define ULEN_METHOD_STATIC 0 /* use unitlen_time value (see above) */
+#define ULEN_METHOD_DYNAMIC 1 /* use AOCD */
+ char dst_telno[TELNO_MAX]; /* destination telephone no */
+ char src_telno[TELNO_MAX]; /* source telephone number */
+} msg_connect_req_t;
+
+#define I4B_CONNECT_REQ _IOW('4', 1, msg_connect_req_t)
+
+/*---------------------------------------------------------------------------*
+ * connect response
+ * this is the answer to an incoming connect indication
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ int cdid; /* call descriptor id */
+ int response; /* what to do with incoming call */
+#define SETUP_RESP_DNTCRE 0 /* dont care, call is not for me */
+#define SETUP_RESP_REJECT 1 /* reject call */
+#define SETUP_RESP_ACCEPT 2 /* accept call */
+ cause_t cause; /* cause for case SETUP_RESP_REJECT */
+ /* the following are only used for SETUP_RESP_ACCEPT !! */
+ int txdelay; /* tx delay after connect */
+ int bprot; /* B chan protocol */
+ int driver; /* driver to route b channel data to */
+ int driver_unit; /* unit number for above driver */
+ int max_idle_time; /* max time without activity on b ch */
+} msg_connect_resp_t;
+
+#define I4B_CONNECT_RESP _IOW('4', 2, msg_connect_resp_t)
+
+/*---------------------------------------------------------------------------*
+ * disconnect request
+ * active disconnect request
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ int cdid; /* call descriptor id */
+ cause_t cause; /* protocol independent cause */
+} msg_discon_req_t;
+
+#define I4B_DISCONNECT_REQ _IOW('4', 3, msg_discon_req_t)
+
+/*---------------------------------------------------------------------------*
+ * controller info request
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ int controller; /* controller number */
+ int ncontroller; /* number of controllers in system */
+ int ctrl_type; /* controller type passive/active */
+ int card_type; /* brand / version */
+ int tei; /* tei controller probably has */
+} msg_ctrl_info_req_t;
+
+#define I4B_CTRL_INFO_REQ _IOWR('4', 4, msg_ctrl_info_req_t)
+
+/*---------------------------------------------------------------------------*
+ * dialout response
+ * status report to driver who requested a dialout
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ int driver; /* driver to route b channel data to */
+ int driver_unit; /* unit number for above driver */
+ int stat; /* state of dialout request */
+#define DSTAT_NONE 0
+#define DSTAT_TFAIL 1 /* transient failure */
+#define DSTAT_PFAIL 2 /* permanent failure */
+#define DSTAT_INONLY 3 /* no outgoing dials allowed */
+} msg_dialout_resp_t;
+
+#define I4B_DIALOUT_RESP _IOW('4', 5, msg_dialout_resp_t)
+
+/*---------------------------------------------------------------------------*
+ * timeout value update
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ int cdid; /* call descriptor id */
+ int unitlen_time; /* length of a charging unit */
+ int idle_time; /* time without activity on b ch */
+ int earlyhup_time; /* safety area at end of unit */
+} msg_timeout_upd_t;
+
+#define I4B_TIMEOUT_UPD _IOW('4', 6, msg_timeout_upd_t)
+
+/*---------------------------------------------------------------------------*
+ * soft enable/disable
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ int driver; /* driver to route b channel data to */
+ int driver_unit; /* unit number for above driver */
+ int updown; /* what to do */
+#define SOFT_ENA 0 /* enable interface */
+#define SOFT_DIS 1 /* disable interface */
+} msg_updown_ind_t;
+
+#define I4B_UPDOWN_IND _IOW('4', 7, msg_updown_ind_t)
+
+/*---------------------------------------------------------------------------*
+ * send alert request
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ int cdid; /* call descriptor id */
+} msg_alert_req_t;
+
+#define I4B_ALERT_REQ _IOW('4', 8, msg_alert_req_t)
+
+/*---------------------------------------------------------------------------*
+ * request version and release info from kernel part
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ int version; /* version number */
+ int release; /* release number */
+ int step; /* release step number */
+} msg_vr_req_t;
+
+#define I4B_VR_REQ _IOR('4', 9, msg_vr_req_t)
+
+/*---------------------------------------------------------------------------*
+ * Protocol download to active cards
+ *---------------------------------------------------------------------------*/
+struct isdn_dr_prot {
+ size_t bytecount; /* length of code */
+ u_int8_t *microcode; /* pointer to microcode */
+};
+
+struct isdn_download_request {
+ int controller; /* controller number */
+ int numprotos; /* number of protocols in 'protocols' */
+ struct isdn_dr_prot *protocols;
+};
+
+#define I4B_CTRL_DOWNLOAD _IOW('4', 100, struct isdn_download_request)
+
+/*---------------------------------------------------------------------------*
+ * Generic diagnostic interface for active cards
+ *---------------------------------------------------------------------------*/
+struct isdn_diagnostic_request {
+ int controller; /* controller number */
+ u_int32_t cmd; /* diagnostic command to execute */
+ size_t in_param_len; /* length of additional input parameter */
+ void *in_param; /* optional input parameter */
+ size_t out_param_len; /* available output space */
+ void *out_param; /* output data goes here */
+};
+
+#define I4B_ACTIVE_DIAGNOSTIC _IOW('4', 102, struct isdn_diagnostic_request)
+
+#endif /* _I4B_IOCTL_H_ */
diff --git a/sys/i4b/include/i4b_isdnq931.h b/sys/i4b/include/i4b_isdnq931.h
new file mode 100644
index 0000000..bdc77f0
--- /dev/null
+++ b/sys/i4b/include/i4b_isdnq931.h
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *---------------------------------------------------------------------------
+ *
+ * i4b_isdnq931.h - DSS1 layer 3 message types
+ * -------------------------------------------
+ *
+ * $Id: i4b_isdnq931.h,v 1.4 1998/12/05 18:02:54 hm Exp $
+ *
+ * last edit-date: [Sat Dec 5 18:04:01 1998]
+ *
+ *---------------------------------------------------------------------------*/
+
+/* protocol discriminators */
+
+#define PD_Q931 0x08 /* Q.931/I.451 */
+
+/* Q.931 single octett information element identifiers */
+
+#define IEI_SENDCOMPL 0xa1 /* sending complete */
+
+/* Q.931 variable length information element identifiers */
+
+#define IEI_SEGMMSG 0x00 /* segmented message */
+#define IEI_BEARERCAP 0x04 /* bearer capabilities */
+#define IEI_CAUSE 0x08 /* cause */
+#define IEI_CALLID 0x10 /* call identity */
+#define IEI_CALLSTATE 0x14 /* call state */
+#define IEI_CHANNELID 0x18 /* channel identification */
+#define IEI_PROGRESSI 0x1e /* progress indicator */
+#define IEI_NETSPCFAC 0x20 /* network specific facilities */
+#define IEI_NOTIFIND 0x27 /* notification indicator */
+#define IEI_DISPLAY 0x28 /* display */
+#define IEI_DATETIME 0x29 /* date/time */
+#define IEI_KEYPAD 0x2c /* keypad facility */
+#define IEI_SIGNAL 0x34 /* signal */
+#define IEI_INFRATE 0x40 /* information rate */
+#define IEI_ETETDEL 0x42 /* end to end transit delay */
+#define IEI_TDELSELIND 0x43 /* transit delay selection and indication */
+#define IEI_PLBPARMS 0x44 /* packet layer binary parameters */
+#define IEI_PLWSIZE 0x45 /* packet layer window size */
+#define IEI_PSIZE 0x46 /* packet size */
+#define IEI_CUG 0x47 /* closed user group */
+#define IEI_REVCHRGI 0x4a /* reverse charge indication */
+#define IEI_CALLINGPN 0x6c /* calling party number */
+#define IEI_CALLINGPS 0x6d /* calling party subaddress */
+#define IEI_CALLEDPN 0x70 /* called party number */
+#define IEI_CALLEDPS 0x71 /* called party subaddress */
+#define IEI_REDIRNO 0x74 /* redirecting number */
+#define IEI_TRNSEL 0x78 /* transit network selection */
+#define IEI_RESTARTI 0x79 /* restart indicator */
+#define IEI_LLCOMPAT 0x7c /* low layer compatibility */
+#define IEI_HLCOMPAT 0x7d /* high layer compatibility */
+#define IEI_USERUSER 0x7e /* user-user */
+#define IEI_ESACPE 0x7f /* escape for extension */
+
+/* Q.932 variable length information element identifiers */
+
+#define IEI_EXTFAC 0x0d /* extended facility */
+#define IEI_FACILITY 0x1c /* facility */
+#define IEI_INFOREQ 0x32 /* information request */
+#define IEI_FEATACT 0x38 /* feature activation */
+#define IEI_FEATIND 0x39 /* feature indication */
+#define IEI_SERVPID 0x3a /* service profile identification */
+#define IEI_ENDPTID 0x3b /* endpoint identifier */
+
+/* Q.933 variable length information element identifiers */
+
+#define IEI_DATALCID 0x19 /* data link connection identifier */
+#define IEI_LLCOREP 0x48 /* link layer core parameters */
+#define IEI_LLPROTP 0x49 /* link layer protocol parameters */
+#define IEI_X213PRI 0x50 /* X.213 priority */
+#define IEI_REPORTT 0x51 /* report type */
+#define IEI_LNKITYVERF 0x53 /* link integrity verification */
+#define IEI_PVCSTAT 0x57 /* PVC status */
+
+/* Q.95x variable length information element identifiers */
+
+#define IEI_PRECLEV 0x41 /* precedence level */
+#define IEI_CONCTDNO 0x4c /* connected number */
+#define IEI_CONCTDSA 0x4d /* connected subaddress */
+#define IEI_REDICNNO 0x76 /* redirection number */
+
+/* single octett information elements */
+
+#define SOIE_SHIFT 0x90 /* shift codeset */
+#define SHIFT_LOCK 0x08 /* shift codeset, locking shift bit */
+#define SOIE_MDSC 0xa0 /* more data AND/OR sending complete */
+#define SOIE_SENDC 0xa1 /* sending complete */
+#define SOIE_CONGL 0xb0 /* congestion level */
+#define SOIE_REPTI 0xd0 /* repeat indicator */
+
+/* codesets */
+
+#define CODESET_0 0 /* codeset 0, normal DSS1 codeset */
+
+/* Q.931/Q.932 message types (see Q.931 03/93 p10 and p311) */
+
+/* call establishment messages */
+
+#define ALERT 0x01
+#define CALL_PROCEEDING 0x02
+#define PROGRESS 0x03
+#define SETUP 0x05
+#define CONNECT 0x07
+#define SETUP_ACKNOWLEDGE 0x0d
+#define CONNECT_ACKNOWLEDGE 0x0f
+
+/* call information phase messages */
+
+#define USER_INFORMATION 0x20
+#define SUSPEND_REJECT 0x21
+#define RESUME_REJECT 0x22
+#define HOLD 0x24
+#define SUSPEND 0x25
+#define RESUME 0x26
+#define HOLD_ACKNOWLEDGE 0x28
+#define SUSPEND_ACKNOWLEDGE 0x2d
+#define RESUME_ACKNOWLEDGE 0x2e
+#define HOLD_REJECT 0x30
+#define RETRIEVE 0x31
+#define RETRIEVE_ACKNOWLEDGE 0x32
+#define RETRIEVE_REJECT 0x37
+
+/* call clearing */
+
+#define DISCONNECT 0x45
+#define RESTART 0x46
+#define RELEASE 0x4d
+#define RESTART_ACKNOWLEDGE 0x4e
+#define RELEASE_COMPLETE 0x5a
+
+/* misc messages */
+
+#define SEGMENT 0x60
+#define FACILITY 0x62
+#define REGISTER 0x64
+#define NOTIFY 0x6e
+#define STATUS_ENQUIRY 0x75
+#define CONGESTION_CONTROL 0x79
+#define INFORMATION 0x7b
+#define STATUS 0x7d
+
+/* EOF */
diff --git a/sys/i4b/include/i4b_l1l2.h b/sys/i4b/include/i4b_l1l2.h
new file mode 100644
index 0000000..782ca68
--- /dev/null
+++ b/sys/i4b/include/i4b_l1l2.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *---------------------------------------------------------------------------
+ *
+ * i4b_l1l2.h - i4b layer 1 / layer 2 interactions
+ * ---------------------------------------------------
+ *
+ * $Id: i4b_l1l2.h,v 1.7 1998/12/05 18:02:56 hm Exp $
+ *
+ * last edit-date: [Sat Dec 5 18:04:25 1998]
+ *
+ *---------------------------------------------------------------------------*/
+
+#ifndef _I4B_L1L2_H_
+#define _I4B_L1L2_H_
+
+#ifdef __FreeBSD__
+#include <machine/i4b_trace.h>
+#else
+#include <i4b/i4b_trace.h>
+#endif
+
+extern struct i4b_l1l2_func i4b_l1l2_func;
+
+struct i4b_l1l2_func
+{
+ /* Layer 1 --> Layer 2 */
+ /* =================== */
+
+ int (*PH_DATA_IND) (int, struct mbuf *);
+ int (*PH_ACTIVATE_IND) (int);
+ int (*PH_DEACTIVATE_IND) (int);
+
+#define PH_Data_Ind(unit, data) \
+ ((*i4b_l1l2_func.PH_DATA_IND)(unit, data))
+#define PH_Act_Ind(unit) \
+ ((*i4b_l1l2_func.PH_ACTIVATE_IND)(unit))
+#define PH_Deact_Ind(unit) \
+ ((*i4b_l1l2_func.PH_DEACTIVATE_IND)(unit))
+
+
+ /* Layer 2 --> Layer 1 */
+ /* =================== */
+
+ int (*PH_DATA_REQ) (int, struct mbuf *, int);
+
+ /* 3rd ph_data_req parameter */
+#define MBUF_DONTFREE 0
+#define MBUF_FREE 1
+
+ int (*PH_ACTIVATE_REQ) (int);
+
+#define PH_Data_Req(unit, data, freeflag) \
+ ((*i4b_l1l2_func.PH_DATA_REQ)(unit, data, freeflag))
+#define PH_Act_Req(unit) \
+ ((*i4b_l1l2_func.PH_ACTIVATE_REQ)(unit))
+
+ /* Layer 1 --> upstream, ISDN trace data */
+ /* ===================================== */
+ int (*MPH_TRACE_IND) (i4b_trace_hdr_t *, int, unsigned char *);
+
+#define MPH_Trace_Ind(header, length, pointer) \
+ ((*i4b_l1l2_func.MPH_TRACE_IND)(header, length, pointer))
+
+ /* L1/L2 management command and status information */
+ /* =============================================== */
+ int (*MPH_STATUS_IND) (int, int, int);
+ int (*MPH_COMMAND_REQ) (int, int, int);
+
+#define MPH_Status_Ind(unit, status, parm) \
+ ((*i4b_l1l2_func.MPH_STATUS_IND)(unit, status, parm))
+#define MPH_Command_Req(unit, command, parm) \
+ ((*i4b_l1l2_func.MPH_COMMAND_REQ)(unit, command, parm))
+};
+
+#endif /* _I4B_L1L2_H_ */
+
diff --git a/sys/i4b/include/i4b_l2l3.h b/sys/i4b/include/i4b_l2l3.h
new file mode 100644
index 0000000..81ab182
--- /dev/null
+++ b/sys/i4b/include/i4b_l2l3.h
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *---------------------------------------------------------------------------
+ *
+ * i4b_l2l3.h - i4b layer 2 / layer 3 interactions
+ * -----------------------------------------------
+ *
+ * $Id: i4b_l2l3.h,v 1.5 1998/12/05 18:02:57 hm Exp $
+ *
+ * last edit-date: [Sat Dec 5 18:04:44 1998]
+ *
+ *---------------------------------------------------------------------------*/
+
+#ifndef _I4B_L2L3_H_
+#define _I4B_L2L3_H_
+
+extern struct i4b_l2l3_func i4b_l2l3_func;
+
+struct i4b_l2l3_func
+{
+ /* Layer 2 --> Layer 3 */
+ /* =================== */
+
+ int (*DL_ESTABLISH_IND) (int);
+ int (*DL_ESTABLISH_CNF) (int);
+
+ int (*DL_RELEASE_IND) (int);
+ int (*DL_RELEASE_CNF) (int);
+
+ int (*DL_DATA_IND) (int, struct mbuf *);
+
+ int (*DL_UNIT_DATA_IND) (int, struct mbuf *);
+
+#define DL_Est_Ind(unit) \
+ ((*i4b_l2l3_func.DL_ESTABLISH_IND)(unit))
+#define DL_Est_Cnf(unit) \
+ ((*i4b_l2l3_func.DL_ESTABLISH_CNF)(unit))
+#define DL_Rel_Ind(unit) \
+ ((*i4b_l2l3_func.DL_RELEASE_IND)(unit))
+#define DL_Rel_Cnf(unit) \
+ ((*i4b_l2l3_func.DL_RELEASE_CNF)(unit))
+#define DL_Data_Ind(unit, data) \
+ ((*i4b_l2l3_func.DL_DATA_IND)(unit, data))
+#define DL_Unit_Data_Ind(unit, data) \
+ ((*i4b_l2l3_func.DL_UNIT_DATA_IND)(unit, data))
+
+#define DL_Est_Ind_A \
+ (i4b_l2l3_func.DL_ESTABLISH_IND)
+#define DL_Est_Cnf_A \
+ (i4b_l2l3_func.DL_ESTABLISH_CNF)
+#define DL_Rel_Ind_A \
+ (i4b_l2l3_func.DL_RELEASE_IND)
+#define DL_Rel_Cnf_A \
+ (i4b_l2l3_func.DL_RELEASE_CNF)
+
+ /* Layer 3 --> Layer 2 */
+ /* =================== */
+
+ int (*DL_ESTABLISH_REQ) (int);
+
+ int (*DL_RELEASE_REQ) (int);
+
+ int (*DL_DATA_REQ) (int, struct mbuf *);
+
+ int (*DL_UNIT_DATA_REQ) (int, struct mbuf *);
+
+#define DL_Est_Req(unit) \
+ ((*i4b_l2l3_func.DL_ESTABLISH_REQ)(unit))
+#define DL_Rel_Req(unit) \
+ ((*i4b_l2l3_func.DL_RELEASE_REQ)(unit))
+#define DL_Data_Req(unit, data) \
+ ((*i4b_l2l3_func.DL_DATA_REQ)(unit, data))
+#define DL_Unit_Data_Req(unit, data) \
+ ((*i4b_l2l3_func.DL_UNIT_DATA_REQ)(unit, data))
+
+ /* Layer 2 --> Layer 3 management */
+ /* ============================== */
+
+ int (*MDL_STATUS_IND) (int, int, int); /* L2 --> L3 status */
+
+#define MDL_Status_Ind(unit, status, parm) \
+ ((*i4b_l2l3_func.MDL_STATUS_IND)(unit, status, parm))
+
+ /* Layer 3 --> Layer 2 management */
+ /* ============================== */
+
+ int (*MDL_COMMAND_REQ) (int, int, int); /* L3 --> L2 command */
+
+#define MDL_Command_Req(unit, command, parm) \
+ ((*i4b_l2l3_func.MDL_COMMAND_REQ)(unit, command, parm))
+};
+
+#endif /* _I4B_L2L3_H_ */
+
diff --git a/sys/i4b/include/i4b_l3l4.h b/sys/i4b/include/i4b_l3l4.h
new file mode 100644
index 0000000..642777c
--- /dev/null
+++ b/sys/i4b/include/i4b_l3l4.h
@@ -0,0 +1,260 @@
+/*
+ * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *---------------------------------------------------------------------------
+ *
+ * i4b_l3l4.h - layer 3 / layer 4 interface
+ * ------------------------------------------
+ *
+ * $Id: i4b_l3l4.h,v 1.21 1998/12/05 18:02:59 hm Exp $
+ *
+ * last edit-date: [Sat Dec 5 18:04:58 1998]
+ *
+ *---------------------------------------------------------------------------*/
+
+#ifndef _I4B_L3L4_H_
+#define _I4B_L3L4_H_
+
+#define T303VAL (hz*4) /* 4 seconds timeout */
+#define T305VAL (hz*30) /* 30 seconds timeout */
+#define T308VAL (hz*4) /* 4 seconds timeout */
+#define T309VAL (hz*90) /* 90 seconds timeout */
+#define T310VAL (hz*60) /* 30-120 seconds timeout */
+#define T313VAL (hz*4) /* 4 seconds timeout */
+#define T400DEF (hz*10) /* 10 seconds timeout */
+
+#define N_CALL_DESC (MAX_CONTROLLERS*2) /* no of call descriptors */
+
+extern int nctrl; /* number of controllers detected in system */
+
+typedef struct bchan_statistics {
+ int outbytes;
+ int inbytes;
+} bchan_statistics_t;
+
+/*---------------------------------------------------------------------------*
+ * table of things the driver needs to know about the b channel
+ * it is connected to for data transfer
+ *---------------------------------------------------------------------------*/
+typedef struct i4l_isdn_bchan_linktab {
+ int unit;
+ int channel;
+ void (*bch_config)(int unit, int channel, int bprot, int updown);
+ void (*bch_tx_start)(int unit, int channel);
+ void (*bch_stat)(int unit, int channel, bchan_statistics_t *bsp);
+ struct ifqueue *tx_queue;
+ struct ifqueue *rx_queue; /* data xfer for NON-HDLC traffic */
+ struct mbuf **rx_mbuf; /* data xfer for HDLC based traffic */
+} isdn_link_t;
+
+/*---------------------------------------------------------------------------*
+ * table of things the b channel handler needs to know about
+ * the driver it is connected to for data transfer
+ *---------------------------------------------------------------------------*/
+typedef struct i4l_driver_bchan_linktab {
+ int unit;
+ void (*bch_rx_data_ready)(int unit);
+ void (*bch_tx_queue_empty)(int unit);
+ void (*bch_activity)(int unit, int rxtx);
+#define ACT_RX 0
+#define ACT_TX 1
+ void (*line_connected)(int unit, void *cde);
+ void (*line_disconnected)(int unit, void *cde);
+ void (*dial_response)(int unit, int stat);
+ void (*updown_ind)(int unit, int updown);
+} drvr_link_t;
+
+/* global linktab functions for controller types (aka hardware drivers) */
+struct ctrl_type_desc {
+ isdn_link_t* (*get_linktab)(int unit, int channel);
+ void (*set_linktab)(int unit, int channel, drvr_link_t *dlt);
+};
+extern struct ctrl_type_desc ctrl_types[];
+
+/* global linktab functions for RBCH userland driver */
+
+drvr_link_t *rbch_ret_linktab(int unit);
+void rbch_set_linktab(int unit, isdn_link_t *ilt);
+
+/* global linktab functions for IPR network driver */
+
+drvr_link_t *ipr_ret_linktab(int unit);
+void ipr_set_linktab(int unit, isdn_link_t *ilt);
+
+/* global linktab functions for TEL userland driver */
+
+drvr_link_t *tel_ret_linktab(int unit);
+void tel_set_linktab(int unit, isdn_link_t *ilt);
+
+/* global linktab functions for ISPPP userland driver */
+
+drvr_link_t *i4bisppp_ret_linktab(int unit);
+void i4bisppp_set_linktab(int unit, isdn_link_t *ilt);
+
+/*---------------------------------------------------------------------------*
+ * this structure describes one call/connection on one B-channel
+ * and all its parameters
+ *---------------------------------------------------------------------------*/
+typedef struct
+{
+ u_int cdid; /* call descriptor id */
+ int controller; /* isdn controller number */
+ int cr; /* call reference value */
+
+ int crflag; /* call reference flag */
+#define CRF_ORIG 0 /* originating side */
+#define CRF_DEST 1 /* destinating side */
+
+ int channelid; /* channel id value */
+ int channelexcl; /* channel exclusive */
+
+ int bprot; /* B channel protocol BPROT_XXX */
+
+ int driver; /* driver to use for B channel */
+ int driver_unit; /* unit for above driver number */
+
+ cause_t cause_in; /* cause value from NT */
+ cause_t cause_out; /* cause value to NT */
+
+ int call_state; /* from incoming SETUP */
+
+ u_char dst_telno[TELNO_MAX]; /* destination number */
+ u_char src_telno[TELNO_MAX]; /* source number */
+ int scr_ind; /* screening ind for incoming call */
+
+ int Q931state; /* Q.931 state for call */
+ int event; /* event to be processed */
+
+ int response; /* setup response type */
+
+ int T303; /* SETUP sent response timeout */
+ int T303_first_to; /* first timeout flag */
+
+ int T305; /* DISC without PROG IND */
+
+ int T308; /* RELEASE sent response timeout*/
+ int T308_first_to; /* first timeout flag */
+
+ int T309; /* data link disconnect timeout */
+
+ int T310; /* CALL PROC received */
+
+ int T313; /* CONNECT sent timeout */
+
+ int T400; /* L4 timeout */
+
+ isdn_link_t *ilt; /* isdn B channel linktab */
+ drvr_link_t *dlt; /* driver linktab */
+
+ int dir; /* outgoing or incoming call */
+#define DIR_OUTGOING 0
+#define DIR_INCOMING 1
+
+ int timeout_active; /* idle timeout() active flag */
+
+#if (defined(__FreeBSD_version) && __FreeBSD_version >= 300001) || \
+ (!defined(__FreeBSD_version) && defined(__FreeBSD__) && __FreeBSD__ >= 3)
+ struct callout_handle idle_timeout_handle;
+ struct callout_handle T303_callout;
+ struct callout_handle T305_callout;
+ struct callout_handle T308_callout;
+ struct callout_handle T309_callout;
+ struct callout_handle T310_callout;
+ struct callout_handle T313_callout;
+ struct callout_handle T400_callout;
+ int callouts_inited; /* must init before use */
+#endif
+
+ int idletime_state; /* wait for idle_time begin */
+#define IST_IDLE 0 /* shorthold mode disabled */
+#define IST_NONCHK 1 /* in non-checked window */
+#define IST_CHECK 2 /* in idle check window */
+#define IST_SAFE 3 /* in safety zone */
+
+ time_t idletimechk_start; /* check idletime window start */
+ time_t connect_time; /* time connect was made */
+ time_t last_active_time; /* last time with activity */
+
+ /* for incoming connections: */
+ time_t max_idle_time; /* max time without activity */
+
+ /* for outgoing connections: */
+ time_t unitlen_time; /* length of a charging unit */
+ time_t idle_time; /* idle time before end of unit */
+ time_t earlyhup_time; /* safety time zone at end of unit */
+
+ int aocd_flag; /* AOCD used for unitlength calc*/
+ time_t last_aocd_time; /* last time AOCD received */
+ int units; /* number of AOCD charging units*/
+ int units_type; /* units type: AOCD, AOCE */
+ int cunits; /* calculated units */
+
+ int isdntxdelay; /* isdn tx delay after connect */
+
+ u_char display[DISPLAY_MAX]; /* display information element */
+ char datetime[DATETIME_MAX]; /* date/time information element*/
+} call_desc_t;
+
+extern call_desc_t call_desc[N_CALL_DESC];
+
+/* forward decl. */
+struct isdn_diagnostic_request;
+struct isdn_dr_prot;
+
+/*---------------------------------------------------------------------------*
+ * this structure "describes" one controller
+ *---------------------------------------------------------------------------*/
+typedef struct
+{
+ int unit; /* unit number of this contr. */
+ int ctrl_type; /* controller type (CTRL_XXX) */
+ int card_type; /* card manufacturer (CARD_XXX) */
+
+ int dl_est; /* layer 2 established */
+#define DL_DOWN 0
+#define DL_UP 1
+
+ int bch_state[2]; /* states of the b channels */
+#define BCH_ST_FREE 0 /* free to be used, idle */
+#define BCH_ST_RSVD 1 /* reserved, may become free or used */
+#define BCH_ST_USED 2 /* in use for data transfer */
+
+ int tei; /* current tei or -1 if invalid */
+
+ /* pointers to functions to be called from L4 */
+
+ void (*N_CONNECT_REQUEST) (unsigned int);
+ void (*N_CONNECT_RESPONSE) (unsigned int, int, int);
+ void (*N_DISCONNECT_REQUEST) (unsigned int, int);
+ void (*N_ALERT_REQUEST) (unsigned int);
+ void (*N_SET_TRACE) (int unit, int val);
+ int (*N_GET_TRACE) (int unit);
+ int (*N_DOWNLOAD) (int unit, int numprotos, struct isdn_dr_prot *protocols);
+ int (*N_DIAGNOSTICS) (int unit, struct isdn_diagnostic_request*);
+ void (*N_MGMT_COMMAND) (int unit, int cmd, int parm);
+} ctrl_desc_t;
+
+extern ctrl_desc_t ctrl_desc[MAX_CONTROLLERS];
+
+#endif /* _I4B_Q931_H_ */
diff --git a/sys/i4b/include/i4b_mbuf.h b/sys/i4b/include/i4b_mbuf.h
new file mode 100644
index 0000000..49ee26d
--- /dev/null
+++ b/sys/i4b/include/i4b_mbuf.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *---------------------------------------------------------------------------
+ *
+ * i4b - mbuf handling support routines
+ * --------------------------------------
+ *
+ * $Id: i4b_mbuf.h,v 1.6 1998/12/05 18:03:00 hm Exp $
+ *
+ * last edit-date: [Sat Dec 5 18:05:12 1998]
+ *
+ *---------------------------------------------------------------------------*/
+
+#ifndef _I4B_MBUF_H_
+#define _I4B_MBUF_H_
+
+#define IF_QEMPTY(ifq) ((ifq)->ifq_len == 0)
+
+struct mbuf *i4b_Dgetmbuf( int );
+void i4b_Dfreembuf( struct mbuf *m );
+void i4b_Dcleanifq( struct ifqueue * );
+
+struct mbuf *i4b_Bgetmbuf( int );
+void i4b_Bfreembuf( struct mbuf *m );
+void i4b_Bcleanifq( struct ifqueue * );
+
+#endif /* _I4B_MBUF_H_ */
+
+/* EOF */
diff --git a/sys/i4b/include/i4b_tel_ioctl.h b/sys/i4b/include/i4b_tel_ioctl.h
new file mode 100644
index 0000000..b7f0f73
--- /dev/null
+++ b/sys/i4b/include/i4b_tel_ioctl.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *---------------------------------------------------------------------------
+ *
+ * i4b_tel_ioctl.h telephony interface ioctls
+ * ------------------------------------------
+ *
+ * $Id: i4b_tel_ioctl.h,v 1.5 1998/12/14 10:31:58 hm Exp $
+ *
+ * last edit-date: [Sat Dec 5 18:37:36 1998]
+ *
+ *---------------------------------------------------------------------------*/
+
+#ifndef _I4B_TEL_IOCTL_H_
+#define _I4B_TEL_IOCTL_H_
+
+/* supported audio format conversions for /dev/i4btelXX devices */
+
+#define CVT_NONE 0 /* no format conversion */
+#define CVT_ALAW2ULAW 1 /* kernel A-law, userland mu-law */
+
+/*---------------------------------------------------------------------------*
+ * get / set audio format
+ *---------------------------------------------------------------------------*/
+
+#define I4B_TEL_GETAUDIOFMT _IOR('A', 0, int)
+#define I4B_TEL_SETAUDIOFMT _IOW('A', 1, int)
+#define I4B_TEL_EMPTYINPUTQUEUE _IOW('A', 2, int)
+
+#endif /* _I4B_TEL_IOCTL_H_ */
diff --git a/sys/i4b/include/i4b_trace.h b/sys/i4b/include/i4b_trace.h
new file mode 100644
index 0000000..07e08da
--- /dev/null
+++ b/sys/i4b/include/i4b_trace.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *---------------------------------------------------------------------------
+ *
+ * i4b_trace.h - header file for trace data read device
+ * ----------------------------------------------------
+ *
+ * $Id: i4b_trace.h,v 1.5 1998/12/05 18:06:01 hm Exp $
+ *
+ * last edit-date: [Sat Dec 5 18:37:49 1998]
+ *
+ *---------------------------------------------------------------------------*/
+
+#ifndef _I4B_TRACE_H_
+#define _I4B_TRACE_H_
+
+/*---------------------------------------------------------------------------*
+ * structure of the header at the beginning of every trace mbuf
+ *---------------------------------------------------------------------------*/
+typedef struct {
+ int length; /* length of the following mbuf */
+ int unit; /* controller unit number */
+ int type; /* type of channel */
+#define TRC_CH_I 0 /* Layer 1 INFO's */
+#define TRC_CH_D 1 /* D channel */
+#define TRC_CH_B1 2 /* B1 channel */
+#define TRC_CH_B2 3 /* B2 channel */
+ int dir; /* direction */
+#define FROM_TE 0 /* user -> network */
+#define FROM_NT 1 /* network -> user */
+ int trunc; /* # of truncated bytes (frame > MCLBYTES) */
+ unsigned int count; /* frame count for this unit/type */
+ struct timeval time; /* timestamp for this frame */
+} i4b_trace_hdr_t;
+
+#define INFO0 0 /* layer 1 */
+#define INFO1_8 1
+#define INFO1_10 2
+#define INFO2 3
+#define INFO3 4
+#define INFO4_8 5
+#define INFO4_10 6
+
+/*---------------------------------------------------------------------------*
+ * ioctl via /dev/i4btrc device(s):
+ * get/set current trace flag settings
+ *---------------------------------------------------------------------------*/
+
+#define I4B_TRC_GET _IOR('T', 0, int) /* get trace settings */
+#define I4B_TRC_SET _IOW('T', 1, int) /* set trace settings */
+
+#define TRACE_OFF 0x00 /* tracing off */
+#define TRACE_I 0x01 /* trace L1 INFO's on */
+#define TRACE_D_TX 0x02 /* trace D channel on */
+#define TRACE_D_RX 0x04 /* trace D channel on */
+#define TRACE_B_TX 0x08 /* trace B channel on */
+#define TRACE_B_RX 0x10 /* trace B channel on */
+
+typedef struct {
+ int rxunit; /* unit # for rx frames */
+ int rxflags; /* d and/or b channel */
+ int txunit; /* unit # for tx frames */
+ int txflags; /* d and/or b channel */
+} i4b_trace_setupa_t;
+
+#define I4B_TRC_SETA _IOW('T', 2, i4b_trace_setupa_t) /* set analyze mode */
+#define I4B_TRC_RESETA _IOW('T', 3, int) /* reset analyze mode */
+
+#endif /* _I4B_TRACE_H_ */
OpenPOWER on IntegriCloud