📄 ospreauthrsp.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. * *******#########################################################################*#########################################################################*#########################################################################*//* * ospreauthrsp.c - OSP reauthorisation 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 "ospreauthrsp.h"#include "ospstatus.h"#include "osputils.h"/**//*-----------------------------------------------------------------------* * OSPPReauthRspSetTimestamp() - sets the timestamp for an reauthorisation response *-----------------------------------------------------------------------*/#ifndef OSPPReauthRspSetTimestampvoid /* nothing returned */OSPPReauthRspSetTimestamp( OSPTREAUTHRSP *ospvReauthRsp, OSPTTIME ospvTime){ if (ospvReauthRsp != OSPC_OSNULL) { ospvReauthRsp->ospmReauthRspTimestamp = ospvTime; }}/**//*-----------------------------------------------------------------------* * OSPPReauthRspHasStatus() - does the reauthorisation response have * a status? *-----------------------------------------------------------------------*/unsigned /* returns non-zero if number exists */OSPPReauthRspHasStatus( OSPTREAUTHRSP *ospvReauthRsp /* reauthorisation response effected */){ unsigned ospvHasStatus = OSPC_FALSE; if (ospvReauthRsp != OSPC_OSNULL) { ospvHasStatus = (ospvReauthRsp->ospmReauthRspStatus != OSPC_OSNULL); } return(ospvHasStatus);}/**//*-----------------------------------------------------------------------* * OSPPReauthRspGetStatus() - returns the status for an * reauthorisation response *-----------------------------------------------------------------------*/OSPTSTATUS * /* returns pointer to dest */ OSPPReauthRspGetStatus( OSPTREAUTHRSP *ospvReauthRsp /* reauthorisation response */ ){ OSPTSTATUS *ospvStatus = OSPC_OSNULL; if (ospvReauthRsp != OSPC_OSNULL) { ospvStatus = ospvReauthRsp->ospmReauthRspStatus; } return(ospvStatus);}/**//*-----------------------------------------------------------------------* * OSPPReauthRspSetTrxId() - sets the transaction ID for an reauthorisation *-----------------------------------------------------------------------*/void /* nothing returned */OSPPReauthRspSetTrxId( OSPTREAUTHRSP *ospvReauthRsp, /* reauthorisation response */ OSPTTRXID ospvTrxId /* transaction ID to set */){ if (ospvReauthRsp != OSPC_OSNULL) { ospvReauthRsp->ospmReauthRspTrxId = ospvTrxId; }}/**//*-----------------------------------------------------------------------* * OSPPReauthRspHasDest() - does the reauthorisation response have * a destination? *-----------------------------------------------------------------------*/unsigned /* returns non-zero if number exists */OSPPReauthRspHasDest( OSPTREAUTHRSP *ospvReauthRsp /* reauthorisation response effected */){ unsigned ospvHasDest = OSPC_FALSE; if (ospvReauthRsp != OSPC_OSNULL) { ospvHasDest = (ospvReauthRsp->ospmReauthRspDest != OSPC_OSNULL); } return(ospvHasDest);}/**//*-----------------------------------------------------------------------* * OSPPReauthRspSetDest() - set the destination for an * reauthorisation response *-----------------------------------------------------------------------*/void /* nothing returned */OSPPReauthRspSetDest( OSPTREAUTHRSP *ospvReauthRsp, /* reauthorisation response to set */ OSPTDEST *ospvDest /* destination */){ if (ospvReauthRsp != OSPC_OSNULL) { if(ospvDest != OSPC_OSNULL) { ospvReauthRsp->ospmReauthRspDest = ospvDest; } } return;}/**//*-----------------------------------------------------------------------* * OSPPReauthRspHasComponentId() - is the component id set ? *-----------------------------------------------------------------------*/unsigned /* returns non-zero if component id is set */OSPPReauthRspHasComponentId( OSPTREAUTHRSP *ospvReauthRsp){ return (ospvReauthRsp->ospmReauthRspComponentId != OSPC_OSNULL);}#endif /* OSPC_DEBUG */OSPTTNAUDIT *OSPPReauthRspGetTNAudit( OSPTREAUTHRSP *ospvReauthRsp){ if(ospvReauthRsp != OSPC_OSNULL) { return ospvReauthRsp->ospmReauthRspTNAudit; } else { return OSPC_OSNULL; }}/**//*-----------------------------------------------------------------------* * OSPPReauthRspNew() - creates a new (empty) reauthorisation response *-----------------------------------------------------------------------*/OSPTREAUTHRSP * /* returns pointer or NULL */ OSPPReauthRspNew(){ OSPTREAUTHRSP *ospvReauthRsp; OSPM_MALLOC(ospvReauthRsp, OSPTREAUTHRSP,sizeof(OSPTREAUTHRSP)); OSPM_MEMSET(ospvReauthRsp, 0, sizeof(ospvReauthRsp)); if (ospvReauthRsp != OSPC_OSNULL) { ospvReauthRsp->ospmReauthRspTimestamp = OSPC_TIMEMIN; ospvReauthRsp->ospmReauthRspStatus = OSPC_OSNULL; ospvReauthRsp->ospmReauthRspTrxId = 0; ospvReauthRsp->ospmReauthRspDest = OSPC_OSNULL; ospvReauthRsp->ospmReauthRspTNAudit = OSPC_OSNULL; ospvReauthRsp->ospmReauthRspComponentId = OSPC_OSNULL; ospvReauthRsp->ospmReauthRspMessageId = OSPC_OSNULL; } return(ospvReauthRsp);}/**//*-----------------------------------------------------------------------* * OSPPReauthRspFromElement() - get reauthorisation response from an XML element *-----------------------------------------------------------------------*/int /* returns error code */OSPPReauthRspFromElement( OSPTXMLELEM *ospvElem, /* input is XML element */ OSPTREAUTHRSP **ospvReauthRsp /* where to put reauthorisation response pointer */){ unsigned ospvErrCode = OSPC_ERR_NO_ERROR; OSPTXMLELEM *elem = OSPC_OSNULL; OSPTREAUTHRSP *reauthrsp = OSPC_OSNULL; OSPTDEST *dest = OSPC_OSNULL; OSPTTIME t = 0L; OSPTTRXID transid = 0L; OSPTXMLELEM *ospvParent = OSPC_OSNULL; unsigned char *messageId = OSPC_OSNULL; unsigned char *compid = OSPC_OSNULL; if (ospvElem == OSPC_OSNULL) { ospvErrCode = OSPC_ERR_XML_NO_ELEMENT; } if (ospvReauthRsp == OSPC_OSNULL) { ospvErrCode = OSPC_ERR_DATA_NO_REAUTHRSP; } if (ospvErrCode == OSPC_ERR_NO_ERROR) { if(OSPPMsgGetElemPart(OSPPXMLElemGetName(ospvElem))==ospeElemMessage) { OSPPReauthRspMessageIdFromElement(ospvElem, &messageId); OSPPReauthRspSetMessageId(reauthrsp, messageId); /* ospvElem is pointing to the Message element. * The first child contains the Component element. * The following two lines of code change ospvElem from * pointing to the Message element to the Component element. */ ospvParent = ospvElem; ospvElem = (OSPTXMLELEM *)OSPPXMLElemFirstChild(ospvParent); } /* create the reauthorisation response object */ reauthrsp = OSPPReauthRspNew(); if (reauthrsp == OSPC_OSNULL) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -