Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 1 | /* RLCMACTest.cpp |
| 2 | * |
| 3 | * Copyright (C) 2011 Ivan Klyuchnikov |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License |
| 7 | * as published by the Free Software Foundation; either version 2 |
| 8 | * of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | |
| 17 | |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 18 | #include <iostream> |
Ivan Kluchnikov | 835f91e | 2012-04-30 18:00:36 +0400 | [diff] [blame] | 19 | #include <cstring> |
Max | 7426c5f | 2019-02-18 20:42:42 +0100 | [diff] [blame] | 20 | #include "gprs_rlcmac.h" |
Pau Espin Pedrol | cdbc5db | 2020-01-23 21:00:19 +0100 | [diff] [blame] | 21 | #include "decoding.h" |
Max | 7426c5f | 2019-02-18 20:42:42 +0100 | [diff] [blame] | 22 | |
Andreas Eversberg | 138f4e6 | 2013-01-14 12:31:11 +0100 | [diff] [blame] | 23 | extern "C" { |
Aravind Sirsikar | 9f5f008 | 2016-08-30 13:20:23 +0530 | [diff] [blame] | 24 | #include <osmocom/core/utils.h> |
Max | d3a0d91 | 2019-03-05 16:15:01 +0100 | [diff] [blame] | 25 | #include <osmocom/core/msgb.h> |
Vadim Yanitskiy | 39a6505 | 2020-01-25 01:24:59 +0700 | [diff] [blame] | 26 | |
| 27 | #include "csn1.h" |
Pau Espin Pedrol | b2653fe | 2020-03-26 15:14:01 +0100 | [diff] [blame] | 28 | #include "gsm_rlcmac.h" |
Andreas Eversberg | 138f4e6 | 2013-01-14 12:31:11 +0100 | [diff] [blame] | 29 | } |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 30 | using namespace std; |
| 31 | |
Pau Espin Pedrol | 1e97951 | 2021-03-09 15:46:35 +0100 | [diff] [blame] | 32 | #include "gprs_debug.h" |
| 33 | |
Pau Espin Pedrol | cdbc5db | 2020-01-23 21:00:19 +0100 | [diff] [blame] | 34 | void *tall_pcu_ctx; |
| 35 | |
Vadim Yanitskiy | 3094bb2 | 2022-08-06 02:21:45 +0700 | [diff] [blame] | 36 | static void testRlcMacDownlink(void *test_ctx) |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 37 | { |
Pau Espin Pedrol | 54681c3 | 2020-01-23 21:59:23 +0100 | [diff] [blame] | 38 | printf("*** %s ***\n", __func__); |
Pau Espin Pedrol | 5e300ce | 2020-02-03 17:18:03 +0100 | [diff] [blame] | 39 | |
| 40 | int rc; |
Alexander Couzens | ccde5c9 | 2017-02-04 03:10:08 +0100 | [diff] [blame] | 41 | struct bitvec *resultVector = bitvec_alloc(23, test_ctx); |
Max | 7426c5f | 2019-02-18 20:42:42 +0100 | [diff] [blame] | 42 | bitvec_unhex(resultVector, DUMMY_VEC); |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 43 | |
| 44 | std::string testData[] = { |
Vadim Yanitskiy | cc2da7b | 2022-08-06 02:22:48 +0700 | [diff] [blame] | 45 | "4e082500e3f1a81d080820800b2b2b2b2b2b2b2b2b2b2b", // Packet Downlink Assignment |
| 46 | "48282407a6a07422720100032b2b2b2b2b2b2b2b2b2b2b", // Packet Uplink Assignment |
| 47 | "47240c00400000000000000079eb2ac9402b2b2b2b2b2b", // Packet Uplink Ack Nack |
| 48 | "47283c367513ba333004242b2b2b2b2b2b2b2b2b2b2b2b", // Packet Uplink Assignment |
| 49 | "400820001a3904df0680efb3300b2b2b2b2b2b2b2b2b2b", // Packet Downlink Assignment (EGPRS) |
| 50 | "40284f0000001009810c826f4406809dcecb2b2b2b2b2b", // Packet Uplink Assignment (EGPRS) |
| 51 | "4024030f2f0000000087b0042b2b2b2b2b2b2b2b2b2b2b", // Packet Uplink Ack Nack (EGPRS) |
| 52 | "4913e00850884013a8048b2b2b2b2b2b2b2b2b2b2b2b2b", // Polling Request (malformed) |
| 53 | "412430007fffffffffffffffefd19c7ba12b2b2b2b2b2b", // Packet Uplink Ack Nack? |
| 54 | "41942b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b", // System Info 13? |
| 55 | "40883c1493120000000012002b2b2b2b2b2b2b2b2b2b2b", // Pkt Paging Request (OS#4838) |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 56 | }; |
| 57 | |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 58 | cout << " DOWNLINK " << endl; |
Vadim Yanitskiy | 5e0fbdc | 2022-08-06 02:24:34 +0700 | [diff] [blame] | 59 | for (unsigned int i = 0; i < ARRAY_SIZE(testData); i++) |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 60 | { |
Pau Espin Pedrol | 87bfbe4 | 2020-01-23 23:51:34 +0100 | [diff] [blame] | 61 | cout << "vector1 = " << testData[i] << endl; |
Alexander Couzens | ccde5c9 | 2017-02-04 03:10:08 +0100 | [diff] [blame] | 62 | bitvec *vector = bitvec_alloc(23, test_ctx); |
Ivan Kluchnikov | 835f91e | 2012-04-30 18:00:36 +0400 | [diff] [blame] | 63 | bitvec_unhex(vector, testData[i].c_str()); |
Pau Espin Pedrol | 87bfbe4 | 2020-01-23 23:51:34 +0100 | [diff] [blame] | 64 | |
Pau Espin Pedrol | 99c437b | 2020-01-24 12:34:50 +0100 | [diff] [blame] | 65 | RlcMacDownlink_t data; |
| 66 | memset(&data, 0, sizeof(data)); |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 67 | cout << "=========Start DECODE===========" << endl; |
Pau Espin Pedrol | 5e300ce | 2020-02-03 17:18:03 +0100 | [diff] [blame] | 68 | rc = decode_gsm_rlcmac_downlink(vector, &data); |
| 69 | cout << "+++++++++Finish DECODE ("<< rc <<")++++++++++" << endl; |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 70 | cout << "=========Start ENCODE=============" << endl; |
Pau Espin Pedrol | 5e300ce | 2020-02-03 17:18:03 +0100 | [diff] [blame] | 71 | rc = encode_gsm_rlcmac_downlink(resultVector, &data); |
| 72 | cout << "+++++++++Finish ENCODE ("<< rc <<")+++++++++++" << endl; |
Pau Espin Pedrol | 87bfbe4 | 2020-01-23 23:51:34 +0100 | [diff] [blame] | 73 | cout << "vector1 = " << osmo_hexdump(vector->data, 23) << endl; |
| 74 | cout << "vector2 = " << osmo_hexdump(resultVector->data, 23) << endl; |
Ivan Kluchnikov | 835f91e | 2012-04-30 18:00:36 +0400 | [diff] [blame] | 75 | if (memcmp(vector->data, resultVector->data, 23) == 0) |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 76 | cout << "vector1 == vector2 : TRUE" << endl; |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 77 | else |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 78 | cout << "vector1 == vector2 : FALSE" << endl; |
Max | 7426c5f | 2019-02-18 20:42:42 +0100 | [diff] [blame] | 79 | bitvec_unhex(resultVector, DUMMY_VEC); |
Ivan Kluchnikov | 835f91e | 2012-04-30 18:00:36 +0400 | [diff] [blame] | 80 | bitvec_free(vector); |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 81 | } |
Andreas Eversberg | 273a222 | 2013-01-16 08:56:33 +0100 | [diff] [blame] | 82 | |
| 83 | bitvec_free(resultVector); |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 84 | } |
| 85 | |
| 86 | |
Vadim Yanitskiy | 3094bb2 | 2022-08-06 02:21:45 +0700 | [diff] [blame] | 87 | static void testRlcMacUplink(void *test_ctx) |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 88 | { |
Pau Espin Pedrol | 54681c3 | 2020-01-23 21:59:23 +0100 | [diff] [blame] | 89 | printf("*** %s ***\n", __func__); |
Pau Espin Pedrol | 5e300ce | 2020-02-03 17:18:03 +0100 | [diff] [blame] | 90 | |
| 91 | int rc; |
Alexander Couzens | ccde5c9 | 2017-02-04 03:10:08 +0100 | [diff] [blame] | 92 | struct bitvec *resultVector = bitvec_alloc(23, test_ctx); |
Max | 7426c5f | 2019-02-18 20:42:42 +0100 | [diff] [blame] | 93 | bitvec_unhex(resultVector, DUMMY_VEC); |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 94 | |
| 95 | std::string testData[] = { |
Vadim Yanitskiy | cc2da7b | 2022-08-06 02:22:48 +0700 | [diff] [blame] | 96 | "400e1e61d11d2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b", // Packet Uplink Dummy Control Block |
| 97 | "400b8020000000000000002480e0032b2b2b2b2b2b2b2b", // Packet Downlink Ack/Nack |
| 98 | "4016713dc094270ca2ae57ef909006aa0fc0001f80222b", // Packet Resource Request |
| 99 | "401673c87f24af2632b25964200600000091000b780080", // Packet Resource Request (from keith) |
| 100 | "40200ffc0021ec010b2b2b2b2b2b2b2b2b2b2b2b2b2b2b", // EPDAN |
| 101 | "400a9020000000000000003010012a0800132b2b2b2b2b", // Packet Downlink Ack/Nack ? |
Vadim Yanitskiy | 809dc8b | 2021-01-28 20:31:42 +0100 | [diff] [blame] | 102 | |
Vadim Yanitskiy | cc2da7b | 2022-08-06 02:22:48 +0700 | [diff] [blame] | 103 | /* Packet Resource Request (see OS#4955, mistakes in 3GPP TS 44.060) */ |
| 104 | "4117ea1b903eaeb2686564b2330820078000102b2b2b2b", |
| 105 | "40167e49f7f8ef2632b2596620060000806d00541c0080", |
| 106 | "4017787174d92eba686564b2ccc30800a000040b2b2b2b", |
| 107 | "4017e5b2cd5a2eca68655e44aec84880139300412b2b2b", |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 108 | }; |
| 109 | |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 110 | cout << " UPLINK " << endl; |
Vadim Yanitskiy | 5e0fbdc | 2022-08-06 02:24:34 +0700 | [diff] [blame] | 111 | for (unsigned int i = 0; i < ARRAY_SIZE(testData); i++) |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 112 | { |
Pau Espin Pedrol | 87bfbe4 | 2020-01-23 23:51:34 +0100 | [diff] [blame] | 113 | cout << "vector1 = " << testData[i] << endl; |
Alexander Couzens | ccde5c9 | 2017-02-04 03:10:08 +0100 | [diff] [blame] | 114 | bitvec *vector = bitvec_alloc(23, test_ctx); |
Ivan Kluchnikov | 835f91e | 2012-04-30 18:00:36 +0400 | [diff] [blame] | 115 | bitvec_unhex(vector, testData[i].c_str()); |
Pau Espin Pedrol | 87bfbe4 | 2020-01-23 23:51:34 +0100 | [diff] [blame] | 116 | |
Pau Espin Pedrol | 99c437b | 2020-01-24 12:34:50 +0100 | [diff] [blame] | 117 | RlcMacUplink_t data; |
| 118 | memset(&data, 0, sizeof(data)); |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 119 | cout << "=========Start DECODE===========" << endl; |
Pau Espin Pedrol | 5e300ce | 2020-02-03 17:18:03 +0100 | [diff] [blame] | 120 | rc = decode_gsm_rlcmac_uplink(vector, &data); |
| 121 | cout << "+++++++++Finish DECODE ("<< rc << ")++++++++++" << endl; |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 122 | cout << "=========Start ENCODE=============" << endl; |
Pau Espin Pedrol | 5e300ce | 2020-02-03 17:18:03 +0100 | [diff] [blame] | 123 | rc = encode_gsm_rlcmac_uplink(resultVector, &data); |
| 124 | cout << "+++++++++Finish ENCODE ("<< rc <<")+++++++++++" << endl; |
Pau Espin Pedrol | 87bfbe4 | 2020-01-23 23:51:34 +0100 | [diff] [blame] | 125 | cout << "vector1 = " << osmo_hexdump(vector->data, 23) << endl; |
| 126 | cout << "vector2 = " << osmo_hexdump(resultVector->data, 23) << endl; |
Ivan Kluchnikov | 835f91e | 2012-04-30 18:00:36 +0400 | [diff] [blame] | 127 | if (memcmp(vector->data, resultVector->data, 23) == 0) |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 128 | cout << "vector1 == vector2 : TRUE" << endl; |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 129 | else |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 130 | cout << "vector1 == vector2 : FALSE" << endl; |
Max | 7426c5f | 2019-02-18 20:42:42 +0100 | [diff] [blame] | 131 | bitvec_unhex(resultVector, DUMMY_VEC); |
Ivan Kluchnikov | 835f91e | 2012-04-30 18:00:36 +0400 | [diff] [blame] | 132 | bitvec_free(vector); |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 133 | } |
Andreas Eversberg | 273a222 | 2013-01-16 08:56:33 +0100 | [diff] [blame] | 134 | |
| 135 | bitvec_free(resultVector); |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 136 | } |
| 137 | |
Vadim Yanitskiy | 3094bb2 | 2022-08-06 02:21:45 +0700 | [diff] [blame] | 138 | static void testCsnLeftAlignedVarBmpBounds(void *test_ctx) |
Aravind Sirsikar | 9f5f008 | 2016-08-30 13:20:23 +0530 | [diff] [blame] | 139 | { |
Pau Espin Pedrol | 54681c3 | 2020-01-23 21:59:23 +0100 | [diff] [blame] | 140 | printf("*** %s ***\n", __func__); |
Pau Espin Pedrol | 5e300ce | 2020-02-03 17:18:03 +0100 | [diff] [blame] | 141 | |
Max | d3a0d91 | 2019-03-05 16:15:01 +0100 | [diff] [blame] | 142 | struct msgb *m = msgb_alloc(80, "test"); |
| 143 | static uint8_t exp[] = { 0x7f, 0xff, 0xff, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
Alexander Couzens | ccde5c9 | 2017-02-04 03:10:08 +0100 | [diff] [blame] | 144 | bitvec *vector = bitvec_alloc(23, test_ctx); |
Pau Espin Pedrol | 5e300ce | 2020-02-03 17:18:03 +0100 | [diff] [blame] | 145 | int rc; |
Aravind Sirsikar | 9f5f008 | 2016-08-30 13:20:23 +0530 | [diff] [blame] | 146 | |
| 147 | bitvec_unhex(vector, "40200bffd161003e0e519ffffffb800000000000000000"); |
| 148 | RlcMacUplink_t data; |
Pau Espin Pedrol | 99c437b | 2020-01-24 12:34:50 +0100 | [diff] [blame] | 149 | memset(&data, 0, sizeof(data)); |
Aravind Sirsikar | 9f5f008 | 2016-08-30 13:20:23 +0530 | [diff] [blame] | 150 | |
| 151 | EGPRS_AckNack_Desc_t *urbb = |
| 152 | &data.u.Egprs_Packet_Downlink_Ack_Nack.EGPRS_AckNack.Desc; |
Pau Espin Pedrol | 5e300ce | 2020-02-03 17:18:03 +0100 | [diff] [blame] | 153 | rc = decode_gsm_rlcmac_uplink(vector, &data); |
| 154 | OSMO_ASSERT(rc == 0); |
Aravind Sirsikar | 9f5f008 | 2016-08-30 13:20:23 +0530 | [diff] [blame] | 155 | |
Max | d3a0d91 | 2019-03-05 16:15:01 +0100 | [diff] [blame] | 156 | memcpy(msgb_put(m, 13), urbb->URBB, 13); |
| 157 | if (!msgb_eq_data_print(m, exp, 13)) |
| 158 | printf("%s failed!\n", __func__); |
| 159 | msgb_free(m); |
Aravind Sirsikar | 9f5f008 | 2016-08-30 13:20:23 +0530 | [diff] [blame] | 160 | } |
| 161 | |
Pau Espin Pedrol | b2653fe | 2020-03-26 15:14:01 +0100 | [diff] [blame] | 162 | extern "C" { |
Pau Espin Pedrol | 007056e | 2020-03-26 15:03:33 +0100 | [diff] [blame] | 163 | int encode_gsm_ra_cap(struct bitvec *vector, MS_Radio_Access_capability_t * data); |
Pau Espin Pedrol | b2653fe | 2020-03-26 15:14:01 +0100 | [diff] [blame] | 164 | } |
Vadim Yanitskiy | b47e53b | 2020-02-20 04:33:50 +0700 | [diff] [blame] | 165 | |
Vadim Yanitskiy | 3094bb2 | 2022-08-06 02:21:45 +0700 | [diff] [blame] | 166 | static void testRAcap(void *test_ctx) |
Pau Espin Pedrol | cdbc5db | 2020-01-23 21:00:19 +0100 | [diff] [blame] | 167 | { |
Pau Espin Pedrol | 866bece | 2020-03-21 01:20:52 +0100 | [diff] [blame] | 168 | printf("*** %s ***\n", __func__); |
| 169 | MS_Radio_Access_capability_t data; |
| 170 | memset(&data, 0, sizeof(data)); |
| 171 | bitvec *bv_dec = bitvec_alloc(23, test_ctx); |
| 172 | bitvec *bv_enc = bitvec_alloc(23, test_ctx); |
| 173 | unsigned int len_dec, len_enc; |
| 174 | int rc; |
| 175 | /* |
| 176 | MS RA capability 1 |
| 177 | 0001 .... = Access Technology Type: GSM E --note that GSM E covers GSM P (1) |
| 178 | .... 0011 011. .... = Length in bits: 0x1b (27) |
| 179 | ...0 01.. RF Power Capability, GMSK Power Class: Not specified (1) |
| 180 | A5 Bits: Same values apply for parameters as in the immediately preceding Access capabilities field within this IE (0) |
| 181 | .... ...1 = Controlled early Classmark Sending: Implemented |
| 182 | 0... .... = Pseudo Synchronisation: Not Present |
| 183 | .0.. .... = Voice Group Call Service: no VGCS capability or no notifications wanted |
| 184 | ..0. .... = Voice Broadcast Service: no VBS capability or no notifications wanted |
| 185 | ...1 .... = Multislot capability struct: Present |
| 186 | HSCSD multislot class: Bits are not available (0) |
| 187 | SMS_VALUE (Switch-Measure-Switch): Bits are not available (0) |
| 188 | ECSD multislot class: Bits are not available (0) |
| 189 | DTM GPRS Multi Slot Class: Bits are not available (0) |
| 190 | .... ..00 011. .... = GPRS multislot class: Max Rx-Slot/TDMA:2 Max Tx-Slot/TDMA:2 Max-Sum-Slot/TDMA:3 Tta:3 Ttb:2 Tra:3 Trb:1 Type:1 (3) |
| 191 | ...0 .... = GPRS Extended Dynamic Allocation Capability: Not Implemented |
| 192 | .... ...0 0011 .... = EGPRS multislot class: Max Rx-Slot/TDMA:2 Max Tx-Slot/TDMA:2 Max-Sum-Slot/TDMA:3 Tta:3 Ttb:2 Tra:3 Trb:1 Type:1 (3) |
| 193 | .... 0... = EGPRS Extended Dynamic Allocation Capability: Not Implemented |
| 194 | */ |
| 195 | bitvec_unhex(bv_dec, "1365146230"); |
| 196 | |
| 197 | printf("=== Test decoding of MS RA Capability ===\n"); |
| 198 | rc = decode_gsm_ra_cap(bv_dec, &data); |
| 199 | OSMO_ASSERT(rc == 0); |
| 200 | |
| 201 | /* Make sure there's 1 value (currently fails due to failed decoding) */ |
| 202 | OSMO_ASSERT(data.Count_MS_RA_capability_value == 1); |
| 203 | |
| 204 | /* Make sure GPRS / EGPRS multislot class is parsed correctly */ |
Pau Espin Pedrol | 8a35e64 | 2021-01-18 17:14:14 +0100 | [diff] [blame] | 205 | printf("GPRS multislot class = %u\n", get_ms_class_by_capability(&data)); |
| 206 | printf("EGPRS multislot class = %u\n", get_egprs_ms_class_by_capability(&data)); |
Pau Espin Pedrol | 866bece | 2020-03-21 01:20:52 +0100 | [diff] [blame] | 207 | |
| 208 | /* Test encoding of decoded MS RA Capability */ |
| 209 | printf("=== Test encoding of MS RA Capability ===\n"); |
| 210 | rc = encode_gsm_ra_cap(bv_enc, &data); |
| 211 | printf("encode_gsm_ra_cap() returns %d\n", rc); |
| 212 | |
| 213 | bv_dec->cur_bit = 4; |
| 214 | len_dec = bitvec_get_uint(bv_dec, 7); |
| 215 | bv_enc->cur_bit = 4; |
| 216 | len_enc = bitvec_get_uint(bv_enc, 7); |
| 217 | |
| 218 | /* NOTE: vector2 is expected to be different because there is actually no |
| 219 | * way to distinguish between NULL and 0 in MS_Radio_Access_capability_t. |
| 220 | * The difference is in length indicator: 27 bits vs 65 bits. */ |
| 221 | printf("vector1 (len_ind=%u) = %s\n", len_dec, osmo_hexdump(bv_dec->data, bv_dec->data_len)); |
| 222 | printf("vector2 (len_ind=%u) = %s\n", len_enc, osmo_hexdump(bv_enc->data, bv_enc->data_len)); |
| 223 | |
| 224 | /* Mangle the length indicator (set it to 21) */ |
| 225 | unsigned int writeIndex = 4; |
| 226 | rc = bitvec_write_field(bv_dec, &writeIndex, 21, 7); |
| 227 | OSMO_ASSERT(rc == 0); |
| 228 | |
| 229 | /* Make sure decoding attempt fails */ |
| 230 | printf("=== Test decoding of a malformed vector (short length indicator) ===\n"); |
| 231 | rc = decode_gsm_ra_cap(bv_dec, &data); |
| 232 | printf("decode_gsm_ra_cap() returns %d\n", rc); |
| 233 | } |
| 234 | |
Vadim Yanitskiy | 3094bb2 | 2022-08-06 02:21:45 +0700 | [diff] [blame] | 235 | static void testMalformedRAcap(void *test_ctx) |
Pau Espin Pedrol | 866bece | 2020-03-21 01:20:52 +0100 | [diff] [blame] | 236 | { |
Pau Espin Pedrol | cdbc5db | 2020-01-23 21:00:19 +0100 | [diff] [blame] | 237 | printf("*** %s ***\n", __func__); |
| 238 | MS_Radio_Access_capability_t data; |
| 239 | memset(&data, 0, sizeof(data)); |
Vadim Yanitskiy | b47e53b | 2020-02-20 04:33:50 +0700 | [diff] [blame] | 240 | bitvec *bv_dec = bitvec_alloc(23, test_ctx); |
Pau Espin Pedrol | cdbc5db | 2020-01-23 21:00:19 +0100 | [diff] [blame] | 241 | int rc; |
| 242 | /* |
| 243 | MS RA capability 1 |
| 244 | 0001 .... = Access Technology Type: GSM E --note that GSM E covers GSM P (1) |
Vadim Yanitskiy | 55f06c3 | 2020-02-18 05:45:15 +0700 | [diff] [blame] | 245 | .... 0011 101. .... = Length in bits: 0x1d (29) |
Pau Espin Pedrol | cdbc5db | 2020-01-23 21:00:19 +0100 | [diff] [blame] | 246 | ...0 01.. RF Power Capability, GMSK Power Class: Not specified (1) |
| 247 | A5 Bits: Same values apply for parameters as in the immediately preceding Access capabilities field within this IE (0) |
| 248 | .... ...1 = Controlled early Classmark Sending: Implemented |
| 249 | 0... .... = Pseudo Synchronisation: Not Present |
| 250 | .0.. .... = Voice Group Call Service: no VGCS capability or no notifications wanted |
| 251 | ..0. .... = Voice Broadcast Service: no VBS capability or no notifications wanted |
| 252 | ...1 .... = Multislot capability struct: Present |
| 253 | .... ..00 011. .... = GPRS multislot class: Max Rx-Slot/TDMA:2 Max Tx-Slot/TDMA:2 Max-Sum-Slot/TDMA:3 Tta:3 Ttb:2 Tra:3 Trb:1 Type:1 (3) |
| 254 | ...0 .... = GPRS Extended Dynamic Allocation Capability: Not Implemented |
Pau Espin Pedrol | 866bece | 2020-03-21 01:20:52 +0100 | [diff] [blame] | 255 | |
| 256 | It doesn't show up in wireshark's tree above because specific parser is |
| 257 | used, but this RA Cap bitstream has Exist_EGPRS_multislot_class = 1 but |
| 258 | it provides no struct with the expected data (malformed, generated |
| 259 | erroneusly through TTCN3). The CSN.1 dceoder should ideally return an |
| 260 | error here, but it doesn't (it returns a >0 value which we convert to 0 |
| 261 | in decode_gsm_ra_cap()). |
Pau Espin Pedrol | cdbc5db | 2020-01-23 21:00:19 +0100 | [diff] [blame] | 262 | */ |
Vadim Yanitskiy | b47e53b | 2020-02-20 04:33:50 +0700 | [diff] [blame] | 263 | bitvec_unhex(bv_dec, "13a5146200"); |
Pau Espin Pedrol | cdbc5db | 2020-01-23 21:00:19 +0100 | [diff] [blame] | 264 | |
Vadim Yanitskiy | b47e53b | 2020-02-20 04:33:50 +0700 | [diff] [blame] | 265 | printf("=== Test decoding of MS RA Capability ===\n"); |
| 266 | rc = decode_gsm_ra_cap(bv_dec, &data); |
Pau Espin Pedrol | 866bece | 2020-03-21 01:20:52 +0100 | [diff] [blame] | 267 | printf("decode_gsm_ra_cap() returns %d\n", rc); |
Vadim Yanitskiy | 55f06c3 | 2020-02-18 05:45:15 +0700 | [diff] [blame] | 268 | OSMO_ASSERT(rc == 0); |
Pau Espin Pedrol | cdbc5db | 2020-01-23 21:00:19 +0100 | [diff] [blame] | 269 | |
Pau Espin Pedrol | 866bece | 2020-03-21 01:20:52 +0100 | [diff] [blame] | 270 | /* For sake of completeness, check if the decoder could find 1 value |
| 271 | before failing to decode it */ |
Vadim Yanitskiy | 55f06c3 | 2020-02-18 05:45:15 +0700 | [diff] [blame] | 272 | OSMO_ASSERT(data.Count_MS_RA_capability_value == 1); |
Pau Espin Pedrol | cdbc5db | 2020-01-23 21:00:19 +0100 | [diff] [blame] | 273 | |
Pau Espin Pedrol | 2f16924 | 2020-03-20 23:59:44 +0100 | [diff] [blame] | 274 | bitvec_free(bv_dec); |
Pau Espin Pedrol | cdbc5db | 2020-01-23 21:00:19 +0100 | [diff] [blame] | 275 | } |
| 276 | |
Pau Espin Pedrol | efad80b | 2020-03-23 14:35:26 +0100 | [diff] [blame] | 277 | /* Reproduce crash from ticket OS#4463 */ |
Vadim Yanitskiy | 3094bb2 | 2022-08-06 02:21:45 +0700 | [diff] [blame] | 278 | static void testRAcap2(void *test_ctx) |
Pau Espin Pedrol | efad80b | 2020-03-23 14:35:26 +0100 | [diff] [blame] | 279 | { |
| 280 | printf("*** %s ***\n", __func__); |
| 281 | MS_Radio_Access_capability_t data; |
| 282 | memset(&data, 0, sizeof(data)); |
| 283 | bitvec *bv_dec = bitvec_alloc(23, test_ctx); |
| 284 | int rc; |
| 285 | /* |
| 286 | MS Radio Access Capability |
| 287 | Element ID: 0x13 |
| 288 | 1... .... = ext: 1 |
| 289 | Length: 23 |
| 290 | ------------------------------------------- Hex bitstream starts here: |
| 291 | MS RA capability 1 |
| 292 | 0001 .... = Access Technology Type: GSM E --note that GSM E covers GSM P (1) |
| 293 | .... 1001 001. .... = Length in bits: 0x49 (73) |
| 294 | ...1 00.. RF Power Capability, GMSK Power Class: 2 W (33 dBm) (4) |
| 295 | A5 Bits: A5 bits follow (1) |
| 296 | A5/1: encryption algorithm available (1) |
| 297 | A5/2: encryption algorithm not available (0) |
| 298 | A5/3: encryption algorithm available (1) |
| 299 | A5/4: encryption algorithm not available (0) |
| 300 | A5/5: encryption algorithm not available (0) |
| 301 | A5/6: encryption algorithm not available (0) |
| 302 | A5/7: encryption algorithm not available (0) |
| 303 | .... ..1. = Controlled early Classmark Sending: Implemented |
| 304 | .... ...1 = Pseudo Synchronisation: Present |
| 305 | 0... .... = Voice Group Call Service: no VGCS capability or no notifications wanted |
| 306 | .0.. .... = Voice Broadcast Service: no VBS capability or no notifications wanted |
| 307 | ..1. .... = Multislot capability struct: Present |
| 308 | HSCSD multislot class: Bits are not available (0) |
| 309 | .... 0111 = SMS_VALUE (Switch-Measure-Switch): 8/4 timeslot (~1154 microseconds) (7) |
| 310 | 0001 .... = (SM_VALUE) Switch-Measure: 2/4 timeslot (~288 microseconds) (1) |
| 311 | ECSD multislot class: Bits are not available (0) |
| 312 | .... ...0 = Single Slot DTM: Not supported |
| 313 | 1... .... = DTM EGPRS Multi Slot Class: Present |
| 314 | .... .011 00.. .... = GPRS multislot class: Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:5 Tta:2 Ttb:1 Tra:2 Trb:1 Type:1 (12) |
| 315 | ..1. .... = GPRS Extended Dynamic Allocation Capability: Implemented |
| 316 | .... ..01 100. .... = EGPRS multislot class: Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:5 Tta:2 Ttb:1 Tra:2 Trb:1 Type:1 (12) |
| 317 | ...1 .... = EGPRS Extended Dynamic Allocation Capability: Implemented |
| 318 | .... .11. = DTM GPRS Multi Slot Class: Multislot class 11 supported (3) |
| 319 | .11. .... = DTM EGPRS Multi Slot Class: Multislot class 11 supported (3) |
| 320 | ...1 .... = 8PSK Power Capability Bits: Present |
| 321 | 8PSK Power Capability: Power class E2 (2) |
| 322 | .... ..0. = COMPACT Interference Measurement Capability: Not Implemented |
| 323 | .... ...1 = Revision Level Indicator: The ME is Release '99 onwards |
| 324 | 0... .... = UMTS FDD Radio Access Technology Capability: Not supported |
| 325 | .0.. .... = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported |
| 326 | ..0. .... = CDMA 2000 Radio Access Technology Capability: Not supported |
| 327 | ...0 .... = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported |
| 328 | .... 1... = GERAN Feature Package 1: Supported |
| 329 | Extended DTM EGPRS Multi Slot Class: Bits are not available (0) |
| 330 | .... ..0. = Modulation based multislot class support: Not supported |
| 331 | High Multislot Capability: Bits are not available (0) |
| 332 | 0... .... = GERAN Iu mode: Not supported |
| 333 | GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 3 (3) |
| 334 | 8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 3 (3) |
| 335 | .... .0.. = Multiple TBF Capability: Not supported |
| 336 | .... ..01 = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance - phase I supported (1) |
| 337 | 1... .... = Extended RLC/MAC Control Message Segmentation Capability: Supported |
| 338 | .1.. .... = DTM Enhancements Capability: The mobile station supports enhanced DTM CS establishment and enhanced DTM CS release procedures |
| 339 | ...0 .... = PS Handover Capability: Not supported |
| 340 | MS RA capability 2 |
| 341 | .... .011 1... .... = Access Technology Type: GSM 850 (7) |
| 342 | .010 0010 = Length in bits: 0x22 (34) |
| 343 | 100. .... RF Power Capability, GMSK Power Class: 2 W (33 dBm) (4) |
| 344 | A5 Bits: Same values apply for parameters as in the immediately preceding Access capabilities field within this IE (0) |
| 345 | .... 1... = Controlled early Classmark Sending: Implemented |
| 346 | .... .1.. = Pseudo Synchronisation: Present |
| 347 | .... ..0. = Voice Group Call Service: no VGCS capability or no notifications wanted |
| 348 | .... ...0 = Voice Broadcast Service: no VBS capability or no notifications wanted |
| 349 | 0... .... = Multislot capability struct: Not Present |
| 350 | .1.. .... = 8PSK Power Capability Bits: Present |
| 351 | 8PSK Power Capability: Power class E2 (2) |
| 352 | .... 0... = COMPACT Interference Measurement Capability: Not Implemented |
| 353 | .... .1.. = Revision Level Indicator: The ME is Release '99 onwards |
| 354 | .... ..0. = UMTS FDD Radio Access Technology Capability: Not supported |
| 355 | .... ...0 = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported |
| 356 | 0... .... = CDMA 2000 Radio Access Technology Capability: Not supported |
| 357 | .0.. .... = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported |
| 358 | ..1. .... = GERAN Feature Package 1: Supported |
| 359 | Extended DTM EGPRS Multi Slot Class: Bits are not available (0) |
| 360 | .... 0... = Modulation based multislot class support: Not supported |
| 361 | High Multislot Capability: Bits are not available (0) |
| 362 | .... ..0. = GERAN Iu mode: Not supported |
| 363 | GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 3 (3) |
| 364 | 8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 3 (3) |
| 365 | ...0 .... = Multiple TBF Capability: Not supported |
| 366 | .... 01.. = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance - phase I supported (1) |
| 367 | .... ..1. = Extended RLC/MAC Control Message Segmentation Capability: Supported |
| 368 | .... ...1 = DTM Enhancements Capability: The mobile station supports enhanced DTM CS establishment and enhanced DTM CS release procedures |
| 369 | .0.. .... = PS Handover Capability: Not supported |
| 370 | MS RA capability 3 |
| 371 | ...0 011. = Access Technology Type: GSM 1800 (3) |
| 372 | .... ...0 1000 10.. = Length in bits: 0x22 (34) |
| 373 | .... ..00 1... .... RF Power Capability, GMSK Power Class: 1 W (30 dBm) (1) |
| 374 | A5 Bits: Same values apply for parameters as in the immediately preceding Access capabilities field within this IE (0) |
| 375 | ..1. .... = Controlled early Classmark Sending: Implemented |
| 376 | ...1 .... = Pseudo Synchronisation: Present |
| 377 | .... 0... = Voice Group Call Service: no VGCS capability or no notifications wanted |
| 378 | .... .0.. = Voice Broadcast Service: no VBS capability or no notifications wanted |
| 379 | .... ..0. = Multislot capability struct: Not Present |
| 380 | .... ...1 = 8PSK Power Capability Bits: Present |
| 381 | 8PSK Power Capability: Power class E2 (2) |
| 382 | ..0. .... = COMPACT Interference Measurement Capability: Not Implemented |
| 383 | ...1 .... = Revision Level Indicator: The ME is Release '99 onwards |
| 384 | .... 0... = UMTS FDD Radio Access Technology Capability: Not supported |
| 385 | .... .0.. = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported |
| 386 | .... ..0. = CDMA 2000 Radio Access Technology Capability: Not supported |
| 387 | .... ...0 = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported |
| 388 | 1... .... = GERAN Feature Package 1: Supported |
| 389 | Extended DTM EGPRS Multi Slot Class: Bits are not available (0) |
| 390 | ..0. .... = Modulation based multislot class support: Not supported |
| 391 | High Multislot Capability: Bits are not available (0) |
| 392 | .... 0... = GERAN Iu mode: Not supported |
| 393 | GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 3 (3) |
| 394 | 8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 3 (3) |
| 395 | .0.. .... = Multiple TBF Capability: Not supported |
| 396 | ..01 .... = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance - phase I supported (1) |
| 397 | .... 1... = Extended RLC/MAC Control Message Segmentation Capability: Supported |
| 398 | .... .1.. = DTM Enhancements Capability: The mobile station supports enhanced DTM CS establishment and enhanced DTM CS release procedures |
| 399 | .... ...0 = PS Handover Capability: Not supported |
| 400 | */ |
| 401 | bitvec_unhex(bv_dec, "1933432b37159ef90879cba28c6421e72688b190879c00"); |
| 402 | |
| 403 | printf("=== Test decoding of multi-band MS RA Capability ===\n"); |
| 404 | rc = decode_gsm_ra_cap(bv_dec, &data); |
Pau Espin Pedrol | 7faa5da | 2020-03-21 00:13:33 +0100 | [diff] [blame] | 405 | printf("decode_gsm_ra_cap() returns %d\n", rc); |
| 406 | OSMO_ASSERT(rc == 0); |
| 407 | |
| 408 | /* Make sure there's 3 values */ |
Pau Espin Pedrol | efad80b | 2020-03-23 14:35:26 +0100 | [diff] [blame] | 409 | OSMO_ASSERT(data.Count_MS_RA_capability_value == 3); |
| 410 | |
| 411 | /* Make sure GPRS / EGPRS multislot class is parsed correctly */ |
Pau Espin Pedrol | 8a35e64 | 2021-01-18 17:14:14 +0100 | [diff] [blame] | 412 | printf("GPRS multislot class = %u\n", get_ms_class_by_capability(&data)); |
| 413 | printf("EGPRS multislot class = %u\n", get_egprs_ms_class_by_capability(&data)); |
Pau Espin Pedrol | 7faa5da | 2020-03-21 00:13:33 +0100 | [diff] [blame] | 414 | |
Pau Espin Pedrol | efad80b | 2020-03-23 14:35:26 +0100 | [diff] [blame] | 415 | bitvec_free(bv_dec); |
| 416 | } |
| 417 | |
Pau Espin Pedrol | 2282b50 | 2021-10-07 12:19:01 +0200 | [diff] [blame] | 418 | /* RAcap larger than 23 bytes */ |
Vadim Yanitskiy | 3094bb2 | 2022-08-06 02:21:45 +0700 | [diff] [blame] | 419 | static void testRAcap3(void *test_ctx) |
Pau Espin Pedrol | 2282b50 | 2021-10-07 12:19:01 +0200 | [diff] [blame] | 420 | { |
| 421 | printf("*** %s ***\n", __func__); |
| 422 | MS_Radio_Access_capability_t data; |
| 423 | memset(&data, 0, sizeof(data)); |
| 424 | bitvec *bv_dec = bitvec_alloc(31, test_ctx); |
| 425 | int rc; |
| 426 | /* |
| 427 | MS Radio Access Capability |
| 428 | Element ID: 0x13 |
| 429 | 1... .... = ext: 1 |
| 430 | Length: 31 |
| 431 | ------------------------------------------- Hex bitstream starts here: |
| 432 | MS RA capability 1 |
| 433 | 0001 .... = Access Technology Type: GSM E --note that GSM E covers GSM P (1) |
| 434 | .... 1010 111. .... = Length in bits: 0x57 (87) |
| 435 | ...1 00.. RF Power Capability, GMSK Power Class: 2 W (33 dBm) (4) |
| 436 | A5 Bits: A5 bits follow (1) |
| 437 | A5/1: encryption algorithm available (1) |
| 438 | A5/2: encryption algorithm not available (0) |
| 439 | A5/3: encryption algorithm available (1) |
| 440 | A5/4: encryption algorithm not available (0) |
| 441 | A5/5: encryption algorithm not available (0) |
| 442 | A5/6: encryption algorithm not available (0) |
| 443 | A5/7: encryption algorithm not available (0) |
| 444 | .... ..1. = Controlled early Classmark Sending: Implemented |
| 445 | .... ...1 = Pseudo Synchronisation: Present |
| 446 | 0... .... = Voice Group Call Service: no VGCS capability or no notifications wanted |
| 447 | .0.. .... = Voice Broadcast Service: no VBS capability or no notifications wanted |
| 448 | ..1. .... = Multislot capability struct: Present |
| 449 | HSCSD multislot class: Bits are not available (0) |
| 450 | SMS_VALUE (Switch-Measure-Switch): Bits are not available (0) |
| 451 | ECSD multislot class: Bits are not available (0) |
| 452 | DTM GPRS Multi Slot Class: Bits are not available (0) |
| 453 | .... .011 00.. .... = GPRS multislot class: Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:5 Tta:2 Ttb:1 Tra:2 Trb:1 Type:1 (12) |
| 454 | ..1. .... = GPRS Extended Dynamic Allocation Capability: Implemented |
| 455 | .... ..01 100. .... = EGPRS multislot class: Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:5 Tta:2 Ttb:1 Tra:2 Trb:1 Type:1 (12) |
| 456 | ...1 .... = EGPRS Extended Dynamic Allocation Capability: Implemented |
| 457 | .... .1.. = 8PSK Power Capability Bits: Present |
| 458 | 8PSK Power Capability: Power class E2 (2) |
| 459 | 0... .... = COMPACT Interference Measurement Capability: Not Implemented |
| 460 | .1.. .... = Revision Level Indicator: The ME is Release '99 onwards |
| 461 | ..0. .... = UMTS FDD Radio Access Technology Capability: Not supported |
| 462 | ...0 .... = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported |
| 463 | .... 0... = CDMA 2000 Radio Access Technology Capability: Not supported |
| 464 | .... .0.. = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported |
| 465 | .... ..1. = GERAN Feature Package 1: Supported |
| 466 | Extended DTM EGPRS Multi Slot Class: Bits are not available (0) |
| 467 | 0... .... = Modulation based multislot class support: Not supported |
| 468 | High Multislot Capability: 0x00 (0) - This field effect all other multislot fields. To understand the value please read TS 24.008 5.6.0 Release 5 Chap 10.5.5.12 Page 406 |
| 469 | .... 0... = GERAN Iu mode: Not supported |
| 470 | GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 0 (0) |
| 471 | 8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 0 (0) |
| 472 | .0.. .... = Multiple TBF Capability: Not supported |
| 473 | ..01 .... = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance - phase I supported (1) |
| 474 | .... 0... = Extended RLC/MAC Control Message Segmentation Capability: Not supported |
| 475 | .... .0.. = DTM Enhancements Capability: The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures |
| 476 | .... ...0 = PS Handover Capability: Not supported |
| 477 | 0... .... = DTM Handover Capability: Not supported |
| 478 | ..0. .... = Flexible Timeslot Assignment: Not supported |
| 479 | ...0 .... = GAN PS Handover Capability: Not supported |
| 480 | .... 0... = RLC Non-persistent Mode: Not supported |
| 481 | .... .0.. = Reduced Latency Capability: Not supported |
| 482 | .... ..00 = Uplink EGPRS2: The mobile station does not support either EGPRS2-A or EGPRS2-B in the uplink (0) |
| 483 | 00.. .... = Downlink EGPRS2: The mobile station does not support either EGPRS2-A or EGPRS2-B in the downlink (0) |
| 484 | ..0. .... = E-UTRA FDD support: Not supported |
| 485 | ...0 .... = E-UTRA TDD support: Not supported |
| 486 | .... 00.. = GERAN to E-UTRA support in GERAN packet transfer mode: None (0) |
| 487 | .... ..0. = Priority-based reselection support: Not supported |
| 488 | 0... .... = Indication of Upper Layer PDU Start Capability for RLC UM: Not supported |
| 489 | .0.. .... = Enhanced Multiplexing for Single TBF Capability: Not supported |
| 490 | ..0. .... = Multiple TTI Capability: Not supported |
| 491 | ...0 .... = Reporting of UTRAN CSG cells in packet transfer mode: Not supported |
| 492 | .... 0... = Reporting of E-UTRAN CSG cells in packet transfer mode: Not supported |
| 493 | .... .0.. = Dynamic Timeslot Reduction Capability: Not supported |
| 494 | .... ..0. = Enhanced Multiplexing for Single RLC Entity Capability: Not supported |
| 495 | .... ...0 = Fast Downlink Frequency Switching Capability: Not supported |
| 496 | 01.. .... = TIGHTER Capability: TIGHTER supported for speech and signalling channels only (1) |
| 497 | MS RA capability 2 |
| 498 | ...0 111. = Access Technology Type: GSM 850 (7) |
| 499 | .... ...0 1111 10.. = Length in bits: 0x3e (62) |
| 500 | .... ..10 0... .... RF Power Capability, GMSK Power Class: 2 W (33 dBm) (4) |
| 501 | A5 Bits: Same values apply for parameters as in the immediately preceding Access capabilities field within this IE (0) |
| 502 | ..1. .... = Controlled early Classmark Sending: Implemented |
| 503 | ...1 .... = Pseudo Synchronisation: Present |
| 504 | .... 0... = Voice Group Call Service: no VGCS capability or no notifications wanted |
| 505 | .... .0.. = Voice Broadcast Service: no VBS capability or no notifications wanted |
| 506 | .... ..0. = Multislot capability struct: Not Present |
| 507 | .... ...1 = 8PSK Power Capability Bits: Present |
| 508 | 8PSK Power Capability: Power class E2 (2) |
| 509 | ..0. .... = COMPACT Interference Measurement Capability: Not Implemented |
| 510 | ...1 .... = Revision Level Indicator: The ME is Release '99 onwards |
| 511 | .... 0... = UMTS FDD Radio Access Technology Capability: Not supported |
| 512 | .... .0.. = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported |
| 513 | .... ..0. = CDMA 2000 Radio Access Technology Capability: Not supported |
| 514 | .... ...0 = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported |
| 515 | 1... .... = GERAN Feature Package 1: Supported |
| 516 | Extended DTM EGPRS Multi Slot Class: Bits are not available (0) |
| 517 | ..0. .... = Modulation based multislot class support: Not supported |
| 518 | High Multislot Capability: 0x00 (0) - This field effect all other multislot fields. To understand the value please read TS 24.008 5.6.0 Release 5 Chap 10.5.5.12 Page 406 |
| 519 | .... ..0. = GERAN Iu mode: Not supported |
| 520 | GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 0 (0) |
| 521 | 8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 0 (0) |
| 522 | ...0 .... = Multiple TBF Capability: Not supported |
| 523 | .... 01.. = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance - phase I supported (1) |
| 524 | .... ..0. = Extended RLC/MAC Control Message Segmentation Capability: Not supported |
| 525 | .... ...0 = DTM Enhancements Capability: The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures |
| 526 | .0.. .... = PS Handover Capability: Not supported |
| 527 | ..0. .... = DTM Handover Capability: Not supported |
| 528 | .... 0... = Flexible Timeslot Assignment: Not supported |
| 529 | .... .0.. = GAN PS Handover Capability: Not supported |
| 530 | .... ..0. = RLC Non-persistent Mode: Not supported |
| 531 | .... ...0 = Reduced Latency Capability: Not supported |
| 532 | 00.. .... = Uplink EGPRS2: The mobile station does not support either EGPRS2-A or EGPRS2-B in the uplink (0) |
| 533 | ..00 .... = Downlink EGPRS2: The mobile station does not support either EGPRS2-A or EGPRS2-B in the downlink (0) |
| 534 | .... 0... = E-UTRA FDD support: Not supported |
| 535 | .... .0.. = E-UTRA TDD support: Not supported |
| 536 | .... ..00 = GERAN to E-UTRA support in GERAN packet transfer mode: None (0) |
| 537 | 0... .... = Priority-based reselection support: Not supported |
| 538 | ..0. .... = Indication of Upper Layer PDU Start Capability for RLC UM: Not supported |
| 539 | ...0 .... = Enhanced Multiplexing for Single TBF Capability: Not supported |
| 540 | .... 0... = Multiple TTI Capability: Not supported |
| 541 | .... .0.. = Reporting of UTRAN CSG cells in packet transfer mode: Not supported |
| 542 | .... ..0. = Reporting of E-UTRAN CSG cells in packet transfer mode: Not supported |
| 543 | .... ...0 = Dynamic Timeslot Reduction Capability: Not supported |
| 544 | 0... .... = Enhanced Multiplexing for Single RLC Entity Capability: Not supported |
| 545 | .0.. .... = Fast Downlink Frequency Switching Capability: Not supported |
| 546 | ..01 .... = TIGHTER Capability: TIGHTER supported for speech and signalling channels only (1) |
| 547 | MS RA capability 3 |
| 548 | .... .010 0... .... = Access Technology Type: GSM 1900 (4) |
| 549 | .011 1110 = Length in bits: 0x3e (62) |
| 550 | 001. .... RF Power Capability, GMSK Power Class: 1 W (30 dBm) (1) |
| 551 | A5 Bits: Same values apply for parameters as in the immediately preceding Access capabilities field within this IE (0) |
| 552 | .... 1... = Controlled early Classmark Sending: Implemented |
| 553 | .... .1.. = Pseudo Synchronisation: Present |
| 554 | .... ..0. = Voice Group Call Service: no VGCS capability or no notifications wanted |
| 555 | .... ...0 = Voice Broadcast Service: no VBS capability or no notifications wanted |
| 556 | 0... .... = Multislot capability struct: Not Present |
| 557 | .1.. .... = 8PSK Power Capability Bits: Present |
| 558 | 8PSK Power Capability: Power class E2 (2) |
| 559 | .... 0... = COMPACT Interference Measurement Capability: Not Implemented |
| 560 | .... .1.. = Revision Level Indicator: The ME is Release '99 onwards |
| 561 | .... ..0. = UMTS FDD Radio Access Technology Capability: Not supported |
| 562 | .... ...0 = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported |
| 563 | 0... .... = CDMA 2000 Radio Access Technology Capability: Not supported |
| 564 | .0.. .... = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported |
| 565 | ..1. .... = GERAN Feature Package 1: Supported |
| 566 | Extended DTM EGPRS Multi Slot Class: Bits are not available (0) |
| 567 | .... 0... = Modulation based multislot class support: Not supported |
| 568 | High Multislot Capability: 0x00 (0) - This field effect all other multislot fields. To understand the value please read TS 24.008 5.6.0 Release 5 Chap 10.5.5.12 Page 406 |
| 569 | 0... .... = GERAN Iu mode: Not supported |
| 570 | GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 0 (0) |
| 571 | 8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 0 (0) |
| 572 | .... .0.. = Multiple TBF Capability: Not supported |
| 573 | .... ..01 = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance - phase I supported (1) |
| 574 | 0... .... = Extended RLC/MAC Control Message Segmentation Capability: Not supported |
| 575 | .0.. .... = DTM Enhancements Capability: The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures |
| 576 | ...0 .... = PS Handover Capability: Not supported |
| 577 | .... 0... = DTM Handover Capability: Not supported |
| 578 | .... ..0. = Flexible Timeslot Assignment: Not supported |
| 579 | .... ...0 = GAN PS Handover Capability: Not supported |
| 580 | 0... .... = RLC Non-persistent Mode: Not supported |
| 581 | .0.. .... = Reduced Latency Capability: Not supported |
| 582 | ..00 .... = Uplink EGPRS2: The mobile station does not support either EGPRS2-A or EGPRS2-B in the uplink (0) |
| 583 | .... 00.. = Downlink EGPRS2: The mobile station does not support either EGPRS2-A or EGPRS2-B in the downlink (0) |
| 584 | .... ..0. = E-UTRA FDD support: Not supported |
| 585 | .... ...0 = E-UTRA TDD support: Not supported |
| 586 | 00.. .... = GERAN to E-UTRA support in GERAN packet transfer mode: None (0) |
| 587 | ..0. .... = Priority-based reselection support: Not supported |
| 588 | .... 0... = Indication of Upper Layer PDU Start Capability for RLC UM: Not supported |
| 589 | .... .0.. = Enhanced Multiplexing for Single TBF Capability: Not supported |
| 590 | .... ..0. = Multiple TTI Capability: Not supported |
| 591 | .... ...0 = Reporting of UTRAN CSG cells in packet transfer mode: Not supported |
| 592 | 0... .... = Reporting of E-UTRAN CSG cells in packet transfer mode: Not supported |
| 593 | .0.. .... = Dynamic Timeslot Reduction Capability: Not supported |
| 594 | ..0. .... = Enhanced Multiplexing for Single RLC Entity Capability: Not supported |
| 595 | ...0 .... = Fast Downlink Frequency Switching Capability: Not supported |
| 596 | .... 01.. = TIGHTER Capability: TIGHTER supported for speech and signalling channels only (1) |
| 597 | */ |
| 598 | bitvec_unhex(bv_dec, "1af3432b25964240100000006efa319090040000001a3e2c64240100000004"); |
| 599 | |
| 600 | printf("=== Test decoding of MS RA Capability 3===\n"); |
| 601 | rc = decode_gsm_ra_cap(bv_dec, &data); |
| 602 | printf("decode_gsm_ra_cap() returns %d\n", rc); |
| 603 | OSMO_ASSERT(rc == 0); |
| 604 | |
| 605 | /* Make sure there's 3 values */ |
| 606 | OSMO_ASSERT(data.Count_MS_RA_capability_value == 3); |
| 607 | |
| 608 | /* Make sure GPRS / EGPRS multislot class is parsed correctly */ |
| 609 | printf("GPRS multislot class = %u\n", get_ms_class_by_capability(&data)); |
| 610 | printf("EGPRS multislot class = %u\n", get_egprs_ms_class_by_capability(&data)); |
| 611 | |
| 612 | bitvec_free(bv_dec); |
| 613 | } |
| 614 | |
Pau Espin Pedrol | 089d734 | 2021-10-07 18:30:30 +0200 | [diff] [blame] | 615 | /* RAcap larger than 23 bytes */ |
Vadim Yanitskiy | 3094bb2 | 2022-08-06 02:21:45 +0700 | [diff] [blame] | 616 | static void testRAcap4(void *test_ctx) |
Pau Espin Pedrol | 089d734 | 2021-10-07 18:30:30 +0200 | [diff] [blame] | 617 | { |
| 618 | printf("*** %s ***\n", __func__); |
| 619 | MS_Radio_Access_capability_t data; |
| 620 | memset(&data, 0, sizeof(data)); |
| 621 | bitvec *bv_dec = bitvec_alloc(22, test_ctx); |
| 622 | int rc; |
| 623 | |
| 624 | /* |
| 625 | MS Radio Access Capability |
| 626 | Element ID: 0x13 |
| 627 | 1... .... = ext: 1 |
| 628 | Length: 22 |
| 629 | ------------------------------------------- Hex bitstream starts here: |
| 630 | MS RA capability 1 |
| 631 | 0001 .... = Access Technology Type: GSM E --note that GSM E covers GSM P (1) |
| 632 | .... 0111 101. .... = Length in bits: 0x3d (61) |
| 633 | ...1 00.. RF Power Capability, GMSK Power Class: 2 W (33 dBm) (4) |
| 634 | A5 Bits: A5 bits follow (1) |
| 635 | A5/1: encryption algorithm available (1) |
| 636 | A5/2: encryption algorithm not available (0) |
| 637 | A5/3: encryption algorithm available (1) |
| 638 | A5/4: encryption algorithm not available (0) |
| 639 | A5/5: encryption algorithm not available (0) |
| 640 | A5/6: encryption algorithm not available (0) |
| 641 | A5/7: encryption algorithm not available (0) |
| 642 | .... ..1. = Controlled early Classmark Sending: Implemented |
| 643 | .... ...1 = Pseudo Synchronisation: Present |
| 644 | 0... .... = Voice Group Call Service: no VGCS capability or no notifications wanted |
| 645 | .0.. .... = Voice Broadcast Service: no VBS capability or no notifications wanted |
| 646 | ..1. .... = Multislot capability struct: Present |
| 647 | HSCSD multislot class: Bits are not available (0) |
| 648 | SMS_VALUE (Switch-Measure-Switch): Bits are not available (0) |
| 649 | ECSD multislot class: Bits are not available (0) |
| 650 | DTM GPRS Multi Slot Class: Bits are not available (0) |
| 651 | .... .011 00.. .... = GPRS multislot class: Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:5 Tta:2 Ttb:1 Tra:2 Trb:1 Type:1 (12) |
| 652 | ..1. .... = GPRS Extended Dynamic Allocation Capability: Implemented |
| 653 | .... ..01 100. .... = EGPRS multislot class: Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:5 Tta:2 Ttb:1 Tra:2 Trb:1 Type:1 (12) |
| 654 | ...1 .... = EGPRS Extended Dynamic Allocation Capability: Implemented |
| 655 | .... .1.. = 8PSK Power Capability Bits: Present |
| 656 | 8PSK Power Capability: Power class E2 (2) |
| 657 | 0... .... = COMPACT Interference Measurement Capability: Not Implemented |
| 658 | .1.. .... = Revision Level Indicator: The ME is Release '99 onwards |
| 659 | ..1. .... = UMTS FDD Radio Access Technology Capability: Supported |
| 660 | ...0 .... = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported |
| 661 | .... 0... = CDMA 2000 Radio Access Technology Capability: Not supported |
| 662 | .... .0.. = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported |
| 663 | .... ..1. = GERAN Feature Package 1: Supported |
| 664 | Extended DTM EGPRS Multi Slot Class: Bits are not available (0) |
| 665 | 0... .... = Modulation based multislot class support: Not supported |
| 666 | High Multislot Capability: Bits are not available (0) |
| 667 | ..0. .... = GERAN Iu mode: Not supported |
| 668 | GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 0 (0) |
| 669 | 8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 0 (0) |
| 670 | .... ...0 = Multiple TBF Capability: Not supported |
| 671 | 00.. .... = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance not supported (0) |
| 672 | ..0. .... = Extended RLC/MAC Control Message Segmentation Capability: Not supported |
| 673 | ...0 .... = DTM Enhancements Capability: The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures |
| 674 | .... .0.. = PS Handover Capability: Not supported |
| 675 | .... ..0. = DTM Handover Capability: Not supported |
| 676 | MS RA capability 2 |
| 677 | .001 1... = Access Technology Type: GSM 1800 (3) |
| 678 | .... .010 0100 .... = Length in bits: 0x24 (36) |
| 679 | .... 001. RF Power Capability, GMSK Power Class: 1 W (30 dBm) (1) |
| 680 | A5 Bits: Same values apply for parameters as in the immediately preceding Access capabilities field within this IE (0) |
| 681 | 1... .... = Controlled early Classmark Sending: Implemented |
| 682 | .1.. .... = Pseudo Synchronisation: Present |
| 683 | ..0. .... = Voice Group Call Service: no VGCS capability or no notifications wanted |
| 684 | ...0 .... = Voice Broadcast Service: no VBS capability or no notifications wanted |
| 685 | .... 0... = Multislot capability struct: Not Present |
| 686 | .... .1.. = 8PSK Power Capability Bits: Present |
| 687 | 8PSK Power Capability: Power class E2 (2) |
| 688 | 0... .... = COMPACT Interference Measurement Capability: Not Implemented |
| 689 | .1.. .... = Revision Level Indicator: The ME is Release '99 onwards |
| 690 | ..1. .... = UMTS FDD Radio Access Technology Capability: Supported |
| 691 | ...0 .... = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported |
| 692 | .... 0... = CDMA 2000 Radio Access Technology Capability: Not supported |
| 693 | .... .0.. = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported |
| 694 | .... ..1. = GERAN Feature Package 1: Supported |
| 695 | Extended DTM EGPRS Multi Slot Class: Bits are not available (0) |
| 696 | 0... .... = Modulation based multislot class support: Not supported |
| 697 | High Multislot Capability: Bits are not available (0) |
| 698 | ..0. .... = GERAN Iu mode: Not supported |
| 699 | GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 0 (0) |
| 700 | 8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 0 (0) |
| 701 | .... ...0 = Multiple TBF Capability: Not supported |
| 702 | 00.. .... = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance not supported (0) |
| 703 | ..0. .... = Extended RLC/MAC Control Message Segmentation Capability: Not supported |
| 704 | ...0 .... = DTM Enhancements Capability: The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures |
| 705 | .... .0.. = PS Handover Capability: Not supported |
| 706 | .... ..0. = DTM Handover Capability: Not supported |
| 707 | MS RA capability 3 |
| 708 | .011 1... = Access Technology Type: GSM 850 (7) |
| 709 | .... .010 0100 .... = Length in bits: 0x24 (36) |
| 710 | .... 100. RF Power Capability, GMSK Power Class: 2 W (33 dBm) (4) |
| 711 | A5 Bits: Same values apply for parameters as in the immediately preceding Access capabilities field within this IE (0) |
| 712 | 1... .... = Controlled early Classmark Sending: Implemented |
| 713 | .1.. .... = Pseudo Synchronisation: Present |
| 714 | ..0. .... = Voice Group Call Service: no VGCS capability or no notifications wanted |
| 715 | ...0 .... = Voice Broadcast Service: no VBS capability or no notifications wanted |
| 716 | .... 0... = Multislot capability struct: Not Present |
| 717 | .... .1.. = 8PSK Power Capability Bits: Present |
| 718 | 8PSK Power Capability: Power class E2 (2) |
| 719 | 0... .... = COMPACT Interference Measurement Capability: Not Implemented |
| 720 | .1.. .... = Revision Level Indicator: The ME is Release '99 onwards |
| 721 | ..1. .... = UMTS FDD Radio Access Technology Capability: Supported |
| 722 | ...0 .... = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported |
| 723 | .... 0... = CDMA 2000 Radio Access Technology Capability: Not supported |
| 724 | .... .0.. = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported |
| 725 | .... ..1. = GERAN Feature Package 1: Supported |
| 726 | Extended DTM EGPRS Multi Slot Class: Bits are not available (0) |
| 727 | 0... .... = Modulation based multislot class support: Not supported |
| 728 | High Multislot Capability: Bits are not available (0) |
| 729 | ..0. .... = GERAN Iu mode: Not supported |
| 730 | GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 0 (0) |
| 731 | 8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 0 (0) |
| 732 | .... ...0 = Multiple TBF Capability: Not supported |
| 733 | 00.. .... = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance not supported (0) |
| 734 | ..0. .... = Extended RLC/MAC Control Message Segmentation Capability: Not supported |
| 735 | ...0 .... = DTM Enhancements Capability: The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures |
| 736 | .... .0.. = PS Handover Capability: Not supported |
| 737 | .... ..0. = DTM Handover Capability: Not supported |
| 738 | */ |
| 739 | |
| 740 | bitvec_unhex(bv_dec, "17b3432b25966200019a42c6620001ba48c662000100"); |
| 741 | |
| 742 | printf("=== Test decoding of MS RA Capability 4===\n"); |
| 743 | rc = decode_gsm_ra_cap(bv_dec, &data); |
| 744 | printf("decode_gsm_ra_cap() returns %d\n", rc); |
Pau Espin Pedrol | ebdc0d8 | 2021-10-19 16:48:16 +0200 | [diff] [blame] | 745 | OSMO_ASSERT(rc == 0); |
Pau Espin Pedrol | 089d734 | 2021-10-07 18:30:30 +0200 | [diff] [blame] | 746 | |
| 747 | /* Make sure there's 3 values */ |
Pau Espin Pedrol | ebdc0d8 | 2021-10-19 16:48:16 +0200 | [diff] [blame] | 748 | OSMO_ASSERT(data.Count_MS_RA_capability_value == 3); |
Pau Espin Pedrol | 089d734 | 2021-10-07 18:30:30 +0200 | [diff] [blame] | 749 | |
| 750 | /* Make sure GPRS / EGPRS multislot class is parsed correctly */ |
Pau Espin Pedrol | ebdc0d8 | 2021-10-19 16:48:16 +0200 | [diff] [blame] | 751 | printf("GPRS multislot class = %u\n", get_ms_class_by_capability(&data)); |
| 752 | printf("EGPRS multislot class = %u\n", get_egprs_ms_class_by_capability(&data)); |
Pau Espin Pedrol | 089d734 | 2021-10-07 18:30:30 +0200 | [diff] [blame] | 753 | |
| 754 | bitvec_free(bv_dec); |
| 755 | } |
| 756 | |
Vadim Yanitskiy | 3094bb2 | 2022-08-06 02:21:45 +0700 | [diff] [blame] | 757 | static void testEGPRSPktChReq(void *test_ctx) |
Vadim Yanitskiy | a2d972a | 2020-04-04 03:44:35 +0700 | [diff] [blame] | 758 | { |
| 759 | EGPRS_PacketChannelRequest_t req; |
| 760 | int rc; |
| 761 | |
| 762 | printf("*** %s ***\n", __func__); |
| 763 | |
| 764 | static const uint16_t EGPRSPktChReqs[] = { |
| 765 | /* < One Phase Access Request : '0'B |
| 766 | < MultislotClass : '10101'B > |
| 767 | < Priority : '10'B > |
| 768 | < RandomBits : '101'B > > */ |
| 769 | 0x2b5, |
| 770 | /* < One Phase Access Request : '0'B |
| 771 | < MultislotClass : '01010'B > |
| 772 | < Priority : '01'B > |
| 773 | < RandomBits : '010'B > > */ |
| 774 | 0x14a, |
| 775 | /* < Short Access Request : '100'B |
| 776 | < NumberOfBlocks : '001'B > |
| 777 | < Priority : '01'B > |
| 778 | < RandomBits : '000'B > > */ |
| 779 | 0x428, |
| 780 | /* < Two Phase Access Request : '110000'B |
| 781 | < Priority : '00'B > |
| 782 | < RandomBits : '000'B > > */ |
| 783 | 0x600, |
| 784 | /* < Two Phase Access Request : '110000'B |
| 785 | < Priority : '11'B > |
| 786 | < RandomBits : '111'B > > */ |
| 787 | 0x61f, |
| 788 | /* < Signalling : '110011'B |
| 789 | < RandomBits : '10101'B > > */ |
| 790 | 0x675, |
| 791 | /* < Signalling : '110011'B |
| 792 | < RandomBits : '10001'B > > */ |
| 793 | 0x671, |
| 794 | /* < Emergency call : '110111'B |
| 795 | < RandomBits : '11001'B > > */ |
| 796 | 0x6f9, |
| 797 | /* < Unknown (test) : '111111'B |
| 798 | < RandomBits : '01010'B > > */ |
| 799 | 0x7ea, |
| 800 | }; |
| 801 | |
| 802 | for (size_t i = 0; i < ARRAY_SIZE(EGPRSPktChReqs); i++) { |
| 803 | rc = decode_egprs_pkt_ch_req(EGPRSPktChReqs[i], &req); |
| 804 | printf("decode_egprs_pkt_ch_req(0x%03x) returns %d\n", EGPRSPktChReqs[i], rc); |
| 805 | if (rc == 0) |
| 806 | printf(" ==> %s\n", get_value_string(egprs_pkt_ch_req_type_names, req.Type)); |
| 807 | } |
| 808 | } |
| 809 | |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 810 | int main(int argc, char *argv[]) |
| 811 | { |
Alexander Couzens | ccde5c9 | 2017-02-04 03:10:08 +0100 | [diff] [blame] | 812 | void *ctx = talloc_named_const(NULL, 1, "RLCMACTest"); |
Neels Hofmeyr | 42f2d61 | 2018-04-01 16:54:40 +0200 | [diff] [blame] | 813 | osmo_init_logging2(ctx, &gprs_log_info); |
Harald Welte | 570f913 | 2020-03-19 15:03:01 +0100 | [diff] [blame] | 814 | log_parse_category_mask(osmo_stderr_target, "DPCU,3:DLGLOBAL,1:DRLCMACDATA,2:DCSN1,1:"); |
Vadim Yanitskiy | 8a87f91 | 2020-02-17 01:19:10 +0700 | [diff] [blame] | 815 | |
| 816 | log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE); |
| 817 | log_set_print_category_hex(osmo_stderr_target, 0); |
| 818 | log_set_print_category(osmo_stderr_target, 1); |
| 819 | log_set_print_level(osmo_stderr_target, 1); |
| 820 | log_set_use_color(osmo_stderr_target, 0); |
Andreas Eversberg | 138f4e6 | 2013-01-14 12:31:11 +0100 | [diff] [blame] | 821 | |
Alexander Couzens | ccde5c9 | 2017-02-04 03:10:08 +0100 | [diff] [blame] | 822 | testRlcMacDownlink(ctx); |
| 823 | testRlcMacUplink(ctx); |
| 824 | testCsnLeftAlignedVarBmpBounds(ctx); |
Pau Espin Pedrol | cdbc5db | 2020-01-23 21:00:19 +0100 | [diff] [blame] | 825 | testRAcap(ctx); |
Pau Espin Pedrol | 866bece | 2020-03-21 01:20:52 +0100 | [diff] [blame] | 826 | testMalformedRAcap(ctx); |
Pau Espin Pedrol | efad80b | 2020-03-23 14:35:26 +0100 | [diff] [blame] | 827 | testRAcap2(ctx); |
Pau Espin Pedrol | 2282b50 | 2021-10-07 12:19:01 +0200 | [diff] [blame] | 828 | testRAcap3(ctx); |
Vadim Yanitskiy | a2d972a | 2020-04-04 03:44:35 +0700 | [diff] [blame] | 829 | |
| 830 | testEGPRSPktChReq(ctx); |
| 831 | |
Pau Espin Pedrol | 089d734 | 2021-10-07 18:30:30 +0200 | [diff] [blame] | 832 | testRAcap4(ctx); |
| 833 | |
Alexander Couzens | ccde5c9 | 2017-02-04 03:10:08 +0100 | [diff] [blame] | 834 | talloc_free(ctx); |
Ivan Kluchnikov | 487a141 | 2011-12-21 13:17:53 +0300 | [diff] [blame] | 835 | } |