init ems server code

This commit is contained in:
2024-09-27 15:39:34 +08:00
parent 9d4009aaca
commit 9930e4e58f
1551 changed files with 110216 additions and 102864 deletions

View File

@@ -0,0 +1,449 @@
#ifndef _MGC_H
#define _MGC_H
#define MGC_MAX_NUM_OF_SAP 5
#define MGC_MAX_USER_NAME_LEN 32
#define MGC_MAX_DOMAIN_LEN 64
#define MGC_MAX_PHY_PORT_PER_MG 32
#define MGC_MAX_CHNL_NUM_PER_PHY 1024
#define MGC_MAX_NUM_OF_CHNL_CON 512
#define MGC_MAX_NUM_OF_CON 8192
#define MGC_MAX_OPER_STEPS_NUM 15
#define MGC_MAX_NUM_OF_MG 1024
#define MGC_MAX_NUM_OF_PHY_PORT 1024
#define MGC_MAX_NUM_OF_CHNL 9424
#define MGC_MAX_NUM_OF_PORT 8192
#define MGC_MAX_NUM_OF_SESS 1024
#define MGC_MAX_NUM_OF_RTP_PROXY_SESS 4096
#define MGC_MGCF_TIMER_50MS 5
#define MGC_MGCF_TIMER_20MS 2
#define MGC_MGCF_TIMER_1S 100
#define MGC_MGCF_TIMER_10S 10 * MGC_MGCF_TIMER_1S
#define MGC_MGCF_TIMER_20S 20 * MGC_MGCF_TIMER_1S
#define MGC_MGCF_TIMER_1H 3600 * MGC_MGCF_TIMER_1S
#define MGC_CHNL_NUM_INTERNAL_PER_PORT 1024
#define MGC_CHNL_NUM_AALN_PER_PORT 1
#define MGC_CHNL_NUM_ANN_PER_TYPE 200
#define MGC_CHNL_NUM_DS_PER_PORT 32
#define MGC_CHNL_NUM_TANDEM_PER_TYPE 1024
#define MGC_CHNL_NUM_SERVEILLANCE_PER_TYPE 1024
#define MGC_HOLD_MUSIC 7
#define MGC_TONE_RING 8
#define MGC_TONE_BUSY 9
#define MGC_TONE_WARN 10
#define MGC_MGCP_MGC_PORT 2727
#define MGC_MGCP_MG_PORT 2427
#define MGC_MG_NETWORK_PORT 4967
#define MGC_MGC_NETWORK_PORT 4966
#define MGC_OPERA_NO_DELAY 0
#define MGC_CONNECT_SILENT_TONE 0x01
#define MGC_MAX_NUM_OF_TANDEM 4096
#define MGC_MAX_NUM_OF_RTP_PROXY_NUM 2
#define MGC_MAX_NUM_OF_TANDEM_CONN (MGC_MAX_NUM_OF_TANDEM*2)
#define MGC_MAX_NUM_OF_TANDEM_CHNL (MGC_MAX_NUM_OF_TANDEM)
#define MGC_TANDEM_CONN_STAR_ID (MGC_MAX_NUM_OF_CON)
#define MGC_TANDEM_CHNL_STAR_ID (MGC_MAX_NUM_OF_CHNL)
#define MGC_TANDEM_PHY_PORT_STAR_ID (MGC_MAX_NUM_OF_PHY_PORT)
#define MGC_MAX_NUM_OF_SURVEILLANCE_NUM 2
#define MGC_MAX_NUM_OF_SURVEILLANCE_CONN 1024
#define MGC_MAX_NUM_OF_SURVEILLANCE_NODE (MGC_MAX_NUM_OF_SURVEILLANCE_CONN)
#define MGC_MAX_NUM_OF_SURVEILLIANCE_CHNL (MGC_MAX_NUM_OF_SURVEILLANCE_CONN)
#define MGC_SURVEILLIANCE_CONN_STAR_ID (MGC_TANDEM_CONN_STAR_ID+MGC_MAX_NUM_OF_TANDEM_CONN)
#define MGC_SURVEILLIANCE_CHNL_STAR_ID (MGC_TANDEM_CHNL_STAR_ID+MGC_MAX_NUM_OF_TANDEM_CHNL)
#define MGC_SURVEILLIANCE_PHY_PORT_STAR_ID (MGC_TANDEM_PHY_PORT_STAR_ID+ MGC_MAX_NUM_OF_RTP_PROXY_NUM)
#include "../../../public/src/include/includes.h"
#include "../../../public/src/include/public.h"
#include "../../../public/src/include/license_id.h"
#include "../../../public/src/include/pub_sdp.h"
//#include "../../../mgcp/src/include/mgcp.h"
typedef enum
{
MGC_RESULT_LACK_PARA = -4,
MGC_RESULT_NO_RES = -3 ,
MGC_RESULT_INPUT_ILLEGAL = -2,
MGC_RESULT_FAILURE = -1,
MGC_RESULT_OK = 0,
MGC_RESULT_8ECP_OK = 1
}MGC_RESULT;
typedef enum{
MGC_DTMF_1 = 1,
MGC_DTMF_2 = 2,
MGC_DTMF_3 = 3,
MGC_DTMF_4 = 4,
MGC_DTMF_5 = 5,
MGC_DTMF_6 = 6,
MGC_DTMF_7 = 7,
MGC_DTMF_8 = 8,
MGC_DTMF_9 = 9,
MGC_DTMF_0 = 10,
MGC_DTMF_START = 11,
MGC_DTMF_POUND = 12
}MGC_DTMF_DEF;
typedef enum{
MGC_PKG_L = 0,
MGC_PKG_D = 1,
MGC_PKG_G = 2
}MGC_PKG_TYPE;
typedef enum
{
MGC_USER_TYPE_UNDEF = -1,
MGC_USER_TYPE_MGC = 0,
MGC_USER_TYPE_MG = 1
}MGC_USER_TYPE;
typedef enum
{
MGC_CONNECT_STATUS_UNDEF = -1,
MGC_CONNECT_STATUS_IDLE ,
MGC_CONNECT_STATUS_CREATING ,
MGC_CONNECT_STATUS_CREATE,
MGC_CONNECT_STATUS_CREATED
}MGC_CONNECT_STATUS;
typedef enum
{
MGC_CON_MODE_UNDEF = -1,
MGC_CON_MODE_INACTIVE ,
MGC_CON_MODE_RECVONLY ,
MGC_CON_MODE_SENDONLY ,
MGC_CON_MODE_SENDRECV ,
MGC_CON_MODE_OWN
}MGC_CON_MODE;
typedef enum
{
MGC_CHNL_INFO_STATUS_UNDEF = -1,
MGC_CHNL_INFO_STATUS_IDLE,
MGC_CHNL_INFO_STATUS_USED
}MGC_CHNL_INFO_STATUS;
typedef enum
{
MGC_PHY_PORT_STATUS_UNDEF = -1,
MGC_PHY_PORT_STATUS_OFF_LINE,
MGC_PHY_PORT_STATUS_ON_LINE
}MGC_PHY_PORT_STATUS;
typedef enum
{
MGC_PHY_PORT_TYPE_UNDEF = -1,
MGC_PHY_PORT_TYPE_E1 = 1 ,
MGC_PHY_PORT_TYPE_T1 = 2 ,
MGC_PHY_PORT_TYPE_ANALOG ,
MGC_PHY_VIRTUAL_TYPE_ANN,
MGC_PHY_VIRTUAL_TYPE_INTERNAL,
MGC_PHY_VIRTUAL_TYPE_TANDEM,
MGC_PHY_VIRTUAL_TYPE_SURVEILLANCE
}MGC_PHY_PORT_TYPE;
typedef enum
{
MGC_MG_CTRL_TYPE_UNDEF = -1,
MGC_MG_CTRL_TYPE_MGCP,
MGC_MG_CTRL_TYPE_8ECP
}MGC_MG_CTRL_TYPE;
typedef enum
{
MGC_MG_TYPE_UNDEF = -1,
MGC_MG_TYPE_INTERNAL = 0 ,
MGC_MG_TYPE_AudioCoder = 1 ,
MGC_MG_TYPE_LGC_MG = 2,
MGC_MG_TYPE_SSW_CSS = 3 ,
MGC_MG_TYPE_IPBSS =4 ,
MGC_MG_TYPE_ANALOG = 11 ,
MGC_MG_TYPE_TANDEM = 20,
MGC_MG_TYPE_ANN =21
}MGC_MG_TYPE;
typedef enum
{
MGC_OPER_ID_UNDEF =-1,
MGC_OPER_ID_CONNECT_CHNL = 1,
MGC_OPER_ID_CONNECT_DTMF = 2,
MGC_OPER_ID_CONNECT_TONE =3,
MGC_OPER_ID_CRCX = 4,
MGC_OPER_ID_MDCX = 5,
MGC_OPER_ID_DLCX = 6,
MGC_OPER_ID_RQNT = 7,
MGC_OPER_ID_AUEP = 8,
MGC_OPER_ID_CONNECT_AAS = 9,
MGC_OPER_ID_TANDEM_CREATE,
MGC_OPER_ID_TANDEM_SET_TAR,
MGC_OPER_ID_TANDEM_UNSET_TAR,
MGC_OPER_ID_TANDEM_CLEAR,
MGC_OPER_ID_TANDEM_FORK_CHNL,
MGC_OPER_ID_CREATE_VIRTUAL_CHNL,
MGC_OPER_ID_RELEASE_VIRTUAL_CHNL,
MGC_OPER_ID_UPDATE_CHNL_MEDIA,
MGC_OPER_ID_IND
}MGC_MG_OPER_ID_TYPE;
typedef enum
{
MGC_CMD_UNDEF = -1,
MGC_CMD_CRCX = 1,
MGC_CMD_MDCX ,
MGC_CMD_DLCX ,
MGC_CMD_RQNT ,
MGC_CMD_NTFY ,
MGC_CMD_AUEP ,
MGC_CMD_RSIP ,
MGC_CMD_NOP //do noting
}MGC_CMD_TYPE;
typedef enum
{
MGCP_OPER_STEP_UNDEF =-1,
MGCP_OPER_STEP_REQUEST,
MGCP_OPER_STEP_REQUEST_SENT,
MGCP_OPER_STEP_RESPONSE_GET,
/***************************************************
* up status is used for MGC , following status is used for MG
*****************************************************/
MGCP_OPER_STEP_IND,
MGCP_OPER_STEP_IND_SENT,
MGCP_OPER_STEP_RESPONSE
}MGCP_OPER_STEP_STATUS;
typedef enum
{
MGC_OPER_FAILURE = 0,
MGC_OPER_SUCCESS = 1
}MGC_OPER_RESULT;
typedef enum
{
MGC_VCTYPE_PCMA = 0 ,
MGC_VCTYPE_PCMU = 1,
MGC_VCTYPE_GSM =2 ,
MGC_VCTYPE_GSM_EFR = 3,
MGC_VCTYPE_AMR_12_2 = 4,
MGC_VCTYPE_G729B = 5,
MGC_VCTYPE_AMR_10_2 = 6,
MGC_VCTYPE_AMR_7_95 = 7,
MGC_VCTYPE_AMR_7_4 = 8,
MGC_VCTYPE_AMR_6_7 = 9,
MGC_VCTYPE_AMR_5_15 = 10,
MGC_VCTYPE_AMR_5_9 = 11,
MGC_VCTYPE_AMR_4_75 = 12,
MGC_VCTYPE_NUM,
MGC_VCTYPE_UNSUPPORT
}MGC_VCTYPE;
typedef enum
{
MGC_TANDEM_STATUS_UNDEF = -1,
MGC_TANDEM_STATUS_IDLE,
MGC_TANDEM_STATUS_USED
}MGC_TANDEM_STATUS;
typedef struct _MGC_ESCCD
{
char domain[MGC_MAX_DOMAIN_LEN];
WORD port;
}MGC_ESCCD;
typedef struct _OPER_REC
{
MGC_MG_OPER_ID_TYPE operaId;
BYTE tone;
WORD duration;
WORD times;
}OPER_REC;
typedef struct _CHNL
{
WORD mgNo; // mg No.
BYTE portNo; // local physical port No. of that mg
WORD chlNo; // local channel No. of that trunk
WORD connectNo;
}CHNL;
typedef struct _MGC_CODEC_LIST
{
BYTE num; // num of codecs
WORD priority; // priority level, used when comparing different codec list
MGC_VCTYPE codec[MGC_VCTYPE_NUM]; // codec ID number, high priority codec first
}MGC_CODEC_LIST;
typedef struct _MG_ATTR
{
BYTE ptime; // ptime, in ms
MGC_MG_TYPE mgType; // non-virtual/ann
MGC_MG_CTRL_TYPE ctrlType; // 8ecp or mgcp
BYTE epDes; // endpoint description method: structured or unstructured
BYTE toneCap; // Tone generation capability
BYTE maxPorts; // maximum physical ports of this MG
WORD maxChnls; // maximum channels of this MG, only applicable to virtual MG.
DWORD ip; // IP address of the MG
char domain[MGC_MAX_DOMAIN_LEN]; // domain name of the mg
BYTE e1cardNo;
DWORD auditTimer;
MGC_CODEC_LIST codecList; // list of codecs that the MG supports
}MG_ATTR;
typedef struct _PKG_EVENT
{
BYTE pkg; // package name
BYTE event; // event name
}PKG_EVENT;
typedef struct _PKG_SIGNAL
{
BYTE pkg; // package name
BYTE signal; // signal name
}PKG_SIGNAL;
typedef struct _PKG_REQ
{
BYTE pkg; // package name
BYTE req; // request name
}PKG_REQ;
#define MGC_MEDIA_PARA_FLAG_EC 0x0001
#define MGC_MEDIA_PARA_FLAG_SS 0x0002
#define MGC_MEDIA_PARA_FLAG_VT 0x0004
#define MGC_MEDIA_PARA_FLAG_CM 0x0008
#define MGC_MEDIA_PARA_FLAG_PT 0x0010
typedef struct _MEDIA_PARA
{
WORD flag; // which media attribute is affected
BYTE ecDisable; // echo canceller disable or enable
BYTE ssDisable; // silence suppression disable or enable;
BYTE conMode; // connect mode
BYTE ptime; // packetization period
MGC_CODEC_LIST vocoderType; // vocoder type
}MEDIA_PARA;
typedef struct _MEDIA_ATTR
{
BYTE ecDisable; // echo canceller disable or enable
BYTE ssDisable; // silence suppression disable or enable
MGC_VCTYPE vocoderType; // vocoder type
MGC_CON_MODE conMode; // connect mode
char callId[33]; // call Id
char conId[33]; // connection id
BYTE ptime; // packetization period
PKG_EVENT pkgEvent; // package + event
PKG_SIGNAL pkgSignal; // package + signal
PKG_REQ pkgReq;
PUB_SDP_MSG sdp; // media info of this channel
}MEDIA_ATTR;
typedef int (*mgc_ind_callback)(CHNL chnl, MGC_CMD_TYPE cmd, WORD *usrPort, WORD mgcPort, MEDIA_ATTR *mediaAttr);
typedef int (*mgc_cnf_callback)(WORD usrPort, WORD mgcPort, MGC_MG_OPER_ID_TYPE operId, MGC_OPER_RESULT success, WORD cause);
typedef struct _MGC_SAP
{
int id; //internal used , should not be modified by up layer
char usrName[MGC_MAX_USER_NAME_LEN]; // user name
MGC_USER_TYPE usrType; // user acts as a mg or mgc
mgc_ind_callback ind_func;
mgc_cnf_callback cnf_func;
}MGC_SAP;
void mgc_init(DWORD systemId, DWORD localIp, DWORD peerIp);
int mgc_bind(MGC_SAP *pSap);
int mgc_unbind(MGC_SAP *pSap, BYTE sapIndex);
void mgc_timer(void);
int mgc_create_MG(BYTE sapIndex, MG_ATTR *pMgAttr);
int mgc_delete_MG(BYTE sapIndex, WORD mgNo);
int mgc_modify_MG(BYTE sapIndex, WORD mgNo, MG_ATTR *pMgAttr);
int mgc_add_port(BYTE sapIndex, WORD mgNo, BYTE portNo, MGC_PHY_PORT_TYPE portType);
int mgc_delete_port(BYTE sapIndex, WORD mgNo, BYTE portNo);
int mgc_crcx_chnl(WORD usrPort, CHNL chnl);
int mgc_mdcx_chnl(WORD usrPort, CHNL chnl, MEDIA_PARA *pMediaPara);
int mgc_dlcx_chnl(WORD usrPort, CHNL chnl);
int mgc_rqnt_chnl(WORD usrPort, CHNL chnl, PKG_EVENT *pPkgEvent, PKG_SIGNAL *pPkgSig);
int mgc_connect_chnl(WORD usrPort, CHNL orgChnl, CHNL destChnl, BYTE flag);
int mgc_connect_dtmf(WORD usrPort, CHNL chnl,CHNL dstChnl, BYTE dtmfNo);
int mgc_recvonly_chnl(WORD usrPort, CHNL orgChnl, CHNL destChnl);
int mgc_connect_AAS(WORD usrPort, CHNL orgChnl, CHNL destChnl, BYTE toneNo, WORD duration, WORD times);
int mgc_connect_tone(WORD usrPort, CHNL orgChnl, CHNL destChnl, BYTE toneNo, WORD duration);
int mgc_query_mg_status(WORD mgNo);
int mgc_query_port_status(WORD mgNo, BYTE portNo);
int mgc_query_channel_status(CHNL chnl);
int mgc_create_virtual_chnl(WORD usrPort, CHNL *pChnl);
int mgc_release_virtual_chnl(WORD usrPort,CHNL chnl);
int mgc_query_chnl_media(WORD usrPort, CHNL chnl, PUB_SDP_MSG **ppMediaInfo, BYTE *pMgPayloads, BYTE *pMgPlNum);
int mgc_update_chnl_media(WORD usrPort, CHNL chnl, PUB_SDP_MSG *pMediaInfo);
int mgc_chnl_codec_update(CHNL chnl , MGC_CODEC_LIST codecList);
OPER_REC *mgc_query_chnl_oper_rec(CHNL chnl);
int mgc_license_ctrl(WORD maxMgNum, WORD maxChnlNum);
int mgc_rsp(BYTE cmd, WORD usrPort, WORD port, WORD retCode, MEDIA_ATTR *pMediaAttr);
int mgc_get_idle_tandem_id(void);
int mgc_bind_chnl_to_tandem(WORD usrPort , CHNL tarChnl , DWORD tandId);
int mgc_create_tandem(WORD usrPort , DWORD tandId);
int mgc_unbind_chnl_from_tandem(WORD usrPort , CHNL tarChnl , DWORD tandId);
int mgc_delete_tandem(WORD usrPort , DWORD tandemId);
int mgc_get_tandem_near_end(DWORD tandem_id, CHNL *pChnl);
int mgc_get_tandem_far_end(DWORD tandem_id, CHNL *pChnl);
int mgc_fork_chnl(WORD usrPort , CHNL parent, CHNL *pChild);
char *mgc_print_failure_reason(int ret);
#endif

View File

@@ -0,0 +1,17 @@
#ifndef _MGC_8ECP_H
#define _MGC_8ECP_H
#include "mgc_struct.h"
#define MGC_8ECP_MAX_TRK_PER_MG 8
int mgc_bind_8ecp_setup(void);
int mgc_8ecp_update_trk_status(BYTE mgNo, BYTE trkNo, BYTE status);
int mgc_8ecp_update_mg_status(BYTE mgNo, BYTE status);
BOOL mgc_8ecp_create(MG_INFO *pMgInfo , MG_ATTR *pMgAttr);
BOOL mgc_8ecp_delete(MG_INFO *pMgInfo);
BOOL mgc_8ecp_dlcx_chnl(CHNL chnl);
BOOL mgc_8ecp_connect_chnl(CHNL orgChnl, CHNL destChnl, BYTE flag);
BOOL mgc_8ecp_connect_dtmf(CHNL orgChnl, CHNL destChnl, BYTE digit);
BOOL mgc_8ecp_connect_tone(CHNL orgChnl, CHNL destChnl, BYTE tone , BYTE duration);
#endif

View File

@@ -0,0 +1,32 @@
#ifndef _MGC_CHNL_INFO_H
#define _MGC_CHNL_INFO_H
#include "mgc_struct.h"
void mgc_chnl_info_setup(void);
void mgc_chnl_info_init(CHNL_INFO *pChnlInfo , int id);
void mgc_chnl_info_clear(CHNL_INFO *pChnlInfo);
void mgc_chnl_info_status_set(CHNL_INFO *pChnlInfo , MGC_CHNL_INFO_STATUS status);
CHNL_INFO *mgc_chnl_info_get_unused_chnl(void);
CHNL_INFO *mgc_chnl_info_get_chnl(CHNL chnl);
BOOL mgc_chnl_info_attach_to_phy_port(CHNL_INFO *pChnlInfo , PHY_PORT_INFO *pPhyPort);
CHNL_INFO *mgc_chnl_info_find_chnl_of_phy(PHY_PORT_INFO *pPhyPort , int chnlNo);
int mgc_chnl_info_get_chnl_no_of_phy(CHNL_INFO *pChnlInfo , PHY_PORT_INFO *pPhyPort);
BOOL mgc_chnl_info_attach_connect(CHNL_INFO *pChnlInfo , CONNECT_INFO *pConnect , int connNo);
BOOL mgc_chnl_info_detach_connect(CHNL_INFO *pChnlInfo , CONNECT_INFO *pConnect);
CONNECT_INFO *mgc_chnl_info_assign_connect(CHNL_INFO *pChnlInfo , int connNo);
CONNECT_INFO *mgc_chnl_info_assign_idle_connect(CHNL_INFO *pChnlInfo);
void mgc_chnl_info_set_mon(int id, BOOL enable);
BYTE *mgc_chnl_info_get_res_addr(void);
char *mgc_chnl_info_print_status(CHNL_INFO *pChnlInfo);
char *mgc_chnl_info_print_remote(CHNL_INFO *pChnlInfo);
char *mgc_chnl_info_print_mode(CHNL_INFO *pChnlInfo);
char *mgc_chnl_info_print_codec(CHNL_INFO *pChnlInfo);
#endif

View File

@@ -0,0 +1,71 @@
#ifndef _MGC_CONNECT_H
#define _MGC_CONNECT_H
#include "mgc_struct.h"
void mgc_connect_setup(void);
void mgc_connect_init(CONNECT_INFO *pConnect , int id);
CONNECT_INFO *mgc_connect_get_unused(void);
void mgc_connect_set_status(CONNECT_INFO *pConnect , MGC_CONNECT_STATUS status);
MGC_CONNECT_STATUS mgc_connect_get_status(CONNECT_INFO *pConnect);
char *mgc_connect_print_statuts(MGC_CONNECT_STATUS status);
void mgc_connect_codec_list_init(MGC_CODEC_LIST *pList);
/*fuplayers and downlayer operation*/
CHNL_INFO *mgc_connect_get_own_chnl_info(CONNECT_INFO *pConnect);
PHY_PORT_INFO *mgc_connect_get_own_phy_port_info(CONNECT_INFO *pConnect);
MGC_SAP *mgc_connect_get_conn_report_sap(CONNECT_INFO *pConnect);
MG_INFO *mgc_connect_get_own_mg_info(CONNECT_INFO *pConnect);
CONNECT_INFO *mgc_connect_find_connect_of_chnl(CHNL_INFO *pChnlInfo , int connNo);
BOOL mgc_connect_attach_connect_to_chnl(CONNECT_INFO *pConnect , CHNL_INFO *pChnlInfo);
int mgc_connect_get_connNo_of_chnl_info(CONNECT_INFO *pConnect , CHNL_INFO *pChnlInfo);
/*attr*/
BOOL mgc_connect_set_conn_mode(CONNECT_INFO *pConnect , MGC_CON_MODE mode);
MGC_CON_MODE mgc_connect_get_conn_mode(CONNECT_INFO *pConnect);
void mgc_connect_attr_init(CONNECT_INFO *pConnect);
BOOL mgc_connect_attr_negotiate(CONNECT_INFO *pConnect);
BOOL mgc_connect_set_dtmf(CONNECT_INFO *pConnect , BYTE dtmfNo);
BOOL mgc_connect_set_tone(CONNECT_INFO *pConnect , BYTE toneNo);
BOOL mgc_connect_clear_tone(CONNECT_INFO *pConnect);
BOOL mgc_connect_set_req(CONNECT_INFO *pConnect , BYTE pkg , BYTE req);
/*operate */
BOOL mgc_connect_attach_step_info(CONNECT_INFO *pConnect , MGCF_OPER_STEP *pOperStep);
BOOL mgc_connect_dettach_step_info(CONNECT_INFO *pConnect);
MGCF_OPER_STEP *mgc_connect_get_step_info(CONNECT_INFO *pConnect);
/*para create*/
BOOL mgc_connect_auep_para_create(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_connect_crcx_para_create(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_connect_mdcx_para_create(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_connect_dlcx_para_create(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_connect_crcx_resp_parse_para(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_connect_mdcx_resp_parse_para(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_connect_rqnt_para_create(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_connect_is_conn_need_update(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
/*para parse*/
CONNECT_INFO *mgc_connect_assign_conn_by_para(MGCP_PARA *pPara);
CONNECT_INFO *mgc_connect_find_conn_by_conid(MGCP_PARA *pPara);
BOOL mgc_connect_crcx_req_parse_para(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_connect_mdcx_req_parse_para(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_connect_req_parse_para(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_connect_add_auep(CONNECT_INFO *pConnect, PORT_INFO *pPortInfo);
BOOL mgc_connect_add_crcx(CONNECT_INFO *pConnect, PORT_INFO *pPortInfo);
BOOL mgc_connect_add_crcx_with_mode(CONNECT_INFO *pConnect, MGC_CON_MODE mode ,PORT_INFO *pPortInfo);
BOOL mgc_connect_add_crcx_aas(CONNECT_INFO *pConnect, CONNECT_INFO *pPeerConnect, PORT_INFO *pPortInfo);
BOOL mgc_connect_add_mdcx_aas(CONNECT_INFO *pConnect, CONNECT_INFO *pPeerConnect,PORT_INFO *pPortInfo);
BOOL mgc_connect_add_dlcx(CONNECT_INFO *pConnect, PORT_INFO *pPortInfo);
BOOL mgc_connect_add_mdcx(CONNECT_INFO *pConnect, CONNECT_INFO *pPeerConnect , MGC_CON_MODE mode, PORT_INFO *pPortInfo);
BOOL mgc_connect_add_nop_with_delay(CONNECT_INFO *pConnect, DWORD delay ,PORT_INFO *pPortInfo);
BOOL mgc_connect_add_nop(CONNECT_INFO *pConnect, PORT_INFO *pPortInfo);
BOOL mgc_connect_add_rqnt(CONNECT_INFO *pConnect, PKG_EVENT *pPkgEvent, PKG_SIGNAL *pPkgSig, PORT_INFO *pPortInfo);
BOOL mgc_connect_add_rqnt_with_delay(CONNECT_INFO *pConnect, WORD delay, PKG_EVENT *pPkgEvent, PKG_SIGNAL *pPkgSig, PORT_INFO *pPortInfo);
CONNECT_INFO *mgc_connect_dup_attr(CONNECT_INFO *pConnect);
#endif

View File

@@ -0,0 +1,16 @@
#ifndef _MGC_CTL_H
#define _MGC_CTL_H
#include "mgc_struct.h"
void mgc_ctl_num_init(WORD sysId , WORD localIp , WORD peerIp);
BOOL mgc_ctl_is_mg_full(void);
void mgc_ctl_mg_add_one(void);
void mgc_ctl_mg_remove_one(void);
BOOL mgc_ctl_is_chnl_full(void);
void mgc_ctl_chnl_add_one(void);
void mgc_ctl_chnl_remove_one(void);
int mgc_ctl_set_mg_max_num(int num);
int mgc_ctl_set_chnl_max_num(int num);
#endif

View File

@@ -0,0 +1,67 @@
#ifndef _MGC_DEBUG_H
#define _MGC_DEBUG_H
#include "mgc_struct.h"
//#define MGC_TEST_DEBUG
#define MGC_MAX_LINE_LENGTH 256
#define MGC_MAX_ASCIIIN_LEN 4096
#define MGC_MAX_ASCIIOUT_LEN (4096*2)
#define MGC_MAX_ASCITMP_LEN 4096
#define MGC_MONITOR_NONE 0x0000
#define MGC_MONITOR_DEBUG 0x0001
#define MGC_MONITOR_ERROR 0x0010
#define MGC_MONITOR_WARN 0x0100
#define MGC_MONITOR_INFO 0x1000
#define MGC_MONITOR_ALL 0xffff
#ifdef MGC_TEST_DEBUG
#define MGC_DEBUG(msg...) printf("\33[37m DEBUG: [%s:%d]",__FILE__ ,__LINE__ );printf(msg);printf("\n \33[37m")
#define MGC_WARN(msg...) printf("\33[33m WARN: [%s:%d]",__FILE__ ,__LINE__ );printf(msg);printf("\n \33[37m")
#define MGC_ERROR(msg...) printf("\33[31m ERROR: [%s:%d]",__FILE__ ,__LINE__ );printf(msg);printf("\n \33[37m")
#define MGC_INFO(msg...) printf("\33[32m INFO: [%s:%d]",__FILE__ ,__LINE__ );printf(msg);printf("\n \33[37m")
#else
void MGC_DEBUG(char *msg,...);
void MGC_WARN(char *msg,...);
void MGC_ERROR(char *msg,...);
void MGC_INFO(char *msg,...);
#endif
/*
#define NONE "\033[m"
#define RED "\033[0;32;31m"
#define LIGHT_RED "\033[1;31m"
#define GREEN "\033[0;32;32m"
#define LIGHT_GREEN "\033[1;32m"
#define BLUE "\033[0;32;34m"
#define LIGHT_BLUE "\033[1;34m"
#define DARY_GRAY "\033[1;30m"
#define CYAN "\033[0;36m"
#define LIGHT_CYAN "\033[1;36m"
#define PURPLE "\033[0;35m"
#define LIGHT_PURPLE "\033[1;35m"
#define BROWN "\033[0;33m"
#define YELLOW "\033[1;33m"
#define LIGHT_GRAY "\033[0;37m"
#define WHITE "\033[1;37m"
*/
BYTE mgcAsciInBuf[MGC_MAX_ASCIIIN_LEN];
BYTE mgcAsciOutBuf[MGC_MAX_ASCIIOUT_LEN];
BYTE mgcAsciTempBuf[MGC_MAX_ASCITMP_LEN];
WORD mgcMonitorFg;
void mgc_mon(void);
int mgc_debug_set(void);
int mgc_asciout_proc(BYTE *out_str);
int mgc_hex_to_ascii(BYTE *from_hex, BYTE from_len, BYTE *to_asc);
int mgc_log_err(char *err_msg);
int mgc_log_procedure(WORD mgNo, WORD portIndex, WORD chnlIndex, char *msg);
#endif

View File

@@ -0,0 +1,32 @@
#ifndef _MGC_INTERNAL_H
#define _MGC_INTERNAL_H
#include "mgc_struct.h"
#define ITL_OPERA_NUM 1024
#define ITL_OPERA_PORT_NO 127
#define ITL_MG_INFO_PORT_NO 37
typedef enum
{
ITL_OPERA_STATE_UNDEF =-1 ,
ITL_OPERA_STATE_IDLE,
ITL_OPERA_STATE_REQUEST ,
ITL_OPERA_STATE_RESPONSE
}ITL_OPERA_STATE;
typedef struct _ITL_OPERA_STRUCT
{
int userPort;
ITL_OPERA_STATE status;
CHNL chnl;
}ITL_OPERA_STRUCT;
BOOL mgc_internal_sap_bind(void);
BOOL mgc_internal_mg_create(void);
BOOL mgc_internal_opera_auep_request(MG_INFO *pMgInfo);
int mgc_internal_get_sap_index(void);
#endif

View File

@@ -0,0 +1,30 @@
#ifndef _MGC_MG_INFO_H
#define _MGC_MG_INFO_H
#include "mgc_struct.h"
void mgc_mg_info_setup(void);
void mgc_mg_info_init(MG_INFO *pMgInfo , int id);
void mgc_mg_info_clear(MG_INFO *pMgInfo);
int mgc_mg_info_attached_phy_port_num(MG_INFO *pMgInfo);
BOOL mgc_mg_info_attach_phy_port(MG_INFO *pMgInfo , PHY_PORT_INFO *pPhyPort, MGC_SAP *pSap);
void mgc_mg_info_dettach_phy_port(MG_INFO *pMgInfo , PHY_PORT_INFO *pPhyPort);
MG_INFO *mgc_mg_info_get_unused_mg(void);
MG_INFO *mgc_mg_info_get_index_mg(int index);
BOOL mgc_mg_info_assign_attr(MG_INFO *pMgInfo , MG_ATTR *pMgAttr);
void mgc_mg_info_update_mg_status(MG_INFO *pMgInfo , BOOL status);
MG_INFO *mgc_mg_info_check_mg_is_exsit(MG_ATTR *pMgAttr);
void mgc_mg_info_state_check(MG_INFO *pMgInfo);
CHNL_INFO *mgc_mg_info_find_idle_chnl_info(MG_INFO *pMgInfo);
BOOL mgc_mg_info_is_port_already_exist(MG_INFO *pMgInfo , int portNo , MGC_SAP *pSap);
MG_INFO *mgc_mg_info_find_available_mg(MGC_MG_TYPE mgType);
CONNECT_INFO *mgc_mg_info_assign_idle_connection(MG_INFO *pMgInfo);
CONNECT_INFO *mgc_mg_info_assign_aas_tone_connection(BYTE toneNo);
PHY_PORT_INFO *mgc_mg_info_find_port_by_name(char *name ,WORD localPort);
PHY_PORT_INFO *mgc_mg_info_find_port_by_name_and_portNo(char *name , BYTE portNo ,WORD localPort);
MG_INFO *mgc_mg_info_find_mg_by_name(char *name);
void mgc_mg_info_set_mon(int id , BOOL enable );
BYTE *mgc_mg_info_get_res_addr(void);
void mgc_mg_info_print_info(MG_INFO *pMgInfo);
#endif

View File

@@ -0,0 +1,41 @@
#ifndef _MGC_MGCP_H
#define _MGC_MGCP_H
#include "mgc_struct.h"
#include "../../../mgcp/src/include/mgcp.h"
int mgc_mgcp_get_sap_index(void);
int mgc_mgcp_match_codec_list(MGC_CODEC_LIST *dest, MGC_CODEC_LIST *aParty, MGC_CODEC_LIST *bParty);
BOOL mgc_mgcp_check_codec_valid(MGC_VCTYPE codec);
int mgc_bind_mgcp_setup(void);
int mgc_mgcp_print_vc_num(MGC_VCTYPE vcCodec);
char *mgc_mgcp_print_vc_codec(MGC_VCTYPE vcCodec);
BYTE mgc_mgcp_convert_cmd_to_mgcp(MGC_CMD_TYPE mgcCmd);
MGC_CMD_TYPE mgc_mgcp_convert_mgcp_to_cmd(BYTE mgcpCmd);
MGC_CON_MODE mgc_mgcp_convert_to_mgc_mode(BYTE mode);
BYTE mgc_mgcp_conver_to_mgcp_mode(MGC_CON_MODE mode);
char *mgc_mgcp_print_mgc_mode(MGC_CON_MODE mode);
char *mgc_mgcp_print_ip(DWORD addr);
BOOL mgc_mgcp_create_connect_dest_ip(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_mgcp_create_connect_port(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_mgcp_create_connect_req_start_line(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_mgcp_create_connect_con_mode(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_mgcp_create_connect_con_id(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_mgcp_create_connect_call_id(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_mgcp_create_connect_local_opt(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_mgcp_create_connect_pkg_sig(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_mgcp_create_connect_pkg_req(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_mgcp_create_connect_sdp(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_mgcp_create_connect_resp_start_line(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_mgcp_response_msg(CONNECT_INFO *pConnect , MGCP_PARA *pPara, int retCode);
BOOL mgc_mgcp_parse_connect_sdp(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_mgcp_parse_connect_pkg_sig(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_mgcp_parse_connect_pkg_event(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_mgcp_parse_connect_call_id(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_mgcp_parse_connect_mode(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
BOOL mgc_mgcp_parse_connect_local_opt(CONNECT_INFO *pConnect , MGCP_PARA *pPara);
#endif

View File

@@ -0,0 +1,24 @@
#ifndef _MGC_PHY_PORT_H
#define _MGC_PHY_PORT_H
#include "mgc_struct.h"
void mgc_phy_port_setup(void);
void mgc_phy_port_init(PHY_PORT_INFO *pPhyPort , int id);
void mgc_phy_port_clear(PHY_PORT_INFO *pPhyPort);
PHY_PORT_INFO *mgc_phy_port_get_unused_phy(void);
PHY_PORT_INFO *mgc_phy_port_find_port_of_mg(MG_INFO *pMgInfo , int portNo);
PHY_PORT_INFO *mgc_phy_port_find_port_of_mg_by_index(MG_INFO *pMgInfo , int index);
void mgc_phy_port_set_chnl_num(PHY_PORT_INFO *pPhyPort , MGC_PHY_PORT_TYPE portType);
BOOL mgc_phy_port_attach_chnl(PHY_PORT_INFO *pPhyPort);
void mgc_phy_port_update_status(PHY_PORT_INFO *pPhyPort , BOOL status);
CHNL_INFO *mgc_phy_port_find_idle_chnl(PHY_PORT_INFO *pPhyPort);
CONNECT_INFO *mgc_phy_port_assign_idle_connection(PHY_PORT_INFO *pPhyPort);
void mgc_phy_port_set_mon(int id, BOOL enalbe);
BYTE *mgc_phy_port_get_res_addr(void);
void mgc_phy_port_print(PHY_PORT_INFO *pPhyPort);
#endif

View File

@@ -0,0 +1,38 @@
#ifndef _MGC_PORT_INFO_H
#define _MGC_PORT_INFO_H
#include "mgc_struct.h"
void mgc_port_info_setup(void);
void mgc_port_info_init(PORT_INFO *pPortInfo , int id);
void mgc_port_info_clear(PORT_INFO *pPortInfo);
PORT_INFO *mgc_port_info_get_unused_port(void);
void mgc_port_info_fsm(PORT_INFO *pPortInfo);
void mgc_port_info_oper_failure_report(PORT_INFO *pPortInfo , MGC_SAP *pMgcSap);
void mgc_port_info_oper_success_report(PORT_INFO *pPortInfo , MGC_SAP *pMgcSap);
PORT_INFO *mgc_port_info_find_port_by_id(int id);
PORT_INFO *mgc_port_info_get_step_port(MGCF_OPER_STEP *pOperStep);
BOOL mgc_port_info_add_opera_to_port(PORT_INFO *pPortInfo , CONNECT_INFO *pConnect , MGCF_STEP_INFO *pStepInfo);
BOOL mgc_port_info_add_ind_to_port(PORT_INFO *pPortInfo , CONNECT_INFO *pConnect , MGC_CMD_TYPE cmd , int hdlPort , DWORD remoteIp);
int mgc_port_info_cnf(PORT_INFO *pPortInfo , BYTE cmd, WORD hdlPort, WORD retCode, MGCP_PARA *pPara);
MGCF_OPER_STEP *mgc_port_info_get_unused_oper_step(PORT_INFO *pPortInfo);
void mgc_port_info_set_step_to_start(PORT_INFO *pPortInfo);
BOOL mgc_port_info_set_step_to_next(PORT_INFO *pPortInfo);
void mgc_port_info_set_oper_id(PORT_INFO *pPortInfo , MGC_MG_OPER_ID_TYPE operId);
void mgc_port_info_set_fsm_time(PORT_INFO *pPortInfo , WORD timer);
BOOL mgc_port_info_set_oper_step(MGCF_OPER_STEP *pMgcfOperStep , CONNECT_INFO *pConnect , MGCF_STEP_INFO *pStepInfo);
BOOL mgc_port_info_oper_step_cnf(MGCF_OPER_STEP *pMgcOperStep , MGCP_PARA *pPara);
void mgc_port_info_set_step_info(MGCF_STEP_INFO *pStepInfo , MGC_CMD_TYPE cmd , CONNECT_INFO *pPeerConn ,
WORD delay, MGC_CON_MODE mode, PKG_EVENT *pPkgEvent, PKG_SIGNAL *pPkgSig , PKG_REQ *pPkgReq);
BYTE *mgc_port_info_get_res_addr(void);
char *mgc_port_info_print_cmd(MGC_CMD_TYPE cmd);
char *mgc_port_info_print_opera_id(MGC_MG_OPER_ID_TYPE operaId);
BOOL mgc_port_info_insert_dlcx_req(PORT_INFO *pPortInfo , CONNECT_INFO *pConnect);
BOOL mgc_port_info_mv_step_into_new_port(PORT_INFO *pPortInfo , MGCF_OPER_STEP *pOperStep);
#endif

View File

@@ -0,0 +1,10 @@
#ifndef _MGC_PORT_LIST_H
#define _MGC_PORT_LIST_H
#include "mgc_struct.h"
void mgc_port_active_list_proc(void);
BOOL mgc_port_list_remove_from_active_list(PORT_INFO *pPortInfo);
MGC_PORT_NODE *mgc_port_list_add_to_active_list(PORT_INFO *pPortInfo);
void mgc_port_list_setup(void);
#endif

View File

@@ -0,0 +1,8 @@
#ifndef _MGC_PUB__H
#define _MGC_PUB__H
#include "../../../public/src/include/includes.h"
#include "../../../public/src/include/public.h"
#endif

View File

@@ -0,0 +1,17 @@
#ifndef _MGC_SNMP_H
#define _MGC_SNMP_H
const BYTE MGC_AC_LINE_STATUS_IDLEN = 12;
DWORD MGC_AC_LINE_STATUS_OID[20] =
{
1,3,6,1,2,1,10,18,6,1,10,0
};
const BYTE MGC_LGC_MG_STATUS_IDLEN = 13;
DWORD MGC_LGC_MG_STATUS_OID[20] =
{
1,3,6,1,4,1,1373,2,2,30,2,1,0
};
#endif

View File

@@ -0,0 +1,196 @@
#ifndef _MGC_STRUCT_H
#define _MGC_STRUCT_H
#include "mgc.h"
#include "../../../mgcp/src/include/mgcp.h"
#include "../../../8ecp/src/include/8ecp.h"
#define MGC_PORT_LIST_EN
#define MGC_REC_PORT
typedef struct _MGCP_REC_TAG
{
PUB_SDP_MEDIA m;
PUB_SDP_C c;
MGCP_M mode;
char esCci[32];
}MGCP_REC_TAG;
typedef struct _CONNECT_INFO
{
int id;
DWORD flag;
struct _MGCF_OPER_STEP *pOperStep;
#ifdef MGC_REC_PORT
struct _PORT_INFO *pPrePortInfo;
#endif
struct _CHNL_INFO *pChnlInfo;
MGC_CONNECT_STATUS status;
MGC_CODEC_LIST codecList;
MEDIA_ATTR mediaAttr;
OPER_REC operRec;
MGCP_REC_TAG mgcpRec;
struct _MGC_TANDEM_INFO *pTandem;
}CONNECT_INFO;
typedef struct _CHNL_INFO
{
int id;
BOOL monFlag; // monitor flag
MGC_CHNL_INFO_STATUS status;
struct _PHY_PORT_INFO *pPhyPort; //chnl's owner
WORD connectNum; //how many connection is attached
WORD maxConnectNum; //max connection num could be attached to the chnl accroding to chnl's owner
struct _CONNECT_INFO *pConnection[MGC_MAX_NUM_OF_CHNL_CON]; //Media Index
}CHNL_INFO;
typedef struct _PHY_PORT_INFO
{
int id;
int portNo; // mg local physical port No. ??
MGC_SAP *pMgcSap; // sap index, indicating which user creates this port
BOOL monFlag;
MGC_PHY_PORT_STATUS status; // physical port status: online/offline
MGC_PHY_PORT_TYPE portType; // port type: E1/T1/analogue
struct _MG_INFO *pMgInfo; // mg No. this port resides on ??
WORD chnlNum; // depend on mg type
struct _CHNL_INFO *pChnlInfo[MGC_MAX_CHNL_NUM_PER_PHY];
}PHY_PORT_INFO;
typedef struct _MG_INFO
{
int id; //internal used
BOOL created; // created flag;
BOOL enable; // MG status: available/unavailable
BOOL monFlag;
MG_ATTR mgAttr; // MG attributes
PHY_PORT_INFO *pPhyPort[MGC_MAX_PHY_PORT_PER_MG];
DWORD requestId; // SNMP request id
DWORD auditTimer;
}MG_INFO;
typedef struct _MGCF_STEP_INFO
{
struct _CONNECT_INFO *pPeerConn;
int delay;
MGC_CON_MODE mode;
MGC_CMD_TYPE cmd;
MGC_CODEC_LIST codecList;
PKG_SIGNAL pkgSig;
BOOL sigEn;
PKG_EVENT pkgEvent;
BOOL eventEn;
PKG_REQ pkgReq;
BOOL reqEn;
DWORD remoteIp; //only used for MG
}MGCF_STEP_INFO;
typedef struct _MGCF_OPER_STEP
{
int id;
struct _CONNECT_INFO *pConnect; //chnl connectIndex
struct _PORT_INFO *pPortInfo;
MGCF_STEP_INFO stepInfo;
MGCP_OPER_STEP_STATUS status;
WORD hdlPort; // lower layer port
WORD llCmd; // lower layer command or response
}MGCF_OPER_STEP;
typedef struct _PORT_INFO{
int id;
BOOL assigned;
WORD usrPort;
WORD mgcfTimer; // mgcf timer
MGC_MG_OPER_ID_TYPE mgcfOperId;
WORD cause; //reason to tell uplayer
struct _MGCF_OPER_STEP *pMgcOperCurrent;
struct _MGCF_OPER_STEP mgcfOperSteps[MGC_MAX_OPER_STEPS_NUM]; // max 8 steps
}
PORT_INFO;
typedef struct _MGC_8ECP_SAP
{
struct _8ECP_SAP sap8ecp;
int sapIndex;
}MGC_8ECP_SAP;
typedef struct _MGC_MGCP_SAP
{
struct _MGCP_SAP sapMgcp;
int sapIndex;
}MGC_MGCP_SAP;
typedef struct _MGC_CTL
{
WORD sysId;
WORD localIp;
WORD peerIp; //???
WORD mgcMaxMgNo;
WORD mgcMaxChlNo;
WORD mgcMgCreated;
WORD mgcChlAssigned;
}MGC_CTL;
typedef struct _MGC_INTERNAL_SAP
{
MGC_SAP mgcSap;
int mgcSapIndex;
int mgNoITL;
}MGC_INTERNAL_SAP;
typedef struct _MGC_SUR_INFO_NODE
{
int id;
struct _CONNECT_INFO *pConn;
struct _MGC_SUR_INFO_NODE *pPrior;
struct _MGC_SUR_INFO_NODE *pNext;
}MGC_SUR_INFO_NODE;
typedef struct _MGC_SUR_INFO_LIST
{
struct _MGC_SUR_INFO_NODE *pHead;
WORD len;
}MGC_SUR_INFO_LIST;
typedef struct _MGC_TANDEM_INFO
{
int id;
char escci[32];
struct _MGC_SUR_INFO_LIST list;
MGC_TANDEM_STATUS status;
CONNECT_INFO *pTconn; //pointer to target
CONNECT_INFO *pTxconn; //pointer to where target conn to send
CONNECT_INFO *pRxconn; //pointer to where targe conn to recieve from
CONNECT_INFO *pAconn; // pointer to associator
}MGC_TANDEM_INFO;
typedef struct _MGC_PORT_LIST
{
struct _MGC_PORT_NODE *pHead;
WORD len;
}MGC_PORT_LIST;
typedef struct _MGC_PORT_NODE
{
int id;
struct _PORT_INFO *pPortInfo;
struct _MGC_PORT_NODE *pPrior;
struct _MGC_PORT_NODE *pNext;
struct _MGC_PORT_LIST *pList;
}MGC_PORT_NODE;
#endif

View File

@@ -0,0 +1,19 @@
#ifndef _MGC_SUR_INFO_H
#define _MGC_SUR_INFO_H
#include "mgc_struct.h"
void mgc_sur_info_list_init(MGC_SUR_INFO_LIST *pList);
BOOL mgc_sur_info_add_conn_to_list(MGC_SUR_INFO_LIST *pList , CONNECT_INFO *pConn);
BOOL mgc_sur_info_remove_conn_to_list(MGC_SUR_INFO_LIST *pList , CONNECT_INFO *pConn);
MGC_SUR_INFO_NODE *mgc_sur_info_find_conn_in_list(MGC_SUR_INFO_LIST *pList , CONNECT_INFO *pConn);
MGC_SUR_INFO_NODE *mgc_sur_info_get_list_tail(MGC_SUR_INFO_LIST *pList);
MGC_SUR_INFO_NODE *mgc_sur_info_get_list_node(MGC_SUR_INFO_LIST *pList , WORD index);
BOOL mgc_sur_info_add_survillance_res(BYTE sapIndex, WORD mgNo);
void mgc_sur_info_setup(void);
void mgc_sur_info_clear_list(MGC_SUR_INFO_LIST *pList);
CONNECT_INFO *mgc_sur_info_find_sur_conn_in_mg(MG_INFO *pMgInfo);
#endif

View File

@@ -0,0 +1,37 @@
#ifndef _MGC_TANDEM_INFO_H
#define _MGC_TANDEM_INFO_H
#include "mgc_struct.h"
typedef enum
{
MGC_TANDEM_CONN_POS_UNDEF = -1,
MGC_TANDEM_CONN_POS_TAR,
MGC_TANDEM_CONN_POS_TX,
MGC_TANDEM_CONN_POS_RX,
MGC_TANDEM_CONN_POS_AOR,
MGC_TANDEM_CONN_POS_SUR
}MGC_TANDEM_CONN_POS;
BOOL mgc_tandem_info_unset_conn(MGC_TANDEM_INFO *pTandem , CONNECT_INFO *pConnect);
BOOL mgc_tandem_info_set_conn(MGC_TANDEM_INFO *pTandem , CONNECT_INFO *pConn, MGC_TANDEM_CONN_POS pos);
MGC_TANDEM_CONN_POS mgc_tandem_info_get_conn_pos(MGC_TANDEM_INFO *pTandem , CONNECT_INFO *pConn);
MGC_TANDEM_INFO *mgc_tandem_info_get_tandem_by_id(DWORD id);
MGC_TANDEM_INFO *mgc_tandem_info_get_idle_tandem(void);
void mgc_tandem_info_setup(void);
BOOL mgc_tandem_info_add_tandem_res(BYTE sapIndex, WORD mgNo);
BOOL mgc_tandem_info_set_esccd_info(MGC_TANDEM_INFO *pTandem , MGCP_ESCCD rxEsccd , MGCP_ESCCD txEsccd);
BOOL mgc_tandem_info_create_tar_tandem(CONNECT_INFO *pConnect, PORT_INFO *pPortInfo);
BOOL mgc_tandem_info_create_tandem(MGC_TANDEM_INFO *pTandem , PORT_INFO *pPortInfo);
BOOL mgc_tandem_info_stop_tandem_send_to_tar(CONNECT_INFO *pConnect, PORT_INFO *pPortInfo);
BOOL mgc_tandem_info_stop_tandem_send_to_aor(CONNECT_INFO *pConnect, PORT_INFO *pPortInfo);
MGC_TANDEM_STATUS mgc_tandem_info_get_status(MGC_TANDEM_INFO *pTandem);
BOOL mgc_tandem_info_dettach_aor_related_tandem(CONNECT_INFO *pConnect, CONNECT_INFO *pPeerConnect, PORT_INFO *pPortInfo);
BOOL mgc_tandem_info_connect(CONNECT_INFO *pConnect, CONNECT_INFO *pPeerConnect, MGC_CON_MODE mode , PORT_INFO *pPortInfo);
BOOL mgc_tandem_info_remove_connection_from_tandem(CONNECT_INFO *pConnect, PORT_INFO *pPortInfo);
BOOL mgc_tandem_info_mdcx(CONNECT_INFO *pConnect , PORT_INFO *pPortInfo);
BOOL mgc_tandem_info_add_crcx_aas(CONNECT_INFO *pAasConnect, CONNECT_INFO *pPeerConnect, PORT_INFO *pPortInfo);
BOOL mgc_tandem_info_add_mdcx_aas(CONNECT_INFO *pConnect, CONNECT_INFO *pAasConnect, PORT_INFO *pPortInfo);
BOOL mgc_tandem_info_clear(MGC_TANDEM_INFO *pTandem, PORT_INFO *pPortInfo);
#endif