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

📄 stackcb.h

📁 mgcp协议源代码和测试程序,还有一个编译器
💻 H
📖 第 1 页 / 共 2 页
字号:
                                   over this limit, the overflowed will no be 
                                   piggybacked */
typedef struct
{
	DWORD dwCmdId;               /* Command ID of this outgoing command */  
	WORD wPiggyCmdNum;           /* Piggybacked command number */

	/* Command IDs piggybacked with this cmd */
	DWORD PiggybackCmdIDTable[MAX_PIGGY_MSG_NUM];

	H_MGCP_ENDPOINT hEndpointHandle;  /* Handle of the endpoint sending this command */
	NOTIFIED_ENTITY NotifiedEntity;   /* Current NE to which for this command to send */

	DWORD dwInitRTO;                  /* Initial retransmission timer value of 
									   this command, used for calculate RTO */

	E_MGCP_CMD eType;
	union
	{
		MGCP_RSIP_CMD *pRsipCmd;
		MGCP_NTFY_CMD *pNtfyCmd;
		MGCP_DLCX_CMD *pDlcxCmd;
	} u;
} MGCP_CMD_OUT;

/* Outgoing command struct used only when buffering the
   command in Disconnected procedure  */
typedef struct
{
	DWORD dwTimwDuration;       /* Time elaplse after initally be buffered, will
								 be deleted after T-MAX if still in disconnecdted
								 procedure*/

	MGCP_CMD_OUT *pCmdOut;
} MGCP_BUF_CMD;

/* Message data of outgoing response message from EndpointCtrl to TranacManager */
typedef struct 
{
	WORD wRspCode;                /* Response code */
	char *pcRspString;            /* Response string */
	DWORD dwTransacId;            /* Transaction id */

	WORD wPiggyCmdNum;            /* Command number piggybacked with this response */
	DWORD PiggybackCmdIDTable[MAX_PIGGY_MSG_NUM];

	DWORD dwDesIpAddr;            /* IP address of this response */
	WORD wDesPort;                /* UDP port of this response */

	E_MGCP_RSP eType;

	union
	{
		MGCP_EPCF_RSP *pEpcfRsp;
		MGCP_RQNT_RSP *pRqntRsp;
		MGCP_CRCX_RSP *pCrcxRsp;
		MGCP_MDCX_RSP *pMdcxRsp;
		MGCP_DLCX_RSP *pDlcxRsp;
		MGCP_AUEP_RSP *pAuepRsp;
		MGCP_AUCX_RSP *pAucxRsp;
	} u;
} MGCP_RSP_OUT;

/* Command sent out */
typedef struct
{
	DWORD dwTransacId;
	DWORD dwTimeDuration;       /* Time elapse after initial transimission */
	WORD wRetranCounter;        /* Retransmission times */
	DWORD dwRTO;                /* Retransmission timer value*/
	MGCP_CMD_OUT *pCmdOut;
} TRANSAC_CMD_OUT;

/* Command sent out and receive the response waiting ack */
typedef struct
{
	DWORD dwTransacId;
	DWORD dwTimeDuration;       /* Time elapse after initial transimission */
} TRANSAC_RSPACK_OUT;

/* Incoming command */
typedef struct
{
	DWORD dwTransacId;
	BOOL bProvisionalRspOut; /* Whether has sent a provisonal response to this
							  command, used for provisonal response procedure */
} TRANSAC_CMD_IN;

/* Response to incoming command sent out */
typedef struct
{
	DWORD dwTimeDuration;       /* Time elapse after initial transimission */
	MGCP_RSP_OUT *pRspOut;
} TRANSAC_RSP_OUT;

/* Response to incoming command sent out and wait ack */
typedef struct
{
	DWORD dwTimeDuration;       /* Time elapse after initial transimission */
	WORD wRetranCounter;        /* Retransmission times */
	DWORD dwRTO;                /* Retransmission timer */
	MGCP_RSP_OUT *pRspOut;
} TRANSAC_RSP_WAIT_ACK;

