From c852f12748db0dd4eefa29dab30f5907eb2ee17e Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 22 Sep 2016 20:21:10 +0200 Subject: msc: add mgcpgw client (with dummy read cb so far) Store the mgcpgw client data in struct gsm_network. Initialize VTY and bind the client. Change-Id: Ifc4efb1ca44fa34c29bf23b35addb54155296d68 --- openbsc/src/osmo-msc/msc_main.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'openbsc/src/osmo-msc/msc_main.c') diff --git a/openbsc/src/osmo-msc/msc_main.c b/openbsc/src/osmo-msc/msc_main.c index 3ac546adc..6a8297f8d 100644 --- a/openbsc/src/osmo-msc/msc_main.c +++ b/openbsc/src/osmo-msc/msc_main.c @@ -66,6 +66,7 @@ #include #include #include +#include #include #include @@ -95,6 +96,16 @@ void *tall_map_ctx = NULL; void *tall_upq_ctx = NULL; /* end deps from libbsc legacy. */ +static void mgcp_rx_cb(struct msgb *msg, void *priv) +{ + static char strbuf[4096]; + unsigned int l = msg->len < sizeof(strbuf)-1 ? msg->len : sizeof(strbuf)-1; + strncpy(strbuf, (const char*)msg->data, l); + strbuf[l] = '\0'; + DEBUGP(DMGCP, "Rx MGCP msg from MGCP GW: '%s'\n", strbuf); + talloc_free(msg); +} + static struct { const char *database_name; const char *config_file; @@ -247,6 +258,8 @@ struct gsm_network *msc_network_alloc(void *ctx, net->name_long = talloc_strdup(net, "OsmoMSC"); net->name_short = talloc_strdup(net, "OsmoMSC"); + mgcpgw_client_conf_init(&net->mgcpgw.conf); + return net; } @@ -456,6 +469,10 @@ TODO: we probably want some of the _net_ ctrl commands from bsc_base_ctrl_cmds_i /* TODO: is this used for crypto?? Improve randomness, at least we * should try to use the nanoseconds part of the current time. */ + msc_network->mgcpgw.client = mgcpgw_client_init( + msc_network, &msc_network->mgcpgw.conf, + mgcp_rx_cb, NULL); + if (db_init(msc_cmdline_config.database_name)) { printf("DB: Failed to init database: %s\n", msc_cmdline_config.database_name); -- cgit v1.2.3