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

📄 ospdest.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.                                      *                                     *******#########################################################################*#########################################################################*#########################################################################*//* * ospdest.c - OSP destination 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 "ospdest.h"#include "ospusage.h"#ifdef OSPC_DEBUG/**//*-----------------------------------------------------------------------* * OSPPDestHasNumber() - does the destination include a called number? *-----------------------------------------------------------------------*/unsigned                            /* returns non-zero if number exists */OSPPDestHasNumber(    OSPTDEST *ospvDest              /* destination effected */){    unsigned ospvHasNumber = OSPC_FALSE;    if (ospvDest != OSPC_OSNULL)     {        ospvHasNumber = ((ospvDest)->ospmDestNumber[0] != '\0');    }    return(ospvHasNumber);}/**//*-----------------------------------------------------------------------* * OSPPDestSetNumber() - set the called number for a destination *-----------------------------------------------------------------------*/void                                       /* nothing returned */OSPPDestSetNumber(    OSPTDEST            *ospvDest,         /* destination to set */    const unsigned char *ospvNum           /* called number (as string) */){    size_t  len = 0;    len=0;    if (ospvDest != OSPC_OSNULL)     {        if (ospvNum  != OSPC_OSNULL)         {            OSPM_MEMCPY((ospvDest)->ospmDestNumber,                 (ospvNum),                 osp_min(OSPC_E164NUMSIZE,OSPM_STRLEN((const char *)ospvNum)+1));        }    }}/**//*-----------------------------------------------------------------------* * OSPPDestGetNumber() - returns the called number for a destination *-----------------------------------------------------------------------*/unsigned char *                     /* returns number as string */OSPPDestGetNumber(    OSPTDEST *ospvDest                     /* destination */){    unsigned char *ospvNum = OSPC_OSNULL;    if (ospvDest != OSPC_OSNULL)     {        ospvNum = ospvDest->ospmDestNumber;    }    return(ospvNum);}/**//*-----------------------------------------------------------------------* * OSPPDestHasAddr() - does a destination have a Addr? *-----------------------------------------------------------------------*/unsigned                                   /* returns non-zero if exists */OSPPDestHasAddr(    OSPTDEST *ospvDest                     /* destination in question */){    unsigned ospvHasAddr = OSPC_FALSE;    if (ospvDest != OSPC_OSNULL)     {        ospvHasAddr = (ospvDest->ospmDestAddr[0] != '\0');    }    return(ospvHasAddr);}/**//*-----------------------------------------------------------------------* * OSPPDestSetAddr() - sets the signalling address for a destination *-----------------------------------------------------------------------*/void                                       /* nothing returned */OSPPDestSetAddr(    OSPTDEST            *ospvDest,         /* destination */    const unsigned char *ospvAddr          /* signal address as string */){    size_t  len;    len=0;    if (ospvDest != OSPC_OSNULL)     {        if (ospvAddr != OSPC_OSNULL)         {            OSPM_MEMCPY((ospvDest)->ospmDestAddr, (ospvAddr),                 osp_min(OSPC_SIGNALADDRSIZE,OSPM_STRLEN((const char *)ospvAddr)+1));        }    }}/**//*-----------------------------------------------------------------------* * OSPPDestGetAddr() - returns the signalling address for a destination *-----------------------------------------------------------------------*/unsigned char *                      /* returns address as string */OSPPDestGetAddr(    OSPTDEST *ospvDest                     /* destination in question */){    unsigned char *ospvAddr = OSPC_OSNULL;    if  (ospvDest != OSPC_OSNULL)     {        ospvAddr = ((ospvDest)->ospmDestAddr);    }    return(ospvAddr);}/**//*-----------------------------------------------------------------------* * OSPPDestDevHasAddr() - does a destination have a Dev Addr? *-----------------------------------------------------------------------*/unsigned                                   /* returns non-zero if exists */OSPPDestDevHasAddr(    OSPTDEST *ospvDest                     /* destination in question */){    unsigned ospvHasAddr = OSPC_FALSE;    if (ospvDest != OSPC_OSNULL)     {        ospvHasAddr = (ospvDest->ospmDestDevAddr[0] != '\0');    }    return(ospvHasAddr);}/**//*-----------------------------------------------------------------------* * OSPPDestDevSetAddr() - sets the signalling address for a destination  *  device *-----------------------------------------------------------------------*/void                                       /* nothing returned */OSPPDestDevSetAddr(    OSPTDEST            *ospvDest,         /* destination */    const unsigned char *ospvAddr          /* signal address as string */){    size_t  len;    len=0;    if (ospvDest != OSPC_OSNULL)     {        if (ospvAddr != OSPC_OSNULL)         {            OSPM_MEMCPY((ospvDest)->ospmDestDevAddr, (ospvAddr),                 osp_min(OSPC_SIGNALADDRSIZE,OSPM_STRLEN((const char *)ospvAddr)+1));        }    }}/**//*-----------------------------------------------------------------------* * OSPPDestDevGetAddr() - returns the signalling address for a destination *  device *-----------------------------------------------------------------------*/unsigned char *                      /* returns address as string */OSPPDestDevGetAddr(    OSPTDEST *ospvDest                     /* destination in question */){    unsigned char *ospvAddr = OSPC_OSNULL;    if  (ospvDest != OSPC_OSNULL)     {        ospvAddr = ((ospvDest)->ospmDestDevAddr);    }    return(ospvAddr);}/**//*-----------------------------------------------------------------------* * OSPPDestHasValidAfter() - Does a destination have a valid after time? *-----------------------------------------------------------------------*/unsigned                                   /* returns non-zero if time */OSPPDestHasValidAfter(    OSPTDEST *ospvDest                     /* destination in question */){    unsigned ospvHasTime = OSPC_FALSE;    if(ospvDest != OSPC_OSNULL)     {        ospvHasTime = ((ospvDest)->ospmDestValidAfter != OSPC_TIMEMIN);    }    return(ospvHasTime);}/**//*-----------------------------------------------------------------------* * OSPPDestSetValidAfter() - sets the valid after time for a destination *-----------------------------------------------------------------------*/void                                       /* nothing returned */OSPPDestSetValidAfter(    OSPTDEST *ospvDest,    OSPTTIME  ospvTime){    if (ospvDest != OSPC_OSNULL)     {        (ospvDest)->ospmDestValidAfter = (ospvTime);    }}/**//*-----------------------------------------------------------------------* * OSPPDestGetValidAfter() - returns valid after time for a destination *-----------------------------------------------------------------------*/OSPTTIME                                   /* returns the time value */OSPPDestGetValidAfter(    OSPTDEST *ospvDest                     /* destination in question */    ){    OSPTTIME ospvTime = 0;    if (ospvDest != OSPC_OSNULL)     {        ospvTime = (ospvDest)->ospmDestValidAfter;    }    return(ospvTime);}/**//*-----------------------------------------------------------------------* * OSPPDestHasValidUntil() - does destination have a valid until time? *-----------------------------------------------------------------------*/unsigned                                   /* returns non-zero if time */OSPPDestHasValidUntil(    OSPTDEST *ospvDest                     /* destination in question */){    unsigned ospvHasTime = OSPC_FALSE;    if (ospvDest != OSPC_OSNULL)     {        ospvHasTime = ((ospvDest)->ospmDestValidUntil != OSPC_TIMEMAX);    }    return(ospvHasTime);}/**//*-----------------------------------------------------------------------* * OSPPDestSetValidUntil() - sets valid until time for destination *-----------------------------------------------------------------------*/void                                       /* nothing returned */OSPPDestSetValidUntil(    OSPTDEST *ospvDest,                    /* destination in question */    OSPTTIME ospvTime                      /* time to set */){    if (ospvDest != OSPC_OSNULL)     {        (ospvDest)->ospmDestValidUntil = (ospvTime);    }}/**//*-----------------------------------------------------------------------* * OSPPDestGetValidUntil() - returns valid until time for destination *-----------------------------------------------------------------------*/OSPTTIME                                   /* returns time */OSPPDestGetValidUntil(    OSPTDEST *ospvDest                     /* destination in question */    ){    OSPTTIME ospvTime = 0;    if (ospvDest != OSPC_OSNULL)     {        ospvTime = ospvDest->ospmDestValidUntil;    }    return(ospvTime);}/**//*-----------------------------------------------------------------------* * OSPPDestHasAuthority() - does an authority URL exist for destination? *-----------------------------------------------------------------------*/unsigned                                   /* returns non-zero if exists */OSPPDestHasAuthority(    OSPTDEST *ospvDest                     /* destination in question */){    unsigned ospvHasAuth = OSPC_FALSE;    if (ospvDest != OSPC_OSNULL)     {        ospvHasAuth = (ospvDest->ospmDestAuthority[0] != '\0');    }    return(ospvHasAuth);}/**//*-----------------------------------------------------------------------* * OSPPDestSetAuthority() - sets authority URL for destination *-----------------------------------------------------------------------*/void                                       /* nothing returned */OSPPDestSetAuthority(    OSPTDEST            *ospvDest,         /* destination in question */    const unsigned char *ospvAuth          /* authority URL */){    if (ospvDest != OSPC_OSNULL)     {        if (ospvAuth != OSPC_OSNULL)         {            OSPM_STRNCPY((char *)((ospvDest)->ospmDestAuthority),                (const char *)(ospvAuth),                 osp_min(OSPM_STRLEN((const char *)ospvAuth)+1,OSPC_URLSIZE-1));        }    }}/**//*-----------------------------------------------------------------------* * OSPPDestHasCallId() - does a destination have a Call ID? *-----------------------------------------------------------------------*/unsigned                                   /* returns non-zero if exists */OSPPDestHasCallId(    OSPTDEST *ospvDest                     /* destination in question */){    unsigned ospvHasId = OSPC_FALSE;    if (ospvDest != OSPC_OSNULL)     {        ospvHasId = ((ospvDest)->ospmDestCallId != OSPC_OSNULL);    }    return(ospvHasId);}/**//*-----------------------------------------------------------------------* * OSPPDestGetCallId() - gets the call ID for a destination *-----------------------------------------------------------------------*/OSPTCALLID *                               /* returns call ID pointer */OSPPDestGetCallId(    OSPTDEST *ospvDest                     /* destination in question */    ){    OSPTCALLID *ospvCallId = OSPC_OSNULL;    if (ospvDest != OSPC_OSNULL)     {        ospvCallId = ((ospvDest)->ospmDestCallId);    }    return(ospvCallId);}/**//*-----------------------------------------------------------------------* * OSPPDestHasToken() - does a destination have a Token? *-----------------------------------------------------------------------*/unsigned                                   /* returns non-zero if exists */

⌨️ 快捷键说明

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