summaryrefslogtreecommitdiffstats
path: root/tests/gsm0408/gsm0408_test.ok
Commit message (Collapse)AuthorAgeFilesLines
* gsm48_mi_to_string(): guard against zero length output bufferNeels Hofmeyr2018-12-101-8/+8
| | | | | | | | All successful cases already return from the switch(), so simply handle all errors below it by returning an empty string (if there is enough string buffer). Change-Id: I709ac3b9efb7b4258d8660715b10312e11b9b571
* gsm48_generate_mid(): mask out ODD flag from mi_typeNeels Hofmeyr2018-12-101-5/+3
| | | | | | | | For MI encoding, see 3GPP TS 24.008, 10.5.1.4 Mobile Identity. The 'odd' flag indicates whether the last BCD nibble is used. Of course that flag should be made sure to reflect the actual length. Change-Id: Id6e695ebf9f86b295eaa7e2c6228989256f37e68
* gsm48_mi_to_string: use osmo_bcd2str(), fix some corner casesNeels Hofmeyr2018-12-101-14/+12
| | | | | | | | | | | | | By using osmo_bcd2str(), ensure that the resulting string is always nul terminated, and always return strlen()+1 whether truncated or not. Still keep up the previous return value style, even if that isn't consistent at all. The difference between IMSI/IMEI and TMSI return values remains and is not part of this patch. Change-Id: I1b51b72a721e1cc9d69796b804ebda741ff0f36b
* gsm0408_test: test encoding and decoding Mobile IdentityNeels Hofmeyr2018-12-101-0/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | One would think by now we would solidly encode and decode Mobile Identities. Well, guess again. - rc is sometimes the amount of bytes written, sometimes actual strlen(). - on string truncation, rc is sometimes strlen() (assuming nul terminated), and sometimes snprintf()-style would-be strlen(). - returned string, when truncated by not enough buffer size, is sometimes nul terminated, sometimes not. - gsm48_mi_to_string() happily reads a byte from zero-length input buffer. - gsm48_mi_to_string() happily writes to zero length output buffer. - gsm48_mi_to_string() returns nonempty string for empty input. - encoding a MI type that still has the GSM_MI_ODD flag set results in encoding an even-length MI as odd-length (hence appending a stray 'F'). I am going to tweak the implementation of gsm48 mobile identity encoding / decoding, so first pinpoint the current behavior in a unit test, and show how perforated even such a seemingly trivial API can be. Change-Id: Iaae3af87f82f1a8f2e6273984c011b2813038cf7
* gsm0408_test: add test cases for MNC with leading zerosNeels Hofmeyr2018-02-281-0/+91
| | | | Change-Id: I9b387e09293a6bbef84b9620ccf21ee2f9ec751c
* gsm0408_test: test new gsm48_{decode,generate}_lai2() functionsNeels Hofmeyr2018-02-281-0/+16
| | | | Change-Id: I4c8492b8055803d2857f1ef30aede088778b085b
* gsm0408_test: check for new mnc_3_digits flagNeels Hofmeyr2018-02-281-2/+2
| | | | | | | Note that on the input side, the 3-digits flag may be left false when the MNC is >99 anyway. On the decoded side, the flag is set accurately. Change-Id: I89765613d8c5bd939a6957f7443ac88475f1b93c
* gsm0408_test: also test gsm48_generate_lai() and gsm48_decode_lai()Neels Hofmeyr2018-02-221-0/+16
| | | | Change-Id: Idd6cee090464bc92b654332904a9a08edf16e5c9
* gsm0408_test: RA test: include min/max value casesNeels Hofmeyr2018-02-221-0/+10
| | | | | | (Preparation for adding 3-digit MNC) Change-Id: Ifbc167de0cc039858112677b8d0cd14a2c8af086
* gsm0408_test: include BCD and leading zeros in test outputNeels Hofmeyr2018-02-221-4/+6
| | | | | | (Preparation for adding 3-digit MNC) Change-Id: I7f8ae05fa3e4a6fc004212757b05ca8a14c9ef45
* gsm0408_test: cosmetically re-order MCC to come before MNCNeels Hofmeyr2018-02-201-4/+4
| | | | | | For consistency in human readability, MCC simply should come first, always. Change-Id: Idb86a7088fac4d8a8c41190ab46f9801635f4eee
* Add test for gsm48_generate_mid_from_imsi()Max2018-02-151-0/+1
| | | | Change-Id: Ibe5c0831268c788ceecd10fd7b22ece6480da817
* Add function to properly encode RAIMax2018-01-081-2/+2
| | | | | | | | | | | | | Add gsm48_encode_ra() which takes appropriate struct as [out] parameter instead of generic buffer. Using uint8_t buffer instead of proper struct type prooved to be error-prone - see Coverity CID57877, CID57876. Old gsm48_construct_ra() is made into tiny wrapper around new function. The test output is adjusted because of the change in function return value which was constant and hence ignored anyway. Related: OS#1640 Change-Id: I31f9605277f4945f207c2c44ff82e62399f8db74
* libosmogsm: add Routing Area Identifier testMax2017-09-011-0/+8
| | | | | | Ensure that gsm48_parse_ra() and gsm48_construct_ra() behave properly. Change-Id: I27117fe728407dd10886459e89ba4ff9d5e53e6b
* gsm0408: Avoid unaligned memory access in gsm48_generate_mid_from_tmsiHolger Hans Peter Freyther2013-07-031-0/+1
| | | | | | | | The &buf[3] is unlikely to be aligned properly. Use memcpy instead of an assignment. Add a small testcase that verifies that I didn't mess up the conversion. Alignment trap: osmo-nitb (3293) PC=0x492b7094 Instr=0xe5803003 Address=0xbeb259db FSR 0x801
* GSM 04.08: Add support for parsing CSD related bearer capabilitiesHarald Welte2012-08-241-0/+2
Also adds a test case for both encoder and decoder of this IE