diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-02-15 20:01:47 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-02-17 19:34:27 +0100 |
commit | 84ec8714b21a766471129282b98a8bcbfef799f0 (patch) | |
tree | 685957259921822b00a661bad164e8e5e1e35a3e /src/main.c | |
parent | f7ce2c6417b2cda3b0672d84f1ac9085c6f86f3a (diff) |
msc: Move the MSC Connection into a new header file
This is in preparation of splitting the MSC part and the
nat logic for the upcoming config rewriting.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 27 |
1 files changed, 16 insertions, 11 deletions
@@ -20,6 +20,7 @@ */ #include <mtp_data.h> +#include <msc_connection.h> #include <mtp_level3.h> #include <mtp_pcap.h> #include <thread.h> @@ -97,8 +98,11 @@ out: static void sigusr2() { + struct msc_connection *msc; printf("Closing the MSC connection on demand.\n"); - msc_close_connection(&bsc->msc_forward); + + llist_for_each_entry(msc, &bsc->mscs, entry) + msc_close_connection(msc); } static void print_help() @@ -157,13 +161,9 @@ static void handle_options(int argc, char **argv) } } -static void bsc_msc_forward_init(struct bsc_data *bsc, - struct bsc_msc_forward *msc) +static void bsc_msc_forward_init(struct msc_connection *msc) { - INIT_LLIST_HEAD(&msc->sccp_connections); - - msc->bsc_data = bsc; - msc->msc_address = "127.0.0.1"; + msc->ip = talloc_strdup(msc, "127.0.0.1"); msc->ping_time = 20; msc->pong_time = 5; msc->msc_time = 20; @@ -172,9 +172,9 @@ static void bsc_msc_forward_init(struct bsc_data *bsc, int main(int argc, char **argv) { int rc; + struct msc_connection *msc; struct mtp_link_set *set; - thread_init(); log_init(&log_info); @@ -198,7 +198,12 @@ int main(int argc, char **argv) bsc->app = APP_CELLMGR; /* msc data */ - bsc_msc_forward_init(bsc, &bsc->msc_forward); + msc = msc_connection_create(bsc, 1); + if (!msc) { + LOGP(DINP, LOGL_ERROR, "Failed to create the MSC connection.\n"); + return -1; + } + bsc_msc_forward_init(msc); handle_options(argc, argv); @@ -221,8 +226,8 @@ int main(int argc, char **argv) if (!set) return -1; - set->fw = &bsc->msc_forward; - bsc->msc_forward.bsc = set; + set->fw = msc; + msc->target_link = set; while (1) { bsc_select_main(0); |