From ea1892d3178f92748c01f5e2f3c75574e339a536 Mon Sep 17 00:00:00 2001 From: Karsten Keil Date: Tue, 22 Feb 2005 11:39:43 +0000 Subject: [PATCH] for backward compatibility the libcapi20 can now compiled to support the old (buggy) version2 ABI. This is not for future developments. This is only to support old binaries, which are linked against the old V2 lib. --- capi20/Makefile.am | 2 +- capi20/capifunc.c | 33 ++++++++++++++++++++++++---- capi20/capiutils.h | 52 +++++++++++++++++++++++++++++++++++++++------ capi20/configure.in | 25 +++++++++++++++++++++- capi20/convert.c | 24 +++++++++++++++++++++ 5 files changed, 123 insertions(+), 13 deletions(-) diff --git a/capi20/Makefile.am b/capi20/Makefile.am index 988235e6..e8c6ed77 100644 --- a/capi20/Makefile.am +++ b/capi20/Makefile.am @@ -9,7 +9,7 @@ lib_LTLIBRARIES = libcapi20.la lib_LIBRARIES = libcapi20dyn.a libcapi20_la_SOURCES = capi20.c capifunc.c convert.c -libcapi20_la_LDFLAGS = -version-info 3:0:0 +libcapi20_la_LDFLAGS = -version-info ${LIBCAPI_VERSION}:${LIBCAPI_VERSION_RELEASE}:${LIBCAPI_VERSION_AGE} libcapi20_la_CFLAGS = -fno-strict-aliasing libcapi20dyn_a_SOURCES = capidyn.c diff --git a/capi20/capifunc.c b/capi20/capifunc.c index 628d2902..deb2380a 100644 --- a/capi20/capifunc.c +++ b/capi20/capifunc.c @@ -2,6 +2,13 @@ * $Id$ * * $Log$ + * Revision 1.7 2005/02/21 17:37:06 keil + * libcapi20 version 3.0.0 + * - add SENDING COMPLETE in ALERT_REQ + * - add Globalconfiguration to CONNECT_REQ/RESP and SELECT_B_PROTOCOL_REQ + * + * * NOTE: incompatible to 2.X.Y versions + * * Revision 1.6 2004/10/06 15:24:43 calle * - "SendingComplete"-Patch reverted => 2.0.8 was not binaer compartible * - Bugfix: capi20_register() with MaxB3Connection == 0 results in a @@ -30,14 +37,19 @@ unsigned ALERT_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, _cstruct BChannelinformation, _cstruct Keypadfacility, _cstruct Useruserdata, - _cstruct Facilitydataarray, - _cstruct SendingComplete) { + _cstruct Facilitydataarray +#ifndef CAPI_LIBRARY_V2 + ,_cstruct SendingComplete +#endif + ) { capi_cmsg_header (cmsg,ApplId,0x01,0x80,Messagenumber,adr); cmsg->BChannelinformation = BChannelinformation; cmsg->Keypadfacility = Keypadfacility; cmsg->Useruserdata = Useruserdata; cmsg->Facilitydataarray = Facilitydataarray; +#ifndef CAPI_LIBRARY_V2 cmsg->SendingComplete = SendingComplete; +#endif return capi_put_cmsg (cmsg); } @@ -54,7 +66,9 @@ unsigned CONNECT_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, _cstruct B1configuration, _cstruct B2configuration, _cstruct B3configuration, +#ifndef CAPI_LIBRARY_V2 _cstruct Globalconfiguration, +#endif _cstruct BC, _cstruct LLC, _cstruct HLC, @@ -74,7 +88,9 @@ unsigned CONNECT_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, cmsg->B1configuration = B1configuration; cmsg->B2configuration = B2configuration; cmsg->B3configuration = B3configuration; +#ifndef CAPI_LIBRARY_V2 cmsg->Globalconfiguration = Globalconfiguration; +#endif cmsg->BC = BC; cmsg->LLC = LLC; cmsg->HLC = HLC; @@ -200,8 +216,11 @@ unsigned SELECT_B_PROTOCOL_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber _cword B3protocol, _cstruct B1configuration, _cstruct B2configuration, - _cstruct B3configuration, - _cstruct Globalconfiguration) { + _cstruct B3configuration +#ifndef CAPI_LIBRARY_V2 + ,_cstruct Globalconfiguration +#endif + ) { capi_cmsg_header (cmsg,ApplId,0x41,0x80,Messagenumber,adr); cmsg->B1protocol = B1protocol; cmsg->B2protocol = B2protocol; @@ -209,7 +228,9 @@ unsigned SELECT_B_PROTOCOL_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber cmsg->B1configuration = B1configuration; cmsg->B2configuration = B2configuration; cmsg->B3configuration = B3configuration; +#ifndef CAPI_LIBRARY_V2 cmsg->Globalconfiguration = Globalconfiguration; +#endif return capi_put_cmsg (cmsg); } @@ -222,7 +243,9 @@ unsigned CONNECT_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, _cstruct B1configuration, _cstruct B2configuration, _cstruct B3configuration, +#ifndef CAPI_LIBRARY_V2 _cstruct Globalconfiguration, +#endif _cstruct ConnectedNumber, _cstruct ConnectedSubaddress, _cstruct LLC, @@ -238,7 +261,9 @@ unsigned CONNECT_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber, cmsg->B1configuration = B1configuration; cmsg->B2configuration = B2configuration; cmsg->B3configuration = B3configuration; +#ifndef CAPI_LIBRARY_V2 cmsg->Globalconfiguration = Globalconfiguration; +#endif cmsg->ConnectedNumber = ConnectedNumber; cmsg->ConnectedSubaddress = ConnectedSubaddress; cmsg->LLC = LLC; diff --git a/capi20/capiutils.h b/capi20/capiutils.h index 5c518650..d0e9cea8 100644 --- a/capi20/capiutils.h +++ b/capi20/capiutils.h @@ -204,7 +204,9 @@ typedef struct { _cword FacilitySelector; _cword Flags; _cdword Function; +#ifndef CAPI_LIBRARY_V2 _cstruct Globalconfiguration; +#endif _cstruct HLC; _cword Info; _cstruct InfoElement; @@ -219,7 +221,9 @@ typedef struct { _cword Reason_B3; _cword Reject; _cstruct Useruserdata; +#ifndef CAPI_LIBRARY_V2 _cstruct SendingComplete; +#endif unsigned char *Data; /* intern */ @@ -359,8 +363,10 @@ char *capi_message2str(_cbyte * msg); /* Data link layer parameter */ #define CONNECT_REQ_B3CONFIGURATION(x) ((x)->B3configuration) /* Network layer parameter */ +#ifndef CAPI_LIBRARY_V2 #define CONNECT_REQ_GLOBALCONFIGURATION(x) ((x)->Globalconfiguration) /* all layer parameter */ +#endif #define CONNECT_REQ_BC(x) ((x)->BC) /* Bearer Capability */ #define CONNECT_REQ_LLC(x) ((x)->LLC) @@ -450,8 +456,10 @@ char *capi_message2str(_cbyte * msg); /* Data link layer parameter */ #define CONNECT_RESP_B3CONFIGURATION(x) ((x)->B3configuration) /* Network layer parameter */ +#ifndef CAPI_LIBRARY_V2 #define CONNECT_RESP_GLOBALCONFIGURATION(x) ((x)->Globalconfiguration) /* all layer parameter */ +#endif #define CONNECT_RESP_CONNECTEDNUMBER(x) ((x)->ConnectedNumber) /* Connected number */ #define CONNECT_RESP_CONNECTEDSUBADDRESS(x) ((x)->ConnectedSubaddress) @@ -818,8 +826,10 @@ char *capi_message2str(_cbyte * msg); /* Data link layer parameter */ #define SELECT_B_PROTOCOL_REQ_B3CONFIGURATION(x) ((x)->B3configuration) /* Network layer parameter */ +#ifndef CAPI_LIBRARY_V2 #define SELECT_B_PROTOCOL_REQ_GLOBALCONFIGURATION(x) ((x)->Globalconfiguration) /* all layer parameter */ +#endif #define SELECT_B_PROTOCOL_CONF_PLCI(x) ((x)->adr.adrPLCI) /* Physical Link Connection Identifier */ #define SELECT_B_PROTOCOL_CONF_INFO(x) ((x)->Info) @@ -927,7 +937,10 @@ unsigned ALERT_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber ,_cstruct Keypadfacility ,_cstruct Useruserdata ,_cstruct Facilitydataarra - ,_cstruct SendingComplete); +#ifndef CAPI_LIBRARY_V2 + ,_cstruct SendingComplete +#endif + ); unsigned CONNECT_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber ,_cdword adr ,_cword CIPValue @@ -941,7 +954,9 @@ unsigned CONNECT_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber ,_cstruct B1configuration ,_cstruct B2configuration ,_cstruct B3configuration +#ifndef CAPI_LIBRARY_V2 ,_cstruct Globalconfiguration +#endif ,_cstruct BC ,_cstruct LLC ,_cstruct HLC @@ -1002,7 +1017,10 @@ unsigned SELECT_B_PROTOCOL_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber ,_cstruct B1configuration ,_cstruct B2configuration ,_cstruct B3configuration - ,_cstruct Globalconfiguration); +#ifndef CAPI_LIBRARY_V2 + ,_cstruct Globalconfiguration +#endif + ); unsigned CONNECT_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber ,_cdword adr ,_cword Reject @@ -1012,7 +1030,9 @@ unsigned CONNECT_RESP (_cmsg *cmsg, _cword ApplId, _cword Messagenumber ,_cstruct B1configuration ,_cstruct B2configuration ,_cstruct B3configuration +#ifndef CAPI_LIBRARY_V2 ,_cstruct Globalconfiguration +#endif ,_cstruct ConnectedNumber ,_cstruct ConnectedSubaddress ,_cstruct LLC @@ -1109,15 +1129,20 @@ static inline void capi_fill_ALERT_REQ(_cmsg * cmsg, _cword ApplId, _cword Messa _cstruct BChannelinformation, _cstruct Keypadfacility, _cstruct Useruserdata, - _cstruct Facilitydataarray, - _cstruct SendingComplete) + _cstruct Facilitydataarray +#ifndef CAPI_LIBRARY_V2 + ,_cstruct SendingComplete +#endif + ) { capi_cmsg_header(cmsg, ApplId, 0x01, 0x80, Messagenumber, adr); cmsg->BChannelinformation = BChannelinformation; cmsg->Keypadfacility = Keypadfacility; cmsg->Useruserdata = Useruserdata; cmsg->Facilitydataarray = Facilitydataarray; +#ifndef CAPI_LIBRARY_V2 cmsg->SendingComplete = SendingComplete; +#endif } static inline void capi_fill_CONNECT_REQ(_cmsg * cmsg, _cword ApplId, _cword Messagenumber, @@ -1133,7 +1158,9 @@ static inline void capi_fill_CONNECT_REQ(_cmsg * cmsg, _cword ApplId, _cword Mes _cstruct B1configuration, _cstruct B2configuration, _cstruct B3configuration, +#ifndef CAPI_LIBRARY_V2 _cstruct Globalconfiguration, +#endif _cstruct BC, _cstruct LLC, _cstruct HLC, @@ -1155,7 +1182,9 @@ static inline void capi_fill_CONNECT_REQ(_cmsg * cmsg, _cword ApplId, _cword Mes cmsg->B1configuration = B1configuration; cmsg->B2configuration = B2configuration; cmsg->B3configuration = B3configuration; +#ifndef CAPI_LIBRARY_V2 cmsg->Globalconfiguration = Globalconfiguration; +#endif cmsg->BC = BC; cmsg->LLC = LLC; cmsg->HLC = HLC; @@ -1235,18 +1264,23 @@ static inline void capi_fill_SELECT_B_PROTOCOL_REQ(_cmsg * cmsg, _cword ApplId, _cword B3protocol, _cstruct B1configuration, _cstruct B2configuration, - _cstruct B3configuration, - _cstruct Globalconfiguration) + _cstruct B3configuration +#ifndef CAPI_LIBRARY_V2 + ,_cstruct Globalconfiguration +#endif + ) { capi_cmsg_header(cmsg, ApplId, 0x41, 0x80, Messagenumber, adr); cmsg->B1protocol = B1protocol; cmsg->B2protocol = B2protocol; cmsg->B3protocol = B3protocol; - cmsg->Globalconfiguration = Globalconfiguration; cmsg->B1configuration = B1configuration; cmsg->B2configuration = B2configuration; cmsg->B3configuration = B3configuration; +#ifndef CAPI_LIBRARY_V2 + cmsg->Globalconfiguration = Globalconfiguration; +#endif } static inline void capi_fill_CONNECT_RESP(_cmsg * cmsg, _cword ApplId, _cword Messagenumber, @@ -1258,7 +1292,9 @@ static inline void capi_fill_CONNECT_RESP(_cmsg * cmsg, _cword ApplId, _cword Me _cstruct B1configuration, _cstruct B2configuration, _cstruct B3configuration, +#ifndef CAPI_LIBRARY_V2 _cstruct Globalconfiguration, +#endif _cstruct ConnectedNumber, _cstruct ConnectedSubaddress, _cstruct LLC, @@ -1275,7 +1311,9 @@ static inline void capi_fill_CONNECT_RESP(_cmsg * cmsg, _cword ApplId, _cword Me cmsg->B1configuration = B1configuration; cmsg->B2configuration = B2configuration; cmsg->B3configuration = B3configuration; +#ifndef CAPI_LIBRARY_V2 cmsg->Globalconfiguration = Globalconfiguration; +#endif cmsg->ConnectedNumber = ConnectedNumber; cmsg->ConnectedSubaddress = ConnectedSubaddress; cmsg->LLC = LLC; diff --git a/capi20/configure.in b/capi20/configure.in index 0e8dacaa..8b14e75d 100644 --- a/capi20/configure.in +++ b/capi20/configure.in @@ -1,7 +1,27 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(capi20.c) -AM_INIT_AUTOMAKE(libcapi20,3.0.0) +AC_ARG_ENABLE([V2], + AS_HELP_STRING([--enable-V2],[build libcapi20 version 2 compatible library]), + [case "${enableval}" in + yes) LIBCAPI_VERSION=2 + LIBCAPI_VERSION_AGE=0 + LIBCAPI_VERSION_RELEASE=10 + AC_DEFINE([CAPI_LIBRARY_V2],1) + ;; + no) LIBCAPI_VERSION=3 + LIBCAPI_VERSION_AGE=0 + LIBCAPI_VERSION_RELEASE=1 + ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-V2) ;; + esac], + [ + LIBCAPI_VERSION=3 + LIBCAPI_VERSION_AGE=0 + LIBCAPI_VERSION_RELEASE=1 +]) + +AM_INIT_AUTOMAKE(libcapi20,${LIBCAPI_VERSION}.${LIBCAPI_VERSION_RELEASE}) AC_PREFIX_DEFAULT(/usr) dnl Checks for programs. @@ -28,4 +48,7 @@ rm -f conftest dnl rm -f conftest AC_SUBST(INSTALL) +AC_SUBST(LIBCAPI_VERSION) +AC_SUBST(LIBCAPI_VERSION_AGE) +AC_SUBST(LIBCAPI_VERSION_RELEASE) AC_OUTPUT(Makefile) diff --git a/capi20/convert.c b/capi20/convert.c index 2b37438d..24903938 100644 --- a/capi20/convert.c +++ b/capi20/convert.c @@ -2,6 +2,13 @@ * $Id$ * * $Log$ + * Revision 1.14 2005/02/21 17:37:07 keil + * libcapi20 version 3.0.0 + * - add SENDING COMPLETE in ALERT_REQ + * - add Globalconfiguration to CONNECT_REQ/RESP and SELECT_B_PROTOCOL_REQ + * + * * NOTE: incompatible to 2.X.Y versions + * * Revision 1.13 2004/10/06 15:24:43 calle * - "SendingComplete"-Patch reverted => 2.0.8 was not binaer compartible * - Bugfix: capi20_register() with MaxB3Connection == 0 results in a @@ -341,14 +348,21 @@ static _cdef cdef[] = { /*2f*/{_CWORD, offsetof(_cmsg, Reject)}, /*30*/{_CSTRUCT, offsetof(_cmsg, Useruserdata)}, /*31*/{_CQWORD, offsetof(_cmsg, Data64)}, +#ifndef CAPI_LIBRARY_V2 /*32*/{_CSTRUCT, offsetof(_cmsg, SendingComplete)}, /*33*/{_CSTRUCT, offsetof(_cmsg, Globalconfiguration)}, +#endif }; static unsigned char *cpars[] = { /*00*/ 0, +#ifdef CAPI_LIBRARY_V2 /*01 ALERT_REQ*/ (unsigned char*)"\x03\x04\x0c\x28\x30\x1c\x32\x01\x01", /*02 CONNECT_REQ*/ (unsigned char*)"\x03\x14\x0e\x10\x0f\x11\x0d\x06\x08\x0a\x05\x07\x09\x33\x01\x0b\x29\x23\x04\x0c\x28\x30\x1c\x01\x01", +#else + /*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", +#endif /*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", @@ -356,7 +370,11 @@ static unsigned char *cpars[] = { /*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", +#ifdef CAPI_LIBRARY_V2 /*0a SELECT_B_PROTOCOL_REQ*/ (unsigned char*)"\x03\x0d\x06\x08\x0a\x05\x07\x09\x33\x01\x01", +#else + /*0a SELECT_B_PROTOCOL_REQ*/ (unsigned char*)"\x03\x0d\x06\x08\x0a\x05\x07\x09\x01\x01", +#endif /*0b CONNECT_B3_REQ*/ (unsigned char*)"\x03\x2c\x01", /*0c*/ 0, /*0d DISCONNECT_B3_REQ*/ (unsigned char*)"\x03\x2c\x01", @@ -402,7 +420,11 @@ static unsigned char *cpars[] = { /*35 CONNECT_B3_T90_ACTIVE_IND*/ (unsigned char*)"\x03\x2c\x01", /*36*/ 0, /*37*/ 0, +#ifdef CAPI_LIBRARY_V2 /*38 CONNECT_RESP*/ (unsigned char*)"\x03\x2f\x0d\x06\x08\x0a\x05\x07\x09\x33\x01\x16\x17\x29\x04\x0c\x28\x30\x1c\x01\x01", +#else + /*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", +#endif /*39 CONNECT_ACTIVE_RESP*/ (unsigned char*)"\x03\x01", /*3a DISCONNECT_RESP*/ (unsigned char*)"\x03\x01", /*3b*/ 0, @@ -826,8 +848,10 @@ static char *pnames[] = { /*2f*/"Reject", /*30*/"Useruserdata", /*31*/"Data64", +#ifndef CAPI_LIBRARY_V2 /*32*/"SendingComplete", /*33*/"GlobalConfiguration", +#endif }; static char buf[8192];