Merge branch 'nsg-4.3' of ssh://git.sangoma.com/smg_freeswitch into nsg-4.3

This commit is contained in:
kapil 2012-06-06 14:46:30 +05:30
commit acfbbc9e73
5 changed files with 1154 additions and 94 deletions

View File

@ -119,6 +119,14 @@ static ftdm_status_t cli_ss7_show_all_channels_of_span(ftdm_stream_handle_t *str
static ftdm_status_t cli_ss7_show_span_by_id(ftdm_stream_handle_t *stream, char *span_id); static ftdm_status_t cli_ss7_show_span_by_id(ftdm_stream_handle_t *stream, char *span_id);
static ftdm_status_t cli_ss7_show_all_spans_general(ftdm_stream_handle_t *stream); static ftdm_status_t cli_ss7_show_all_spans_general(ftdm_stream_handle_t *stream);
static ftdm_status_t cli_ss7_show_all_spans_detail(ftdm_stream_handle_t *stream); static ftdm_status_t cli_ss7_show_all_spans_detail(ftdm_stream_handle_t *stream);
static ftdm_status_t handle_show_sctp_profiles(ftdm_stream_handle_t *stream);
static ftdm_status_t handle_show_sctp_profile(ftdm_stream_handle_t *stream, char* sctp_profile_name);
static ftdm_status_t handle_show_m2ua_profiles(ftdm_stream_handle_t *stream);
static ftdm_status_t handle_show_m2ua_profile(ftdm_stream_handle_t *stream, char* m2ua_profile_name);
static ftdm_status_t handle_show_m2ua_peer_status(ftdm_stream_handle_t *stream, char* m2ua_profile_name);
static ftdm_status_t handle_show_nif_profiles(ftdm_stream_handle_t *stream);
static ftdm_status_t handle_show_nif_profile(ftdm_stream_handle_t *stream, char* profile_name);
int get_assoc_resp_buf(char* buf,SbMgmt* cfm);
/******************************************************************************/ /******************************************************************************/
/* FUNCTIONS ******************************************************************/ /* FUNCTIONS ******************************************************************/
@ -383,6 +391,58 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha
} else if (!strcasecmp(argv[c], "procid")) { } else if (!strcasecmp(argv[c], "procid")) {
/**********************************************************************/ /**********************************************************************/
handle_show_procId(stream); handle_show_procId(stream);
/**********************************************************************/
} else if (!strcasecmp(argv[c], "m2ua")) {
/**********************************************************************/
switch(argc)
{
case 2: /* show m2ua */
{
handle_show_m2ua_profiles(stream);
break;
}
case 3: /* show m2ua <profile-name> */
{
c++;
handle_show_m2ua_profile(stream, argv[c]);
break;
}
case 4:
{
char* profile_name = argv[++c];
c++;
if(!strcasecmp(argv[c],"peerstatus")){
handle_show_m2ua_peer_status(stream, profile_name);
}
else{
stream->write_function(stream, "Unknown \"show m2ua \" command..\n");
goto handle_cli_error_argc;
}
break;
}
default:
goto handle_cli_error_argc;
}
/**********************************************************************/
} else if (!strcasecmp(argv[c], "nif")) {
/**********************************************************************/
if (check_arg_count(argc, 3)){
handle_show_nif_profiles(stream);
}else{
c++;
handle_show_nif_profile(stream, argv[c]);
}
/**********************************************************************/
} else if (!strcasecmp(argv[c], "sctp")) {
/**********************************************************************/
if (check_arg_count(argc, 3)){
handle_show_sctp_profiles(stream);
}else{
c++;
handle_show_sctp_profile(stream, argv[c]);
}
/**********************************************************************/ /**********************************************************************/
} else { } else {
/**********************************************************************/ /**********************************************************************/
@ -751,6 +811,28 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha
/**********************************************************************/ /**********************************************************************/
} }
/**************************************************************************/ /**************************************************************************/
} else if (!strcasecmp(argv[c], "m2ua")) {
/**************************************************************************/
if (check_arg_count(argc, 3)) {
stream->write_function(stream, "Invalid \"m2ua option\", please use \"m2ua logging [enable|disable] \n");
goto handle_cli_error_argc;
}
c++;
if(!strcasecmp(argv[c],"logging")){
c++;
if(!strcasecmp(argv[c],"enable")){
ftmod_ss7_enable_m2ua_sg_logging();
}else if(!strcasecmp(argv[c],"disable")){
ftmod_ss7_disable_m2ua_sg_logging();
} else{
stream->write_function(stream, "Unknown \"m2ua logging %s option\", supported values enable/disable\n",argv[c]);
goto handle_cli_error_argc;
}
}else{
stream->write_function(stream, "Unknown \"m2ua %s option\", supported values \"logging\"\n",argv[c]);
goto handle_cli_error_argc;
}
/**************************************************************************/
} else { } else {
/**************************************************************************/ /**************************************************************************/
goto handle_cli_error; goto handle_cli_error;
@ -831,6 +913,20 @@ static ftdm_status_t handle_print_usage(ftdm_stream_handle_t *stream)
stream->write_function(stream, "ftdm ss7 show relay\n"); stream->write_function(stream, "ftdm ss7 show relay\n");
stream->write_function(stream, "\n"); stream->write_function(stream, "\n");
stream->write_function(stream, "ftmod_sangoma_ss7 M2UA :\n");
stream->write_function(stream, "ftdm ss7 show sctp \n");
stream->write_function(stream, "ftdm ss7 show sctp <sctp_interface_name>\n");
stream->write_function(stream, "ftdm ss7 show m2ua \n");
stream->write_function(stream, "ftdm ss7 show m2ua <m2ua_interface_name>\n");
stream->write_function(stream, "ftdm ss7 show m2ua <m2ua_interface_name> peerstatus\n");
stream->write_function(stream, "ftdm ss7 show nif \n");
stream->write_function(stream, "ftdm ss7 show nif <nif_interface_name>\n");
stream->write_function(stream, "\n");
stream->write_function(stream, "ftmod_sangoma_ss7 M2UA logging:\n");
stream->write_function(stream, "ftdm ss7 m2ua logging [enable|disable] \n");
stream->write_function(stream, "\n"); stream->write_function(stream, "\n");
return FTDM_SUCCESS; return FTDM_SUCCESS;
@ -2717,6 +2813,7 @@ static ftdm_status_t cli_ss7_show_general(ftdm_stream_handle_t *stream)
stream->write_function(stream, "MTP2 status: \n"); stream->write_function(stream, "MTP2 status: \n");
cli_ss7_show_all_mtp2link(stream); cli_ss7_show_all_mtp2link(stream);
if(SNG_SS7_OPR_MODE_M2UA_SG != g_ftdm_operating_mode){
stream->write_function(stream, "\nMTP3 status: \n"); stream->write_function(stream, "\nMTP3 status: \n");
cli_ss7_show_all_mtp3link(stream); cli_ss7_show_all_mtp3link(stream);
@ -2731,6 +2828,7 @@ static ftdm_status_t cli_ss7_show_general(ftdm_stream_handle_t *stream)
stream->write_function(stream, "\nRelay status: \n"); stream->write_function(stream, "\nRelay status: \n");
cli_ss7_show_all_relay(stream); cli_ss7_show_all_relay(stream);
}
return FTDM_SUCCESS; return FTDM_SUCCESS;
} }
@ -2947,6 +3045,707 @@ static ftdm_status_t cli_ss7_show_all_spans_general(ftdm_stream_handle_t *stream
return FTDM_FAIL; return FTDM_FAIL;
} }
/******************************************************************************
* Fun: handle_show_m2ua_profiles()
* Desc: display all m2ua profile information
* Ret: FTDM_SUCCESS | FTDM_FAIL
* Note:
* author: Kapil Gupta
*******************************************************************************/
static ftdm_status_t handle_show_m2ua_profiles(ftdm_stream_handle_t *stream)
{
char* xmlhdr = (char*)"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
char buf[2048];
int x = 0x00;
int idx = 0x00;
int len = 0x00;
MwMgmt cfm;
memset((U8 *)&cfm, 0, sizeof(MwMgmt));
memset(&buf[0], 0, sizeof(buf));
len = len + sprintf(buf + len, "%s\n", xmlhdr);
len = len + sprintf(buf + len, "<m2ua_profiles>\n");
if(ftmod_m2ua_ssta_req(STMWGEN, 0x00, &cfm)) {
stream->write_function(stream," Request to Trillium M2UA layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<m2ua_gen>\n");
len = len + sprintf(buf + len, "<mem_size> %d </mem_size>\n",cfm.t.ssta.s.genSta.memSize);
len = len + sprintf(buf + len, " <allocated_mem_size> %d </allocated_mem_size>\n",cfm.t.ssta.s.genSta.memAlloc);
len = len + sprintf(buf + len, " <num_of_cluster> %d </num_of_cluster>\n",cfm.t.ssta.s.genSta.nmbClusters);
len = len + sprintf(buf + len, " <num_of_peers> %d </num_of_peers>\n",cfm.t.ssta.s.genSta.nmbPeers);
len = len + sprintf(buf + len, " <num_of_interfaces> %d </num_of_interfaces>\n",cfm.t.ssta.s.genSta.nmbIntf);
len = len + sprintf(buf + len, "</m2ua_gen>\n");
}
/*iterate through all the m2ua links and prints all information */
x = 1;
while(x<MW_MAX_NUM_OF_INTF){
if((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].flags & SNGSS7_CONFIGURED))) {
len = len + sprintf(buf + len, "<m2ua_profile>\n");
if(ftmod_m2ua_ssta_req(STMWDLSAP,x,&cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<m2ua_dlsap>\n");
len = len + sprintf(buf + len," <state> %s </state>\n", PRNT_M2UA_SAP_STATE(cfm.t.ssta.s.dlSapSta.state));
len = len + sprintf(buf + len," <link_state> %s </link_state>\n", PRNT_M2UA_LINK_STATE(cfm.t.ssta.s.dlSapSta.lnkState));
len = len + sprintf(buf + len," <rpo_enable> %d </rpo_enable>\n", cfm.t.ssta.s.dlSapSta.rpoEnable);
len = len + sprintf(buf + len," <lpo_enable> %d </lpo_enable>\n", cfm.t.ssta.s.dlSapSta.lpoEnable);
len = len + sprintf(buf + len," <congestion_level> %d </congestion_level>\n", cfm.t.ssta.s.dlSapSta.congLevel);
len = len + sprintf(buf + len, "</m2ua_dlsap>\n");
}
if(ftmod_m2ua_ssta_req(STMWCLUSTER,x,&cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<m2ua_cluster>\n");
len = len + sprintf(buf + len," <state> %s </state>\n", PRNT_M2UA_CLUSTER_STATE(cfm.t.ssta.s.clusterSta.state));
len = len + sprintf(buf + len, " <num_of_peers> %d </num_of_peers>\n",cfm.t.ssta.s.clusterSta.nmbPeer);
len = len + sprintf(buf + len, "<m2ua_cluster_peer>\n");
for(idx = 0; idx < cfm.t.ssta.s.clusterSta.nmbPeer; idx++)
{
len = len + sprintf(buf + len, " <peer_id> %d </peer_id>\n", cfm.t.ssta.s.clusterSta.peerSt[idx].peerId);
len = len + sprintf(buf + len, " <peer_state> %s </peer_state>\n", PRNT_M2UA_PEER_STATE(cfm.t.ssta.s.clusterSta.peerSt[idx].peerState));
}
len = len + sprintf(buf + len, "</m2ua_cluster_peer>\n");
len = len + sprintf(buf + len, "<num_active_peer> %d </num_active_peer>\n",cfm.t.ssta.s.clusterSta.nmbActPeer);
len = len + sprintf(buf + len, "</m2ua_cluster>\n");
}
if(ftmod_m2ua_ssta_req(STMWPEER,x,&cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<m2ua_peer>\n");
len = len + sprintf(buf + len," <state> %s </state>\n", PRNT_M2UA_PEER_STATE(cfm.t.ssta.s.peerSta.state));
len = len + sprintf(buf + len, " <retry_count> %d </retry_count>\n",cfm.t.ssta.s.peerSta.retryCount);
len = len + sprintf(buf + len, " <assoc_id> %d </assoc_id>\n",cfm.t.ssta.s.peerSta.assocSta.spAssocId);
len = len + sprintf(buf + len, " <connected_status> %s </connected_status>\n",(cfm.t.ssta.s.peerSta.assocSta.connected)?"CONNECTED":"NOT CONNECTED");
len = len + sprintf(buf + len, " <flow_cntrl_progress> %d </flow_cntrl_progress>\n",cfm.t.ssta.s.peerSta.assocSta.flcInProg);
len = len + sprintf(buf + len, " <flow_cntrl_level> %d </flow_cntrl_level>\n",cfm.t.ssta.s.peerSta.assocSta.flcLevel);
len = len + sprintf(buf + len, " <hearbeat_status> %d </hearbeat_status>\n",cfm.t.ssta.s.peerSta.assocSta.sctpHBeatEnb);
len = len + sprintf(buf + len, " <nmb_of_stream> %d </nmb_of_stream>\n",cfm.t.ssta.s.peerSta.assocSta.locOutStrms);
len = len + sprintf(buf + len, "</m2ua_peer>\n");
}
if(ftmod_m2ua_ssta_req(STMWSCTSAP,x,&cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<m2ua_sctp_sap>\n");
len = len + sprintf(buf + len," <state> %s </state>\n", PRNT_M2UA_SAP_STATE(cfm.t.ssta.s.sctSapSta.state));
len = len + sprintf(buf + len," <end_point_open_state> %s </end_point_open_state>\n", (cfm.t.ssta.s.sctSapSta.endpOpen)?"END_POINT_OPENED_SUCCESSFULLY":"END_POINT_NOT_OPEN");
len = len + sprintf(buf + len," <end_point_id> %d </end_point_id>\n", cfm.t.ssta.s.sctSapSta.spEndpId);
len = len + sprintf(buf + len," <nmb_of_retry_attemp> %d </nmb_of_retry_attemp>\n", cfm.t.ssta.s.sctSapSta.nmbPrimRetry);
len = len + sprintf(buf + len, "</m2ua_sctp_sap>\n");
}
len = len + sprintf(buf + len, "</m2ua_profile>\n");
}
x++;
}
len = len + sprintf(buf + len, "</m2ua_profiles>\n");
stream->write_function(stream,"\n%s\n",buf);
return FTDM_FAIL;
}
/******************************************************************************
* Fun: handle_show_m2ua_profile()
* Desc: display requested m2ua profile information
* Ret: FTDM_SUCCESS | FTDM_FAIL
* Note:
* author: Kapil Gupta
*******************************************************************************/
static ftdm_status_t handle_show_m2ua_profile(ftdm_stream_handle_t *stream, char* m2ua_profile_name)
{
char* xmlhdr = (char*)"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
char buf[2048];
int x = 0x00;
int idx = 0x00;
int found = 0x00;
int len = 0x00;
MwMgmt cfm;
memset((U8 *)&cfm, 0, sizeof(MwMgmt));
memset(&buf[0], 0, sizeof(buf));
len = len + sprintf(buf + len, "%s\n", xmlhdr);
/*iterate through all the m2ua links and get required profile */
x = 1;
while(x<MW_MAX_NUM_OF_INTF){
if((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].flags & SNGSS7_CONFIGURED))) {
if(!strcasecmp(m2ua_profile_name, g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].name)){
found = 0x01;
break;
}
}
x++;
}
if(!found){
stream->write_function(stream,"Requested M2UA profile[%s] not configured\n", m2ua_profile_name);
return FTDM_FAIL;
}
len = len + sprintf(buf + len, "<m2ua_profile>\n");
if(ftmod_m2ua_ssta_req(STMWDLSAP,x,&cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<m2ua_dlsap>\n");
len = len + sprintf(buf + len," <state> %s </state>\n", PRNT_M2UA_SAP_STATE(cfm.t.ssta.s.dlSapSta.state));
len = len + sprintf(buf + len," <link_state> %s </link_state>\n", PRNT_M2UA_LINK_STATE(cfm.t.ssta.s.dlSapSta.lnkState));
len = len + sprintf(buf + len," <rpo_enable> %d </rpo_enable>\n", cfm.t.ssta.s.dlSapSta.rpoEnable);
len = len + sprintf(buf + len," <lpo_enable> %d </lpo_enable>\n", cfm.t.ssta.s.dlSapSta.lpoEnable);
len = len + sprintf(buf + len," <congestion_level> %d </congestion_level>\n", cfm.t.ssta.s.dlSapSta.congLevel);
len = len + sprintf(buf + len, "</m2ua_dlsap>\n");
}
if(ftmod_m2ua_ssta_req(STMWCLUSTER,x,&cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<m2ua_cluster>\n");
len = len + sprintf(buf + len," <state> %s </state>\n", PRNT_M2UA_CLUSTER_STATE(cfm.t.ssta.s.clusterSta.state));
len = len + sprintf(buf + len, " <num_of_peers> %d </num_of_peers>\n",cfm.t.ssta.s.clusterSta.nmbPeer);
len = len + sprintf(buf + len, "<m2ua_cluster_peer>\n");
for(idx = 0; idx < cfm.t.ssta.s.clusterSta.nmbPeer; idx++)
{
len = len + sprintf(buf + len, " <peer_id> %d </peer_id>\n", cfm.t.ssta.s.clusterSta.peerSt[idx].peerId);
len = len + sprintf(buf + len, " <peer_state> %s </peer_state>\n", PRNT_M2UA_PEER_STATE(cfm.t.ssta.s.clusterSta.peerSt[idx].peerState));
}
len = len + sprintf(buf + len, "</m2ua_cluster_peer>\n");
len = len + sprintf(buf + len, "<num_active_peer> %d </num_active_peer>\n",cfm.t.ssta.s.clusterSta.nmbActPeer);
len = len + sprintf(buf + len, "</m2ua_cluster>\n");
}
if(ftmod_m2ua_ssta_req(STMWPEER,x,&cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<m2ua_peer>\n");
len = len + sprintf(buf + len," <state> %s </state>\n", PRNT_M2UA_PEER_STATE(cfm.t.ssta.s.peerSta.state));
len = len + sprintf(buf + len, " <retry_count> %d </retry_count>\n",cfm.t.ssta.s.peerSta.retryCount);
len = len + sprintf(buf + len, " <assoc_id> %d </assoc_id>\n",cfm.t.ssta.s.peerSta.assocSta.spAssocId);
len = len + sprintf(buf + len, " <connected_status> %s </connected_status>\n",(cfm.t.ssta.s.peerSta.assocSta.connected)?"CONNECTED":"NOT CONNECTED");
len = len + sprintf(buf + len, " <flow_cntrl_progress> %d </flow_cntrl_progress>\n",cfm.t.ssta.s.peerSta.assocSta.flcInProg);
len = len + sprintf(buf + len, " <flow_cntrl_level> %d </flow_cntrl_level>\n",cfm.t.ssta.s.peerSta.assocSta.flcLevel);
len = len + sprintf(buf + len, " <hearbeat_status> %d </hearbeat_status>\n",cfm.t.ssta.s.peerSta.assocSta.sctpHBeatEnb);
len = len + sprintf(buf + len, " <nmb_of_stream> %d </nmb_of_stream>\n",cfm.t.ssta.s.peerSta.assocSta.locOutStrms);
len = len + sprintf(buf + len, "</m2ua_peer>\n");
}
if(ftmod_m2ua_ssta_req(STMWSCTSAP,x,&cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<m2ua_sctp_sap>\n");
len = len + sprintf(buf + len," <state> %s </state>\n", PRNT_M2UA_SAP_STATE(cfm.t.ssta.s.sctSapSta.state));
len = len + sprintf(buf + len," <end_point_open_state> %s </end_point_open_state>\n", (cfm.t.ssta.s.sctSapSta.endpOpen)?"END_POINT_OPENED_SUCCESSFULLY":"END_POINT_NOT_OPEN");
len = len + sprintf(buf + len," <end_point_id> %d </end_point_id>\n", cfm.t.ssta.s.sctSapSta.spEndpId);
len = len + sprintf(buf + len," <nmb_of_retry_attemp> %d </nmb_of_retry_attemp>\n", cfm.t.ssta.s.sctSapSta.nmbPrimRetry);
len = len + sprintf(buf + len, "</m2ua_sctp_sap>\n");
}
len = len + sprintf(buf + len, "</m2ua_profile>\n");
stream->write_function(stream,"\n%s\n",buf);
return FTDM_FAIL;
}
/******************************************************************************
* Fun: handle_show_sctp_profiles()
* Desc: display all sctp profile information
* Ret: FTDM_SUCCESS | FTDM_FAIL
* Note:
* author: Kapil Gupta
*******************************************************************************/
static ftdm_status_t handle_show_sctp_profiles(ftdm_stream_handle_t *stream)
{
char* xmlhdr = (char*)"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
char buf[2048];
int x = 0x00;
int len = 0x00;
SbMgmt cfm;
memset((U8 *)&cfm, 0, sizeof(SbMgmt));
memset(&buf[0], 0, sizeof(buf));
len = len + sprintf(buf + len, "%s\n", xmlhdr);
len = len + sprintf(buf + len, "<sctp_profiles>\n");
if(ftmod_sctp_ssta_req(STSBGEN, 0x00, &cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<sctp_gen>\n");
len = len + sprintf(buf + len, "<mem_size> %d </mem_size>\n",cfm.t.ssta.s.genSta.memSize);
len = len + sprintf(buf + len, " <allocated_mem_size> %d </allocated_mem_size>\n",cfm.t.ssta.s.genSta.memAlloc);
len = len + sprintf(buf + len, " <num_of_open_assoc> %d </num_of_open_assoc>\n",cfm.t.ssta.s.genSta.nmbAssoc);
len = len + sprintf(buf + len, " <num_of_open_end_points> %d </num_of_open_end_points>\n",cfm.t.ssta.s.genSta.nmbEndp);
len = len + sprintf(buf + len, " <num_of_lcl_addr_in_use> %d </num_of_lcl_addr_in_use>\n",cfm.t.ssta.s.genSta.nmbLocalAddr);
len = len + sprintf(buf + len, " <num_of_rmt_addr_in_use> %d </num_of_rmt_addr_in_use>\n",cfm.t.ssta.s.genSta.nmbPeerAddr);
len = len + sprintf(buf + len, "</sctp_gen>\n");
}
#ifdef LSB12
if(ftmod_sctp_ssta_req(STSBTMR, 0x00, &cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<sctp_timers>\n");
len = len + sprintf(buf + len, "<life_time_timer_val> %d </life_time_timer_val>\n", cfm.t.ssta.s.tmrSta.lifetimeTmr);
len = len + sprintf(buf + len, "<ack_delay_timer_val> %d </ack_delay_timer_val>\n", cfm.t.ssta.s.tmrSta.ackDelayTmr);
len = len + sprintf(buf + len, "<cookie_timer_val> %d </cookie_timer_val>\n", cfm.t.ssta.s.tmrSta.cookieTmr);
len = len + sprintf(buf + len, "<key_timer_val> %d </key_timer_val>\n", cfm.t.ssta.s.tmrSta.keyTmr);
len = len + sprintf(buf + len, "<freeze_timer_val> %d </freeze_timer_val> \n", cfm.t.ssta.s.tmrSta.freezeTmr);
#ifdef LSB4
len = len + sprintf(buf + len, "<bundle_timer_val> %d </bundle_timer_val> \n", cfm.t.ssta.s.tmrSta.bundleTmr);
#endif
len = len + sprintf(buf + len, "<t1_init_timer_val> %d </t1_init_timer_val> \n", cfm.t.ssta.s.tmrSta.t1InitTmr);
len = len + sprintf(buf + len, "<t2_shutdown_timer_val> %d </t2_shutdown_timer_val> \n", cfm.t.ssta.s.tmrSta.t2ShutdownTmr);
len = len + sprintf(buf + len, "<round_trip_timer_val> %d </round_trip_timer_val> \n", cfm.t.ssta.s.tmrSta.hbeat);
len = len + sprintf(buf + len, "<t3_rtx_timer_val> %d </t3_rtx_timer_val> \n", cfm.t.ssta.s.tmrSta.t3rtx);
len = len + sprintf(buf + len, "<bind_retry_timer_val> %d </bind_retry_timer_val> \n", cfm.t.ssta.s.tmrSta.tIntTmr);
}
#endif
/*iterate through all the sctp links and prints all information */
x = 1;
while(x<MAX_SCTP_LINK){
if((g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].flags & SNGSS7_CONFIGURED))) {
len = len + sprintf(buf + len, "<sctp_profile>\n");
if(ftmod_sctp_ssta_req(STSBSCTSAP,x,&cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<sctp_sap>\n");
len = len + sprintf(buf + len," <state> %s </state>\n", PRNT_SCTP_SAP_STATE(cfm.t.ssta.s.sapSta.hlSt));
len = len + sprintf(buf + len," <switch> %s </switch>\n", PRNT_SCTP_PROTO_SWITCH(cfm.t.ssta.s.sapSta.swtch));
len = len + sprintf(buf + len, "</sctp_sap>\n");
}
if(ftmod_sctp_ssta_req(STSBTSAP,x,&cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<sctp_transport_sap>\n");
len = len + sprintf(buf + len," <state> %s </state>\n", PRNT_SCTP_SAP_STATE(cfm.t.ssta.s.sapSta.hlSt));
len = len + sprintf(buf + len," <switch> %s </switch>\n", PRNT_SCTP_PROTO_SWITCH(cfm.t.ssta.s.sapSta.swtch));
len = len + sprintf(buf + len, "</sctp_transport_sap>\n");
}
if(ftmod_sctp_ssta_req(STSBASSOC,x,&cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<sctp_association>\n");
len = len + get_assoc_resp_buf(buf + len, &cfm);
len = len + sprintf(buf + len, "</sctp_association>\n");
}
/* TODO - STSBDTA */
len = len + sprintf(buf + len, "</sctp_profile>\n");
}
x++;
}
len = len + sprintf(buf + len, "</sctp_profiles>\n");
stream->write_function(stream,"\n%s\n",buf);
return FTDM_SUCCESS;
}
int get_assoc_resp_buf(char* buf,SbMgmt* cfm)
{
int len = 0x00;
int idx = 0x00;
char *asciiAddr;
CmInetIpAddr ip;
len = len + sprintf(buf + len, " <assoc_id> %d </assoc_id>\n", cfm->t.ssta.s.assocSta.assocId);
len = len + sprintf(buf + len, " <assoc_status> %s </assoc_status>\n", PRNT_SCTP_ASSOC_STATE(cfm->t.ssta.s.assocSta.assocState));
len = len + sprintf(buf + len, " <assoc_dst_port> %d </assoc_dst_port>\n", cfm->t.ssta.s.assocSta.dstPort);
len = len + sprintf(buf + len, " <assoc_src_port> %d </assoc_src_port>\n", cfm->t.ssta.s.assocSta.srcPort);
len = len + sprintf(buf + len, " <nmb_dst_addr> %d </nmb_dst_addr>\n", cfm->t.ssta.s.assocSta.dstNAddrLst.nmb);
for(idx =0; idx < cfm->t.ssta.s.assocSta.dstNAddrLst.nmb; idx++)
{
len = len + sprintf(buf + len, " <dst_addr_list> \n");
len = len + sprintf(buf + len, " <dst_addr_type> %s </dst_addr_type>\n", PRNT_CM_ADDR_TYPE(cfm->t.ssta.s.assocSta.dstNAddrLst.nAddr[idx].type));
if(cfm->t.ssta.s.assocSta.dstNAddrLst.nAddr[idx].type == CM_IPV4ADDR_TYPE)
{
ip = ntohl(cfm->t.ssta.s.assocSta.dstNAddrLst.nAddr[idx].u.ipv4NetAddr);
cmInetNtoa(ip, &asciiAddr);
len = len + sprintf(buf + len, " <dst_addr> %s </dst_addr>\n",asciiAddr);
}
else
{
len = len + sprintf(buf + len, " <dst_addr> %s </dst_addr> \n", cfm->t.ssta.s.assocSta.dstNAddrLst.nAddr[idx].u.ipv6NetAddr);
}
len = len + sprintf(buf + len, " </dst_addr_list> \n");
}
len = len + sprintf(buf + len, " <nmb_src_addr> %d </nmb_src_addr> \n", cfm->t.ssta.s.assocSta.srcNAddrLst.nmb);
for(idx =0; idx < cfm->t.ssta.s.assocSta.srcNAddrLst.nmb; idx++)
{
len = len + sprintf(buf + len, " <src_addr_list> \n");
len = len + sprintf(buf + len, " <src_addr_type> %s </src_addr_type>\n", PRNT_CM_ADDR_TYPE(cfm->t.ssta.s.assocSta.srcNAddrLst.nAddr[idx].type));
if(cfm->t.ssta.s.assocSta.srcNAddrLst.nAddr[idx].type == CM_IPV4ADDR_TYPE)
{
ip = ntohl(cfm->t.ssta.s.assocSta.srcNAddrLst.nAddr[idx].u.ipv4NetAddr);
cmInetNtoa(ip, &asciiAddr);
len = len + sprintf(buf + len, " <src_addr> %s </src_addr>\n", asciiAddr);
}
else
{
len = len + sprintf(buf + len, " <src_addr> %s </src_addr>\n", cfm->t.ssta.s.assocSta.srcNAddrLst.nAddr[idx].u.ipv6NetAddr);
}
len = len + sprintf(buf + len, " </src_addr_list> \n");
}
len = len + sprintf(buf + len, "\n <primary_addr_type> %s </primary_addr_type>\n", PRNT_CM_ADDR_TYPE(cfm->t.ssta.s.assocSta.priNAddr.type));
if(cfm->t.ssta.s.assocSta.priNAddr.type == CM_IPV4ADDR_TYPE)
{
ip = ntohl(cfm->t.ssta.s.assocSta.priNAddr.u.ipv4NetAddr);
cmInetNtoa(ip, &asciiAddr);
len = len + sprintf(buf + len, " <primary_addr> %s </primary_addr>\n",asciiAddr);
}
else
{
len = len + sprintf(buf + len, " <primary_addr> %s </primary_addr>\n", cfm->t.ssta.s.assocSta.priNAddr.u.ipv6NetAddr);
}
#ifdef LSB11
/* TODO - this flag is not enable as of now.. so later on will convert below prints to XML tags */
len = len + sprintf(buf + len, " The number of unsent datagrams : %d\n", cfm->t.ssta.s.assocSta.nmbUnsentDgms);
len = len + sprintf(buf + len, " The number of unack datagrams : %d\n", cfm->t.ssta.s.assocSta.nmbUnackDgms);
len = len + sprintf(buf + len, " The number of undelivered datagrams : %d\n", cfm->t.ssta.s.assocSta.nmbUndelDgms);
len = len + sprintf(buf + len, " The number of retransmissions count : %d\n", cfm->t.ssta.s.assocSta.rtxCnt);
len = len + sprintf(buf + len, " The receive window size is: %d\n\n", cfm->t.ssta.s.assocSta.SctWinSize);
for(idx =0; idx < LSB_MAX_TMRS ; idx++)
{
len = len + sprintf(buf + len, " %d) Timer state is %d\n", idx, cfm->t.ssta.s.assocSta.tmr[idx].state);
len = len + sprintf(buf + len, " %d) Timer value is %d\n", idx, cfm->t.ssta.s.assocSta.tmr[idx].tmrVal);
len = len + sprintf(buf + len, " %d) No of paths is %d\n", idx, cfm->t.ssta.s.assocSta.tmr[idx].numPaths);
for(idx1 =0; idx1 < cfm->t.ssta.s.assocSta.tmr[idx].numPaths; idx1++)
{
if( cfm->t.ssta.s.assocSta.tmr[idx].path[idx1].localAddr.type == CM_IPV4ADDR_TYPE)
{
len = len + sprintf(buf + len, " %d) the local Addr is %d\n", idx1,
cfm->t.ssta.s.assocSta.tmr[idx].path[idx1].localAddr.u.ipv4NetAddr);
}
else
{
len = len + sprintf(buf + len, " %d) the local Addr is %s\n", idx1,
cfm->t.ssta.s.assocSta.tmr[idx].path[idx1].localAddr.u.ipv6NetAddr);
}
if( cfm->t.ssta.s.assocSta.tmr[idx].path[idx1].peerAddr.type == CM_IPV4ADDR_TYPE)
{
len = len + sprintf(buf + len, " %d) the peer Addr is %d\n", idx1,
cfm->t.ssta.s.assocSta.tmr[idx].path[idx1].peerAddr.u.ipv4NetAddr);
}
else
{
len = len + sprintf(buf + len, " %d) the peer Addr is %s\n", idx1,
cfm->t.ssta.s.assocSta.tmr[idx].path[idx1].peerAddr.u.ipv6NetAddr);
}
} /* Loop for paths */
} /* Loop for timers */
#endif
return len;
}
/******************************************************************************
* Fun: handle_show_sctp_profile()
* Desc: display requested sctp profile information
* Ret: FTDM_SUCCESS | FTDM_FAIL
* Note:
* author: Kapil Gupta
*******************************************************************************/
static ftdm_status_t handle_show_sctp_profile(ftdm_stream_handle_t *stream, char* sctp_profile_name)
{
char* xmlhdr = (char*)"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
char buf[2048];
int x = 0x00;
int len = 0x00;
SbMgmt cfm;
int found = 0x00;
memset((U8 *)&cfm, 0, sizeof(SbMgmt));
memset(&buf[0], 0, sizeof(buf));
len = len + sprintf(buf + len, "%s\n", xmlhdr);
/*iterate through all the sctp links and prints all information */
x = 1;
while(x<MAX_SCTP_LINK){
if((g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].flags & SNGSS7_CONFIGURED))) {
if(!strcasecmp(sctp_profile_name, g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].name)){
found = 0x01;
break;
}
}
x++;
}
if(!found){
stream->write_function(stream,"Requested SCTP profile[%s] not configured\n", sctp_profile_name);
return FTDM_FAIL;
}
len = len + sprintf(buf + len, "<sctp_profile>\n");
if(ftmod_sctp_ssta_req(STSBSCTSAP,x,&cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<sctp_sap>\n");
len = len + sprintf(buf + len," <state> %s </state>\n", PRNT_SCTP_SAP_STATE(cfm.t.ssta.s.sapSta.hlSt));
len = len + sprintf(buf + len," <switch> %s </switch>\n", PRNT_SCTP_PROTO_SWITCH(cfm.t.ssta.s.sapSta.swtch));
len = len + sprintf(buf + len, "</sctp_sap>\n");
}
if(ftmod_sctp_ssta_req(STSBTSAP,x,&cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<sctp_transport_sap>\n");
len = len + sprintf(buf + len," <state> %s </state>\n", PRNT_SCTP_SAP_STATE(cfm.t.ssta.s.sapSta.hlSt));
len = len + sprintf(buf + len," <switch> %s </switch>\n", PRNT_SCTP_PROTO_SWITCH(cfm.t.ssta.s.sapSta.swtch));
len = len + sprintf(buf + len, "</sctp_transport_sap>\n");
}
if(ftmod_sctp_ssta_req(STSBASSOC,x,&cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<sctp_association>\n");
len = len + get_assoc_resp_buf(buf + len, &cfm);
len = len + sprintf(buf + len, "</sctp_association>\n");
}
/* TODO - STSBDTA */
len = len + sprintf(buf + len, "</sctp_profile>\n");
stream->write_function(stream,"\n%s\n",buf);
return FTDM_SUCCESS;
}
/******************************************************************************
* Fun: handle_show_nif_profiles()
* Desc: display all nif profile information
* Ret: FTDM_SUCCESS | FTDM_FAIL
* Note:
* author: Kapil Gupta
*******************************************************************************/
static ftdm_status_t handle_show_nif_profiles(ftdm_stream_handle_t *stream)
{
char* xmlhdr = (char*)"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
char buf[2048];
int x = 0x00;
int len = 0x00;
NwMgmt cfm;
memset((U8 *)&cfm, 0, sizeof(NwMgmt));
memset(&buf[0], 0, sizeof(buf));
len = len + sprintf(buf + len, "%s\n", xmlhdr);
len = len + sprintf(buf + len, "<nif_profiles>\n");
if(ftmod_nif_ssta_req(STNWGEN, 0x00, &cfm)) {
stream->write_function(stream," Request to Trillium NIF layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<nif_gen>\n");
len = len + sprintf(buf + len, "<mem_size> %d </mem_size>\n",cfm.t.ssta.s.genSta.memSize);
len = len + sprintf(buf + len, " <allocated_mem_size> %d </allocated_mem_size>\n",cfm.t.ssta.s.genSta.memAlloc);
len = len + sprintf(buf + len, "</nif_gen>\n");
}
/*iterate through all the NIF links and prints all information */
x = 1;
while(x<MW_MAX_NUM_OF_INTF){
if((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].flags & SNGSS7_CONFIGURED))) {
len = len + sprintf(buf + len, "<nif_profile>\n");
if(ftmod_nif_ssta_req(STNWDLSAP,x,&cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<nif_dlsap>\n");
len = len + sprintf(buf + len," <m2ua_sap_state> %s </m2ua_sap_state>\n", PRNT_NIF_SAP_STATE(cfm.t.ssta.s.dlSapSta.m2uaState));
len = len + sprintf(buf + len," <mtp2_sap_state> %s </mtp2_sap_state>\n", PRNT_NIF_SAP_STATE(cfm.t.ssta.s.dlSapSta.mtp2State));
len = len + sprintf(buf + len," <nmb_of_retry> %d </nmb_of_retry>\n", cfm.t.ssta.s.dlSapSta.nmbRetry);
len = len + sprintf(buf + len, "</nif_dlsap>\n");
}
len = len + sprintf(buf + len, "</nif_profile>\n");
}
x++;
}
len = len + sprintf(buf + len, "</nif_profiles>\n");
stream->write_function(stream,"\n%s\n",buf);
return FTDM_FAIL;
}
/******************************************************************************
* Fun: handle_show_nif_profile()
* Desc: display requested nif profile information
* Ret: FTDM_SUCCESS | FTDM_FAIL
* Note:
* author: Kapil Gupta
*******************************************************************************/
static ftdm_status_t handle_show_nif_profile(ftdm_stream_handle_t *stream, char* nif_profile_name)
{
char* xmlhdr = (char*)"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
char buf[2048];
int x = 0x00;
int found = 0x00;
int len = 0x00;
NwMgmt cfm;
memset((U8 *)&cfm, 0, sizeof(NwMgmt));
memset(&buf[0], 0, sizeof(buf));
len = len + sprintf(buf + len, "%s\n", xmlhdr);
/*iterate through all the m2ua links and get required profile */
x = 1;
while(x<MW_MAX_NUM_OF_INTF){
if((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].flags & SNGSS7_CONFIGURED))) {
if(!strcasecmp(nif_profile_name, g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].name)){
found = 0x01;
break;
}
}
x++;
}
if(!found){
stream->write_function(stream,"Requested NIF profile[%s] not configured\n", nif_profile_name);
return FTDM_FAIL;
}
len = len + sprintf(buf + len, "<nif_profile>\n");
if(ftmod_nif_ssta_req(STNWDLSAP,x,&cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<nif_dlsap>\n");
len = len + sprintf(buf + len," <m2ua_sap_state> %s </m2ua_sap_state>\n", PRNT_NIF_SAP_STATE(cfm.t.ssta.s.dlSapSta.m2uaState));
len = len + sprintf(buf + len," <mtp2_sap_state> %s </mtp2_sap_state>\n", PRNT_NIF_SAP_STATE(cfm.t.ssta.s.dlSapSta.mtp2State));
len = len + sprintf(buf + len," <nmb_of_retry> %d </nmb_of_retry>\n", cfm.t.ssta.s.dlSapSta.nmbRetry);
len = len + sprintf(buf + len, "</nif_dlsap>\n");
}
len = len + sprintf(buf + len, "</nif_profile>\n");
stream->write_function(stream,"\n%s\n",buf);
return FTDM_FAIL;
}
/******************************************************************************/
/******************************************************************************
* Fun: handle_show_m2ua_peer_status()
* Desc: display requested m2ua profile peer information
* Ret: FTDM_SUCCESS | FTDM_FAIL
* Note:
* author: Kapil Gupta
*******************************************************************************/
static ftdm_status_t handle_show_m2ua_peer_status(ftdm_stream_handle_t *stream, char* m2ua_profile_name)
{
char* xmlhdr = (char*)"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
char buf[2048];
int x = 0x00;
int found = 0x00;
int len = 0x00;
MwMgmt cfm;
memset((U8 *)&cfm, 0, sizeof(MwMgmt));
memset(&buf[0], 0, sizeof(buf));
len = len + sprintf(buf + len, "%s\n", xmlhdr);
/*iterate through all the m2ua links and get required profile */
x = 1;
while(x<MW_MAX_NUM_OF_INTF){
if((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].flags & SNGSS7_CONFIGURED))) {
if(!strcasecmp(m2ua_profile_name, g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].name)){
found = 0x01;
break;
}
}
x++;
}
if(!found){
stream->write_function(stream,"Requested M2UA profile[%s] not configured\n", m2ua_profile_name);
return FTDM_FAIL;
}
if(ftmod_m2ua_ssta_req(STMWPEER,x,&cfm)) {
stream->write_function(stream," Request to Trillium M2UA layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<m2ua_peer>\n");
len = len + sprintf(buf + len," <state> %s </state>\n", PRNT_M2UA_PEER_STATE(cfm.t.ssta.s.peerSta.state));
len = len + sprintf(buf + len, " <connected_status> %s </connected_status>\n",(cfm.t.ssta.s.peerSta.assocSta.connected)?"CONNECTED":"NOT CONNECTED");
len = len + sprintf(buf + len, "</m2ua_peer>\n");
}
stream->write_function(stream,"\n%s\n",buf);
return FTDM_FAIL;
}
/******************************************************************************/ /******************************************************************************/
/* For Emacs: /* For Emacs:
* Local Variables: * Local Variables:

View File

@ -60,11 +60,12 @@ static int ftmod_nif_dlsap_config(int idx);
static int ftmod_sctp_tucl_tsap_bind(int idx); static int ftmod_sctp_tucl_tsap_bind(int idx);
static int ftmod_m2ua_sctp_sctsap_bind(int idx); static int ftmod_m2ua_sctp_sctsap_bind(int idx);
static int ftmod_open_endpoint(int idx); static int ftmod_open_endpoint(int idx);
static int ftmod_init_sctp_assoc(int peer_id);
static int ftmod_nif_m2ua_dlsap_bind(int id); 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_debug(int action);
static int ftmod_tucl_enable_debug(void); static int ftmod_tucl_debug(int action);
static int ftmod_sctp_enable_debug(void); static int ftmod_sctp_debug(int action);
static int ftmod_ss7_sctp_shutdown(void); static int ftmod_ss7_sctp_shutdown(void);
static int ftmod_ss7_m2ua_shutdown(void); static int ftmod_ss7_m2ua_shutdown(void);
@ -76,14 +77,19 @@ ftdm_status_t sng_m2ua_cfg(void);
/******************************************************************************/ /******************************************************************************/
void ftmod_ss7_m2ua_free() void ftmod_ss7_m2ua_free()
{ {
if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_M2UA_STARTED)) {
ftmod_ss7_m2ua_shutdown(); ftmod_ss7_m2ua_shutdown();
ftmod_ss7_sctp_shutdown();
ftmod_ss7_tucl_shutdown();
sng_isup_free_m2ua(); sng_isup_free_m2ua();
}
if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SCTP_STARTED)) {
ftmod_ss7_sctp_shutdown();
sng_isup_free_sctp(); sng_isup_free_sctp();
}
if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_TUCL_STARTED)) {
ftmod_ss7_tucl_shutdown();
sng_isup_free_tucl(); sng_isup_free_tucl();
} }
}
/******************************************************************************/ /******************************************************************************/
static int ftmod_ss7_tucl_shutdown() static int ftmod_ss7_tucl_shutdown()
{ {
@ -186,6 +192,12 @@ ftdm_status_t ftmod_ss7_m2ua_cfg(void)
return FTDM_FAIL; return FTDM_FAIL;
} }
/* SET STARTED FLAGS */
sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_NIF_STARTED);
sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_M2UA_STARTED);
sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SCTP_STARTED);
sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_TUCL_STARTED);
return FTDM_SUCCESS; return FTDM_SUCCESS;
} }
@ -266,8 +278,10 @@ ftdm_status_t sng_m2ua_cfg(void)
} }
/****************************************************************************************************/ /****************************************************************************************************/
/* M2UA SCTP SAP configurations */ /* M2UA SCTP SAP configurations */
for (x=1; g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].id !=0; x++) { x = 1;
if (!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].flags & SNGSS7_CONFIGURED)) { while(x<MW_MAX_NUM_OF_INTF){
if((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].flags & SNGSS7_CONFIGURED))) {
if(ftmod_m2ua_sctsap_config(x)) { if(ftmod_m2ua_sctsap_config(x)) {
ftdm_log (FTDM_LOG_ERROR ,"M2UA SCTSAP[%d] configuration: NOT OK\n", x); ftdm_log (FTDM_LOG_ERROR ,"M2UA SCTSAP[%d] configuration: NOT OK\n", x);
@ -306,6 +320,7 @@ ftdm_status_t sng_m2ua_cfg(void)
ftdm_log (FTDM_LOG_INFO ,"M2UA DLSAP[%d] configuration: OK\n", x); ftdm_log (FTDM_LOG_INFO ,"M2UA DLSAP[%d] configuration: OK\n", x);
} }
} /* END - SNGSS7_CONFIGURED */ } /* END - SNGSS7_CONFIGURED */
x++;
}/* END - M2UA Interfaces for loop*/ }/* END - M2UA Interfaces for loop*/
/****************************************************************************************************/ /****************************************************************************************************/
/* NIF */ /* NIF */
@ -319,8 +334,10 @@ ftdm_status_t sng_m2ua_cfg(void)
/****************************************************************************************************/ /****************************************************************************************************/
/* NIF DLSAP */ /* NIF DLSAP */
for (x=1; g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].id !=0; x++) { x = 1;
if (!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].flags & SNGSS7_CONFIGURED)) { while(x<MW_MAX_NUM_OF_INTF){
if ((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].flags & SNGSS7_CONFIGURED))) {
if(ftmod_nif_dlsap_config(x)) { if(ftmod_nif_dlsap_config(x)) {
ftdm_log (FTDM_LOG_ERROR ,"NIF DLSAP[%d] configuration: NOT OK\n", x); ftdm_log (FTDM_LOG_ERROR ,"NIF DLSAP[%d] configuration: NOT OK\n", x);
return FTDM_FAIL; return FTDM_FAIL;
@ -328,6 +345,7 @@ ftdm_status_t sng_m2ua_cfg(void)
ftdm_log (FTDM_LOG_INFO ,"NIF DLSAP[%d] configuration: OK\n", x); ftdm_log (FTDM_LOG_INFO ,"NIF DLSAP[%d] configuration: OK\n", x);
} }
} }
x++;
} }
/****************************************************************************************************/ /****************************************************************************************************/
@ -1134,19 +1152,32 @@ uint32_t iptoul(const char *ip)
return (uint32_t)val; return (uint32_t)val;
} }
/***********************************************************************************************************************/ /***********************************************************************************************************************/
void ftmod_ss7_enable_m2ua_sg_logging(void){
/* Enable DEBUGs*/
ftmod_sctp_debug(AENA);
ftmod_m2ua_debug(AENA);
ftmod_tucl_debug(AENA);
}
/***********************************************************************************************************************/
void ftmod_ss7_disable_m2ua_sg_logging(void){
/* DISABLE DEBUGs*/
ftmod_sctp_debug(ADISIMM);
ftmod_m2ua_debug(ADISIMM);
ftmod_tucl_debug(ADISIMM);
}
/***********************************************************************************************************************/
int ftmod_ss7_m2ua_start(void){ int ftmod_ss7_m2ua_start(void){
int x=0; int x=0;
/***********************************************************************************************************************/ /***********************************************************************************************************************/
/* Enable DEBUGs*/ x = 1;
ftmod_sctp_enable_debug(); while(x<MAX_SCTP_LINK){
ftmod_m2ua_enable_debug(); if((g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].id !=0) &&
ftmod_tucl_enable_debug(); (!(g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].flags & SNGSS7_CONFIGURED))) {
/***********************************************************************************************************************/
for (x=1; g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].id !=0; x++) {
if (!(g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].flags & SNGSS7_CONFIGURED)) {
/* Send a control request to bind the TSAP between SCTP and TUCL */ /* Send a control request to bind the TSAP between SCTP and TUCL */
if(ftmod_sctp_tucl_tsap_bind(x)) { if(ftmod_sctp_tucl_tsap_bind(x)) {
@ -1156,12 +1187,15 @@ int ftmod_ss7_m2ua_start(void){
ftdm_log (FTDM_LOG_INFO ,"\nControl request to bind TSAP[%d] of SCTP and TUCL: OK\n", x); ftdm_log (FTDM_LOG_INFO ,"\nControl request to bind TSAP[%d] of SCTP and TUCL: OK\n", x);
} }
} }
x++;
} }
/***********************************************************************************************************************/ /***********************************************************************************************************************/
/* Send a control request to bind the SCTSAP between SCTP and M2UA */ /* Send a control request to bind the SCTSAP between SCTP and M2UA */
for (x=1; g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].id !=0; x++) { x = 1;
if (!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].flags & SNGSS7_CONFIGURED)) { while(x<MW_MAX_NUM_OF_INTF){
if((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].flags & SNGSS7_CONFIGURED))) {
if(ftmod_m2ua_sctp_sctsap_bind(x)) { if(ftmod_m2ua_sctp_sctsap_bind(x)) {
ftdm_log (FTDM_LOG_ERROR ,"Control request to bind SCTSAP[%d] of M2UA and SCTP : NOT OK\n", x); ftdm_log (FTDM_LOG_ERROR ,"Control request to bind SCTSAP[%d] of M2UA and SCTP : NOT OK\n", x);
return 1; return 1;
@ -1169,11 +1203,14 @@ int ftmod_ss7_m2ua_start(void){
ftdm_log (FTDM_LOG_INFO ,"Control request to bind SCTSAP[%d] of M2UA and SCTP: OK\n", x); ftdm_log (FTDM_LOG_INFO ,"Control request to bind SCTSAP[%d] of M2UA and SCTP: OK\n", x);
} }
} }
}/* END - M2UA Interfaces for loop*/ x++;
}/* END - M2UA Interfaces while loop*/
/***********************************************************************************************************************/ /***********************************************************************************************************************/
for (x=1; g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].id !=0; x++) { x = 1;
if (!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].flags & SNGSS7_CONFIGURED)) { while(x<MW_MAX_NUM_OF_INTF){
if ((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].flags & SNGSS7_CONFIGURED))) {
/* Send a control request to bind the DLSAP between NIF, M2UA and MTP-2 */ /* Send a control request to bind the DLSAP between NIF, M2UA and MTP-2 */
if(ftmod_nif_m2ua_dlsap_bind(x)) { if(ftmod_nif_m2ua_dlsap_bind(x)) {
ftdm_log (FTDM_LOG_ERROR ,"Control request to bind DLSAP[%d] between NIF and M2UA: NOT OK\n", x); ftdm_log (FTDM_LOG_ERROR ,"Control request to bind DLSAP[%d] between NIF and M2UA: NOT OK\n", x);
@ -1188,12 +1225,15 @@ int ftmod_ss7_m2ua_start(void){
ftdm_log (FTDM_LOG_INFO ,"Control request to bind DLSAP[%d] between NIF and MTP2 : OK\n", x); ftdm_log (FTDM_LOG_INFO ,"Control request to bind DLSAP[%d] between NIF and MTP2 : OK\n", x);
} }
} }
x++;
}/* END - NIF Interfaces for loop*/ }/* END - NIF Interfaces for loop*/
/***********************************************************************************************************************/ /***********************************************************************************************************************/
for (x=1; g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].id !=0; x++) { x = 1;
if (!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].flags & SNGSS7_CONFIGURED)) { while(x<MW_MAX_NUM_OF_INTF){
if ((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].flags & SNGSS7_CONFIGURED))) {
/* Send a control request to open endpoint */ /* Send a control request to open endpoint */
if(ftmod_open_endpoint(x)) { if(ftmod_open_endpoint(x)) {
ftdm_log (FTDM_LOG_ERROR ,"ftmod_open_endpoint FAIL \n"); ftdm_log (FTDM_LOG_ERROR ,"ftmod_open_endpoint FAIL \n");
@ -1202,8 +1242,30 @@ int ftmod_ss7_m2ua_start(void){
ftdm_log (FTDM_LOG_INFO ,"ftmod_open_endpoint SUCCESS \n"); ftdm_log (FTDM_LOG_INFO ,"ftmod_open_endpoint SUCCESS \n");
} }
} }
x++;
} }
/***********************************************************************************************************************/
sleep(2);
x = 1;
while (x < (MW_MAX_NUM_OF_PEER)) {
if ((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[x].flags & SNGSS7_CONFIGURED)) &&
(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[x].init_sctp_assoc)) {
if(ftmod_init_sctp_assoc(x)) {
ftdm_log (FTDM_LOG_ERROR ,"ftmod_init_sctp_assoc FAIL for peerId[%d] \n", x);
return 1;
}else {
ftdm_log (FTDM_LOG_INFO ,"ftmod_init_sctp_assoc SUCCESS for peerId[%d] \n", x);
}
}
x++;
}
return 0; return 0;
} }
/***********************************************************************************************************************/ /***********************************************************************************************************************/
@ -1239,7 +1301,42 @@ static int ftmod_open_endpoint(int id)
cntrl.t.cntrl.s.suId = m2ua->id; /* M2UA sct sap Id */ cntrl.t.cntrl.s.suId = m2ua->id; /* M2UA sct sap Id */
return (sng_cntrl_m2ua (&pst, &cntrl)); return (sng_cntrl_m2ua (&pst, &cntrl));
}
/***********************************************************************************************************************/
static int ftmod_init_sctp_assoc(int peer_id)
{
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 = STMWPEER; /* General */
cntrl.hdr.transId = 1; /* transaction identifier */
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 = AMWESTABLISH;
/*cntrl.t.cntrl.s.suId = 1;*/
cntrl.t.cntrl.s.peerId = (MwPeerId) peer_id;
return (sng_cntrl_m2ua (&pst, &cntrl));
} }
/***********************************************************************************************************************/ /***********************************************************************************************************************/
@ -1380,7 +1477,7 @@ static int ftmod_nif_mtp2_dlsap_bind(int id)
} }
/***********************************************************************************************************************/ /***********************************************************************************************************************/
static int ftmod_sctp_enable_debug() static int ftmod_sctp_debug(int action)
{ {
Pst pst; Pst pst;
SbMgmt cntrl; SbMgmt cntrl;
@ -1404,7 +1501,7 @@ static int ftmod_sctp_enable_debug()
cntrl.hdr.response.mem.region = S_REG; cntrl.hdr.response.mem.region = S_REG;
cntrl.hdr.response.mem.pool = S_POOL; cntrl.hdr.response.mem.pool = S_POOL;
cntrl.t.cntrl.action = AENA; cntrl.t.cntrl.action = action;
cntrl.t.cntrl.subAction = SADBG; cntrl.t.cntrl.subAction = SADBG;
cntrl.t.cntrl.dbgMask = 0xFFFF; cntrl.t.cntrl.dbgMask = 0xFFFF;
@ -1412,7 +1509,7 @@ static int ftmod_sctp_enable_debug()
} }
/***********************************************************************************************************************/ /***********************************************************************************************************************/
static int ftmod_m2ua_enable_debug() static int ftmod_m2ua_debug(int action)
{ {
Pst pst; Pst pst;
MwMgmt cntrl; MwMgmt cntrl;
@ -1436,14 +1533,14 @@ static int ftmod_m2ua_enable_debug()
cntrl.hdr.response.mem.region = S_REG; cntrl.hdr.response.mem.region = S_REG;
cntrl.hdr.response.mem.pool = S_POOL; cntrl.hdr.response.mem.pool = S_POOL;
cntrl.t.cntrl.action = AENA; cntrl.t.cntrl.action = action;
cntrl.t.cntrl.subAction = SADBG; cntrl.t.cntrl.subAction = SADBG;
cntrl.t.cntrl.s.dbgMask = 0xFFFF; cntrl.t.cntrl.s.dbgMask = 0xFFFF;
return (sng_cntrl_m2ua (&pst, &cntrl)); return (sng_cntrl_m2ua (&pst, &cntrl));
} }
/***********************************************************************************************************************/ /***********************************************************************************************************************/
static int ftmod_tucl_enable_debug() static int ftmod_tucl_debug(int action)
{ {
Pst pst; Pst pst;
HiMngmt cntrl; HiMngmt cntrl;
@ -1467,10 +1564,135 @@ static int ftmod_tucl_enable_debug()
cntrl.hdr.response.mem.region = S_REG; cntrl.hdr.response.mem.region = S_REG;
cntrl.hdr.response.mem.pool = S_POOL; cntrl.hdr.response.mem.pool = S_POOL;
cntrl.t.cntrl.action = AENA; cntrl.t.cntrl.action = action;
cntrl.t.cntrl.subAction = SADBG; cntrl.t.cntrl.subAction = SADBG;
cntrl.t.cntrl.ctlType.hiDbg.dbgMask = 0xFFFF; cntrl.t.cntrl.ctlType.hiDbg.dbgMask = 0xFFFF;
return (sng_cntrl_tucl (&pst, &cntrl)); return (sng_cntrl_tucl (&pst, &cntrl));
} }
/***********************************************************************************************************************/ /***********************************************************************************************************************/
/***********************************************************************************************************************/
int ftmod_sctp_ssta_req(int elemt, int id, SbMgmt* cfm)
{
SbMgmt ssta;
Pst pst;
sng_sctp_link_t *k = &g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[id];
memset((U8 *)&pst, 0, sizeof(Pst));
memset((U8 *)&ssta, 0, sizeof(SbMgmt));
smPstInit(&pst);
pst.dstEnt = ENTSB;
/* prepare header */
ssta.hdr.msgType = TSSTA; /* message type */
ssta.hdr.entId.ent = ENTSB; /* entity */
ssta.hdr.entId.inst = 0; /* instance */
ssta.hdr.elmId.elmnt = elemt; /* STSBGEN */ /* Others are STSBTSAP, STSBSCTSAP, STSBASSOC, STSBDTA, STSBTMR */
ssta.hdr.transId = 1; /* transaction identifier */
ssta.hdr.response.selector = 0;
ssta.hdr.response.prior = PRIOR0;
ssta.hdr.response.route = RTESPEC;
ssta.hdr.response.mem.region = S_REG;
ssta.hdr.response.mem.pool = S_POOL;
if((ssta.hdr.elmId.elmnt == STSBSCTSAP) || (ssta.hdr.elmId.elmnt == STSBTSAP))
{
ssta.t.ssta.sapId = k->id; /* SapId */
}
if(ssta.hdr.elmId.elmnt == STSBASSOC)
{
/*TODO - how to get assoc Id*/
ssta.t.ssta.s.assocSta.assocId = 0; /* association id */
}
return(sng_sta_sctp(&pst,&ssta,cfm));
}
int ftmod_m2ua_ssta_req(int elemt, int id, MwMgmt* cfm)
{
MwMgmt ssta;
Pst pst;
sng_m2ua_cfg_t* m2ua = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[id];
sng_m2ua_cluster_cfg_t* clust = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[m2ua->clusterId];
sng_m2ua_peer_cfg_t* peer = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[m2ua->peerId];
memset((U8 *)&pst, 0, sizeof(Pst));
memset((U8 *)&ssta, 0, sizeof(MwMgmt));
smPstInit(&pst);
pst.dstEnt = ENTMW;
/* prepare header */
ssta.hdr.msgType = TSSTA; /* message type */
ssta.hdr.entId.ent = ENTMW; /* entity */
ssta.hdr.entId.inst = 0; /* instance */
ssta.hdr.elmId.elmnt = elemt; /*STMWGEN */ /* Others are STMWSCTSAP, STMWCLUSTER, STMWPEER,STMWSID, STMWDLSAP */
ssta.hdr.transId = 1; /* transaction identifier */
ssta.hdr.response.selector = 0;
ssta.hdr.response.prior = PRIOR0;
ssta.hdr.response.route = RTESPEC;
ssta.hdr.response.mem.region = S_REG;
ssta.hdr.response.mem.pool = S_POOL;
switch(ssta.hdr.elmId.elmnt)
{
case STMWSCTSAP:
{
ssta.t.ssta.id.suId = m2ua->id ; /* lower sap Id */
break;
}
case STMWDLSAP:
{
ssta.t.ssta.id.lnkNmb = id ; /* upper sap Id */
break;
}
case STMWPEER:
{
ssta.t.ssta.id.peerId = peer->id ; /* peer Id */
break;
}
case STMWCLUSTER:
{
ssta.t.ssta.id.clusterId = clust->id ; /* cluster Id */
break;
}
default:
break;
}
return(sng_sta_m2ua(&pst,&ssta,cfm));
}
int ftmod_nif_ssta_req(int elemt, int id, NwMgmt* cfm)
{
NwMgmt ssta;
Pst pst;
sng_nif_cfg_t* nif = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[id];
memset((U8 *)&pst, 0, sizeof(Pst));
memset((U8 *)&ssta, 0, sizeof(NwMgmt));
smPstInit(&pst);
pst.dstEnt = ENTNW;
/* prepare header */
ssta.hdr.msgType = TSSTA; /* message type */
ssta.hdr.entId.ent = ENTNW; /* entity */
ssta.hdr.entId.inst = 0; /* instance */
ssta.hdr.elmId.elmnt = elemt;
ssta.hdr.response.selector = 0;
ssta.hdr.response.prior = PRIOR0;
ssta.hdr.response.route = RTESPEC;
ssta.hdr.response.mem.region = S_REG;
ssta.hdr.response.mem.pool = S_POOL;
ssta.t.ssta.suId = nif->id; /* Lower sapId */
return(sng_sta_nif(&pst,&ssta,cfm));
}

View File

@ -75,6 +75,7 @@ typedef struct sng_m2ua_peer_cfg{
uint16_t sctpId; /* idx to sctp profile */ uint16_t sctpId; /* idx to sctp profile */
uint32_t destAddrList[SCT_MAX_NET_ADDRS+1]; /* Destination adddress list */ uint32_t destAddrList[SCT_MAX_NET_ADDRS+1]; /* Destination adddress list */
uint16_t locOutStrms; /*Number of outgoing streams supported by this association*/ uint16_t locOutStrms; /*Number of outgoing streams supported by this association*/
int init_sctp_assoc; /* flag to tell if we need to initiate SCTP association */
}sng_m2ua_peer_cfg_t; }sng_m2ua_peer_cfg_t;
typedef enum{ typedef enum{
@ -103,10 +104,10 @@ typedef struct sng_m2ua_cluster_cfg{
}sng_m2ua_cluster_cfg_t; }sng_m2ua_cluster_cfg_t;
typedef struct sng_m2ua_gbl_cfg{ typedef struct sng_m2ua_gbl_cfg{
sng_nif_cfg_t nif[MW_MAX_NUM_OF_INTF]; sng_nif_cfg_t nif[MW_MAX_NUM_OF_INTF+1];
sng_m2ua_cfg_t m2ua[MW_MAX_NUM_OF_INTF]; sng_m2ua_cfg_t m2ua[MW_MAX_NUM_OF_INTF+1];
sng_m2ua_peer_cfg_t m2ua_peer[MW_MAX_NUM_OF_PEER]; sng_m2ua_peer_cfg_t m2ua_peer[MW_MAX_NUM_OF_PEER+1];
sng_m2ua_cluster_cfg_t m2ua_clus[MW_MAX_NUM_OF_CLUSTER]; sng_m2ua_cluster_cfg_t m2ua_clus[MW_MAX_NUM_OF_CLUSTER+1];
}sng_m2ua_gbl_cfg_t; }sng_m2ua_gbl_cfg_t;
/* m2ua xml parsing APIs */ /* m2ua xml parsing APIs */
@ -122,5 +123,11 @@ void ftmod_ss7_m2ua_free(void);
ftdm_status_t ftmod_ss7_m2ua_cfg(void); ftdm_status_t ftmod_ss7_m2ua_cfg(void);
int ftmod_sctp_ssta_req(int elemt, int id, SbMgmt* cfm);
int ftmod_m2ua_ssta_req(int elemt, int id, MwMgmt* cfm);
int ftmod_nif_ssta_req(int elemt, int id, NwMgmt* cfm);
void ftmod_ss7_enable_m2ua_sg_logging(void);
void ftmod_ss7_disable_m2ua_sg_logging(void);
#endif /*__FTMOD_SNG_SS7_M2UA_H__*/ #endif /*__FTMOD_SNG_SS7_M2UA_H__*/

View File

@ -165,6 +165,8 @@ static int ftmod_ss7_fill_in_nif_interface(sng_nif_cfg_t *nif_iface)
g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[i].m2uaLnkNmb = nif_iface->m2uaLnkNmb; g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[i].m2uaLnkNmb = nif_iface->m2uaLnkNmb;
g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[i].mtp2LnkNmb = nif_iface->mtp2LnkNmb; g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[i].mtp2LnkNmb = nif_iface->mtp2LnkNmb;
sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_NIF_PRESENT);
return 0; return 0;
} }
@ -300,6 +302,7 @@ static int ftmod_ss7_fill_in_m2ua_interface(sng_m2ua_cfg_t *m2ua_iface)
g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[i].sctpId = m2ua_iface->sctpId; g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[i].sctpId = m2ua_iface->sctpId;
g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[i].peerId = m2ua_iface->peerId; g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[i].peerId = m2ua_iface->peerId;
g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[i].clusterId = m2ua_iface->clusterId; g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[i].clusterId = m2ua_iface->clusterId;
sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_M2UA_PRESENT);
return 0; return 0;
} }
@ -413,6 +416,19 @@ static int ftmod_ss7_parse_m2ua_peer_interface(ftdm_conf_node_t *m2ua_peer_inter
SS7_DEBUG("Found an sng_m2ua_peer loc_out_strms = %d\n", sng_m2ua_peer.locOutStrms); SS7_DEBUG("Found an sng_m2ua_peer loc_out_strms = %d\n", sng_m2ua_peer.locOutStrms);
/**********************************************************************/ /**********************************************************************/
} else if (!strcasecmp(parm->var, "init_sctp_assoc")) {
/**********************************************************************/
if(!strcasecmp(parm->val, "TRUE")){
sng_m2ua_peer.init_sctp_assoc = 0x01;
} else if(!strcasecmp(parm->val, "FALSE")){
sng_m2ua_peer.init_sctp_assoc = 0x00;
} else {
SS7_ERROR("Found an invalid init_sctp_assoc Parameter Value[%s]\n", parm->val);
return FTDM_FAIL;
}
SS7_DEBUG("Found an sng_m2ua_peer init_sctp_assoc = %d\n", sng_m2ua_peer.init_sctp_assoc);
/**********************************************************************/
} else { } else {
/**********************************************************************/ /**********************************************************************/
SS7_ERROR("Found an invalid parameter %s!\n", parm->var); SS7_ERROR("Found an invalid parameter %s!\n", parm->var);
@ -447,6 +463,7 @@ static int ftmod_ss7_fill_in_m2ua_peer_interface(sng_m2ua_peer_cfg_t *m2ua_peer_
g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].locOutStrms = m2ua_peer_iface->locOutStrms; g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].locOutStrms = m2ua_peer_iface->locOutStrms;
g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].numDestAddr = m2ua_peer_iface->numDestAddr; g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].numDestAddr = m2ua_peer_iface->numDestAddr;
g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].sctpId = m2ua_peer_iface->sctpId; g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].sctpId = m2ua_peer_iface->sctpId;
g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].init_sctp_assoc = m2ua_peer_iface->init_sctp_assoc;
for (k=0; k<m2ua_peer_iface->numDestAddr; k++) { for (k=0; k<m2ua_peer_iface->numDestAddr; k++) {
g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].destAddrList[k] = m2ua_peer_iface->destAddrList[k]; g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].destAddrList[k] = m2ua_peer_iface->destAddrList[k];
} }
@ -688,6 +705,8 @@ static int ftmod_ss7_parse_sctp_link(ftdm_conf_node_t *node)
g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[t_link.id].srcAddrList[i] = t_link.srcAddrList[i]; g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[t_link.id].srcAddrList[i] = t_link.srcAddrList[i];
} }
sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SCTP_PRESENT);
return FTDM_SUCCESS; return FTDM_SUCCESS;
} }
/******************************************************************************/ /******************************************************************************/

View File

@ -758,6 +758,19 @@ typedef enum {
SNGSS7_CC_PRESENT = (1 << 12), SNGSS7_CC_PRESENT = (1 << 12),
SNGSS7_CC_STARTED = (1 << 13), SNGSS7_CC_STARTED = (1 << 13),
SNGSS7_TUCL_PRESENT = (1 << 14),
SNGSS7_TUCL_STARTED = (1 << 15),
SNGSS7_SCTP_PRESENT = (1 << 16),
SNGSS7_SCTP_STARTED = (1 << 17),
SNGSS7_M2UA_PRESENT = (1 << 18),
SNGSS7_M2UA_STARTED = (1 << 19),
SNGSS7_NIF_PRESENT = (1 << 20),
SNGSS7_NIF_STARTED = (1 << 21),
} sng_task_flag_t; } sng_task_flag_t;
/******************************************************************************/ /******************************************************************************/