aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-02-15 20:01:47 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-02-17 19:34:27 +0100
commit84ec8714b21a766471129282b98a8bcbfef799f0 (patch)
tree685957259921822b00a661bad164e8e5e1e35a3e /src/main.c
parentf7ce2c6417b2cda3b0672d84f1ac9085c6f86f3a (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.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/main.c b/src/main.c
index 93e9ee3..2962d94 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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);