aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-09-22 20:21:10 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-03-16 15:32:32 +0100
commitc852f12748db0dd4eefa29dab30f5907eb2ee17e (patch)
tree673bc06dc5dae20efce98ed1e49f50904fa1371a /openbsc
parent5d88beeab2001a18ad6e3f0d47ae1887e2f3ceef (diff)
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
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/gsm_data.h6
-rw-r--r--openbsc/src/libmsc/msc_vty.c4
-rw-r--r--openbsc/src/osmo-msc/Makefile.am1
-rw-r--r--openbsc/src/osmo-msc/msc_main.c17
4 files changed, 28 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index 93e605cef..8b405cc83 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -15,6 +15,7 @@
#include <openbsc/rest_octets.h>
#include <openbsc/common_cs.h>
+#include <openbsc/mgcpgw_client.h>
/** annotations for msgb ownership */
#define __uses
@@ -457,6 +458,11 @@ struct gsm_network {
/* Periodic location update default value */
uint8_t t3212;
+
+ struct {
+ struct mgcpgw_client_conf conf;
+ struct mgcpgw_client *client;
+ } mgcpgw;
};
struct osmo_esme;
diff --git a/openbsc/src/libmsc/msc_vty.c b/openbsc/src/libmsc/msc_vty.c
index 7071a42d5..0eb6efa3e 100644
--- a/openbsc/src/libmsc/msc_vty.c
+++ b/openbsc/src/libmsc/msc_vty.c
@@ -122,6 +122,9 @@ static int config_write_msc(struct vty *vty)
VTY_NEWLINE);
vty_out(vty, " %sassign-tmsi%s",
gsmnet->vlr->cfg.assign_tmsi? "" : "no ", VTY_NEWLINE);
+
+ mgcpgw_client_config_write(vty, " ");
+
return CMD_SUCCESS;
}
@@ -171,4 +174,5 @@ void msc_vty_init(struct gsm_network *msc_network)
install_element(MSC_NODE, &cfg_msc_no_subscr_create_cmd);
install_element(MSC_NODE, &cfg_msc_assign_tmsi_cmd);
install_element(MSC_NODE, &cfg_msc_no_assign_tmsi_cmd);
+ mgcpgw_client_vty_init(MSC_NODE, &msc_network->mgcpgw.conf);
}
diff --git a/openbsc/src/osmo-msc/Makefile.am b/openbsc/src/osmo-msc/Makefile.am
index ac2df6376..d3191424e 100644
--- a/openbsc/src/osmo-msc/Makefile.am
+++ b/openbsc/src/osmo-msc/Makefile.am
@@ -43,6 +43,7 @@ osmo_msc_LDADD = \
$(top_builddir)/src/libcommon-cs/libcommon-cs.a \
$(top_builddir)/src/libtrau/libtrau.a \
$(top_builddir)/src/libcommon/libcommon.a \
+ $(top_builddir)/src/libmgcp/libmgcp.a \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOVTY_LIBS) \
$(LIBOSMOCORE_LIBS) \
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 <openbsc/smpp.h>
#include <osmocom/sigtran/sccp_sap.h>
#include <osmocom/sigtran/sua.h>
+#include <openbsc/mgcpgw_client.h>
#include <openbsc/msc_ifaces.h>
#include <openbsc/iu.h>
@@ -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);