Change in libosmocore[master]: add OSMO_IMSI_SIZE

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Apr 10 17:50:45 UTC 2019


Neels Hofmeyr has uploaded this change for review. ( https://gerrit.osmocom.org/13575


Change subject: add OSMO_IMSI_SIZE
......................................................................

add OSMO_IMSI_SIZE

Various places in our code base figure out how many char they need to safely
store an IMSI. An IMSI can have a checksum digit, which is not reflected by
GSM23003_IMSI_MAX_DIGITS. And we usually needs a terminating \0.

Instead of having a magic +2 repeated every so often, rather define
OSMO_IMSI_SIZE to contain both checksum digit and nul char, and have the
explanatory comment with it here in libosmocore.

Change-Id: Id11ada4c96b79f7f0ad58185ab7dbf24622fb770
---
M include/osmocom/gsm/protocol/gsm_23_003.h
1 file changed, 3 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/75/13575/1

diff --git a/include/osmocom/gsm/protocol/gsm_23_003.h b/include/osmocom/gsm/protocol/gsm_23_003.h
index babd0f4..9dcf4ac 100644
--- a/include/osmocom/gsm/protocol/gsm_23_003.h
+++ b/include/osmocom/gsm/protocol/gsm_23_003.h
@@ -5,6 +5,9 @@
 /* Chapter 2.2 */
 #define GSM23003_IMSI_MAX_DIGITS	15
 #define GSM23003_IMSI_MIN_DIGITS	6
+/*! The char[] buffer size to completely contain an IMSI including the optional checksum digit as well as the
+ * terminating nul character. */
+#define OSMO_IMSI_SIZE (GSM23003_IMSI_MAX_DIGITS+2)
 /* Chapter 2.4 */
 #define GSM23003_TMSI_NUM_BYTES		4
 /* Chapter 2.5 */

-- 
To view, visit https://gerrit.osmocom.org/13575
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: Id11ada4c96b79f7f0ad58185ab7dbf24622fb770
Gerrit-Change-Number: 13575
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190410/0337f44a/attachment.htm>


More information about the gerrit-log mailing list