aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-11-08 16:21:49 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2018-11-09 15:50:44 +0000
commit3416c77ab6d5a77ebc924617292c58decd6c442d (patch)
treebe8d523a0c93788c48e86234a7ef5307fc182805
parentac858945ddfb4e62bc9c13b01406811e7c532f20 (diff)
abis_nm: Split handling of Attribute Response Info into its own func
In future commits, nanoBTS support will be added, which implements its own format not exactly equal to specs Attribute Response Info. Related: OS#3624 Change-Id: I346dacc58faac70e6d224ca49484f9211cb8a046
-rw-r--r--src/osmo-bsc/abis_nm.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c
index ef61f9e58..17c987b37 100644
--- a/src/osmo-bsc/abis_nm.c
+++ b/src/osmo-bsc/abis_nm.c
@@ -528,29 +528,21 @@ static inline const uint8_t *parse_attr_resp_info_manuf_state(const struct gsm_b
}
/* Handle 3GPP TS 52.021 §9.4.64 Get Attribute Response Info */
-static int abis_nm_rx_get_attr_resp(struct msgb *mb, const struct gsm_bts_trx *trx)
+static int parse_attr_resp_info(struct gsm_bts *bts, const struct gsm_bts_trx *trx, struct abis_om_fom_hdr *foh, struct tlv_parsed *tp)
{
- struct abis_om_hdr *oh = msgb_l2(mb);
- struct abis_om_fom_hdr *foh = msgb_l3(mb);
- struct e1inp_sign_link *sign_link = mb->dst;
- struct gsm_bts *bts = trx ? trx->bts : sign_link->trx->bts;
- struct tlv_parsed tp;
const uint8_t *data;
int i;
uint16_t data_len;
int rc;
struct abis_nm_sw_desc sw_descr[MAX_BTS_ATTR];
- DEBUGPFOH(DNM, foh, "Get Attributes Response for BTS%u\n", bts->nr);
-
- abis_nm_tlv_parse(&tp, bts, foh->data, oh->length-sizeof(*foh));
- if (!TLVP_PRES_LEN(&tp, NM_ATT_GET_ARI, 1)) {
+ if (!TLVP_PRES_LEN(tp, NM_ATT_GET_ARI, 1)) {
LOGPFOH(DNM, LOGL_ERROR, foh, "BTS%u: Get Attr Response without Response Info?!\n",
bts->nr);
return -EINVAL;
}
- data = parse_attr_resp_info_unreported(bts->nr, TLVP_VAL(&tp, NM_ATT_GET_ARI), TLVP_LEN(&tp, NM_ATT_GET_ARI),
+ data = parse_attr_resp_info_unreported(bts->nr, TLVP_VAL(tp, NM_ATT_GET_ARI), TLVP_LEN(tp, NM_ATT_GET_ARI),
&data_len);
data = parse_attr_resp_info_manuf_state(trx, data, &data_len);
@@ -570,10 +562,25 @@ static int abis_nm_rx_get_attr_resp(struct msgb *mb, const struct gsm_bts_trx *t
LOGPFOH(DNM, LOGL_ERROR, foh, "BTS%u: failed to parse SW-Config part of "
"Get Attribute Response Info: %s\n", bts->nr, strerror(-rc));
}
-
return 0;
}
+/* Handle 3GPP TS 52.021 §8.11.3 Get Attribute Response */
+static int abis_nm_rx_get_attr_resp(struct msgb *mb, const struct gsm_bts_trx *trx)
+{
+ struct abis_om_hdr *oh = msgb_l2(mb);
+ struct abis_om_fom_hdr *foh = msgb_l3(mb);
+ struct e1inp_sign_link *sign_link = mb->dst;
+ struct gsm_bts *bts = trx ? trx->bts : sign_link->trx->bts;
+ struct tlv_parsed tp;
+
+ DEBUGPFOH(DNM, foh, "Get Attributes Response for BTS%u\n", bts->nr);
+
+ abis_nm_tlv_parse(&tp, bts, foh->data, oh->length-sizeof(*foh));
+
+ return parse_attr_resp_info(bts, trx, foh, &tp);
+}
+
/* 3GPP TS 52.021 §6.2.5 */
static int abis_nm_rx_sw_act_req(struct msgb *mb)
{