📄 ospauthind.c
字号:
ospvAltInfo = (OSPTALTINFO *)OSPPListFirst(&((ospvAuthInd)->ospmAuthIndSourceAlternate)); } return(ospvAltInfo);}/**//*-----------------------------------------------------------------------* * OSPPAuthIndNextSourceAlt() - gets the next source alternate for an * authorisation indication *-----------------------------------------------------------------------*/OSPTALTINFO * /* returns alt info pointer */ OSPPAuthIndNextSourceAlt( OSPTAUTHIND *ospvAuthInd, /* authorisation indication */ OSPTALTINFO *ospvAltInfo ){ OSPTALTINFO *altinfo = OSPC_OSNULL; if (ospvAuthInd != OSPC_OSNULL) { altinfo = (OSPTALTINFO *)OSPPListNext(&((ospvAuthInd)->ospmAuthIndSourceAlternate), ospvAltInfo); } return(altinfo);}/**//*-----------------------------------------------------------------------* * OSPPAuthIndGetSourceAltValue() - gets the source alternate value for * an authorisation indication *-----------------------------------------------------------------------*/unsigned char * /* returns alt info value */ OSPPAuthIndGetSourceAltValue( OSPTALTINFO *ospvAltInfo /* Alt info ptr */ ){ unsigned char *ospvAltInfoValue = OSPC_OSNULL; if (ospvAltInfo != OSPC_OSNULL) { ospvAltInfoValue = (unsigned char *)OSPPAltInfoGetValue(ospvAltInfo); } return(ospvAltInfoValue);}/**//*-----------------------------------------------------------------------* * OSPPAuthIndHasDestinationAlt() - does an authorisation indication have a * Destination Alternate? *-----------------------------------------------------------------------*/unsigned /* returns non-zero if exists */OSPPAuthIndHasDestinationAlt( OSPTAUTHIND *ospvAuthInd /* authorisation indication */){ unsigned ospvHasDestinationAlt = OSPC_FALSE; if (ospvAuthInd != OSPC_OSNULL) { ospvHasDestinationAlt = (OSPPAuthIndFirstDestinationAlt(ospvAuthInd) != OSPC_OSNULL); } return(ospvHasDestinationAlt);}/**//*-----------------------------------------------------------------------* * OSPPAuthIndFirstDestinationAlt() - gets the First Destination alternate for an * authorisation indication *-----------------------------------------------------------------------*/OSPTALTINFO * /* returns alt info pointer */ OSPPAuthIndFirstDestinationAlt( OSPTAUTHIND *ospvAuthInd /* authorisation indication */ ){ OSPTALTINFO *ospvAltInfo = OSPC_OSNULL; if (ospvAuthInd != OSPC_OSNULL) { ospvAltInfo = (OSPTALTINFO *)OSPPListFirst(&((ospvAuthInd)->ospmAuthIndDestinationAlternate)); } return(ospvAltInfo);}/**//*-----------------------------------------------------------------------* * OSPPAuthIndNextDestinationAlt() - gets the next Destination alternate for an * authorisation indication *-----------------------------------------------------------------------*/OSPTALTINFO * /* returns alt info pointer */ OSPPAuthIndNextDestinationAlt( OSPTAUTHIND *ospvAuthInd, /* authorisation indication */ OSPTALTINFO *ospvAltInfo ){ OSPTALTINFO *altinfo = OSPC_OSNULL; if (ospvAuthInd != OSPC_OSNULL) { altinfo = (OSPTALTINFO *)OSPPListNext(&((ospvAuthInd)->ospmAuthIndDestinationAlternate), ospvAltInfo); } return(altinfo);}/**//*-----------------------------------------------------------------------* * OSPPAuthIndGetDestinationAltValue() - gets the Destination alternate value for * an authorisation indication *-----------------------------------------------------------------------*/unsigned char * /* returns alt info value */ OSPPAuthIndGetDestinationAltValue( OSPTALTINFO *ospvAltInfo /* Alt info ptr */ ){ unsigned char *ospvAltInfoValue = OSPC_OSNULL; if (ospvAltInfo != OSPC_OSNULL) { ospvAltInfoValue = (unsigned char *)OSPPAltInfoGetValue(ospvAltInfo); } return(ospvAltInfoValue);}/**//*-----------------------------------------------------------------------* * OSPPAuthIndSetDest() - sets the destination for an authorisation *-----------------------------------------------------------------------*/voidOSPPAuthIndSetDest( OSPTAUTHIND *ospvAuthInd, OSPTDEST *ospvDest){ if(ospvAuthInd != OSPC_OSNULL) { if(ospvDest != OSPC_OSNULL) { if(OSPPAuthIndHasDest(ospvAuthInd) == OSPC_TRUE) { OSPPDestDelete(&(ospvAuthInd->ospmAuthIndDest)); } ospvAuthInd->ospmAuthIndDest = ospvDest; } }}/**//*-----------------------------------------------------------------------* * OSPPAuthIndHasDest() - does an authorisation indication have a * Destination? *-----------------------------------------------------------------------*/unsignedOSPPAuthIndHasDest( OSPTAUTHIND *ospvAuthInd){ if(ospvAuthInd->ospmAuthIndDest != OSPC_OSNULL) { return OSPC_TRUE; } else { return OSPC_FALSE; }}#endif /* OSPC_DEBUG *//**//*-----------------------------------------------------------------------* * OSPPAuthIndSetTimeLimit() - sets the timelimit for an authorisation * indication *-----------------------------------------------------------------------*/void /* nothing returned */OSPPAuthIndSetTimeLimit( OSPTAUTHIND *ospvAuthInd, unsigned ospvTimeLimit){ if (ospvAuthInd != OSPC_OSNULL) { (ospvAuthInd)->ospmAuthIndTimeLimit = (ospvTimeLimit); (ospvAuthInd)->ospmAuthIndHasTimeLimit = OSPC_TRUE; }}/**//*-----------------------------------------------------------------------* * OSPPAuthIndNew() - creates a new (empty) authorisation indication *-----------------------------------------------------------------------*/OSPTAUTHIND * /* returns pointer or NULL */ OSPPAuthIndNew(){ OSPTAUTHIND *ospvAuthInd = OSPC_OSNULL; OSPM_MALLOC(ospvAuthInd, OSPTAUTHIND,sizeof(OSPTAUTHIND)); if (ospvAuthInd != OSPC_OSNULL) { OSPM_MEMSET(ospvAuthInd, 0, sizeof(OSPTAUTHIND)); ospvAuthInd->ospmAuthIndTimestamp = OSPC_TIMEMIN; ospvAuthInd->ospmAuthIndRole = 0; ospvAuthInd->ospmAuthIndHasRole = OSPC_FALSE; ospvAuthInd->ospmAuthIndCallId = OSPC_OSNULL; ospvAuthInd->ospmAuthIndSourceNumber[0] = '\0'; ospvAuthInd->ospmAuthIndDestNumber[0] = '\0'; OSPPListNew(&ospvAuthInd->ospmAuthIndTokens); OSPPListNew (&(ospvAuthInd->ospmAuthIndSourceAlternate)); OSPPListNew(&(ospvAuthInd->ospmAuthIndDestinationAlternate)); } return(ospvAuthInd);}/*-----------------------------------------------------------------------* * OSPPAuthIndDelete() - destroy specified AuthInd object *-----------------------------------------------------------------------*/voidOSPPAuthIndDelete(OSPTAUTHIND **ospvAuthInd){ OSPTTOKEN *token = OSPC_OSNULL; OSPTALTINFO *altinfo = OSPC_OSNULL; if (*ospvAuthInd != OSPC_OSNULL) { if (OSPPAuthIndHasCallId(*ospvAuthInd)) { OSPPCallIdDelete(&((*ospvAuthInd)->ospmAuthIndCallId)); } while(!OSPPListEmpty(&((*ospvAuthInd)->ospmAuthIndTokens))) { token = (OSPTTOKEN *)OSPPListRemove(&((*ospvAuthInd)->ospmAuthIndTokens)); if(token != OSPC_OSNULL) { OSPPTokenDelete(&token); } } OSPPListDelete(&((*ospvAuthInd)->ospmAuthIndTokens)); while(!OSPPListEmpty(&((*ospvAuthInd)->ospmAuthIndSourceAlternate))) { altinfo = (OSPTALTINFO *)OSPPListRemove(&((*ospvAuthInd)->ospmAuthIndSourceAlternate)); if(altinfo != OSPC_OSNULL) { OSPM_FREE(altinfo); altinfo = OSPC_OSNULL; } } OSPPListDelete(&((*ospvAuthInd)->ospmAuthIndSourceAlternate)); while(!OSPPListEmpty(&((*ospvAuthInd)->ospmAuthIndDestinationAlternate))) { altinfo = (OSPTALTINFO *)OSPPListRemove(&((*ospvAuthInd)->ospmAuthIndDestinationAlternate)); if(altinfo != OSPC_OSNULL) { OSPM_FREE(altinfo); altinfo = OSPC_OSNULL; } } OSPPListDelete(&((*ospvAuthInd)->ospmAuthIndDestinationAlternate)); OSPPDestDelete(&((*ospvAuthInd)->ospmAuthIndDest)); OSPM_FREE(*ospvAuthInd); *ospvAuthInd = OSPC_OSNULL; } return;}/**//*-----------------------------------------------------------------------* * OSPPAuthIndSetCallId() - sets the call ID for an authorisation *-----------------------------------------------------------------------*/void /* nothing returned */OSPPAuthIndSetCallId( OSPTAUTHIND *ospvAuthInd, /* authorisation indication */ OSPTCALLID *ospvCallId /* call ID */){ if (ospvAuthInd != OSPC_OSNULL) { if ((ospvCallId) != OSPC_OSNULL) { if ((ospvAuthInd)->ospmAuthIndCallId != OSPC_OSNULL) { OSPPCallIdDelete(&((ospvAuthInd)->ospmAuthIndCallId)); } (ospvAuthInd)->ospmAuthIndCallId = OSPPCallIdNew((ospvCallId)->ospmCallIdLen, (ospvCallId)->ospmCallIdVal); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -