adding m2ua stack free code while unloading freetdm module

This commit is contained in:
kapil 2012-05-30 20:20:58 +05:30
parent 69501d091c
commit f1f78a8653
4 changed files with 147 additions and 0 deletions

View File

@ -870,6 +870,11 @@ void handle_sng_m2ua_alarm(Pst *pst, MwMgmt *sta)
/* To print the event specific information */ /* To print the event specific information */
switch(sta->t.usta.alarm.event) switch(sta->t.usta.alarm.event)
{ {
case LMW_EVENT_ENDPOPEN_OK:
{
ftdm_log(FTDM_LOG_INFO," M2UA : LMW_EVENT_ENDPOPEN_OK: \n");
break;
}
case LMW_EVENT_ESTABLISH_OK: case LMW_EVENT_ESTABLISH_OK:
{ {
ftdm_log(FTDM_LOG_INFO," M2UA : LMW_EVENT_ESTABLISH_OK Event raised on peerId[%d]\n",sta->t.usta.s.peerId); ftdm_log(FTDM_LOG_INFO," M2UA : LMW_EVENT_ESTABLISH_OK Event raised on peerId[%d]\n",sta->t.usta.s.peerId);

View File

@ -64,10 +64,114 @@ static int ftmod_nif_m2ua_dlsap_bind(int id);
static int ftmod_nif_mtp2_dlsap_bind(int id); static int ftmod_nif_mtp2_dlsap_bind(int id);
static int ftmod_m2ua_enable_debug(void); static int ftmod_m2ua_enable_debug(void);
static int ftmod_tucl_enable_debug(void); static int ftmod_tucl_enable_debug(void);
static int ftmod_sctp_enable_debug(void);
static int ftmod_ss7_sctp_shutdown(void);
static int ftmod_ss7_m2ua_shutdown(void);
static int ftmod_ss7_tucl_shutdown(void);
ftdm_status_t sng_m2ua_init(void); ftdm_status_t sng_m2ua_init(void);
ftdm_status_t sng_m2ua_cfg(void); ftdm_status_t sng_m2ua_cfg(void);
/******************************************************************************/
void ftmod_ss7_m2ua_free()
{
ftmod_ss7_m2ua_shutdown();
ftmod_ss7_sctp_shutdown();
ftmod_ss7_tucl_shutdown();
sng_isup_free_m2ua();
sng_isup_free_sctp();
sng_isup_free_tucl();
}
/******************************************************************************/
static int ftmod_ss7_tucl_shutdown()
{
Pst pst;
HiMngmt cntrl;
memset((U8 *)&pst, 0, sizeof(Pst));
memset((U8 *)&cntrl, 0, sizeof(HiMngmt));
smPstInit(&pst);
pst.dstEnt = ENTHI;
/* prepare header */
cntrl.hdr.msgType = TCNTRL; /* message type */
cntrl.hdr.entId.ent = ENTHI; /* entity */
cntrl.hdr.entId.inst = 0; /* instance */
cntrl.hdr.elmId.elmnt = STGEN; /* General */
cntrl.hdr.response.selector = 0;
cntrl.hdr.response.prior = PRIOR0;
cntrl.hdr.response.route = RTESPEC;
cntrl.hdr.response.mem.region = S_REG;
cntrl.hdr.response.mem.pool = S_POOL;
cntrl.t.cntrl.action = ASHUTDOWN;
return (sng_cntrl_tucl (&pst, &cntrl));
}
/******************************************************************************/
static int ftmod_ss7_m2ua_shutdown()
{
Pst pst;
MwMgmt cntrl;
memset((U8 *)&pst, 0, sizeof(Pst));
memset((U8 *)&cntrl, 0, sizeof(MwMgmt));
smPstInit(&pst);
pst.dstEnt = ENTMW;
/* prepare header */
cntrl.hdr.msgType = TCNTRL; /* message type */
cntrl.hdr.entId.ent = ENTMW; /* entity */
cntrl.hdr.entId.inst = 0; /* instance */
cntrl.hdr.elmId.elmnt = STMWGEN; /* General */
cntrl.hdr.response.selector = 0;
cntrl.hdr.response.prior = PRIOR0;
cntrl.hdr.response.route = RTESPEC;
cntrl.hdr.response.mem.region = S_REG;
cntrl.hdr.response.mem.pool = S_POOL;
cntrl.t.cntrl.action = ASHUTDOWN;
return (sng_cntrl_m2ua (&pst, &cntrl));
}
/***********************************************************************************************************************/
static int ftmod_ss7_sctp_shutdown()
{
Pst pst;
SbMgmt cntrl;
memset((U8 *)&pst, 0, sizeof(Pst));
memset((U8 *)&cntrl, 0, sizeof(SbMgmt));
smPstInit(&pst);
pst.dstEnt = ENTSB;
/* prepare header */
cntrl.hdr.msgType = TCNTRL; /* message type */
cntrl.hdr.entId.ent = ENTSB; /* entity */
cntrl.hdr.entId.inst = 0; /* instance */
cntrl.hdr.elmId.elmnt = STSBGEN; /* General */
cntrl.hdr.response.selector = 0;
cntrl.hdr.response.prior = PRIOR0;
cntrl.hdr.response.route = RTESPEC;
cntrl.hdr.response.mem.region = S_REG;
cntrl.hdr.response.mem.pool = S_POOL;
cntrl.t.cntrl.action = ASHUTDOWN;
return (sng_cntrl_sctp (&pst, &cntrl));
}
/******************************************************************************/ /******************************************************************************/
ftdm_status_t ftmod_ss7_m2ua_cfg(void) ftdm_status_t ftmod_ss7_m2ua_cfg(void)
@ -1036,6 +1140,7 @@ int ftmod_ss7_m2ua_start(void){
/***********************************************************************************************************************/ /***********************************************************************************************************************/
/* Enable DEBUGs*/ /* Enable DEBUGs*/
ftmod_sctp_enable_debug();
ftmod_m2ua_enable_debug(); ftmod_m2ua_enable_debug();
ftmod_tucl_enable_debug(); ftmod_tucl_enable_debug();
@ -1275,6 +1380,38 @@ static int ftmod_nif_mtp2_dlsap_bind(int id)
} }
/***********************************************************************************************************************/ /***********************************************************************************************************************/
static int ftmod_sctp_enable_debug()
{
Pst pst;
SbMgmt cntrl;
memset((U8 *)&pst, 0, sizeof(Pst));
memset((U8 *)&cntrl, 0, sizeof(SbMgmt));
smPstInit(&pst);
pst.dstEnt = ENTSB;
/* prepare header */
cntrl.hdr.msgType = TCNTRL; /* message type */
cntrl.hdr.entId.ent = ENTSB; /* entity */
cntrl.hdr.entId.inst = 0; /* instance */
cntrl.hdr.elmId.elmnt = STSBGEN; /* General */
cntrl.hdr.response.selector = 0;
cntrl.hdr.response.prior = PRIOR0;
cntrl.hdr.response.route = RTESPEC;
cntrl.hdr.response.mem.region = S_REG;
cntrl.hdr.response.mem.pool = S_POOL;
cntrl.t.cntrl.action = AENA;
cntrl.t.cntrl.subAction = SADBG;
cntrl.t.cntrl.dbgMask = 0xFFFF;
return (sng_cntrl_sctp (&pst, &cntrl));
}
/***********************************************************************************************************************/
static int ftmod_m2ua_enable_debug() static int ftmod_m2ua_enable_debug()
{ {
Pst pst; Pst pst;

View File

@ -118,6 +118,7 @@ int ftmod_ss7_parse_sctp_links(ftdm_conf_node_t *node);
uint32_t iptoul(const char *ip); uint32_t iptoul(const char *ip);
int ftmod_ss7_m2ua_start(void); int ftmod_ss7_m2ua_start(void);
void ftmod_ss7_m2ua_free(void);
ftdm_status_t ftmod_ss7_m2ua_cfg(void); ftdm_status_t ftmod_ss7_m2ua_cfg(void);

View File

@ -2687,6 +2687,10 @@ static FIO_SIG_UNLOAD_FUNCTION(ftdm_sangoma_ss7_unload)
sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY_STARTED); sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY_STARTED);
} }
if(SNG_SS7_OPR_MODE_ISUP != g_ftdm_operating_mode){
ftmod_ss7_m2ua_free();
}
if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SM_STARTED)) { if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SM_STARTED)) {
sng_isup_free_sm(); sng_isup_free_sm();