diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-09-30 03:04:28 +0800 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-09-30 03:04:28 +0800 |
commit | 0e4e35fdd6a29d7269a25f11b3ac3ee11c88a297 (patch) | |
tree | e9fc26fbbe4cb74c7893fea2f6c34930bbaadba9 | |
parent | b3e1068992244a35df5a56e064daaaa6d9c986f3 (diff) |
bsc: Be able to configure the LAC/MNC/MCC...
-rw-r--r-- | include/bsc_data.h | 8 | ||||
-rw-r--r-- | src/vty_interface.c | 39 |
2 files changed, 47 insertions, 0 deletions
diff --git a/include/bsc_data.h b/include/bsc_data.h index 7050bbc..e48e5b7 100644 --- a/include/bsc_data.h +++ b/include/bsc_data.h @@ -28,6 +28,8 @@ #include <osmocore/timer.h> #include <osmocore/write_queue.h> +#include <osmocore/protocol/gsm_04_08.h> + #include <osmocom/sccp/sccp.h> @@ -107,6 +109,12 @@ struct bsc_data { int udp_port; char *udp_ip; int once; + + /* LAC of the cell */ + struct gsm48_loc_area_id lai; + uint16_t mcc; + uint16_t mnc; + uint16_t lac; }; /* bsc related functions */ diff --git a/src/vty_interface.c b/src/vty_interface.c index 1782ea1..f1ac86e 100644 --- a/src/vty_interface.c +++ b/src/vty_interface.c @@ -23,6 +23,7 @@ #include <bsc_data.h> #include <osmocore/talloc.h> +#include <osmocore/gsm48.h> #include <osmocom/vty/command.h> #include <osmocom/vty/vty.h> @@ -61,6 +62,9 @@ static int config_write_cell(struct vty *vty) vty_out(vty, "cellmgr%s", VTY_NEWLINE); vty_out(vty, " mtp dpc %d%s", bsc.dpc, VTY_NEWLINE); vty_out(vty, " mtp opc %d%s", bsc.opc, VTY_NEWLINE); + vty_out(vty, " country-code %d%s", bsc.mcc, VTY_NEWLINE); + vty_out(vty, " network-code %d%s", bsc.mnc, VTY_NEWLINE); + vty_out(vty, " location-area-code %d%s", bsc.lac, VTY_NEWLINE); if (bsc.udp_ip) vty_out(vty, " udp dest ip %s%s", bsc.udp_ip, VTY_NEWLINE); vty_out(vty, " udp dest port %d%s", bsc.udp_port, VTY_NEWLINE); @@ -212,6 +216,38 @@ DEFUN(cfg_msc_time, cfg_msc_time_cmd, return CMD_SUCCESS; } +static void update_lai(struct bsc_data *bsc) +{ + gsm48_generate_lai(&bsc->lai, bsc->mcc, bsc->mnc, bsc->lac); +} + +DEFUN(cfg_mnc, cfg_mnc_cmd, + "network-code NR", + "Set the Mobile Network Code\n" "Number\n") +{ + bsc.mnc = atoi(argv[0]); + update_lai(&bsc); + return CMD_SUCCESS; +} + +DEFUN(cfg_mcc, cfg_mcc_cmd, + "country-code NR", + "Set the Mobile Country Code\n" "Number\n") +{ + bsc.mcc = atoi(argv[0]); + update_lai(&bsc); + return CMD_SUCCESS; +} + +DEFUN(cfg_lac, cfg_lac_cmd, + "location-area-code NR", + "Set the Location Area Code\n" "Number\n") +{ + bsc.lac = atoi(argv[0]); + update_lai(&bsc); + return CMD_SUCCESS; +} + void cell_vty_init(void) { cmd_init(1); @@ -234,6 +270,9 @@ void cell_vty_init(void) install_element(CELLMGR_NODE, &cfg_ping_time_cmd); install_element(CELLMGR_NODE, &cfg_pong_time_cmd); install_element(CELLMGR_NODE, &cfg_msc_time_cmd); + install_element(CELLMGR_NODE, &cfg_mcc_cmd); + install_element(CELLMGR_NODE, &cfg_mnc_cmd); + install_element(CELLMGR_NODE, &cfg_lac_cmd); } const char *openbsc_copyright = ""; |