⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ospusageind.c

📁 mgcp协议源代码。支持多种编码:g711
💻 C
📖 第 1 页 / 共 4 页
字号:
/**########################################################################*########################################################################*########################################################################*                                                               *   COPYRIGHT (c) 1998, 1999 by TransNexus, LLC                          **   This software contains proprietary and confidential information  *   of TransNexus, LLC. Except as may be set forth in the license    *   agreement under which this software is supplied, use, disclosure, *   or reproduction is prohibited without the prior, express, written*   consent of TransNexus, LLC.                                      *                                     *******#########################################################################*#########################################################################*#########################################################################*//* * ospusageind.c - OSP usage indication functions */#include "osp.h"#include "osperrno.h"#include "ospbfr.h"#include "osplist.h"#include "ospxmlattr.h"#include "ospxmlelem.h"#include "ospmsgattr.h"#include "ospmsgelem.h"#include "ospcallid.h"#include "ospusage.h"#include "ospusageind.h"#include "ospstatistics.h"#include "osputils.h"#ifdef OSPC_DEBUG/**//*-----------------------------------------------------------------------* *  OSPPUsageIndHasTimestamp() - is the timestamp set ? *-----------------------------------------------------------------------*/unsigned                            /* returns non-zero if number exists */OSPPUsageIndHasTimestamp(    OSPTUSAGEIND *ospvUsageInd              /* Usage Indication effected */){    unsigned ospvHasTimestamp = OSPC_FALSE;    if (ospvUsageInd != OSPC_OSNULL)     {        ospvHasTimestamp = ((ospvUsageInd)->ospmUsageIndTimestamp);    }    return ospvHasTimestamp;}/**//*-----------------------------------------------------------------------* * OSPPUsageIndSetTimestamp() - set the timestamp *-----------------------------------------------------------------------*/void                                /* nothing returned */OSPPUsageIndSetTimestamp(    OSPTUSAGEIND *ospvUsageInd,     /* usage indication to set */    OSPTTIME ospvTimestamp          /* timestamp to set to */){    if (ospvUsageInd != OSPC_OSNULL)     {        if (ospvTimestamp  != 0)         {            ospvUsageInd->ospmUsageIndTimestamp = ospvTimestamp;        }    }    return;}/**//*-----------------------------------------------------------------------* * OSPPUsageIndGetTimestamp() - returns the timestamp for a usage ind *-----------------------------------------------------------------------*/OSPTTIME    OSPPUsageIndGetTimestamp(    OSPTUSAGEIND *ospvUsageInd                     /* usage ind */    ){    OSPTTIME ospvTimestamp = 0;    if (ospvUsageInd != OSPC_OSNULL)     {        ospvTimestamp = ospvUsageInd->ospmUsageIndTimestamp;    }    return ospvTimestamp;}/**//*-----------------------------------------------------------------------* * OSPPUsageIndHasRole() - Does usage indication have role set? *-----------------------------------------------------------------------*/unsigned                                   /* returns non-zero if time */OSPPUsageIndHasRole(    OSPTUSAGEIND *ospvUsageInd             /* usage indication in question */){    unsigned ospvHasRole = OSPC_FALSE;    if (ospvUsageInd != OSPC_OSNULL)    {        ospvHasRole = ((ospvUsageInd)->ospmUsageIndHasRole != OSPC_FALSE);    }    return(ospvHasRole);}/**//*-----------------------------------------------------------------------* * OSPPUsageIndGetRole() - returns role for an usage indication *-----------------------------------------------------------------------*/OSPE_MSG_ROLETYPES                         /* returns the role (OGW/TGW) */    OSPPUsageIndGetRole(    OSPTUSAGEIND *ospvUsageInd             /* usage indication */    ){    OSPE_MSG_ROLETYPES ospvRole = OSPC_UNDEFINED_ROLE;    if (ospvUsageInd != OSPC_OSNULL)    {        ospvRole = (OSPE_MSG_ROLETYPES)ospvUsageInd->ospmUsageIndRole;    }    return(ospvRole);}/**//*-----------------------------------------------------------------------* * OSPPUsageIndSetRole() - sets the role for an usage indication *-----------------------------------------------------------------------*/void                                       /* nothing returned */OSPPUsageIndSetRole(    OSPTUSAGEIND    *ospvUsageInd,    unsigned        ospvRole){    if (ospvUsageInd != OSPC_OSNULL)    {        (ospvUsageInd)->ospmUsageIndRole = (ospvRole);        (ospvUsageInd)->ospmUsageIndHasRole = OSPC_TRUE;    }}/**//*-----------------------------------------------------------------------* * OSPPUsageIndHasComponentId() - is the component id set ? *-----------------------------------------------------------------------*/unsigned                    /* returns non-zero if component id is set */OSPPUsageIndHasComponentId(    OSPTUSAGEIND *ospvUsageInd){  return (ospvUsageInd->ospmUsageIndComponentId != OSPC_OSNULL);}/**//*-----------------------------------------------------------------------* * OSPPUsageIndGetComponentId() - returns a new copy of the component id. *-----------------------------------------------------------------------*/unsigned char  *OSPPUsageIndGetComponentId(    OSPTUSAGEIND *ospvUsageInd){    unsigned char   *componentstring   = OSPC_OSNULL;    int             len                = 0;    if (OSPPUsageIndHasComponentId(ospvUsageInd))    {        len = OSPM_STRLEN((const char *)ospvUsageInd->ospmUsageIndComponentId);        OSPM_MALLOC(componentstring, unsigned char, len + 1);        OSPM_MEMSET(componentstring, 0, len + 1);        OSPM_MEMCPY(componentstring, ospvUsageInd->ospmUsageIndComponentId, len);    }    return componentstring;}/**//*-----------------------------------------------------------------------* * OSPPUsageIndHasTransactionId() - is the transaction id set ? *-----------------------------------------------------------------------*/unsigned                            /* returns non-zero if number exists */OSPPUsageIndHasTransactionId(    OSPTUSAGEIND *ospvUsageInd              /* Usage Indication effected */){    unsigned ospvHasTransactionId = OSPC_FALSE;    if (ospvUsageInd != OSPC_OSNULL)     {        ospvHasTransactionId = ((ospvUsageInd)->ospmUsageIndTransactionId != 0);    }    return ospvHasTransactionId;}/**//*-----------------------------------------------------------------------* * OSPPUsageIndSetTransactionId() - set the transaction id *-----------------------------------------------------------------------*/void                                /* nothing returned */OSPPUsageIndSetTransactionId(    OSPTUSAGEIND *ospvUsageInd,     /* usage indication to set */    OSPTTRXID ospvTransactionId    /* transaction id to set to */){    if (ospvUsageInd != OSPC_OSNULL)     {        if (ospvTransactionId  != (OSPTTRXID)OSPC_OSNULL)         {            ospvUsageInd->ospmUsageIndTransactionId = ospvTransactionId;        }    }    return;}/**//*-----------------------------------------------------------------------* * OSPPUsageIndGetTransactionId() - returns the trans id for a usage ind *-----------------------------------------------------------------------*/OSPTTRXID    OSPPUsageIndGetTransactionId(    OSPTUSAGEIND *ospvUsageInd                     /* usage ind */    ){    OSPTTRXID ospvTransactionId = 0;    if (ospvUsageInd != OSPC_OSNULL)     {        ospvTransactionId = ospvUsageInd->ospmUsageIndTransactionId;    }    return ospvTransactionId;}/**//*-----------------------------------------------------------------------* * OSPPUsageIndHasCallId() - does an usage indication have a Call ID? *-----------------------------------------------------------------------*/unsigned                                   /* returns non-zero if exists */OSPPUsageIndHasCallId(    OSPTUSAGEIND *ospvUsageInd                  /* usage indication */){    unsigned ospvHasCallId = OSPC_FALSE;    if (ospvUsageInd != OSPC_OSNULL)    {        ospvHasCallId = ((ospvUsageInd)->ospmUsageIndCallId != OSPC_OSNULL);    }    return(ospvHasCallId);}/**//*-----------------------------------------------------------------------* * OSPPUsageIndGetCallId() - gets the call ID for an usage indication *-----------------------------------------------------------------------*/OSPTCALLID *                               /* returns call ID pointer */    OSPPUsageIndGetCallId(    OSPTUSAGEIND *ospvUsageInd               /* usage indication */    ){    OSPTCALLID *ospvCallId = OSPC_OSNULL;    if (ospvUsageInd != OSPC_OSNULL)    {        ospvCallId = ((ospvUsageInd)->ospmUsageIndCallId);    }    return(ospvCallId);}/**//*-----------------------------------------------------------------------* * OSPPUsageIndSetSourceNumber() - set the source number *-----------------------------------------------------------------------*/void                                /* nothing returned */OSPPUsageIndSetSourceNumber(    OSPTUSAGEIND *ospvUsageInd,     /* usage indication to set */    unsigned char *ospvSourceNumber /* source number to set to */){    if (ospvUsageInd != OSPC_OSNULL)    {        if (ospvSourceNumber  != OSPC_OSNULL)        {            OSPM_STRNCPY((char *)(ospvUsageInd)->ospmUsageIndSourceNumber,                 (const char *)(ospvSourceNumber),                osp_min(OSPC_E164NUMSIZE-1, OSPM_STRLEN((const char *) ospvSourceNumber)+1));        }    }    return;}/**//*-----------------------------------------------------------------------* * OSPPUsageIndGetSourceNumber() - returns the source number for usage ind *-----------------------------------------------------------------------*/unsigned char *OSPPUsageIndGetSourceNumber(    OSPTUSAGEIND *ospvUsageInd                     /* usage ind */){    unsigned char *ospvSourceNumber = OSPC_OSNULL;    if (ospvUsageInd != OSPC_OSNULL)    {        ospvSourceNumber = ospvUsageInd->ospmUsageIndSourceNumber;    }    return ospvSourceNumber;}/**//*-----------------------------------------------------------------------* * OSPPUsageIndSetDestNumber() - set the destination number *-----------------------------------------------------------------------*/void                                /* nothing returned */OSPPUsageIndSetDestNumber(    OSPTUSAGEIND *ospvUsageInd,     /* usage indication to set */    unsigned char *ospvDestNumber /* destination number to set to */){    if (ospvUsageInd != OSPC_OSNULL)    {        if (ospvDestNumber != OSPC_OSNULL)        {            OSPM_STRNCPY((char *)(ospvUsageInd)->ospmUsageIndDestNumber,                 (const char *)(ospvDestNumber),                 osp_min(OSPC_E164NUMSIZE-1, OSPM_STRLEN((const char *) ospvDestNumber)+1));        }    }    return;}/**//*-----------------------------------------------------------------------* * OSPPUsageIndGetDestNumber() - returns the destination number for a usage ind *-----------------------------------------------------------------------*/unsigned char *OSPPUsageIndGetDestNumber(    OSPTUSAGEIND *ospvUsageInd                     /* usage ind */){    unsigned char *ospvDestNumber = OSPC_OSNULL;    if (ospvUsageInd != OSPC_OSNULL)    {        ospvDestNumber = ospvUsageInd->ospmUsageIndDestNumber;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -