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

📄 stackcb.c

📁 mgcp协议源代码和测试程序,还有一个编译器
💻 C
📖 第 1 页 / 共 3 页
字号:
 *
 * Date              : Sep 13 2005, Frank Zhang
 ******************************************************************************/
void ClearTranRspOut(TRANSAC_RSP_OUT *pData)
{
	Assert(pData);

	if (pData && pData->pRspOut != NULL)
	{
		ClearMgcpRspOut(pData->pRspOut);
		free(pData->pRspOut);
		pData->pRspOut = NULL;
	}
}
/******************************************************************************
 * Function          : ClearTranRspOutWaitAck
 *
 * Description       : Clear outgoing transaction response waiting Ack 
 *                     
 * Input parameters  : pData - Pointer to the data to be cleared
 *
 * Output parameters : 
 *
 * Return value      : None
 *
 * Comments          : 
 *
 * History           :
 *  2005/09/13       : Creation
 *
 * Date              : Sep 13 2005, Frank Zhang
 ******************************************************************************/
void ClearTranRspOutWaitAck(TRANSAC_RSP_WAIT_ACK *pData)
{
	Assert(pData);

	if (pData->pRspOut)
	{
		ClearMgcpRspOut(pData->pRspOut);
		free(pData->pRspOut);
		pData->pRspOut = NULL;
	}
}
/******************************************************************************
 * Function          : ClearTranCmdOut
 *
 * Description       : Clear the outgoing transaction command 
 *                     
 * Input parameters  : pData - Pointer to the data to be cleared
 *
 * Output parameters : 
 *
 * Return value      : None
 *
 * Comments          : 
 *
 * History           :
 *  2005/09/13       : Creation
 *
 * Date              : Sep 13 2005, Frank Zhang
 ******************************************************************************/
void ClearTranCmdOut(TRANSAC_CMD_OUT *pData)
{
	Assert(pData);

	if (pData->pCmdOut)
	{
		ClearMgcpCmdOut(pData->pCmdOut);
		free(pData->pCmdOut);
		pData->pCmdOut = NULL;
	}
}
/******************************************************************************
 * Function          : ClearMgcpConnection
 *
 * Description       : Clear the Mgcp connection 
 *                     
 * Input parameters  : pData - Pointer to the data to be cleared
 *
 * Output parameters : 
 *
 * Return value      : None
 *
 * Comments          : 
 *
 * History           :
 *  2005/09/13       : Creation
 *
 * Date              : Sep 13 2005, Frank Zhang
 ******************************************************************************/
void ClearMgcpConnection(MGCP_CONNECTION *pData)
{
	if (pData != NULL)
	{
		ClearConnectionMode(&pData->ConnecMode);
		ClearLocalConnectionOptions(&pData->LocalConnecOpt);
		ClearSdpConnectionDescriptor(&pData->LocalConnecDesc);
		
		if (pData->pRemoteConnecDesc != NULL)
		{
			ClearSdpConnectionDescriptor(pData->pRemoteConnecDesc);
			free(pData->pRemoteConnecDesc);
		}
		memset(pData, 0, sizeof(MGCP_CONNECTION));
	}
}
/******************************************************************************
 * Function          : ClearMgcpCall
 *
 * Description       : Clear the mgcp call
 *                     
 * Input parameters  : pData - Pointer to the data to be cleared
 *
 * Output parameters : 
 *
 * Return value      : None
 *
 * Comments          : 
 *
 * History           :
 *  2005/09/13       : Creation
 *
 * Date              : Sep 13 2005, Frank Zhang
 ******************************************************************************/
void ClearMgcpCall(MGCP_CALL *pData)
{
	MGCP_CONNECTION *pConnection;

	if (pData != NULL)
	{
		if (pData->pcCallId != NULL)
		{
			free(pData->pcCallId);
			pData->pcCallId = NULL;
		}

		SListReset(&pData->ConnectionList);
		while((pConnection = (MGCP_CONNECTION*)
			  SListGetCurData(&pData->ConnectionList)) != NULL)
		{
			ClearMgcpConnection(pConnection);
			free(pConnection);
			SListDelCurNode(&pData->ConnectionList);
		}
	}
}
/******************************************************************************
 * Function          : ClearMgcpCallList
 *
 * Description       : Clear the mgcp call list
 *                     
 * Input parameters  : pData - Pointer to the data to be cleared
 *
 * Output parameters : 
 *
 * Return value      : None
 *
 * Comments          : 
 *
 * History           :
 *  2005/09/13       : Creation
 *
 * Date              : Sep 13 2005, Frank Zhang
 ******************************************************************************/
