📄 ospauthrsp.c
字号:
/**########################################################################*########################################################################*########################################################################* * 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. * *******#########################################################################*#########################################################################*#########################################################################*//* * ospauthrsp.c - OSP authorisation response 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 "ospdest.h"#include "ospauthrsp.h"#include "ospstatus.h"#include "osputils.h"#ifdef OSPC_DEBUG/**//*-----------------------------------------------------------------------* * OSPPAuthRspSetTimestamp() - sets the timestamp for an authorisation response *-----------------------------------------------------------------------*/void /* nothing returned */OSPPAuthRspSetTimestamp( OSPTAUTHRSP *ospvAuthRsp, OSPTTIME ospvTime){ if (ospvAuthRsp != OSPC_OSNULL) { (ospvAuthRsp)->ospmAuthRspTimestamp = (ospvTime); }}/**//*-----------------------------------------------------------------------* * OSPPAuthRspHasStatus() - does the authorisation response have * a status? *-----------------------------------------------------------------------*/unsigned /* returns non-zero if number exists */OSPPAuthRspHasStatus( OSPTAUTHRSP *ospvAuthRsp /* authorisation response effected */){ unsigned ospvHasStatus = OSPC_FALSE; if(ospvAuthRsp != OSPC_OSNULL) { ospvHasStatus = ((ospvAuthRsp)->ospmAuthRspStatus != OSPC_OSNULL); } return(ospvHasStatus);}/**//*-----------------------------------------------------------------------* * OSPPAuthRspGetStatus() - returns the status for an * authorisation response *-----------------------------------------------------------------------*/OSPTSTATUS * /* returns pointer to status */ OSPPAuthRspGetStatus( OSPTAUTHRSP *ospvAuthRsp /* authorisation response */ ){ OSPTSTATUS *ospvStatus = OSPC_OSNULL; if (ospvAuthRsp != OSPC_OSNULL) { ospvStatus = (ospvAuthRsp)->ospmAuthRspStatus; } return(ospvStatus);}/**//*-----------------------------------------------------------------------* * OSPPAuthRspSetTrxId() - sets the transaction ID for an authorisation *-----------------------------------------------------------------------*/void /* nothing returned */OSPPAuthRspSetTrxId( OSPTAUTHRSP *ospvAuthRsp, /* authorisation response */ OSPTTRXID ospvTrxId /* transaction ID to set */){ if(ospvAuthRsp != OSPC_OSNULL) { (ospvAuthRsp)->ospmAuthRspTrxId = ospvTrxId; }}/**//*-----------------------------------------------------------------------* * OSPPAuthRspHasDest() - does the authorisation response have * a destination? *-----------------------------------------------------------------------*/unsigned /* returns non-zero if number exists */OSPPAuthRspHasDest( OSPTAUTHRSP *ospvAuthRsp /* authorisation response effected */){ unsigned ospvHasDest = OSPC_FALSE; if (ospvAuthRsp != OSPC_OSNULL) { ospvHasDest = ((ospvAuthRsp)->ospmAuthRspDest != OSPC_OSNULL); } return(ospvHasDest);}/**//*-----------------------------------------------------------------------* * OSPPAuthRspFirstDest() - returns the first destination for an * authorisation response *-----------------------------------------------------------------------*/OSPTDEST * /* returns pointer to dest */ OSPPAuthRspFirstDest( OSPTAUTHRSP *ospvAuthRsp /* authorisation response */ ){ OSPTDEST *dest = OSPC_OSNULL; if (ospvAuthRsp != OSPC_OSNULL) { dest = (OSPTDEST *)OSPPListFirst(&(ospvAuthRsp->ospmAuthRspDest)); } return(dest);}/**//*-----------------------------------------------------------------------* * OSPPAuthRspNextDest() - returns the next destination for an * authorisation response *-----------------------------------------------------------------------*/OSPTDEST * /* returns pointer to dest */ OSPPAuthRspNextDest( OSPTAUTHRSP *ospvAuthRsp, /* authorisation response */ OSPTDEST *ospvDest ){ OSPTDEST *dest = (OSPTDEST *)OSPC_OSNULL; if (ospvAuthRsp != (OSPTAUTHRSP *)OSPC_OSNULL) { dest = (OSPTDEST *)OSPPListNext(&(ospvAuthRsp->ospmAuthRspDest), ospvDest); } return dest;}/**//*-----------------------------------------------------------------------* * OSPPAuthRspHasTNDelayLimit() - does an auth response have delay limit? *-----------------------------------------------------------------------*/unsigned /* returns non-zero if exists */OSPPAuthRspHasTNDelayLimit( OSPTAUTHRSP *ospvAuthRsp /* authorisation response */){ unsigned ospvHasTNDelayLimit = OSPC_FALSE; if(ospvAuthRsp != OSPC_OSNULL) { ospvHasTNDelayLimit = ((ospvAuthRsp)->ospmAuthRspTNDelayLimit > 0); } return(ospvHasTNDelayLimit);}/**//*-----------------------------------------------------------------------* * OSPPAuthRspSetTNDelayLimit() - sets the delay limit for an authorisation *-----------------------------------------------------------------------*/void /* nothing returned */OSPPAuthRspSetTNDelayLimit( OSPTAUTHRSP *ospvAuthRsp, /* authorisation response */ unsigned ospvTNDelayLimit /* delay limit to set */){ if(ospvAuthRsp != OSPC_OSNULL) { (ospvAuthRsp)->ospmAuthRspTNDelayLimit = ospvTNDelayLimit; }}/**//*-----------------------------------------------------------------------* * OSPPAuthRspGetTNDelayLimit() - gets the delay limit for an auth response *-----------------------------------------------------------------------*/unsigned /* returns transaction ID pointer */ OSPPAuthRspGetTNDelayLimit( OSPTAUTHRSP *ospvAuthRsp /* authorisation response */ ){ unsigned ospvTNDelayLimit = 0; if (ospvAuthRsp != OSPC_OSNULL) { ospvTNDelayLimit = ((ospvAuthRsp)->ospmAuthRspTNDelayLimit); } return(ospvTNDelayLimit);}/**//*-----------------------------------------------------------------------* * OSPPAuthRspHasTNDelayPref() - does an auth response have delay pref? *-----------------------------------------------------------------------*/unsigned /* returns non-zero if exists */OSPPAuthRspHasTNDelayPref( OSPTAUTHRSP *ospvAuthRsp /* authorisation response */){ unsigned ospvHasTNDelayPref = OSPC_FALSE; if(ospvAuthRsp != OSPC_OSNULL) { ospvHasTNDelayPref = ((ospvAuthRsp)->ospmAuthRspTNDelayPref > 0); } return(ospvHasTNDelayPref);}/**//*-----------------------------------------------------------------------* * OSPPAuthRspSetTNDelayPref() - sets the delay pref for an authorisation *-----------------------------------------------------------------------*/void /* nothing returned */OSPPAuthRspSetTNDelayPref( OSPTAUTHRSP *ospvAuthRsp, /* authorisation response */ unsigned ospvTNDelayPref /* delay pref to set */){ if(ospvAuthRsp != OSPC_OSNULL) { (ospvAuthRsp)->ospmAuthRspTNDelayPref = ospvTNDelayPref; }}unsignedOSPPAuthRspHasNumDests( OSPTAUTHRSP *ospvAuthRsp){ if(ospvAuthRsp != OSPC_OSNULL) { return ospvAuthRsp->ospmNumDests; } else { return 0; }}voidOSPPAuthRspIncNumDests( OSPTAUTHRSP *ospvAuthRsp){ if(ospvAuthRsp != OSPC_OSNULL) { ospvAuthRsp->ospmNumDests++; } return;}unsignedOSPPAuthRspGetNumDests( OSPTAUTHRSP *ospvAuthRsp){ if(ospvAuthRsp != OSPC_OSNULL) { return ospvAuthRsp->ospmNumDests; } else { return 0; }}/**//*-----------------------------------------------------------------------* * OSPPAuthRspHasComponentId() - is the component id set ? *-----------------------------------------------------------------------*/unsigned /* returns non-zero if component id is set */OSPPAuthRspHasComponentId( OSPTAUTHRSP *ospvAuthRsp){ return (ospvAuthRsp->ospmAuthRspComponentId != OSPC_OSNULL);}#endif /* OSPC_DEBUG *//**//*-----------------------------------------------------------------------* * OSPPAuthRspSetComponentId() - creates space and copies in the string. *-----------------------------------------------------------------------*/void OSPPAuthRspSetComponentId( OSPTAUTHRSP *ospvAuthRsp, /* In - pointer to Usage Indication struct */ unsigned char *ospvComponentId /* In - pointer to component id string */ ){ int len = OSPM_STRLEN((const char *)ospvComponentId); if(ospvAuthRsp != OSPC_OSNULL) { if(ospvAuthRsp->ospmAuthRspComponentId != OSPC_OSNULL) { OSPM_FREE(ospvAuthRsp->ospmAuthRspComponentId); } OSPM_MALLOC(ospvAuthRsp->ospmAuthRspComponentId, unsigned char, len + 1); OSPM_MEMSET(ospvAuthRsp->ospmAuthRspComponentId, 0, len + 1); OSPM_MEMCPY(ospvAuthRsp->ospmAuthRspComponentId, ospvComponentId, len); } return;}OSPTTNAUDIT *OSPPAuthRspGetTNAudit( OSPTAUTHRSP *ospvAuthRsp){ if(ospvAuthRsp != OSPC_OSNULL) { return ospvAuthRsp->ospmAuthRspTNAudit; } else { return OSPC_OSNULL; }}/**//*-----------------------------------------------------------------------* * OSPPAuthRspNew() - creates a new (empty) authorisation response *-----------------------------------------------------------------------*/OSPTAUTHRSP * /* returns pointer or NULL */ OSPPAuthRspNew(){ OSPTAUTHRSP *ospvAuthRsp; OSPM_MALLOC(ospvAuthRsp, OSPTAUTHRSP,sizeof(OSPTAUTHRSP)); if (ospvAuthRsp != OSPC_OSNULL) { OSPM_MEMSET(ospvAuthRsp, 0, sizeof(OSPTAUTHRSP)); ospvAuthRsp->ospmAuthRspTimestamp = OSPC_TIMEMIN; ospvAuthRsp->ospmAuthRspStatus = OSPC_OSNULL; ospvAuthRsp->ospmAuthRspTrxId = 0; ospvAuthRsp->ospmAuthRspCSAudit = (OSPTCSAUDIT *)OSPC_OSNULL; OSPPListNew(&(ospvAuthRsp->ospmAuthRspDest)); } return(ospvAuthRsp);}/*-----------------------------------------------------------------------* * OSPPAuthRspDelete() - deletes an authorisation response structure *-----------------------------------------------------------------------*/void
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -