aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-01-09 17:03:27 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-07-31 16:46:33 +0200
commit05de373c3e7900aa550aab8fec54279282d4f283 (patch)
treebe3ba5dcba99853499a02a237ea49984b9058bf7
parent745b76ee4dc387457568f345a3516ee8b9add806 (diff)
nitb: Make it possible to set various BTS parameters through the ctrl interface
-rw-r--r--openbsc/src/libmsc/Makefile.am1
-rw-r--r--openbsc/src/libmsc/ctrl_commands.c40
-rw-r--r--openbsc/src/osmo-nitb/bsc_hack.c7
3 files changed, 48 insertions, 0 deletions
diff --git a/openbsc/src/libmsc/Makefile.am b/openbsc/src/libmsc/Makefile.am
index c36ba926b..c27628a77 100644
--- a/openbsc/src/libmsc/Makefile.am
+++ b/openbsc/src/libmsc/Makefile.am
@@ -16,6 +16,7 @@ libmsc_a_SOURCES = auth.c \
ussd.c \
vty_interface_layer3.c \
transaction.c \
+ ctrl_commands.c \
osmo_msc.c
if BUILD_SMPP
diff --git a/openbsc/src/libmsc/ctrl_commands.c b/openbsc/src/libmsc/ctrl_commands.c
new file mode 100644
index 000000000..d04a95314
--- /dev/null
+++ b/openbsc/src/libmsc/ctrl_commands.c
@@ -0,0 +1,40 @@
+/*
+ * (C) 2013 by Holger Hans Peter Freyther
+ * (C) 2013 by sysmocom s.f.m.c. GmbH
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <openbsc/control_cmd.h>
+#include <openbsc/gsm_data.h>
+
+
+CTRL_CMD_DEFINE_RANGE(bts_mnc, "mnc", struct gsm_bts, network_code, 0, 999);
+CTRL_CMD_DEFINE_RANGE(bts_mcc, "mcc", struct gsm_bts, country_code, 1, 999);
+CTRL_CMD_DEFINE_STRING(bts_short_name, "short-name", struct gsm_bts, name_short);
+CTRL_CMD_DEFINE_STRING(bts_long_name, "long-name", struct gsm_bts, name_long);
+
+int bsc_ctrl_cmds_install(void)
+{
+ int rc = 0;
+ rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_mnc);
+ rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_mcc);
+ rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_short_name);
+ rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_long_name);
+
+ return rc;
+}
diff --git a/openbsc/src/osmo-nitb/bsc_hack.c b/openbsc/src/osmo-nitb/bsc_hack.c
index 172fb8269..063d384e6 100644
--- a/openbsc/src/osmo-nitb/bsc_hack.c
+++ b/openbsc/src/osmo-nitb/bsc_hack.c
@@ -67,6 +67,8 @@ static int use_db_counter = 1;
static struct osmo_timer_list db_sync_timer;
+extern int bsc_ctrl_cmds_install(void);
+
static void create_pcap_file(char *file)
{
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
@@ -290,6 +292,11 @@ int main(int argc, char **argv)
return -1;
}
+ if (bsc_ctrl_cmds_install() != 0) {
+ printf("Failed to initialize the control commands. Exiting.\n");
+ return -1;
+ }
+
/* seed the PRNG */
srand(time(NULL));