📄 protocalapi.c
字号:
* ePkgID - MGCP package type of the persistent event * eEventID - MGCP event type of the persistent event * * Output parameters : * * Return value : Return OK if the persistent event is added successfully, * otherwise return FAIL. * * Comments : * * History : * 2005/12/13 : Creation * * Date : Dec 13 2005, Frank ZHANG ******************************************************************************/LONG MgcpEndpointAddPersistentEvent(H_ENDPOINT pEndpoint, E_MGCP_PACKAGE ePkgID, E_MGCP_EVENT eEventID){ MGCP_PERSIS_EVENT *pEvent; pEvent = (MGCP_PERSIS_EVENT*)calloc(1, sizeof(MGCP_PERSIS_EVENT)); Assert(pEvent); pEvent->ePkgID = ePkgID; pEvent->EventID = eEventID; SListAppend(&((H_MGCP_ENDPOINT)pEndpoint)->PerSistentEvents, pEvent); return OK;}/****************************************************************************** * Function : MgcpEndpointClearPersistentEvents * * Description : Remove all the supported persistent events of the * endpoint * * Input parameters : pEndpoint - Handle of the Endpoint * * Output parameters : * * Return value : None * * Comments : * * History : * 2005/12/15 : Creation * * Date : Dec 15 2005, Frank ZHANG ******************************************************************************/void MgcpEndpointClearPersistentEvents(H_ENDPOINT pEndpoint){ Assert(pEndpoint); SListFreeAll(&((H_MGCP_ENDPOINT)pEndpoint)->PerSistentEvents);}/****************************************************************************** * Function : MgcpEndpointNotifyEvent * * Description : Notify an observed event to the protocal stack. Construct * a internal message and send it to the message queue. * * Input parameters : pEndpoint - Handle of the Endpoint * pEvent - Pointer to the observed event * pExperiParamList - Experimental parameters of the * observed event * * Output parameters : * * Return value : Return OK if the message is sent into the queue * successfully, otherwise return FAIL. * * Comments : * * History : * 2005/11/20 : Creation * * Date : Nov 20 2005, Frank ZHANG ******************************************************************************/LONG MgcpEndpointNotifyEvent(H_ENDPOINT pEndpoint, MGCP_OBSERVED_EVENT *pEvent, EXPERIMENTAL_PARAMS *pExperiParamList){ MGCP_ENDPOINT_MSG *pMsgData; MGCP_STACK_MSG StackMsg; H_MGCP_ENDPOINT pEndpnt = (H_MGCP_ENDPOINT)pEndpoint; Assert(pEndpnt); Assert(pEvent); if (pEndpnt == NULL || pEvent == NULL) return FAIL; if (STACK_HANDLE(pEndpnt)->eStackState != STACK_STATE_RUNNING) return FAIL; pMsgData = (MGCP_ENDPOINT_MSG*)calloc(1, sizeof(MGCP_ENDPOINT_MSG)); Assert(pMsgData); pMsgData->hEndpointHandle = pEndpnt; pMsgData->eType = M_ENDPOINT_NOTIFY; pMsgData->u.pEventNotify = (ENDPOINT_EVENT*)calloc(1, sizeof(ENDPOINT_EVENT)); Assert(pMsgData->u.pEventNotify); /* Observed event data */ CopyMgcpObservedEvent(&pMsgData->u.pEventNotify->Event, pEvent); /* Experimental parameters */ if (pExperiParamList != NULL) { pMsgData->u.pEventNotify->pExperiParamList = (EXPERIMENTAL_PARAMS*)calloc(1, sizeof(EXPERIMENTAL_PARAMS)); Assert(pMsgData->u.pEventNotify->pExperiParamList); CopyExperimentalParameters(pMsgData->u.pEventNotify->pExperiParamList, pExperiParamList); } StackMsg.eMsgCode = M_APPLICATION_MSG; StackMsg.pMsgData = pMsgData; return SendMsgToEndpointCtrl(ENDPOINT_CTRL_HANDLE(pEndpnt), &StackMsg);}/****************************************************************************** * Function : MgcpEndpointDelConnection * * Description : Send a DLCX requeste to the protocal stack. * * Input parameters : pEndpoint - Handle of the Endpoint * pcCallId - Call ID the connection * dwConnecId - Connection ID of the connection * wReasonCode - Reason code of why to delete the connection * pConnecParam - Connectipn parameters * pExperiParams - Experimental parameters of the DLCX * * Output parameters : * * Return value : Return OK if the message is sent into the queue * successfully, otherwise return FAIL. * * Comments : * * History : * 2005/11/20 : Creation * * Date : Nov 20 2005, Frank ZHANG ******************************************************************************/LONG MgcpEndpointDelConnection(H_ENDPOINT pEndpoint, char *pcCallId, DWORD dwConnecId, WORD wReasonCode, CONNECTION_PARAMETERS *pConnecParam, EXPERIMENTAL_PARAMS *pExperiParams){ MGCP_ENDPOINT_MSG *pMsgData; MGCP_STACK_MSG StackMsg; H_MGCP_ENDPOINT pEndpnt = (H_MGCP_ENDPOINT)pEndpoint; Assert(pEndpnt); if (pEndpnt == NULL || pcCallId == NULL) return FAIL; if (STACK_HANDLE(pEndpnt)->eStackState != STACK_STATE_RUNNING) return FAIL; pMsgData = (MGCP_ENDPOINT_MSG*)calloc(1, sizeof(MGCP_ENDPOINT_MSG)); Assert(pMsgData); pMsgData->hEndpointHandle = pEndpnt; pMsgData->eType = M_ENDPOINT_DLCX_REQ; pMsgData->u.pDeleteConnectReq = (ENDPOINT_DLCX*)calloc(1, sizeof(ENDPOINT_DLCX)); Assert(pMsgData->u.pDeleteConnectReq); StrClone(&pMsgData->u.pDeleteConnectReq->pcCallId, pcCallId); pMsgData->u.pDeleteConnectReq->pcConnecId = Ultoa(dwConnecId); if (wReasonCode) { pMsgData->u.pDeleteConnectReq->pReasonCode = (REASON_CODE*)calloc(1, sizeof(REASON_CODE)); pMsgData->u.pDeleteConnectReq->pReasonCode->wCode = wReasonCode; } if (pConnecParam != NULL) { pMsgData->u.pDeleteConnectReq->pConnecParam = (CONNECTION_PARAMETERS*)calloc(1, sizeof(CONNECTION_PARAMETERS)); Assert(pMsgData->u.pDeleteConnectReq->pConnecParam); CopyConnectionParameters(pMsgData->u.pDeleteConnectReq->pConnecParam, pConnecParam); } if (pExperiParams != NULL) { pMsgData->u.pDeleteConnectReq->pExperiParamList = (EXPERIMENTAL_PARAMS*)calloc(1, sizeof(EXPERIMENTAL_PARAMS)); Assert(pMsgData->u.pDeleteConnectReq->pExperiParamList); CopyExperimentalParameters(pMsgData->u.pDeleteConnectReq->pExperiParamList, pExperiParams); } StackMsg.eMsgCode = M_APPLICATION_MSG; StackMsg.pMsgData = pMsgData; return SendMsgToEndpointCtrl(ENDPOINT_CTRL_HANDLE(pEndpnt), &StackMsg);}/****************************************************************************** * Function : MgcpEndpointAcceptCRCX * * Description : Send a accept resonse to the CRCX request to the protocal * stack. * * Input parameters : pEndpoint - Handle of the Endpoint * dwConnecID - Connection ID * pLocalConnecDesc - Local connection descriptor * pExperiParamList - Experimental parameters of the * observed event * * Output parameters : * * Return value : Return OK if the message is sent into the queue * successfully, otherwise return FAIL. * * Comments : * * History : * 2005/11/20 : Creation * * Date : Nov 20 2005, Frank ZHANG ******************************************************************************/LONG MgcpEndpointAcceptCRCX(H_ENDPOINT pEndpoint, DWORD dwConnecID, CONNECTION_DESCRIPTOR *pLocalConnecDesc, EXPERIMENTAL_PARAMS *pExperParam){ MGCP_ENDPOINT_MSG *pMsgData; MGCP_STACK_MSG StackMsg; H_MGCP_ENDPOINT pEndpnt = (H_MGCP_ENDPOINT)pEndpoint; Assert(pEndpnt); if (pEndpnt == NULL || pLocalConnecDesc == NULL) return FAIL; if (STACK_HANDLE(pEndpnt)->eStackState != STACK_STATE_RUNNING) return FAIL; pMsgData = (MGCP_ENDPOINT_MSG*)calloc(1, sizeof(MGCP_ENDPOINT_MSG)); Assert(pMsgData); pMsgData->hEndpointHandle = pEndpnt; pMsgData->eType = M_ENDPOINT_CRCX_OK; pMsgData->u.pAcceptConnection = (ENDPOINT_CONNECTION_OK*)calloc(1, sizeof(ENDPOINT_CONNECTION_OK)); Assert(pMsgData->u.pAcceptConnection); pMsgData->u.pAcceptConnection->dwConnecID = dwConnecID; if (pLocalConnecDesc) { pMsgData->u.pAcceptConnection->pLocalConnDes = (CONNECTION_DESCRIPTOR*)calloc(1, sizeof(CONNECTION_DESCRIPTOR)); Assert(pMsgData->u.pAcceptConnection->pLocalConnDes); CopySdpConnectionDescriptor(pMsgData->u.pAcceptConnection->pLocalConnDes, pLocalConnecDesc); } if (pExperParam != NULL) { pMsgData->u.pDeleteConnectReq->pExperiParamList = (EXPERIMENTAL_PARAMS*)calloc(1, sizeof(EXPERIMENTAL_PARAMS)); Assert(pMsgData->u.pDeleteConnectReq->pExperiParamList); CopyExperimentalParameters(pMsgData->u.pDeleteConnectReq->pExperiParamList, pExperParam); } StackMsg.eMsgCode = M_APPLICATION_MSG; StackMsg.pMsgData = pMsgData; return SendMsgToEndpointCtrl(ENDPOINT_CTRL_HANDLE(pEndpnt), &StackMsg);}/****************************************************************************** * Function : MgcpEndpointRejectCRCX * * Description : Send a reject resonse to the CRCX request to the protocal * stack. * * Input parameters : pEndpoint - Handle of the Endpoint * dwConnecID - Connection ID * wRspCode - Response code * pExperiParamList - Experimental parameters of the * observed event * * Output parameters : * * Return value : Return OK if the message is sent into the queue * successfully, otherwise return FAIL. * * Comments : * * History : * 2005/11/23 : Creation * * Date : Nov 23 2005, Frank ZHANG ******************************************************************************/LONG MgcpEndpointRejectCRCX(H_ENDPOINT pEndpoint, DWORD dwConnecID, WORD wRspCode, EXPERIMENTAL_PARAMS *pExperParam){ MGCP_ENDPOINT_MSG *pMsgData; MGCP_STACK_MSG StackMsg; H_MGCP_ENDPOINT pEndpnt = (H_MGCP_ENDPOINT)pEndpoint; Assert(pEndpnt); if (pEndpnt == NULL) return FAIL; if (STACK_HANDLE(pEndpnt)->eStackState != STACK_STATE_RUNNING) return FAIL; pMsgData = (MGCP_ENDPOINT_MSG*)calloc(1, sizeof(MGCP_ENDPOINT_MSG)); Assert(pMsgData); pMsgData->hEndpointHandle = pEndpnt; pMsgData->eType = M_ENDPOINT_CRCX_FAIL; pMsgData->u.pRejectConnection = (ENDPOINT_CONNECTION_FAIL*)calloc(1, sizeof(ENDPOINT_CONNECTION_FAIL)); Assert(pMsgData->u.pRejectConnection); pMsgData->u.pRejectConnection->dwConnecID= dwConnecID; pMsgData->u.pRejectConnection->wRspCode = wRspCode; if (pExperParam != NULL) { pMsgData->u.pRejectConnection->pExperiParamList = (EXPERIMENTAL_PARAMS*)calloc(1, sizeof(EXPERIMENTAL_PARAMS)); Assert(pMsgData->u.pRejectConnection->pExperiParamList); CopyExperimentalParameters(pMsgData->u.pDeleteConnectReq->pExperiParamList, pExperParam); } StackMsg.eMsgCode = M_APPLICATION_MSG; StackMsg.pMsgData = pMsgData; return SendMsgToEndpointCtrl(ENDPOINT_CTRL_HANDLE(pEndpnt), &StackMsg);}/****************************************************************************** * Function : MgcpEndpointAcceptMDCX * * Description : Send a accept resonse to the MDCX request to the protocal * stack. * * Input parameters : pEndpoint - Handle of the Endpoint * dwConnecID - Connection ID * pLocalConnecDesc - Local connection descriptor * pExperiParamList - Experimental parameters of the * observed event * * Output parameters : * * Return value : Return OK if the message is sent into the queue * successfully, otherwise return FAIL. * * Comments : * * History : * 2005/11/23 : Creation * * Date : Nov 23 2005, Frank ZHANG ******************************************************************************/LONG MgcpEndpointAcceptMDCX(H_ENDPOINT pEndpoint, DWORD dwConnecID, CONNECTION_DESCRIPTOR *pLocalConnecDesc, EXPERIMENTAL_PARAMS *pExperParam){ MGCP_ENDPOINT_MSG *pMsgData; MGCP_STACK_MSG StackMsg; H_MGCP_ENDPOINT pEndpnt = (H_MGCP_ENDPOINT)pEndpoint; Assert(pEndpnt); if (pEndpnt == NULL || pLocalConnecDesc == NULL) return FAIL; if (STACK_HANDLE(pEndpnt)->eStackState != STACK_STATE_RUNNING) return FAIL; pMsgData = (MGCP_ENDPOINT_MSG*)calloc(1, sizeof(MGCP_ENDPOINT_MSG)); Assert(pMsgData); pMsgData->hEndpointHandle = pEndpnt; pMsgData->eType = M_ENDPOINT_MDCX_OK; pMsgData->u.pAcceptConnection = (ENDPOINT_CONNECTION_OK*)calloc(1, sizeof(ENDPOINT_CONNECTION_OK)); pMsgData->u.pAcceptConnection->dwConnecID= dwConnecID; if (pLocalConnecDesc) { pMsgData->u.pAcceptConnection->pLocalConnDes = (CONNECTION_DESCRIPTOR*)calloc(1, sizeof(CONNECTION_DESCRIPTOR)); Assert(pMsgData->u.pAcceptConnection->pLocalConnDes); CopySdpConnectionDescriptor(pMsgData->u.pAcceptConnection->pLocalConnDes, pLocalConnecDesc); } if (pExperParam != NULL) { pMsgData->u.pAcceptConnection->pExperiParamList = (EXPERIMENTAL_PARAMS*)calloc(1, sizeof(EXPERIMENTAL_PARAMS)); Assert(pMsgData->u.pAcceptConnection->pExperiParamList); CopyExperimentalParameters(pMsgData->u.pAcceptConnection->pExperiParamList, pExperParam); } StackMsg.eMsgCode = M_APPLICATION_MSG; StackMsg.pMsgData = pMsgData; return SendMsgToEndpointCtrl(ENDPOINT_CTRL_HANDLE(pEndpnt), &StackMsg);}/****************************************************************************** * Function : MgcpEndpointRejectCRCX * * Description : Send a reject resonse to the MDCX request to the protocal * stack. * * Input parameters : pEndpoint - Handle of the Endpoint * dwConnecID - Connection ID * wRspCode - Response code * pExperiParamList - Experimental parameters of the * observed event * * Output parameters : * * Return value : Return OK if the message is sent into the queue * successfully, otherwise return FAIL. * * History : * 2005/11/23 : Creation * * Date : Nov 23 2005, Frank ZHANG ******************************************************************************/LONG MgcpEndpointRejectMDCX(H_ENDPOINT pEndpoint, DWORD dwConnecID, WORD wRspCode, EXPERIMENTAL_PARAMS *pExperParam){ MGCP_ENDPOINT_MSG *pMsgData; MGCP_STACK_MSG StackMsg; H_MGCP_ENDPOINT pEndpnt = (H_MGCP_ENDPOINT)pEndpoint; Assert(pEndpnt); if (pEndpnt == NULL) return FAIL; if (STACK_HANDLE(pEndpnt)->eStackState != STACK_STATE_RUNNING) return FAIL; pMsgData = (MGCP_ENDPOINT_MSG*)calloc(1, sizeof(MGCP_ENDPOINT_MSG)); Assert(pMsgData); pMsgData->hEndpointHandle = pEndpnt; pMsgData->eType = M_ENDPOINT_MDCX_FAIL; pMsgData->u.pRejectConnection = (ENDPOINT_CONNECTION_FAIL*)calloc(1, sizeof(ENDPOINT_CONNECTION_FAIL)); Assert(pMsgData->u.pRejectConnection); pMsgData->u.pRejectConnection->dwConnecID= dwConnecID; pMsgData->u.pRejectConnection->wRspCode = wRspCode; if (pExperParam != NULL) { pMsgData->u.pRejectConnection->pExperiParamList = (EXPERIMENTAL_PARAMS*)calloc(1, sizeof(EXPERIMENTAL_PARAMS)); Assert(pMsgData->u.pRejectConnection->pExperiParamList); CopyExperimentalParameters(pMsgData->u.pDeleteConnectReq->pExperiParamList, pExperParam); } StackMsg.eMsgCode = M_APPLICATION_MSG; StackMsg.pMsgData = pMsgData; return SendMsgToEndpointCtrl(ENDPOINT_CTRL_HANDLE(pEndpnt), &StackMsg);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -