aboutsummaryrefslogtreecommitdiffstats
path: root/src/libbsc/bsc_vty.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libbsc/bsc_vty.c')
-rw-r--r--src/libbsc/bsc_vty.c80
1 files changed, 48 insertions, 32 deletions
diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c
index c0909db5..971cdf70 100644
--- a/src/libbsc/bsc_vty.c
+++ b/src/libbsc/bsc_vty.c
@@ -19,7 +19,6 @@
#include <stdlib.h>
#include <unistd.h>
-#include <sys/types.h>
#include <osmocom/vty/command.h>
#include <osmocom/vty/buffer.h>
@@ -29,17 +28,18 @@
#include <arpa/inet.h>
-#include <osmocore/linuxlist.h>
+#include <osmocom/core/linuxlist.h>
#include <openbsc/gsm_data.h>
#include <openbsc/e1_input.h>
#include <openbsc/abis_nm.h>
#include <openbsc/abis_om2000.h>
-#include <osmocore/utils.h>
-#include <osmocore/gsm_utils.h>
+#include <osmocom/core/utils.h>
+#include <osmocom/gsm/gsm_utils.h>
+#include <osmocom/gsm/abis_nm.h>
#include <openbsc/chan_alloc.h>
#include <openbsc/meas_rep.h>
#include <openbsc/db.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/talloc.h>
#include <openbsc/vty.h>
#include <openbsc/gprs_ns.h>
#include <openbsc/system_information.h>
@@ -133,8 +133,8 @@ static int dummy_config_write(struct vty *v)
static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms)
{
vty_out(vty,"Oper '%s', Admin %u, Avail '%s'%s",
- nm_opstate_name(nms->operational), nms->administrative,
- nm_avail_name(nms->availability), VTY_NEWLINE);
+ abis_nm_opstate_name(nms->operational), nms->administrative,
+ abis_nm_avail_name(nms->availability), VTY_NEWLINE);
}
static void dump_pchan_load_vty(struct vty *vty, char *prefix,
@@ -189,7 +189,7 @@ static void net_dump_vty(struct vty *vty, struct gsm_network *net)
dump_pchan_load_vty(vty, " ", &pl);
/* show rf */
- if (net->msc_data)
+ if (net->msc_data && net->msc_data->rf_ctl)
vty_out(vty, " Last RF Command: %s%s",
net->msc_data->rf_ctl->last_state_command,
VTY_NEWLINE);
@@ -256,10 +256,11 @@ static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
else if (bts->type == GSM_BTS_TYPE_HSL_FEMTO)
vty_out(vty, " Serial Number: %lu%s", bts->hsl.serno, VTY_NEWLINE);
vty_out(vty, " NM State: ");
- net_dump_nmstate(vty, &bts->nm_state);
+ net_dump_nmstate(vty, &bts->mo.nm_state);
vty_out(vty, " Site Mgr NM State: ");
- net_dump_nmstate(vty, &bts->site_mgr.nm_state);
- vty_out(vty, " Paging: FIXME pending requests, %u free slots%s",
+ net_dump_nmstate(vty, &bts->site_mgr.mo.nm_state);
+ vty_out(vty, " Paging: %u pending requests, %u free slots%s",
+ paging_pending_requests_nr(bts),
bts->paging.available_slots, VTY_NEWLINE);
if (is_ipaccess_bts(bts)) {
vty_out(vty, " OML Link state: %s.%s",
@@ -332,6 +333,8 @@ static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link
static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
{
vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
+ if (ts->tsc != -1 && ts->tsc != ts->trx->bts->tsc)
+ vty_out(vty, " training_sequence_code %u%s", ts->tsc, VTY_NEWLINE);
if (ts->pchan != GSM_PCHAN_NONE)
vty_out(vty, " phys_chan_config %s%s",
gsm_pchan_name(ts->pchan), VTY_NEWLINE);
@@ -365,7 +368,7 @@ static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
vty_out(vty, " description %s%s", trx->description,
VTY_NEWLINE);
vty_out(vty, " rf_locked %u%s",
- trx->nm_state.administrative == NM_STATE_LOCKED ? 1 : 0,
+ trx->mo.nm_state.administrative == NM_STATE_LOCKED ? 1 : 0,
VTY_NEWLINE);
vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE);
vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE);
@@ -495,7 +498,7 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
get_value_string(osmo_sitype_strs, i), VTY_NEWLINE);
vty_out(vty, " system-information %s static %s%s",
get_value_string(osmo_sitype_strs, i),
- hexdump_nospc(bts->si_buf[i], sizeof(bts->si_buf[i])),
+ osmo_osmo_hexdump_nospc(bts->si_buf[i], sizeof(bts->si_buf[i])),
VTY_NEWLINE);
}
}
@@ -616,9 +619,9 @@ static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
trx->nominal_power, trx->max_power_red,
trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
vty_out(vty, " NM State: ");
- net_dump_nmstate(vty, &trx->nm_state);
+ net_dump_nmstate(vty, &trx->mo.nm_state);
vty_out(vty, " Baseband Transceiver NM State: ");
- net_dump_nmstate(vty, &trx->bb_transc.nm_state);
+ net_dump_nmstate(vty, &trx->bb_transc.mo.nm_state);
if (is_ipaccess_bts(trx->bts)) {
vty_out(vty, " ip.access stream ID: 0x%02x%s",
trx->rsl_tei, VTY_NEWLINE);
@@ -684,15 +687,15 @@ DEFUN(show_trx,
static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
{
- vty_out(vty, "BTS %u, TRX %u, Timeslot %u, phys cfg %s",
+ vty_out(vty, "BTS %u, TRX %u, Timeslot %u, phys cfg %s, TSC %u",
ts->trx->bts->nr, ts->trx->nr, ts->nr,
- gsm_pchan_name(ts->pchan));
+ gsm_pchan_name(ts->pchan), ts->tsc);
if (ts->pchan == GSM_PCHAN_TCH_F_PDCH)
vty_out(vty, " (%s mode)",
ts->flags & TS_F_PDCH_MODE ? "PDCH" : "TCH/F");
vty_out(vty, "%s", VTY_NEWLINE);
vty_out(vty, " NM State: ");
- net_dump_nmstate(vty, &ts->nm_state);
+ net_dump_nmstate(vty, &ts->mo.nm_state);
if (!is_ipaccess_bts(ts->trx->bts))
vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
ts->e1_link.e1_nr, ts->e1_link.e1_ts,
@@ -1439,8 +1442,8 @@ DEFUN(cfg_bts,
return CMD_WARNING;
} else if (bts_nr == gsmnet->num_bts) {
/* allocate a new one */
- bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
- HARDCODED_TSC, HARDCODED_BSIC);
+ bts = gsm_bts_alloc_register(gsmnet, GSM_BTS_TYPE_UNKNOWN,
+ HARDCODED_TSC, HARDCODED_BSIC);
} else
bts = gsm_bts_num(gsmnet, bts_nr);
@@ -2171,7 +2174,7 @@ DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd,
memset(bts->si_buf[type], 0x2b, sizeof(bts->si_buf[type]));
/* Parse the user-specified SI in hex format, [partially] overwriting padding */
- rc = hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0]));
+ rc = osmo_hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0]));
if (rc < 0 || rc > sizeof(bts->si_buf[0])) {
vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE);
return CMD_WARNING;
@@ -2427,6 +2430,18 @@ DEFUN(cfg_ts_pchan,
return CMD_SUCCESS;
}
+DEFUN(cfg_ts_tsc,
+ cfg_ts_tsc_cmd,
+ "training_sequence_code <0-7>",
+ "Training Sequence Code")
+{
+ struct gsm_bts_trx_ts *ts = vty->index;
+
+ ts->tsc = atoi(argv[0]);
+
+ return CMD_SUCCESS;
+}
+
#define HOPPING_STR "Configure frequency hopping\n"
DEFUN(cfg_ts_hopping,
@@ -2518,18 +2533,18 @@ DEFUN(cfg_ts_e1_subslot,
void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
{
vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
- counter_get(net->stats.chreq.total),
- counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
+ osmo_counter_get(net->stats.chreq.total),
+ osmo_counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s",
- counter_get(net->stats.chan.rf_fail),
- counter_get(net->stats.chan.rll_err), VTY_NEWLINE);
+ osmo_counter_get(net->stats.chan.rf_fail),
+ osmo_counter_get(net->stats.chan.rll_err), VTY_NEWLINE);
vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
- counter_get(net->stats.paging.attempted),
- counter_get(net->stats.paging.completed),
- counter_get(net->stats.paging.expired), VTY_NEWLINE);
+ osmo_counter_get(net->stats.paging.attempted),
+ osmo_counter_get(net->stats.paging.completed),
+ osmo_counter_get(net->stats.paging.expired), VTY_NEWLINE);
vty_out(vty, "BTS failures : %lu OML, %lu RSL%s",
- counter_get(net->stats.bts.oml_fail),
- counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
+ osmo_counter_get(net->stats.bts.oml_fail),
+ osmo_counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
}
DEFUN(logging_fltr_imsi,
@@ -2650,7 +2665,7 @@ DEFUN(pdch_act, pdch_act_cmd,
extern int bsc_vty_init_extra(void);
extern const char *openbsc_copyright;
-int bsc_vty_init(void)
+int bsc_vty_init(const struct log_info *cat)
{
install_element_ve(&show_net_cmd);
install_element_ve(&show_bts_cmd);
@@ -2666,7 +2681,7 @@ int bsc_vty_init(void)
install_element_ve(&show_paging_cmd);
- logging_vty_add_cmds();
+ logging_vty_add_cmds(cat);
install_element(CFG_LOG_NODE, &logging_fltr_imsi_cmd);
install_element(CONFIG_NODE, &cfg_net_cmd);
@@ -2779,6 +2794,7 @@ int bsc_vty_init(void)
install_element(TS_NODE, &ournode_exit_cmd);
install_element(TS_NODE, &ournode_end_cmd);
install_element(TS_NODE, &cfg_ts_pchan_cmd);
+ install_element(TS_NODE, &cfg_ts_tsc_cmd);
install_element(TS_NODE, &cfg_ts_hopping_cmd);
install_element(TS_NODE, &cfg_ts_hsn_cmd);
install_element(TS_NODE, &cfg_ts_maio_cmd);