aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-12-14 12:52:16 +0100
committerHarald Welte <laforge@gnumonks.org>2010-12-14 12:52:16 +0100
commitf751a10018ce05f7823f40988b4b8d7160b1c4cf (patch)
tree88ed5016bd37e330689f62f206183691058aca51 /openbsc
parent7e72fa0250bc678d9982ec23a45ad0e8435db2bd (diff)
bs11_config: show the BPORT0 / BPORT1 configuration in 'query'
This introduces abis_nm_bs11_get_bport_line_cfg() and a parser for the result.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/abis_nm.h1
-rw-r--r--openbsc/src/abis_nm.c14
-rw-r--r--openbsc/src/bs11_config.c25
3 files changed, 40 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/abis_nm.h b/openbsc/include/openbsc/abis_nm.h
index 7672bb17c..5c9cbd0d3 100644
--- a/openbsc/include/openbsc/abis_nm.h
+++ b/openbsc/include/openbsc/abis_nm.h
@@ -138,6 +138,7 @@ int abis_nm_bs11_get_state(struct gsm_bts *bts);
int abis_nm_bs11_load_swl(struct gsm_bts *bts, const char *fname,
u_int8_t win_size, int forced, gsm_cbfn *cbfn);
int abis_nm_bs11_set_ext_time(struct gsm_bts *bts);
+int abis_nm_bs11_get_bport_line_cfg(struct gsm_bts *bts, u_int8_t bport);
int abis_nm_bs11_set_bport_line_cfg(struct gsm_bts *bts, u_int8_t bport, enum abis_bs11_line_cfg line_cfg);
int abis_nm_bs11_bsc_disconnect(struct gsm_bts *bts, int reconnect);
int abis_nm_bs11_restart(struct gsm_bts *bts);
diff --git a/openbsc/src/abis_nm.c b/openbsc/src/abis_nm.c
index 8bc3ffb3c..9f55d3510 100644
--- a/openbsc/src/abis_nm.c
+++ b/openbsc/src/abis_nm.c
@@ -2681,6 +2681,20 @@ int abis_nm_bs11_set_ext_time(struct gsm_bts *bts)
return abis_nm_sendmsg(bts, msg);
}
+int abis_nm_bs11_get_bport_line_cfg(struct gsm_bts *bts, u_int8_t bport)
+{
+ struct abis_om_hdr *oh;
+ struct msgb *msg = nm_msgb_alloc();
+ u_int8_t attr = NM_ATT_BS11_LINE_CFG;
+
+ oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
+ fill_om_fom_hdr(oh, 2+sizeof(attr), NM_MT_GET_ATTR,
+ NM_OC_BS11_BPORT, bport, 0xff, 0x02);
+ msgb_tlv_put(msg, NM_ATT_LIST_REQ_ATTR, sizeof(attr), &attr);
+
+ return abis_nm_sendmsg(bts, msg);
+}
+
int abis_nm_bs11_set_bport_line_cfg(struct gsm_bts *bts, u_int8_t bport, enum abis_bs11_line_cfg line_cfg)
{
struct abis_om_hdr *oh;
diff --git a/openbsc/src/bs11_config.c b/openbsc/src/bs11_config.c
index 803034a7b..334f94a91 100644
--- a/openbsc/src/bs11_config.c
+++ b/openbsc/src/bs11_config.c
@@ -331,6 +331,18 @@ static const char *cclk_acc_name(u_int8_t acc)
}
}
+static const char *bport_lcfg_name(u_int8_t lcfg)
+{
+ switch (lcfg) {
+ case BS11_LINE_CFG_STAR:
+ return "Star";
+ case BS11_LINE_CFG_MULTIDROP:
+ return "Multi-Drop";
+ default:
+ return "unknown";
+ }
+}
+
static const char *obj_name(struct abis_om_fom_hdr *foh)
{
static char retbuf[256];
@@ -356,6 +368,10 @@ static const char *obj_name(struct abis_om_fom_hdr *foh)
case NM_OC_SITE_MANAGER:
strcat(retbuf, "SITE MANAGER ");
break;
+ case NM_OC_BS11_BPORT:
+ sprintf(retbuf+strlen(retbuf), "BPORT%u ",
+ foh->obj_inst.bts_nr);
+ break;
}
return retbuf;
}
@@ -441,6 +457,13 @@ static int print_attr(struct tlv_parsed *tp)
const u_int8_t *acc = TLVP_VAL(tp, NM_ATT_BS11_CCLK_TYPE);
printf("\tCCLK Type=%d\n", *acc);
}
+ if (TLVP_PRESENT(tp, NM_ATT_BS11_LINE_CFG) &&
+ TLVP_LEN(tp, NM_ATT_BS11_LINE_CFG) >= 1) {
+ const u_int8_t *lcfg = TLVP_VAL(tp, NM_ATT_BS11_LINE_CFG);
+ printf("\tLine Configuration: %s (%d)\n",
+ bport_lcfg_name(*lcfg), *lcfg);
+ }
+
return 0;
@@ -459,6 +482,8 @@ static void cmd_query(void)
trx = gsm_bts_trx_num(g_bts, 1);
if (trx)
abis_nm_bs11_get_trx_power(trx);
+ abis_nm_bs11_get_bport_line_cfg(g_bts, 0);
+ abis_nm_bs11_get_bport_line_cfg(g_bts, 1);
sleep(1);
abis_nm_bs11_factory_logon(g_bts, 0);
command = NULL;