summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-08-16 20:10:40 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-08-25 23:21:55 +0200
commit158a38221279757b9a84e15db298ec1a630aab30 (patch)
tree558a58842c57fd25e37e7eb7abad5fd485cc1b3b
parent82e533950493c8d97dc38c2937f5799135e23ebb (diff)
bsc: Send a TRAP with the locations on a MSC connection
Send the current position when the MSC connection is established.
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_ctrl.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c
index 30ec782..e7f76be 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c
@@ -1,4 +1,5 @@
/* (C) 2011 by Daniel Willmann <daniel@totalueberwachung.de>
+ * (C) 2011 by Holger Hans Peter Freyther
* (C) 2011 by On-Waves
* All Rights Reserved
*
@@ -23,6 +24,7 @@
#include <openbsc/osmo_bsc.h>
#include <openbsc/osmo_bsc_rf.h>
#include <openbsc/osmo_msc_data.h>
+#include <openbsc/signal.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/talloc.h>
@@ -315,6 +317,42 @@ static int verify_net_rf_lock(struct ctrl_cmd *cmd, const char *value, void *dat
return 0;
}
+static int msc_signal_handler(unsigned int subsys, unsigned int signal,
+ void *handler_data, void *signal_data)
+{
+ struct ctrl_cmd *cmd;
+ struct msc_signal_data *msc;
+ struct gsm_network *net;
+ struct gsm_bts *bts;
+ char *loc_fmt = "net.bts.%i.location";
+
+ if (subsys != SS_MSC)
+ return 0;
+ if (signal != S_MSC_AUTHENTICATED)
+ return 0;
+
+ msc = signal_data;
+ cmd = ctrl_cmd_create(msc->data, CTRL_TYPE_TRAP);
+ if (!cmd) {
+ LOGP(DCTRL, LOGL_ERROR, "Failed to create TRAP for location.\n");
+ return 0;
+ }
+
+ cmd->id = "0";
+
+ net = msc->data->network;
+ llist_for_each_entry(bts, &net->bts_list, list) {
+ cmd->node = bts;
+ cmd->variable = talloc_asprintf(cmd, loc_fmt, bts->nr);
+ get_bts_loc(cmd, NULL);
+ osmo_bsc_send_trap(cmd, msc->data->msc_con);
+ talloc_free(cmd->variable);
+ }
+
+ talloc_free(cmd);
+ return 0;
+}
+
int bsc_ctrl_cmds_install()
{
int rc;
@@ -325,6 +363,8 @@ int bsc_ctrl_cmds_install()
rc = ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_rf_lock);
if (rc)
goto end;
+
+ osmo_signal_register_handler(SS_MSC, msc_signal_handler, NULL);
end:
return rc;
}