void ClearMgcpCallList(SLIST *pData)
{
	if (pData != NULL)
	{
		MGCP_CALL *pCall;
		SListReset(pData);
		while ((pCall = SListGetCurData(pData)) != NULL)
		{
			ClearMgcpCall(pCall);
			free(pCall);
			SListDelCurNode(pData);
		}
	}
}
/******************************************************************************
 * Function          : ClearMgcpBufferCmdList
 *
 * Description       : Clear the buffered outgoing mgcp command list
 *                     
 * Input parameters  : pData - Pointer to the data to be cleared
 *
 * Output parameters : 
 *
 * Return value      : None
 *
 * Comments          : 
 *
 * History           :
 *  2005/09/13       : Creation
 *
 * Date              : Sep 13 2005, Frank Zhang
 ******************************************************************************/
void ClearMgcpBufferCmdList(SLIST *pData)
{
	if (pData != NULL)
	{
		MGCP_BUF_CMD *pCmd;

		SListReset(pData);
		while ((pCmd = SListGetCurData(pData)) != NULL)
		{
			ClearMgcpCmdOut(pCmd->pCmdOut);
			free(pCmd);
			SListDelCurNode(pData);
		}
	}
}
/******************************************************************************
 * Function          : ClearMgcpEndpoint
 *
 * Description       : Clear the control block of the endpoint
 *                     
 * Input parameters  : pData - Pointer to the data to be cleared
 *
 * Output parameters : 
 *
 * Return value      : None
 *
 * Comments          : 
 *
 * History           :
 *  2005/09/13       : Creation
 *
 * Date              : Sep 13 2005, Frank Zhang
 ******************************************************************************/
void ClearMgcpEndpoint(MGCP_ENDPOINT *pData)
{
	Assert(pData);

	if (pData != NULL)
	{
		CONNECTION_MODE *pMode;

		if (pData->pcEndpointName != NULL)
		{
			free(pData->pcEndpointName);
		}

		SListFreeAll(&pData->PendingCmdOutList);

		ClearNotifiedEntity(&pData->NotifiedEntity);


		/* Clear capabilities */
		SListFreeAll(&pData->CapabilityList.CompressAlgo);
		SListFreeAll(&pData->CapabilityList.SupportedPackages);
		SListReset(&pData->CapabilityList.ConnectionModes);
		while ((pMode = SListGetCurData(&pData->CapabilityList.ConnectionModes)) != NULL)
		{
			ClearConnectionMode(pMode);
			free(pMode);
			SListDelCurNode(&pData->CapabilityList.ConnectionModes);
		}

		ClearPendingConnectionCmdlist(&pData->PendingCmdsIn.PendingCrcxList);
		ClearPendingConnectionCmdlist(&pData->PendingCmdsIn.PendingMdcxList);

		SListFreeAll(&pData->PerSistentEvents);

		if (pData->pcRequestedID != NULL)
		{
			free(pData->pcRequestedID);
		}

		ClearMgcpDigitMap(&pData->DigitMap);

		/* Dial string */
		free(pData->pcDialString);

		ClearMgcpRequestedEventList(&pData->RequestedEvents);
		ClearMgcpDetectEventList(&pData->DetectEvents);

		ClearMgcpSignalList(&pData->RequestedSignals);
		ClearMgcpObservedEventList(&pData->ObservedEvents);
		ClearMgcpObservedEventList(&pData->QuarantinedEvents);

		ClearMgcpBufferCmdList(&pData->BuffedCmdInDisconected);
		ClearMgcpCallList(&pData->CallList);


		ClearRestartMethod(&pData->RestartMethod);
		ClearBearerInfo(&pData->BearerInfo);

		memset(pData, 0, sizeof(MGCP_ENDPOINT));
	}
}
/******************************************************************************
 * Function          : ClearEndpointEventNotify
 *
 * Description       : Clear the notify message data from application
 *                     
 * Input parameters  : pData - Pointer to the data to be cleared
 *
 * Output parameters : 
 *
 * Return value      : None
 *
 * Comments          : 
 *
 * History           :
 *  2005/12/16       : Creation
 *
 * Date              : Dec 16 2005, Frank Zhang
 ******************************************************************************/
