aboutsummaryrefslogtreecommitdiffstats
path: root/src/main_stp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main_stp.c')
-rw-r--r--src/main_stp.c50
1 files changed, 27 insertions, 23 deletions
diff --git a/src/main_stp.c b/src/main_stp.c
index ba204a7..35ec2ed 100644
--- a/src/main_stp.c
+++ b/src/main_stp.c
@@ -227,6 +227,32 @@ int main(int argc, char **argv)
srand(time(NULL));
+ set = link_set_create(bsc);
+ if (!set) {
+ LOGP(DINP, LOGL_ERROR, "Failed to allocate the link.\n");
+ return -1;
+ }
+
+ app = ss7_application_alloc(bsc);
+ if (!app) {
+ LOGP(DINP, LOGL_ERROR, "Failed to create the SS7 application.\n");
+ return -1;
+ }
+
+ m2ua_set = mtp_link_set_alloc(bsc);
+ m2ua_set->dpc = 92;
+ m2ua_set->opc = 9;
+ m2ua_set->sccp_opc = 9;
+ m2ua_set->isup_opc = 9;
+ m2ua_set->ni = 3;
+ m2ua_set->pcap_fd = bsc->pcap_fd;
+ m2ua_set->name = talloc_strdup(m2ua_set, "M2UA");
+ m2ua_set->supported_ssn[1] = 1;
+ m2ua_set->supported_ssn[7] = 1;
+ m2ua_set->supported_ssn[8] = 1;
+ m2ua_set->supported_ssn[146] = 1;
+ m2ua_set->supported_ssn[254] = 1;
+
cell_vty_init();
if (vty_read_config_file(config, NULL) < 0) {
fprintf(stderr, "Failed to read the VTY config.\n");
@@ -242,12 +268,7 @@ int main(int argc, char **argv)
return -1;
}
- app = ss7_application_alloc(bsc);
- if (!app)
- return -1;
-
- set = link_init(bsc);
- if (!set)
+ if (link_init(bsc, set) != 0)
return -1;
bsc->m2ua_trans = sctp_m2ua_transp_create("0.0.0.0", 2904);
@@ -256,24 +277,7 @@ int main(int argc, char **argv)
return -1;
}
- m2ua_set = mtp_link_set_alloc(bsc);
- m2ua_set->dpc = 92;
- m2ua_set->opc = 9;
- m2ua_set->sccp_opc = 9;
- m2ua_set->isup_opc = 9;
- m2ua_set->ni = 3;
- m2ua_set->pcap_fd = bsc->pcap_fd;
- m2ua_set->name = talloc_strdup(m2ua_set, "M2UA");
- m2ua_set->supported_ssn[1] = 1;
- m2ua_set->supported_ssn[7] = 1;
- m2ua_set->supported_ssn[8] = 1;
- m2ua_set->supported_ssn[146] = 1;
- m2ua_set->supported_ssn[254] = 1;
-
/* setup things */
- set->pass_all_isup = bsc->isup_pass;
- m2ua_set->pass_all_isup = bsc->isup_pass;
-
lnk = mtp_m2ua_link_create(bsc->m2ua_trans, m2ua_set);
ss7_application_setup(app, APP_STP,