/* Response to incoming command sent out and acked */
typedef struct
{
	DWORD dwTransacId;
} TRANSAC_RSP_ACKED;

/********************************************************************
 * Endpoint control structure
 ********************************************************************/

/* MGCP Connection */
typedef struct
{
	DWORD dwConnectionID;      /* MGCP Connection ID used between stack and app */

	CONNECTION_MODE ConnecMode;
	LOCAL_CONNEC_OPTS LocalConnecOpt; /* Most recent Local connection option,
									   only used for AUCX response */

	CONNECTION_DESCRIPTOR LocalConnecDesc;    /* SDP info of local connecteion */
	CONNECTION_DESCRIPTOR *pRemoteConnecDesc; /* SDP info of remote connecteion */ 
} MGCP_CONNECTION;

/* MGCP Call */ 
typedef struct
{
	char *pcCallId;         /* MGCP call ID used in mgcp message */
	SLIST ConnectionList;   /* Connections associated to this call */
} MGCP_CALL;


/* Message data of incoming response message from TranacManager to EndpointCtrl */
typedef struct
{
	WORD wRspCode;                    /* Response code */
	DWORD dwCmdId;                    /* Command id of this response */
	H_MGCP_ENDPOINT hEndpointHandle;  /* Target endpoint handle receive this response */
	DWORD dwRTTDelay;                 /* Round trip time delay of response the command */
	E_MGCP_RSP eType;                 /* The response type(RSIP/NTFY/DLCX) */  
	union                             /* Response data */
	{
		MGCP_RSIP_RSP *pRsipRsp;
		MGCP_NTFY_RSP *pNtfyRsp;
		MGCP_DLCX_RSP *pDlcxRsp;
	} u;
} MGCP_RSP_IN;


/* Message type used between threads */
typedef enum
{
	/* Messages from TransacManager to EndpointCtrl */
	M_INCOMING_CMD = 100,              /* Incoming MGCP command */
	M_INCOMING_RSP,                    /* Incoming MGCP response */
	M_DISCONNECTED,                    /* Disconnected indication */

	/* Messages from Application to EndpointCtrl */
	M_APPLICATION_MSG = 200,

	/* Messages from EndpointCtrl to TransacManager */
	M_OUTGOING_CMD = 300,              /* Outgoing MGCP command */
	M_OUTGOING_RSP,                    /* Outgoing MGCP response */
	M_UPDATE_NE,                       /* Notifed entity updatation */

	/* Messages from Timer Handler */
	M_TIMEOUT = 400                    /* Timout message from timer */
} E_MSG_CODE;

/* Message data for M_UPDATE_NE message */
typedef struct
{
	H_MGCP_ENDPOINT hEndpoint;
	NOTIFIED_ENTITY NewNotifiedEntity;
} MSG_DATA_UPDATE_NE;

/* Message data for M_DISCONNECTED message */
typedef struct
{
	H_MGCP_ENDPOINT hEndpoint;
	E_MGCP_CMD eCmdType;
} MSG_DATA_DISCONNECTED;


/* Message struct for thread message queue */
typedef struct
{
	E_MSG_CODE eMsgCode;              /* Code of the message */
	void *pMsgData;                   /* Message data */
} MGCP_STACK_MSG;