void ClearEndpointEventNotify(ENDPOINT_EVENT *pData)
{
	if (pData != NULL)
	{    
		if (pData->pExperiParamList != NULL)
		{
			ClearExperimentalParameters(pData->pExperiParamList);
			free(pData->pExperiParamList);
			pData->pExperiParamList = NULL;
		}
		ClearEventParameters(&pData->Event.EventParams);
	}
}
/******************************************************************************
 * Function          : ClearEndpointDlcxRequest
 *
 * Description       : Clear the DLCX message data from application
 *                     
 * Input parameters  : pData - Pointer to the data to be cleared
 *
 * Output parameters : 
 *
 * Return value      : None
 *
 * Comments          : 
 *
 * History           :
 *  2005/12/16       : Creation
 *
 * Date              : Dec 16 2005, Frank Zhang
 ******************************************************************************/
void ClearEndpointDlcxRequest(ENDPOINT_DLCX *pData)
{
	if (pData != NULL)
	{
		if (pData->pcCallId)
		{
			free(pData->pcCallId);
		}

		if (pData->pcConnecId)
		{
			free(pData->pcConnecId);
		}

		if (pData->pReasonCode)
		{
			ClearReasonCode(pData->pReasonCode);
			free(pData->pReasonCode);
		}

		if (pData->pConnecParam)
		{
			ClearConnectionParameters(pData->pConnecParam);
			free(pData->pConnecParam);
		}

		if (pData->pExperiParamList)
		{
			ClearExperimentalParameters(pData->pExperiParamList);
			free(pData->pExperiParamList);
		}

		memset(pData, 0, sizeof(ENDPOINT_DLCX));
	}
}
/******************************************************************************
 * Function          : ClearEndpointAcceptConnection
 *
 * Description       : Clear the accept connection message data from application
 *                     
 * Input parameters  : pData - Pointer to the data to be cleared
 *
 * Output parameters : 
 *
 * Return value      : None
 *
 * Comments          : 
 *
 * History           :
 *  2005/12/16       : Creation
 *
 * Date              : Dec 16 2005, Frank Zhang
 ******************************************************************************/
void ClearEndpointAcceptConnection(ENDPOINT_CONNECTION_OK *pData)
{
	if (pData != NULL)
	{    
		if (pData->pLocalConnDes)
		{
			ClearSdpConnectionDescriptor(pData->pLocalConnDes);
			free(pData->pLocalConnDes);
		}

		if (pData->pExperiParamList)
		{
			ClearExperimentalParameters(pData->pExperiParamList);
			free(pData->pExperiParamList);
		}

		memset(pData, 0, sizeof(ENDPOINT_CONNECTION_OK));
	}
}
/******************************************************************************
 * Function          : ClearEndpointRejectConnection
 *
 * Description       : Clear the reject connection message data from application
 *                     
 * Input parameters  : pData - Pointer to the data to be cleared
 *
 * Output parameters : 
 *
 * Return value      : None
 *
 * Comments          : 
 *
 * History           :
 *  2005/12/16       : Creation
 *
 * Date              : Dec 16 2005, Frank Zhang
 ******************************************************************************/
void ClearEndpointRejectConnection(ENDPOINT_CONNECTION_FAIL *pData)
{
	if (pData != NULL)
	{    
		if (pData->pExperiParamList)
		{
			ClearExperimentalParameters(pData->pExperiParamList);
			free(pData->pExperiParamList);
		}
		memset(pData, 0, sizeof(ENDPOINT_CONNECTION_FAIL));
	}
}
/******************************************************************************
 * Function          : ClearMgcpEndpointMsg
 *
 * Description       : Clear the stack message data from application
 *                     
 * Input parameters  : pData - Pointer to the data to be cleared
 *
 * Output parameters : 
 *
 * Return value      : None
 *
 * Comments          : 
 *
 * History           :
 *  2005/12/16       : Creation
 *
 * Date              : Dec 16 2005, Frank Zhang
 ******************************************************************************/
void ClearMgcpEndpointMsg(MGCP_ENDPOINT_MSG *pData)
{
	if (pData != NULL)
	{
		switch (pData->eType)
		{
			case M_ENDPOINT_NOTIFY:
			{
				ClearEndpointEventNotify((ENDPOINT_EVENT*)pData->u.pEventNotify);
				break;
			}
			case M_ENDPOINT_DLCX_REQ:
			{

⌨️ 快捷键说明

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