📄 mgcpdef.c
字号:
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)); 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){ if (pSrcData->pRequestedEvents != NULL) { pDesData->pRequestedEvents = (REQUESTED_EVENTS*)calloc(1, sizeof(REQUESTED_EVENTS)); CopyRequestedEvents(pDesData->pRequestedEvents, pDesData->pRequestedEvents); } if (pSrcData->pDigitMap != NULL) { pDesData->pDigitMap = (DIGIT_MAP*)calloc(1, sizeof(DIGIT_MAP)); CopyDigitMap(pDesData->pDigitMap, pDesData->pDigitMap); } if (pSrcData->pSignalRequests != NULL) { pDesData->pSignalRequests = (SIGNAL_REQUESTS*)calloc(1, sizeof(SIGNAL_REQUESTS)); CopySignalRequests(pDesData->pSignalRequests, pDesData->pSignalRequests); } if (pSrcData->pQuarantineHandling != NULL) { pDesData->pQuarantineHandling = (QUARANTINE_HANDLING*)calloc(1, 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)); 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){ if (pSrcData != NULL) { pDesData->eType = pSrcData->eType; if (pSrcData->u.pEmbeddedRequest != NULL) { pDesData->u.pEmbeddedRequest = (struct EMBEDDED_REQUEST*)calloc(1, 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)); 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){ 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 : * 2005/07/17 : Creation * * Date : July 17 2005, Frank ZHANG ******************************************************************************/void CopyEventActions(EVENT_ACTIONS *pDesData, EVENT_ACTIONS *pSrcData){ if (pSrcData != NULL) { int i; pDesData->wNum = pSrcData->wNum; pDesData->pActionList = (EVENT_ACTION*)calloc(pDesData->wNum, sizeof(EVENT_ACTION)); for (i = 0; i < pDesData->wNum; i++) CopyEventAction(pDesData->pActionList+i, pSrcData->pActionList+i); }}/******************************************************************************* * Function : ClearRequestedEvent * * Description : Clear the Requested Event * * 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 ClearRequestedEvent(REQUESTED_EVENT *pData){ if (pData != NULL) { ClearEventName(&pData->EventName); if (pData->pEventActions != NULL) { ClearEventActions(pData->pEventActions); free(pData->pEventActions); pData->pEventActions = NULL; } ClearEventParameters(&pData->EventParams); }}/******************************************************************************* * Function : CopyRequestedEvent * * Description : Copy the Requested Event * * 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 CopyRequestedEvent(REQUESTED_EVENT *pDesData, REQUESTED_EVENT *pSrcData){ Assert(pDesData); Assert(pSrcData); if (pSrcData != NULL) { CopyEventName(&pDesData->EventName, &pSrcData->EventName); if (pSrcData->pEventActions != NULL) { pDesData->pEventActions = (EVENT_ACTIONS*)calloc(1, sizeof(EVENT_ACTIONS)); CopyEventActions(pDesData->pEventActions, pSrcData->pEventActions); } CopyEventParameters(&pDesData->EventParams, &pSrcData->EventParams); }}/******************************************************************************* * Function : ClearRequestedEvents * * Description : Clear the Requested Events * * Input parameters : pData - Pointer to the data to be cleared * * Output parameters : * * Return value : * * Comments : * * History : * 2005/07/18 : Creation * * Date : July 18 2005, Frank ZHANG ******************************************************************************/void ClearRequestedEvents(REQUESTED_EVENTS *pData){ if (pData != NULL) { if (pData->wNum > 0) { while (pData->wNum-- > 0) ClearRequestedEvent(pData->pReqEventList+pData->wNum); pData->wNum = 0; free(pData->pReqEventList); pData->pReqEventList = NULL; } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -