📄 stackcb.c
字号:
* 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: ClearEndpointDlcxRequest((ENDPOINT_DLCX*)pData->u.pDeleteConnectReq); break; case M_ENDPOINT_CRCX_OK: ClearEndpointAcceptConnection((ENDPOINT_CONNECTION_OK*) pData->u.pAcceptConnection); break; case M_ENDPOINT_CRCX_FAIL: ClearEndpointRejectConnection((ENDPOINT_CONNECTION_FAIL*) pData->u.pRejectConnection); break; case M_ENDPOINT_MDCX_OK: ClearEndpointAcceptConnection((ENDPOINT_CONNECTION_OK*) pData->u.pAcceptConnection); break; case M_ENDPOINT_MDCX_FAIL: ClearEndpointRejectConnection((ENDPOINT_CONNECTION_FAIL*) pData->u.pRejectConnection); break; } free(pData->u.pEventNotify); memset(pData, 0, sizeof(MGCP_ENDPOINT_MSG)); }}/****************************************************************************** * Function : ClearMgcpStackMessage * * Description : Clear the mgcp stack message * * 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 ClearMgcpStackMessage(MGCP_STACK_MSG *pData){ if (pData != NULL) { switch (pData->eMsgCode) { case M_INCOMING_CMD: ClearMgcpCmdIn((MGCP_CMD_IN*)pData->pMsgData); break; case M_INCOMING_RSP: ClearMgcpRspIn((MGCP_RSP_IN*)pData->pMsgData); break; case M_DISCONNECTED: /* Need do nothing */ break; case M_APPLICATION_MSG: ClearMgcpEndpointMsg((MGCP_ENDPOINT_MSG*)pData->pMsgData); break; case M_OUTGOING_CMD: ClearMgcpCmdOut((MGCP_CMD_OUT*)pData->pMsgData); break; case M_OUTGOING_RSP: ClearMgcpRspOut((MGCP_RSP_OUT*)pData->pMsgData); break; case M_UPDATE_NE: { MSG_DATA_UPDATE_NE *pMsgData =(MSG_DATA_UPDATE_NE*)pData->pMsgData; /* Free the message data */ ClearNotifiedEntity(&pMsgData->NewNotifiedEntity); } break; case M_TIMEOUT: /* Need do nothing */ break; default: Assert(0); } free(pData->pMsgData); memset(pData, 0, sizeof(MGCP_STACK_MSG)); }}/****************************************************************************** * Function : ClearMgcpMessageList * * Description : Clear the mgcp message list * * Input parameters : pData - Pointer to the message list * * Output parameters : * * Return value : None * * Comments : * * History : * 2005/12/16 : Creation * * Date : Dec 16 2005, Frank ZHANG ******************************************************************************/void ClearMgcpMessageList(MGCP_MSG_LIST *pMsgList){ TRANSAC_RSP_OUT *pRsp; TRANSAC_RSP_WAIT_ACK *pRspWaitAck; TRANSAC_CMD_OUT *pCmd; Assert(pMsgList); if (pMsgList != NULL) { /* Clear incoming command list */ SListFreeAll(&pMsgList->CmdInProcessList); /* Clear outgoing response list */ SListReset(&pMsgList->RspSentList); while ((pRsp = SListGetCurData(&pMsgList->RspSentList)) != NULL) { ClearTranRspOut(pRsp); free(pRsp); SListDelCurNode(&pMsgList->RspSentList); } /* Clear outgoing piggyback response list */ SListReset(&pMsgList->RspSentPiggybackList); while ((pRsp = SListGetCurData(&pMsgList->RspSentPiggybackList)) != NULL) { ClearTranRspOut(pRsp); free(pRsp); SListDelCurNode(&pMsgList->RspSentPiggybackList); } /* Clear outgoing response and wait ack list */ SListReset(&pMsgList->RspSentWaitAckList); while ((pRspWaitAck = SListGetCurData(&pMsgList->RspSentWaitAckList)) != NULL) { ClearTranRspOutWaitAck(pRspWaitAck); free(pRspWaitAck); SListDelCurNode(&pMsgList->RspSentWaitAckList); } /* Clear outgoing piggyback response and wait ack list */ SListReset(&pMsgList->RspSentPiggyWaitAckList); while ((pRspWaitAck = SListGetCurData(&pMsgList->RspSentPiggyWaitAckList)) != NULL) { ClearTranRspOutWaitAck(pRspWaitAck); free(pRspWaitAck); SListDelCurNode(&pMsgList->RspSentPiggyWaitAckList); } /* Clear outgoing response and acked list */ SListFreeAll(&pMsgList->RspAckReceivedList); /* Clear outgoing command list */ SListReset(&pMsgList->CmdSentList); while ((pCmd = SListGetCurData(&pMsgList->CmdSentList)) != NULL) { ClearTranCmdOut(pCmd); free(pCmd); SListDelCurNode(&pMsgList->CmdSentList); } /* Clear outgoing piggyback command list */ SListReset(&pMsgList->CmdSentPiggybackList); while ((pCmd = SListGetCurData(&pMsgList->CmdSentPiggybackList)) != NULL) { ClearTranCmdOut(pCmd); free(pCmd); SListDelCurNode(&pMsgList->CmdSentPiggybackList); } /* Clear outgoing response ack list */ SListFreeAll(&pMsgList->AckRspSentList); memset(pMsgList, 0, sizeof(MGCP_MSG_LIST)); }}/****************************************************************************** * Function : PrintStackMSG * * Description : Print the Stack MSG * * Input parameters : pMsg - Pointer to the stack message * * Output parameters : * * Return value : None * * Comments : * * History : * 2006/01/02 : Creation * * Date : Jan 02 2006, Frank ZHANG ******************************************************************************/char *GetMgcpCmdNameByType(E_MGCP_CMD eType){ switch (eType) { case MGCP_CMD_RSIP: return("RSIP"); case MGCP_CMD_NTFY: return("NTFY"); case MGCP_CMD_EPCF: return("EPCF"); case MGCP_CMD_RQNT: return("RQNT"); case MGCP_CMD_CRCX: return("CRCX"); case MGCP_CMD_MDCX: return("MDCX"); case MGCP_CMD_DLCX: return("DLCX"); case MGCP_CMD_AUEP: return("AUEP"); case MGCP_CMD_AUCX: return("AUCX"); case MGCP_CMD_EXPR: return("EXPR"); default: return("Unknown MGCP CMD"); }}char *GetMgcpRspNameByType(E_MGCP_RSP eType){ switch (eType) { case MGCP_RSP_COMM: return("RSP_COMM"); case MGCP_RSP_RSIP: return("RSP_RSIP"); case MGCP_RSP_NTFY: return("RSP_NTFY"); case MGCP_RSP_EPCF: return("RSP_EPCF"); case MGCP_RSP_RQNT: return("RSP_RQNT"); case MGCP_RSP_CRCX: return("RSP_CRCX"); case MGCP_RSP_MDCX: return("RSP_MDCX"); case MGCP_RSP_DLCX: return("RSP_DLC"); case MGCP_RSP_AUEP: return("RSP_AUEP"); case MGCP_RSP_AUCX: return("RSP_AUCX"); case MGCP_RSP_EXPR: return("RSP_EXPR"); default: return("Unkown MGCP RSP"); }}char *GetAppMsgNameByType(E_ENDPOINT_MSG eType){ switch (eType) { case M_ENDPOINT_NOTIFY: return("Event Notify"); case M_ENDPOINT_DLCX_REQ: return("DLCX Request"); case M_ENDPOINT_CRCX_OK: return("Accept CRCX"); case M_ENDPOINT_CRCX_FAIL: return("Reject CRCX"); case M_ENDPOINT_MDCX_OK: return("Accept MDCX"); case M_ENDPOINT_MDCX_FAIL: return("Reject MDCX"); default: return("Unknown MSG"); }} void PrintStackMSG(MGCP_STACK_MSG *pMsg){ Assert(pMsg); switch (pMsg->eMsgCode) { case M_INCOMING_CMD: { MGCP_CMD_IN *pData = (MGCP_CMD_IN*)pMsg->pMsgData; DEBUG(LogMSG(LOG_TASK_MSG, "\nM_INCOMING_CMD:");); DEBUG(LogMSG(LOG_TASK_MSG, "\n TransacId = %d", pData->dwTransacId);); DEBUG(LogMSG(LOG_TASK_MSG, "\n EndpointName = %s@%s", pData->EndpointName.pcLocalName, pData->EndpointName.pcDomainName);); DEBUG(LogMSG(LOG_TASK_MSG, "\n Type = %s", GetMgcpCmdNameByType(pData->eType));); } break; case M_INCOMING_RSP: { MGCP_RSP_IN *pData = (MGCP_RSP_IN*)pMsg->pMsgData; DEBUG(LogMSG(LOG_TASK_MSG, "\nM_INCOMING_RSP:");); DEBUG(LogMSG(LOG_TASK_MSG, "\n RspCode = %d", pData->wRspCode);); DEBUG(LogMSG(LOG_TASK_MSG, "\n wCmdId = %d", pData->dwCmdId);); DEBUG(LogMSG(LOG_TASK_MSG, "\n EndpointHandle = %d (Name: %s)", pData->hEndpointHandle, pData->hEndpointHandle->pcEndpointName);); DEBUG(LogMSG(LOG_TASK_MSG, "\n RTTDelay = %d", pData->dwRTTDelay);); DEBUG(LogMSG(LOG_TASK_MSG, "\n Type = %s", GetMgcpRspNameByType(pData->eType));); } break; case M_DISCONNECTED: { MSG_DATA_DISCONNECTED *pData = (MSG_DATA_DISCONNECTED*)pMsg->pMsgData; DEBUG(LogMSG(LOG_TASK_MSG, "\nM_DISCONNECTED:");); DEBUG(LogMSG(LOG_TASK_MSG, "\n EndpointHandle = %d (Name: %s)", pData->hEndpoint, pData->hEndpoint->pcEndpointName);); DEBUG(LogMSG(LOG_TASK_MSG, "\n CmdType = %s", GetMgcpCmdNameByType(pData->eCmdType));); } break; case M_APPLICATION_MSG: { MGCP_ENDPOINT_MSG *pData = (MGCP_ENDPOINT_MSG*)pMsg->pMsgData; DEBUG(LogMSG(LOG_TASK_MSG, "\nM_APPLICATION_MSG:");); DEBUG(LogMSG(LOG_TASK_MSG, "\n EndpointHandle = %d (Name: %s)", pData->hEndpointHandle, pData->hEndpointHandle->pcEndpointName);); DEBUG(LogMSG(LOG_TASK_MSG, "\n Type = %s", GetAppMsgNameByType(pData->eType));); } break; case M_OUTGOING_CMD: { MGCP_CMD_OUT *pData = (MGCP_CMD_OUT*)pMsg->pMsgData; DEBUG(LogMSG(LOG_TASK_MSG, "\nM_OUTGOING_CMD:");); DEBUG(LogMSG(LOG_TASK_MSG, "\n CmdId = %d", pData->dwCmdId);); DEBUG(LogMSG(LOG_TASK_MSG, "\n PiggyCmdNum = %d", pData->wPiggyCmdNum);); DEBUG(LogMSG(LOG_TASK_MSG, "\n EndpointHandle = %d (Name: %s)", pData->hEndpointHandle, pData->hEndpointHandle->pcEndpointName);); DEBUG(LogMSG(LOG_TASK_MSG, "\n wInitRTO = %d", pData->dwInitRTO);); DEBUG(LogMSG(LOG_TASK_MSG, "\n NotifiedEntity = %s@%s:%d", pData->NotifiedEntity.pcLocalName, pData->NotifiedEntity.pcDomainName, pData->NotifiedEntity.wPort);); DEBUG(LogMSG(LOG_TASK_MSG, "\n Type = %s", GetMgcpCmdNameByType(pData->eType));); } break; case M_OUTGOING_RSP: { MGCP_RSP_OUT *pData = (MGCP_RSP_OUT*)pMsg->pMsgData; DEBUG(LogMSG(LOG_TASK_MSG, "\nM_OUTGOING_RSP:");); DEBUG(LogMSG(LOG_TASK_MSG, "\n RspCode = %d", pData->wRspCode);); DEBUG(LogMSG(LOG_TASK_MSG, "\n RspString = %s", pData->pcRspString);); DEBUG(LogMSG(LOG_TASK_MSG, "\n TransacId = %d", pData->dwTransacId);); DEBUG(LogMSG(LOG_TASK_MSG, "\n PiggyCmdNum = %d", pData->wPiggyCmdNum);); DEBUG(LogMSG(LOG_TASK_MSG, "\n Type = %s", GetMgcpRspNameByType(pData->eType));); } break; case M_UPDATE_NE: { MSG_DATA_UPDATE_NE *pData = (MSG_DATA_UPDATE_NE*)pMsg->pMsgData; DEBUG(LogMSG(LOG_TASK_MSG, "\nM_UPDATE_NE:");); DEBUG(LogMSG(LOG_TASK_MSG, "\n EndpointHandle = %d (Name: %s)", pData->hEndpoint, pData->hEndpoint->pcEndpointName);); DEBUG(LogMSG(LOG_TASK_MSG, "\n NewNotifiedEntity = %s@%s:%d", pData->NewNotifiedEntity.pcLocalName, pData->NewNotifiedEntity.pcDomainName, pData->NewNotifiedEntity.wPort);); } break; case M_TIMEOUT: //LogMSG("\nM_TIMEOUT:"); break; default: DEBUG(LogMSG(LOG_TASK_MSG, "\nUnknown!");); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -