diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2022-03-18 13:17:28 +0100 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2022-03-18 17:36:43 +0100 |
commit | a3987fcf3918a1ff9e030848f3d42bee39dfc364 (patch) | |
tree | d85ad57a19952cddeee84aba675a316cfb72968b /tests | |
parent | contrib/jenkins_amd64.sh: remove FreeBSD specific quirks (diff) | |
download | libosmocore-a3987fcf3918a1ff9e030848f3d42bee39dfc364.tar.xz libosmocore-a3987fcf3918a1ff9e030848f3d42bee39dfc364.zip |
gsm0808_test: Add new unit test showing dec error
This unit tests shows how decoding of such message fails. Fix will be
provided in a follow up patch to make the test pass.
Related: SYS#5891
Change-Id: Ib4ff71d5e01d464febb062c5bfe3e06ee5a19ecd
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gsm0808/gsm0808_test.c | 54 | ||||
-rw-r--r-- | tests/gsm0808/gsm0808_test.ok | 1 |
2 files changed, 55 insertions, 0 deletions
diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c index b823a151..38c68bf0 100644 --- a/tests/gsm0808/gsm0808_test.c +++ b/tests/gsm0808/gsm0808_test.c @@ -424,6 +424,59 @@ static void test_dec_confusion() osmo_hexdump(diag->msg, diag_len-2)); } +/* Test Perform Location Report SYS#5891 */ +static void test_dec_perform_location_report_sys5891() +{ +/* Message Type Perform Location Request + Location Type + Element ID: 0x44 + Length: 1 + Location Information: current geographic location (0x00) + Cell Identifier/CI (25911) + Element ID: 0x05 + Length: 8 + 0000 .... = Spare bit(s): 0x00 + .... 0000 = Cell identification discriminator: The whole Cell Global Identification, CGI, is used to identify the cells. (0) + Mobile Country Code (MCC): (removed)) + Mobile Network Code (MNC): (removed)) + Cell LAC: 0x001e (30) + Cell CI: 0x6537 (25911) + LCS Client Type + Element ID: 0x48 + Length: 1 + 0011 .... = Client Category: Emergency Services (0x03) + .... 0000 = Client Subtype: unspecified (0x00) + LCS Priority + Element ID: 0x43 + Length: 1 + Periodicity: highest (0) + LCS QoS + Element ID: 0x3e + Length: 4 + 0000 00.. = Spare: 0x00 + .... ..0. = Velocity Requested: do not report velocity (0x00) + .... ...0 = Vertical Coordinate Indicator: vertical coordinate not requested (0x00) + 1... .... = Horizontal Accuracy Indicator: horizontal accuracy is specified (0x01) + .001 0010 = Horizontal Accuracy: 0x12 + 0... .... = Vertical Accuracy Indicator: vertical accuracy is not specified (0x00) + .000 0000 = Spare: 0x00 + 00.. .... = Response Time Category: Response Time is not specified (0x00) +*/ + const uint8_t hex[] = { + 0x2b, 0x44, 0x01, 0x00, 0x05, 0x08, 0x00, 0xab, 0xbc, 0xcd, 0x00, 0x1e, + 0x65, 0x37, 0x48, 0x01, 0x30, 0x43, 0x01, 0x00, 0x3e, 0x04, 0x00, 0x92, + 0x00, 0x00 + }; + + struct tlv_parsed tp; + int rc; + + printf("Testing decoding Perform Location Report SYS#5891\n"); + + rc = tlv_parse(&tp, gsm0808_att_tlvdef(), hex+1, sizeof(hex)-1, 0, 0); + OSMO_ASSERT(rc < 0); +} + static void test_create_ass() { static const uint8_t res1[] = @@ -2525,6 +2578,7 @@ int main(int argc, char **argv) test_gsm0808_cell_id_to_from_cgi(); test_dec_confusion(); + test_dec_perform_location_report_sys5891(); printf("Done\n"); return EXIT_SUCCESS; diff --git a/tests/gsm0808/gsm0808_test.ok b/tests/gsm0808/gsm0808_test.ok index eaae7a69..8f91eb16 100644 --- a/tests/gsm0808/gsm0808_test.ok +++ b/tests/gsm0808/gsm0808_test.ok @@ -916,4 +916,5 @@ Testing decoding CONFUSION Diagnostics error octet location 0 (Error location not determined) Diagnostics error bit location 15 (Reserved value) Diagnostics message that provoked the error: 00 03 25 03 25 +Testing decoding Perform Location Report SYS#5891 Done |