📄 ospusageind.c
字号:
*-----------------------------------------------------------------------*/unsigned long /* returns the time value */ OSPPUsageIndGetTNCustId( OSPTUSAGEIND *ospvUsageInd /* usage request */ ){ unsigned long ospvTNCustId = 0L; if (ospvUsageInd != OSPC_OSNULL) { ospvTNCustId = (ospvUsageInd)->ospmUsageIndTNCustId; } return(ospvTNCustId);}/**//*-----------------------------------------------------------------------* * OSPPUsageIndHasTNDeviceId() - Does request have a TransNexus Device Id? *-----------------------------------------------------------------------*/unsigned /* returns non-zero if time */OSPPUsageIndHasTNDeviceId( OSPTUSAGEIND *ospvUsageInd /* usage request in question */){ unsigned ospvHasTNDeviceId = OSPC_FALSE; if (ospvUsageInd != OSPC_OSNULL) { ospvHasTNDeviceId = ((ospvUsageInd)->ospmUsageIndTNDeviceId != 0L); } return(ospvHasTNDeviceId);}/**//*-----------------------------------------------------------------------* * OSPPUsageIndSetTNDeviceId() - Set TransNexus Device Id *-----------------------------------------------------------------------*/void /* nothing returned */OSPPUsageIndSetTNDeviceId( OSPTUSAGEIND *ospvUsageInd, unsigned long ospvTNDeviceId){ if (ospvUsageInd != OSPC_OSNULL) { (ospvUsageInd)->ospmUsageIndTNDeviceId = (ospvTNDeviceId); }}/**//*-----------------------------------------------------------------------* * OSPPUsageIndGetTNDeviceId() - returns TN Device Id for an usage request *-----------------------------------------------------------------------*/unsigned long /* returns the time value */ OSPPUsageIndGetTNDeviceId( OSPTUSAGEIND *ospvUsageInd /* usage request */ ){ unsigned long ospvTNDeviceId = 0L; if (ospvUsageInd != OSPC_OSNULL) { ospvTNDeviceId = (ospvUsageInd)->ospmUsageIndTNDeviceId; } return(ospvTNDeviceId);}/**//*-----------------------------------------------------------------------* * OSPPUsageIndHasTNFailReason() - Does request have a TransNexus Fail Rsn *-----------------------------------------------------------------------*/unsigned /* returns non-zero if time */OSPPUsageIndHasTNFailReason( OSPTUSAGEIND *ospvUsageInd /* usage request in question */){ unsigned ospvHasTNFailReason = OSPC_FALSE; if (ospvUsageInd != OSPC_OSNULL) { ospvHasTNFailReason = ((ospvUsageInd)->ospmUsageIndTNFailReasonInd); } return(ospvHasTNFailReason);}/**//*-----------------------------------------------------------------------* * OSPPUsageIndSetTNFailReason() - Set TransNexus Fail Reason *-----------------------------------------------------------------------*/void /* nothing returned */OSPPUsageIndSetTNFailReason( OSPTUSAGEIND *ospvUsageInd, unsigned ospvTNFailReason){ if (ospvUsageInd != OSPC_OSNULL) { (ospvUsageInd)->ospmUsageIndTNFailReason = (ospvTNFailReason); (ospvUsageInd)->ospmUsageIndTNFailReasonInd = 1; }}/**//*-----------------------------------------------------------------------* * OSPPUsageIndGetTNFailReason() - returns TN Fail Rsn for an usage request *-----------------------------------------------------------------------*/unsigned /* returns the fail reason value */ OSPPUsageIndGetTNFailReason( OSPTUSAGEIND *ospvUsageInd /* usage request */ ){ unsigned ospvTNFailReason = 0; if (ospvUsageInd != OSPC_OSNULL) { ospvTNFailReason = (ospvUsageInd)->ospmUsageIndTNFailReason; } return(ospvTNFailReason);}/**//*-----------------------------------------------------------------------* * OSPPUsageIndHasSourceAlt() - does an usage indication have a * Source Alternate? *-----------------------------------------------------------------------*/unsigned /* returns non-zero if exists */OSPPUsageIndHasSourceAlt( OSPTUSAGEIND *ospvUsageInd /* usage indication */){ unsigned ospvHasSourceAlt = OSPC_FALSE; if (ospvUsageInd != OSPC_OSNULL) { ospvHasSourceAlt = (OSPPUsageIndFirstSourceAlt(ospvUsageInd) != OSPC_OSNULL); } return(ospvHasSourceAlt);}/**//*-----------------------------------------------------------------------* * OSPPUsageIndFirstSourceAlt() - gets the First Source alternate for an * usage indication *-----------------------------------------------------------------------*/OSPTALTINFO * /* returns alt info pointer */ OSPPUsageIndFirstSourceAlt( OSPTUSAGEIND *ospvUsageInd /* usage indication */ ){ OSPTALTINFO *ospvAltInfo = OSPC_OSNULL; if (ospvUsageInd != OSPC_OSNULL) { ospvAltInfo = (OSPTALTINFO *)OSPPListFirst(&((ospvUsageInd)->ospmUsageIndSourceAlternate)); } return(ospvAltInfo);}/**//*-----------------------------------------------------------------------* * OSPPUsageIndNextSourceAlt() - gets the next source alternate for an * usage indication *-----------------------------------------------------------------------*/OSPTALTINFO * /* returns alt info pointer */ OSPPUsageIndNextSourceAlt( OSPTUSAGEIND *ospvUsageInd, /* usage indication */ OSPTALTINFO *ospvAltInfo ){ OSPTALTINFO *altinfo = OSPC_OSNULL; if (ospvUsageInd != OSPC_OSNULL) { altinfo = (OSPTALTINFO *)OSPPListNext(&((ospvUsageInd)->ospmUsageIndSourceAlternate), ospvAltInfo); } return(altinfo);}/**//*-----------------------------------------------------------------------* * OSPPUsageIndHasDestinationAlt() - does an usage indication have a * Destination Alternate? *-----------------------------------------------------------------------*/unsigned /* returns non-zero if exists */OSPPUsageIndHasDestinationAlt( OSPTUSAGEIND *ospvUsageInd /* usage indication */){ unsigned ospvHasDestinationAlt = OSPC_FALSE; if (ospvUsageInd != OSPC_OSNULL) { ospvHasDestinationAlt = (OSPPUsageIndFirstDestinationAlt(ospvUsageInd) != OSPC_OSNULL); } return(ospvHasDestinationAlt);}/**//*-----------------------------------------------------------------------* * OSPPUsageIndFirstDestinationAlt() - gets the First Destination alternate for an * usage indication *-----------------------------------------------------------------------*/OSPTALTINFO * /* returns alt info pointer */ OSPPUsageIndFirstDestinationAlt( OSPTUSAGEIND *ospvUsageInd /* usage indication */ ){ OSPTALTINFO *ospvAltInfo = OSPC_OSNULL; if (ospvUsageInd != OSPC_OSNULL) { ospvAltInfo = (OSPTALTINFO *)OSPPListFirst(&((ospvUsageInd)->ospmUsageIndDestinationAlternate)); } return(ospvAltInfo);}/**//*-----------------------------------------------------------------------* * OSPPUsageIndNextDestinationAlt() - gets the next Destination alternate for an * usage indication *-----------------------------------------------------------------------*/OSPTALTINFO * /* returns alt info pointer */ OSPPUsageIndNextDestinationAlt( OSPTUSAGEIND *ospvUsageInd, /* usage indication */ OSPTALTINFO *ospvAltInfo ){ OSPTALTINFO *altinfo = OSPC_OSNULL; if (ospvUsageInd != OSPC_OSNULL) { altinfo = (OSPTALTINFO *)OSPPListNext(&((ospvUsageInd)->ospmUsageIndDestinationAlternate), ospvAltInfo); } return(altinfo);}/**//*-----------------------------------------------------------------------* * OSPPUsageIndGetDestinationAltSize() - gets the Destination alternate size * for an altinfo *-----------------------------------------------------------------------*/unsigned /* returns alt info size */ OSPPUsageIndGetDestinationAltSize( OSPTALTINFO *ospvAltInfo /* Alt info ptr */ ){ unsigned ospvAltInfoSize = 0; if (ospvAltInfo != OSPC_OSNULL) { ospvAltInfoSize = OSPPAltInfoGetSize(ospvAltInfo); } return(ospvAltInfoSize);}#endif /* OSPC_DEBUG *//**//*-----------------------------------------------------------------------* * OSPPUsageIndSetComponentId() - creates space and copies in the string. *-----------------------------------------------------------------------*/void OSPPUsageIndSetComponentId( OSPTUSAGEIND *ospvUsageInd, /* In - pointer to Usage Indication struct */ unsigned char *ospvComponentId /* In - pointer to component id string */ ){ int len = OSPM_STRLEN((const char *)ospvComponentId); if(ospvUsageInd != OSPC_OSNULL) { if(ospvUsageInd->ospmUsageIndComponentId != OSPC_OSNULL) { OSPM_FREE(ospvUsageInd->ospmUsageIndComponentId); } OSPM_MALLOC(ospvUsageInd->ospmUsageIndComponentId, unsigned char, len + 1); OSPM_MEMSET(ospvUsageInd->ospmUsageIndComponentId, 0, len + 1); OSPM_MEMCPY(ospvUsageInd->ospmUsageIndComponentId, ospvComponentId, len); } return;}/**//*-----------------------------------------------------------------------* * OSPPUsageIndMoveSourceAlt() - move the source alt list from list *-----------------------------------------------------------------------*/void /* nothing returned */OSPPUsageIndMoveSourceAlt( OSPTUSAGEIND *ospvUsageInd, /* usage indication to set */ OSPTLIST *ospvList /* list to move */ ){ if((ospvUsageInd != OSPC_OSNULL) && (ospvList != OSPC_OSNULL)) { OSPPListNew(&(ospvUsageInd->ospmUsageIndSourceAlternate)); OSPPListMove(&(ospvUsageInd->ospmUsageIndSourceAlternate), ospvList); } return;}/**//*-----------------------------------------------------------------------* * OSPPUsageIndCopySourceAlt() - Copy the source alt list *-----------------------------------------------------------------------*/void /* nothing returned */OSPPUsageIndCopySourceAlt( OSPTUSAGEIND *ospvUsageInd, /* usage indication to set */ OSPTLIST *ospvList /* list to move */ ){ OSPTALTINFO *altinfo1 = OSPC_OSNULL, *altinfo2 = OSPC_OSNULL; if((ospvUsageInd != OSPC_OSNULL) && (ospvList != OSPC_OSNULL)) { OSPPListNew(&(ospvUsageInd->ospmUsageIndSourceAlternate)); for(altinfo1 = (OSPTALTINFO *)OSPPListFirst(ospvList); altinfo1 != OSPC_OSNULL; altinfo1 = (OSPTALTINFO *)OSPPListNext(ospvList, altinfo1)) { altinfo2 = OSPPAltInfoNew(OSPPAltInfoGetSize(altinfo1), OSPPAltInfoGetValue(altinfo1), OSPPAltInfoGetType(altinfo1)); if(altinfo2 != OSPC_OSNULL) { OSPPListAppend(&(ospvUsageInd)->ospmUsageIndSourceAlternate, altinfo2); } altinfo2 = OSPC_OSNULL; } } if(altinfo2 != OSPC_OSNULL) { OSPPAltInfoDelete(&altinfo2); } return;}/**//*-----------------------------------------------------------------------* * OSPPUsageIndMoveDestinationAlt() - move the destination alt list from * a list *-----------------------------------------------------------------------*/void /* nothing returned */OSPPUsageIndMoveDestinationAlt( OSPTUSAGEIND *ospvUsageInd, /* usage indication to set */ OSPTLIST *ospvList /* list to move */ ){ if((ospvUsageInd != OSPC_OSNULL) && (ospvList != OSPC_OSNULL)) { OSPPListNew(&(ospvUsageInd->ospmUsageIndDestinationAlternate)); OSPPListMove(&(ospvUsageInd->ospmUsageIndDestinationAlternate), ospvList); } return;}/**//*-----------------------------------------------------------------------* * OSPPUsageIndNew() - creates a new (empty) usage indication *-----------------------------------------------------------------------*/OSPTUSAGEIND * /* returns pointer or NULL */ OSPPUsageIndNew(){ OSPTUSAGEIND *ospvUsageInd = OSPC_OSNULL; OSPM_MALLOC(ospvUsageInd, OSPTUSAGEIND,sizeof(OSPTUSAGEIND)); if (ospvUsageInd != OSPC_OSNULL) { OSPM_MEMSET(ospvUsageInd, 0, sizeof(OSPTUSAGEIND)); OSPPListLinkNew (&(ospvUsageInd->ospmUsageIndLink)); ospvUsageInd->ospmUsageIndTimestamp = (OSPTTIME)0; ospvUsageInd->ospmUsageIndTransactionId = (OSPTTRXID)OSPC_OSNULL; ospvUsageInd->ospmUsageIndCallId = (OSPTCALLID *)OSPC_OSNULL; ospvUsageInd->ospmUsageIndSourceNumber[0] = '\0'; ospvUsageInd->ospmUsageIndDestNumber[0] = '\0'; ospvUsageInd->ospmUsageIndDuration = -1; ospvUsageInd->ospmUsageIndTNCustId = 0L; ospvUsageInd->ospmUsageIndTNDeviceId = 0L; ospvUsageInd->ospmUsageIndTNFailReasonInd = 0; OSPPListNew (&(ospvUsageInd->ospmUsageIndSourceAlternate)); OSPPListNew(&(ospvUsageInd->ospmUsageIndDestinationAlternate)); ospvUsageInd->ospmUsageIndTNStats = OSPC_OSNULL; ospvUsageInd->ospmUsageIndComponentId = OSPC_OSNULL; } return ospvUsageInd;}/**//*-----------------------------------------------------------------------* * OSPPUsageIndDelete() - deletes a usage indication *-----------------------------------------------------------------------*/voidOSPPUsageIndDelete(OSPTUSAGEIND **ospvUsageInd){ OSPTALTINFO *altinfo = OSPC_OSNULL; if (*ospvUsageInd) { if (OSPPUsageIndHasCallId(*ospvUsageInd)) { OSPPCallIdDelete(&((*ospvUsageInd)->ospmUsageIndCallId)); } if(OSPPUsageIndHasComponentId(*ospvUsageInd)) { OSPM_FREE((*ospvUsageInd)->ospmUsageIndComponentId); } while(!OSPPListEmpty(&((*ospvUsageInd)->ospmUsageIndSourceAlternate))) { altinfo = (OSPTALTINFO *)OSPPListRemove(&((*ospvUsageInd)->ospmUsageIndSourceAlternate)); OSPM_FREE(altinfo); altinfo = OSPC_OSNULL; } OSPPListDelete(&((*ospvUsageInd)->ospmUsageIndSourceAlternate)); while(!OSPPListEmpty(&((*ospvUsageInd)->ospmUsageIndDestinationAlternate))) { altinfo = (OSPTALTINFO *)OSPPListRemove(&((*ospvUsageInd)->ospmUsageIndDestinationAlternate)); OSPM_FREE(altinfo); altinfo = OSPC_OSNULL; } if(OSPPUsageIndHasTNStatistics(*ospvUsageInd)) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -