diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-01-02 11:23:54 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-01-17 11:21:09 +0100 |
commit | a99b04b700891e39d0a10444224fc77a86945970 (patch) | |
tree | 1eb5b9226ccce3e9051f2f5ebab5f11436b759f5 /src/main_udt.c | |
parent | f9b4a86e8dc16e85c09e37861f6de081167ccd7b (diff) |
mtp: Move the link code into a new file called links.
Diffstat (limited to 'src/main_udt.c')
-rw-r--r-- | src/main_udt.c | 71 |
1 files changed, 2 insertions, 69 deletions
diff --git a/src/main_udt.c b/src/main_udt.c index ef5fce2..07bf587 100644 --- a/src/main_udt.c +++ b/src/main_udt.c @@ -65,17 +65,6 @@ extern void cell_vty_init(void); /* * 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); @@ -198,19 +187,6 @@ static void handle_options(int argc, char **argv) } } -static void start_rest(void *start) -{ - bsc.setup = 1; - - if (msc_init(&bsc, 0) != 0) { - fprintf(stderr, "Failed to init MSC part.\n"); - exit(3); - } - - bsc.link.start(&bsc.link); -} - - int main(int argc, char **argv) { int rc; @@ -269,51 +245,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); |