📄 mgcpdef.c
字号:
* Date : July 16 2005, Frank Zhang
******************************************************************************/
void ClearEventName(EVENT_NAME *pData)
{
if (pData != NULL)
{
if (pData->pcPackageName != NULL)
{
free(pData->pcPackageName);
pData->pcPackageName = NULL;
}
if (pData->pcEventIDName != NULL)
{
free(pData->pcEventIDName);
pData->pcEventIDName = NULL;
}
if (pData->pcConnectionId != NULL)
{
free(pData->pcConnectionId);
pData->pcConnectionId = NULL;
}
pData->eType = 0;
}
}
/*******************************************************************************
* Function : CopyEventName
*
* Description : Copy the Event Name
*
* Input parameters : pDesData - Pointer to the destination data be copied into
* pSrcData - Pointer to the source data to be copied
*
* Output parameters :
*
* Return value :
*
* Comments :
*
* History :
* 2005/07/16 : Creation
*
* Date : July 16 2005, Frank Zhang
******************************************************************************/
void CopyEventName(EVENT_NAME *pDesData, EVENT_NAME *pSrcData)
{
Assert(pDesData);
Assert(pSrcData);
if (pSrcData != NULL)
{
StrClone(&pDesData->pcPackageName, pSrcData->pcPackageName);
pDesData->eType = pSrcData->eType;
StrClone(&pDesData->pcEventIDName, pSrcData->pcEventIDName);
StrClone(&pDesData->pcConnectionId, pSrcData->pcConnectionId);
}
}
/*******************************************************************************
* Function : ClearEventParameters
*
* Description : Clear the Event Parameters
*
* Input parameters : pData - Pointer to the data to be cleared
*
* Output parameters :
*
* Return value :
*
* Comments :
*
* History :
* 2005/07/16 : Creation
*
* Date : July 16 2005, Frank Zhang
******************************************************************************/
void ClearEventParameters(EVENT_PARAMETERS *pData)
{
if (pData != NULL && pData->wNum > 0)
{
while (pData->wNum-- > 0)
{
if (pData->pEventParamList[pData->wNum].pcParamName != NULL)
free(pData->pEventParamList[pData->wNum].pcParamName);
if (pData->pEventParamList[pData->wNum].pcParamValue != NULL)
free(pData->pEventParamList[pData->wNum].pcParamValue);
}
pData->wNum = 0;
free(pData->pEventParamList);
pData->pEventParamList = NULL;
}
}
/*******************************************************************************
* Function : CopyEventParameters
*
* Description : Copy the Event Parameters
*
* Input parameters : pDesData - Pointer to the destination data be copied into
* pSrcData - Pointer to the source data to be copied
*
* Output parameters :
*
* Return value :
*
* Comments :
*
* History :
* 2005/07/16 : Creation
*
* Date : July 16 2005, Frank Zhang
******************************************************************************/
void CopyEventParameters(EVENT_PARAMETERS *pDesData, EVENT_PARAMETERS *pSrcData)
{
int i;
Assert(pDesData);
if (pSrcData != NULL)
{
if (pSrcData->wNum > 0)
{
pDesData->wNum = pSrcData->wNum;
pDesData->pEventParamList = (EVENT_PARAMETER*)
calloc(pDesData->wNum, sizeof(EVENT_PARAMETER));
Assert(pDesData->pEventParamList);
// memset(pDesData->pEventParamList, 0, pDesData->wNum * sizeof(EVENT_PARAMETER));
for (i = 0; i < pSrcData->wNum; i++)
{
StrClone(&pDesData->pEventParamList[i].pcParamName,
pSrcData->pEventParamList[i].pcParamName);
StrClone(&pDesData->pEventParamList[i].pcParamValue,
pSrcData->pEventParamList[i].pcParamValue);
}
}
}
}
/*******************************************************************************
* Function : ClearEmbeddedRequest
*
* Description : Clear the Embedded Request
*
* Input parameters : pData - Pointer to the data to be cleared
*
* Output parameters :
*
* Return value :
*
* Comments :
*
* History :
* 2005/07/16 : Creation
*
* Date : July 16 2005, Frank Zhang
******************************************************************************/
void ClearEmbeddedRequest(EMBEDDED_REQUEST *pData)
{
if (pData != NULL)
{
if (pData->pRequestedEvents != NULL)
{
ClearRequestedEvents(pData->pRequestedEvents);
free(pData->pRequestedEvents);
pData->pRequestedEvents = NULL;
}
if (pData->pSignalRequests != NULL)
{
ClearSignalRequests(pData->pSignalRequests);
free(pData->pSignalRequests);
pData->pSignalRequests = NULL;
}
if (pData->pDigitMap != NULL)
{
ClearDigitMap(pData->pDigitMap);
free(pData->pDigitMap);
pData->pDigitMap = NULL;
}
}
}
/*******************************************************************************
* Function : CopyEmbeddedRequest
*
* Description : Copy the Embedded Request
*
* Input parameters : pDesData - Pointer to the destination data be copied into
* pSrcData - Pointer to the source data to be copied
*
* Output parameters :
*
* Return value :
*
* Comments :
*
* History :
* 2005/07/16 : Creation
*
* Date : July 16 2005, Frank Zhang
******************************************************************************/
void CopyEmbeddedRequest(EMBEDDED_REQUEST *pDesData, EMBEDDED_REQUEST *pSrcData)
{
Assert(pDesData);
Assert(pSrcData);
if (pSrcData->pRequestedEvents != NULL)
{
pDesData->pRequestedEvents
= (REQUESTED_EVENTS*)calloc(1, sizeof(REQUESTED_EVENTS));
Assert(pDesData->pRequestedEvents);
// memset(pDesData->pRequestedEvents, 0, sizeof(REQUESTED_EVENTS));
CopyRequestedEvents(pDesData->pRequestedEvents, pDesData->pRequestedEvents);
}
if (pSrcData->pDigitMap != NULL)
{
pDesData->pDigitMap = (DIGIT_MAP*)calloc(1, sizeof(DIGIT_MAP));
Assert(pDesData->pDigitMap);
// memset(pDesData->pDigitMap, 0, sizeof(DIGIT_MAP));
CopyDigitMap(pDesData->pDigitMap, pDesData->pDigitMap);
}
if (pSrcData->pSignalRequests != NULL)
{
pDesData->pSignalRequests
= (SIGNAL_REQUESTS*)calloc(1, sizeof(SIGNAL_REQUESTS));
Assert(pDesData->pSignalRequests);
// memset(pDesData->pSignalRequests, 0, sizeof(SIGNAL_REQUESTS));
CopySignalRequests(pDesData->pSignalRequests, pDesData->pSignalRequests);
}
if (pSrcData->pQuarantineHandling != NULL)
{
pDesData->pQuarantineHandling
= (QUARANTINE_HANDLING*)calloc(1, sizeof(QUARANTINE_HANDLING));
Assert(pDesData->pQuarantineHandling);
// memset(pDesData->pQuarantineHandling, 0, sizeof(QUARANTINE_HANDLING));
pDesData->pQuarantineHandling->eLoopControl
= pSrcData->pQuarantineHandling->eLoopControl;
pDesData->pQuarantineHandling->eProcessControl
= pSrcData->pQuarantineHandling->eProcessControl;
}
if (pSrcData->pDetectEvents != NULL)
{
pDesData->pDetectEvents = (DETECT_EVENTS*)calloc(1, sizeof(DETECT_EVENTS));
Assert(pDesData->pDetectEvents);
// memset(pDesData->pDetectEvents, 0, sizeof(DETECT_EVENTS));
CopySignalRequests(pDesData->pDetectEvents, pDesData->pDetectEvents);
}
}
/*******************************************************************************
* Function : ClearEventAction
*
* Description : Clear the Event Action
*
* Input parameters : pData - Pointer to the data to be cleared
*
* Output parameters :
*
* Return value :
*
* Comments :
*
* History :
* 2005/07/16 : Creation
*
* Date : July 16 2005, Frank Zhang
******************************************************************************/
void ClearEventAction(EVENT_ACTION *pData)
{
if (pData != NULL)
{
if (pData->eType == ACTION_EMBED_REQ)
ClearEmbeddedRequest((EMBEDDED_REQUEST*)pData->u.pEmbeddedRequest);
else if (pData->eType == ACTION_EXTENDED)
{
if (pData->u.pExtensionAction->pcPackageName != NULL)
free(pData->u.pExtensionAction->pcPackageName);
if (pData->u.pExtensionAction->pcActionName != NULL)
free(pData->u.pExtensionAction->pcActionName);
ClearEventParameters(&pData->u.pExtensionAction->ActionParameters);
}
free(pData->u.pEmbeddedRequest);
pData->u.pEmbeddedRequest = NULL;
pData->eType = 0;
}
}
/*******************************************************************************
* Function : CopyEventAction
*
* Description : Copy the Event Action
*
* Input parameters : pDesData - Pointer to the destination data be copied into
* pSrcData - Pointer to the source data to be copied
*
* Output parameters :
*
* Return value :
*
* Comments :
*
* History :
* 2005/07/17 : Creation
*
* Date : July 17 2005, Frank Zhang
******************************************************************************/
void CopyEventAction(EVENT_ACTION *pDesData, EVENT_ACTION *pSrcData)
{
Assert(pDesData);
if (pSrcData != NULL)
{
pDesData->eType = pSrcData->eType;
if (pSrcData->u.pEmbeddedRequest != NULL)
{
pDesData->u.pEmbeddedRequest
= (struct EMBEDDED_REQUEST*)calloc(1, sizeof(EMBEDDED_REQUEST));
Assert(pDesData->u.pEmbeddedRequest);
// memset(pDesData->u.pEmbeddedRequest, 0, sizeof(EMBEDDED_REQUEST));
CopyEmbeddedRequest((EMBEDDED_REQUEST*)pDesData->u.pEmbeddedRequest,
(EMBEDDED_REQUEST*)pSrcData->u.pEmbeddedRequest);
}
if (pSrcData->u.pExtensionAction != NULL)
{
pDesData->u.pExtensionAction = (EXTENSION_ACTION*)calloc(1, sizeof(EXTENSION_ACTION));
Assert(pDesData->u.pExtensionAction);
// memset(pDesData->u.pExtensionAction, 0, sizeof(EXTENSION_ACTION));
CopyExtensionAction(pDesData->u.pExtensionAction, pSrcData->u.pExtensionAction);
}
}
}
/*******************************************************************************
* Function : CopyExtensionAction
*
* Description : Copy the Extension Action
*
* Input parameters : pDesData - Pointer to the destination data be copied into
* pSrcData - Pointer to the source data to be copied
*
* Output parameters :
*
* Return value :
*
* Comments :
*
* History :
* 2005/07/17 : Creation
*
* Date : July 17 2005, Frank Zhang
******************************************************************************/
void CopyExtensionAction(EXTENSION_ACTION *pDesData, EXTENSION_ACTION *pSrcData)
{
Assert(pDesData);
if (pSrcData != NULL)
{
StrClone(&pDesData->pcPackageName, pSrcData->pcPackageName);
StrClone(&pDesData->pcActionName, pSrcData->pcActionName);
CopyEventParameters(&pDesData->ActionParameters, &pSrcData->ActionParameters);
}
}
/*******************************************************************************
* Function : ClearEventActions
*
* Description : Clear the Event Actions
*
* Input parameters : pData - Pointer to the data to be cleared
*
* Output parameters :
*
* Return value :
*
* Comments :
*
* History :
* 2005/07/17 : Creation
*
* Date : July 17 2005, Frank Zhang
******************************************************************************/
void ClearEventActions(EVENT_ACTIONS *pData)
{
if (pData != NULL)
{
if (pData->wNum > 0)
{
while (pData->wNum-- > 0)
ClearEventAction(pData->pActionList+pData->wNum);
pData->wNum = 0;
free(pData->pActionList);
pData->pActionList = NULL;
}
}
}
/*******************************************************************************
* Function : CopyEventActions
*
* Description : Copy the Event Actions
*
* Input parameters : pDesData - Pointer to the destination data be copied into
* pSrcData - Pointer to the source data to be copied
*
* Output parameters :
*
* Return value :
*
* Comments :
*
* History :
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -