summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/gsm/gsm23003.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/osmocom/gsm/gsm23003.h b/include/osmocom/gsm/gsm23003.h
index 660186e3..5d1fbd7f 100644
--- a/include/osmocom/gsm/gsm23003.h
+++ b/include/osmocom/gsm/gsm23003.h
@@ -98,5 +98,16 @@ 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);
+/* Convert string to MCC.
+ * \param mcc_str[in] String representation of an MCC, with or without leading zeros.
+ * \param mcc[out] MCC result buffer, or NULL.
+ * \returns zero on success, -EINVAL in case of surplus characters, negative errno in case of conversion
+ * errors. In case of error, do not modify the out-arguments.
+ */
+static inline int osmo_mcc_from_str(const char *mcc_str, uint16_t *mcc)
+{
+ return osmo_mnc_from_str(mcc_str, mcc, NULL);
+}
+
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);