/* Incoming MGCP command defination */
/* Message data of incoming command from TranacManager to EndpointCtrl */
typedef struct
{
	DWORD dwTransacId;            /* Used for sending corresponding response */
	ENDPOINT_NAME EndpointName;   /* Endpoing name to receive this command */
	DWORD dwSrcIpAddr;            /* IP address of this command */
	WORD wSrcPort;                /* UDP port of this command */
	E_MGCP_CMD eType;             /* Command type */  

	union                         /* Command data */
	{
		MGCP_EPCF_CMD *pEpcfCmd;
		MGCP_RQNT_CMD *pRqntCmd;
		MGCP_CRCX_CMD *pCrcxCmd;
		MGCP_MDCX_CMD *pMdcxCmd;
		MGCP_DLCX_CMD *pDlcxCmd;
		MGCP_AUEP_CMD *pAuepCmd;  
		MGCP_AUCX_CMD *pAucxCmd;     
		MGCP_EXPR_CMD *pExprCmd;
	} u;
} MGCP_CMD_IN;

/*Message date from application to EndpointCtrl */
/* Message data of event notify command */
typedef struct
{
	MGCP_OBSERVED_EVENT Event;
	EXPERIMENTAL_PARAMS *pExperiParamList;
} ENDPOINT_EVENT;

/* Message data of event notify command */
typedef struct
{
	MGCP_OBSERVED_EVENT Event;
	E_MGCP_EVENT eSigID;         /* Signal ID of operation */
	DWORD dwConnecID;            /* Connection ID of the signal */

	EXPERIMENTAL_PARAMS *pExperiParamList;
} ENDPOINT_OPERATION_EVENT;

/* Message data delete connection command */
typedef struct
{
	char *pcCallId;
	char *pcConnecId;
	REASON_CODE *pReasonCode;
	CONNECTION_PARAMETERS *pConnecParam;
	EXPERIMENTAL_PARAMS *pExperiParamList;
} ENDPOINT_DLCX;

/* Message data of CRCX/MDCX accept response */
typedef struct
{
	DWORD dwConnecID;
	CONNECTION_DESCRIPTOR *pLocalConnDes;
	EXPERIMENTAL_PARAMS *pExperiParamList;
} ENDPOINT_CONNECTION_OK;

/* Message data of CRCX/MDCX reject response */
typedef struct
{
	DWORD dwConnecID;                      /* Connection ID */
	WORD wRspCode;                         /* Response code */
	EXPERIMENTAL_PARAMS *pExperiParamList;
} ENDPOINT_CONNECTION_FAIL;

typedef enum
{
	M_ENDPOINT_NOTIFY = 1,                 /* NTFY event, except OC/OF */
	M_ENDPOINT_OPERATION_NOTIFY,           /* NTFY event, only for OC/OF */
	M_ENDPOINT_DLCX_REQ,                   /* DLCX command */
	M_ENDPOINT_CRCX_OK,                    /* Response to CRCX */
	M_ENDPOINT_CRCX_FAIL,                  /* Response to CRCX */
	M_ENDPOINT_MDCX_OK,                    /* Response to MDCX */
	M_ENDPOINT_MDCX_FAIL                   /* Response to MDCX */
} E_ENDPOINT_MSG;

typedef struct
{
	H_MGCP_ENDPOINT hEndpointHandle;                 /* Endpoint handle */
	E_ENDPOINT_MSG eType;                            /* Message type */
	union
	{
		ENDPOINT_EVENT *pEventNotify;                  /* NTFY event(except OC/OF) */
		ENDPOINT_OPERATION_EVENT *pOperationEvent;     /* NTFY OC/OF event */
		ENDPOINT_DLCX *pDeleteConnectReq;              /* DLCX command */
		ENDPOINT_CONNECTION_OK *pAcceptConnection;     /* Accept CRCX/MDCX */
		ENDPOINT_CONNECTION_FAIL *pRejectConnection;   /* Reject CRCX/MDCX */
	} u;
} MGCP_ENDPOINT_MSG;

/* Incoming MGCP pending RQNT command */
typedef struct
{
	SLIST PendingSigReq;                /* Requested signal list */
	SLIST PendingReqEvents;             /* Requested event list */
	SLIST PendingDetEvents;             /* Detect event list */
	char *pcReqID;                      /* Requested ID */
	DIGIT_MAP *pDigitMap;               /* Digit map */
	QUARANTINE_HANDLING *pQuarantineHandling;
} MGCP_PENDING_RQNT;

