]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
adding m2ua stack free code while unloading freetdm module
authorkapil <kgupta@sangoma.com>
Wed, 30 May 2012 14:50:58 +0000 (20:20 +0530)
committerkapil <kgupta@sangoma.com>
Wed, 30 May 2012 14:50:58 +0000 (20:20 +0530)
libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c
libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.c
libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.h
libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c

index 5a6cc31907f729076f9d59e5d2e501e0ccead2fd..922200629fe424210080481d65e136093ab74677 100644 (file)
@@ -870,6 +870,11 @@ void handle_sng_m2ua_alarm(Pst *pst, MwMgmt *sta)
        /* To print the event specific information */
        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:
                        {
                                ftdm_log(FTDM_LOG_INFO," M2UA : LMW_EVENT_ESTABLISH_OK Event raised on peerId[%d]\n",sta->t.usta.s.peerId);
index f7836ed629349349bacf3f9601b56c21d0130613..39e9bba65855f3edbc13393443913fc9294aef69 100644 (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_m2ua_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_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)
@@ -1036,6 +1140,7 @@ int ftmod_ss7_m2ua_start(void){
 
 /***********************************************************************************************************************/
        /* Enable DEBUGs*/
+       ftmod_sctp_enable_debug();
        ftmod_m2ua_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()
 {
        Pst pst;
index 9eb727ea02adeac31ae36acbdce38de32b4ea1df..a988b9c8db1e657bad90c413e0d3f2b53774097a 100644 (file)
@@ -118,6 +118,7 @@ int ftmod_ss7_parse_sctp_links(ftdm_conf_node_t *node);
 uint32_t iptoul(const char *ip);
 
 int ftmod_ss7_m2ua_start(void);
+void ftmod_ss7_m2ua_free(void);
 
 ftdm_status_t ftmod_ss7_m2ua_cfg(void);
 
index dbb1c1974c071bc13b3fe1f046b3ae27824ce501..90202d398968b243e37795bce4b379fe6028cf37 100644 (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);
        }
 
+       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)) {
                sng_isup_free_sm();