mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-11-03 13:33:29 +00:00
bsc: Send a TRAP with the locations on a MSC connection
Send the current position when the MSC connection is established.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
/* (C) 2011 by Daniel Willmann <daniel@totalueberwachung.de>
|
/* (C) 2011 by Daniel Willmann <daniel@totalueberwachung.de>
|
||||||
|
* (C) 2011 by Holger Hans Peter Freyther
|
||||||
* (C) 2011 by On-Waves
|
* (C) 2011 by On-Waves
|
||||||
* All Rights Reserved
|
* All Rights Reserved
|
||||||
*
|
*
|
||||||
@@ -23,6 +24,7 @@
|
|||||||
#include <openbsc/osmo_bsc.h>
|
#include <openbsc/osmo_bsc.h>
|
||||||
#include <openbsc/osmo_bsc_rf.h>
|
#include <openbsc/osmo_bsc_rf.h>
|
||||||
#include <openbsc/osmo_msc_data.h>
|
#include <openbsc/osmo_msc_data.h>
|
||||||
|
#include <openbsc/signal.h>
|
||||||
|
|
||||||
#include <osmocom/core/linuxlist.h>
|
#include <osmocom/core/linuxlist.h>
|
||||||
#include <osmocom/core/talloc.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;
|
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 bsc_ctrl_cmds_install()
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
@@ -325,6 +363,8 @@ int bsc_ctrl_cmds_install()
|
|||||||
rc = ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_rf_lock);
|
rc = ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_rf_lock);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
|
osmo_signal_register_handler(SS_MSC, msc_signal_handler, NULL);
|
||||||
end:
|
end:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user