📄 ospciscoext.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. * *******#########################################################################*#########################################################################*#########################################################################*//* * ospciscoext.c - Functions for Cisco audit element. */#include "ospciscoext.h"#include "ospmsgelem.h"#include "ospmsg.h"#include "ospmsgattr.h"void OSPPCSAuditDelete( OSPTCSAUDIT **ospvCSAudit){ if (*ospvCSAudit != OSPC_OSNULL) { if ((*ospvCSAudit)->ospmAuditTrigger != OSPC_OSNULL ) { OSPM_FREE((*ospvCSAudit)->ospmAuditTrigger); (*ospvCSAudit)->ospmAuditTrigger = OSPC_OSNULL; } OSPM_FREE(*ospvCSAudit); *ospvCSAudit = OSPC_OSNULL; } return;}int OSPPCSAuditFromElement( OSPTXMLELEM *ospvElem, OSPTCSAUDIT **ospvCSAudit){ int errorcode = OSPC_ERR_NO_ERROR; if (ospvElem == OSPC_OSNULL) { errorcode = OSPC_ERR_XML_NO_ELEMENT; } if (ospvCSAudit == OSPC_OSNULL) { errorcode = OSPC_ERR_DATA_NO_STATUS; } /* create the CSAudit structure */ if (errorcode == OSPC_ERR_NO_ERROR) { *ospvCSAudit = OSPPCSAuditNew(); if (*ospvCSAudit == OSPC_OSNULL) { errorcode = OSPC_ERR_AUDIT_MALLOC_FAILED; } } if (errorcode == OSPC_ERR_NO_ERROR) { /* * The CSAudit element should consist of one element. * */ if(OSPPMsgGetElemPart(OSPPXMLElemGetName(ospvElem)) == ospeElemCSAuditTrigger) { OSPPCSAuditSetTrigger(*ospvCSAudit, (unsigned char *)OSPPXMLElemGetValue(ospvElem)); } else if (OSPPMsgElemIsCritical(ospvElem)) { errorcode = OSPC_ERR_XML_BAD_ELEMENT; } } return errorcode;}unsigned char *OSPPCSAuditGetTrigger( OSPTCSAUDIT *ospvCSAudit){ if(ospvCSAudit != OSPC_OSNULL) { return ospvCSAudit->ospmAuditTrigger; } else { return OSPC_OSNULL; }}unsigned OSPPCSAuditHasTrigger( OSPTCSAUDIT *ospvCSAudit){ if(ospvCSAudit != OSPC_OSNULL) { return(ospvCSAudit->ospmAuditTrigger != OSPC_OSNULL); } else { return 0; }}OSPTCSAUDIT *OSPPCSAuditNew( void){ OSPTCSAUDIT *ospvCSAudit = OSPC_OSNULL; /* try to allocate the memory for the entire object */ OSPM_MALLOC(ospvCSAudit, OSPTCSAUDIT, sizeof(OSPTCSAUDIT)); if(ospvCSAudit != OSPC_OSNULL) { /* Initialize it */ OSPM_MEMSET(ospvCSAudit, 0, sizeof(OSPTCSAUDIT)); ospvCSAudit->ospmAuditTrigger = OSPC_OSNULL; } return(ospvCSAudit);}void OSPPCSAuditSetTrigger( OSPTCSAUDIT *ospvCSAudit, unsigned char *ospvAuditTrigger){ if (ospvCSAudit != OSPC_OSNULL) { if(ospvAuditTrigger != OSPC_OSNULL) { if (ospvCSAudit->ospmAuditTrigger != OSPC_OSNULL) { OSPM_FREE(ospvCSAudit->ospmAuditTrigger); ospvCSAudit->ospmAuditTrigger = OSPC_OSNULL; } OSPM_MALLOC(ospvCSAudit->ospmAuditTrigger, unsigned char, strlen((const char *)ospvAuditTrigger)+1); if (ospvCSAudit->ospmAuditTrigger != OSPC_OSNULL) { OSPM_MEMCPY((ospvCSAudit->ospmAuditTrigger), (const char *)(ospvAuditTrigger), strlen((const char *)ospvAuditTrigger)+1); } } } return; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -