osmith has uploaded this change for review. ( https://gerrit.osmocom.org/13961


Change subject: gsm_23_003: add GSM23003_MSISDN_{MIN,MAX}_DIGITS
......................................................................

gsm_23_003: add GSM23003_MSISDN_{MIN,MAX}_DIGITS

Add the constant, so it can be used in create-subscriber-on-demand
related patches. ITU-T Rec. E.164 6.1 states that maximum international
number length should be 15. I did not find a source for a minimum
length, but I've added the constant and set it to 1 for consistency
(based on the existing osmo_msisdn_str_valid() function).

Related: OS#2542
Change-Id: Idc74f4d94ad44b9fc1b6d43178f5f33d551ebfb1
---
M include/osmocom/gsm/protocol/gsm_23_003.h
M src/gsm/gsm23003.c
2 files changed, 4 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/61/13961/1

diff --git a/include/osmocom/gsm/protocol/gsm_23_003.h 
b/include/osmocom/gsm/protocol/gsm_23_003.h
index be1b157..3e5c3e5 100644
--- a/include/osmocom/gsm/protocol/gsm_23_003.h
+++ b/include/osmocom/gsm/protocol/gsm_23_003.h
@@ -20,6 +20,9 @@
 #define GSM23003_MME_CODE_NUM_BYTES    1
 #define GSM23003_MME_GROUP_NUM_BYTES   2
 #define GSM23003_MTMSI_NUM_BYTES       4
+/* Chapter 3.2 */
+#define GSM23003_MSISDN_MAX_DIGITS     15 /* ITU-T Rec. E.164 6.1 */
+#define GSM23003_MSISDN_MIN_DIGITS     1
 /* Chapter 6.2.1 */
 #define GSM23003_IMEI_TAC_NUM_DIGITS   8
 #define GSM23003_IMEI_SNR_NUM_DIGITS   6
diff --git a/src/gsm/gsm23003.c b/src/gsm/gsm23003.c
index 2252f70..a97ed07 100644
--- a/src/gsm/gsm23003.c
+++ b/src/gsm/gsm23003.c
@@ -69,7 +69,7 @@
  */
 bool osmo_msisdn_str_valid(const char *msisdn)
 {
-       return is_n_digits(msisdn, 1, 15);
+       return is_n_digits(msisdn, GSM23003_MSISDN_MIN_DIGITS, 
GSM23003_MSISDN_MAX_DIGITS);
 }

 /*! Determine whether the given IMEI is valid according to 3GPP TS 23.003,

--
To view, visit https://gerrit.osmocom.org/13961
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: Idc74f4d94ad44b9fc1b6d43178f5f33d551ebfb1
Gerrit-Change-Number: 13961
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <[email protected]>

Reply via email to