This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
osmith gerrit-no-reply at lists.osmocom.orgosmith has uploaded this change for review. ( https://gerrit.osmocom.org/12524 Change subject: gsm23003: add osmo_imei_str_valid() ...................................................................... gsm23003: add osmo_imei_str_valid() To be used by OsmoHLR to check IMEIs before writing them to the DB. Related: OS#2541 Change-Id: Id2d2a3a93b033bafc74c62e15297034bf4aafe61 --- M include/osmocom/gsm/gsm23003.h M src/gsm/gsm23003.c M src/gsm/libosmogsm.map 3 files changed, 14 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/24/12524/1 diff --git a/include/osmocom/gsm/gsm23003.h b/include/osmocom/gsm/gsm23003.h index 2f380ae..d21c8d5 100644 --- a/include/osmocom/gsm/gsm23003.h +++ b/include/osmocom/gsm/gsm23003.h @@ -93,6 +93,7 @@ bool osmo_imsi_str_valid(const char *imsi); bool osmo_msisdn_str_valid(const char *msisdn); +bool osmo_imei_str_valid(const char *imei); const char *osmo_mcc_name(uint16_t mcc); const char *osmo_mnc_name(uint16_t mnc, bool mnc_3_digits); diff --git a/src/gsm/gsm23003.c b/src/gsm/gsm23003.c index 4fdad48..74d0de2 100644 --- a/src/gsm/gsm23003.c +++ b/src/gsm/gsm23003.c @@ -71,6 +71,18 @@ return is_n_digits(msisdn, 1, 15); } +/*! Determine whether the given IMEI is valid according to 3GPP TS 23.003, + * Section 6.2.1. It consists of 14 digits, the 15th check digit is not + * intended for digital transmission. + * \param imei IMEI digits in ASCII string representation. + * \returns true when the IMEI is valid, false for invalid characters or number + * of digits. + */ +bool osmo_imei_str_valid(const char *imei) +{ + return is_n_digits(imei, 14, 14); +} + /*! Return MCC string as standardized 3-digit with leading zeros. * \param[in] mcc MCC value. * \returns string in static buffer. diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index cdcbcc9..dbac69b 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -534,6 +534,7 @@ osmo_imsi_str_valid; osmo_msisdn_str_valid; +osmo_imei_str_valid; osmo_mncc_stringify; osmo_mncc_names; -- To view, visit https://gerrit.osmocom.org/12524 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Id2d2a3a93b033bafc74c62e15297034bf4aafe61 Gerrit-Change-Number: 12524 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith at sysmocom.de> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190111/f4b3c01f/attachment.htm>