diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2018-03-21 16:04:30 +0100 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2018-03-22 04:13:09 +0000 |
commit | da5b09a08e2b480a02ce6ffb6878959b7db068d6 (patch) | |
tree | 01fbbbbf9b473a9d643a949d95a0c5ba2656d731 | |
parent | 9cf2babed9b75aec49d93ba7ce33198c574035e4 (diff) |
cosmetic: abis_nm: use osmo_cell_global_id, parse 3-digit MNC
Instead of a local redefinition, use osmo_cell_global_id.
This change is cosmetic because the decoded PLMN is currently actually never
used.
Change-Id: I38ac98a4d25159cfd4f686efbfbaf8f00625a6d8
-rw-r--r-- | include/osmocom/bsc/abis_nm.h | 9 | ||||
-rw-r--r-- | src/libbsc/abis_nm.c | 20 |
2 files changed, 5 insertions, 24 deletions
diff --git a/include/osmocom/bsc/abis_nm.h b/include/osmocom/bsc/abis_nm.h index 18f87cdf4..9586deddd 100644 --- a/include/osmocom/bsc/abis_nm.h +++ b/include/osmocom/bsc/abis_nm.h @@ -31,13 +31,6 @@ /* max number of attributes represented as 3GPP TS 52.021 ยง9.4.62 SW Description array */ #define MAX_BTS_ATTR 5 -struct cell_global_id { - uint16_t mcc; - uint16_t mnc; - uint16_t lac; - uint16_t ci; -}; - /* The BCCH info from an ip.access test, in host byte order * and already parsed... */ struct ipac_bcch_info { @@ -52,7 +45,7 @@ struct ipac_bcch_info { uint16_t frame_offset; uint32_t frame_nr_offset; uint8_t bsic; - struct cell_global_id cgi; + struct osmo_cell_global_id cgi; uint8_t ba_list_si2[16]; uint8_t ba_list_si2bis[16]; uint8_t ba_list_si2ter[16]; diff --git a/src/libbsc/abis_nm.c b/src/libbsc/abis_nm.c index c2cb1d00d..2ee2e24fa 100644 --- a/src/libbsc/abis_nm.c +++ b/src/libbsc/abis_nm.c @@ -2871,23 +2871,11 @@ const char *ipacc_testres_name(uint8_t res) return get_value_string(ipacc_testres_names, res); } -void ipac_parse_cgi(struct cell_global_id *cid, const uint8_t *buf) +void ipac_parse_cgi(struct osmo_cell_global_id *cid, const uint8_t *buf) { - cid->mcc = (buf[0] & 0xf) * 100; - cid->mcc += (buf[0] >> 4) * 10; - cid->mcc += (buf[1] & 0xf) * 1; - - if (buf[1] >> 4 == 0xf) { - cid->mnc = (buf[2] & 0xf) * 10; - cid->mnc += (buf[2] >> 4) * 1; - } else { - cid->mnc = (buf[2] & 0xf) * 100; - cid->mnc += (buf[2] >> 4) * 10; - cid->mnc += (buf[1] >> 4) * 1; - } - - cid->lac = ntohs(*((uint16_t *)&buf[3])); - cid->ci = ntohs(*((uint16_t *)&buf[5])); + osmo_plmn_from_bcd(buf, &cid->lai.plmn); + cid->lai.lac = ntohs(*((uint16_t *)&buf[3])); + cid->cell_identity = ntohs(*((uint16_t *)&buf[5])); } /* parse BCCH information IEI from wire format to struct ipac_bcch_info */ |