ospauthind.c

来自「mgcp协议源代码。支持多种编码:g711」· C语言 代码 · 共 604 行 · 第 1/2 页

C
604
字号
/**########################################################################*########################################################################*########################################################################*                                                               *   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.                                      *                                     *******#########################################################################*#########################################################################*#########################################################################*//* * ospauthind.c - OSP authorisation 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 "osptoken.h"#include "ospauthind.h"#include "osputils.h"#ifdef OSPC_DEBUG/**//*-----------------------------------------------------------------------* * OSPPAuthIndSetTimestamp() - sets the timestamp for an authorisation indication *-----------------------------------------------------------------------*/void                                       /* nothing returned */OSPPAuthIndSetTimestamp(    OSPTAUTHIND *ospvAuthInd,    OSPTTIME  ospvTime){    if (ospvAuthInd != OSPC_OSNULL)    {        (ospvAuthInd)->ospmAuthIndTimestamp = (ospvTime);    }}/**//*-----------------------------------------------------------------------* * OSPPAuthIndSetRole() - sets the role for an authorisation indication *-----------------------------------------------------------------------*/void                                       /* nothing returned */OSPPAuthIndSetRole(    OSPTAUTHIND *ospvAuthInd,    unsigned  ospvRole){    if (ospvAuthInd != OSPC_OSNULL)    {        (ospvAuthInd)->ospmAuthIndRole = (ospvRole);        (ospvAuthInd)->ospmAuthIndHasRole = OSPC_TRUE;    }}/**//*-----------------------------------------------------------------------* * OSPPAuthIndHasCallId() - does an authorisation indication have a Call ID? *-----------------------------------------------------------------------*/unsigned                                   /* returns non-zero if exists */OSPPAuthIndHasCallId(    OSPTAUTHIND *ospvAuthInd                  /* authorisation indication */){    unsigned ospvHasCallId = OSPC_FALSE;    if (ospvAuthInd != OSPC_OSNULL)    {        ospvHasCallId = ((ospvAuthInd)->ospmAuthIndCallId != OSPC_OSNULL);    }    return(ospvHasCallId);}/**//*-----------------------------------------------------------------------* * OSPPAuthIndGetCallId() - gets the call ID for an authorisation indication *-----------------------------------------------------------------------*/OSPTCALLID *                               /* returns call ID pointer */    OSPPAuthIndGetCallId(    OSPTAUTHIND *ospvAuthInd               /* authorisation indication */    ){    OSPTCALLID *ospvCallId = OSPC_OSNULL;    if (ospvAuthInd != OSPC_OSNULL)    {        ospvCallId = ((ospvAuthInd)->ospmAuthIndCallId);    }    return(ospvCallId);}/**//*-----------------------------------------------------------------------* * OSPPAuthIndGetCallIdSize() - gets the call ID size for an authorisation indication *-----------------------------------------------------------------------*/unsigned                                   /* returns call ID size */    OSPPAuthIndGetCallIdSize(    OSPTAUTHIND *ospvAuthInd               /* authorisation indication */    ){    unsigned ospvCallIdSize = 0;    if (ospvAuthInd != OSPC_OSNULL)    {        ospvCallIdSize = OSPPCallIdGetSize(((ospvAuthInd)->ospmAuthIndCallId));    }    return(ospvCallIdSize);}/**//*-----------------------------------------------------------------------* * OSPPAuthIndGetCallIdValue() - gets the call ID value for an authorisation indication *-----------------------------------------------------------------------*/unsigned char *                             /* returns call ID value */    OSPPAuthIndGetCallIdValue(    OSPTAUTHIND *ospvAuthInd               /* authorisation indication */    ){    unsigned char *ospvCallIdValue = OSPC_OSNULL;    if (ospvAuthInd != OSPC_OSNULL)    {        ospvCallIdValue = OSPPCallIdGetValue(((ospvAuthInd)->ospmAuthIndCallId));    }    return(ospvCallIdValue);}/**//*-----------------------------------------------------------------------* * OSPPAuthIndHasSourceNumber() - does the authorisation indication have * a source number? *-----------------------------------------------------------------------*/unsigned                            /* returns non-zero if number exists */OSPPAuthIndHasSourceNumber(    OSPTAUTHIND *ospvAuthInd        /* authorisation indication effected */){    unsigned ospvHasSourceNumber = OSPC_FALSE;    if (ospvAuthInd != OSPC_OSNULL)    {        ospvHasSourceNumber = ((ospvAuthInd)->ospmAuthIndSourceNumber[0] != '\0');    }    return(ospvHasSourceNumber);}/**//*-----------------------------------------------------------------------* * OSPPAuthIndSetSourceNumber() - set the source number for an * authorisation indication *-----------------------------------------------------------------------*/void                                       /* nothing returned */OSPPAuthIndSetSourceNumber(    OSPTAUTHIND         *ospvAuthInd,      /* authorisation indication  to set */    const unsigned char *ospvNum           /* source number (as string) */){    if (ospvAuthInd != OSPC_OSNULL)    {        if (ospvNum  != OSPC_OSNULL)        {            OSPM_STRNCPY((char *)(ospvAuthInd)->ospmAuthIndSourceNumber,                 (const char *)(ospvNum),                 osp_min(OSPM_STRLEN((const char *)ospvNum)+1,OSPC_E164NUMSIZE-1));        }    }}/**//*-----------------------------------------------------------------------* * OSPPAuthIndGetSourceNumber() - returns the source number for an  * authorisation indication *-----------------------------------------------------------------------*/unsigned char *                      /* returns number as string */OSPPAuthIndGetSourceNumber(    OSPTAUTHIND *ospvAuthInd               /* authorisation indication */){    unsigned char *ospvSourceNumber = OSPC_OSNULL;    if (ospvAuthInd != OSPC_OSNULL)    {        ospvSourceNumber = (ospvAuthInd->ospmAuthIndSourceNumber);    }    return(ospvSourceNumber);}/**//*-----------------------------------------------------------------------* * OSPPAuthIndHasDestNumber() - does the authorisation indication include a * dest number? *-----------------------------------------------------------------------*/unsigned                            /* returns non-zero if number exists */OSPPAuthIndHasDestNumber(    OSPTAUTHIND *ospvAuthInd        /* authorisation indication effected */){    unsigned ospvHasDestNumber = OSPC_FALSE;    if (ospvAuthInd != OSPC_OSNULL)    {        ospvHasDestNumber = ((ospvAuthInd)->ospmAuthIndDestNumber[0] != '\0');    }    return(ospvHasDestNumber);}/**//*-----------------------------------------------------------------------* * OSPPAuthIndSetDestNumber() - set the destination number for an * authorisation indication *-----------------------------------------------------------------------*/void                                       /* nothing returned */OSPPAuthIndSetDestNumber(    OSPTAUTHIND         *ospvAuthInd,      /* authorisation indication to set */    const unsigned char *ospvNum           /* destination number (as string) */){    if (ospvAuthInd != OSPC_OSNULL)    {        if (ospvNum  != OSPC_OSNULL)        {            OSPM_STRNCPY((char *)(ospvAuthInd)->ospmAuthIndDestNumber,                 (const char *)(ospvNum),                 osp_min(OSPM_STRLEN((const char *)ospvNum)+1,OSPC_E164NUMSIZE-1));        }    }}/**//*-----------------------------------------------------------------------* * OSPPAuthIndGetDestNumber() - returns the destination number for an * authorisation indication *-----------------------------------------------------------------------*/unsigned char *                      /* returns number as string */OSPPAuthIndGetDestNumber(    OSPTAUTHIND *ospvAuthInd               /* authorisation indication */){    unsigned char *ospvDestNumber = OSPC_OSNULL;    if (ospvAuthInd != OSPC_OSNULL)    {        ospvDestNumber = ((ospvAuthInd)->ospmAuthIndDestNumber);    }    return(ospvDestNumber);}/**//*-----------------------------------------------------------------------* * OSPPAuthIndHasSourceAlt() - does an authorisation indication have a  * Source Alternate? *-----------------------------------------------------------------------*/unsigned                                   /* returns non-zero if exists */OSPPAuthIndHasSourceAlt(    OSPTAUTHIND *ospvAuthInd               /* authorisation indication */){    unsigned ospvHasSourceAlt = OSPC_FALSE;    if (ospvAuthInd != OSPC_OSNULL)    {        ospvHasSourceAlt = (OSPPAuthIndFirstSourceAlt(ospvAuthInd) != OSPC_OSNULL);    }    return(ospvHasSourceAlt);}/**//*-----------------------------------------------------------------------* * OSPPAuthIndFirstSourceAlt() - gets the First Source alternate for an  * authorisation indication *-----------------------------------------------------------------------*/OSPTALTINFO *                              /* returns alt info pointer */    OSPPAuthIndFirstSourceAlt(    OSPTAUTHIND *ospvAuthInd               /* authorisation indication */    ){    OSPTALTINFO *ospvAltInfo = OSPC_OSNULL;    if (ospvAuthInd != OSPC_OSNULL)    {

⌨️ 快捷键说明

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