From 749b5a99abda92054e94912da19645275e723937 Mon Sep 17 00:00:00 2001 From: calle Date: Sun, 30 Aug 1998 09:57:13 +0000 Subject: [PATCH] I hope it is know readable for everybody. --- capi20/.cvsignore | 5 + capi20/Makefile.in | 55 ++ capi20/aclocal.m4 | 41 ++ capi20/capi20.c | 326 ++++++++++ capi20/capi20.h | 957 +++++++++++++++++++++++++++ capi20/capifunc.c | 313 +++++++++ capi20/configure | 1500 +++++++++++++++++++++++++++++++++++++++++++ capi20/configure.in | 38 ++ capi20/convert.c | 420 ++++++++++++ capi20/install-sh | 2 + 10 files changed, 3657 insertions(+) create mode 100644 capi20/.cvsignore create mode 100644 capi20/Makefile.in create mode 100644 capi20/aclocal.m4 create mode 100644 capi20/capi20.c create mode 100644 capi20/capi20.h create mode 100644 capi20/capifunc.c create mode 100755 capi20/configure create mode 100644 capi20/configure.in create mode 100644 capi20/convert.c create mode 100755 capi20/install-sh diff --git a/capi20/.cvsignore b/capi20/.cvsignore new file mode 100644 index 00000000..d1b28fe7 --- /dev/null +++ b/capi20/.cvsignore @@ -0,0 +1,5 @@ +config.log +config.cache +config.status +Makefile +comperr diff --git a/capi20/Makefile.in b/capi20/Makefile.in new file mode 100644 index 00000000..8d14726f --- /dev/null +++ b/capi20/Makefile.in @@ -0,0 +1,55 @@ +# $Id: Makefile.in,v 1.3 1998/08/30 09:57:13 calle Exp $ +# +# Makefile for libcapi20 +# (C) 1998 Carsten Paeth +# +# $Log: Makefile.in,v $ +# Revision 1.3 1998/08/30 09:57:13 calle +# I hope it is know readable for everybody. +# +# Revision 1.1 1998/08/25 16:33:14 calle +# Added CAPI2.0 library. First Version. +# +# + +prefix := @prefix@ +exec_prefix := @exec_prefix@ + +LIBDIR := @libdir@ +INCLUDEDIR := @includedir@ +INSTALL := @INSTALL@ +INSTALL_DATA := $(INSTALL) -m 0644 -o 0 -g 0 + +all: libcapi20.a + +install: all + $(INSTALL_DATA) libcapi20.a $(LIBDIR) + $(INSTALL_DATA) capi20.h $(INCLUDEDIR) + +ifeq (.depend,$(wildcard .depend)) +include .depend +endif + +.depend: + $(CPP) -M $(CFLAGS) $(DEFS) *.c >.depend + +depend: .depend + +config: + @./configure + +Makefile: Makefile.in config.status + ./config.status + +config.status: configure + ./config.status --recheck + +libcapi20.a: capi20.o capifunc.o convert.o + @rm -f $@ + $(AR) cvq $@ $^ + +clean: + rm -f *.o libcapi20.a libcapi20.so.* comperr + +distclean: clean + rm -f config.status config.cache config.log Makefile .depend diff --git a/capi20/aclocal.m4 b/capi20/aclocal.m4 new file mode 100644 index 00000000..eeca1b77 --- /dev/null +++ b/capi20/aclocal.m4 @@ -0,0 +1,41 @@ +dnl +dnl Try finding linux sourcetree +dnl + +AC_DEFUN(AC_FIND_KERNEL, [ + OLD_CPPFLAGS="$CPPFLAGS" + lxdir="no" + eval tst_kerneldir=$CONFIG_KERNELDIR + + AC_ARG_WITH(kernel, + [ --with-kernel=DIR Set kernel source directory [/usr/src/linux]], + DOTEST="y"; tst_kerneldir="${withval}") + + if test "$DOTEST" = "y" || test "$CONFIG_KERNELDIR" != "" ; then + AC_MSG_CHECKING([for linux kernel source in ${tst_kerneldir}]) + CPPFLAGS="-nostdinc -I${tst_kerneldir}/drivers/isdn" + AC_TRY_CPP([#include ], lxdir=${tst_kerneldir}, + AC_MSG_RESULT("no")) + fi + if test "$lxdir" = "no" ; then + AC_MSG_CHECKING([for linux kernel source in /usr/src/linux]) + CPPFLAGS="-nostdinc -I/usr/src/linux/drivers/isdn" + AC_TRY_CPP([#include ], lxdir=/usr/src/linux) + fi + if test "$lxdir" = "no" ; then + AC_MSG_RESULT("$lxdir") + AC_MSG_CHECKING([for linux kernel source in /usr/local/src/linux]) + CPPFLAGS="-nostdinc -I/usr/local/src/linux/drivers/isdn" + AC_TRY_CPP([#include ], lxdir=/usr/local/src/linux) + fi + if test "$lxdir" != "no" ; then + AC_MSG_RESULT("yes") + else + lxdir="" + AC_MSG_ERROR("Kernel source not found. You MUST specify a correct path to the linux source in the configuration.") + fi + CONFIG_KERNELDIR="$lxdir" + CPPFLAGS="$OLD_CPPFLAGS" + AC_DEFINE_UNQUOTED(CONFIG_KERNELDIR,"$lxdir") + AC_SUBST(CONFIG_KERNELDIR) +]) diff --git a/capi20/capi20.c b/capi20/capi20.c new file mode 100644 index 00000000..0990ca7e --- /dev/null +++ b/capi20/capi20.c @@ -0,0 +1,326 @@ +/* + * $Id: capi20.c,v 1.3 1998/08/30 09:57:14 calle Exp $ + * + * $Log: capi20.c,v $ + * Revision 1.3 1998/08/30 09:57:14 calle + * I hope it is know readable for everybody. + * + * Revision 1.1 1998/08/25 16:33:16 calle + * Added CAPI2.0 library. First Version. + * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "capi20.h" + +static int capi_fd = -1; +static capi_ioctl_struct ioctl_data; +static unsigned char rcvbuf[128+2048]; /* message + data */ +static unsigned char sndbuf[128+2048]; /* message + data */ + +unsigned capi20_isinstalled (void) +{ + if (capi_fd >= 0) + return 1; + + /*----- open managment link -----*/ + if ((capi_fd = open("/dev/capi20", O_RDWR, 0666)) < 0) + return 0; + + return ioctl(capi_fd, CAPI_INSTALLED, 0) == 0; +} + +/* + * managment of application ids + */ + +static struct capi_applidmap { + int used; + int fd; +} capi_applidmap[CAPI_MAXAPPL] = {0}; + +static inline _cword allocapplid(int fd) +{ + _cword i; + for (i=0; i < CAPI_MAXAPPL; i++) { + if (capi_applidmap[i].used == 0) { + capi_applidmap[i].used = 1; + capi_applidmap[i].fd = fd; + return i+1; + } + } + return 0; +} + +static inline void freeapplid(_cword applid) +{ + capi_applidmap[applid-1].used = 0; + capi_applidmap[applid-1].fd = -1; +} + +static inline int validapplid(_cword applid) +{ + return applid > 0 && applid <= CAPI_MAXAPPL + && capi_applidmap[applid-1].used; +} + +static inline int applid2fd(_cword applid) +{ + if (applid < CAPI_MAXAPPL) + return capi_applidmap[applid-1].fd; + return -1; +} + +/* + * CAPI2.0 functions + */ + +_cword +capi20_register (unsigned MaxB3Connection, + unsigned MaxB3Blks, + unsigned MaxSizeB3, + CAPI_REGISTER_ERROR *ErrorCode) +{ + _cword applid; + char buf[PATH_MAX]; + int i, fd = -1; + + if (!capi20_isinstalled()) { + *ErrorCode = CapiRegNotInstalled; + return 0; + } + + *ErrorCode = CapiRegOSResourceErr; + + for (i=0; fd < 0; i++) { + /*----- open pseudo-clone device -----*/ + sprintf(buf, "/dev/capi20.%02d", i); + if ((fd = open(buf, O_RDWR|O_NONBLOCK, 0666)) < 0) { + switch (errno) { + case EEXIST: + break; + default: + return 0; + } + } + } + + if ((applid = allocapplid(fd)) == 0) + return 0; + + ioctl_data.rparams.level3cnt = MaxB3Connection; + ioctl_data.rparams.datablkcnt = MaxB3Blks; + ioctl_data.rparams.datablklen = MaxSizeB3; + + if (ioctl(fd, CAPI_REGISTER, &ioctl_data) < 0) { + if (errno == EIO) { + if (ioctl(fd, CAPI_GET_ERRCODE, &ioctl_data) < 0) + return 0; + *ErrorCode = ioctl_data.errcode; + } + return 0; + } + return applid; +} + +MESSAGE_EXCHANGE_ERROR +capi20_release (unsigned Appl_Id) +{ + if (!capi20_isinstalled()) + return CapiRegNotInstalled; + if (!validapplid(Appl_Id)) + return CapiIllAppNr; + (void)close(applid2fd(Appl_Id)); + freeapplid(Appl_Id); + return CapiNoError; +} + +MESSAGE_EXCHANGE_ERROR +capi20_put_message (CAPI_MESSAGE Msg, unsigned Appl_Id) +{ + MESSAGE_EXCHANGE_ERROR ret; + int len = (Msg[0] | (Msg[1] << 8)); + int cmd = Msg[4]; + int subcmd = Msg[5]; + int rc; + int fd; + + if (!capi20_isinstalled()) + return CapiRegNotInstalled; + + if (!validapplid(Appl_Id)) + return CapiIllAppNr; + + fd = applid2fd(Appl_Id); + + memcpy(sndbuf, Msg, len); + + if (cmd == CAPI_DATA_B3 && subcmd == CAPI_REQ) { + int datalen = (Msg[16] | (Msg[17] << 8)); + void *dataptr = (void *)(Msg[12]|(Msg[13]<<8)|(Msg[14]<<16)|(Msg[15]<<24)); + memcpy(sndbuf+len, dataptr, datalen); + len += datalen; + } + + ret = CapiNoError; + errno = 0; + + if ((rc = write(fd, sndbuf, len)) != len) { + switch (errno) { + case EFAULT: + case EINVAL: + ret = CapiIllCmdOrSubcmdOrMsgToSmall; + break; + case EBADF: + ret = CapiIllAppNr; + break; + case EIO: + if (ioctl(fd, CAPI_GET_ERRCODE, &ioctl_data) < 0) + ret = CapiMsgOSResourceErr; + else ret = (MESSAGE_EXCHANGE_ERROR)ioctl_data.errcode; + break; + default: + ret = CapiMsgOSResourceErr; + break; + } + } + + return ret; +} + +MESSAGE_EXCHANGE_ERROR +capi20_get_message (unsigned Appl_Id, CAPI_MESSAGE *ReturnMessage) +{ + MESSAGE_EXCHANGE_ERROR ret; + int rc, fd; + + if (!capi20_isinstalled()) + return CapiRegNotInstalled; + + if (!validapplid(Appl_Id)) + return CapiIllAppNr; + + fd = applid2fd(Appl_Id); + + *ReturnMessage = rcvbuf; + if ((rc = read(fd, rcvbuf, sizeof(rcvbuf))) > 0) { + return CapiNoError; + } + + if (rc == 0) + return CapiReceiveQueueEmpty; + + switch (errno) { + case EMSGSIZE: + ret = CapiIllCmdOrSubcmdOrMsgToSmall; + break; + case EAGAIN: + return CapiReceiveQueueEmpty; + default: + ret = CapiMsgOSResourceErr; + break; + } + + return ret; +} + +CAPI_MESSAGE +capi20_get_manufacturer(unsigned contr, CAPI_MESSAGE LpBuffer) +{ + if (!capi20_isinstalled()) + return 0; + ioctl_data.contr = contr; + if (ioctl(capi_fd, CAPI_GET_MANUFACTURER, &ioctl_data) < 0) + return 0; + strncpy(LpBuffer, ioctl_data.manufacturer, CAPI_MANUFACTURER_LEN); + return LpBuffer; +} + +CAPI_MESSAGE +capi20_get_version(unsigned contr, CAPI_MESSAGE version) +{ + if (!capi20_isinstalled()) + return 0; + ioctl_data.contr = contr; + if (ioctl(capi_fd, CAPI_GET_VERSION, &ioctl_data) < 0) + return 0; + memcpy(version, &ioctl_data.version, sizeof(capi_version)); + return version; +} + +CAPI_MESSAGE +capi20_get_serial_number(unsigned contr, CAPI_MESSAGE LpBuffer) +{ + if (!capi20_isinstalled()) + return 0; + ioctl_data.contr = contr; + if (ioctl(capi_fd, CAPI_GET_SERIAL, &ioctl_data) < 0) + return 0; + memcpy(LpBuffer, &ioctl_data.serial, CAPI_SERIAL_LEN); + return LpBuffer; +} + +MESSAGE_EXCHANGE_ERROR +capi20_get_profile(unsigned Controller, CAPI_MESSAGE LpBuffer) +{ + if (!capi20_isinstalled()) + return CapiMsgNotInstalled; + + ioctl_data.contr = Controller; + if (ioctl(capi_fd, CAPI_GET_PROFILE, &ioctl_data) < 0) { + if (errno != EIO) + return CapiMsgOSResourceErr; + if (ioctl(capi_fd, CAPI_GET_ERRCODE, &ioctl_data) < 0) + return CapiMsgOSResourceErr; + return (MESSAGE_EXCHANGE_ERROR)ioctl_data.errcode; + } + if (Controller) + memcpy(LpBuffer, &ioctl_data.profile, CAPI_SERIAL_LEN); + else + memcpy(LpBuffer, &ioctl_data.profile.ncontroller, + sizeof(ioctl_data.profile.ncontroller)); + return CapiNoError; +} +/* + * functions added to the CAPI2.0 spec + */ + +MESSAGE_EXCHANGE_ERROR +capi20_waitformessage(_cword Appl_Id, struct timeval *tvp) +{ + int fd; + fd_set rfds; + int retval; + + FD_ZERO(&rfds); + + if(!capi20_isinstalled()) + return CapiRegNotInstalled; + + if(!validapplid(Appl_Id)) + return CapiIllAppNr; + + fd = applid2fd(Appl_Id); + + FD_SET(fd, &rfds); + + fcntl(fd, F_SETFL, !O_NONBLOCK); + retval = select(fd + 1, &rfds, NULL, NULL, tvp); + fcntl(fd, F_SETFL, O_NONBLOCK); + + return(CapiNoError); +} + +int +capi20_fileno(_cword applid) +{ + return applid2fd(applid); +} + diff --git a/capi20/capi20.h b/capi20/capi20.h new file mode 100644 index 00000000..7f55abd3 --- /dev/null +++ b/capi20/capi20.h @@ -0,0 +1,957 @@ +#ifndef __CAPI20_H +#define __CAPI20_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*----- basic-type definitions -----*/ + +typedef unsigned char *CAPI_MESSAGE; +typedef unsigned char _cbyte; +typedef unsigned short _cword; +typedef unsigned long _cdword; +typedef CAPI_MESSAGE _cstruct; +typedef enum { CAPI_COMPOSE = 0, CAPI_DEFAULT = 1 } _cmstruct; + +/*----- errornumbers -----*/ + +typedef enum { + CapiToManyAppls =0x1001, + CapiLogBlkSizeToSmall =0x1002, + CapiBuffExeceeds64k =0x1003, + CapiMsgBufSizeToSmall =0x1004, + CapiAnzLogConnNotSupported =0x1005, + CapiRegReserved =0x1006, + CapiRegBusy =0x1007, + CapiRegOSResourceErr =0x1008, + CapiRegNotInstalled =0x1009, + CapiRegCtrlerNotSupportExtEquip =0x100a, + CapiRegCtrlerOnlySupportExtEquip =0x100b +} CAPI_REGISTER_ERROR; + +typedef enum { + CapiNoError =0x0000, + CapiIllAppNr =0x1101, + CapiIllCmdOrSubcmdOrMsgToSmall =0x1102, + CapiSendQueueFull =0x1103, + CapiReceiveQueueEmpty =0x1104, + CapiReceiveOverflow =0x1105, + CapiUnknownNotPar =0x1106, + CapiMsgBusy =0x1107, + CapiMsgOSResourceErr =0x1108, + CapiMsgNotInstalled =0x1109, + CapiMsgCtrlerNotSupportExtEquip =0x110a, + CapiMsgCtrlerOnlySupportExtEquip =0x110b +} MESSAGE_EXCHANGE_ERROR; + +/*----- CAPI commands -----*/ + +#define CAPI_ALERT 0x01 +#define CAPI_CONNECT 0x02 +#define CAPI_CONNECT_ACTIVE 0x03 +#define CAPI_CONNECT_B3_ACTIVE 0x83 +#define CAPI_CONNECT_B3 0x82 +#define CAPI_CONNECT_B3_T90_ACTIVE 0x88 +#define CAPI_DATA_B3 0x86 +#define CAPI_DISCONNECT_B3 0x84 +#define CAPI_DISCONNECT 0x04 +#define CAPI_FACILITY 0x80 +#define CAPI_INFO 0x08 +#define CAPI_LISTEN 0x05 +#define CAPI_MANUFACTURER 0xff +#define CAPI_RESET_B3 0x87 +#define CAPI_SELECT_B_PROTOCOL 0x41 + +/*----- CAPI subcommands -----*/ + +#define CAPI_REQ 0x80 +#define CAPI_CONF 0x81 +#define CAPI_IND 0x82 +#define CAPI_RESP 0x83 + +/* standard CAPI2.0 functions */ + +unsigned capi20_isinstalled (void); + +_cword capi20_register (unsigned MaxB3Connection, + unsigned MaxB3Blks, + unsigned MaxSizeB3, + CAPI_REGISTER_ERROR *ErrorCode); + +MESSAGE_EXCHANGE_ERROR capi20_release (unsigned Appl_Id); + +MESSAGE_EXCHANGE_ERROR capi20_put_message (CAPI_MESSAGE Msg, unsigned Appl_Id); + +MESSAGE_EXCHANGE_ERROR capi20_get_message (unsigned Appl_Id, CAPI_MESSAGE *ReturnMessage); + +CAPI_MESSAGE capi20_get_manufacturer (unsigned contr, CAPI_MESSAGE LpBuffer); + +CAPI_MESSAGE capi20_get_version (unsigned contr, CAPI_MESSAGE version); + +CAPI_MESSAGE capi20_get_serial_number (unsigned contr, CAPI_MESSAGE LpBuffer); + +MESSAGE_EXCHANGE_ERROR capi20_get_profile (unsigned Controller, CAPI_MESSAGE LpBuffer); + +/* CAPI2.0 Spec names */ +#define CAPI20_REGISTER capi20_register +#define CAPI20_RELEASE capi20_release +#define CAPI20_PUT_MESSAGE capi20_put_message +#define CAPI20_GET_MESSAGE capi20_get_message +#define CAPI20_GET_MANUFACTURER capi20_get_manufacturer +#define CAPI20_GET_VERSION capi20_get_version +#define CAPI20_GET_SERIAL_NUMBER capi20_get_serial_number +#define CAPI20_GET_PROFILE capi20_get_profile + +/* extra functions */ +#define CAPI20_WaitforMessage capi20_waitformessage +MESSAGE_EXCHANGE_ERROR capi20_waitformessage(_cword Appl_Id, struct timeval *tvp); + +int capi20_fileno(_cword applid); + +/* + * The _cmsg structure contains all possible CAPI 2.0 parameter. + * All parameters are stored here first. The function capi_cmsg2message() + * assembles the parameter and builds CAPI2.0 conform messages. + * capi_message2cmsg disassembles CAPI 2.0 messages and stores the + * parameter in the _cmsg structure + */ + +typedef struct { + /* Header */ + _cword ApplId; + _cbyte Command; + _cbyte Subcommand; + _cword Messagenumber; + + /* Parameter */ + union { + _cdword adrController; + _cdword adrPLCI; + _cdword adrNCCI; + } adr; + + _cmstruct AdditionalInfo; + _cstruct B1configuration; + _cword B1protocol; + _cstruct B2configuration; + _cword B2protocol; + _cstruct B3configuration; + _cword B3protocol; + _cstruct BC; + _cstruct BChannelinformation; + _cmstruct BProtocol; + _cstruct CalledPartyNumber; + _cstruct CalledPartySubaddress; + _cstruct CallingPartyNumber; + _cstruct CallingPartySubaddress; + _cdword CIPmask; + _cdword CIPmask2; + _cword CIPValue; + _cdword Class; + _cstruct ConnectedNumber; + _cstruct ConnectedSubaddress; + _cdword Data; + _cword DataHandle; + _cword DataLength; + _cstruct FacilityConfirmationParameter; + _cstruct Facilitydataarray; + _cstruct FacilityIndicationParameter; + _cstruct FacilityRequestParameter; + _cstruct FacilityResponseParameters; + _cword FacilitySelector; + _cword Flags; + _cdword Function; + _cstruct HLC; + _cword Info; + _cstruct InfoElement; + _cdword InfoMask; + _cword InfoNumber; + _cstruct Keypadfacility; + _cstruct LLC; + _cstruct ManuData; + _cdword ManuID; + _cstruct NCPI; + _cword Reason; + _cword Reason_B3; + _cword Reject; + _cstruct Useruserdata; + + /* intern */ + unsigned l,p; + unsigned char *par; + CAPI_MESSAGE m; +} _cmsg; + +unsigned capi_cmsg2message(_cmsg *cmsg, CAPI_MESSAGE msg); + +unsigned capi_message2cmsg (_cmsg *cmsg, CAPI_MESSAGE msg); + +/* + * capi_put_cmsg() works like capi_put_message() but it converts the _cmsg + * first with capi_cmsg2message(). Possible errors from capi_put_message() + * will be returned. + */ + +unsigned capi_put_cmsg(_cmsg *cmsg); + +/* + * capi_get_cmsg() works like capi_get_message() and converts the CAPI message + * to a _cmsg with capi_message2cmsg(). Possible errors from capi_get_message() + * will be returned. + */ +unsigned capi_get_cmsg(_cmsg *cmsg, unsigned applid); + +/* + * capi_cmsg_header() fills the _cmsg structure with default values, so only + * parameter with non default values must be changed before sending the + * message. + */ +unsigned capi_cmsg_header (_cmsg *cmsg, _cword _ApplId, _cbyte _Command, _cbyte _Subcommand, _cword _Messagenumber, _cdword _Controller); + +/* + * capi_cmsg_answer() is used to answer indications. It changes the header + * of an indication to a response, and leaves all other parameters the same + */ +unsigned capi_cmsg_answer (_cmsg *cmsg); + +/*----- defines to access specific parameter -----*/ + +#define ALERT_REQ_PLCI(x) ((x)->adr.adrPLCI) + /* Physical Link Connection Identifier */ +#define ALERT_REQ_ADDITIONALINFO(x) ((x)->AdditionalInfo) + /* Additional info elements */ +#define ALERT_REQ_BCHANNELINFORMATION(x) ((x)->BChannelinformation) +#define ALERT_REQ_KEYPADFACILITY(x) ((x)->Keypadfacility) + /* coded according to ETS 300 102-1 / Q.931 */ +#define ALERT_REQ_USERUSERDATA(x) ((x)->Useruserdata) + /* coded according to ETS 300 102-1 / Q.931 */ +#define ALERT_REQ_FACILITYDATAARRAY(x) ((x)->Facilitydataarray) + /* which is used to transfer additional parameters coded */ + /* according to ETS 300 102-1 / Q.931 starting from octet 1. */ + /* This field is used to transport one or more complete facility */ + /* data information elements. */ +#define ALERT_CONF_PLCI(x) ((x)->adr.adrPLCI) + /* Physical Link Connection Identifier */ +#define ALERT_CONF_INFO(x) ((x)->Info) + /* 0: alert initiated */ + /* 0x0003: alert already sent by another application */ + /* 0x2001: message not supported in current state */ + /* 0x2002: illegal PLCI */ + /* 0x2007: illegal message parameter coding */ +#define CONNECT_REQ_CONTROLLER(x) ((x)->adr.adrController) +#define CONNECT_REQ_CIPVALUE(x) ((x)->CIPValue) + /* Compatibility Information Profile */ +#define CONNECT_REQ_CALLEDPARTYNUMBER(x) ((x)->CalledPartyNumber) + /* Called party number */ +#define CONNECT_REQ_CALLINGPARTYNUMBER(x) ((x)->CallingPartyNumber) + /* Calling party number */ +#define CONNECT_REQ_CALLEDPARTYSUBADDRESS(x) ((x)->CalledPartySubaddress) + /* Called party subaddress */ +#define CONNECT_REQ_CALLINGPARTYSUBADDRESS(x) ((x)->CallingPartySubaddress) + /* Calling party subaddress */ +#define CONNECT_REQ_BPROTOCOL(x) ((x)->BProtocol) + /* B protocol to be used */ +#define CONNECT_REQ_B1PROTOCOL(x) ((x)->B1protocol) + /* Physical layer and framing */ +#define CONNECT_REQ_B2PROTOCOL(x) ((x)->B2protocol) + /* Data link layer */ +#define CONNECT_REQ_B3PROTOCOL(x) ((x)->B3protocol) + /* Network layer */ +#define CONNECT_REQ_B1CONFIGURATION(x) ((x)->B1configuration) + /* Physical layer and framing parameter */ +#define CONNECT_REQ_B2CONFIGURATION(x) ((x)->B2configuration) + /* Data link layer parameter */ +#define CONNECT_REQ_B3CONFIGURATION(x) ((x)->B3configuration) + /* Network layer parameter */ +#define CONNECT_REQ_BC(x) ((x)->BC) + /* Bearer Capability */ +#define CONNECT_REQ_LLC(x) ((x)->LLC) + /* Low Layer Compatibility */ +#define CONNECT_REQ_HLC(x) ((x)->HLC) + /* High Layer Compatibility */ +#define CONNECT_REQ_ADDITIONALINFO(x) ((x)->AdditionalInfo) + /* Additional information elements */ +#define CONNECT_REQ_BCHANNELINFORMATION(x) ((x)->BChannelinformation) +#define CONNECT_REQ_KEYPADFACILITY(x) ((x)->Keypadfacility) + /* coded according to ETS 300 102-1 / Q.931 */ +#define CONNECT_REQ_USERUSERDATA(x) ((x)->Useruserdata) + /* coded according to ETS 300 102-1 / Q.931 */ +#define CONNECT_REQ_FACILITYDATAARRAY(x) ((x)->Facilitydataarray) + /* which is used to transfer additional parameters coded */ + /* according to ETS 300 102-1 / Q.931 starting from octet 1. */ + /* This field is used to transport one or more complete facility */ + /* data information elements. */ +#define CONNECT_CONF_PLCI(x) ((x)->adr.adrPLCI) + /* Physical Link Connection Identifier */ +#define CONNECT_CONF_INFO(x) ((x)->Info) + /* 0: connect initiated */ + /* 0x2002: illegal controller */ + /* 0x2003: out of PLCI */ + /* 0x2007: illegal message parameter coding */ + /* 0x3001: B1 protocol not supported */ + /* 0x3002: B2 protocol not supported */ + /* 0x3003: B3 protocol not supported */ + /* 0x3004: B1 protocol parameter not supported */ + /* 0x3005: B2 protocol parameter not supported */ + /* 0x3006: B3 protocol parameter not supported */ + /* 0x3007: B protocol combination not supported */ + /* 0x300A: CIP Value unknown */ +#define CONNECT_IND_PLCI(x) ((x)->adr.adrPLCI) + /* Physical Link Connection Identifier */ +#define CONNECT_IND_CIPVALUE(x) ((x)->CIPValue) + /* Compatibility Information Profile */ +#define CONNECT_IND_CALLEDPARTYNUMBER(x) ((x)->CalledPartyNumber) + /* Called party number */ +#define CONNECT_IND_CALLINGPARTYNUMBER(x) ((x)->CallingPartyNumber) + /* Calling party number */ +#define CONNECT_IND_CALLEDPARTYSUBADDRESS(x) ((x)->CalledPartySubaddress) + /* Called party subaddress */ +#define CONNECT_IND_CALLINGPARTYSUBADDRESS(x) ((x)->CallingPartySubaddress) + /* Calling party subaddress */ +#define CONNECT_IND_BC(x) ((x)->BC) + /* Bearer compatibility */ +#define CONNECT_IND_LLC(x) ((x)->LLC) + /* Low Layer Compatibility */ +#define CONNECT_IND_HLC(x) ((x)->HLC) + /* High Layer Compatibility */ +#define CONNECT_IND_ADDITIONALINFO(x) ((x)->AdditionalInfo) + /* Additional information elements */ +#define CONNECT_IND_BCHANNELINFORMATION(x) ((x)->BChannelinformation) +#define CONNECT_IND_KEYPADFACILITY(x) ((x)->Keypadfacility) + /* coded according to ETS 300 102-1 / Q.931 */ +#define CONNECT_IND_USERUSERDATA(x) ((x)->Useruserdata) + /* coded according to ETS 300 102-1 / Q.931 */ +#define CONNECT_IND_FACILITYDATAARRAY(x) ((x)->Facilitydataarray) + /* which is used to transfer additional parameters coded */ + /* according to ETS 300 102-1 / Q.931 starting from octet 1. */ + /* This field is used to transport one or more complete facility */ + /* data information elements. */ +#define CONNECT_RESP_PLCI(x) ((x)->adr.adrPLCI) + /* Physical Link Connection Identifier */ +#define CONNECT_RESP_REJECT(x) ((x)->Reject) + /* 0: accept call */ + /* 1: ignore call */ + /* 2: reject call, normal call clearing */ + /* 3: reject call, user busy */ + /* 4: reject call, requestet circuit/channel not available */ + /* 5: reject call, facility rejected */ + /* 6: reject call, channel unacceptable */ + /* 7: reject call, incompatible destination */ + /* 8: reject call, destination out of order */ +#define CONNECT_RESP_BPROTOCOL(x) ((x)->BProtocol) + /* B protocol to be used */ +#define CONNECT_RESP_B1PROTOCOL(x) ((x)->B1protocol) + /* Physical layer and framing */ +#define CONNECT_RESP_B2PROTOCOL(x) ((x)->B2protocol) + /* Data link layer */ +#define CONNECT_RESP_B3PROTOCOL(x) ((x)->B3protocol) + /* Network layer */ +#define CONNECT_RESP_B1CONFIGURATION(x) ((x)->B1configuration) + /* Physical layer and framing parameter */ +#define CONNECT_RESP_B2CONFIGURATION(x) ((x)->B2configuration) + /* Data link layer parameter */ +#define CONNECT_RESP_B3CONFIGURATION(x) ((x)->B3configuration) + /* Network layer parameter */ +#define CONNECT_RESP_CONNECTEDNUMBER(x) ((x)->ConnectedNumber) + /* Connected number */ +#define CONNECT_RESP_CONNECTEDSUBADDRESS(x) ((x)->ConnectedSubaddress) + /* Connected subaddress */ +#define CONNECT_RESP_LLC(x) ((x)->LLC) + /* Low Layer Compatibility */ +#define CONNECT_RESP_ADDITIONALINFO(x) ((x)->AdditionalInfo) + /* Additional information elements */ +#define CONNECT_RESP_BCHANNELINFORMATION(x) ((x)->BChannelinformation) +#define CONNECT_RESP_KEYPADFACILITY(x) ((x)->Keypadfacility) + /* coded according to ETS 300 102-1 / Q.931 */ +#define CONNECT_RESP_USERUSERDATA(x) ((x)->Useruserdata) + /* coded according to ETS 300 102-1 / Q.931 */ +#define CONNECT_RESP_FACILITYDATAARRAY(x) ((x)->Facilitydataarray) + /* which is used to transfer additional parameters coded */ + /* according to ETS 300 102-1 / Q.931 starting from octet 1. */ + /* This field is used to transport one or more complete facility */ + /* data information elements. */ +#define CONNECT_ACTIVE_IND_PLCI(x) ((x)->adr.adrPLCI) + /* Physical Link Connection Identifier */ +#define CONNECT_ACTIVE_IND_CONNECTEDNUMBER(x) ((x)->ConnectedNumber) + /* Connected number */ +#define CONNECT_ACTIVE_IND_CONNECTEDSUBADDRESS(x) ((x)->ConnectedSubaddress) + /* Connected subaddress */ +#define CONNECT_ACTIVE_IND_LLC(x) ((x)->LLC) + /* Low Layer Compatibility */ +#define CONNECT_ACTIVE_RESP_PLCI(x) ((x)->adr.adrPLCI) + /* Physical Link Connection Identifier */ +#define CONNECT_B3_ACTIVE_IND_NCCI(x) ((x)->adr.adrNCCI) + /* Network Control Connection Identifier */ +#define CONNECT_B3_ACTIVE_IND_NCPI(x) ((x)->NCPI) + /* Network Control Protocol Information */ +#define CONNECT_B3_ACTIVE_RESP_NCCI(x) ((x)->adr.adrNCCI) + /* Network Control Connection Identifier */ +#define CONNECT_B3_REQ_PLCI(x) ((x)->adr.adrPLCI) + /* Physical Link Connection Identifier */ +#define CONNECT_B3_REQ_NCPI(x) ((x)->NCPI) + /* Network Control Protocol Information */ +#define CONNECT_B3_CONF_NCCI(x) ((x)->adr.adrNCCI) + /* Network Control Connection Identifier */ +#define CONNECT_B3_CONF_INFO(x) ((x)->Info) + /* 0: connect initiated */ + /* 0x0001: NCPI not supported by current protocol, NCPI ignored */ + /* 0x2001: message not supported in current state */ + /* 0x2002: illegal PLCI */ + /* 0x2004: out of NCCI */ + /* 0x3008: NCPI not supported */ +#define CONNECT_B3_IND_NCCI(x) ((x)->adr.adrNCCI) + /* Network Control Connection Identifier */ +#define CONNECT_B3_IND_NCPI(x) ((x)->NCPI) + /* Network Control Protocol Information */ +#define CONNECT_B3_RESP_NCCI(x) ((x)->adr.adrNCCI) + /* Network Control Connection Identifier */ +#define CONNECT_B3_RESP_REJECT(x) ((x)->Reject) + /* 0: accept call */ + /* 2: reject call, normal call clearing */ +#define CONNECT_B3_RESP_NCPI(x) ((x)->NCPI) + /* Network Control Protocol Information */ +#define CONNECT_B3_T90_ACTIVE_IND_NCCI(x) ((x)->adr.adrNCCI) + /* Network Control Connection Identifier */ +#define CONNECT_B3_T90_ACTIVE_IND_NCPI(x) ((x)->NCPI) + /* Network Control Protocol Information */ +#define CONNECT_B3_T90_ACTIVE_RESP_NCCI(x) ((x)->adr.adrNCCI) + /* Network Control Connection Identifier */ +#define DATA_B3_REQ_NCCI(x) ((x)->adr.adrNCCI) + /* Network Control Connection Identifier */ +#define DATA_B3_REQ_DATA(x) ((x)->Data) + /* Pointer to the data to be sent */ +#define DATA_B3_REQ_DATALENGTH(x) ((x)->DataLength) + /* Size of data area to be sent */ +#define DATA_B3_REQ_DATAHANDLE(x) ((x)->DataHandle) + /* Referenced in DATA_B3_CONF */ +#define DATA_B3_REQ_FLAGS(x) ((x)->Flags) + /* [0]: qualifier bit */ + /* [1]: more data bit */ + /* [2]: delivery confirmation bit */ + /* [3]: expedited data */ + /* [4] to [15]: reserved */ +#define DATA_B3_CONF_NCCI(x) ((x)->adr.adrNCCI) + /* Network Control Connection Identifier */ +#define DATA_B3_CONF_DATAHANDLE(x) ((x)->DataHandle) + /* Identifies the data area of corresponding DATA_B3_REQ */ +#define DATA_B3_CONF_INFO(x) ((x)->Info) + /* 0: data transmission initiated */ + /* 0x0002: flags not supported by current protocol, flags ignored */ + /* 0x2001: message not supported in current state */ + /* 0x2002: illegal NCCI */ + /* 0x2007: illegal message parameter coding */ + /* 0x300A: flags not supported (reserved bits) */ + /* 0x300C: data length not supported by current protocol */ +#define DATA_B3_IND_NCCI(x) ((x)->adr.adrNCCI) + /* Network Control Connection Identifier */ +#define DATA_B3_IND_DATA(x) ((x)->Data) + /* Pointer to data received */ +#define DATA_B3_IND_DATALENGTH(x) ((x)->DataLength) + /* Size of data area received */ +#define DATA_B3_IND_DATAHANDLE(x) ((x)->DataHandle) + /* handle to data area, referenced in DATA_B3_RESP */ +#define DATA_B3_IND_FLAGS(x) ((x)->Flags) + /* 0: qualifier bit */ + /* 1: more-data bit */ + /* 2: delivery confirmation bit */ + /* 3: expedited data */ + /* 4 to 14: reserved */ + /* [15]: framing error bit, data may be invalid (only with corresponding B2 protocol) */ +#define DATA_B3_RESP_NCCI(x) ((x)->adr.adrNCCI) + /* Network Control Connection Identifier */ +#define DATA_B3_RESP_DATAHANDLE(x) ((x)->DataHandle) + /* Data area reference in corresponding DATA_B3_IND */ +#define DISCONNECT_B3_REQ_NCCI(x) ((x)->adr.adrNCCI) + /* Network Control Connection Identifier */ +#define DISCONNECT_B3_REQ_NCPI(x) ((x)->NCPI) + /* Network Control Protocol Information */ +#define DISCONNECT_B3_CONF_NCCI(x) ((x)->adr.adrNCCI) + /* Network Control Connection Identifier */ +#define DISCONNECT_B3_CONF_INFO(x) ((x)->Info) + /* 0: disconnect initiated */ + /* 0x0001: NCPI not supported by current protocol, NCPI ignored */ + /* 0x2001: message not supported in current state */ + /* 0x2002: illegal NCCI */ + /* 0x2007: illegal message parameter coding */ + /* 0x3008: NCPI not supported */ +#define DISCONNECT_B3_IND_NCCI(x) ((x)->adr.adrNCCI) + /* Network Control Connection Identifier */ +#define DISCONNECT_B3_IND_REASON_B3(x) ((x)->Reason_B3) + /* 0: clearing according to protocol */ + /* 0x3301: protocol error layer 1 */ + /* 0x3302: protocol error layer 2 */ + /* 0x3303: protocol error layer 3 */ + /* protocol dependent values are described in chapter 6 */ +#define DISCONNECT_B3_IND_NCPI(x) ((x)->NCPI) + /* Network Control Protocol Information */ +#define DISCONNECT_B3_RESP_NCCI(x) ((x)->adr.adrNCCI) + /* Network Control Connection Identifier */ +#define DISCONNECT_REQ_PLCI(x) ((x)->adr.adrPLCI) + /* Physical Link Connection Identifier */ +#define DISCONNECT_REQ_ADDITIONALINFO(x) ((x)->AdditionalInfo) + /* Additional information elements */ +#define DISCONNECT_REQ_BCHANNELINFORMATION(x) ((x)->BChannelinformation) +#define DISCONNECT_REQ_KEYPADFACILITY(x) ((x)->Keypadfacility) + /* coded according to ETS 300 102-1 / Q.931 */ +#define DISCONNECT_REQ_USERUSERDATA(x) ((x)->Useruserdata) + /* coded according to ETS 300 102-1 / Q.931 */ +#define DISCONNECT_REQ_FACILITYDATAARRAY(x) ((x)->Facilitydataarray) + /* which is used to transfer additional parameters coded */ + /* according to ETS 300 102-1 / Q.931 starting from octet 1. */ + /* This field is used to transport one or more complete facility */ + /* data information elements. */ +#define DISCONNECT_CONF_PLCI(x) ((x)->adr.adrPLCI) + /* Physical Link Connection Identifier */ +#define DISCONNECT_CONF_INFO(x) ((x)->Info) + /* 0: disconnect initiated */ + /* 0x2001: message not supported in current state */ + /* 0x2002: illegal PLCI */ + /* 0x2007: illegal message parameter coding */ +#define DISCONNECT_IND_PLCI(x) ((x)->adr.adrPLCI) + /* Physical Link Connection Identifier */ +#define DISCONNECT_IND_REASON(x) ((x)->Reason) + /* 0: no cause available */ + /* 0x3301: protocol error layer 1 */ + /* 0x3302: protocol error layer 2 */ + /* 0x3303: protocol error layer 3 */ + /* 0x3304: another application got that call */ + /* 0x34xx: disconnect cause from the network according to Q.931/ETS 300 102-1. In the field 'xx' the cause value received within a cause information element (octet 4) from the network is indicated. */ +#define DISCONNECT_RESP_PLCI(x) ((x)->adr.adrPLCI) + /* Physical Link Connection Identifier */ +#define FACILITY_REQ_CONTROLLER(x) ((x)->adr.adrController) +#define FACILITY_REQ_PLCI(x) ((x)->adr.adrPLCI) +#define FACILITY_REQ_NCCI(x) ((x)->adr.adrNCCI) + /* Depending on the facility selector */ +#define FACILITY_REQ_FACILITYSELECTOR(x) ((x)->FacilitySelector) + /* 0: Handset Support */ + /* 1: DTMF */ + /* 2 to n: reserved */ +#define FACILITY_REQ_FACILITYREQUESTPARAMETER(x) ((x)->FacilityRequestParameter) + /* Facility depending parameters */ +#define FACILITY_CONF_CONTROLLER(x) ((x)->adr.adrController) +#define FACILITY_CONF_PLCI(x) ((x)->adr.adrPLCI) +#define FACILITY_CONF_NCCI(x) ((x)->adr.adrNCCI) + /* Depending on the facility selector */ +#define FACILITY_CONF_INFO(x) ((x)->Info) + /* 0: request accepted */ + /* 0x2001: message not supported in current state */ + /* 0x2002: incorrect Controller/PLCI/NCCI */ + /* 0x2007: illegal message parameter coding */ + /* 0x300B: facility not supported */ +#define FACILITY_CONF_FACILITYSELECTOR(x) ((x)->FacilitySelector) + /* 0: Handset Support */ + /* 1: DTMF */ + /* 2 to n: reserved */ +#define FACILITY_CONF_FACILITYCONFIRMATIONPARAMETER(x) ((x)->FacilityConfirmationParameter) + /* Facility-depending parameters */ +#define FACILITY_IND_CONTROLLER(x) ((x)->adr.adrController) +#define FACILITY_IND_PLCI(x) ((x)->adr.adrPLCI) +#define FACILITY_IND_NCCI(x) ((x)->adr.adrNCCI) + /* Depending on the facility selector */ +#define FACILITY_IND_FACILITYSELECTOR(x) ((x)->FacilitySelector) + /* 0: Handset Support */ + /* 1: DTMF */ + /* 2 to n: reserved */ +#define FACILITY_IND_FACILITYINDICATIONPARAMETER(x) ((x)->FacilityIndicationParameter) + /* Facility-depending parameters */ +#define FACILITY_RESP_CONTROLLER(x) ((x)->adr.adrController) +#define FACILITY_RESP_PLCI(x) ((x)->adr.adrPLCI) +#define FACILITY_RESP_NCCI(x) ((x)->adr.adrNCCI) + /* Depending on the facility selector */ +#define FACILITY_RESP_FACILITYSELECTOR(x) ((x)->FacilitySelector) + /* 0: Handset Support */ + /* 1: DTMF */ + /* 2 to n: reserved */ + /* Facility response parameters */ + /* struct */ + /* Facility-depending parameters */ +#define INFO_REQ_CONTROLLER(x) ((x)->adr.adrController) +#define INFO_REQ_PLCI(x) ((x)->adr.adrPLCI) + /* See note */ +#define INFO_REQ_CALLEDPARTYNUMBER(x) ((x)->CalledPartyNumber) + /* Called party number */ +#define INFO_REQ_ADDITIONALINFO(x) ((x)->AdditionalInfo) + /* Additional information elements */ +#define INFO_REQ_BCHANNELINFORMATION(x) ((x)->BChannelinformation) +#define INFO_REQ_KEYPADFACILITY(x) ((x)->Keypadfacility) + /* coded according to ETS 300 102-1 / Q.931 */ +#define INFO_REQ_USERUSERDATA(x) ((x)->Useruserdata) + /* coded according to ETS 300 102-1 / Q.931 */ +#define INFO_REQ_FACILITYDATAARRAY(x) ((x)->Facilitydataarray) + /* which is used to transfer additional parameters coded */ + /* according to ETS 300 102-1 / Q.931 starting from octet 1. */ + /* This field is used to transport one or more complete facility */ + /* data information elements. */ +#define INFO_CONF_PLCI(x) ((x)->adr.adrPLCI) + /* Physical Link Connection Identifier */ +#define INFO_CONF_INFO(x) ((x)->Info) + /* 0: transmission of information initiated */ + /* 0x2001: message not supported in current state */ + /* 0x2002: illegal Controller/PLCI */ + /* 0x2003: out of PLCI */ + /* 0x2007: illegal message parameter coding */ +#define INFO_IND_CONTROLLER(x) ((x)->adr.adrController) +#define INFO_IND_PLCI(x) ((x)->adr.adrPLCI) + /* Physical Link Connection Identifier */ +#define INFO_IND_INFONUMBER(x) ((x)->InfoNumber) + /* Information element identifier */ +#define INFO_IND_INFOELEMENT(x) ((x)->InfoElement) + /* Information element dependent structure */ +#define INFO_RESP_CONTROLLER(x) ((x)->adr.adrController) +#define INFO_RESP_PLCI(x) ((x)->adr.adrPLCI) + /* As in INFO_IND */ +#define LISTEN_REQ_CONTROLLER(x) ((x)->adr.adrController) +#define LISTEN_REQ_INFOMASK(x) ((x)->InfoMask) + /* Bit field, coding as follows: */ + /* 0: cause */ + /* 1: date/Time */ + /* 2: display */ + /* 3: user-user information */ + /* 4: call progression */ + /* 5: facility */ + /* 6: charging */ + /* 7 to 31: reserved */ +#define LISTEN_REQ_CIPMASK(x) ((x)->CIPmask) + /* Bit field, coding as follows: */ + /* 0: any match */ + /* 1: speech */ + /* 2: unrestricted digital information */ + /* 3: restricted digital information */ + /* 4: 3.1 kHz audio */ + /* 5: 7.0 kHz audio */ + /* 6: video */ + /* 7: packet mode */ + /* 8: 56 kBit/s rate adaptation */ + /* 9: unrestricted digital information with tones/announcements */ + /* 10..15: reserved */ + /* 16: telephony */ + /* 17: fax group 2/3 */ + /* 18: fax group 4 class 1 */ + /* 19: Teletex service (basic and mixed), fax group 4 class 2 */ + /* 20: Teletex service (basic and processable) */ + /* 21: Teletex service (basic) */ + /* 22: Videotex */ + /* 23: Telex */ + /* reserved for additional services */ + /* 25: OSI applications according X.200 */ + /* 26: 7 kHz Telephony */ + /* 27: Video Telephony F.721, first connection */ + /* 28: Video Telephony F.721, second connection */ + /* 29 to 31: reserved */ +#define LISTEN_REQ_CIPMASK2(x) ((x)->CIPmask2) + /* reserved for additional services */ +#define LISTEN_REQ_CALLINGPARTYNUMBER(x) ((x)->CallingPartyNumber) + /* Calling party number */ +#define LISTEN_REQ_CALLINGPARTYSUBADDRESS(x) ((x)->CallingPartySubaddress) + /* Calling party subaddress */ +#define LISTEN_CONF_CONTROLLER(x) ((x)->adr.adrController) +#define LISTEN_CONF_INFO(x) ((x)->Info) + /* 0: listen is active */ + /* 0x2002: illegal controller */ + /* 0x2005: out of LISTEN-Resources */ + /* 0x2007: illegal message parameter coding */ +#define MANUFACTURER_REQ_CONTROLLER(x) ((x)->adr.adrController) +#define MANUFACTURER_REQ_MANUID(x) ((x)->ManuID) + /* Manufacturer specific ID (should be unique) */ + /* Manufacturer specific */ +#define MANUFACTURER_REQ_CLASS(x) ((x)->Class) +#define MANUFACTURER_REQ_FUNCTION(x) ((x)->Function) +#define MANUFACTURER_REQ_MANUDATA(x) ((x)->ManuData) + /* Manufacturer specific data */ +#define MANUFACTURER_CONF_CONTROLLER(x) ((x)->adr.adrController) +#define MANUFACTURER_CONF_MANUID(x) ((x)->ManuID) + /* Manufacturer specific ID (should be unique) */ + /* Manufacturer specific */ +#define MANUFACTURER_CONF_CLASS(x) ((x)->Class) +#define MANUFACTURER_CONF_FUNCTION(x) ((x)->Function) +#define MANUFACTURER_CONF_MANUDATA(x) ((x)->ManuData) + /* Manufacturer specific data */ +#define MANUFACTURER_IND_CONTROLLER(x) ((x)->adr.adrController) +#define MANUFACTURER_IND_MANUID(x) ((x)->ManuID) + /* Manufacturer specific ID (should be unique) */ + /* Manufacturer specific */ +#define MANUFACTURER_IND_CLASS(x) ((x)->Class) +#define MANUFACTURER_IND_FUNCTION(x) ((x)->Function) +#define MANUFACTURER_IND_MANUDATA(x) ((x)->ManuData) + /* Manufacturer specific data */ +#define MANUFACTURER_RESP_CONTROLLER(x) ((x)->adr.adrController) +#define MANUFACTURER_RESP_MANUID(x) ((x)->ManuID) + /* Manufacturer specific ID (should be unique) */ + /* Manufacturer specific */ +#define MANUFACTURER_RESP_CLASS(x) ((x)->Class) +#define MANUFACTURER_RESP_FUNCTION(x) ((x)->Function) +#define MANUFACTURER_RESP_MANUDATA(x) ((x)->ManuData) + /* Manufacturer specific data */ +#define RESET_B3_REQ_NCCI(x) ((x)->adr.adrNCCI) + /* Network Control Connection Identifier */ +#define RESET_B3_REQ_NCPI(x) ((x)->NCPI) + /* Network Control Protocol Information */ +#define RESET_B3_CONF_NCCI(x) ((x)->adr.adrNCCI) + /* Network Control Connection Identifier */ +#define RESET_B3_CONF_INFO(x) ((x)->Info) + /* 0: reset initiated */ + /* 0x0001: NCPI not supported by current protocol, NCPI ignored */ + /* 0x2001: message not supported in current state */ + /* 0x2002: illegal NCCI */ + /* 0x2007: illegal message parameter coding */ + /* 0x3008: NCPI not supported */ + /* 0x300D: reset procedure not supported by current protocol */ +#define RESET_B3_IND_NCCI(x) ((x)->adr.adrNCCI) + /* Network Control Connection Identifier */ +#define RESET_B3_IND_NCPI(x) ((x)->NCPI) + /* Network Control Protocol Information */ +#define RESET_B3_RESP_NCCI(x) ((x)->adr.adrNCCI) + /* Network Control Connection Identifier */ +#define SELECT_B_PROTOCOL_REQ_PLCI(x) ((x)->adr.adrPLCI) + /* Physical Link Connection Identifier */ +#define SELECT_B_PROTOCOL_REQ_BPROTOCOL(x) ((x)->BProtocol) + /* Protocol definition */ +#define SELECT_B_PROTOCOL_REQ_B1PROTOCOL(x) ((x)->B1protocol) + /* Physical layer and framing */ +#define SELECT_B_PROTOCOL_REQ_B2PROTOCOL(x) ((x)->B2protocol) + /* Data link layer */ +#define SELECT_B_PROTOCOL_REQ_B3PROTOCOL(x) ((x)->B3protocol) + /* Network layer */ +#define SELECT_B_PROTOCOL_REQ_B1CONFIGURATION(x) ((x)->B1configuration) + /* Physical layer and framing parameter */ +#define SELECT_B_PROTOCOL_REQ_B2CONFIGURATION(x) ((x)->B2configuration) + /* Data link layer parameter */ +#define SELECT_B_PROTOCOL_REQ_B3CONFIGURATION(x) ((x)->B3configuration) + /* Network layer parameter */ +#define SELECT_B_PROTOCOL_CONF_PLCI(x) ((x)->adr.adrPLCI) + /* Physical Link Connection Identifier */ +#define SELECT_B_PROTOCOL_CONF_INFO(x) ((x)->Info) + /* 0: protocol switch successful */ + /* 0x2001: message not supported in current state */ + /* 0x2002: illegal PLCI */ + /* 0x2007: illegal message parameter coding */ + /* 0x3001: B1 protocol not supported */ + /* 0x3002: B2 protocol not supported */ + /* 0x3003: B3 protocol not supported */ + /* 0x3004: B1 protocol parameter not supported */ + /* 0x3005: B2 protocol parameter not supported */ + /* 0x3006: B3 protocol parameter not supported */ + /* 0x3007: B protocol combination not supported */ + +/*----- tests for specific commands -----*/ + +#define IS_CONNECT_IND(m) ((m)->Command==0x02 && (m)->Subcommand==0x82) +#define IS_CONNECT_ACTIVE_IND(m) ((m)->Command==0x03 && (m)->Subcommand==0x82) +#define IS_CONNECT_B3_ACTIVE_IND(m) ((m)->Command==0x83 && (m)->Subcommand==0x82) +#define IS_CONNECT_B3_IND(m) ((m)->Command==0x82 && (m)->Subcommand==0x82) +#define IS_CONNECT_B3_T90_ACTIVE_IND(m) ((m)->Command==0x88 && (m)->Subcommand==0x82) +#define IS_DATA_B3_IND(m) ((m)->Command==0x86 && (m)->Subcommand==0x82) +#define IS_DISCONNECT_B3_IND(m) ((m)->Command==0x84 && (m)->Subcommand==0x82) +#define IS_DISCONNECT_IND(m) ((m)->Command==0x04 && (m)->Subcommand==0x82) +#define IS_FACILITY_IND(m) ((m)->Command==0x80 && (m)->Subcommand==0x82) +#define IS_INFO_IND(m) ((m)->Command==0x08 && (m)->Subcommand==0x82) +#define IS_MANUFACTURER_IND(m) ((m)->Command==0xff && (m)->Subcommand==0x82) +#define IS_RESET_B3_IND(m) ((m)->Command==0x87 && (m)->Subcommand==0x82) +#define IS_ALERT_CONF(m) ((m)->Command==0x01 && (m)->Subcommand==0x81) +#define IS_CONNECT_CONF(m) ((m)->Command==0x02 && (m)->Subcommand==0x81) +#define IS_CONNECT_B3_CONF(m) ((m)->Command==0x82 && (m)->Subcommand==0x81) +#define IS_DATA_B3_CONF(m) ((m)->Command==0x86 && (m)->Subcommand==0x81) +#define IS_DISCONNECT_B3_CONF(m) ((m)->Command==0x84 && (m)->Subcommand==0x81) +#define IS_DISCONNECT_CONF(m) ((m)->Command==0x04 && (m)->Subcommand==0x81) +#define IS_FACILITY_CONF(m) ((m)->Command==0x80 && (m)->Subcommand==0x81) +#define IS_INFO_CONF(m) ((m)->Command==0x08 && (m)->Subcommand==0x81) +#define IS_LISTEN_CONF(m) ((m)->Command==0x05 && (m)->Subcommand==0x81) +#define IS_MANUFACTURER_CONF(m) ((m)->Command==0xff && (m)->Subcommand==0x81) +#define IS_RESET_B3_CONF(m) ((m)->Command==0x87 && (m)->Subcommand==0x81) +#define IS_SELECT_B_PROTOCOL_CONF(m) ((m)->Command==0x41 && (m)->Subcommand==0x81) + +/*----- header functions that fill the _cmsg structure with default -----*/ +/*----- values. Only nonstandard parameter need to be changed -----*/ + +#define ALERT_REQ_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x01,0x80,Messagenumber,adr) +#define CONNECT_REQ_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x02,0x80,Messagenumber,adr) +#define CONNECT_B3_REQ_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x82,0x80,Messagenumber,adr) +#define DATA_B3_REQ_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x86,0x80,Messagenumber,adr) +#define DISCONNECT_B3_REQ_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x84,0x80,Messagenumber,adr) +#define DISCONNECT_REQ_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x04,0x80,Messagenumber,adr) +#define FACILITY_REQ_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x80,0x80,Messagenumber,adr) +#define INFO_REQ_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x08,0x80,Messagenumber,adr) +#define LISTEN_REQ_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x05,0x80,Messagenumber,adr) +#define MANUFACTURER_REQ_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0xff,0x80,Messagenumber,adr) +#define RESET_B3_REQ_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x87,0x80,Messagenumber,adr) +#define SELECT_B_PROTOCOL_REQ_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x41,0x80,Messagenumber,adr) +#define CONNECT_RESP_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x02,0x83,Messagenumber,adr) +#define CONNECT_ACTIVE_RESP_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x03,0x83,Messagenumber,adr) +#define CONNECT_B3_ACTIVE_RESP_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x83,0x83,Messagenumber,adr) +#define CONNECT_B3_RESP_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x82,0x83,Messagenumber,adr) +#define CONNECT_B3_T90_ACTIVE_RESP_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x88,0x83,Messagenumber,adr) +#define DATA_B3_RESP_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x86,0x83,Messagenumber,adr) +#define DISCONNECT_B3_RESP_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x84,0x83,Messagenumber,adr) +#define DISCONNECT_RESP_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x04,0x83,Messagenumber,adr) +#define FACILITY_RESP_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x80,0x83,Messagenumber,adr) +#define INFO_RESP_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x08,0x83,Messagenumber,adr) +#define MANUFACTURER_RESP_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0xff,0x83,Messagenumber,adr) +#define RESET_B3_RESP_HEADER(cmsg,ApplId,Messagenumber,adr) \ + CAPI_CMSG_HEADER(cmsg,ApplId,0x87,0x83,Messagenumber,adr) + +/* + * CAPI-functions that correspond to the CAPI messages specified in the + * CAPI 2.0 specification. All possible parameter have to be specified. + * The CAPI message is sent immediately when calling these functions, + * return values are the same as in capi_put_message() + */ + +unsigned ALERT_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr + ,_cstruct BChannelinformation + ,_cstruct Keypadfacility + ,_cstruct Useruserdata + ,_cstruct Facilitydataarray); +unsigned CONNECT_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr + ,_cword CIPValue + ,_cstruct CalledPartyNumber + ,_cstruct CallingPartyNumber + ,_cstruct CalledPartySubaddress + ,_cstruct CallingPartySubaddress + ,_cword B1protocol + ,_cword B2protocol + ,_cword B3protocol + ,_cstruct B1configuration + ,_cstruct B2configuration + ,_cstruct B3configuration + ,_cstruct BC + ,_cstruct LLC + ,_cstruct HLC + ,_cstruct BChannelinformation + ,_cstruct Keypadfacility + ,_cstruct Useruserdata + ,_cstruct Facilitydataarray); +unsigned CONNECT_B3_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr + ,_cstruct NCPI); +unsigned DATA_B3_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr + ,_cdword Data + ,_cword DataLength + ,_cword DataHandle + ,_cword Flags); +unsigned DISCONNECT_B3_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr + ,_cstruct NCPI); +unsigned DISCONNECT_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr + ,_cstruct BChannelinformation + ,_cstruct Keypadfacility + ,_cstruct Useruserdata + ,_cstruct Facilitydataarray); +unsigned FACILITY_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr + ,_cword FacilitySelector + ,_cstruct FacilityRequestParameter); +unsigned INFO_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr + ,_cstruct CalledPartyNumber + ,_cstruct BChannelinformation + ,_cstruct Keypadfacility + ,_cstruct Useruserdata + ,_cstruct Facilitydataarray); +unsigned LISTEN_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr + ,_cdword InfoMask + ,_cdword CIPmask + ,_cdword CIPmask2 + ,_cstruct CallingPartyNumber + ,_cstruct CallingPartySubaddress); +unsigned MANUFACTURER_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr + ,_cdword ManuID + ,_cdword Class + ,_cdword Function + ,_cstruct ManuData); +unsigned RESET_B3_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr + ,_cstruct NCPI); +unsigned SELECT_B_PROTOCOL_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr + ,_cword B1protocol + ,_cword B2protocol + ,_cword B3protocol + ,_cstruct B1configuration + ,_cstruct B2configuration + ,_cstruct B3configuration); +unsigned CONNECT_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr + ,_cword Reject + ,_cword B1protocol + ,_cword B2protocol + ,_cword B3protocol + ,_cstruct B1configuration + ,_cstruct B2configuration + ,_cstruct B3configuration + ,_cstruct ConnectedNumber + ,_cstruct ConnectedSubaddress + ,_cstruct LLC + ,_cstruct BChannelinformation + ,_cstruct Keypadfacility + ,_cstruct Useruserdata + ,_cstruct Facilitydataarray); +unsigned CONNECT_ACTIVE_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr); +unsigned CONNECT_B3_ACTIVE_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr); +unsigned CONNECT_B3_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr + ,_cword Reject + ,_cstruct NCPI); +unsigned CONNECT_B3_T90_ACTIVE_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr); +unsigned DATA_B3_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr + ,_cword DataHandle); +unsigned DISCONNECT_B3_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr); +unsigned DISCONNECT_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr); +unsigned FACILITY_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr + ,_cword FacilitySelector + ,_cstruct FacilityResponseParameters); +unsigned INFO_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr); +unsigned MANUFACTURER_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr + ,_cdword ManuID + ,_cdword Class + ,_cdword Function + ,_cstruct ManuData); +unsigned RESET_B3_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber + ,_cdword adr); + + +#ifdef __cplusplus +} +#endif + +#endif /* __CAPI20_H */ diff --git a/capi20/capifunc.c b/capi20/capifunc.c new file mode 100644 index 00000000..82ba7387 --- /dev/null +++ b/capi20/capifunc.c @@ -0,0 +1,313 @@ +/* + * $Id: capifunc.c,v 1.3 1998/08/30 09:57:17 calle Exp $ + * + * $Log: capifunc.c,v $ + * Revision 1.3 1998/08/30 09:57:17 calle + * I hope it is know readable for everybody. + * + * Revision 1.1 1998/08/25 16:33:19 calle + * Added CAPI2.0 library. First Version. + * + */ + +#include "capi20.h" + +unsigned ALERT_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr, + _cstruct BChannelinformation, + _cstruct Keypadfacility, + _cstruct Useruserdata, + _cstruct Facilitydataarray) { + capi_cmsg_header (cmsg,ApplId,0x01,0x80,Messagenumber,adr); + cmsg->BChannelinformation = BChannelinformation; + cmsg->Keypadfacility = Keypadfacility; + cmsg->Useruserdata = Useruserdata; + cmsg->Facilitydataarray = Facilitydataarray; + return capi_put_cmsg (cmsg); +} + +unsigned CONNECT_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr, + _cword CIPValue, + _cstruct CalledPartyNumber, + _cstruct CallingPartyNumber, + _cstruct CalledPartySubaddress, + _cstruct CallingPartySubaddress, + _cword B1protocol, + _cword B2protocol, + _cword B3protocol, + _cstruct B1configuration, + _cstruct B2configuration, + _cstruct B3configuration, + _cstruct BC, + _cstruct LLC, + _cstruct HLC, + _cstruct BChannelinformation, + _cstruct Keypadfacility, + _cstruct Useruserdata, + _cstruct Facilitydataarray) { + capi_cmsg_header (cmsg,ApplId,0x02,0x80,Messagenumber,adr); + cmsg->CIPValue = CIPValue; + cmsg->CalledPartyNumber = CalledPartyNumber; + cmsg->CallingPartyNumber = CallingPartyNumber; + cmsg->CalledPartySubaddress = CalledPartySubaddress; + cmsg->CallingPartySubaddress = CallingPartySubaddress; + cmsg->B1protocol = B1protocol; + cmsg->B2protocol = B2protocol; + cmsg->B3protocol = B3protocol; + cmsg->B1configuration = B1configuration; + cmsg->B2configuration = B2configuration; + cmsg->B3configuration = B3configuration; + cmsg->BC = BC; + cmsg->LLC = LLC; + cmsg->HLC = HLC; + cmsg->BChannelinformation = BChannelinformation; + cmsg->Keypadfacility = Keypadfacility; + cmsg->Useruserdata = Useruserdata; + cmsg->Facilitydataarray = Facilitydataarray; + return capi_put_cmsg (cmsg); +} + +unsigned CONNECT_B3_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr, + _cstruct NCPI) { + capi_cmsg_header (cmsg,ApplId,0x82,0x80,Messagenumber,adr); + cmsg->NCPI = NCPI; + return capi_put_cmsg (cmsg); +} + +unsigned DATA_B3_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr, + _cdword Data, + _cword DataLength, + _cword DataHandle, + _cword Flags) { + capi_cmsg_header (cmsg,ApplId,0x86,0x80,Messagenumber,adr); + cmsg->Data = Data; + cmsg->DataLength = DataLength; + cmsg->DataHandle = DataHandle; + cmsg->Flags = Flags; + return capi_put_cmsg (cmsg); +} + +unsigned DISCONNECT_B3_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr, + _cstruct NCPI) { + capi_cmsg_header (cmsg,ApplId,0x84,0x80,Messagenumber,adr); + cmsg->NCPI = NCPI; + return capi_put_cmsg (cmsg); +} + +unsigned DISCONNECT_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr, + _cstruct BChannelinformation, + _cstruct Keypadfacility, + _cstruct Useruserdata, + _cstruct Facilitydataarray) { + capi_cmsg_header (cmsg,ApplId,0x04,0x80,Messagenumber,adr); + cmsg->BChannelinformation = BChannelinformation; + cmsg->Keypadfacility = Keypadfacility; + cmsg->Useruserdata = Useruserdata; + cmsg->Facilitydataarray = Facilitydataarray; + return capi_put_cmsg (cmsg); +} + +unsigned FACILITY_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr, + _cword FacilitySelector, + _cstruct FacilityRequestParameter) { + capi_cmsg_header (cmsg,ApplId,0x80,0x80,Messagenumber,adr); + cmsg->FacilitySelector = FacilitySelector; + cmsg->FacilityRequestParameter = FacilityRequestParameter; + return capi_put_cmsg (cmsg); +} + +unsigned INFO_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr, + _cstruct CalledPartyNumber, + _cstruct BChannelinformation, + _cstruct Keypadfacility, + _cstruct Useruserdata, + _cstruct Facilitydataarray) { + capi_cmsg_header (cmsg,ApplId,0x08,0x80,Messagenumber,adr); + cmsg->CalledPartyNumber = CalledPartyNumber; + cmsg->BChannelinformation = BChannelinformation; + cmsg->Keypadfacility = Keypadfacility; + cmsg->Useruserdata = Useruserdata; + cmsg->Facilitydataarray = Facilitydataarray; + return capi_put_cmsg (cmsg); +} + +unsigned LISTEN_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr, + _cdword InfoMask, + _cdword CIPmask, + _cdword CIPmask2, + _cstruct CallingPartyNumber, + _cstruct CallingPartySubaddress) { + capi_cmsg_header (cmsg,ApplId,0x05,0x80,Messagenumber,adr); + cmsg->InfoMask = InfoMask; + cmsg->CIPmask = CIPmask; + cmsg->CIPmask2 = CIPmask2; + cmsg->CallingPartyNumber = CallingPartyNumber; + cmsg->CallingPartySubaddress = CallingPartySubaddress; + return capi_put_cmsg (cmsg); +} + +unsigned MANUFACTURER_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr, + _cdword ManuID, + _cdword Class, + _cdword Function, + _cstruct ManuData) { + capi_cmsg_header (cmsg,ApplId,0xff,0x80,Messagenumber,adr); + cmsg->ManuID = ManuID; + cmsg->Class = Class; + cmsg->Function = Function; + cmsg->ManuData = ManuData; + return capi_put_cmsg (cmsg); +} + +unsigned RESET_B3_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr, + _cstruct NCPI) { + capi_cmsg_header (cmsg,ApplId,0x87,0x80,Messagenumber,adr); + cmsg->NCPI = NCPI; + return capi_put_cmsg (cmsg); +} + +unsigned SELECT_B_PROTOCOL_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr, + _cword B1protocol, + _cword B2protocol, + _cword B3protocol, + _cstruct B1configuration, + _cstruct B2configuration, + _cstruct B3configuration) { + capi_cmsg_header (cmsg,ApplId,0x41,0x80,Messagenumber,adr); + cmsg->B1protocol = B1protocol; + cmsg->B2protocol = B2protocol; + cmsg->B3protocol = B3protocol; + cmsg->B1configuration = B1configuration; + cmsg->B2configuration = B2configuration; + cmsg->B3configuration = B3configuration; + return capi_put_cmsg (cmsg); +} + +unsigned CONNECT_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr, + _cword Reject, + _cword B1protocol, + _cword B2protocol, + _cword B3protocol, + _cstruct B1configuration, + _cstruct B2configuration, + _cstruct B3configuration, + _cstruct ConnectedNumber, + _cstruct ConnectedSubaddress, + _cstruct LLC, + _cstruct BChannelinformation, + _cstruct Keypadfacility, + _cstruct Useruserdata, + _cstruct Facilitydataarray) { + capi_cmsg_header (cmsg,ApplId,0x02,0x83,Messagenumber,adr); + cmsg->Reject = Reject; + cmsg->B1protocol = B1protocol; + cmsg->B2protocol = B2protocol; + cmsg->B3protocol = B3protocol; + cmsg->B1configuration = B1configuration; + cmsg->B2configuration = B2configuration; + cmsg->B3configuration = B3configuration; + cmsg->ConnectedNumber = ConnectedNumber; + cmsg->ConnectedSubaddress = ConnectedSubaddress; + cmsg->LLC = LLC; + cmsg->BChannelinformation = BChannelinformation; + cmsg->Keypadfacility = Keypadfacility; + cmsg->Useruserdata = Useruserdata; + cmsg->Facilitydataarray = Facilitydataarray; + return capi_put_cmsg (cmsg); +} + +unsigned CONNECT_ACTIVE_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr) { + capi_cmsg_header (cmsg,ApplId,0x03,0x83,Messagenumber,adr); + return capi_put_cmsg (cmsg); +} + +unsigned CONNECT_B3_ACTIVE_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr) { + capi_cmsg_header (cmsg,ApplId,0x83,0x83,Messagenumber,adr); + return capi_put_cmsg (cmsg); +} + +unsigned CONNECT_B3_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr, + _cword Reject, + _cstruct NCPI) { + capi_cmsg_header (cmsg,ApplId,0x82,0x83,Messagenumber,adr); + cmsg->Reject = Reject; + cmsg->NCPI = NCPI; + return capi_put_cmsg (cmsg); +} + +unsigned CONNECT_B3_T90_ACTIVE_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr) { + capi_cmsg_header (cmsg,ApplId,0x88,0x83,Messagenumber,adr); + return capi_put_cmsg (cmsg); +} + +unsigned DATA_B3_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr, + _cword DataHandle) { + capi_cmsg_header (cmsg,ApplId,0x86,0x83,Messagenumber,adr); + cmsg->DataHandle = DataHandle; + return capi_put_cmsg (cmsg); +} + +unsigned DISCONNECT_B3_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr) { + capi_cmsg_header (cmsg,ApplId,0x84,0x83,Messagenumber,adr); + return capi_put_cmsg (cmsg); +} + +unsigned DISCONNECT_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr) { + capi_cmsg_header (cmsg,ApplId,0x04,0x83,Messagenumber,adr); + return capi_put_cmsg (cmsg); +} + +unsigned FACILITY_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr, + _cword FacilitySelector, + _cstruct FacilityResponseParameters) { + capi_cmsg_header (cmsg,ApplId,0x80,0x83,Messagenumber,adr); + cmsg->FacilitySelector = FacilitySelector; + cmsg->FacilityResponseParameters = FacilityResponseParameters; + return capi_put_cmsg (cmsg); +} + +unsigned INFO_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr) { + capi_cmsg_header (cmsg,ApplId,0x08,0x83,Messagenumber,adr); + return capi_put_cmsg (cmsg); +} + +unsigned MANUFACTURER_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr, + _cdword ManuID, + _cdword Class, + _cdword Function, + _cstruct ManuData) { + capi_cmsg_header (cmsg,ApplId,0xff,0x83,Messagenumber,adr); + cmsg->ManuID = ManuID; + cmsg->Class = Class; + cmsg->Function = Function; + cmsg->ManuData = ManuData; + return capi_put_cmsg (cmsg); +} + +unsigned RESET_B3_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, + _cdword adr) { + capi_cmsg_header (cmsg,ApplId,0x87,0x83,Messagenumber,adr); + return capi_put_cmsg (cmsg); +} diff --git a/capi20/configure b/capi20/configure new file mode 100755 index 00000000..a0eaab09 --- /dev/null +++ b/capi20/configure @@ -0,0 +1,1500 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_default_prefix=/usr +ac_help="$ac_help + --with-kernel=DIR Set kernel source directory [/usr/src/linux]" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=capi20.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:530: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:559: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:607: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:641: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:646: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:670: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:727: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + for ac_prog in ginstall installbsd scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +I4LCONFDIR=${I4LCONFDIR:-"/etc/isdn"} +I4LVERSION=${I4LVERSION:-"?.?"} +CONFIG_DATADIR=${CONFIG_DATADIR:-"/usr/lib/isdn"} +CONFIG_MANDIR=`eval echo ${CONFIG_MANDIR:-"/usr/man"}` +CONFIG_SBINDIR=`eval echo ${CONFIG_SBINDIR:-"/sbin"}` +CONFIG_KERNELDIR=`eval echo ${CONFIG_KERNELDIR:-"/usr/src/linux"}` + + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:786: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:807: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:824: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:847: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:860: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : +else + cat > conftest.$ac_ext < +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +for ac_hdr in fcntl.h sys/ioctl.h unistd.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:954: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:964: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + + OLD_CPPFLAGS="$CPPFLAGS" + lxdir="no" + eval tst_kerneldir=$CONFIG_KERNELDIR + + # Check whether --with-kernel or --without-kernel was given. +if test "${with_kernel+set}" = set; then + withval="$with_kernel" + DOTEST="y"; tst_kerneldir="${withval}" +fi + + + if test "$DOTEST" = "y" || test "$CONFIG_KERNELDIR" != "" ; then + echo $ac_n "checking for linux kernel source in ${tst_kerneldir}""... $ac_c" 1>&6 +echo "configure:1004: checking for linux kernel source in ${tst_kerneldir}" >&5 + CPPFLAGS="-nostdinc -I${tst_kerneldir}/drivers/isdn" + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1012: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + lxdir=${tst_kerneldir} +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t"""no"" 1>&6 +fi +rm -f conftest* + fi + if test "$lxdir" = "no" ; then + echo $ac_n "checking for linux kernel source in /usr/src/linux""... $ac_c" 1>&6 +echo "configure:1028: checking for linux kernel source in /usr/src/linux" >&5 + CPPFLAGS="-nostdinc -I/usr/src/linux/drivers/isdn" + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1036: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + lxdir=/usr/src/linux +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + fi + if test "$lxdir" = "no" ; then + echo "$ac_t"""$lxdir"" 1>&6 + echo $ac_n "checking for linux kernel source in /usr/local/src/linux""... $ac_c" 1>&6 +echo "configure:1051: checking for linux kernel source in /usr/local/src/linux" >&5 + CPPFLAGS="-nostdinc -I/usr/local/src/linux/drivers/isdn" + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1059: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + lxdir=/usr/local/src/linux +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + fi + if test "$lxdir" != "no" ; then + echo "$ac_t"""yes"" 1>&6 + else + lxdir="" + { echo "configure: error: "Kernel source not found. You MUST specify a correct path to the linux source in the configuration."" 1>&2; exit 1; } + fi + CONFIG_KERNELDIR="$lxdir" + CPPFLAGS="$OLD_CPPFLAGS" + cat >> confdefs.h <&6 +echo "configure:1089: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1099: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +{ echo "configure: error: "Missing $ac_hdr. Kernel source installed?"" 1>&2; exit 1; } +fi +done + + + +if test $ac_cv_prog_gcc = yes; then + echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 +echo "configure:1130: checking whether ${CC-cc} needs -traditional" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_pattern="Autoconf.*'x'" + cat > conftest.$ac_ext < +Autoconf TIOCGETP +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_prog_gcc_traditional=yes +else + rm -rf conftest* + ac_cv_prog_gcc_traditional=no +fi +rm -f conftest* + + + if test $ac_cv_prog_gcc_traditional = no; then + cat > conftest.$ac_ext < +Autoconf TCGETA +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_prog_gcc_traditional=yes +fi +rm -f conftest* + + fi +fi + +echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6 + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + +for ac_func in select +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1178: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + + + + + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@CC@%$CC%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CPP@%$CPP%g +s%@CONFIG_KERNELDIR@%$CONFIG_KERNELDIR%g +s%@INSTALL@%$INSTALL%g +s%@I4LVERSION@%$I4LVERSION%g +s%@CONFIG_SBINDIR@%$CONFIG_SBINDIR%g +s%@CONFIG_DATADIR@%$CONFIG_DATADIR%g +s%@CONFIG_MANDIR@%$CONFIG_MANDIR%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/capi20/configure.in b/capi20/configure.in new file mode 100644 index 00000000..f2a9df8d --- /dev/null +++ b/capi20/configure.in @@ -0,0 +1,38 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(capi20.c) +AC_PREFIX_DEFAULT(/usr) + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_INSTALL + +I4LCONFDIR=${I4LCONFDIR:-"/etc/isdn"} +I4LVERSION=${I4LVERSION:-"?.?"} +CONFIG_DATADIR=${CONFIG_DATADIR:-"/usr/lib/isdn"} +CONFIG_MANDIR=`eval echo ${CONFIG_MANDIR:-"/usr/man"}` +CONFIG_SBINDIR=`eval echo ${CONFIG_SBINDIR:-"/sbin"}` +CONFIG_KERNELDIR=`eval echo ${CONFIG_KERNELDIR:-"/usr/src/linux"}` + +dnl Checks for libraries. + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(fcntl.h sys/ioctl.h unistd.h) +dnl Check for kernel stuff +AC_FIND_KERNEL +AC_CHECK_HEADERS($CONFIG_KERNELDIR/include/linux/capi.h $CONFIG_KERNELDIR/include/linux/kernelcapi.h,, + AC_MSG_ERROR("Missing $ac_hdr. Kernel source installed?")) + +dnl Checks for typedefs, structures, and compiler characteristics. + +dnl Checks for library functions. +AC_PROG_GCC_TRADITIONAL +AC_CHECK_FUNCS(select) + +AC_SUBST(INSTALL) +AC_SUBST(I4LVERSION) +AC_SUBST(CONFIG_SBINDIR) +AC_SUBST(CONFIG_DATADIR) +AC_SUBST(CONFIG_MANDIR) +AC_SUBST(CONFIG_KERNELDIR) +AC_OUTPUT(Makefile) diff --git a/capi20/convert.c b/capi20/convert.c new file mode 100644 index 00000000..f3939c88 --- /dev/null +++ b/capi20/convert.c @@ -0,0 +1,420 @@ +/* + * $Id: convert.c,v 1.3 1998/08/30 09:57:21 calle Exp $ + * + * $Log: convert.c,v $ + * Revision 1.3 1998/08/30 09:57:21 calle + * I hope it is know readable for everybody. + * + * Revision 1.1 1998/08/25 16:33:23 calle + * Added CAPI2.0 library. First Version. + * + */ +#include +#include +#include +#include +#include +#include +#include + +#include "capi20.h" + +typedef struct { + int typ; + unsigned off; +} _cdef; + +#define _CBYTE 1 +#define _CWORD 2 +#define _CDWORD 3 +#define _CSTRUCT 4 +#define _CMSTRUCT 5 +#define _CEND 6 + +static _cdef cdef[] = { + /*00*/{_CEND}, + /*01*/{_CEND}, + /*02*/{_CEND}, + /*03*/{_CDWORD, offsetof(_cmsg,adr.adrController) }, + /*04*/{_CMSTRUCT, offsetof(_cmsg,AdditionalInfo) }, + /*05*/{_CSTRUCT, offsetof(_cmsg,B1configuration) }, + /*06*/{_CWORD, offsetof(_cmsg,B1protocol) }, + /*07*/{_CSTRUCT, offsetof(_cmsg,B2configuration) }, + /*08*/{_CWORD, offsetof(_cmsg,B2protocol) }, + /*09*/{_CSTRUCT, offsetof(_cmsg,B3configuration) }, + /*0a*/{_CWORD, offsetof(_cmsg,B3protocol) }, + /*0b*/{_CSTRUCT, offsetof(_cmsg,BC) }, + /*0c*/{_CSTRUCT, offsetof(_cmsg,BChannelinformation) }, + /*0d*/{_CMSTRUCT, offsetof(_cmsg,BProtocol) }, + /*0e*/{_CSTRUCT, offsetof(_cmsg,CalledPartyNumber) }, + /*0f*/{_CSTRUCT, offsetof(_cmsg,CalledPartySubaddress) }, + /*10*/{_CSTRUCT, offsetof(_cmsg,CallingPartyNumber) }, + /*11*/{_CSTRUCT, offsetof(_cmsg,CallingPartySubaddress) }, + /*12*/{_CDWORD, offsetof(_cmsg,CIPmask) }, + /*13*/{_CDWORD, offsetof(_cmsg,CIPmask2) }, + /*14*/{_CWORD, offsetof(_cmsg,CIPValue) }, + /*15*/{_CDWORD, offsetof(_cmsg,Class) }, + /*16*/{_CSTRUCT, offsetof(_cmsg,ConnectedNumber) }, + /*17*/{_CSTRUCT, offsetof(_cmsg,ConnectedSubaddress) }, + /*18*/{_CDWORD, offsetof(_cmsg,Data) }, + /*19*/{_CWORD, offsetof(_cmsg,DataHandle) }, + /*1a*/{_CWORD, offsetof(_cmsg,DataLength) }, + /*1b*/{_CSTRUCT, offsetof(_cmsg,FacilityConfirmationParameter) }, + /*1c*/{_CSTRUCT, offsetof(_cmsg,Facilitydataarray) }, + /*1d*/{_CSTRUCT, offsetof(_cmsg,FacilityIndicationParameter) }, + /*1e*/{_CSTRUCT, offsetof(_cmsg,FacilityRequestParameter) }, + /*1f*/{_CSTRUCT, offsetof(_cmsg,FacilityResponseParameters) }, + /*20*/{_CWORD, offsetof(_cmsg,FacilitySelector) }, + /*21*/{_CWORD, offsetof(_cmsg,Flags) }, + /*22*/{_CDWORD, offsetof(_cmsg,Function) }, + /*23*/{_CSTRUCT, offsetof(_cmsg,HLC) }, + /*24*/{_CWORD, offsetof(_cmsg,Info) }, + /*25*/{_CSTRUCT, offsetof(_cmsg,InfoElement) }, + /*26*/{_CDWORD, offsetof(_cmsg,InfoMask) }, + /*27*/{_CWORD, offsetof(_cmsg,InfoNumber) }, + /*28*/{_CSTRUCT, offsetof(_cmsg,Keypadfacility) }, + /*29*/{_CSTRUCT, offsetof(_cmsg,LLC) }, + /*2a*/{_CSTRUCT, offsetof(_cmsg,ManuData) }, + /*2b*/{_CDWORD, offsetof(_cmsg,ManuID) }, + /*2c*/{_CSTRUCT, offsetof(_cmsg,NCPI) }, + /*2d*/{_CWORD, offsetof(_cmsg,Reason) }, + /*2e*/{_CWORD, offsetof(_cmsg,Reason_B3) }, + /*2f*/{_CWORD, offsetof(_cmsg,Reject) }, + /*30*/{_CSTRUCT, offsetof(_cmsg,Useruserdata) }, +}; + +static unsigned char *cpars[] = { + /*00*/ 0, + /*01 ALERT_REQ*/ + (unsigned char*)"\x03\x04\x0c\x28\x30\x1c\x01\x01", + /*02 CONNECT_REQ*/ + (unsigned char*)"\x03\x14\x0e\x10\x0f\x11\x0d\x06\x08\x0a\x05\x07\x09\x01\x0b\x29\x23\x04\x0c\x28\x30\x1c\x01\x01", + /*03*/ 0, + /*04 DISCONNECT_REQ*/ + (unsigned char*)"\x03\x04\x0c\x28\x30\x1c\x01\x01", + /*05 LISTEN_REQ*/ + (unsigned char*)"\x03\x26\x12\x13\x10\x11\x01", + /*06*/ 0, + /*07*/ 0, + /*08 INFO_REQ*/ + (unsigned char*)"\x03\x0e\x04\x0c\x28\x30\x1c\x01\x01", + /*09 FACILITY_REQ*/ + (unsigned char*)"\x03\x20\x1e\x01", + /*0a SELECT_B_PROTOCOL_REQ*/ + (unsigned char*)"\x03\x0d\x06\x08\x0a\x05\x07\x09\x01\x01", + /*0b CONNECT_B3_REQ*/ + (unsigned char*)"\x03\x2c\x01", + /*0c*/ 0, + /*0d DISCONNECT_B3_REQ*/ + (unsigned char*)"\x03\x2c\x01", + /*0e*/ 0, + /*0f DATA_B3_REQ*/ + (unsigned char*)"\x03\x18\x1a\x19\x21\x01", + /*10 RESET_B3_REQ*/ + (unsigned char*)"\x03\x2c\x01", + /*11*/ 0, + /*12*/ 0, + /*13 ALERT_CONF*/ + (unsigned char*)"\x03\x24\x01", + /*14 CONNECT_CONF*/ + (unsigned char*)"\x03\x24\x01", + /*15*/ 0, + /*16 DISCONNECT_CONF*/ + (unsigned char*)"\x03\x24\x01", + /*17 LISTEN_CONF*/ + (unsigned char*)"\x03\x24\x01", + /*18 MANUFACTURER_REQ*/ + (unsigned char*)"\x03\x2b\x15\x22\x2a\x01", + /*19*/ 0, + /*1a INFO_CONF*/ + (unsigned char*)"\x03\x24\x01", + /*1b FACILITY_CONF*/ + (unsigned char*)"\x03\x24\x20\x1b\x01", + /*1c SELECT_B_PROTOCOL_CONF*/ + (unsigned char*)"\x03\x24\x01", + /*1d CONNECT_B3_CONF*/ + (unsigned char*)"\x03\x24\x01", + /*1e*/ 0, + /*1f DISCONNECT_B3_CONF*/ + (unsigned char*)"\x03\x24\x01", + /*20*/ 0, + /*21 DATA_B3_CONF*/ + (unsigned char*)"\x03\x19\x24\x01", + /*22 RESET_B3_CONF*/ + (unsigned char*)"\x03\x24\x01", + /*23*/ 0, + /*24*/ 0, + /*25*/ 0, + /*26 CONNECT_IND*/ + (unsigned char*)"\x03\x14\x0e\x10\x0f\x11\x0b\x29\x23\x04\x0c\x28\x30\x1c\x01\x01", + /*27 CONNECT_ACTIVE_IND*/ + (unsigned char*)"\x03\x16\x17\x29\x01", + /*28 DISCONNECT_IND*/ + (unsigned char*)"\x03\x2d\x01", + /*29*/ 0, + /*2a MANUFACTURER_CONF*/ + (unsigned char*)"\x03\x2b\x15\x22\x2a\x01", + /*2b*/ 0, + /*2c INFO_IND*/ + (unsigned char*)"\x03\x27\x25\x01", + /*2d FACILITY_IND*/ + (unsigned char*)"\x03\x20\x1d\x01", + /*2e*/ 0, + /*2f CONNECT_B3_IND*/ + (unsigned char*)"\x03\x2c\x01", + /*30 CONNECT_B3_ACTIVE_IND*/ + (unsigned char*)"\x03\x2c\x01", + /*31 DISCONNECT_B3_IND*/ + (unsigned char*)"\x03\x2e\x2c\x01", + /*32*/ 0, + /*33 DATA_B3_IND*/ + (unsigned char*)"\x03\x18\x1a\x19\x21\x01", + /*34 RESET_B3_IND*/ + (unsigned char*)"\x03\x2c\x01", + /*35 CONNECT_B3_T90_ACTIVE_IND*/ + (unsigned char*)"\x03\x2c\x01", + /*36*/ 0, + /*37*/ 0, + /*38 CONNECT_RESP*/ + (unsigned char*)"\x03\x2f\x0d\x06\x08\x0a\x05\x07\x09\x01\x16\x17\x29\x04\x0c\x28\x30\x1c\x01\x01", + /*39 CONNECT_ACTIVE_RESP*/ + (unsigned char*)"\x03\x01", + /*3a DISCONNECT_RESP*/ + (unsigned char*)"\x03\x01", + /*3b*/ 0, + /*3c MANUFACTURER_IND*/ + (unsigned char*)"\x03\x2b\x15\x22\x2a\x01", + /*3d*/ 0, + /*3e INFO_RESP*/ + (unsigned char*)"\x03\x01", + /*3f FACILITY_RESP*/ + (unsigned char*)"\x03\x20\x1f\x01", + /*40*/ 0, + /*41 CONNECT_B3_RESP*/ + (unsigned char*)"\x03\x2f\x2c\x01", + /*42 CONNECT_B3_ACTIVE_RESP*/ + (unsigned char*)"\x03\x01", + /*43 DISCONNECT_B3_RESP*/ + (unsigned char*)"\x03\x01", + /*44*/ 0, + /*45 DATA_B3_RESP*/ + (unsigned char*)"\x03\x19\x01", + /*46 RESET_B3_RESP*/ + (unsigned char*)"\x03\x01", + /*47 CONNECT_B3_T90_ACTIVE_RESP*/ + (unsigned char*)"\x03\x01", + /*48*/ 0, + /*49*/ 0, + /*4a*/ 0, + /*4b*/ 0, + /*4c*/ 0, + /*4d*/ 0, + /*4e MANUFACTURER_RESP*/ + (unsigned char*)"\x03\x2b\x15\x22\x2a\x01", +}; + +/*-------------------------------------------------------*/ + +#define byteTLcpy(x,y) *(_cbyte *)(x)=*(_cbyte *)(y); +#define wordTLcpy(x,y) *(_cword *)(x)=*(_cword *)(y); +#define dwordTLcpy(x,y) memcpy(x,y,4); +#define structTLcpy(x,y,l) memcpy (x,y,l) +#define structTLcpyovl(x,y,l) memmove (x,y,l) + +#define byteTRcpy(x,y) *(_cbyte *)(y)=*(_cbyte *)(x); +#define wordTRcpy(x,y) *(_cword *)(y)=*(_cword *)(x); +#define dwordTRcpy(x,y) memcpy(y,x,4); +#define structTRcpy(x,y,l) memcpy (y,x,l) +#define structTRcpyovl(x,y,l) memmove (y,x,l) + +/*-------------------------------------------------------*/ +static unsigned command_2_index (unsigned c, unsigned sc) { + if (c & 0x80) c = 0x9+(c&0x0f); + else if (c<=0x0f) ; + else if (c==0x41) c = 0x9+0x1; + else if (c==0xff) c = 0x00; + return (sc&3)*(0x9+0x9)+c; +} + +/*-------------------------------------------------------*/ +#define TYP (cdef[cmsg->par[cmsg->p]].typ) +#define OFF (((char *)cmsg)+cdef[cmsg->par[cmsg->p]].off) + +static void jumpcstruct (_cmsg *cmsg) { + unsigned layer; + for (cmsg->p++,layer=1; layer;) { + assert (cmsg->p); + cmsg->p++; + switch (TYP) { + case _CMSTRUCT: + layer++; + break; + case _CEND: + layer--; + break; + } + } +} +/*-------------------------------------------------------*/ +static void PARS_2_MESSAGE (_cmsg *cmsg) { + + for (;TYP != _CEND; cmsg->p++) { + switch (TYP) { + case _CBYTE: + byteTLcpy (cmsg->m+cmsg->l, OFF); + cmsg->l++; + break; + case _CWORD: + wordTLcpy (cmsg->m+cmsg->l, OFF); + cmsg->l+=2; + break; + case _CDWORD: + dwordTLcpy (cmsg->m+cmsg->l, OFF); + cmsg->l+=4; + break; + case _CSTRUCT: + if (*(CAPI_MESSAGE *) OFF == 0) { + *(cmsg->m+cmsg->l)='\0'; + cmsg->l++; + } + else if(**(_cstruct*)OFF != 0xff) { + structTLcpy (cmsg->m+cmsg->l, *(_cstruct*)OFF, 1+**(_cstruct*)OFF); + cmsg->l+=1+**(_cstruct*)OFF; + } + else { + _cstruct s = *(_cstruct*)OFF; + structTLcpy (cmsg->m+cmsg->l, s, 3+*(_cword*)(s+1)); + cmsg->l+= 3+*(_cword*)(s+1); + } + break; + case _CMSTRUCT: + /*----- Metastruktur 0 -----*/ + if (*(_cmstruct*)OFF == CAPI_DEFAULT) { + *(cmsg->m+cmsg->l)='\0'; + cmsg->l++; + jumpcstruct (cmsg); + } + /*----- Metastruktur wird composed -----*/ + else { + unsigned _l = cmsg->l; + unsigned _ls; + cmsg->l++; + cmsg->p++; + PARS_2_MESSAGE (cmsg); + _ls = cmsg->l-_l-1; + if (_ls < 255) + (cmsg->m+_l)[0] = (_cbyte)_ls; + else { + structTLcpyovl (cmsg->m+_l+3, cmsg->m+_l+1, _ls); + (cmsg->m+_l)[0] = 0xff; + wordTLcpy (cmsg->m+_l+1, &_ls); + cmsg->l+=2; + } + } + break; + } + } +} + +/*-------------------------------------------------------*/ +unsigned capi_cmsg2message (_cmsg *cmsg, CAPI_MESSAGE msg) +{ + cmsg->m = msg; + cmsg->l = 8; + cmsg->p = 0; + cmsg->par = cpars [command_2_index (cmsg->Command,cmsg->Subcommand)]; + + PARS_2_MESSAGE (cmsg); + + wordTLcpy (msg+0, &cmsg->l); + byteTLcpy (cmsg->m+4, &cmsg->Command); + byteTLcpy (cmsg->m+5, &cmsg->Subcommand); + wordTLcpy (cmsg->m+2, &cmsg->ApplId); + wordTLcpy (cmsg->m+6, &cmsg->Messagenumber); + + return 0; +} + +/*-------------------------------------------------------*/ +static void MESSAGE_2_PARS (_cmsg *cmsg) { + for (;TYP != _CEND; cmsg->p++) { + + switch (TYP) { + case _CBYTE: + byteTRcpy (cmsg->m+cmsg->l, OFF); + cmsg->l++; + break; + case _CWORD: + wordTRcpy (cmsg->m+cmsg->l, OFF); + cmsg->l+=2; + break; + case _CDWORD: + dwordTRcpy (cmsg->m+cmsg->l, OFF); + cmsg->l+=4; + break; + case _CSTRUCT: + *(CAPI_MESSAGE *)OFF = cmsg->m+cmsg->l; + + if (cmsg->m[cmsg->l] != 0xff) + cmsg->l+= 1+ cmsg->m[cmsg->l]; + else + cmsg->l+= 3+ *(_cword *)(cmsg->m+cmsg->l+1); + break; + case _CMSTRUCT: + /*----- Metastruktur 0 -----*/ + if (cmsg->m[cmsg->l] == '\0') { + *(_cmstruct*)OFF = CAPI_DEFAULT; + cmsg->l++; + jumpcstruct (cmsg); + } + else { + unsigned _l = cmsg->l; + *(_cmstruct*)OFF = CAPI_COMPOSE; + cmsg->l = (cmsg->m+_l)[0] == 255 ? cmsg->l+3 : cmsg->l+1; + cmsg->p++; + MESSAGE_2_PARS (cmsg); + } + break; + } + } +} + +/*-------------------------------------------------------*/ +unsigned capi_message2cmsg (_cmsg *cmsg, CAPI_MESSAGE msg) +{ + memset (cmsg, 0, sizeof(_cmsg)); + cmsg->m = msg; + cmsg->l = 8; + cmsg->p = 0; + byteTRcpy (cmsg->m+4, &cmsg->Command); + byteTRcpy (cmsg->m+5, &cmsg->Subcommand); + cmsg->par = cpars [command_2_index (cmsg->Command,cmsg->Subcommand)]; + + MESSAGE_2_PARS (cmsg); + + wordTRcpy (msg+0, &cmsg->l); + wordTRcpy (cmsg->m+2, &cmsg->ApplId); + wordTRcpy (cmsg->m+6, &cmsg->Messagenumber); + + return 0; +} + +/*-------------------------------------------------------*/ +unsigned capi_cmsg_answer (_cmsg *cmsg) +{ + cmsg->Subcommand |= 0x01; + return 0; +} + +/*-------------------------------------------------------*/ +unsigned capi_cmsg_header (_cmsg *cmsg, _cword _ApplId, + _cbyte _Command, _cbyte _Subcommand, + _cword _Messagenumber, _cdword _Controller) { + memset (cmsg, 0, sizeof(_cmsg)); + cmsg->ApplId = _ApplId ; + cmsg->Command = _Command ; + cmsg->Subcommand = _Subcommand ; + cmsg->Messagenumber = _Messagenumber; + cmsg->adr.adrController = _Controller ; + return 0; +} diff --git a/capi20/install-sh b/capi20/install-sh new file mode 100755 index 00000000..039e4d00 --- /dev/null +++ b/capi20/install-sh @@ -0,0 +1,2 @@ +#!/bin/sh +exit 0