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

📄 ospusagecnf.c

📁 mgcp协议源代码。支持多种编码:g711
💻 C
📖 第 1 页 / 共 2 页
字号:
/**########################################################################*########################################################################*########################################################################*                                                               *   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.                                      *                                     *******#########################################################################*#########################################################################*#########################################################################*//* * ospusagecnf.c - OSP usage confirmation 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 "ospusage.h"#include "ospusagecnf.h"#include "ospstatus.h"#include "osputils.h"#include "ospciscoext.h"/*-----------------------------------------------------------------------* * OSPPUsageCnfDelete() - destroy specified UsageCnf object *-----------------------------------------------------------------------*/voidOSPPUsageCnfDelete(OSPTUSAGECNF **ospvUsageCnf){    if (*ospvUsageCnf != OSPC_OSNULL)    {        if (OSPPUsageCnfHasStatus(*ospvUsageCnf))        {            OSPPStatusDelete(&((*ospvUsageCnf)->ospmUsageCnfStatus));        }        if((*ospvUsageCnf)->ospmUsageCnfTNAudit != OSPC_OSNULL)        {                  OSPPTNAuditDelete(&((*ospvUsageCnf)->ospmUsageCnfTNAudit));        }        if((*ospvUsageCnf)->ospmUsageCnfCSAudit != OSPC_OSNULL)        {                  OSPPCSAuditDelete(&((*ospvUsageCnf)->ospmUsageCnfCSAudit));        }        if((*ospvUsageCnf)->ospmUsageCnfComponentId != OSPC_OSNULL)        {                  OSPM_FREE((*ospvUsageCnf)->ospmUsageCnfComponentId);        }        if((*ospvUsageCnf)->ospmUsageCnfMessageId != OSPC_OSNULL)        {            OSPM_FREE((*ospvUsageCnf)->ospmUsageCnfMessageId);        }        OSPM_FREE(*ospvUsageCnf);        *ospvUsageCnf = OSPC_OSNULL;    }}#ifdef OSPC_DEBUG/**//*-----------------------------------------------------------------------* * OSPPUsageCnfSetTimestamp() - set the timestamp *-----------------------------------------------------------------------*/void                                /* nothing returned */OSPPUsageCnfSetTimestamp(    OSPTUSAGECNF *ospvUsageCnf,     /* usage cnfication to set */    OSPTTIME ospvTimestamp          /* timestamp to set to */){    if (ospvUsageCnf != OSPC_OSNULL)    {        if(ospvTimestamp  != 0)        {            ospvUsageCnf->ospmUsageCnfTimestamp = ospvTimestamp;        }    }    return;}/**//*-----------------------------------------------------------------------* * OSPPUsageCnfHasStatus() - does the usage confirmation have * a status? *-----------------------------------------------------------------------*/unsigned                            /* returns non-zero if number exists */OSPPUsageCnfHasStatus(    OSPTUSAGECNF *ospvUsageCnf        /* usage confirmation effected */){    unsigned ospvHasStatus = OSPC_FALSE;    if(ospvUsageCnf != OSPC_OSNULL)    {        ospvHasStatus = ((ospvUsageCnf)->ospmUsageCnfStatus != OSPC_OSNULL);    }    return(ospvHasStatus);}/**//*-----------------------------------------------------------------------* * OSPPUsageCnfGetStatus() - returns the status for an  * usage confirmation *-----------------------------------------------------------------------*/OSPTSTATUS *                                 /* returns pointer to dest */    OSPPUsageCnfGetStatus(    OSPTUSAGECNF *ospvUsageCnf               /* usage confirmation */    ){    OSPTSTATUS *ospvStatus = OSPC_OSNULL;    if (ospvUsageCnf != OSPC_OSNULL)    {        ospvStatus = (ospvUsageCnf)->ospmUsageCnfStatus;    }    return(ospvStatus);}#endif /* OSPC_DEBUG *//**//*-----------------------------------------------------------------------* * OSPPUsageCnfHasComponentId() - is the component id set ? *-----------------------------------------------------------------------*/unsigned                    /* returns non-zero if component id is set */OSPPUsageCnfHasComponentId(    OSPTUSAGECNF *ospvUsageCnf){  return (ospvUsageCnf->ospmUsageCnfComponentId != OSPC_OSNULL);}/**//*-----------------------------------------------------------------------* * OSPPUsageCnfGetComponentId() - returns a new copy of the component id. *-----------------------------------------------------------------------*/unsigned char  *OSPPUsageCnfGetComponentId(    OSPTUSAGECNF *ospvUsageCnf){    unsigned char   *componentstring   = OSPC_OSNULL;    int             len                = 0;    if (OSPPUsageCnfHasComponentId(ospvUsageCnf))    {        len = OSPM_STRLEN((const char *)(ospvUsageCnf->ospmUsageCnfComponentId));        OSPM_MALLOC(componentstring, unsigned char, len + 1);        OSPM_MEMSET(componentstring, 0, len + 1);        OSPM_MEMCPY(componentstring, ospvUsageCnf->ospmUsageCnfComponentId, len);    }    return componentstring;}/**//*-----------------------------------------------------------------------* * OSPPUsageCnfSetComponentId() - creates space and copies in the string. *-----------------------------------------------------------------------*/void      OSPPUsageCnfSetComponentId(    OSPTUSAGECNF  *ospvUsageCnf,    /* In - pointer to Usage Confirm struct */    unsigned char *ospvComponentId  /* In - pointer to component id string */    ){    int len = OSPM_STRLEN((const char *)ospvComponentId);    if(ospvUsageCnf != OSPC_OSNULL)    {        if(ospvUsageCnf->ospmUsageCnfComponentId != OSPC_OSNULL)        {            OSPM_FREE(ospvUsageCnf->ospmUsageCnfComponentId);            }        OSPM_MALLOC(ospvUsageCnf->ospmUsageCnfComponentId, unsigned char, len + 1);        OSPM_MEMSET(ospvUsageCnf->ospmUsageCnfComponentId, 0, len + 1);        OSPM_MEMCPY(ospvUsageCnf->ospmUsageCnfComponentId, ospvComponentId, len);    }    return;}/**//*-----------------------------------------------------------------------* * OSPPUsageCnfNew() - creates a new (empty) usage confirmation *-----------------------------------------------------------------------*/OSPTUSAGECNF *                                 /* returns pointer or NULL */    OSPPUsageCnfNew(void){    OSPTUSAGECNF *usagecnf;    OSPM_MALLOC(usagecnf, OSPTUSAGECNF,sizeof(OSPTUSAGECNF));    if (usagecnf != (OSPTUSAGECNF *)OSPC_OSNULL)    {        OSPM_MEMSET(usagecnf, 0, sizeof(OSPTUSAGECNF));        OSPPListLinkNew (&(usagecnf->ospmUsageCnfLink));        usagecnf->ospmUsageCnfTimestamp = (OSPTTIME)0;        usagecnf->ospmUsageCnfStatus = OSPC_OSNULL;        usagecnf->ospmUsageCnfCSAudit = OSPC_OSNULL;        usagecnf->ospmUsageCnfTNAudit = OSPC_OSNULL;        usagecnf->ospmUsageCnfComponentId = OSPC_OSNULL;        usagecnf->ospmUsageCnfMessageId = OSPC_OSNULL;    }    return usagecnf;}OSPTCSAUDIT *OSPPUsageCnfGetCSAudit(    OSPTUSAGECNF *ospvUsageCnf){    if(ospvUsageCnf != OSPC_OSNULL)    {        return ospvUsageCnf->ospmUsageCnfCSAudit;    }    else    {        return OSPC_OSNULL;    }}OSPTTNAUDIT *OSPPUsageCnfGetTNAudit(    OSPTUSAGECNF *ospvUsageCnf){    if(ospvUsageCnf != OSPC_OSNULL)    {        return ospvUsageCnf->ospmUsageCnfTNAudit;    }    else    {        return OSPC_OSNULL;    }}/* * OSPPUsageCnfComponentIdFromElement() - Get component id attribute from element. */void   OSPPUsageCnfComponentIdFromElement(    OSPTXMLELEM *ospvElem,     const unsigned char **ospvComponentId)

⌨️ 快捷键说明

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