pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/27531 )


Change subject: gsm0808_test: Add new unit test showing dec error
......................................................................

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
---
M tests/gsm0808/gsm0808_test.c
M tests/gsm0808/gsm0808_test.ok
2 files changed, 66 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/31/27531/1

diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c
index b823a15..abf6b5d 100644
--- a/tests/gsm0808/gsm0808_test.c
+++ b/tests/gsm0808/gsm0808_test.c
@@ -424,6 +424,70 @@
               osmo_hexdump(diag->msg, diag_len-2));
 }

+static void test_dec_perform_location_report_sys5891()
+{
+       /* Test Perform Location Report SYS#5891 */
+/*
+Frame 870: 128 bytes on wire (1024 bits), 128 bytes captured (1024 bits)
+Linux cooked capture v1
+802.1Q Virtual LAN, PRI: 0, DEI: 0, ID: 1591
+Internet Protocol Version 4, Src: 163.162.127.195, Dst: 192.168.101.38
+Stream Control Transmission Protocol, Src Port: 2905 (2905), Dst Port: 2905 
(2905)
+MTP 3 User Adaptation Layer
+Signalling Connection Control Part
+BSSAP
+    Message Type: BSS Management (0x00)
+    Length: 26
+GSM A-I/F BSSMAP - Perform Location Request
+    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 +2589,7 @@
        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 eaae7a6..8f91eb1 100644
--- a/tests/gsm0808/gsm0808_test.ok
+++ b/tests/gsm0808/gsm0808_test.ok
@@ -916,4 +916,5 @@
   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

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/27531
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ib4ff71d5e01d464febb062c5bfe3e06ee5a19ecd
Gerrit-Change-Number: 27531
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-MessageType: newchange

Reply via email to