path: root/include
diff options
authorNeels Hofmeyr <neels@hofmeyr.de>2018-02-20 21:38:00 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-02-28 19:26:43 +0100
commit721aa6ded9c736e3cc5b20824dd58b1af4f4a907 (patch)
tree2af83106d1afbf097030502fb0ba828cffb1e6bc /include
parent6c7b3e21d63b6f26de6dc53d7cb2bf92c42b9ce7 (diff)
gsm: add osmo_mnc_from_str(), osmo_mnc_cmp(), osmo_plmn_cmp() for 3-digit MNC
osmo_mnc_from_str() preserves leading zeros in the string and is useful for VTY config parsing (osmo-bsc, osmo-msc, osmo-sgsn, osmo-pcu). osmo_{plmn,mnc}_cmp() takes care of the slight intricacy of ignoring the 3-digit flag if the MNC is anyway >99. Will be used by osmo-sgsn.git and osmo-bsc.git. (All current users just care about identical MNC, but a proper cmp doesn't hurt.) Change-Id: Ib7176b1d65a03b76f41f94bc9d3293a8a07d24c6
Diffstat (limited to 'include')
1 files changed, 5 insertions, 0 deletions
diff --git a/include/osmocom/gsm/gsm23003.h b/include/osmocom/gsm/gsm23003.h
index 51e5ef83..660186e3 100644
--- a/include/osmocom/gsm/gsm23003.h
+++ b/include/osmocom/gsm/gsm23003.h
@@ -95,3 +95,8 @@ const char *osmo_lai_name(const struct osmo_location_area_id *lai);
void osmo_plmn_to_bcd(uint8_t *bcd_dst, const struct osmo_plmn_id *plmn);
void osmo_plmn_from_bcd(const uint8_t *bcd_src, struct osmo_plmn_id *plmn);
+int osmo_mnc_from_str(const char *mnc_str, uint16_t *mnc, bool *mnc_3_digits);
+int osmo_mnc_cmp(uint16_t a_mnc, bool a_mnc_3_digits, uint16_t b_mnc, bool b_mnc_3_digits);
+int osmo_plmn_cmp(const struct osmo_plmn_id *a, const struct osmo_plmn_id *b);