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