aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-01-02 11:23:54 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-01-17 11:21:09 +0100
commita99b04b700891e39d0a10444224fc77a86945970 (patch)
tree1eb5b9226ccce3e9051f2f5ebab5f11436b759f5 /src/main.c
parentf9b4a86e8dc16e85c09e37861f6de081167ccd7b (diff)
mtp: Move the link code into a new file called links.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c72
1 files changed, 2 insertions, 70 deletions
diff --git a/src/main.c b/src/main.c
index 74b9243..5546ded 100644
--- a/src/main.c
+++ b/src/main.c
@@ -26,7 +26,6 @@
#include <bss_patch.h>
#include <bssap_sccp.h>
#include <bsc_data.h>
-#include <snmp_mtp.h>
#include <cellmgr_debug.h>
#include <bsc_sccp.h>
@@ -84,17 +83,6 @@ static void mgcp_reset(struct bsc_data *bsc)
/*
* methods called from the MTP Level3 part
*/
-void mtp_link_submit(struct mtp_link *link, struct msgb *msg)
-{
- bsc.link.write(&bsc.link, msg);
-}
-
-void mtp_link_restart(struct mtp_link *link)
-{
- LOGP(DINP, LOGL_ERROR, "Need to restart the SS7 link.\n");
- bsc.link.reset(&bsc.link);
-}
-
void mtp_link_sccp_down(struct mtp_link *link)
{
msc_clear_queue(&bsc);
@@ -646,19 +634,6 @@ static void handle_options(int argc, char **argv)
}
}
-static void start_rest(void *start)
-{
- bsc.setup = 1;
-
- if (msc_init(&bsc, 1) != 0) {
- fprintf(stderr, "Failed to init MSC part.\n");
- exit(3);
- }
-
- bsc.link.start(&bsc.link);
-}
-
-
int main(int argc, char **argv)
{
int rc;
@@ -716,51 +691,8 @@ int main(int argc, char **argv)
if (rc < 0)
return rc;
- bsc.link.the_link = mtp_link_alloc();
- bsc.link.the_link->dpc = bsc.dpc;
- bsc.link.the_link->opc = bsc.opc;
- bsc.link.the_link->sccp_opc = bsc.sccp_opc > -1 ? bsc.sccp_opc : bsc.opc;
- bsc.link.the_link->link = 0;
- bsc.link.the_link->sltm_once = bsc.once;
- bsc.link.the_link->ni = bsc.ni_ni;
- bsc.link.the_link->spare = bsc.ni_spare;
- bsc.link.bsc = &bsc;
-
- if (bsc.udp_ip) {
- LOGP(DINP, LOGL_NOTICE, "Using UDP MTP mode.\n");
-
- /* setup SNMP first, it is blocking */
- bsc.link.udp.session = snmp_mtp_session_create(bsc.udp_ip);
- if (!bsc.link.udp.session)
- return -1;
-
- /* now connect to the transport */
- if (link_udp_init(&bsc.link, bsc.src_port, bsc.udp_ip, bsc.udp_port) != 0)
- return -1;
-
- /*
- * We will ask the MTP link to be taken down for two
- * timeouts of the BSC to make sure we are missing the
- * SLTM and it begins a reset. Then we will take it up
- * again and do the usual business.
- */
- snmp_mtp_deactivate(bsc.link.udp.session);
- bsc.start_timer.cb = start_rest;
- bsc.start_timer.data = &bsc;
- bsc_schedule_timer(&bsc.start_timer, bsc.link.udp.reset_timeout, 0);
- LOGP(DMSC, LOGL_NOTICE, "Making sure SLTM will timeout.\n");
- } else {
- LOGP(DINP, LOGL_NOTICE, "Using NexusWare C7 input.\n");
- if (link_c7_init(&bsc.link) != 0)
- return -1;
-
- /* give time to things to start*/
- bsc.start_timer.cb = start_rest;
- bsc.start_timer.data = &bsc;
- bsc_schedule_timer(&bsc.start_timer, 30, 0);
- LOGP(DMSC, LOGL_NOTICE, "Waiting to continue to startup.\n");
- }
-
+ if (link_init(&bsc) != 0)
+ return -1;
while (1) {
bsc_select_main(0);