⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mgcpdef.c

📁 mgcp协议源代码和测试程序,还有一个编译器
💻 C
📖 第 1 页 / 共 5 页
字号:
 *  2005/07/17       : Creation
 *
 * Date              : July 17 2005, Frank Zhang
 ******************************************************************************/
void CopyEventActions(EVENT_ACTIONS *pDesData, EVENT_ACTIONS *pSrcData)
{
  Assert(pDesData);
  if (pSrcData != NULL)
  {
    int i;
    
    pDesData->wNum = pSrcData->wNum;
    pDesData->pActionList = (EVENT_ACTION*)calloc(pDesData->wNum, sizeof(EVENT_ACTION));
	Assert(pDesData->pActionList);
//	memset(pDesData->pActionList, 0, 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);

  if (pSrcData != NULL)
  {
    CopyEventName(&pDesData->EventName, &pSrcData->EventName);

    if (pSrcData->pEventActions != NULL)
    {
      pDesData->pEventActions = (EVENT_ACTIONS*)calloc(1, sizeof(EVENT_ACTIONS));
	  Assert(pDesData->pEventActions);
//	  memset(pDesData->pEventActions, 0, 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;
    }
  }
}
/*******************************************************************************
 * Function          : CopyRequestedEvents
 *
 * Description       : Copy the Requested Events
 *                     
 * 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/18       : Creation
 *
 * Date              : July 18 2005, Frank Zhang
 ******************************************************************************/
void CopyRequestedEvents(REQUESTED_EVENTS *pDesData, REQUESTED_EVENTS *pSrcData)
{
  int i;
  
  Assert(pDesData);
  if (pSrcData != NULL && pSrcData->wNum > 0)
  {  
    pDesData->wNum = pSrcData->wNum;
    pDesData->pReqEventList
      = (REQUESTED_EVENT*)calloc(pDesData->wNum, sizeof(REQUESTED_EVENT));
	Assert(pDesData->pReqEventList);
//    memset(pDesData->pReqEventList, 0, pDesData->wNum * sizeof(REQUESTED_EVENT));
    for (i = 0; i < pDesData->wNum; i++)
      CopyRequestedEvent(pDesData->pReqEventList+i, pSrcData->pReqEventList+i);
  }
}
/*******************************************************************************
 * Function          : ClearSignalRequest
 *
 * Description       : Clear the Signal Request
 *                     
 * 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 ClearSignalRequest(SIGNAL_REQUEST *pData)
{
  if (pData != NULL)
  {
    ClearEventName(&pData->SignalName);
    ClearEventParameters(&pData->SigParamList);
  }
}
/*******************************************************************************
 * Function          : CopySignalRequest
 *
 * Description       : Copy the Signal 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/18       : Creation
 *
 * Date              : July 18 2005, Frank Zhang
 ******************************************************************************/
void CopySignalRequest(SIGNAL_REQUEST *pDesData, SIGNAL_REQUEST *pSrcData)
{
  Assert(pDesData);

  if (pSrcData != NULL)
  {
    CopyEventName(&pDesData->SignalName, &pSrcData->SignalName);

    
    CopyEventParameters(&pDesData->SigParamList, &pSrcData->SigParamList);
  }
}
/*******************************************************************************
 * Function          : ClearSignalRequests
 *
 * Description       : Clear the Signal Requests
 *                     
 * Input parameters  : pData - Pointer to the data to be cleared
 *
 * Output parameters : 
 *
 * Return value      : 
 *
 * Comments          : 
 *
 * History           :
 *  2005/07/19       : Creation
 *
 * Date              : July 19 2005, Frank Zhang
 ******************************************************************************/
void ClearSignalRequests(SIGNAL_REQUESTS *pData)
{
  if (pData != NULL)
  {
    if (pData->wNum > 0)
    {
      while (pData->wNum-- > 0)
        ClearSignalRequest(pData->pSigReqList+pData->wNum);
  
      pData->wNum = 0;
      free(pData->pSigReqList);
      pData->pSigReqList = NULL;
    }
  }
}
/*******************************************************************************
 * Function          : CopySignalRequests
 *
 * Description       : Copy the Signal Requests
 *                     
 * 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/19       : Creation
 *
 * Date              : July 19 2005, Frank Zhang
 ******************************************************************************/
void CopySignalRequests(SIGNAL_REQUESTS *pDesData, SIGNAL_REQUESTS *pSrcData)
{
  int i;
  
  Assert(pDesData);
  if (pSrcData != NULL && pSrcData->wNum > 0)
  {  
    pDesData->wNum = pSrcData->wNum;
    pDesData->pSigReqList = (SIGNAL_REQUEST*)calloc(pDesData->wNum, sizeof(SIGNAL_REQUEST));
	Assert(pDesData->pSigReqList);
//    memset(pDesData->pSigReqList, 0, pDesData->wNum * sizeof(SIGNAL_REQUEST));
    for (i = 0; i < pDesData->wNum; i++)
      CopySignalRequest(pDesData->pSigReqList+i, pSrcData->pSigReqList+i);
  }
}
/*******************************************************************************
 * Function          : CopyDigitMap
 *
 * Description       : Copy the Digit Map
 *                     
 * 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/19       : Creation
 *
 * Date              : July 19 2005, Frank Zhang
 ******************************************************************************/
void CopyDigitMap(DIGIT_MAP *pDesData, DIGIT_MAP *pSrcData)
{
  int i = 0;
  Assert(pDesData);

  if (pSrcData != NULL)
  {
    pDesData->eType = pSrcData->eType;
    pDesData->wNum = pSrcData->wNum;

    if (pSrcData->wNum > 0)
    {
      pDesData->pDigitString = (char**)calloc(pSrcData->wNum, sizeof(char*));
	  Assert(pDesData->pDigitString);
//	  memset(pDesData->pDigitString, 0, pSrcData->wNum * sizeof(char*));
      for (i = 0; i < pSrcData->wNum; i++)
      {
        StrClone(pDesData->pDigitString+i, pSrcData->pDigitString[i]);
      }
    }
  }
}
/*******************************************************************************
 * Function          : ClearDigitMap
 *
 * Description       : Clear the Digit Map
 *                     
 * Input parameters  : pData - Pointer to the data to be cleared
 *
 * Output parameters : 
 *
 * Return value      : 
 *
 * Comments          : 
 *
 * History           :
 *  2005/07/19       : Creation
 *
 * Date              : July 19 2005, Frank Zhang
 ******************************************************************************/
void ClearDigitMap(DIGIT_MAP *pData)
{
  if (pData != NULL)
  {
    if (pData->wNum >0)
    {
      while (pData->wNum-- > 0)
        free(pData->pDigitString[pData->wNum]);

      pData->wNum = 0;
      free(pData->pDigitString);
      pData->pDigitString = NULL;
    }
    pData->eType = 0;
  }
}
/*******************************************************************************
 * Function          : ClearMgcpDigitMap
 *
 * Description       : Clear the Mgcp Digit Map
 *                     
 * Input parameters  : pData - Pointer to the data to be cleared
 *
 * Output parameters : 
 *
 * Return value      : 
 *
 * Comments          : 
 *
 * History           :
 *  2005/07/19       : Creation
 *
 * Date              : July 19 2005, Frank Zhang
 ******************************************************************************/
void ClearMgcpDigitMap(MGCP_DIGIT_MAP *pData)
{
  if (pData != NULL)
  {
    ClearDigitMap(&pData->DigitMap);
    
    while (pData->wStrNum-- > 0)
    {
      WORD wNum = pData->pDigitStrList[pData->wStrNum].wSubStrNum;
      while (wNum-- > 0)
      {
        free(pData->pDigitStrList[pData->wStrNum].pSubStrList[wNum].pcDigitString);
      }
      free(pData->pDigitStrList[pData->wStrNum].pSubStrList);
    }

    pData->wStrNum = 0;
    free(pData->pDigitStrList);
    pData->pDigitStrList = NULL;
  }
}
/*******************************************************************************
 * Function          : ClearConnectionParameters
 *
 * Description       : Clear the Connection Parameters
 *                     
 * Input parameters  : pData - Pointer to the data to be cleared
 *
 * Output parameters : 
 *
 * Return value      : 
 *
 * Comments          : 
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -