removign sctp/peer id from <m2ua_interface> config xml block

This commit is contained in:
kapil 2012-06-11 12:43:08 +05:30
parent 8b017f6c01
commit 69bada7025
3 changed files with 43 additions and 33 deletions

View File

@ -51,8 +51,9 @@ static int ftmod_sctp_config(int id);
static ftdm_status_t ftmod_sctp_sap_config(int id);
static ftdm_status_t ftmod_sctp_tsap_config(int id);
static int ftmod_m2ua_gen_config(void);
static int ftmod_m2ua_sctsap_config(int id);
static int ftmod_m2ua_sctsap_config(int m2ua_inf_id, int sctp_id);
static int ftmod_m2ua_peer_config(int id);
static int ftmod_m2ua_peer_config1(int m2ua_inf_id, int peer_id);
static int ftmod_m2ua_cluster_config(int idx);
static int ftmod_m2ua_dlsap_config(int idx);
static int ftmod_nif_gen_config(void);
@ -283,13 +284,6 @@ ftdm_status_t sng_m2ua_cfg(void)
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)) {
ftdm_log (FTDM_LOG_ERROR ,"M2UA SCTSAP[%d] configuration: NOT OK\n", x);
return FTDM_FAIL;
}else {
ftdm_log (FTDM_LOG_INFO ,"M2UA SCTSAP[%d] configuration: OK\n", x);
}
/****************************************************************************************************/
/* M2UA PEER configurations */
@ -780,13 +774,44 @@ static int ftmod_m2ua_gen_config(void)
}
/**********************************************************************************************/
static int ftmod_m2ua_sctsap_config(int id)
static int ftmod_m2ua_peer_config(int id)
{
int x = 0;
int peer_id = 0;
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 = NULL;
/* loop through peer list from cluster to configure SCTSAP */
for(x = 0; x < clust->numOfPeers;x++){
peer_id = clust->peerIdLst[x];
peer = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[peer_id];
if(ftmod_m2ua_sctsap_config(id, peer->sctpId)){
ftdm_log (FTDM_LOG_ERROR, " ftmod_m2ua_sctsap_config: M2UA SCTSAP for M2UA Intf Id[%d] config FAILED \n", id);
return 0x01;
}else{
ftdm_log (FTDM_LOG_ERROR, " ftmod_m2ua_sctsap_config: M2UA SCTSAP for M2UA Intf Id[%d] config SUCCESS \n", id);
}
if(ftmod_m2ua_peer_config1(id, peer_id)){
ftdm_log (FTDM_LOG_ERROR, " ftmod_m2ua_peer_config1: M2UA Peer configuration for M2UA Intf Id[%d] config FAILED \n", id);
return 0x01;
}else{
ftdm_log (FTDM_LOG_ERROR, " ftmod_m2ua_peer_config1: M2UA Peer configuration for M2UA Intf Id[%d] config SUCCESS \n", id);
}
}
return 0x0;;
}
static int ftmod_m2ua_sctsap_config(int m2ua_inf_id, int sctp_id)
{
int i;
Pst pst;
MwMgmt cfg;
sng_m2ua_cfg_t* m2ua = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[id];
sng_sctp_link_t *sctp = &g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[m2ua->sctpId];
sng_sctp_link_t *sctp = &g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[sctp_id];
memset((U8 *)&cfg, 0, sizeof(MwMgmt));
memset((U8 *)&pst, 0, sizeof(Pst));
@ -811,9 +836,9 @@ static int ftmod_m2ua_sctsap_config(int id)
cfg.t.cfg.s.sctSapCfg.reConfig.selector = 0;
/* service user SAP ID */
cfg.t.cfg.s.sctSapCfg.suId = m2ua->id;
cfg.t.cfg.s.sctSapCfg.suId = m2ua_inf_id;
/* service provider ID */
cfg.t.cfg.s.sctSapCfg.spId = m2ua->sctpId;
cfg.t.cfg.s.sctSapCfg.spId = sctp_id;
/* source port number */
cfg.t.cfg.s.sctSapCfg.srcPort = 2904;
/* interface address */
@ -858,13 +883,12 @@ static int ftmod_m2ua_sctsap_config(int id)
/****************************************************************************************************/
/* M2UA - Peer configuration */
static int ftmod_m2ua_peer_config(int id)
static int ftmod_m2ua_peer_config1(int m2ua_inf_id, int peer_id)
{
int i;
Pst pst;
MwMgmt cfg;
sng_m2ua_cfg_t* m2ua = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[id];
sng_m2ua_peer_cfg_t* peer = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[m2ua->peerId];
sng_m2ua_peer_cfg_t* peer = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[peer_id];
sng_sctp_link_t *sctp = &g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[peer->sctpId];
memset((U8 *)&cfg, 0, sizeof(MwMgmt));
@ -1615,9 +1639,10 @@ int ftmod_m2ua_ssta_req(int elemt, int id, MwMgmt* cfm)
{
MwMgmt ssta;
Pst pst;
int peerId = 0x01;
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];
sng_m2ua_peer_cfg_t* peer = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[peerId]; /*TODO - KAPIL - need to add proper peerId*/
memset((U8 *)&pst, 0, sizeof(Pst));
memset((U8 *)&ssta, 0, sizeof(MwMgmt));

View File

@ -60,8 +60,6 @@ typedef struct sng_m2ua_cfg{
uint32_t flags;
uint32_t id; /* ID */
uint8_t nodeType; /*Node Type SG/ASP */
uint16_t sctpId; /* idx to sctp profile */
uint16_t peerId; /* idx to m2ua_peer profile */
uint16_t clusterId; /* idx to m2ua_cluster profile */
}sng_m2ua_cfg_t;

View File

@ -252,17 +252,6 @@ static int ftmod_ss7_parse_m2ua_interface(ftdm_conf_node_t *m2ua_interface)
}
SS7_DEBUG("Found an nif node_type = %d\n", sng_m2ua.nodeType);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "sctp_id")) {
/**********************************************************************/
sng_m2ua.sctpId=atoi(parm->val);
SS7_DEBUG("Found an m2ua sctp_id = %d\n", sng_m2ua.sctpId);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "peerd_id")) {
/**********************************************************************/
sng_m2ua.peerId=atoi(parm->val);
SS7_DEBUG("Found an m2ua peerd_id = %d\n", sng_m2ua.peerId);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "cluster_id")) {
/**********************************************************************/
@ -299,8 +288,6 @@ static int ftmod_ss7_fill_in_m2ua_interface(sng_m2ua_cfg_t *m2ua_iface)
g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[i].id = m2ua_iface->id;
g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[i].nodeType = m2ua_iface->nodeType;
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].clusterId = m2ua_iface->clusterId;
sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_M2UA_PRESENT);