path: root/tests/gsm23003
AgeCommit message (Collapse)AuthorFilesLines
2019-01-14gsm23003: add osmo_imei_str_valid()Oliver Smith2-0/+54
Verify 14 digit and 15 digit IMEI strings. OsmoHLR will use the 14 digit version to check IMEIs before writing them to the DB. Place the Luhn checksum code in a dedicated osmo_luhn() function, so it can be used elsewhere. Related: OS#2541 Change-Id: Id2d2a3a93b033bafc74c62e15297034bf4aafe61
2018-10-28gsm23003: Add MME domain name related helper functionsHarald Welte2-0/+80
osmo_gen_mme_group_domain(), osmo_gen_mme_group_domain() and osmo_gen_home_network_domain() Change-Id: Ia882d9db05ec0037e593aeebea21bc31adb680bb
2018-03-05fix osmo_mnc_from_str(): don't try to parse NULLNeels Hofmeyr2-15/+15
In osmo_mnc_from_str() do not try to return some values even if the validation fails; hence don't try to decode a NULL pointer. That whole idea was half-baked and a can of worms to begin with. Change-Id: Ibaaa128ac60b941a015a31134eb52aef56bc6e22
2018-03-01gsm23003_test: fix: compare members instead of bcmpNeels Hofmeyr1-1/+3
In certain builds (for me a build with no -O2 flag) the recently added gsm23003_test test_mnc_from_str() fails, because bcmp() compares all bytes of sizeof(struct test_mnc_from_str_result), which has valid data for 7 bytes plus one padding byte that may contain arbitrary values. Instead of bcmp(), rather compare the actual members one by one. Change-Id: I28b28457c7b0462c950612fd9b87b5c7181d8bad
2018-02-28gsm: add osmo_mnc_from_str(), osmo_mnc_cmp(), osmo_plmn_cmp() for 3-digit MNCNeels Hofmeyr2-0/+72
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
2017-11-13Fix/Update copyright notices; Add SPDX annotationHarald Welte1-1/+2
Let's fix some erroneous/accidential references to wrong license, update copyright information where applicable and introduce a SPDX-License-Identifier to all files. Change-Id: I39af26c6aaaf5c926966391f6565fc5936be21af
2017-10-10gsm: make osmo_imsi_str_valid() NULL-safeNeels Hofmeyr2-0/+4
No callers that would pass NULL exist, but let's check against NULL from the start. Fixup for recent change I1e94f5b0717b947d2a7a7d36bacdf04a75cb3522. Change-Id: I111fbf29228929f2cd6ffa06bcb1f69da223224e
2017-10-05add osmo_imsi_str_valid() and osmo_msisdn_str_valid()Neels Hofmeyr2-0/+166
Add GSM23003_IMSI_MIN_DIGITS definition. Add regression test gsm23003_test.c to test the two new functions. Will be used by OsmoHLR to validate VTY and CTRL input. Change-Id: I1e94f5b0717b947d2a7a7d36bacdf04a75cb3522