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>2012-05-02 20:13:36 +0200
commit3e6eb68e44fb61e0013d805412550cb0b5a4b275 (patch)
tree0bc28e74210ed2adc56a3033b6efc77faba316d7
parentcef72c9276d7c4ab59cc750fa84183544c2e440d (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.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c
index b456be0e2..2815a3bf0 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
*
@@ -422,6 +423,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(struct gsm_network *net)
{
int rc;
@@ -438,10 +475,14 @@ int bsc_ctrl_cmds_install(struct gsm_network *net)
rc = osmo_signal_register_handler(SS_MSC, &msc_connection_status_trap_cb, net);
if (rc)
goto end;
+ rc = osmo_signal_register_handler(SS_MSC, msc_signal_handler, NULL);
+ if (rc)
+ goto end;
rc = ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_bts_connection_status);
if (rc)
goto end;
rc = osmo_signal_register_handler(SS_INPUT, &bts_connection_status_trap_cb, net);
+
end:
return rc;
}