diff -Nru osptoolkit-4.11.3+dfsg/debian/changelog osptoolkit-4.13.0/debian/changelog --- osptoolkit-4.11.3+dfsg/debian/changelog 2017-02-09 07:53:57.000000000 +0000 +++ osptoolkit-4.13.0/debian/changelog 2017-02-13 09:40:51.000000000 +0000 @@ -1,8 +1,11 @@ -osptoolkit (4.11.3+dfsg-1ubuntu1) zesty; urgency=medium +osptoolkit (4.13.0-1) unstable; urgency=medium - * Fix compilation with latest glibc by applying float correctly. + * New upstream release + * Fix FTBFS with openssl 1.1.0 (Closes: #828482). + * Fix non-floating-point argument in '__builtin_isana' (Closes: #830444). + * Update debhelper compatibility level from 9 to 10. - -- Bhavani Shankar Thu, 09 Feb 2017 13:17:19 +0530 + -- TransNexus Mon, 13 Feb 2017 04:40:51 -0500 osptoolkit (4.11.3+dfsg-1) unstable; urgency=medium diff -Nru osptoolkit-4.11.3+dfsg/debian/compat osptoolkit-4.13.0/debian/compat --- osptoolkit-4.11.3+dfsg/debian/compat 2016-06-09 08:35:16.000000000 +0000 +++ osptoolkit-4.13.0/debian/compat 2017-02-13 09:40:51.000000000 +0000 @@ -1 +1 @@ -9 +10 diff -Nru osptoolkit-4.11.3+dfsg/debian/control osptoolkit-4.13.0/debian/control --- osptoolkit-4.11.3+dfsg/debian/control 2017-02-09 07:54:06.000000000 +0000 +++ osptoolkit-4.13.0/debian/control 2016-06-24 09:13:58.000000000 +0000 @@ -1,6 +1,5 @@ Source: osptoolkit -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: TransNexus +Maintainer: TransNexus Uploaders: Di-Shi Sun Section: utils Priority: optional diff -Nru osptoolkit-4.11.3+dfsg/debian/copyright osptoolkit-4.13.0/debian/copyright --- osptoolkit-4.11.3+dfsg/debian/copyright 2016-06-15 01:23:15.000000000 +0000 +++ osptoolkit-4.13.0/debian/copyright 2017-02-13 09:40:51.000000000 +0000 @@ -4,11 +4,11 @@ Source: https://sourceforge.net/projects/osp-toolkit Files: * -Copyright: 2004-2016 TransNexus, Inc. +Copyright: 2016-2017 TransNexus, Inc. License: BSD-3-Clause Files: debian/* -Copyright: 2016 TransNexus, Inc. +Copyright: 2017 TransNexus, Inc. License: BSD-3-Clause License: BSD-3-Clause diff -Nru osptoolkit-4.11.3+dfsg/debian/libosptk4.symbols osptoolkit-4.13.0/debian/libosptk4.symbols --- osptoolkit-4.11.3+dfsg/debian/libosptk4.symbols 2016-06-24 10:04:36.000000000 +0000 +++ osptoolkit-4.13.0/debian/libosptk4.symbols 2017-02-13 09:40:51.000000000 +0000 @@ -243,6 +243,7 @@ OSPPCryptoWrapVerify@Base 4.11.3 OSPPCustomInfoToElement@Base 4.11.3 OSPPDestAddToken@Base 4.11.3 + OSPPDestAltFromElement@Base 4.13.0 OSPPDestDelete@Base 4.11.3 OSPPDestDevGetAddr@Base 4.11.3 OSPPDestDevHasAddr@Base 4.11.3 @@ -734,6 +735,7 @@ OSPPTransactionGetDeleteAllowed@Base 4.11.3 OSPPTransactionGetDestAllowed@Base 4.11.3 OSPPTransactionGetDestProtocol@Base 4.11.3 + OSPPTransactionGetDestSwitchId@Base 4.13.0 OSPPTransactionGetDestination@Base 4.11.3 OSPPTransactionGetDestinationNetworkId@Base 4.11.3 OSPPTransactionGetFirstDestination@Base 4.11.3 @@ -770,12 +772,15 @@ OSPPTransactionSetCallCategory@Base 4.11.3 OSPPTransactionSetCallPartyInfo@Base 4.11.3 OSPPTransactionSetCallType@Base 4.11.3 + OSPPTransactionSetChargingVector@Base 4.13.0 OSPPTransactionSetCodec@Base 4.11.3 OSPPTransactionSetCustomInfo@Base 4.11.3 OSPPTransactionSetDelay@Base 4.11.3 OSPPTransactionSetDestAudioAddr@Base 4.11.3 OSPPTransactionSetDestNetworkId@Base 4.11.3 OSPPTransactionSetDestRealm@Base 4.11.3 + OSPPTransactionSetDestServiceProvider@Base 4.13.0 + OSPPTransactionSetDestSwitchId@Base 4.13.0 OSPPTransactionSetDestVideoAddr@Base 4.11.3 OSPPTransactionSetDestinationCount@Base 4.11.3 OSPPTransactionSetDiversion@Base 4.11.3 @@ -812,6 +817,7 @@ OSPPTransactionSetSrcAudioAddr@Base 4.11.3 OSPPTransactionSetSrcNetworkId@Base 4.11.3 OSPPTransactionSetSrcRealm@Base 4.11.3 + OSPPTransactionSetSrcSwitchId@Base 4.13.0 OSPPTransactionSetSrcVideoAddr@Base 4.11.3 OSPPTransactionSetState@Base 4.11.3 OSPPTransactionSetSystemId@Base 4.11.3 diff -Nru osptoolkit-4.11.3+dfsg/debian/osptoolkit.docs osptoolkit-4.13.0/debian/osptoolkit.docs --- osptoolkit-4.11.3+dfsg/debian/osptoolkit.docs 2016-06-09 09:10:39.000000000 +0000 +++ osptoolkit-4.13.0/debian/osptoolkit.docs 2017-02-13 09:40:51.000000000 +0000 @@ -1,3 +1,2 @@ -LICENSE.txt README.txt RELNOTES.txt diff -Nru osptoolkit-4.11.3+dfsg/debian/osptoolkit.txt osptoolkit-4.13.0/debian/osptoolkit.txt --- osptoolkit-4.11.3+dfsg/debian/osptoolkit.txt 2016-06-23 13:35:08.000000000 +0000 +++ osptoolkit-4.13.0/debian/osptoolkit.txt 2017-02-13 09:40:51.000000000 +0000 @@ -40,7 +40,7 @@ The OSP Toolkit is a shared library comprised of OSP client functions that simplify sending and receiving OSP peering messages. It is this library, which will be integrated into the SIP proxy. The OSP Toolkit uses third party software (by default OpenSSL) for cryptographic algorithms and for secure internet transactions (HTTPS). The OSP Toolkit also includes the application enroll which enables the OSP client device to generate its own public-private key pair, get the public key from an OSP peering server, send a certificate request to a peering server and receive the resulting signed certificate from the peering server. - There are three OSP Toolkit packages for Debian. The osptoolkit package contains the OSP Toolkit enroll application and a test application. The libosptk-4.11.3 package contains the OSP Toolkit run-time shared library. The libosptk-dev package contains the OSP Toolkit header files and static library. + There are three OSP Toolkit packages for Debian. The osptoolkit package contains the OSP Toolkit enroll application and a test application. The libosptk-4.13.0 package contains the OSP Toolkit run-time shared library. The libosptk-dev package contains the OSP Toolkit header files and static library. In order to successfully install and use the OSP Toolkit, the following list of software is required: @@ -48,18 +48,18 @@ * OSP Server (required for testing) - Two open source OSP server projects are available. OpenOSP, an OSP server written in C code, is located at http://www.vovida.org/applications/downloads/openosp. RAMS, a Java based OSP server, is located at http://sourceforge.net/projects/rams. Also, a free version of the TransNexus commercial OSP server can be downloaded from www.transnexus.com/OSP%20Toolkit/Peering_Server/VoIP_Peering_Server.htm. - After downloading the OSP Toolkit packages for Debian, osptoolkit and libosptk-4.11.3, perform the following steps in order: + After downloading the OSP Toolkit packages for Debian, osptoolkit and libosptk-4.13.0, perform the following steps in order: * Copy the OSP Toolkit packages into the temporary directory. * Login as root and execute the following command: - dpkg 每i libosptk-4.11.3_###_$$$.deb - Where ### is the version number separated by dots and dash and $$$ is the platform type. For example, if the version is 4.11.3-1 and platform type is i386 then the above commands would be: - dpkg 每i libosptk-4.11.3_4.11.3-1_i386.deb + dpkg 每i libosptk-4.13.0_###_$$$.deb + Where ### is the version number separated by dots and dash and $$$ is the platform type. For example, if the version is 4.13.0-1 and platform type is i386 then the above commands would be: + dpkg 每i libosptk-4.13.0_4.13.0-1_i386.deb By default, it will install the OSP Toolkit run-time shared library, libosptk.so, into /usr/lib directory. * Execute the following command: dpkg 每I osptoolkit_###_$$$.deb - Where ### is the version number separated by dots and dash and $$$ is the platform type. For example, if the version is 4.11.3-1 and platform type is i386 then the above commands would be: - dpkg 每I osptoolkit_4.11.3-1_i386.deb + Where ### is the version number separated by dots and dash and $$$ is the platform type. For example, if the version is 4.13.0-1 and platform type is i386 then the above commands would be: + dpkg 每I osptoolkit_4.13.0-1_i386.deb By default, it will install OSP Toolkit enroll and the test applications into /usr/bin directory. Enroll SIP proxy on Debian with a Peering Server diff -Nru osptoolkit-4.11.3+dfsg/debian/patches/enroll.sh.patch osptoolkit-4.13.0/debian/patches/enroll.sh.patch --- osptoolkit-4.11.3+dfsg/debian/patches/enroll.sh.patch 2016-06-13 02:21:05.000000000 +0000 +++ osptoolkit-4.13.0/debian/patches/enroll.sh.patch 2017-02-13 09:40:51.000000000 +0000 @@ -1,12 +1,10 @@ Description: Changes for Debian osptoolkit package path. Forwarded: not-needed From: Di-Shi Sun -Last-Update: 2016-06-13 +Last-Update: 2017-02-13 -Index: osptoolkit-4.11.3/bin/enroll.sh -=================================================================== ---- osptoolkit-4.11.3.orig/bin/enroll.sh -+++ osptoolkit-4.11.3/bin/enroll.sh +--- a/bin/enroll.sh ++++ b/bin/enroll.sh @@ -7,7 +7,9 @@ # # # This shell script is used to enroll the device with the Server # @@ -18,7 +16,7 @@ export OPENSSL_CONF RANDFILE=./.rnd export RANDFILE -@@ -26,7 +28,7 @@ echo "Request Failed" +@@ -26,7 +28,7 @@ exit 127 fi @@ -27,7 +25,7 @@ ret_val=$? export ret_val echo "[SP: $1]Error Code returned from getcacert command :" $ret_val -@@ -35,7 +37,7 @@ echo "Request Failed" +@@ -35,7 +37,7 @@ exit 127 fi @@ -36,7 +34,7 @@ ret_val=$? export ret_val echo "Error Code returned from localcert command :" $ret_val -@@ -47,7 +49,7 @@ fi +@@ -47,7 +49,7 @@ i=1 shift while [ $# -ge 1 ]; do diff -Nru osptoolkit-4.11.3+dfsg/debian/patches/fix_latest_glibc_float.patch osptoolkit-4.13.0/debian/patches/fix_latest_glibc_float.patch --- osptoolkit-4.11.3+dfsg/debian/patches/fix_latest_glibc_float.patch 2017-02-09 08:00:32.000000000 +0000 +++ osptoolkit-4.13.0/debian/patches/fix_latest_glibc_float.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -Description: Fix compilation with latest glibc by applying float correctly. -Author: Bhavani Shankar -Bug-Debian: https://bugs.debian.org/830444 - ---- osptoolkit-4.11.3+dfsg.orig/src/osptransapi.c -+++ osptoolkit-4.11.3+dfsg/src/osptransapi.c -@@ -1038,7 +1038,7 @@ int OSPPTransactionAccumulateTwoWayDelay - /* sample mean - have to cast Samples to a float to get some precision on the mean */ - mean = ((metrics.mean * currnumber) + (ospvMean * ospvSamples)) / (float)metrics.samples; - -- OSPM_ISNAN(metrics.mean, tnisnan); -+ OSPM_ISNAN(mean, tnisnan); - - if (tnisnan) { - errcode = OSPC_ERR_TRAN_INVALID_CALC; diff -Nru osptoolkit-4.11.3+dfsg/debian/patches/LICENSE.txt.patch osptoolkit-4.13.0/debian/patches/LICENSE.txt.patch --- osptoolkit-4.11.3+dfsg/debian/patches/LICENSE.txt.patch 1970-01-01 00:00:00.000000000 +0000 +++ osptoolkit-4.13.0/debian/patches/LICENSE.txt.patch 2017-02-13 09:40:51.000000000 +0000 @@ -0,0 +1,21 @@ +Description: Removed for lintian warning message. +Forwarded: not-needed +From: Di-Shi Sun +Last-Update: 2017-02-21 + +--- a/LICENSE.txt ++++ /dev/null +@@ -1,13 +0,0 @@ +-OSP ToolkitTM +- +-BSD License Agreement +- +-Copyright (c) 2004, TransNexus, Inc.; Atlanta, GA USA +-All rights reserved. +- +-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +- +-Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +-Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +-Neither the name of the TransNexus, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. +-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff -Nru osptoolkit-4.11.3+dfsg/debian/patches/Makefile.patch osptoolkit-4.13.0/debian/patches/Makefile.patch --- osptoolkit-4.11.3+dfsg/debian/patches/Makefile.patch 2016-06-24 11:40:22.000000000 +0000 +++ osptoolkit-4.13.0/debian/patches/Makefile.patch 2017-02-13 09:40:51.000000000 +0000 @@ -1,12 +1,10 @@ Description: Makefile created for Debian osptoolkit packages. Forwarded: not-needed From: Di-Shi Sun -Last-Update: 2016-06-13 +Last-Update: 2017-02-13 -Index: osptoolkit-4.11.3/Makefile -=================================================================== --- /dev/null -+++ osptoolkit-4.11.3/Makefile ++++ b/Makefile @@ -0,0 +1,210 @@ +# +# OSP Toolkit Makefile for Debian diff -Nru osptoolkit-4.11.3+dfsg/debian/patches/ospcryptowrap.c.patch osptoolkit-4.13.0/debian/patches/ospcryptowrap.c.patch --- osptoolkit-4.11.3+dfsg/debian/patches/ospcryptowrap.c.patch 1970-01-01 00:00:00.000000000 +0000 +++ osptoolkit-4.13.0/debian/patches/ospcryptowrap.c.patch 2017-02-13 09:40:51.000000000 +0000 @@ -0,0 +1,149 @@ +Description: Changes for OpenSSL 1.1.0. +Forwarded: no +From: Di-Shi Sun +Last-Update: 2017-02-21 + +--- a/src/ospcryptowrap.c ++++ b/src/ospcryptowrap.c +@@ -45,7 +45,12 @@ + unsigned char digestedData[OSPC_CRYPTO_DIGEST_BUFFER_MAXLENGTH]; + unsigned int digestedDataLength = 0; + +- EVP_MD_CTX ctx; ++#if (OPENSSL_VERSION_NUMBER >= 0x010100000) ++ EVP_MD_CTX *ctx; ++#else ++ EVP_MD_CTX ctxbuf; ++ EVP_MD_CTX *ctx = &ctxbuf; ++#endif + EVP_MD *type = OSPC_OSNULL; + + OSPM_ARGUSED(ospvFlags); +@@ -60,9 +65,15 @@ + + if (type) { + /* Calcualte digest */ +- EVP_DigestInit(&ctx, type); +- EVP_DigestUpdate(&ctx, ospvData, ospvDataLength); +- EVP_DigestFinal(&ctx, digestedData, &digestedDataLength); ++#if (OPENSSL_VERSION_NUMBER >= 0x010100000) ++ ctx = EVP_MD_CTX_new(); ++#endif ++ EVP_DigestInit(ctx, type); ++ EVP_DigestUpdate(ctx, ospvData, ospvDataLength); ++ EVP_DigestFinal(ctx, digestedData, &digestedDataLength); ++#if (OPENSSL_VERSION_NUMBER >= 0x010100000) ++ EVP_MD_CTX_free(ctx); ++#endif + errorcode = OSPC_ERR_NO_ERROR; + } else { + OSPM_DBGERRORLOG(errorcode, "Error setting digest type"); +@@ -127,10 +138,7 @@ + unsigned char decryptedData[OSPC_CRYPTO_ENCRYPT_BUFFER_MAXLENGTH]; + unsigned int decryptedDataLength = 0; + +- X509_PUBKEY *pX509PubKey = OSPC_OSNULL; + RSA *pRSAPubKey = OSPC_OSNULL; +- unsigned char *pData = OSPC_OSNULL; +- unsigned int len = 0; + + OSPM_ARGUSED(ospvFlags); + OSPM_ARGUSED(ospvBERAlgorithm); +@@ -139,34 +147,21 @@ + OSPTNLOGDUMP(ospvEncryptedData, ospvEncryptedDataLength, "DECRYPT: ospvEncryptedData"); + OSPTNLOGDUMP(ospvBERReaderKey, ospvBERReaderKeyLength, "DECRYPT: ospvBERReaderKey"); + +- pX509PubKey = d2i_X509_PUBKEY(NULL, (const unsigned char **)(&ospvBERReaderKey), ospvBERReaderKeyLength); +- +- if (pX509PubKey) { +- pData = pX509PubKey->public_key->data; +- len = pX509PubKey->public_key->length; +- pRSAPubKey = d2i_RSAPublicKey(NULL, (const unsigned char **)&pData, len); +- +- if (pRSAPubKey) { +- decryptedDataLength = RSA_public_decrypt(ospvEncryptedDataLength, ospvEncryptedData, decryptedData, pRSAPubKey, RSA_PKCS1_PADDING); +- if (decryptedDataLength != -1) { +- errorcode = OSPC_ERR_NO_ERROR; +- } else { +- OSPM_DBGERRORLOG(errorcode, "Failed to decrypt message"); +- } +- +- /* Free up mem */ +- RSA_free(pRSAPubKey); ++ pRSAPubKey = d2i_RSA_PUBKEY(NULL, (const unsigned char **)(&ospvBERReaderKey), ospvBERReaderKeyLength); ++ if (pRSAPubKey) { ++ decryptedDataLength = RSA_public_decrypt(ospvEncryptedDataLength, ospvEncryptedData, decryptedData, pRSAPubKey, RSA_PKCS1_PADDING); ++ if (decryptedDataLength != -1) { ++ errorcode = OSPC_ERR_NO_ERROR; + } else { +- OSPM_DBGERRORLOG(errorcode, "Failed to init RSA key"); ++ OSPM_DBGERRORLOG(errorcode, "Failed to decrypt message"); + } + + /* Free up mem */ +- X509_PUBKEY_free(pX509PubKey); ++ RSA_free(pRSAPubKey); + } else { +- OSPM_DBGERRORLOG(errorcode, "Failed to init X509_PUBKEY"); ++ OSPM_DBGERRORLOG(errorcode, "Failed to init RSA key"); + } + +- + /* Copy results to OUT params */ + if (errorcode == OSPC_ERR_NO_ERROR) { + if (ospvDecryptedData == OSPC_OSNULL) { +@@ -202,10 +197,7 @@ + int errorcode = OSPC_ERR_CRYPTO_IMPLEMENTATION_SPECIFIC_ERROR; + unsigned char digestedData[OSPC_CRYPTO_DIGEST_BUFFER_MAXLENGTH]; + unsigned int digestedDataLength = OSPC_CRYPTO_DIGEST_BUFFER_MAXLENGTH; +- X509_PUBKEY *pX509PubKey = OSPC_OSNULL; + RSA *pRSAPubKey = OSPC_OSNULL; +- unsigned char *pData = OSPC_OSNULL; +- unsigned int len = 0; + int type = NID_md5; + + OSPM_ARGUSED(ospvFlags); +@@ -214,34 +206,22 @@ + OSPTNLOGDUMP(ospvSignature, ospvSignatureLength, "VERIFY: ospvSignature"); + OSPTNLOGDUMP(ospvBERReaderKey, ospvBERReaderKeyLength, "VERIFY: ospvBERReaderKey"); + +- pX509PubKey = d2i_X509_PUBKEY(NULL, (const unsigned char **)(&ospvBERReaderKey), ospvBERReaderKeyLength); +- +- if (pX509PubKey) { +- pData = pX509PubKey->public_key->data; +- len = pX509PubKey->public_key->length; +- pRSAPubKey = d2i_RSAPublicKey(NULL, (const unsigned char **)&pData, len); +- +- if (pRSAPubKey) { +- if (OSPC_ERR_NO_ERROR == OSPPCryptoWrapDigest(digestedData, &digestedDataLength, OSPC_OSNULL, 0, ospvData, ospvDataLength, 0)) { +- if (1 == RSA_verify(type, digestedData, digestedDataLength, ospvSignature, ospvSignatureLength, pRSAPubKey)) { +- errorcode = OSPC_ERR_NO_ERROR; +- } else { +- OSPM_DBGERRORLOG(errorcode, "Open-SSL error occurred in Verify"); +- } ++ pRSAPubKey = d2i_RSA_PUBKEY(NULL, (const unsigned char **)(&ospvBERReaderKey), ospvBERReaderKeyLength); ++ if (pRSAPubKey) { ++ if (OSPC_ERR_NO_ERROR == OSPPCryptoWrapDigest(digestedData, &digestedDataLength, OSPC_OSNULL, 0, ospvData, ospvDataLength, 0)) { ++ if (1 == RSA_verify(type, digestedData, digestedDataLength, ospvSignature, ospvSignatureLength, pRSAPubKey)) { ++ errorcode = OSPC_ERR_NO_ERROR; + } else { +- OSPM_DBGERRORLOG(errorcode, "Failed to calculate digest"); ++ OSPM_DBGERRORLOG(errorcode, "Open-SSL error occurred in Verify"); + } +- +- /* Free up mem */ +- RSA_free(pRSAPubKey); + } else { +- OSPM_DBGERRORLOG(errorcode, "Failed to init RSA key"); ++ OSPM_DBGERRORLOG(errorcode, "Failed to calculate digest"); + } + + /* Free up mem */ +- X509_PUBKEY_free(pX509PubKey); ++ RSA_free(pRSAPubKey); + } else { +- OSPM_DBGERRORLOG(errorcode, "Failed to init X509_PUBKEY"); ++ OSPM_DBGERRORLOG(errorcode, "Failed to init RSA key"); + } + + return errorcode; diff -Nru osptoolkit-4.11.3+dfsg/debian/patches/ospopenssl.c.patch osptoolkit-4.13.0/debian/patches/ospopenssl.c.patch --- osptoolkit-4.11.3+dfsg/debian/patches/ospopenssl.c.patch 1970-01-01 00:00:00.000000000 +0000 +++ osptoolkit-4.13.0/debian/patches/ospopenssl.c.patch 2017-02-13 09:40:51.000000000 +0000 @@ -0,0 +1,45 @@ +Description: Changes for OpenSSL 1.1.0. +Forwarded: no +From: Di-Shi Sun +Last-Update: 2017-02-21 + +--- a/src/ospopenssl.c ++++ b/src/ospopenssl.c +@@ -84,7 +84,11 @@ + * function. It will be done only once now, rather than with every ProviderNew + */ + ctx = (SSL_CTX **)&(security->ContextRef); ++#if (OPENSSL_VERSION_NUMBER >= 0x010100000) ++ version = TLS_client_method(); ++#else + version = TLSv1_client_method(); ++#endif + *ctx = SSL_CTX_new(version); + + if (*ctx != OSPC_OSNULL) { +@@ -508,21 +512,21 @@ + ok = 0; + } + } +- switch (ctx->error) { ++ switch (err) { + case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: +- X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert), buf, 256); ++ X509_NAME_oneline(X509_get_issuer_name(err_cert), buf, 256); + BIO_printf(bio_stdout, "issuer= %s\n", buf); + break; + case X509_V_ERR_CERT_NOT_YET_VALID: + case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: + BIO_printf(bio_stdout, "notBefore="); +- ASN1_TIME_print(bio_stdout, X509_get_notBefore(ctx->current_cert)); ++ ASN1_TIME_print(bio_stdout, X509_get_notBefore(err_cert)); + BIO_printf(bio_stdout, "\n"); + break; + case X509_V_ERR_CERT_HAS_EXPIRED: + case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: + BIO_printf(bio_stdout, "notAfter="); +- ASN1_TIME_print(bio_stdout, X509_get_notAfter(ctx->current_cert)); ++ ASN1_TIME_print(bio_stdout, X509_get_notAfter(err_cert)); + BIO_printf(bio_stdout, "\n"); + break; + } diff -Nru osptoolkit-4.11.3+dfsg/debian/patches/osptransapi.c.patch osptoolkit-4.13.0/debian/patches/osptransapi.c.patch --- osptoolkit-4.11.3+dfsg/debian/patches/osptransapi.c.patch 1970-01-01 00:00:00.000000000 +0000 +++ osptoolkit-4.13.0/debian/patches/osptransapi.c.patch 2017-02-13 09:40:51.000000000 +0000 @@ -0,0 +1,25 @@ +Description: Changes for gcc and ABI issues. +Forwarded: no +From: Di-Shi Sun +Last-Update: 2017-02-13 + +--- a/src/osptransapi.c ++++ b/src/osptransapi.c +@@ -983,7 +983,7 @@ + /* sample mean - have to cast Samples to a float to get some precision on the mean */ + mean = ((metrics.mean * currnumber) + (ospvMean * ospvSamples)) / (float)metrics.samples; + +- OSPM_ISNAN(metrics.mean, tnisnan); ++ OSPM_ISNAN(((float)metrics.mean), tnisnan); + + if (tnisnan) { + errcode = OSPC_ERR_TRAN_INVALID_CALC; +@@ -5297,7 +5297,7 @@ + return errcode; + } + +-int OSPPTransactionSetSrcServiceProvider( ++int OSPPTransactionSetServiceProvider( + OSPTTRANHANDLE ospvTransaction, /* In - Transaction handle */ + const char *ospvServiceProvider) /* In - Service provider */ + { diff -Nru osptoolkit-4.11.3+dfsg/debian/patches/osptransapi.h.patch osptoolkit-4.13.0/debian/patches/osptransapi.h.patch --- osptoolkit-4.11.3+dfsg/debian/patches/osptransapi.h.patch 1970-01-01 00:00:00.000000000 +0000 +++ osptoolkit-4.13.0/debian/patches/osptransapi.h.patch 2017-02-13 09:40:51.000000000 +0000 @@ -0,0 +1,17 @@ +Description: Change for ABI issue. +Forwarded: no +From: Di-Shi Sun +Last-Update: 2017-02-28 + +--- a/include/osp/osptransapi.h ++++ b/include/osp/osptransapi.h +@@ -136,7 +136,8 @@ + int OSPPTransactionSetTransferId(OSPTTRANHANDLE, const char*); + int OSPPTransactionSetTransferStatus(OSPTTRANHANDLE, OSPE_TRANSFER_STATUS); + int OSPPTransactionSetNetworkTranslatedCalledNumber(OSPTTRANHANDLE, OSPE_NUMBER_FORMAT, const char *); +- int OSPPTransactionSetSrcServiceProvider(OSPTTRANHANDLE, const char *); ++ int OSPPTransactionSetServiceProvider(OSPTTRANHANDLE, const char *); ++#define OSPPTransactionSetSrcServiceProvider(transaction, provider) OSPPTransactionSetServiceProvider(transaction, provider); + int OSPPTransactionSetDestServiceProvider(OSPTTRANHANDLE, const char *); + int OSPPTransactionSetSystemId(OSPTTRANHANDLE, const char *); + int OSPPTransactionSetRelatedReason(OSPTTRANHANDLE, const char *); diff -Nru osptoolkit-4.11.3+dfsg/debian/patches/series osptoolkit-4.13.0/debian/patches/series --- osptoolkit-4.11.3+dfsg/debian/patches/series 2017-02-09 07:55:01.000000000 +0000 +++ osptoolkit-4.13.0/debian/patches/series 2017-02-13 09:40:51.000000000 +0000 @@ -1,4 +1,7 @@ -Makefile.patch +osptransapi.h.patch +osptransapi.c.patch +ospopenssl.c.patch +ospcryptowrap.c.patch +LICENSE.txt.patch enroll.sh.patch -test_app.c.patch -fix_latest_glibc_float.patch +Makefile.patch diff -Nru osptoolkit-4.11.3+dfsg/debian/patches/test_app.c.patch osptoolkit-4.13.0/debian/patches/test_app.c.patch --- osptoolkit-4.11.3+dfsg/debian/patches/test_app.c.patch 2016-06-24 07:53:24.000000000 +0000 +++ osptoolkit-4.13.0/debian/patches/test_app.c.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,341 +0,0 @@ -Description: Changes for compile warn and error on Debian. -Forwarded: no -From: Di-Shi Sun -Last-Update: 2016-06-13 - -Index: osptoolkit-4.11.3/test/test_app.c -=================================================================== ---- osptoolkit-4.11.3.orig/test/test_app.c -+++ osptoolkit-4.11.3/test/test_app.c -@@ -1075,74 +1075,106 @@ int testSetDestinationCount() - - printf("Enter destination count (0 if N/A)"); - -- scanf("%d", &destinationCount); -- getchar(); -- -- printf("Setting destination count to %d\n", destinationCount); -+ if (scanf("%d", &destinationCount) == 1) { -+ printf("Setting destination count to %d\n", destinationCount); -+ errcode = OSPPTransactionSetDestinationCount(OSPVTransactionHandle, destinationCount); -+ } else { -+ errcode = -1; -+ } - -- errcode = OSPPTransactionSetDestinationCount(OSPVTransactionHandle, destinationCount); -+ getchar(); - - return errcode; - } - - int testSetDuration() - { -+ int errcode = 0; -+ - printf("Enter duration (in seconds) : "); - -- scanf("%d", &duration); -+ if (scanf("%d", &duration) != 1) { -+ errcode = -1; -+ } -+ - getchar(); - -- return 0; -+ return errcode; - } - - int testSetTCCode() - { -+ int errcode = 0; -+ - printf("Enter TC Code: "); - -- scanf("%d", &TCcode); -+ if (scanf("%d", &TCcode) != 1) { -+ errcode = -1; -+ } -+ - getchar(); - -- return 0; -+ return errcode; - } - - int testSetStartTime() - { -+ int errcode = 0; -+ - printf("Enter Call Start Time (in seconds since 1970 GMT) : "); - -- scanf("%ld", &call_start_time); -+ if (scanf("%ld", &call_start_time) != 1) { -+ errcode = -1; -+ } -+ - getchar(); - -- return 0; -+ return errcode; - } - - int testSetEndTime() - { -+ int errcode = 0; -+ - printf("Enter Call End Time (in seconds since 1970 GMT) : "); - -- scanf("%ld", &call_end_time); -+ if (scanf("%ld", &call_end_time) != 1) { -+ errcode = -1; -+ } -+ - getchar(); - -- return 0; -+ return errcode; - } - - int testSetAlertTime() - { -+ int errcode = 0; -+ - printf("Enter Call Alert Time (in seconds since 1970 GMT) : "); - -- scanf("%ld", &call_alert_time); -+ if (scanf("%ld", &call_alert_time) != 1) { -+ errcode = -1; -+ } -+ - getchar(); - -- return 0; -+ return errcode; - } - - int testSetConnectTime() - { -+ int errcode = 0; -+ - printf("Enter Call Connect Time (in seconds since 1970 GMT) : "); - -- scanf("%ld", &call_connect_time); -+ if (scanf("%ld", &call_connect_time) != 1) { -+ errcode = -1; -+ } -+ - getchar(); - -- return 0; -+ return errcode; - } - - int testSetServiceType() -@@ -1709,11 +1741,14 @@ int testOSPPSecSignatureVerify() - } - - if (errcode == OSPC_ERR_NO_ERROR) { -- _Read(tokenfd, (unsigned char *)&signatureLength, 4); -- -- OSPM_MALLOC(signature, unsigned char, signatureLength); -- -- _Read(tokenfd, signature, signatureLength); -+ if (_Read(tokenfd, (unsigned char *)&signatureLength, 4) == 4) { -+ OSPM_MALLOC(signature, unsigned char, signatureLength); -+ if (_Read(tokenfd, signature, signatureLength) != signatureLength) { -+ errcode = -1; -+ } -+ } else { -+ errcode = -1; -+ } - - _Close(tokenfd); - } -@@ -1862,7 +1897,7 @@ int testSetOperatorName() - - int testSetSIPHeaders() - { -- const unsigned number = 3; -+ #define number 3 - const char *fingerprints[number] = { "fingerprint1", "fingerprint2", "fingerprint3" }; - int errcode = 0; - -@@ -2395,8 +2430,8 @@ int testSetIdentity() - const char *type = "Type"; - const char *canon = "Canon"; - int errcode = 0; --errcode = OSPPTransactionSetIdentity(OSPVTransactionHandle, strlen(sign), (const unsigned char *)sign, alg, info, type, strlen(canon), (const unsigned char *)canon); - -+ errcode = OSPPTransactionSetIdentity(OSPVTransactionHandle, strlen(sign), (const unsigned char *)sign, alg, info, type, strlen(canon), (const unsigned char *)canon); - - return errcode; - } -@@ -2565,16 +2600,21 @@ int testAPI(int apinumber) - break; - case 43: - printf("Build a new transaction ? Press 1 for Yes, 0 for No : "); -- scanf("%d", &build_new_trans); -+ if (scanf("%d", &build_new_trans) == 1) { -+ errcode = testBuildUsageFromScratch(OSPC_ROLE_SOURCE, build_new_trans); -+ } else { -+ errcode = -1; -+ } - getchar(); -- errcode = testBuildUsageFromScratch(OSPC_ROLE_SOURCE, build_new_trans); - break; - case 44: - printf("Build a new transaction ? Press 1 for Yes, 0 for No : "); -- scanf("%d", &build_new_trans); -+ if (scanf("%d", &build_new_trans) == 1) { -+ errcode = testBuildUsageFromScratch(OSPC_ROLE_DESTINATION, build_new_trans); -+ } else { -+ errcode = -1; -+ } - getchar(); -- errcode = -- testBuildUsageFromScratch(OSPC_ROLE_DESTINATION, build_new_trans); - break; - case 45: - errcode = testOSPPTransactionGetLookAheadInfoIfPresent(); -@@ -2631,42 +2671,46 @@ int testAPI(int apinumber) - break; - case 100: - printf("Enter the number of Providers to be created .. "); -- scanf("%d", &num_providers); -- getchar(); -- if (num_providers > OSPC_MAX_PROVIDERS) { -- printf("Cannot run the test. The entered value is greater than the maximum providers allowed\n"); -- errcode = OSPC_ERR_PROV_MAX_PROVIDERS; -- } else { -- printf("Enter the number of Transactions to be run .. "); -- scanf("%d", &trans_to_run); -- getchar(); -- if (2 * trans_to_run > OSPC_MAX_TRANS) { -- errcode = OSPC_ERR_TRAN_NO_TRANS_SPACE; -- printf("Cannot run the test. The entered value is greater than the maximum transactions allowed\n"); -- } -- -- if ((errcode == 0) && (trans_to_run > MAX_QUEUE_SIZE)) { -- printf("Warning !!! The toolkit may not be able to process - %d calls because the maximum queue size is - %d\n", -- trans_to_run, MAX_QUEUE_SIZE); -- } -- -- /* -- * Launch the threads -- */ -- if (errcode == 0) { -- for (i = 0; i < num_providers; i++) { -- OSPM_CREATE_THREAD(MultProviderThrId[i], -- NULL, -- testNonBlockingPerformanceTest, -- (void *)&trans_to_run, errcode); -- -- printf("Created Thread [%d] with thread id: [%lu]\n", i, (unsigned long int)MultProviderThrId[i]); -- } -- for (i = 0; i < num_providers; i++) { -- OSPM_THR_JOIN(MultProviderThrId[i], NULL); -+ if (scanf("%d", &num_providers) == 1) { -+ if (num_providers > OSPC_MAX_PROVIDERS) { -+ printf("Cannot run the test. The entered value is greater than the maximum providers allowed\n"); -+ errcode = OSPC_ERR_PROV_MAX_PROVIDERS; -+ } else { -+ printf("Enter the number of Transactions to be run .. "); -+ if (scanf("%d", &trans_to_run) == 1) { -+ if (2 * trans_to_run > OSPC_MAX_TRANS) { -+ errcode = OSPC_ERR_TRAN_NO_TRANS_SPACE; -+ printf("Cannot run the test. The entered value is greater than the maximum transactions allowed\n"); -+ } -+ -+ if ((errcode == 0) && (trans_to_run > MAX_QUEUE_SIZE)) { -+ printf("Warning !!! The toolkit may not be able to process - %d calls because the maximum queue size is - %d\n", -+ trans_to_run, MAX_QUEUE_SIZE); -+ } -+ -+ /* -+ * Launch the threads -+ */ -+ if (errcode == 0) { -+ for (i = 0; i < num_providers; i++) { -+ OSPM_CREATE_THREAD(MultProviderThrId[i], -+ NULL, -+ testNonBlockingPerformanceTest, -+ (void *)&trans_to_run, errcode); -+ -+ printf("Created Thread [%d] with thread id: [%lu]\n", i, (unsigned long int)MultProviderThrId[i]); -+ } -+ for (i = 0; i < num_providers; i++) { -+ OSPM_THR_JOIN(MultProviderThrId[i], NULL); -+ } -+ } - } -+ getchar(); - } -+ } else { -+ errcode = -1; - } -+ getchar(); - break; - case 101: - errcode = testNonBlockingPerformanceTestForCapabilities(); -@@ -2711,7 +2755,7 @@ int testAPI(int apinumber) - errcode = testSetSessionId(); - break; - case 224: -- errcode = testSetCustomInfo(true); -+ errcode = testSetCustomInfo(1); - break; - case 225: - errcode = testSetReleaseSource(); -@@ -2844,7 +2888,7 @@ int testAPI(int apinumber) - errcode = testSetCallingPartyInfo(); - } - if (errcode == OSPC_ERR_NO_ERROR) { -- errcode = testSetCustomInfo(true); -+ errcode = testSetCustomInfo(1); - } - if (errcode == OSPC_ERR_NO_ERROR) { - errcode = testSetIdentity(); -@@ -2909,7 +2953,7 @@ int testAPI(int apinumber) - errcode = testSetSessionId(); - } - if (errcode == OSPC_ERR_NO_ERROR) { -- errcode = testSetCustomInfo(false); -+ errcode = testSetCustomInfo(0); - } - if (errcode == OSPC_ERR_NO_ERROR) { - errcode = testSetReleaseSource(); -@@ -3102,11 +3146,15 @@ int testMenu() - printf("---------------------------------------------------------------------\n"); - printf("Enter function number or 'q' to quit => "); - } -- fgets(inbuf, 256, stdin); -- if (inbuf[0] == 'q' || inbuf[0] == 'Q') -- funcnum = -1; -- else -- funcnum = atoi(inbuf); -+ if (fgets(inbuf, 256, stdin) != NULL) { -+ if (inbuf[0] == 'q' || inbuf[0] == 'Q') { -+ funcnum = -1; -+ } else { -+ funcnum = atoi(inbuf); -+ } -+ } else { -+ funcnum = 0; -+ } - - return funcnum; - } -@@ -3791,9 +3839,11 @@ int testNonBlockingPerformanceTestForCap - - fflush(stdin); - printf("Enter the number of Simultaneous Calls : "); -- scanf("%d", &TEST_NUM); -+ if (scanf("%d", &TEST_NUM) != 1) { -+ TEST_NUM = OSPC_MAX_TRANS > MAX_QUEUE_SIZE ? MAX_QUEUE_SIZE : OSPC_MAX_TRANS; -+ } - -- if ((TEST_NUM) > OSPC_MAX_TRANS) -+ if (TEST_NUM > OSPC_MAX_TRANS) - printf("Warning !! The toolkit may not be able to process - %d Calls because the maximum transactions that can be created is - %d\n", - TEST_NUM, OSPC_MAX_TRANS); - diff -Nru osptoolkit-4.11.3+dfsg/debian/rules osptoolkit-4.13.0/debian/rules --- osptoolkit-4.11.3+dfsg/debian/rules 2016-06-24 11:27:08.000000000 +0000 +++ osptoolkit-4.13.0/debian/rules 2017-02-13 09:40:51.000000000 +0000 @@ -4,7 +4,7 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all -version=4.11.3 +version=4.13.0 major=4 %: diff -Nru osptoolkit-4.11.3+dfsg/include/osp/ospaltinfo.h osptoolkit-4.13.0/include/osp/ospaltinfo.h --- osptoolkit-4.11.3+dfsg/include/osp/ospaltinfo.h 2015-12-16 02:28:56.000000000 +0000 +++ osptoolkit-4.13.0/include/osp/ospaltinfo.h 2016-09-01 02:52:48.000000000 +0000 @@ -60,6 +60,11 @@ OSPC_ALTINFO_INGRESS, OSPC_ALTINFO_EGRESS, OSPC_ALTINFO_CNAM, + OSPC_ALTINFO_SWITCHID, + OSPC_ALTINFO_ICID, + OSPC_ALTINFO_GENERATEDAT, + OSPC_ALTINFO_ORIGIOI, + OSPC_ALTINFO_TERMIOI, /* For other attributes */ OSPC_ALTINFO_TRUE, OSPC_ALTINFO_FALSE, diff -Nru osptoolkit-4.11.3+dfsg/include/osp/ospdest.h osptoolkit-4.13.0/include/osp/ospdest.h --- osptoolkit-4.11.3+dfsg/include/osp/ospdest.h 2015-12-16 02:28:56.000000000 +0000 +++ osptoolkit-4.13.0/include/osp/ospdest.h 2016-11-07 18:45:55.000000000 +0000 @@ -148,6 +148,8 @@ char CallType[OSPC_SIZE_NORSTR]; char CallCategory[OSPC_SIZE_NORSTR]; char NetworkType[OSPC_SIZE_NORSTR]; + char SwitchId[OSPC_SIZE_NORID]; + char DestServiceProvider[OSPC_SIZE_NORSTR]; } OSPT_DEST; /* Function Prototypes */ @@ -208,6 +210,7 @@ void OSPPDestProtocolFromElement(OSPT_XML_ELEM *, OSPT_DEST *); void OSPPSrcInfoFromElement(OSPT_XML_ELEM *, OSPT_DEST *); void OSPPDestInfoFromElement(OSPT_XML_ELEM *, OSPT_DEST *); + void OSPPDestAltFromElement(OSPT_XML_ELEM *, OSPT_DEST *); int OSPPUsageDetailFromElement(OSPT_XML_ELEM *, OSPT_DEST *); void OSPPServiceFromElement(OSPT_XML_ELEM *, OSPT_DEST *); diff -Nru osptoolkit-4.11.3+dfsg/include/osp/osplibversion.h osptoolkit-4.13.0/include/osp/osplibversion.h --- osptoolkit-4.11.3+dfsg/include/osp/osplibversion.h 2016-03-16 08:53:57.000000000 +0000 +++ osptoolkit-4.13.0/include/osp/osplibversion.h 2016-11-07 18:45:55.000000000 +0000 @@ -20,7 +20,7 @@ #define _OSPLIBVERSION_H #define OSP_CLIENT_TOOLKIT_VERSION_MAJOR 4 -#define OSP_CLIENT_TOOLKIT_VERSION_MINOR 11 -#define OSP_CLIENT_TOOLKIT_VERSION_BUGFIX 3 +#define OSP_CLIENT_TOOLKIT_VERSION_MINOR 13 +#define OSP_CLIENT_TOOLKIT_VERSION_BUGFIX 0 #endif /* _OSPLIBVERSION_H */ diff -Nru osptoolkit-4.11.3+dfsg/include/osp/ospmsgelem.h osptoolkit-4.13.0/include/osp/ospmsgelem.h --- osptoolkit-4.11.3+dfsg/include/osp/ospmsgelem.h 2016-02-19 13:01:25.000000000 +0000 +++ osptoolkit-4.13.0/include/osp/ospmsgelem.h 2016-09-01 02:52:48.000000000 +0000 @@ -55,6 +55,7 @@ OSPC_MELEM_CDRPROXYHOST, OSPC_MELEM_CDRPROXYSUBFOLDER, OSPC_MELEM_CHARGEINFO, + OSPC_MELEM_CHARGINGVECTOR, OSPC_MELEM_CODE, OSPC_MELEM_CODEC, OSPC_MELEM_CONNECTTIME, diff -Nru osptoolkit-4.11.3+dfsg/include/osp/ospmsg.h osptoolkit-4.13.0/include/osp/ospmsg.h --- osptoolkit-4.11.3+dfsg/include/osp/ospmsg.h 2016-03-16 08:40:41.000000000 +0000 +++ osptoolkit-4.13.0/include/osp/ospmsg.h 2016-11-07 18:45:55.000000000 +0000 @@ -77,6 +77,9 @@ OSPC_RSTATE_HUNT2, OSPC_RSTATE_MEDIA, OSPC_RSTATE_REDIRECT, + OSPC_RSTATE_INVITE, + OSPC_RSTATE_REFER, + OSPC_RSTATE_REGISTER, /* Number of role states */ OSPC_RSTATE_NUMBER } OSPE_ROLE_STATE; @@ -95,6 +98,7 @@ OSPC_RFORMAT_ASCII, OSPC_RFORMAT_XML, OSPC_RFORMAT_FW, + OSPC_RFORMAT_MESSAGE, /* Number of role formats */ OSPC_RFORMAT_NUMBER } OSPE_ROLE_FORMAT; @@ -118,8 +122,10 @@ OSPC_RVENDOR_OPENSIPS, OSPC_RVENDOR_PERIMETA, OSPC_RVENDOR_SANSAY, + OSPC_RVENDOR_SIP, OSPC_RVENDOR_SONUS, OSPC_RVENDOR_TAQUA, + OSPC_RVENDOR_TELCOBRIDGES, /* Number of role vendors */ OSPC_RVENDOR_NUMBER } OSPE_ROLE_VENDOR; diff -Nru osptoolkit-4.11.3+dfsg/include/osp/osptransapi.h osptoolkit-4.13.0/include/osp/osptransapi.h --- osptoolkit-4.11.3+dfsg/include/osp/osptransapi.h 2016-02-19 13:01:25.000000000 +0000 +++ osptoolkit-4.13.0/include/osp/osptransapi.h 2016-11-07 18:45:55.000000000 +0000 @@ -136,8 +136,8 @@ int OSPPTransactionSetTransferId(OSPTTRANHANDLE, const char*); int OSPPTransactionSetTransferStatus(OSPTTRANHANDLE, OSPE_TRANSFER_STATUS); int OSPPTransactionSetNetworkTranslatedCalledNumber(OSPTTRANHANDLE, OSPE_NUMBER_FORMAT, const char *); - int OSPPTransactionSetServiceProvider(OSPTTRANHANDLE, const char *); -#define OSPPTransactionSetServiceProviderId OSPPTransactionSetServiceProvider + int OSPPTransactionSetSrcServiceProvider(OSPTTRANHANDLE, const char *); + int OSPPTransactionSetDestServiceProvider(OSPTTRANHANDLE, const char *); int OSPPTransactionSetSystemId(OSPTTRANHANDLE, const char *); int OSPPTransactionSetRelatedReason(OSPTTRANHANDLE, const char *); int OSPPTransactionSetSetupAttempt(OSPTTRANHANDLE, int); @@ -161,6 +161,10 @@ int OSPPTransactionSetFingerPrint(OSPTTRANHANDLE, unsigned, const char **); int OSPPTransactionSetIdentity(OSPTTRANHANDLE, unsigned, const unsigned char *, const char *, const char *, const char *, unsigned, const unsigned char *); int OSPPTransactionGetIdentity(OSPTTRANHANDLE, unsigned *, unsigned char *, unsigned, char *, unsigned, char *, unsigned, char *, unsigned *, unsigned char *); + int OSPPTransactionSetSrcSwitchId(OSPTTRANHANDLE, const char *); + int OSPPTransactionSetDestSwitchId(OSPTTRANHANDLE, const char *); + int OSPPTransactionGetDestSwitchId(OSPTTRANHANDLE, unsigned, char *); + int OSPPTransactionSetChargingVector(OSPTTRANHANDLE, const char *, const char *, const char *, const char *); #ifdef __cplusplus } diff -Nru osptoolkit-4.11.3+dfsg/include/osp/osptrans.h osptoolkit-4.13.0/include/osp/osptrans.h --- osptoolkit-4.11.3+dfsg/include/osp/osptrans.h 2016-02-19 13:01:25.000000000 +0000 +++ osptoolkit-4.13.0/include/osp/osptrans.h 2016-11-07 18:45:55.000000000 +0000 @@ -119,7 +119,7 @@ OSPE_ROLE_VENDOR RoleVendor; OSPE_NUMBER_FORMAT NetworkTranslatedCalledFormat; char NetworkTranslatedCalled[OSPC_SIZE_E164NUM]; - char ServiceProvider[OSPC_SIZE_NORSTR]; + char SrcServiceProvider[OSPC_SIZE_NORSTR]; char SystemId[OSPC_SIZE_NORSTR]; char RelatedReason[OSPC_SIZE_NORSTR]; int TotalSetupAttempts; @@ -135,6 +135,8 @@ OSPTTIME RequestDate; OSPTLIST SDPFingerPrint; OSPT_IDENTITY Identity; + char SrcSwitchId[OSPC_SIZE_NORID]; + char PCVICID[OSPC_SIZE_NORSTR]; } OSPTTRANS; #define OSPC_MAX_TRANS 20000 diff -Nru osptoolkit-4.11.3+dfsg/include/osp/ospusageind.h osptoolkit-4.13.0/include/osp/ospusageind.h --- osptoolkit-4.11.3+dfsg/include/osp/ospusageind.h 2015-12-16 02:28:56.000000000 +0000 +++ osptoolkit-4.13.0/include/osp/ospusageind.h 2016-11-07 18:45:55.000000000 +0000 @@ -74,6 +74,7 @@ char CallType[OSPC_SIZE_NORSTR]; char CallCategory[OSPC_SIZE_NORSTR]; char NetworkType[OSPC_SIZE_NORSTR]; + char DestServiceProvider[OSPC_SIZE_NORSTR]; } OSPT_USAGE_IND; /* Function Prototypes */ @@ -164,6 +165,7 @@ OSPTBOOL OSPPUsageIndHasSessionId(OSPT_USAGE_IND *, OSPE_SESSION_ID); OSPT_CALL_ID *OSPPUsageIndGetSessionId(OSPT_USAGE_IND *, OSPE_SESSION_ID); void OSPPUsageIndSetSessionId(OSPT_USAGE_IND *, OSPE_SESSION_ID, OSPT_CALL_ID *); + void OSPPUsageIndSetChargingVevtor(OSPT_USAGE_IND *, const char *, const char *, const char *, const char *); #ifdef __cplusplus } diff -Nru osptoolkit-4.11.3+dfsg/RELNOTES.txt osptoolkit-4.13.0/RELNOTES.txt --- osptoolkit-4.11.3+dfsg/RELNOTES.txt 2016-05-19 09:07:35.000000000 +0000 +++ osptoolkit-4.13.0/RELNOTES.txt 2016-11-07 18:45:55.000000000 +0000 @@ -691,3 +691,18 @@ Version 4.11.3 - 2016-05-19 * Fixed codec API typos. +--------------------------------------------------------------------------- + +Version 4.11.4 - 2016-08-24 +* Added RoleInfo values. +* Imported patch from Debian project. +--------------------------------------------------------------------------- + +Version 4.12.0 - 2016-09-01 +* Added switch ID and P-Charging-Vector support. +--------------------------------------------------------------------------- + +Version 4.13.0 - 2016-11-07 +* Added TelcoBridges vendor info. +* Added REFER state info. +* Added destination service provider ID support. diff -Nru osptoolkit-4.11.3+dfsg/src/ospaltinfo.c osptoolkit-4.13.0/src/ospaltinfo.c --- osptoolkit-4.11.3+dfsg/src/ospaltinfo.c 2016-01-25 02:33:08.000000000 +0000 +++ osptoolkit-4.13.0/src/ospaltinfo.c 2016-09-01 02:52:48.000000000 +0000 @@ -58,6 +58,11 @@ { OSPC_ALTINFO_INGRESS, "ingress" }, { OSPC_ALTINFO_EGRESS, "egress" }, { OSPC_ALTINFO_CNAM, "cnam" }, + { OSPC_ALTINFO_SWITCHID, "switchId" }, + { OSPC_ALTINFO_ICID, "icidvalue" }, + { OSPC_ALTINFO_GENERATEDAT, "icidgeneratedat" }, + { OSPC_ALTINFO_ORIGIOI, "origioi" }, + { OSPC_ALTINFO_TERMIOI, "termioi" }, /* For other attributes */ { OSPC_ALTINFO_TRUE, "true" }, { OSPC_ALTINFO_FALSE, "false" }, diff -Nru osptoolkit-4.11.3+dfsg/src/ospauthreq.c osptoolkit-4.13.0/src/ospauthreq.c --- osptoolkit-4.11.3+dfsg/src/ospauthreq.c 2016-02-19 13:01:25.000000000 +0000 +++ osptoolkit-4.13.0/src/ospauthreq.c 2016-11-07 18:45:55.000000000 +0000 @@ -950,10 +950,10 @@ } } - /* Add service provider */ + /* Add source service provider */ if (errcode == OSPC_ERR_NO_ERROR) { - if (trans->ServiceProvider[0] != '\0') { - errcode = OSPPStringToElement(OSPC_MELEM_SERVICEPROVIDER, trans->ServiceProvider, 0, OSPC_OSNULL, OSPC_OSNULL, &elem); + if (trans->SrcServiceProvider[0] != '\0') { + errcode = OSPPStringToElement(OSPC_MELEM_SERVICEPROVIDER, trans->SrcServiceProvider, 0, OSPC_OSNULL, OSPC_OSNULL, &elem); if (errcode == OSPC_ERR_NO_ERROR) { OSPPXMLElemAddChild(authreqelem, elem); elem = OSPC_OSNULL; @@ -1046,6 +1046,19 @@ if (errcode == OSPC_ERR_NO_ERROR) { OSPPXMLElemAddChild(authreqelem, elem); elem = OSPC_OSNULL; + } + } + } + + /* Add charging vector */ + if (errcode == OSPC_ERR_NO_ERROR) { + if (trans->PCVICID[0] != '\0') { + attrtype = OSPC_MATTR_TYPE; + attrvalue = OSPC_ALTINFO_ICID; + errcode = OSPPStringToElement(OSPC_MELEM_CHARGINGVECTOR, trans->PCVICID, 1, &attrtype, &attrvalue, &elem); + if (errcode == OSPC_ERR_NO_ERROR) { + OSPPXMLElemAddChild(authreqelem, elem); + elem = OSPC_OSNULL; } } } diff -Nru osptoolkit-4.11.3+dfsg/src/ospdest.c osptoolkit-4.13.0/src/ospdest.c --- osptoolkit-4.11.3+dfsg/src/ospdest.c 2016-01-25 02:33:08.000000000 +0000 +++ osptoolkit-4.13.0/src/ospdest.c 2016-09-01 02:52:48.000000000 +0000 @@ -773,7 +773,7 @@ OSPPDestInfoFromElement(elem, dest); break; case OSPC_MELEM_DESTALT: - OSPPDestSetNetworkAddr(dest, OSPPXMLElemGetValue(elem)); + OSPPDestAltFromElement(elem, dest); break; case OSPC_MELEM_DESTSIGADDR: OSPPDestSetAddr(dest, OSPPXMLElemGetValue(elem)); @@ -1042,6 +1042,31 @@ break; default: break; + } + } + } +} + +void OSPPDestAltFromElement( + OSPT_XML_ELEM *ospvElem, + OSPT_DEST *ospvDest) +{ + OSPT_XML_ATTR* attr = OSPC_OSNULL; + + for (attr = (OSPT_XML_ATTR*)OSPPXMLElemFirstAttr(ospvElem); + (attr != OSPC_OSNULL); + attr = (OSPT_XML_ATTR*)OSPPXMLElemNextAttr(ospvElem, attr)) + { + if (OSPPMsgAttrGetPart(OSPPXMLAttrGetName(attr)) == OSPC_MATTR_TYPE) { + switch (OSPPAltInfoTypeGetPart(OSPPXMLAttrGetValue(attr))) { + case OSPC_ALTINFO_NETWORK: + OSPPDestSetNetworkAddr(ospvDest, OSPPXMLElemGetValue(ospvElem)); + break; + case OSPC_ALTINFO_SWITCHID: + OSPM_STRNCPY(ospvDest->SwitchId, OSPPXMLElemGetValue(ospvElem), sizeof(ospvDest->SwitchId)); + break; + default: + break; } } } diff -Nru osptoolkit-4.11.3+dfsg/src/ospmsgattr.c osptoolkit-4.13.0/src/ospmsgattr.c --- osptoolkit-4.11.3+dfsg/src/ospmsgattr.c 2016-03-16 08:40:41.000000000 +0000 +++ osptoolkit-4.13.0/src/ospmsgattr.c 2016-11-07 18:45:55.000000000 +0000 @@ -62,7 +62,10 @@ { OSPC_RSTATE_HUNT1, "hunt1" }, { OSPC_RSTATE_HUNT2, "hunt2" }, { OSPC_RSTATE_MEDIA, "media" }, - { OSPC_RSTATE_REDIRECT, "redirect" } + { OSPC_RSTATE_REDIRECT, "redirect" }, + { OSPC_RSTATE_INVITE, "invite" }, + { OSPC_RSTATE_REFER, "refer" }, + { OSPC_RSTATE_REGISTER, "register" } }; /* Array that associates role state */ @@ -75,27 +78,30 @@ { OSPC_RFORMAT_TSV, "texttsv" }, { OSPC_RFORMAT_ASCII, "ascii" }, { OSPC_RFORMAT_XML, "xml" }, - { OSPC_RFORMAT_FW, "fixedwidth" } + { OSPC_RFORMAT_FW, "fixedwidth" }, + { OSPC_RFORMAT_MESSAGE, "message" } }; /* Array that associates role vendor */ const OSPT_MSG_DESC OSPV_RVENDOR_DESCS[OSPC_RVENDOR_NUMBER] = { - { OSPC_RVENDOR_ACME, "acme" }, - { OSPC_RVENDOR_ASTERISK, "asterisk" }, - { OSPC_RVENDOR_AUDIOCODES, "audiocodes" }, - { OSPC_RVENDOR_AVAYA, "avaya" }, - { OSPC_RVENDOR_BROADWORKS, "broadworks" }, - { OSPC_RVENDOR_CISCO, "cisco" }, - { OSPC_RVENDOR_CUCM, "cucm" }, - { OSPC_RVENDOR_FREESWITCH, "freeswitch" }, - { OSPC_RVENDOR_GENBANDS3, "genbands3" }, - { OSPC_RVENDOR_KAMAILIO, "kamailio" }, - { OSPC_RVENDOR_METASPHERE, "metasphere" }, - { OSPC_RVENDOR_OPENSIPS, "opensips" }, - { OSPC_RVENDOR_PERIMETA, "perimeta" }, - { OSPC_RVENDOR_SANSAY, "sansay" }, - { OSPC_RVENDOR_SONUS, "sonus" }, - { OSPC_RVENDOR_TAQUA, "taqua" } + { OSPC_RVENDOR_ACME, "acme" }, + { OSPC_RVENDOR_ASTERISK, "asterisk" }, + { OSPC_RVENDOR_AUDIOCODES, "audiocodes" }, + { OSPC_RVENDOR_AVAYA, "avaya" }, + { OSPC_RVENDOR_BROADWORKS, "broadworks" }, + { OSPC_RVENDOR_CISCO, "cisco" }, + { OSPC_RVENDOR_CUCM, "cucm" }, + { OSPC_RVENDOR_FREESWITCH, "freeswitch" }, + { OSPC_RVENDOR_GENBANDS3, "genbands3" }, + { OSPC_RVENDOR_KAMAILIO, "kamailio" }, + { OSPC_RVENDOR_METASPHERE, "metasphere" }, + { OSPC_RVENDOR_OPENSIPS, "opensips" }, + { OSPC_RVENDOR_PERIMETA, "perimeta" }, + { OSPC_RVENDOR_SANSAY, "sansay" }, + { OSPC_RVENDOR_SIP, "sip" }, + { OSPC_RVENDOR_SONUS, "sonus" }, + { OSPC_RVENDOR_TAQUA, "taqua" }, + { OSPC_RVENDOR_TELCOBRIDGES, "telcobridges" } }; /* Array that associates service type and names */ diff -Nru osptoolkit-4.11.3+dfsg/src/ospmsgelem.c osptoolkit-4.13.0/src/ospmsgelem.c --- osptoolkit-4.11.3+dfsg/src/ospmsgelem.c 2016-02-19 13:01:25.000000000 +0000 +++ osptoolkit-4.13.0/src/ospmsgelem.c 2016-09-01 02:52:48.000000000 +0000 @@ -52,6 +52,7 @@ { OSPC_MELEM_CDRPROXYHOST, "Host" }, { OSPC_MELEM_CDRPROXYSUBFOLDER, "SubfolderName" }, { OSPC_MELEM_CHARGEINFO, "ChargeInfoSourceInfo" }, + { OSPC_MELEM_CHARGINGVECTOR, "ChargingVector" }, { OSPC_MELEM_CODE, "Code" }, { OSPC_MELEM_CODEC, "Codec" }, { OSPC_MELEM_CONNECTTIME, "ConnectTime" }, diff -Nru osptoolkit-4.11.3+dfsg/src/osptransapi.c osptoolkit-4.13.0/src/osptransapi.c --- osptoolkit-4.11.3+dfsg/src/osptransapi.c 2016-02-19 13:01:25.000000000 +0000 +++ osptoolkit-4.13.0/src/osptransapi.c 2016-11-07 18:45:55.000000000 +0000 @@ -146,7 +146,7 @@ OSPTTRANS *trans = OSPC_OSNULL; OSPT_DEST *dest = OSPC_OSNULL; OSPTBOOL modifyallowed = OSPC_FALSE; - OSPT_ALTINFO *altinfo = OSPC_OSNULL, *altinfoToKeep = OSPC_OSNULL, *altinfoToKeep2 = OSPC_OSNULL; + OSPT_ALTINFO *altinfo = OSPC_OSNULL; if ((ospvSource == OSPC_OSNULL) && (ospvSourceDevice == OSPC_OSNULL) && (ospvDestination == OSPC_OSNULL) && (ospvDestinationDevice == OSPC_OSNULL)) { errcode = OSPC_ERR_TRAN_INVALID_ENTRY; @@ -226,21 +226,14 @@ * If srcAlt is present, delete the type- transport * but keep the type-network. */ - altinfoToKeep = OSPC_OSNULL; while (!OSPPListEmpty(&(trans->AuthInd->SourceAlternate))) { altinfo = (OSPT_ALTINFO *)OSPPListRemove(&(trans->AuthInd->SourceAlternate)); - if (altinfo->Type == OSPC_ALTINFO_NETWORK) { - /* This node in the list corresponds to Network Id. Do not delete it. */ - altinfoToKeep = altinfo; + if ((altinfo->Type == OSPC_ALTINFO_NETWORK) || (altinfo->Type == OSPC_ALTINFO_SWITCHID)) { + OSPPListAppend((OSPTLIST *)&(trans->AuthInd->SourceAlternate), (void *)altinfo); } else { OSPM_FREE(altinfo); - altinfo = OSPC_OSNULL; } - } - /* Add back the AltInfo for networkId */ - if (altinfoToKeep) { - OSPPListAppend((OSPTLIST *)&(trans->AuthInd->SourceAlternate), (void *)altinfoToKeep); - altinfoToKeep = OSPC_OSNULL; + altinfo = OSPC_OSNULL; } } @@ -258,21 +251,14 @@ * If srcAlt is present, delete the type- transport * but keep the type-network. */ - altinfoToKeep = OSPC_OSNULL; while (!OSPPListEmpty(&(trans->AuthInd->DeviceInfo))) { altinfo = (OSPT_ALTINFO *)OSPPListRemove(&(trans->AuthInd->DeviceInfo)); - if (altinfo->Type == OSPC_ALTINFO_NETWORK) { - /* This node in the list corresponds to Network Id. Do not delete it. */ - altinfoToKeep = altinfo; + if ((altinfo->Type == OSPC_ALTINFO_NETWORK) || (altinfo->Type == OSPC_ALTINFO_SWITCHID)){ + OSPPListAppend((OSPTLIST *)&(trans->AuthInd->DeviceInfo), (void *)altinfo); } else { OSPM_FREE(altinfo); - altinfo = OSPC_OSNULL; } - } - /* Add back the AltInfo for networkId */ - if (altinfoToKeep) { - OSPPListAppend((OSPTLIST *)&(trans->AuthInd->DeviceInfo), (void *)altinfoToKeep); - altinfoToKeep = OSPC_OSNULL; + altinfo = OSPC_OSNULL; } } @@ -293,12 +279,9 @@ while (!OSPPListEmpty(&(trans->AuthInd->DestinationAlternate))) { altinfo = (OSPT_ALTINFO *)OSPPListRemove(&(trans->AuthInd->DestinationAlternate)); if (altinfo != OSPC_OSNULL) { - if (altinfo->Type == OSPC_ALTINFO_H323) { - /* This node in the list corresponds to DestinationDevice. Do not delete it. */ - altinfoToKeep = altinfo; - } else if (altinfo->Type == OSPC_ALTINFO_NETWORK) { - /* This node in the list corresponds to Network Id. Do not delete it. */ - altinfoToKeep2 = altinfo; + if ((altinfo->Type == OSPC_ALTINFO_H323) || (altinfo->Type == OSPC_ALTINFO_NETWORK) || (altinfo->Type == OSPC_ALTINFO_SWITCHID)) { + /* This node in the list corresponds to DestinationDevice/NetworkID/SwitchID. Do not delete it. */ + OSPPListAppend((OSPTLIST *)&(trans->AuthInd->DestinationAlternate), (void *)altinfo); } else { OSPM_FREE(altinfo); } @@ -306,19 +289,6 @@ } } - /* - * We have emptied the list now. - * Add back the altinfo that corresponded to destinationDevice and Network Id - */ - if (altinfoToKeep) { - OSPPListAppend((OSPTLIST *)&(trans->AuthInd->DestinationAlternate), (void *)altinfoToKeep); - altinfoToKeep = OSPC_OSNULL; - } - - if (altinfoToKeep2) { - OSPPListAppend((OSPTLIST *)&(trans->AuthInd->DestinationAlternate), (void *)altinfoToKeep2); - altinfoToKeep2 = OSPC_OSNULL; - } /* Now add the new destination */ altinfo = OSPPAltInfoNew(OSPM_STRLEN(ospvDestination), ospvDestination, OSPC_ALTINFO_TRANSPORT); if (altinfo != OSPC_OSNULL) { @@ -337,12 +307,9 @@ while (!OSPPListEmpty(&(trans->AuthInd->DestinationAlternate))) { altinfo = (OSPT_ALTINFO *)OSPPListRemove(&(trans->AuthInd->DestinationAlternate)); if (altinfo != OSPC_OSNULL) { - if (altinfo->Type == OSPC_ALTINFO_TRANSPORT) { - /* This node in the list corresponds to Destination. Do not delete it. */ - altinfoToKeep = altinfo; - } else if (altinfo->Type == OSPC_ALTINFO_NETWORK) { - /* This node in the list corresponds to NetworkId. Do not delete it. */ - altinfoToKeep2 = altinfo; + if ((altinfo->Type == OSPC_ALTINFO_TRANSPORT) || (altinfo->Type == OSPC_ALTINFO_NETWORK) || (altinfo->Type == OSPC_ALTINFO_SWITCHID)) { + /* This node in the list corresponds to Destination/NetworkID/SwitchID. Do not delete it. */ + OSPPListAppend((OSPTLIST *)&(trans->AuthInd->DestinationAlternate), (void *)altinfo); } else { OSPM_FREE(altinfo); } @@ -350,21 +317,6 @@ } } - /* - * We have emptied the list now. - * Add back the altinfo that corresponded to destination - */ - - if (altinfoToKeep) { - OSPPListAppend((OSPTLIST *)&(trans->AuthInd->DestinationAlternate), (void *)altinfoToKeep); - altinfoToKeep = OSPC_OSNULL; - } - - if (altinfoToKeep2) { - OSPPListAppend((OSPTLIST *)&(trans->AuthInd->DestinationAlternate), (void *)altinfoToKeep2); - altinfoToKeep2 = OSPC_OSNULL; - } - /* Now add the new node for destinationDevice */ altinfo = OSPPAltInfoNew(OSPM_STRLEN(ospvDestinationDevice), ospvDestinationDevice, OSPC_ALTINFO_H323); if (altinfo != OSPC_OSNULL) { @@ -403,7 +355,6 @@ OSPT_AUTH_IND **ospvAuthInd; const char *destinfo; OSPT_ALTINFO *altinfo = OSPC_OSNULL; - OSPT_ALTINFO *altinfoToKeep = OSPC_OSNULL; trans = OSPPTransactionGetContext(ospvTransaction, &errcode); if (errcode == OSPC_ERR_NO_ERROR) { @@ -429,13 +380,13 @@ while (!OSPPListEmpty(&((*ospvAuthInd)->DestinationAlternate))) { altinfo = (OSPT_ALTINFO *)OSPPListRemove(&((*ospvAuthInd)->DestinationAlternate)); if (altinfo != OSPC_OSNULL) { - if (altinfo->Type == OSPC_ALTINFO_NETWORK) { - /* This node in the list corresponds to Network Id. Do not delete it. */ - altinfoToKeep = altinfo; + if ((altinfo->Type == OSPC_ALTINFO_NETWORK) || (altinfo->Type == OSPC_ALTINFO_SWITCHID)) { + /* This node in the list corresponds to Network/Switch Id. Do not delete it. */ + OSPPListAppend((OSPTLIST *)&(trans->AuthInd->DestinationAlternate), (void *)altinfo); } else { OSPM_FREE(altinfo); - altinfo = OSPC_OSNULL; } + altinfo = OSPC_OSNULL; } } @@ -444,12 +395,6 @@ /* Create a new list of destiantion Alt */ OSPPListNew((OSPTLIST *)&(trans->AuthInd->DestinationAlternate)); - /* Add back the AltInfo for networkId */ - if (altinfoToKeep) { - OSPPListAppend((OSPTLIST *)&(trans->AuthInd->DestinationAlternate), (void *)altinfoToKeep); - altinfoToKeep = OSPC_OSNULL; - } - altinfo = OSPPAltInfoNew(OSPM_STRLEN(destinfo), destinfo, OSPC_ALTINFO_TRANSPORT); if (altinfo != OSPC_OSNULL) { OSPPListAppend((OSPTLIST *)&(trans->AuthInd->DestinationAlternate), (void *)altinfo); @@ -1755,7 +1700,7 @@ * -------------------------------------- */ if (errcode == OSPC_ERR_NO_ERROR) { - if ((ospvSource != OSPC_OSNULL) || (trans->SrcNetworkId != OSPC_OSNULL)) { + if ((ospvSource != OSPC_OSNULL) || (trans->SrcNetworkId != OSPC_OSNULL) || (trans->SrcSwitchId[0] != '\0')) { /* source alternates - create a linked list */ OSPPListNew((OSPTLIST *)&(trans->AuthInd->SourceAlternate)); @@ -1763,18 +1708,25 @@ altinfo = OSPPAltInfoNew(OSPM_STRLEN(trans->SrcNetworkId), trans->SrcNetworkId, OSPC_ALTINFO_NETWORK); if (altinfo != OSPC_OSNULL) { OSPPListAppend((OSPTLIST *)&(trans->AuthInd->SourceAlternate), (void *)altinfo); + altinfo = OSPC_OSNULL; + } + } + + if (trans->SrcSwitchId[0] != '\0') { + altinfo = OSPPAltInfoNew(OSPM_STRLEN(trans->SrcSwitchId), trans->SrcSwitchId, OSPC_ALTINFO_SWITCHID); + if (altinfo != OSPC_OSNULL) { + OSPPListAppend((OSPTLIST *)&(trans->AuthInd->SourceAlternate), (void *)altinfo); + altinfo = OSPC_OSNULL; } } - altinfo = OSPC_OSNULL; if (ospvSource != OSPC_OSNULL) { altinfo = OSPPAltInfoNew(OSPM_STRLEN(ospvSource), ospvSource, OSPC_ALTINFO_TRANSPORT); if (altinfo != OSPC_OSNULL) { OSPPListAppend((OSPTLIST *)&(trans->AuthInd->SourceAlternate), (void *)altinfo); + altinfo = OSPC_OSNULL; } } - - altinfo = OSPC_OSNULL; } else { errcode = OSPC_ERR_TRAN_SOURCE_INVALID; } @@ -1794,20 +1746,18 @@ altinfo = OSPPAltInfoNew(OSPM_STRLEN(trans->DestNetworkId), trans->DestNetworkId, OSPC_ALTINFO_NETWORK); if (altinfo != OSPC_OSNULL) { OSPPListAppend((OSPTLIST *)&(trans->AuthInd->DestinationAlternate), (void *)altinfo); + altinfo = OSPC_OSNULL; } } - altinfo = OSPC_OSNULL; - if (ospvDestination != OSPC_OSNULL) { altinfo = OSPPAltInfoNew(OSPM_STRLEN(ospvDestination), ospvDestination, OSPC_ALTINFO_TRANSPORT); if (altinfo != OSPC_OSNULL) { OSPPListAppend((OSPTLIST *)&(trans->AuthInd->DestinationAlternate), (void *)altinfo); + altinfo = OSPC_OSNULL; } } - altinfo = OSPC_OSNULL; - if (ospvDestinationDevice != OSPC_OSNULL) { altinfo = OSPPAltInfoNew(OSPM_STRLEN(ospvDestinationDevice), ospvDestinationDevice, OSPC_ALTINFO_H323); if (altinfo != OSPC_OSNULL) { @@ -1830,7 +1780,6 @@ } else { errcode = OSPC_ERR_TRAN_NOT_IMPLEMENTED; OSPM_DBGERRORLOG(errcode, "Invalid system type."); - } } @@ -2185,7 +2134,7 @@ trans->RoleVendor = OSPC_RVENDOR_UNKNOWN; trans->NetworkTranslatedCalledFormat = OSPC_NFORMAT_E164; trans->NetworkTranslatedCalled[0] = '\0'; - trans->ServiceProvider[0] = '\0'; + trans->SrcServiceProvider[0] = '\0'; trans->SystemId[0] = '\0'; trans->RelatedReason[0] = '\0'; trans->TotalSetupAttempts = -1; @@ -2207,6 +2156,8 @@ trans->Identity.IdInfo[0] = '\0'; trans->Identity.IdType[0] = '\0'; trans->Identity.CanonSize = 0; + trans->SrcSwitchId[0] = '\0'; + trans->PCVICID[0] = '\0'; } return errcode; @@ -3557,7 +3508,6 @@ } } - /* Get the call id from the token, if it is "UNDEFINED", set callidundefined */ if (errcode == OSPC_ERR_NO_ERROR) { CallIdSize = OSPPTokenInfoGetCallIdSize(tokeninfo); @@ -3621,7 +3571,6 @@ trans->CurrentDest = dest; dest = OSPC_OSNULL; - } } @@ -3644,8 +3593,8 @@ altinfo = OSPPAltInfoNew(OSPM_STRLEN(ospvSourceDevice), ospvSourceDevice, OSPC_ALTINFO_TRANSPORT); if (altinfo != OSPC_OSNULL) { OSPPListAppend((OSPTLIST *)&(trans->AuthInd->DeviceInfo), (void *)altinfo); + altinfo = OSPC_OSNULL; } - altinfo = OSPC_OSNULL; } /* end if ospvSourceDevice != OSPC_OSNULL */ @@ -3654,24 +3603,33 @@ * -------------------------------------- */ if (errcode == OSPC_ERR_NO_ERROR) { - if ((ospvSource != OSPC_OSNULL) || (trans->SrcNetworkId != OSPC_OSNULL)) { + if ((ospvSource != OSPC_OSNULL) || (trans->SrcNetworkId != OSPC_OSNULL) || (trans->SrcSwitchId[0] != '\0')) { /* source alternates - create a linked list */ OSPPListNew((OSPTLIST *)&(trans->AuthInd->SourceAlternate)); + if (trans->SrcNetworkId != OSPC_OSNULL) { altinfo = OSPPAltInfoNew(OSPM_STRLEN(trans->SrcNetworkId), trans->SrcNetworkId, OSPC_ALTINFO_NETWORK); if (altinfo != OSPC_OSNULL) { OSPPListAppend((OSPTLIST *)&(trans->AuthInd->SourceAlternate), (void *)altinfo); + altinfo = OSPC_OSNULL; + } + } + + if (trans->SrcSwitchId[0] != '\0') { + altinfo = OSPPAltInfoNew(OSPM_STRLEN(trans->SrcSwitchId), trans->SrcSwitchId, OSPC_ALTINFO_SWITCHID); + if (altinfo != OSPC_OSNULL) { + OSPPListAppend((OSPTLIST *)&(trans->AuthInd->SourceAlternate), (void *)altinfo); + altinfo = OSPC_OSNULL; } } - altinfo = OSPC_OSNULL; if (ospvSource != OSPC_OSNULL) { altinfo = OSPPAltInfoNew(OSPM_STRLEN(ospvSource), ospvSource, OSPC_ALTINFO_TRANSPORT); if (altinfo != OSPC_OSNULL) { OSPPListAppend((OSPTLIST *)&(trans->AuthInd->SourceAlternate), (void *)altinfo); + altinfo = OSPC_OSNULL; } } - altinfo = OSPC_OSNULL; } else { errcode = OSPC_ERR_TRAN_SOURCE_INVALID; } @@ -3683,7 +3641,6 @@ * ----------------------------------------------------- */ if (errcode == OSPC_ERR_NO_ERROR) { - if ((ospvDestination != OSPC_OSNULL) || (ospvDestinationDevice != OSPC_OSNULL) || (trans->DestNetworkId != OSPC_OSNULL)) { /* destination alternates - create a linked list */ @@ -3700,17 +3657,17 @@ altinfo = OSPPAltInfoNew(OSPM_STRLEN(trans->DestNetworkId), trans->DestNetworkId, OSPC_ALTINFO_NETWORK); if (altinfo != OSPC_OSNULL) { OSPPListAppend((OSPTLIST *)&(trans->AuthInd->DestinationAlternate), (void *)altinfo); + altinfo = OSPC_OSNULL; } } - altinfo = OSPC_OSNULL; if (ospvDestination != OSPC_OSNULL) { altinfo = OSPPAltInfoNew(OSPM_STRLEN(ospvDestination), ospvDestination, OSPC_ALTINFO_TRANSPORT); if (altinfo != OSPC_OSNULL) { OSPPListAppend((OSPTLIST *)&(trans->AuthInd->DestinationAlternate), (void *)altinfo); + altinfo = OSPC_OSNULL; } } - altinfo = OSPC_OSNULL; if (ospvDestinationDevice != OSPC_OSNULL) { altinfo = OSPPAltInfoNew(OSPM_STRLEN(ospvDestinationDevice), ospvDestinationDevice, OSPC_ALTINFO_H323); @@ -3740,9 +3697,7 @@ } if (errcode == OSPC_ERR_NO_ERROR) { - if (trans->AuthInd->Tokens != OSPC_OSNULL) { - token = OSPPTokenNew(ospvSizeOfToken, (const unsigned char *)ospvToken); if (token != OSPC_OSNULL) { @@ -3801,16 +3756,14 @@ OSPPTokenInfoGetDestNetworkId(tokeninfo), OSPC_ALTINFO_NETWORK); if (altinfo != OSPC_OSNULL) { - OSPPListAppend((OSPTLIST *)&(trans->AuthInd->DestinationAlternate), (void *)altinfo); + altinfo = OSPC_OSNULL; } - altinfo = OSPC_OSNULL; trans->AuthInd->HasDestNetworkIdInToken = OSPC_TRUE; } if (errcode == OSPC_ERR_NO_ERROR && dtype == OSPC_MSG_TOKINFO) { - /* Verify Source Number */ retcode = OSPM_STRCMP(OSPPAuthIndGetSourceNumber(trans->AuthInd), OSPPTokenInfoGetSourceNumber(tokeninfo)); @@ -5344,7 +5297,7 @@ return errcode; } -int OSPPTransactionSetServiceProvider( +int OSPPTransactionSetSrcServiceProvider( OSPTTRANHANDLE ospvTransaction, /* In - Transaction handle */ const char *ospvServiceProvider) /* In - Service provider */ { @@ -5356,7 +5309,31 @@ } else { trans = OSPPTransactionGetContext(ospvTransaction, &errcode); if ((errcode == OSPC_ERR_NO_ERROR) && (trans != OSPC_OSNULL)) { - OSPM_STRNCPY(trans->ServiceProvider, ospvServiceProvider, sizeof(trans->ServiceProvider)); + OSPM_STRNCPY(trans->SrcServiceProvider, ospvServiceProvider, sizeof(trans->SrcServiceProvider)); + } + } + + return errcode; +} + +int OSPPTransactionSetDestServiceProvider( + OSPTTRANHANDLE ospvTransaction, /* In - Transaction handle */ + const char *ospvServiceProvider) /* In - Service provider */ +{ + int errcode = OSPC_ERR_NO_ERROR; + OSPTTRANS *trans = OSPC_OSNULL; + OSPT_DEST *dest = OSPC_OSNULL; + + if ((ospvServiceProvider == OSPC_OSNULL) || (ospvServiceProvider[0] == '\0')) { + errcode = OSPC_ERR_TRAN_INVALID_ENTRY; + } else { + trans = OSPPTransactionGetContext(ospvTransaction, &errcode); + if ((errcode == OSPC_ERR_NO_ERROR) && + (trans != OSPC_OSNULL) && + (trans->AuthReq != OSPC_OSNULL) && + ((dest = trans->CurrentDest) != OSPC_OSNULL)) + { + OSPM_STRNCPY(dest->DestServiceProvider, ospvServiceProvider, sizeof(dest->DestServiceProvider)); } } @@ -5773,7 +5750,7 @@ int OSPPTransactionSetCallCategory( OSPTTRANHANDLE ospvTransaction, /* In - Transaction handle */ - const char *ospvCallCategory) /* In - Call type */ + const char *ospvCallCategory) /* In - Call type */ { int errcode = OSPC_ERR_NO_ERROR; OSPTTRANS *trans = OSPC_OSNULL; @@ -5795,7 +5772,7 @@ int OSPPTransactionSetNetworkType( OSPTTRANHANDLE ospvTransaction, /* In - Transaction handle */ - const char *ospvNetworkType) /* In - Call type */ + const char *ospvNetworkType) /* In - Call type */ { int errcode = OSPC_ERR_NO_ERROR; OSPTTRANS *trans = OSPC_OSNULL; @@ -5941,6 +5918,141 @@ } } } + + return errcode; +} + +int OSPPTransactionSetChargingVector( + OSPTTRANHANDLE ospvTransaction, /* In - Transaction handle */ + const char *ospvICID, /* In - ICID value */ + const char *ospvGeneratedAt, /* In - ICID genearted at */ + const char *ospvOrigIOI, /* In - Orig IOI */ + const char *ospvTermIOI) /* In - Term IOI */ +{ + int errcode = OSPC_ERR_NO_ERROR; + OSPTTRANS *trans = OSPC_OSNULL; + + trans = OSPPTransactionGetContext(ospvTransaction, &errcode); + if ((errcode == OSPC_ERR_NO_ERROR) && (trans != OSPC_OSNULL)) { + if (ospvICID != OSPC_OSNULL) { + OSPM_STRNCPY(trans->PCVICID, ospvICID, sizeof(trans->PCVICID)); + } + } + + return errcode; +} + +/* Must be called before calling BuildUsageFromScratch */ +int OSPPTransactionSetSrcSwitchId( + OSPTTRANHANDLE ospvTransaction, /* In - Transaction handle */ + const char *ospvSwitchId) /* In - Source switch ID */ +{ + int errcode = OSPC_ERR_NO_ERROR; + OSPTTRANS *trans = OSPC_OSNULL; + + if ((ospvSwitchId == OSPC_OSNULL) || (ospvSwitchId[0] == '\0')) { + errcode = OSPC_ERR_TRAN_INVALID_ENTRY; + } else { + trans = OSPPTransactionGetContext(ospvTransaction, &errcode); + if ((errcode == OSPC_ERR_NO_ERROR) && (trans != OSPC_OSNULL)) { + OSPM_STRNCPY(trans->SrcSwitchId, ospvSwitchId, sizeof(trans->SrcSwitchId)); + } + } + + return errcode; +} + +int OSPPTransactionSetDestSwitchId( + OSPTTRANHANDLE ospvTransaction, /* In - Transaction handle */ + const char *ospvSwitchId) /* In - Destination switch ID */ +{ + int errcode = OSPC_ERR_NO_ERROR; + OSPTTRANS *trans = OSPC_OSNULL; + OSPT_DEST *dest = OSPC_OSNULL; + + if ((ospvSwitchId == OSPC_OSNULL) || (ospvSwitchId[0] == '\0')) { + errcode = OSPC_ERR_TRAN_INVALID_ENTRY; + } else { + trans = OSPPTransactionGetContext(ospvTransaction, &errcode); + if ((errcode == OSPC_ERR_NO_ERROR) && (trans != OSPC_OSNULL)) { + dest = trans->CurrentDest; + if (dest != OSPC_OSNULL) { + OSPM_STRNCPY(dest->SwitchId, ospvSwitchId, sizeof(dest->SwitchId)); + } + } + } + + return errcode; +} + +/* + * OSPPTransactionGetDestSwitchId() : + * Reports the destination switch Id as returned in AuthRsp + * returns OSPC_ERR_NO_ERROR if successful, else a 'Request out of Sequence' errcode. + */ +int OSPPTransactionGetDestSwitchId( + OSPTTRANHANDLE ospvTransaction, /* In - Transaction handle */ + unsigned ospvSizeOfSwitchId, /* In - Max size of switch ID */ + char *ospvSwitchId) /* In - switch specific information */ +{ + int errcode = OSPC_ERR_NO_ERROR; + OSPTTRANS *trans = OSPC_OSNULL; + OSPT_DEST *dest = OSPC_OSNULL; + OSPT_ALTINFO *altinfo = OSPC_OSNULL; + const char *destval = OSPC_OSNULL; + const char *swid; + + if (ospvSizeOfSwitchId == 0) { + errcode = OSPC_ERR_TRAN_NOT_ENOUGH_SPACE_FOR_COPY; + OSPM_DBGERRORLOG(errcode, "No enough buffer to copy switch ID."); + } else { + ospvSwitchId[0] = '\0'; + + if ((trans = OSPPTransactionGetContext(ospvTransaction, &errcode)) != OSPC_OSNULL) { + if (trans->AuthReq != OSPC_OSNULL) { + /* We are the source. Get the information from the destination structure. */ + if (trans->State == OSPC_GET_DEST_SUCCESS) { + if ((dest = trans->CurrentDest) == OSPC_OSNULL) { + errcode = OSPC_ERR_TRAN_DEST_NOT_FOUND; + OSPM_DBGERRORLOG(errcode, "Could not find Destination for this Transaction\n"); + } else { + swid = dest->SwitchId; + if (ospvSizeOfSwitchId > OSPM_STRLEN(swid)) { + OSPM_STRNCPY(ospvSwitchId, swid, ospvSizeOfSwitchId); + } else { + errcode = OSPC_ERR_TRAN_NOT_ENOUGH_SPACE_FOR_COPY; + OSPM_DBGERRORLOG(errcode, "No enough buffer to copy switch ID."); + } + } + } else { + errcode = OSPC_ERR_TRAN_REQ_OUT_OF_SEQ; + OSPM_DBGERRORLOG(errcode, "Called API Not In Sequence\n"); + } + } else if (trans->AuthInd != OSPC_OSNULL) { + /* We are the destination. Get the information from the AuthInd structure. */ + altinfo = (OSPT_ALTINFO *)OSPPAuthIndFirstDestinationAlt(trans->AuthInd); + while (altinfo != OSPC_OSNULL) { + if (altinfo->Type == OSPC_ALTINFO_SWITCHID) { + destval = OSPPAuthIndGetDestinationAltValue(altinfo); + if (destval != OSPC_OSNULL) { + if (ospvSizeOfSwitchId > OSPM_STRLEN(destval)) { + OSPM_STRNCPY(ospvSwitchId, destval, ospvSizeOfSwitchId); + } else { + errcode = OSPC_ERR_TRAN_NOT_ENOUGH_SPACE_FOR_COPY; + OSPM_DBGERRORLOG(errcode, "No enough buffer to copy switch ID."); + } + } + break; + } else { + altinfo = (OSPT_ALTINFO *)OSPPAuthIndNextDestinationAlt(trans->AuthInd, altinfo); + } + } + } else { + errcode = OSPC_ERR_TRAN_INVALID_ENTRY; + OSPM_DBGERRORLOG(errcode, "No information available to process this report."); + } + } + } return errcode; } diff -Nru osptoolkit-4.11.3+dfsg/src/osptrans.c osptoolkit-4.13.0/src/osptrans.c --- osptoolkit-4.11.3+dfsg/src/osptrans.c 2015-12-16 02:28:56.000000000 +0000 +++ osptoolkit-4.13.0/src/osptrans.c 2016-11-07 18:45:55.000000000 +0000 @@ -309,6 +309,12 @@ OSPPUsageIndAddDestinationAlt(*ospvUsage, altinfo); altinfo = OSPC_OSNULL; } + if ((errcode == OSPC_ERR_NO_ERROR) && (ospvDest->SwitchId[0] != '\0')) { + dest = ospvDest->SwitchId; + altinfo = OSPPAltInfoNew(OSPM_STRLEN(dest), dest, OSPC_ALTINFO_SWITCHID); + OSPPUsageIndAddDestinationAlt(*ospvUsage, altinfo); + altinfo = OSPC_OSNULL; + } /* Get Destination Alternates */ if ((errcode == OSPC_ERR_NO_ERROR) && OSPPAuthReqHasDestinationAlt(ospvTrans->AuthReq)) { @@ -428,6 +434,11 @@ if (errcode == OSPC_ERR_NO_ERROR) { OSPM_STRNCPY((*ospvUsage)->NetworkType, ospvDest->NetworkType, sizeof((*ospvUsage)->NetworkType)); } + + /* Move destination service provider to the usage structure */ + if (errcode == OSPC_ERR_NO_ERROR) { + OSPM_STRNCPY((*ospvUsage)->DestServiceProvider, ospvDest->DestServiceProvider, sizeof((*ospvUsage)->DestServiceProvider)); + } } else if (ospvType == OSPC_MSG_AIND) { /* Terminating */ if ((ospvTrans->AuthInd != OSPC_OSNULL) && @@ -1727,15 +1738,15 @@ altinfo = OSPPAltInfoNew(OSPM_STRLEN(ospvSourceDevice), ospvSourceDevice, OSPC_ALTINFO_TRANSPORT); if (altinfo != OSPC_OSNULL) { OSPPListAppend((OSPTLIST *)&(ospvTrans->AuthReq->DeviceInfo), altinfo); + altinfo = OSPC_OSNULL; } - altinfo = OSPC_OSNULL; } /* -------------------------------------- * SourceAlternate * -------------------------------------- */ - if ((ospvSource != OSPC_OSNULL) || (ospvTrans->SrcNetworkId != OSPC_OSNULL) || (ospvUser != OSPC_OSNULL)) { + if ((ospvSource != OSPC_OSNULL) || (ospvTrans->SrcNetworkId != OSPC_OSNULL) || (ospvTrans->SrcSwitchId[0] != '\0') || (ospvUser != OSPC_OSNULL)) { /* source alternates - create a linked list */ OSPPListNew((OSPTLIST *)&(ospvTrans->AuthReq->SourceAlternate)); @@ -1743,25 +1754,33 @@ altinfo = OSPPAltInfoNew(OSPM_STRLEN(ospvTrans->SrcNetworkId), ospvTrans->SrcNetworkId, OSPC_ALTINFO_NETWORK); if (altinfo != OSPC_OSNULL) { OSPPListAppend((OSPTLIST *)&(ospvTrans->AuthReq->SourceAlternate), (void *)altinfo); + altinfo = OSPC_OSNULL; + } + } + + if (ospvTrans->SrcSwitchId[0] != '\0') { + altinfo = OSPPAltInfoNew(OSPM_STRLEN(ospvTrans->SrcSwitchId), ospvTrans->SrcSwitchId, OSPC_ALTINFO_SWITCHID); + if (altinfo != OSPC_OSNULL) { + OSPPListAppend((OSPTLIST *)&(ospvTrans->AuthReq->SourceAlternate), (void *)altinfo); + altinfo = OSPC_OSNULL; } } - altinfo = OSPC_OSNULL; if (ospvSource != OSPC_OSNULL) { altinfo = OSPPAltInfoNew(OSPM_STRLEN(ospvSource), ospvSource, OSPC_ALTINFO_TRANSPORT); if (altinfo != OSPC_OSNULL) { OSPPListAppend((OSPTLIST *)&(ospvTrans->AuthReq->SourceAlternate), (void *)altinfo); + altinfo = OSPC_OSNULL; } } - altinfo = OSPC_OSNULL; if (ospvUser != OSPC_OSNULL) { altinfo = OSPPAltInfoNew(OSPM_STRLEN(ospvUser), ospvUser, OSPC_ALTINFO_SUBSCRIBER); if (altinfo != OSPC_OSNULL) { OSPPListAppend((OSPTLIST *)&(ospvTrans->AuthReq->SourceAlternate), (void *)altinfo); + altinfo = OSPC_OSNULL; } } - altinfo = OSPC_OSNULL; } else { errorcode = OSPC_ERR_TRAN_SOURCE_INVALID; } @@ -1790,6 +1809,7 @@ altinfo = OSPPAltInfoNew(OSPM_STRLEN(ospvPreferredDestinations[i]), ospvPreferredDestinations[i], OSPC_ALTINFO_TRANSPORT); if (altinfo != OSPC_OSNULL) { OSPPListAppend((OSPTLIST *)&(ospvTrans->AuthReq->DestinationAlternate), (void *)altinfo); + altinfo = OSPC_OSNULL; } } else { /* we're done */ @@ -1797,7 +1817,6 @@ } i++; - altinfo = OSPC_OSNULL; } } diff -Nru osptoolkit-4.11.3+dfsg/src/ospusageind.c osptoolkit-4.13.0/src/ospusageind.c --- osptoolkit-4.11.3+dfsg/src/ospusageind.c 2016-05-19 09:07:35.000000000 +0000 +++ osptoolkit-4.13.0/src/ospusageind.c 2016-11-07 18:45:55.000000000 +0000 @@ -1930,9 +1930,20 @@ } } - /* Add service provider */ - if ((errcode == OSPC_ERR_NO_ERROR) && (trans->ServiceProvider[0] != '\0')) { - errcode = OSPPStringToElement(OSPC_MELEM_SERVICEPROVIDER, trans->ServiceProvider, 0, OSPC_OSNULL, OSPC_OSNULL, &subelem); + /* Add source service provider */ + if ((errcode == OSPC_ERR_NO_ERROR) && (trans->SrcServiceProvider[0] != '\0')) { + errcode = OSPPStringToElement(OSPC_MELEM_SERVICEPROVIDER, trans->SrcServiceProvider, 0, OSPC_OSNULL, OSPC_OSNULL, &subelem); + if (errcode == OSPC_ERR_NO_ERROR) { + OSPPXMLElemAddChild(usageindelem, subelem); + subelem = OSPC_OSNULL; + } + } + + /* Add destination service provider */ + if ((errcode == OSPC_ERR_NO_ERROR) && (usage->DestServiceProvider[0] != '\0')) { + attrtype[0] = OSPC_MATTR_TYPE; + attrvalue[0] = OSPC_ALTINFO_DESTINATION; + errcode = OSPPStringToElement(OSPC_MELEM_SERVICEPROVIDER, usage->DestServiceProvider, 1, attrtype, attrvalue, &subelem); if (errcode == OSPC_ERR_NO_ERROR) { OSPPXMLElemAddChild(usageindelem, subelem); subelem = OSPC_OSNULL; @@ -2062,6 +2073,17 @@ } } + /* Add charging vector */ + if ((errcode == OSPC_ERR_NO_ERROR) && (trans->PCVICID[0] != '\0')) { + attrtype[0] = OSPC_MATTR_TYPE; + attrvalue[0] = OSPC_ALTINFO_ICID; + errcode = OSPPStringToElement(OSPC_MELEM_CHARGINGVECTOR, trans->PCVICID, 1, attrtype, attrvalue, &subelem); + if (errcode == OSPC_ERR_NO_ERROR) { + OSPPXMLElemAddChild(usageindelem, subelem); + subelem = OSPC_OSNULL; + } + } + if (errcode == OSPC_ERR_NO_ERROR) { OSPPXMLElemAddChild(*ospvElem, usageindelem); usageindelem = OSPC_OSNULL; diff -Nru osptoolkit-4.11.3+dfsg/test/test_app.c osptoolkit-4.13.0/test/test_app.c --- osptoolkit-4.11.3+dfsg/test/test_app.c 2016-02-19 13:01:25.000000000 +0000 +++ osptoolkit-4.13.0/test/test_app.c 2016-11-07 18:45:55.000000000 +0000 @@ -702,8 +702,8 @@ int testOSPPTransactionSetNetworkId() { int errcode = 0, i = 0; - char SrcNetId[128]; - char DestNetId[128]; + char SrcNetId[OSPC_SIZE_NORID]; + char DestNetId[OSPC_SIZE_NORID]; printf("Enter the Source Network Identifier : "); fflush(stdin); @@ -1075,74 +1075,106 @@ printf("Enter destination count (0 if N/A)"); - scanf("%d", &destinationCount); - getchar(); - - printf("Setting destination count to %d\n", destinationCount); + if (scanf("%d", &destinationCount) == 1) { + printf("Setting destination count to %d\n", destinationCount); + errcode = OSPPTransactionSetDestinationCount(OSPVTransactionHandle, destinationCount); + } else { + errcode = -1; + } - errcode = OSPPTransactionSetDestinationCount(OSPVTransactionHandle, destinationCount); + getchar(); return errcode; } int testSetDuration() { + int errcode = 0; + printf("Enter duration (in seconds) : "); - scanf("%d", &duration); + if (scanf("%d", &duration) != 1) { + errcode = -1; + } + getchar(); - return 0; + return errcode; } int testSetTCCode() { + int errcode = 0; + printf("Enter TC Code: "); - scanf("%d", &TCcode); + if (scanf("%d", &TCcode) != 1) { + errcode = -1; + } + getchar(); - return 0; + return errcode; } int testSetStartTime() { + int errcode = 0; + printf("Enter Call Start Time (in seconds since 1970 GMT) : "); - scanf("%ld", &call_start_time); + if (scanf("%ld", &call_start_time) != 1) { + errcode = -1; + } + getchar(); - return 0; + return errcode; } int testSetEndTime() { + int errcode = 0; + printf("Enter Call End Time (in seconds since 1970 GMT) : "); - scanf("%ld", &call_end_time); + if (scanf("%ld", &call_end_time) != 1) { + errcode = -1; + } + getchar(); - return 0; + return errcode; } int testSetAlertTime() { + int errcode = 0; + printf("Enter Call Alert Time (in seconds since 1970 GMT) : "); - scanf("%ld", &call_alert_time); + if (scanf("%ld", &call_alert_time) != 1) { + errcode = -1; + } + getchar(); - return 0; + return errcode; } int testSetConnectTime() { + int errcode = 0; + printf("Enter Call Connect Time (in seconds since 1970 GMT) : "); - scanf("%ld", &call_connect_time); + if (scanf("%ld", &call_connect_time) != 1) { + errcode = -1; + } + getchar(); - return 0; + return errcode; } int testSetServiceType() @@ -1709,11 +1741,14 @@ } if (errcode == OSPC_ERR_NO_ERROR) { - _Read(tokenfd, (unsigned char *)&signatureLength, 4); - - OSPM_MALLOC(signature, unsigned char, signatureLength); - - _Read(tokenfd, signature, signatureLength); + if (_Read(tokenfd, (unsigned char *)&signatureLength, 4) == 4) { + OSPM_MALLOC(signature, unsigned char, signatureLength); + if (_Read(tokenfd, signature, signatureLength) != signatureLength) { + errcode = -1; + } + } else { + errcode = -1; + } _Close(tokenfd); } @@ -1862,7 +1897,7 @@ int testSetSIPHeaders() { - const unsigned number = 3; + #define number 3 const char *fingerprints[number] = { "fingerprint1", "fingerprint2", "fingerprint3" }; int errcode = 0; @@ -1929,8 +1964,17 @@ { int errcode = 0; - errcode = OSPPTransactionSetSrcNetworkId(OSPVTransactionHandle, "SrcNetworkId"); - errcode = OSPPTransactionSetDestNetworkId(OSPVTransactionHandle, "DestNetworkId"); + errcode = OSPPTransactionSetNetworkIds(OSPVTransactionHandle, "SrcNetworkId", "DestNetworkId"); + + return errcode; +} + +int testSetSwitchId() +{ + int errcode = 0; + + errcode = OSPPTransactionSetSrcSwitchId(OSPVTransactionHandle, "SrcSwitchId"); + errcode = OSPPTransactionSetDestSwitchId(OSPVTransactionHandle, "DestSwitchId"); return errcode; } @@ -2052,11 +2096,20 @@ return errcode; } -int testSetServiceProvider() +int testSetSrcServiceProvider() { int errcode = 0; - errcode = OSPPTransactionSetServiceProvider(OSPVTransactionHandle, "providerofservice"); + errcode = OSPPTransactionSetSrcServiceProvider(OSPVTransactionHandle, "srcproviderofservice"); + + return errcode; +} + +int testSetDestServiceProvider() +{ + int errcode = 0; + + errcode = OSPPTransactionSetDestServiceProvider(OSPVTransactionHandle, "dstproviderofservice"); return errcode; } @@ -2395,8 +2448,8 @@ const char *type = "Type"; const char *canon = "Canon"; int errcode = 0; -errcode = OSPPTransactionSetIdentity(OSPVTransactionHandle, strlen(sign), (const unsigned char *)sign, alg, info, type, strlen(canon), (const unsigned char *)canon); + errcode = OSPPTransactionSetIdentity(OSPVTransactionHandle, strlen(sign), (const unsigned char *)sign, alg, info, type, strlen(canon), (const unsigned char *)canon); return errcode; } @@ -2424,6 +2477,32 @@ return errcode; } +int testGetDestSwitchId() +{ + char swid[OSPC_SIZE_NORID]; + int errcode = OSPC_ERR_NO_ERROR; + + errcode = OSPPTransactionGetDestSwitchId(OSPVTransactionHandle, sizeof(swid), swid); + if (errcode == OSPC_ERR_NO_ERROR) { + printf("Destination switch ID: %s\n", swid); + } + + return errcode; +} + +int testSetChargingVector() +{ + const char *icid = "PCVICID"; + const char *genat = "PCVGENAT"; + const char *origioi = "PCVORIGIOI"; + const char *termioi = "PCVTERMIOI"; + int errcode = 0; + + errcode = OSPPTransactionSetChargingVector(OSPVTransactionHandle, icid, genat, origioi, termioi); + + return errcode; +} + int testAPI(int apinumber) { OSPTTHREADID MultProviderThrId[OSPC_MAX_PROVIDERS]; @@ -2565,16 +2644,21 @@ break; case 43: printf("Build a new transaction ? Press 1 for Yes, 0 for No : "); - scanf("%d", &build_new_trans); + if (scanf("%d", &build_new_trans) == 1) { + errcode = testBuildUsageFromScratch(OSPC_ROLE_SOURCE, build_new_trans); + } else { + errcode = -1; + } getchar(); - errcode = testBuildUsageFromScratch(OSPC_ROLE_SOURCE, build_new_trans); break; case 44: printf("Build a new transaction ? Press 1 for Yes, 0 for No : "); - scanf("%d", &build_new_trans); + if (scanf("%d", &build_new_trans) == 1) { + errcode = testBuildUsageFromScratch(OSPC_ROLE_DESTINATION, build_new_trans); + } else { + errcode = -1; + } getchar(); - errcode = - testBuildUsageFromScratch(OSPC_ROLE_DESTINATION, build_new_trans); break; case 45: errcode = testOSPPTransactionGetLookAheadInfoIfPresent(); @@ -2631,42 +2715,46 @@ break; case 100: printf("Enter the number of Providers to be created .. "); - scanf("%d", &num_providers); - getchar(); - if (num_providers > OSPC_MAX_PROVIDERS) { - printf("Cannot run the test. The entered value is greater than the maximum providers allowed\n"); - errcode = OSPC_ERR_PROV_MAX_PROVIDERS; - } else { - printf("Enter the number of Transactions to be run .. "); - scanf("%d", &trans_to_run); - getchar(); - if (2 * trans_to_run > OSPC_MAX_TRANS) { - errcode = OSPC_ERR_TRAN_NO_TRANS_SPACE; - printf("Cannot run the test. The entered value is greater than the maximum transactions allowed\n"); - } - - if ((errcode == 0) && (trans_to_run > MAX_QUEUE_SIZE)) { - printf("Warning !!! The toolkit may not be able to process - %d calls because the maximum queue size is - %d\n", - trans_to_run, MAX_QUEUE_SIZE); - } - - /* - * Launch the threads - */ - if (errcode == 0) { - for (i = 0; i < num_providers; i++) { - OSPM_CREATE_THREAD(MultProviderThrId[i], - NULL, - testNonBlockingPerformanceTest, - (void *)&trans_to_run, errcode); - - printf("Created Thread [%d] with thread id: [%lu]\n", i, (unsigned long int)MultProviderThrId[i]); - } - for (i = 0; i < num_providers; i++) { - OSPM_THR_JOIN(MultProviderThrId[i], NULL); + if (scanf("%d", &num_providers) == 1) { + if (num_providers > OSPC_MAX_PROVIDERS) { + printf("Cannot run the test. The entered value is greater than the maximum providers allowed\n"); + errcode = OSPC_ERR_PROV_MAX_PROVIDERS; + } else { + printf("Enter the number of Transactions to be run .. "); + if (scanf("%d", &trans_to_run) == 1) { + if (2 * trans_to_run > OSPC_MAX_TRANS) { + errcode = OSPC_ERR_TRAN_NO_TRANS_SPACE; + printf("Cannot run the test. The entered value is greater than the maximum transactions allowed\n"); + } + + if ((errcode == 0) && (trans_to_run > MAX_QUEUE_SIZE)) { + printf("Warning !!! The toolkit may not be able to process - %d calls because the maximum queue size is - %d\n", + trans_to_run, MAX_QUEUE_SIZE); + } + + /* + * Launch the threads + */ + if (errcode == 0) { + for (i = 0; i < num_providers; i++) { + OSPM_CREATE_THREAD(MultProviderThrId[i], + NULL, + testNonBlockingPerformanceTest, + (void *)&trans_to_run, errcode); + + printf("Created Thread [%d] with thread id: [%lu]\n", i, (unsigned long int)MultProviderThrId[i]); + } + for (i = 0; i < num_providers; i++) { + OSPM_THR_JOIN(MultProviderThrId[i], NULL); + } + } } + getchar(); } + } else { + errcode = -1; } + getchar(); break; case 101: errcode = testNonBlockingPerformanceTestForCapabilities(); @@ -2706,12 +2794,13 @@ break; case 222: errcode = testSetNetworkId(); + errcode = testSetSwitchId(); break; case 223: errcode = testSetSessionId(); break; case 224: - errcode = testSetCustomInfo(true); + errcode = testSetCustomInfo(1); break; case 225: errcode = testSetReleaseSource(); @@ -2730,7 +2819,8 @@ errcode = testSetNetTransCalled(); break; case 230: - errcode = testSetServiceProvider(); + errcode = testSetSrcServiceProvider(); + errcode = testSetDestServiceProvider(); break; case 231: errcode = testSetSystemId(); @@ -2761,6 +2851,9 @@ case 239: errcode = testSetCallType(); break; + case 240: + errcode = testSetChargingVector(); + break; case 250: errcode = testGetNumberPortability(); break; @@ -2776,6 +2869,9 @@ case 254: errcode = testGetIdentity(); break; + case 255: + errcode = testGetDestSwitchId(); + break; case 300: errcode = testStatsLost(); break; @@ -2814,6 +2910,10 @@ errcode = testOSPPTransactionNew(); } if (errcode == OSPC_ERR_NO_ERROR) { + errcode = testSetNetworkId(); + errcode = testSetSwitchId(); + } + if (errcode == OSPC_ERR_NO_ERROR) { errcode = testSetOperatorName(); } if (errcode == OSPC_ERR_NO_ERROR) { @@ -2838,18 +2938,21 @@ errcode = testSetJIP(); } if (errcode == OSPC_ERR_NO_ERROR) { - errcode = testSetServiceProvider(); + errcode = testSetSrcServiceProvider(); } if (errcode == OSPC_ERR_NO_ERROR) { errcode = testSetCallingPartyInfo(); } if (errcode == OSPC_ERR_NO_ERROR) { - errcode = testSetCustomInfo(true); + errcode = testSetCustomInfo(1); } if (errcode == OSPC_ERR_NO_ERROR) { errcode = testSetIdentity(); } if (errcode == OSPC_ERR_NO_ERROR) { + errcode = testSetChargingVector(); + } + if (errcode == OSPC_ERR_NO_ERROR) { errcode = testOSPPTransactionRequestAuthorisation(); } /* 1st destination */ @@ -2866,6 +2969,9 @@ errcode = testSetProviderPDD(3010); } if (errcode == OSPC_ERR_NO_ERROR) { + errcode = testSetDestServiceProvider(); + } + if (errcode == OSPC_ERR_NO_ERROR) { errcode = testOSPPTransactionRecordFailure(); } /* 2nd destination */ @@ -2903,13 +3009,10 @@ errcode = testSetCodec(); } if (errcode == OSPC_ERR_NO_ERROR) { - errcode = testSetNetworkId(); - } - if (errcode == OSPC_ERR_NO_ERROR) { errcode = testSetSessionId(); } if (errcode == OSPC_ERR_NO_ERROR) { - errcode = testSetCustomInfo(false); + errcode = testSetCustomInfo(0); } if (errcode == OSPC_ERR_NO_ERROR) { errcode = testSetReleaseSource(); @@ -3082,7 +3185,7 @@ printf("216) Set Realms 217) Set Application ID\n"); printf("218) Set SIP Headers 219) Set Total Setup Attempts\n"); printf("220) Set Signaling Protocol 221) Set Codec\n"); - printf("222) Set Network ID 223) Set Session ID\n"); + printf("222) Set Network/Switch ID 223) Set Session ID\n"); printf("224) Set Custom Info 225) Set Release Source\n"); printf("226) Set Call Party Info 227) Set Transfer ID\n"); printf("228) Set Transfer Status 229) Set Network Translated Called Number\n"); @@ -3091,9 +3194,10 @@ printf("234) Set User Agent 235) Set Media Addresses\n"); printf("236) Set Proxy Addresses 237) Set Provider PDD\n"); printf("238) Set JIP 239) Set Call Type\n"); + printf("240) Set Charging Vector\n"); printf("250) Get NP parameters 251) Get Operator Names\n"); printf("252) Get URLs 253) Get CNAM\n"); - printf("254) Get Identity\n"); + printf("254) Get Identity 255) Get Destination Switch ID\n"); printf("300) Set Lost 301) Set Jitter\n"); printf("302) Set Delay 303) Set Round Trip Delay\n"); printf("304) Set Octets 305) Set Packets\n"); @@ -3102,11 +3206,15 @@ printf("---------------------------------------------------------------------\n"); printf("Enter function number or 'q' to quit => "); } - fgets(inbuf, 256, stdin); - if (inbuf[0] == 'q' || inbuf[0] == 'Q') - funcnum = -1; - else - funcnum = atoi(inbuf); + if (fgets(inbuf, 256, stdin) != NULL) { + if (inbuf[0] == 'q' || inbuf[0] == 'Q') { + funcnum = -1; + } else { + funcnum = atoi(inbuf); + } + } else { + funcnum = 0; + } return funcnum; } @@ -3791,9 +3899,11 @@ fflush(stdin); printf("Enter the number of Simultaneous Calls : "); - scanf("%d", &TEST_NUM); + if (scanf("%d", &TEST_NUM) != 1) { + TEST_NUM = OSPC_MAX_TRANS > MAX_QUEUE_SIZE ? MAX_QUEUE_SIZE : OSPC_MAX_TRANS; + } - if ((TEST_NUM) > OSPC_MAX_TRANS) + if (TEST_NUM > OSPC_MAX_TRANS) printf("Warning !! The toolkit may not be able to process - %d Calls because the maximum transactions that can be created is - %d\n", TEST_NUM, OSPC_MAX_TRANS);