typedef DWORD H_MGCP_CONNECTION;
typedef struct
{
	/* This field is only used for MDCX */
	H_MGCP_CONNECTION hConnection;            /* Handle of the connection to be
											  modified, only used in MDCX, must
											  not to be freed! */

	char *pcCallId;                          /* MGCP call ID used in mgcp message */
	DWORD dwConnectionID;                    /* MGCP Connection ID used between
											  stack and app */
	CONNECTION_MODE *pConnecMode;
	LOCAL_CONNEC_OPTS *pLocalConnecOpt;      /* Most recent Local connection option,
											  only used for AUCX response */

	CONNECTION_DESCRIPTOR *pRemoteConnecDesc; /* SDP info of remote connecteion */ 

	/* Below fields are only used for CRCX */
	H_MGCP_ENDPOINT pSpecificEndPnt;       /* If not NULL, the CRCX use ANY wildcard,
											so response to CRCX must contain the
											SpecificEndpoint parameter */
	H_MGCP_ENDPOINT pSecondEndPnt;         /* If not NULL, the CRCX is a to create
											two local connections */
	DWORD dwSecondConnectionId;
} MGCP_PENDING_CONNEC;

typedef struct
{
	DWORD dwTransacID;                /* Transaction ID of the CRCX/MDCX */
	DWORD dwSrcIpAddr;                /* Source IP address of the CRCX/MDCX */
	WORD wSrcPort;                    /* Source port of the CRCX/MDCX */
	MGCP_PENDING_RQNT *pPendingRqnt;  /* Encap RQNT of the CRCX/MDCX */
	MGCP_PENDING_CONNEC PendingConn;  /* Connection info of the pending CRCX/MDCX */
} MGCP_PENDING_CONNEC_CMD;


void ClearPendingRqnt(MGCP_PENDING_RQNT *pData);
void ClearPendingConnection(MGCP_PENDING_CONNEC *pData);
void ClearPendingConnectionCmd(MGCP_PENDING_CONNEC_CMD *pData);
void ClearPendingConnectionCmdlist(SLIST *pData);
void ClearMgcpRspIn(MGCP_RSP_IN* pData);
void ClearMgcpRspOut(MGCP_RSP_OUT* pData);
void ClearMgcpCmdOut(MGCP_CMD_OUT* pData);
void ClearMgcpCmdIn(MGCP_CMD_IN* pData);
void ClearTranRspOut(TRANSAC_RSP_OUT *pData);
void ClearTranRspOutWaitAck(TRANSAC_RSP_WAIT_ACK *pData);
void ClearTranCmdOut(TRANSAC_CMD_OUT *pData);
void ClearMgcpConnection(MGCP_CONNECTION *pData);
void ClearMgcpCall(MGCP_CALL *pData);
void ClearMgcpCallList(SLIST *pData);
void ClearMgcpBufferCmdList(SLIST *pData);
void ClearMgcpEndpoint(MGCP_ENDPOINT *pData);
void ClearEndpointEventNotify(ENDPOINT_EVENT *pData);
void ClearEndpointDlcxRequest(ENDPOINT_DLCX *pData);
void ClearEndpointAcceptConnection(ENDPOINT_CONNECTION_OK *pData);
void ClearEndpointRejectConnection(ENDPOINT_CONNECTION_FAIL *pData);
void ClearMgcpEndpointMsg(MGCP_ENDPOINT_MSG *pData);
void ClearMgcpStackMessage(MGCP_STACK_MSG *pData);
void ClearMgcpMessageList(MGCP_MSG_LIST *pMsgList);

/* Only used for Debug */
void PrintStackMSG(MGCP_STACK_MSG *pMsg);


#ifdef __cplusplus}#endif

#endif

⌨️ 快捷键说明

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