Neels Hofmeyr | 17518fe | 2017-06-20 04:35:06 +0200 | [diff] [blame] | 1 | /*! \file gsm_04_08.h |
| 2 | * GSM TS 04.08 definitions. */ |
| 3 | |
Sylvain Munaut | 12ba778 | 2014-06-16 10:13:40 +0200 | [diff] [blame] | 4 | #pragma once |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 5 | |
| 6 | #include <stdint.h> |
Max | fe65fa7 | 2016-05-10 17:17:05 +0200 | [diff] [blame] | 7 | #include <stdbool.h> |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 8 | |
Max | fb348ee | 2016-03-30 21:14:53 +0200 | [diff] [blame] | 9 | #include <osmocom/core/utils.h> |
Ruben Undheim | 720ac4a | 2016-05-27 22:03:59 +0200 | [diff] [blame] | 10 | #include <osmocom/core/endian.h> |
| 11 | |
Pau Espin Pedrol | 2272a03 | 2019-11-04 11:03:37 +0100 | [diff] [blame] | 12 | #include <osmocom/gsm/gsm_utils.h> |
| 13 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 14 | struct gsm_lchan; |
| 15 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 16 | /* Chapter 10.5.1.5 */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 17 | struct gsm48_classmark1 { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 18 | #if OSMO_IS_LITTLE_ENDIAN |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 19 | uint8_t pwr_lev:3, |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 20 | a5_1:1, |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 21 | es_ind:1, |
| 22 | rev_lev:2, |
| 23 | spare:1; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 24 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 25 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 26 | uint8_t spare:1, rev_lev:2, es_ind:1, a5_1:1, pwr_lev:3; |
| 27 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 28 | } __attribute__ ((packed)); |
| 29 | |
| 30 | /* Chapter 10.5.1.6 */ |
| 31 | struct gsm48_classmark2 { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 32 | #if OSMO_IS_LITTLE_ENDIAN |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 33 | uint8_t pwr_lev:3, |
| 34 | a5_1:1, |
| 35 | es_ind:1, |
| 36 | rev_lev:2, |
| 37 | spare:1; |
| 38 | uint8_t fc:1, |
| 39 | vgcs:1, |
| 40 | vbs:1, |
| 41 | sm_cap:1, |
| 42 | ss_scr:2, |
| 43 | ps_cap:1, |
| 44 | spare2:1; |
| 45 | uint8_t a5_2:1, |
| 46 | a5_3:1, |
| 47 | cmsp:1, |
| 48 | solsa:1, |
| 49 | spare3:1, |
| 50 | lcsva_cap:1, |
| 51 | spare4:1, |
| 52 | cm3:1; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 53 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 54 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 55 | uint8_t spare:1, rev_lev:2, es_ind:1, a5_1:1, pwr_lev:3; |
| 56 | uint8_t spare2:1, ps_cap:1, ss_scr:2, sm_cap:1, vbs:1, vgcs:1, fc:1; |
| 57 | uint8_t cm3:1, spare4:1, lcsva_cap:1, spare3:1, solsa:1, cmsp:1, a5_3:1, a5_2:1; |
| 58 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 59 | } __attribute__ ((packed)); |
| 60 | |
Philipp Maier | e36be56 | 2020-11-12 11:33:54 +0100 | [diff] [blame] | 61 | /* Chapter 10.5.1.7 */ |
| 62 | struct gsm48_classmark3 { |
| 63 | uint8_t a5_bits; |
| 64 | uint8_t mult_band_supp; |
| 65 | uint8_t assoc_radio_cap_1; |
| 66 | uint8_t assoc_radio_cap_2; |
| 67 | |
| 68 | struct { |
| 69 | bool present; |
| 70 | uint8_t r_gsm_assoc_radio_cap; |
| 71 | } r_support; |
| 72 | |
| 73 | struct { |
| 74 | bool present; |
| 75 | uint8_t mslot_class; |
| 76 | } hscsd_mult_slot_cap; |
| 77 | |
| 78 | bool ucs2_treatment; |
| 79 | bool extended_meas_cap; |
| 80 | |
| 81 | struct { |
| 82 | bool present; |
| 83 | uint8_t sms_value; |
| 84 | uint8_t sm_value; |
| 85 | } ms_meas_cap; |
| 86 | |
| 87 | struct { |
| 88 | bool present; |
| 89 | uint8_t method; |
| 90 | } ms_pos_method_cap; |
| 91 | |
| 92 | struct { |
| 93 | bool present; |
| 94 | uint8_t mslot_class; |
| 95 | } ecsd_multislot_cap; |
| 96 | |
| 97 | struct { |
| 98 | bool present; |
| 99 | bool mod_cap; |
| 100 | |
| 101 | struct { |
| 102 | bool present; |
| 103 | uint8_t value; |
| 104 | } rf_pwr_cap_1; |
| 105 | |
| 106 | struct { |
| 107 | bool present; |
| 108 | uint8_t value; |
| 109 | } rf_pwr_cap_2; |
| 110 | |
| 111 | } psk8_struct; |
| 112 | |
| 113 | struct { |
| 114 | bool present; |
| 115 | uint8_t value; |
| 116 | uint8_t assoc_radio_cap; |
| 117 | } gsm_400_bands_supp; |
| 118 | |
| 119 | struct { |
| 120 | bool present; |
| 121 | uint8_t value; |
| 122 | } gsm_850_assoc_radio_cap; |
| 123 | |
| 124 | struct { |
| 125 | bool present; |
| 126 | uint8_t value; |
| 127 | } gsm_1900_assoc_radio_cap; |
| 128 | |
| 129 | bool umts_fdd_rat_cap; |
| 130 | bool umts_tdd_rat_cap; |
| 131 | bool cdma200_rat_cap; |
| 132 | |
| 133 | struct { |
| 134 | bool present; |
| 135 | uint8_t mslot_class; |
| 136 | bool single_slot_dtm; |
| 137 | struct { |
| 138 | bool present; |
| 139 | uint8_t mslot_class; |
| 140 | } dtm_egprs_multislot_cap; |
| 141 | } dtm_gprs_multislot_cap; |
| 142 | |
| 143 | struct { |
| 144 | bool present; |
| 145 | uint8_t value; |
| 146 | } single_band_supp; |
| 147 | |
| 148 | struct { |
| 149 | bool present; |
| 150 | uint8_t value; |
| 151 | } gsm_750_assoc_radio_cap; |
| 152 | |
| 153 | bool umts_1_28_mcps_tdd_rat_cap; |
| 154 | bool geran_feature_package; |
| 155 | |
| 156 | struct { |
| 157 | bool present; |
| 158 | uint8_t mslot_class; |
| 159 | struct { |
| 160 | bool present; |
| 161 | uint8_t mslot_class; |
| 162 | } extended_dtm_egprs_multislot_cap; |
| 163 | } extended_dtm_gprs_multislot_cap; |
| 164 | |
| 165 | struct { |
| 166 | bool present; |
| 167 | uint8_t value; |
| 168 | } high_multislot_cap; |
| 169 | |
| 170 | bool geran_feature_package_2; |
| 171 | uint8_t gmsk_multislot_power_prof; |
| 172 | uint8_t psk8_multislot_power_prof; |
| 173 | |
| 174 | struct { |
| 175 | bool present; |
| 176 | uint8_t value; |
| 177 | uint8_t assoc_radio_cap; |
| 178 | } t_gsm_400_bands_supp; |
| 179 | |
| 180 | uint8_t dl_advanced_rx_perf; |
| 181 | bool dtm_enhancements_cap; |
| 182 | |
| 183 | struct { |
| 184 | bool present; |
| 185 | uint8_t mslot_class; |
| 186 | bool offset_required; |
| 187 | struct { |
| 188 | bool present; |
| 189 | uint8_t mslot_class; |
| 190 | } dtm_egprs_high_multislot_cap; |
| 191 | } dtm_gprs_high_multislot_cap; |
| 192 | |
| 193 | bool repeated_acch_capability; |
| 194 | |
| 195 | struct { |
| 196 | bool present; |
| 197 | uint8_t value; |
| 198 | } gsm_710_assoc_radio_cap; |
| 199 | |
| 200 | struct { |
| 201 | bool present; |
| 202 | uint8_t value; |
| 203 | } t_gsm_810_assoc_radio_cap; |
| 204 | |
| 205 | bool ciphering_mode_setting_cap; |
| 206 | bool add_pos_cap; |
| 207 | bool e_utra_fdd_supp; |
| 208 | bool e_utra_tdd_supp; |
| 209 | bool e_utra_meas_rep_supp; |
| 210 | bool prio_resel_supp; |
| 211 | bool utra_csg_cells_rep; |
| 212 | |
| 213 | uint8_t vamos_level; |
| 214 | uint8_t tighter_capability; |
| 215 | |
| 216 | bool sel_ciph_dl_sacch; |
| 217 | |
| 218 | uint8_t cs_ps_srvcc_geran_utra; |
| 219 | uint8_t cs_ps_srvcc_geran_eutra; |
| 220 | |
| 221 | bool geran_net_sharing; |
| 222 | bool e_utra_wb_rsrq_meas_supp; |
| 223 | bool er_band_support; |
| 224 | bool utra_mult_band_ind_supp; |
| 225 | bool e_utra_mult_band_ind_supp; |
| 226 | bool extended_tsc_set_cap_supp; |
| 227 | bool extended_earfcn_val_range; |
| 228 | }; |
| 229 | |
Neels Hofmeyr | 7740d26 | 2019-01-16 16:53:26 +0100 | [diff] [blame] | 230 | struct osmo_gsm48_classmark { |
| 231 | bool classmark1_set; |
| 232 | struct gsm48_classmark1 classmark1; |
| 233 | uint8_t classmark2_len; |
| 234 | struct gsm48_classmark2 classmark2; |
| 235 | uint8_t classmark3_len; |
| 236 | uint8_t classmark3[14]; /* if cm3 gets extended by spec, it will be truncated */ |
| 237 | }; |
| 238 | |
| 239 | bool osmo_gsm48_classmark_is_r99(const struct osmo_gsm48_classmark *cm); |
| 240 | bool osmo_gsm48_classmark1_is_r99(const struct gsm48_classmark1 *cm1); |
| 241 | bool osmo_gsm48_classmark2_is_r99(const struct gsm48_classmark2 *cm2, uint8_t cm2_len); |
| 242 | int osmo_gsm48_classmark_supports_a5(const struct osmo_gsm48_classmark *cm, uint8_t a5); |
| 243 | const char *osmo_gsm48_classmark_a5_name(const struct osmo_gsm48_classmark *cm); |
Harald Welte | 4a62eda | 2019-03-18 18:27:00 +0100 | [diff] [blame] | 244 | char *osmo_gsm48_classmark_a5_name_buf(char *buf, size_t buf_len, const struct osmo_gsm48_classmark *cm); |
Harald Welte | 179f357 | 2019-03-18 18:38:47 +0100 | [diff] [blame] | 245 | char *osmo_gsm48_classmark_a5_name_c(const void *ctx, const struct osmo_gsm48_classmark *cm); |
Neels Hofmeyr | 7740d26 | 2019-01-16 16:53:26 +0100 | [diff] [blame] | 246 | void osmo_gsm48_classmark_update(struct osmo_gsm48_classmark *dst, const struct osmo_gsm48_classmark *src); |
Pau Espin Pedrol | b99f4ca | 2019-10-31 13:35:22 +0100 | [diff] [blame] | 247 | int8_t osmo_gsm48_rfpowercap2powerclass(enum gsm_band band, uint8_t rf_power_cap); |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 248 | /* Chapter 10.5.2.1b.3 */ |
| 249 | struct gsm48_range_1024 { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 250 | #if OSMO_IS_LITTLE_ENDIAN |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 251 | uint8_t w1_hi:2, |
| 252 | f0:1, |
| 253 | form_id:5; |
| 254 | uint8_t w1_lo; |
| 255 | uint8_t w2_hi; |
| 256 | uint8_t w3_hi:7, |
| 257 | w2_lo:1; |
| 258 | uint8_t w4_hi:6, |
| 259 | w3_lo:2; |
| 260 | uint8_t w5_hi:6, |
| 261 | w4_lo:2; |
| 262 | uint8_t w6_hi:6, |
| 263 | w5_lo:2; |
| 264 | uint8_t w7_hi:6, |
| 265 | w6_lo:2; |
| 266 | uint8_t w8_hi:6, |
| 267 | w7_lo:2; |
| 268 | uint8_t w9:7, |
| 269 | w8_lo:1; |
| 270 | uint8_t w11_hi:1, |
| 271 | w10:7; |
| 272 | uint8_t w12_hi:2, |
| 273 | w11_lo:6; |
| 274 | uint8_t w13_hi:3, |
| 275 | w12_lo:5; |
| 276 | uint8_t w14_hi:4, |
| 277 | w13_lo:4; |
| 278 | uint8_t w15_hi:5, |
| 279 | w14_lo:3; |
| 280 | uint8_t w16:6, |
| 281 | w15_lo:2; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 282 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 283 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 284 | uint8_t form_id:5, f0:1, w1_hi:2; |
| 285 | uint8_t w1_lo; |
| 286 | uint8_t w2_hi; |
| 287 | uint8_t w2_lo:1, w3_hi:7; |
| 288 | uint8_t w3_lo:2, w4_hi:6; |
| 289 | uint8_t w4_lo:2, w5_hi:6; |
| 290 | uint8_t w5_lo:2, w6_hi:6; |
| 291 | uint8_t w6_lo:2, w7_hi:6; |
| 292 | uint8_t w7_lo:2, w8_hi:6; |
| 293 | uint8_t w8_lo:1, w9:7; |
| 294 | uint8_t w10:7, w11_hi:1; |
| 295 | uint8_t w11_lo:6, w12_hi:2; |
| 296 | uint8_t w12_lo:5, w13_hi:3; |
| 297 | uint8_t w13_lo:4, w14_hi:4; |
| 298 | uint8_t w14_lo:3, w15_hi:5; |
| 299 | uint8_t w15_lo:2, w16:6; |
| 300 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 301 | } __attribute__ ((packed)); |
| 302 | |
| 303 | /* Chapter 10.5.2.1b.4 */ |
| 304 | struct gsm48_range_512 { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 305 | #if OSMO_IS_LITTLE_ENDIAN |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 306 | uint8_t orig_arfcn_hi:1, |
| 307 | form_id:7; |
| 308 | uint8_t orig_arfcn_mid; |
| 309 | uint8_t w1_hi:7, |
| 310 | orig_arfcn_lo:1; |
| 311 | uint8_t w2_hi:6, |
| 312 | w1_lo:2; |
| 313 | uint8_t w3_hi:6, |
| 314 | w2_lo:2; |
| 315 | uint8_t w4_hi:6, |
| 316 | w3_lo:2; |
| 317 | uint8_t w5:7, |
| 318 | w4_lo:1; |
| 319 | uint8_t w7_hi:1, |
| 320 | w6:7; |
| 321 | uint8_t w8_hi:2, |
| 322 | w7_lo:6; |
| 323 | uint8_t w9_hi:4, |
| 324 | w8_lo:4; |
| 325 | uint8_t w10:6, |
| 326 | w9_lo:2; |
| 327 | uint8_t w12_hi:2, |
| 328 | w11:6; |
| 329 | uint8_t w13_hi:4, |
| 330 | w12_lo:4; |
| 331 | uint8_t w14:6, |
| 332 | w13_lo:2; |
| 333 | uint8_t w16_hi:2, |
| 334 | w15:6; |
| 335 | uint8_t w17:5, |
| 336 | w16_lo:3; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 337 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 338 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 339 | uint8_t form_id:7, orig_arfcn_hi:1; |
| 340 | uint8_t orig_arfcn_mid; |
| 341 | uint8_t orig_arfcn_lo:1, w1_hi:7; |
| 342 | uint8_t w1_lo:2, w2_hi:6; |
| 343 | uint8_t w2_lo:2, w3_hi:6; |
| 344 | uint8_t w3_lo:2, w4_hi:6; |
| 345 | uint8_t w4_lo:1, w5:7; |
| 346 | uint8_t w6:7, w7_hi:1; |
| 347 | uint8_t w7_lo:6, w8_hi:2; |
| 348 | uint8_t w8_lo:4, w9_hi:4; |
| 349 | uint8_t w9_lo:2, w10:6; |
| 350 | uint8_t w11:6, w12_hi:2; |
| 351 | uint8_t w12_lo:4, w13_hi:4; |
| 352 | uint8_t w13_lo:2, w14:6; |
| 353 | uint8_t w15:6, w16_hi:2; |
| 354 | uint8_t w16_lo:3, w17:5; |
| 355 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 356 | } __attribute__ ((packed)); |
| 357 | |
| 358 | /* Chapter 10.5.2.1b.5 */ |
| 359 | struct gsm48_range_256 { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 360 | #if OSMO_IS_LITTLE_ENDIAN |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 361 | uint8_t orig_arfcn_hi:1, |
| 362 | form_id:7; |
| 363 | uint8_t orig_arfcn_mid; |
| 364 | uint8_t w1_hi:7, |
| 365 | orig_arfcn_lo:1; |
| 366 | uint8_t w2:7, |
| 367 | w1_lo:1; |
| 368 | uint8_t w4_hi:1, |
| 369 | w3:7; |
| 370 | uint8_t w5_hi:3, |
| 371 | w4_lo:5; |
| 372 | uint8_t w6_hi:5, |
| 373 | w5_lo:3; |
| 374 | uint8_t w8_hi:1, |
| 375 | w7:6, |
| 376 | w6_lo:1; |
| 377 | uint8_t w9_hi:4, |
| 378 | w8_lo:4; |
| 379 | uint8_t w11_hi:2, |
| 380 | w10:5, |
| 381 | w9_lo:1; |
| 382 | uint8_t w12:5, |
| 383 | w11_lo:3; |
| 384 | uint8_t w14_hi:3, |
| 385 | w13:5; |
| 386 | uint8_t w16_hi:1, |
| 387 | w15:5, |
| 388 | w14_lo:2; |
| 389 | uint8_t w18_hi:1, |
| 390 | w17:4, |
| 391 | w16_lo:3; |
| 392 | uint8_t w20_hi:1, |
| 393 | w19:4, |
| 394 | w18_lo:3; |
| 395 | uint8_t spare:1, |
| 396 | w21:4, |
| 397 | w20_lo:3; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 398 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 399 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 400 | uint8_t form_id:7, orig_arfcn_hi:1; |
| 401 | uint8_t orig_arfcn_mid; |
| 402 | uint8_t orig_arfcn_lo:1, w1_hi:7; |
| 403 | uint8_t w1_lo:1, w2:7; |
| 404 | uint8_t w3:7, w4_hi:1; |
| 405 | uint8_t w4_lo:5, w5_hi:3; |
| 406 | uint8_t w5_lo:3, w6_hi:5; |
| 407 | uint8_t w6_lo:1, w7:6, w8_hi:1; |
| 408 | uint8_t w8_lo:4, w9_hi:4; |
| 409 | uint8_t w9_lo:1, w10:5, w11_hi:2; |
| 410 | uint8_t w11_lo:3, w12:5; |
| 411 | uint8_t w13:5, w14_hi:3; |
| 412 | uint8_t w14_lo:2, w15:5, w16_hi:1; |
| 413 | uint8_t w16_lo:3, w17:4, w18_hi:1; |
| 414 | uint8_t w18_lo:3, w19:4, w20_hi:1; |
| 415 | uint8_t w20_lo:3, w21:4, spare:1; |
| 416 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 417 | } __attribute__ ((packed)); |
| 418 | |
| 419 | /* Chapter 10.5.2.1b.6 */ |
| 420 | struct gsm48_range_128 { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 421 | #if OSMO_IS_LITTLE_ENDIAN |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 422 | uint8_t orig_arfcn_hi:1, |
| 423 | form_id:7; |
| 424 | uint8_t orig_arfcn_mid; |
| 425 | uint8_t w1:7, |
| 426 | orig_arfcn_lo:1; |
| 427 | uint8_t w3_hi:2, |
| 428 | w2:6; |
| 429 | uint8_t w4_hi:4, |
| 430 | w3_lo:4; |
| 431 | uint8_t w6_hi:2, |
| 432 | w5:5, |
| 433 | w4_lo:1; |
| 434 | uint8_t w7:5, |
| 435 | w6_lo:3; |
| 436 | uint8_t w9:4, |
| 437 | w8:4; |
| 438 | uint8_t w11:4, |
| 439 | w10:4; |
| 440 | uint8_t w13:4, |
| 441 | w12:4; |
| 442 | uint8_t w15:4, |
| 443 | w14:4; |
| 444 | uint8_t w18_hi:2, |
| 445 | w17:3, |
| 446 | w16:3; |
| 447 | uint8_t w21_hi:1, |
| 448 | w20:3, |
| 449 | w19:3, |
| 450 | w18_lo:1; |
| 451 | uint8_t w23:3, |
| 452 | w22:3, |
| 453 | w21_lo:2; |
| 454 | uint8_t w26_hi:2, |
| 455 | w25:3, |
| 456 | w24:3; |
| 457 | uint8_t spare:1, |
| 458 | w28:3, |
| 459 | w27:3, |
| 460 | w26_lo:1; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 461 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 462 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 463 | uint8_t form_id:7, orig_arfcn_hi:1; |
| 464 | uint8_t orig_arfcn_mid; |
| 465 | uint8_t orig_arfcn_lo:1, w1:7; |
| 466 | uint8_t w2:6, w3_hi:2; |
| 467 | uint8_t w3_lo:4, w4_hi:4; |
| 468 | uint8_t w4_lo:1, w5:5, w6_hi:2; |
| 469 | uint8_t w6_lo:3, w7:5; |
| 470 | uint8_t w8:4, w9:4; |
| 471 | uint8_t w10:4, w11:4; |
| 472 | uint8_t w12:4, w13:4; |
| 473 | uint8_t w14:4, w15:4; |
| 474 | uint8_t w16:3, w17:3, w18_hi:2; |
| 475 | uint8_t w18_lo:1, w19:3, w20:3, w21_hi:1; |
| 476 | uint8_t w21_lo:2, w22:3, w23:3; |
| 477 | uint8_t w24:3, w25:3, w26_hi:2; |
| 478 | uint8_t w26_lo:1, w27:3, w28:3, spare:1; |
| 479 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 480 | } __attribute__ ((packed)); |
| 481 | |
| 482 | /* Chapter 10.5.2.1b.7 */ |
| 483 | struct gsm48_var_bit { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 484 | #if OSMO_IS_LITTLE_ENDIAN |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 485 | uint8_t orig_arfcn_hi:1, |
| 486 | form_id:7; |
| 487 | uint8_t orig_arfcn_mid; |
| 488 | uint8_t rrfcn1_7:7, |
| 489 | orig_arfcn_lo:1; |
| 490 | uint8_t rrfcn8_111[13]; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 491 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 492 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 493 | uint8_t form_id:7, orig_arfcn_hi:1; |
| 494 | uint8_t orig_arfcn_mid; |
| 495 | uint8_t orig_arfcn_lo:1, rrfcn1_7:7; |
| 496 | uint8_t rrfcn8_111[13]; |
| 497 | #endif |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 498 | } __attribute__ ((packed)); |
| 499 | |
| 500 | /* Chapter 10.5.2.5 */ |
| 501 | struct gsm48_chan_desc { |
| 502 | uint8_t chan_nr; |
| 503 | union { |
| 504 | struct { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 505 | #if OSMO_IS_LITTLE_ENDIAN |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 506 | uint8_t maio_high:4, |
| 507 | h:1, |
| 508 | tsc:3; |
| 509 | uint8_t hsn:6, |
| 510 | maio_low:2; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 511 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 512 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 513 | uint8_t tsc:3, h:1, maio_high:4; |
| 514 | uint8_t maio_low:2, hsn:6; |
| 515 | #endif |
Andreas Eversberg | 4b332d7 | 2012-02-07 20:02:17 +0100 | [diff] [blame] | 516 | } __attribute__ ((packed)) h1; |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 517 | struct { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 518 | #if OSMO_IS_LITTLE_ENDIAN |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 519 | uint8_t arfcn_high:2, |
| 520 | spare:2, |
| 521 | h:1, |
| 522 | tsc:3; |
| 523 | uint8_t arfcn_low; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 524 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 525 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 526 | uint8_t tsc:3, h:1, spare:2, arfcn_high:2; |
| 527 | uint8_t arfcn_low; |
| 528 | #endif |
Andreas Eversberg | 4b332d7 | 2012-02-07 20:02:17 +0100 | [diff] [blame] | 529 | } __attribute__ ((packed)) h0; |
| 530 | } __attribute__ ((packed)); |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 531 | } __attribute__ ((packed)); |
| 532 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 533 | /* Chapter 10.5.2.20 */ |
| 534 | struct gsm48_meas_res { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 535 | #if OSMO_IS_LITTLE_ENDIAN |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 536 | uint8_t rxlev_full:6, |
| 537 | dtx_used:1, |
| 538 | ba_used:1; |
| 539 | uint8_t rxlev_sub:6, |
| 540 | meas_valid:1, |
| 541 | spare:1; |
| 542 | uint8_t no_nc_n_hi:1, |
| 543 | rxqual_sub:3, |
| 544 | rxqual_full:3, |
| 545 | spare2:1; |
| 546 | uint8_t rxlev_nc1:6, |
| 547 | no_nc_n_lo:2; |
| 548 | uint8_t bsic_nc1_hi:3, |
| 549 | bcch_f_nc1:5; |
| 550 | uint8_t rxlev_nc2_hi:5, |
| 551 | bsic_nc1_lo:3; |
| 552 | uint8_t bsic_nc2_hi:2, |
| 553 | bcch_f_nc2:5, |
| 554 | rxlev_nc2_lo:1; |
| 555 | uint8_t rxlev_nc3_hi:4, |
| 556 | bsic_nc2_lo:4; |
| 557 | uint8_t bsic_nc3_hi:1, |
| 558 | bcch_f_nc3:5, |
| 559 | rxlev_nc3_lo:2; |
| 560 | uint8_t rxlev_nc4_hi:3, |
| 561 | bsic_nc3_lo:5; |
| 562 | uint8_t bcch_f_nc4:5, |
| 563 | rxlev_nc4_lo:3; |
| 564 | uint8_t rxlev_nc5_hi:2, |
| 565 | bsic_nc4:6; |
| 566 | uint8_t bcch_f_nc5_hi:4, |
| 567 | rxlev_nc5_lo:4; |
| 568 | uint8_t rxlev_nc6_hi:1, |
| 569 | bsic_nc5:6, |
| 570 | bcch_f_nc5_lo:1; |
| 571 | uint8_t bcch_f_nc6_hi:3, |
| 572 | rxlev_nc6_lo:5; |
| 573 | uint8_t bsic_nc6:6, |
| 574 | bcch_f_nc6_lo:2; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 575 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 576 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 577 | uint8_t ba_used:1, dtx_used:1, rxlev_full:6; |
| 578 | uint8_t spare:1, meas_valid:1, rxlev_sub:6; |
| 579 | uint8_t spare2:1, rxqual_full:3, rxqual_sub:3, no_nc_n_hi:1; |
| 580 | uint8_t no_nc_n_lo:2, rxlev_nc1:6; |
| 581 | uint8_t bcch_f_nc1:5, bsic_nc1_hi:3; |
| 582 | uint8_t bsic_nc1_lo:3, rxlev_nc2_hi:5; |
| 583 | uint8_t rxlev_nc2_lo:1, bcch_f_nc2:5, bsic_nc2_hi:2; |
| 584 | uint8_t bsic_nc2_lo:4, rxlev_nc3_hi:4; |
| 585 | uint8_t rxlev_nc3_lo:2, bcch_f_nc3:5, bsic_nc3_hi:1; |
| 586 | uint8_t bsic_nc3_lo:5, rxlev_nc4_hi:3; |
| 587 | uint8_t rxlev_nc4_lo:3, bcch_f_nc4:5; |
| 588 | uint8_t bsic_nc4:6, rxlev_nc5_hi:2; |
| 589 | uint8_t rxlev_nc5_lo:4, bcch_f_nc5_hi:4; |
| 590 | uint8_t bcch_f_nc5_lo:1, bsic_nc5:6, rxlev_nc6_hi:1; |
| 591 | uint8_t rxlev_nc6_lo:5, bcch_f_nc6_hi:3; |
| 592 | uint8_t bcch_f_nc6_lo:2, bsic_nc6:6; |
| 593 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 594 | } __attribute__ ((packed)); |
| 595 | |
Vadim Yanitskiy | 190b6ef | 2021-11-04 17:21:11 +0300 | [diff] [blame] | 596 | /*! Check if the given mr contains valid measurement results */ |
| 597 | static inline bool gsm48_meas_res_is_valid(const struct gsm48_meas_res *mr) |
| 598 | { |
| 599 | return (mr->meas_valid == 0); /* 0 means valid */ |
| 600 | } |
| 601 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 602 | /* Chapter 10.5.2.21aa */ |
| 603 | struct gsm48_multi_rate_conf { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 604 | #if OSMO_IS_LITTLE_ENDIAN |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 605 | uint8_t smod : 2, |
| 606 | spare: 1, |
| 607 | icmi : 1, |
| 608 | nscb : 1, |
| 609 | ver : 3; |
| 610 | uint8_t m4_75 : 1, |
| 611 | m5_15 : 1, |
| 612 | m5_90 : 1, |
| 613 | m6_70 : 1, |
| 614 | m7_40 : 1, |
| 615 | m7_95 : 1, |
| 616 | m10_2 : 1, |
| 617 | m12_2 : 1; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 618 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 619 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 620 | uint8_t ver:3, nscb:1, icmi:1, spare:1, smod:2; |
| 621 | uint8_t m12_2:1, m10_2:1, m7_95:1, m7_40:1, m6_70:1, m5_90:1, m5_15:1, m4_75:1; |
| 622 | #endif |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 623 | } __attribute__((packed)); |
| 624 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 625 | /* Chapter 10.5.2.28(a) */ |
| 626 | struct gsm48_power_cmd { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 627 | #if OSMO_IS_LITTLE_ENDIAN |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 628 | uint8_t power_level:5, |
| 629 | spare:2, |
| 630 | atc:1; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 631 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 632 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 633 | uint8_t atc:1, spare:2, power_level:5; |
| 634 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 635 | } __attribute__((packed)); |
| 636 | |
| 637 | /* Chapter 10.5.2.29 */ |
| 638 | struct gsm48_rach_control { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 639 | #if OSMO_IS_LITTLE_ENDIAN |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 640 | uint8_t re :1, |
| 641 | cell_bar :1, |
| 642 | tx_integer :4, |
| 643 | max_trans :2; |
Stefan Sperling | 1859515 | 2018-02-06 13:20:23 +0100 | [diff] [blame] | 644 | uint8_t t2; /* ACC 8-15 barred flags */ |
| 645 | uint8_t t3; /* ACC 0-7 barred flags */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 646 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 647 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 648 | uint8_t max_trans:2, tx_integer:4, cell_bar:1, re:1; |
| 649 | uint8_t t2; |
| 650 | uint8_t t3; |
| 651 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 652 | } __attribute__ ((packed)); |
| 653 | |
Stefan Sperling | 1859515 | 2018-02-06 13:20:23 +0100 | [diff] [blame] | 654 | /* |
| 655 | * Mark an Access Control Class as barred. |
| 656 | * \param[in] rach_control A Rach Control Information Element. |
| 657 | * \param[in] acc Access Control Class number (0 - 15) which shall be barred. |
| 658 | */ |
| 659 | static inline void gsm48_barr_acc(struct gsm48_rach_control *rach_control, unsigned int acc) |
| 660 | { |
Vadim Yanitskiy | b8734ba | 2019-06-12 15:50:57 +0700 | [diff] [blame] | 661 | OSMO_ASSERT(acc <= 15); |
Stefan Sperling | 1859515 | 2018-02-06 13:20:23 +0100 | [diff] [blame] | 662 | if (acc >= 8) |
| 663 | rach_control->t2 |= (1 << (acc - 8)); |
| 664 | else |
| 665 | rach_control->t3 |= (1 << (acc)); |
| 666 | } |
| 667 | |
| 668 | /* |
| 669 | * Mark an Access Control Class as allowed. |
| 670 | * \param[in] rach_control A Rach Control Information Element. |
| 671 | * \param[in] acc Access Control Class number (0 - 15) which shall be allowed. |
| 672 | */ |
| 673 | static inline void gsm48_allow_acc(struct gsm48_rach_control *rach_control, unsigned int acc) |
| 674 | { |
Vadim Yanitskiy | b8734ba | 2019-06-12 15:50:57 +0700 | [diff] [blame] | 675 | OSMO_ASSERT(acc <= 15); |
Stefan Sperling | 1859515 | 2018-02-06 13:20:23 +0100 | [diff] [blame] | 676 | if (acc >= 8) |
| 677 | rach_control->t2 &= ~(1 << (acc - 8)); |
| 678 | else |
| 679 | rach_control->t3 &= ~(1 << (acc)); |
| 680 | } |
| 681 | |
| 682 | /* |
| 683 | * Indicate whether an Access Control Class is barred. |
| 684 | * \param[in] rach_control A Rach Control Information Element. |
| 685 | * \param[in] acc Access Control Class number (0 - 15). |
| 686 | * \returns true if the Access Control class is barred, false otherwise |
| 687 | */ |
| 688 | static inline bool gsm48_acc_is_barred(struct gsm48_rach_control *rach_control, unsigned int acc) |
| 689 | { |
Vadim Yanitskiy | b8734ba | 2019-06-12 15:50:57 +0700 | [diff] [blame] | 690 | OSMO_ASSERT(acc <= 15); |
Stefan Sperling | 1859515 | 2018-02-06 13:20:23 +0100 | [diff] [blame] | 691 | if (acc >= 8) |
| 692 | return (rach_control->t2 & (1 << (acc - 8))) != 0; |
| 693 | return (rach_control->t3 & (1 << (acc))) != 0; |
| 694 | } |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 695 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 696 | /* Chapter 10.5.2.30 */ |
| 697 | struct gsm48_req_ref { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 698 | #if OSMO_IS_LITTLE_ENDIAN |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 699 | uint8_t ra; |
| 700 | uint8_t t3_high:3, |
Andreas Eversberg | 93364fc | 2010-06-25 02:50:06 +0200 | [diff] [blame] | 701 | t1:5; |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 702 | uint8_t t2:5, |
| 703 | t3_low:3; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 704 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 705 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 706 | uint8_t ra; |
| 707 | uint8_t t1:5, t3_high:3; |
| 708 | uint8_t t3_low:3, t2:5; |
| 709 | #endif |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 710 | } __attribute__ ((packed)); |
| 711 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 712 | /* Chapter 10.5.2.38 */ |
| 713 | struct gsm48_start_time { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 714 | #if OSMO_IS_LITTLE_ENDIAN |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 715 | uint8_t t3_high:3, |
| 716 | t1:5; |
| 717 | uint8_t t2:5, |
| 718 | t3_low:3; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 719 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 720 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 721 | uint8_t t1:5, t3_high:3; |
| 722 | uint8_t t3_low:3, t2:5; |
| 723 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 724 | } __attribute__ ((packed)); |
| 725 | |
| 726 | /* Chapter 10.5.2.39 */ |
| 727 | struct gsm48_sync_ind { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 728 | #if OSMO_IS_LITTLE_ENDIAN |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 729 | uint8_t si:2, |
| 730 | rot:1, |
| 731 | nci:1, |
| 732 | sync_ie:4; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 733 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 734 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 735 | uint8_t sync_ie:4, nci:1, rot:1, si:2; |
| 736 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 737 | } __attribute__((packed)); |
| 738 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 739 | /* |
| 740 | * Chapter 9.1.5/9.1.6 |
| 741 | * |
| 742 | * For 9.1.6 the chan_desc has the meaning of 10.5.2.5a |
| 743 | */ |
| 744 | struct gsm48_chan_mode_modify { |
| 745 | struct gsm48_chan_desc chan_desc; |
| 746 | uint8_t mode; |
| 747 | } __attribute__ ((packed)); |
| 748 | |
Vadim Yanitskiy | 8c7f023 | 2023-03-23 05:43:07 +0700 | [diff] [blame] | 749 | /*! 10.5.2.6 Channel Mode value */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 750 | enum gsm48_chan_mode { |
Vadim Yanitskiy | 8c7f023 | 2023-03-23 05:43:07 +0700 | [diff] [blame] | 751 | /*! Signalling only (TCH/F or TCH/H) */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 752 | GSM48_CMODE_SIGN = 0x00, |
Vadim Yanitskiy | 8c7f023 | 2023-03-23 05:43:07 +0700 | [diff] [blame] | 753 | /*! Speech: FR (TCH/FS) or HR (TCH/HS) */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 754 | GSM48_CMODE_SPEECH_V1 = 0x01, |
Vadim Yanitskiy | 8c7f023 | 2023-03-23 05:43:07 +0700 | [diff] [blame] | 755 | /*! Speech: EFR (TCH/EFS) */ |
| 756 | GSM48_CMODE_SPEECH_EFR = 0x21, /*!< a.k.a. V2 */ |
| 757 | /*! Speech: AMR (TCH/AFS or TCH/AHS) */ |
| 758 | GSM48_CMODE_SPEECH_AMR = 0x41, /*!< a.k.a. V3 */ |
Vadim Yanitskiy | 1c88ff9 | 2023-03-23 06:33:51 +0700 | [diff] [blame] | 759 | /*! Speech: OFR AMR-WB (O-TCH/WFS) or OHR AMR-WB (O-TCH/WHS) */ |
| 760 | GSM48_CMODE_SPEECH_V4 = 0x81, |
| 761 | /*! Speech: FR AMR-WB (TCH/WFS) */ |
| 762 | GSM48_CMODE_SPEECH_V5 = 0x82, |
| 763 | /*! Speech: OHR AMR (O-TCH/AHS) */ |
| 764 | GSM48_CMODE_SPEECH_V6 = 0x83, |
Vadim Yanitskiy | 8c7f023 | 2023-03-23 05:43:07 +0700 | [diff] [blame] | 765 | |
Vadim Yanitskiy | 173c84c | 2023-03-23 06:34:13 +0700 | [diff] [blame] | 766 | /* ECSD: 43.5 kbit/s (DL) + 14.5 kbit/s (UL) */ |
| 767 | GSM48_CMODE_DATA_43k5_14k5 = 0x61, |
| 768 | /* ECSD: 29.0 kbit/s (DL) + 14.5 kbit/s (UL) */ |
| 769 | GSM48_CMODE_DATA_29k0_14k5 = 0x62, |
| 770 | /* ECSD: 43.5 kbit/s (DL) + 29.0 kbit/s (UL) */ |
| 771 | GSM48_CMODE_DATA_43k5_29k0 = 0x64, |
| 772 | /* ECSD: 14.5 kbit/s (DL) + 43.5 kbit/s (UL) */ |
| 773 | GSM48_CMODE_DATA_14k5_43k5 = 0x67, |
| 774 | /* ECSD: 14.5 kbit/s (DL) + 29.0 kbit/s (UL) */ |
| 775 | GSM48_CMODE_DATA_14k5_29k0 = 0x65, |
| 776 | /* ECSD: 29.0 kbit/s (DL) + 43.5 kbit/s (UL) */ |
| 777 | GSM48_CMODE_DATA_29k0_43k5 = 0x66, |
| 778 | |
| 779 | /*! ECSD: 43.5 kbit/s radio interface rate, 43.2 kbit/s services (E-TCH/F43.2) */ |
| 780 | GSM48_CMODE_DATA_43k5 = 0x27, |
| 781 | /*! ECSD: 32.0 kbit/s radio interface rate, 32.0 kbit/s services (E-TCH/F32.0) */ |
| 782 | GSM48_CMODE_DATA_32k0 = 0x63, |
| 783 | /*! ECSD: 29.0 kbit/s radio interface rate, 28.8 kbit/s services (E-TCH/F28.8) */ |
| 784 | GSM48_CMODE_DATA_29k0 = 0x43, |
Vadim Yanitskiy | 8c7f023 | 2023-03-23 05:43:07 +0700 | [diff] [blame] | 785 | /*! CSD: 14.5 kbit/s radio interface rate, 14.4 kbit/s services (TCH/F14.4) */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 786 | GSM48_CMODE_DATA_14k5 = 0x0f, |
Vadim Yanitskiy | 8c7f023 | 2023-03-23 05:43:07 +0700 | [diff] [blame] | 787 | /*! CSD: 12.0 kbit/s radio interface rate, 9.6 kbit/s services (TCH/F9.6) */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 788 | GSM48_CMODE_DATA_12k0 = 0x03, |
Vadim Yanitskiy | 8c7f023 | 2023-03-23 05:43:07 +0700 | [diff] [blame] | 789 | /*! CSD: 6.0 kbit/s radio interface rate, 4.8 kbit/s services (TCH/{F,H}4.8) */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 790 | GSM48_CMODE_DATA_6k0 = 0x0b, |
Vadim Yanitskiy | 8c7f023 | 2023-03-23 05:43:07 +0700 | [diff] [blame] | 791 | /*! CSD: 3.6 kbit/s radio interface rate, 2.4 kbit/s and less services (TCH/{F,H}2.4) */ |
Bhaskar | 31e844b | 2013-05-16 17:06:35 +0530 | [diff] [blame] | 792 | GSM48_CMODE_DATA_3k6 = 0x13, |
Vadim Yanitskiy | 8c7f023 | 2023-03-23 05:43:07 +0700 | [diff] [blame] | 793 | |
| 794 | /*! Same as GSM48_CMODE_SPEECH_V1, in VAMOS mode */ |
Neels Hofmeyr | a9da9f7 | 2021-04-16 15:36:58 +0200 | [diff] [blame] | 795 | GSM48_CMODE_SPEECH_V1_VAMOS = 0xc1, |
Vadim Yanitskiy | 8c7f023 | 2023-03-23 05:43:07 +0700 | [diff] [blame] | 796 | /*! Same as GSM48_CMODE_SPEECH_EFR, in VAMOS mode */ |
Neels Hofmeyr | a9da9f7 | 2021-04-16 15:36:58 +0200 | [diff] [blame] | 797 | GSM48_CMODE_SPEECH_V2_VAMOS = 0xc2, |
Vadim Yanitskiy | 8c7f023 | 2023-03-23 05:43:07 +0700 | [diff] [blame] | 798 | /*! Same as GSM48_CMODE_SPEECH_AMR, in VAMOS mode */ |
Neels Hofmeyr | a9da9f7 | 2021-04-16 15:36:58 +0200 | [diff] [blame] | 799 | GSM48_CMODE_SPEECH_V3_VAMOS = 0xc3, |
Vadim Yanitskiy | 1c88ff9 | 2023-03-23 06:33:51 +0700 | [diff] [blame] | 800 | /*! Speech: GSM48_CMODE_SPEECH_V5, in VAMOS mode */ |
Neels Hofmeyr | a9da9f7 | 2021-04-16 15:36:58 +0200 | [diff] [blame] | 801 | GSM48_CMODE_SPEECH_V5_VAMOS = 0xc5, |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 802 | }; |
| 803 | |
Max | fb348ee | 2016-03-30 21:14:53 +0200 | [diff] [blame] | 804 | extern const struct value_string gsm48_chan_mode_names[]; |
Philipp Maier | 5796a21 | 2018-07-12 17:48:26 +0200 | [diff] [blame] | 805 | static inline const char *gsm48_chan_mode_name(enum gsm48_chan_mode val) |
| 806 | { return get_value_string(gsm48_chan_mode_names, val); } |
Max | fb348ee | 2016-03-30 21:14:53 +0200 | [diff] [blame] | 807 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 808 | /* Chapter 9.1.2 */ |
| 809 | struct gsm48_ass_cmd { |
| 810 | /* Semantic is from 10.5.2.5a */ |
| 811 | struct gsm48_chan_desc chan_desc; |
| 812 | uint8_t power_command; |
| 813 | uint8_t data[0]; |
| 814 | } __attribute__((packed)); |
| 815 | |
Andreas Eversberg | fa83201 | 2010-09-01 23:37:07 +0200 | [diff] [blame] | 816 | /* Chapter 9.1.13 */ |
| 817 | struct gsm48_frq_redef { |
| 818 | /* Semantic is from 10.5.2.5a */ |
| 819 | struct gsm48_chan_desc chan_desc; |
| 820 | uint8_t mob_alloc_len; |
| 821 | uint8_t mob_alloc[0]; |
| 822 | } __attribute__((packed)); |
| 823 | |
Harald Welte | 548e371 | 2017-07-10 22:32:08 +0200 | [diff] [blame] | 824 | /* Chapter 9.1.13b GPRS suspension request */ |
| 825 | struct gsm48_gprs_susp_req { |
| 826 | uint32_t tlli; |
| 827 | uint8_t ra_id[6]; |
| 828 | uint8_t cause; |
| 829 | uint8_t options[0]; |
| 830 | } __attribute__ ((packed)); |
| 831 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 832 | /* Chapter 10.5.2.2 */ |
| 833 | struct gsm48_cell_desc { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 834 | #if OSMO_IS_LITTLE_ENDIAN |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 835 | uint8_t bcc:3, |
| 836 | ncc:3, |
| 837 | arfcn_hi:2; |
| 838 | uint8_t arfcn_lo; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 839 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 840 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 841 | uint8_t arfcn_hi:2, ncc:3, bcc:3; |
| 842 | uint8_t arfcn_lo; |
| 843 | #endif |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 844 | } __attribute__((packed)); |
| 845 | |
| 846 | /* Chapter 9.1.15 */ |
| 847 | struct gsm48_ho_cmd { |
| 848 | struct gsm48_cell_desc cell_desc; |
| 849 | struct gsm48_chan_desc chan_desc; |
| 850 | uint8_t ho_ref; |
| 851 | uint8_t power_command; |
| 852 | uint8_t data[0]; |
| 853 | } __attribute__((packed)); |
| 854 | |
| 855 | /* Chapter 9.1.18 */ |
| 856 | struct gsm48_imm_ass { |
| 857 | uint8_t l2_plen; |
| 858 | uint8_t proto_discr; |
| 859 | uint8_t msg_type; |
| 860 | uint8_t page_mode; |
| 861 | struct gsm48_chan_desc chan_desc; |
| 862 | struct gsm48_req_ref req_ref; |
| 863 | uint8_t timing_advance; |
| 864 | uint8_t mob_alloc_len; |
| 865 | uint8_t mob_alloc[0]; |
| 866 | } __attribute__ ((packed)); |
| 867 | |
Holger Hans Peter Freyther | 5dcef3c | 2010-05-15 22:35:25 +0800 | [diff] [blame] | 868 | /* Chapter 9.1.25 */ |
| 869 | struct gsm48_pag_resp { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 870 | #if OSMO_IS_LITTLE_ENDIAN |
Holger Hans Peter Freyther | 5dcef3c | 2010-05-15 22:35:25 +0800 | [diff] [blame] | 871 | uint8_t spare:4, |
| 872 | key_seq:4; |
Pau Espin Pedrol | ba5a9b9 | 2019-11-04 15:41:32 +0100 | [diff] [blame] | 873 | union { |
| 874 | uint32_t classmark2; /* Backward compatibility */ |
| 875 | struct { |
| 876 | uint8_t cm2_len; |
| 877 | struct gsm48_classmark2 cm2; |
| 878 | }; |
| 879 | }; |
Holger Hans Peter Freyther | 5dcef3c | 2010-05-15 22:35:25 +0800 | [diff] [blame] | 880 | uint8_t mi_len; |
| 881 | uint8_t mi[0]; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 882 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 883 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 884 | uint8_t key_seq:4, spare:4; |
Pau Espin Pedrol | ba5a9b9 | 2019-11-04 15:41:32 +0100 | [diff] [blame] | 885 | union { |
Neels Hofmeyr | 534f0f4 | 2020-05-14 17:28:39 +0200 | [diff] [blame] | 886 | uint32_t classmark2; |
Pau Espin Pedrol | ba5a9b9 | 2019-11-04 15:41:32 +0100 | [diff] [blame] | 887 | struct { |
| 888 | uint8_t cm2_len; |
| 889 | struct gsm48_classmark2 cm2; |
| 890 | }; |
| 891 | }; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 892 | uint8_t mi_len; |
| 893 | uint8_t mi[0]; |
| 894 | #endif |
Holger Hans Peter Freyther | 5dcef3c | 2010-05-15 22:35:25 +0800 | [diff] [blame] | 895 | } __attribute__ ((packed)); |
| 896 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 897 | /* Chapter 10.5.1.3 */ |
| 898 | struct gsm48_loc_area_id { |
| 899 | uint8_t digits[3]; /* BCD! */ |
| 900 | uint16_t lac; |
| 901 | } __attribute__ ((packed)); |
| 902 | |
| 903 | /* Section 9.2.2 */ |
| 904 | struct gsm48_auth_req { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 905 | #if OSMO_IS_LITTLE_ENDIAN |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 906 | uint8_t key_seq:4, |
| 907 | spare:4; |
| 908 | uint8_t rand[16]; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 909 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 910 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 911 | uint8_t spare:4, key_seq:4; |
| 912 | uint8_t rand[16]; |
| 913 | #endif |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 914 | } __attribute__ ((packed)); |
| 915 | |
Sylvain Munaut | d005eab | 2010-06-10 13:30:50 +0200 | [diff] [blame] | 916 | /* Section 9.2.3 */ |
| 917 | struct gsm48_auth_resp { |
| 918 | uint8_t sres[4]; |
| 919 | } __attribute__ ((packed)); |
| 920 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 921 | /* Section 9.2.15 */ |
| 922 | struct gsm48_loc_upd_req { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 923 | #if OSMO_IS_LITTLE_ENDIAN |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 924 | uint8_t type:4, |
| 925 | key_seq:4; |
| 926 | struct gsm48_loc_area_id lai; |
| 927 | struct gsm48_classmark1 classmark1; |
| 928 | uint8_t mi_len; |
| 929 | uint8_t mi[0]; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 930 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 931 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 932 | uint8_t key_seq:4, type:4; |
| 933 | struct gsm48_loc_area_id lai; |
| 934 | struct gsm48_classmark1 classmark1; |
| 935 | uint8_t mi_len; |
| 936 | uint8_t mi[0]; |
| 937 | #endif |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 938 | } __attribute__ ((packed)); |
| 939 | |
| 940 | /* Section 10.1 */ |
| 941 | struct gsm48_hdr { |
| 942 | uint8_t proto_discr; |
| 943 | uint8_t msg_type; |
| 944 | uint8_t data[0]; |
| 945 | } __attribute__ ((packed)); |
| 946 | |
Andreas Eversberg | bfb917f | 2023-05-10 17:07:36 +0200 | [diff] [blame] | 947 | /* Short header */ |
| 948 | struct gsm48_hdr_sh { |
| 949 | #if OSMO_IS_LITTLE_ENDIAN |
| 950 | uint8_t l2_header:2, /* < short layer 2 header : bit(2) > See 3GPP TS 44.006 ยง6.4a */ |
| 951 | msg_type:5, /* < message type : bit(5) > See 3GPP TS 44.018 Table 10.4.2 */ |
| 952 | rr_short_pd:1; /* < RR short PD : bit > See 3GPP TS 24.007 ยง11.3.2 */ |
| 953 | uint8_t data[0]; |
| 954 | #elif OSMO_IS_BIG_ENDIAN |
| 955 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
| 956 | uint8_t rr_short_pd:1, msg_type:5, l2_header:2; |
| 957 | uint8_t data[0]; |
| 958 | #endif |
| 959 | } __attribute__ ((packed)); |
| 960 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 961 | /* Section 9.1.3x System information Type header */ |
| 962 | struct gsm48_system_information_type_header { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 963 | #if OSMO_IS_LITTLE_ENDIAN |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 964 | uint8_t l2_plen; |
| 965 | uint8_t rr_protocol_discriminator :4, |
Pau Espin Pedrol | ab6d6cf | 2019-10-31 13:34:57 +0100 | [diff] [blame] | 966 | skip_indicator:4; |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 967 | uint8_t system_information; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 968 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 969 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 970 | uint8_t l2_plen; |
| 971 | uint8_t skip_indicator:4, rr_protocol_discriminator:4; |
| 972 | uint8_t system_information; |
| 973 | #endif |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 974 | } __attribute__ ((packed)); |
| 975 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 976 | /* Section 10.5.2.4 Cell Selection Parameters */ |
| 977 | struct gsm48_cell_sel_par { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 978 | #if OSMO_IS_LITTLE_ENDIAN |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 979 | uint8_t ms_txpwr_max_ccch:5, /* GSM 05.08 MS-TXPWR-MAX-CCCH */ |
| 980 | cell_resel_hyst:3; /* GSM 05.08 CELL-RESELECT-HYSTERESIS */ |
| 981 | uint8_t rxlev_acc_min:6, /* GSM 05.08 RXLEV-ACCESS-MIN */ |
| 982 | neci:1, |
| 983 | acs:1; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 984 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 985 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 986 | uint8_t cell_resel_hyst:3, ms_txpwr_max_ccch:5; |
| 987 | uint8_t acs:1, neci:1, rxlev_acc_min:6; |
| 988 | #endif |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 989 | } __attribute__ ((packed)); |
| 990 | |
Neels Hofmeyr | d1c2fc6 | 2017-02-21 14:51:40 +0100 | [diff] [blame] | 991 | /* 3GPP TS 44.018 Section 10.5.2.11 Control Channel Description */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 992 | struct gsm48_control_channel_descr { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 993 | #if OSMO_IS_LITTLE_ENDIAN |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 994 | uint8_t ccch_conf :3, |
| 995 | bs_ag_blks_res :3, |
| 996 | att :1, |
Neels Hofmeyr | d1c2fc6 | 2017-02-21 14:51:40 +0100 | [diff] [blame] | 997 | mscr :1; |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 998 | uint8_t bs_pa_mfrms : 3, |
Neels Hofmeyr | d1c2fc6 | 2017-02-21 14:51:40 +0100 | [diff] [blame] | 999 | spare_1 :2, |
| 1000 | cbq3 :2, |
| 1001 | spare_2 :1; |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1002 | uint8_t t3212; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1003 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 1004 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1005 | uint8_t mscr:1, att:1, bs_ag_blks_res:3, ccch_conf:3; |
| 1006 | uint8_t spare_2:1, cbq3:2, spare_1:2, bs_pa_mfrms:3; |
| 1007 | uint8_t t3212; |
| 1008 | #endif |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1009 | } __attribute__ ((packed)); |
| 1010 | |
Max | fe65fa7 | 2016-05-10 17:17:05 +0200 | [diff] [blame] | 1011 | enum gsm48_dtx_mode { |
| 1012 | GSM48_DTX_MAY_BE_USED, |
| 1013 | GSM48_DTX_SHALL_BE_USED, |
| 1014 | GSM48_DTX_SHALL_NOT_BE_USED |
| 1015 | }; |
| 1016 | |
| 1017 | /* Cell Options for SI6, SACCH (10.5.2.3a.2) or SI3, BCCH (Table 10.5.2.3.1), |
| 1018 | 3GPP TS 44.018 */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1019 | struct gsm48_cell_options { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1020 | #if OSMO_IS_LITTLE_ENDIAN |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1021 | uint8_t radio_link_timeout:4, |
| 1022 | dtx:2, |
| 1023 | pwrc:1, |
Max | fe65fa7 | 2016-05-10 17:17:05 +0200 | [diff] [blame] | 1024 | /* either DN-IND or top bit of DTX IND */ |
| 1025 | d:1; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1026 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 1027 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1028 | uint8_t d:1, pwrc:1, dtx:2, radio_link_timeout:4; |
| 1029 | #endif |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1030 | } __attribute__ ((packed)); |
| 1031 | |
| 1032 | /* Section 9.2.9 CM service request */ |
| 1033 | struct gsm48_service_request { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1034 | #if OSMO_IS_LITTLE_ENDIAN |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1035 | uint8_t cm_service_type : 4, |
| 1036 | cipher_key_seq : 4; |
Pau Espin Pedrol | ba5a9b9 | 2019-11-04 15:41:32 +0100 | [diff] [blame] | 1037 | union { |
| 1038 | uint32_t classmark; /* Backward compatibility */ |
| 1039 | struct { |
| 1040 | uint8_t cm2_len; |
| 1041 | struct gsm48_classmark2 classmark2; |
| 1042 | }; |
| 1043 | }; |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1044 | uint8_t mi_len; |
| 1045 | uint8_t mi[0]; |
| 1046 | /* optional priority level */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1047 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 1048 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1049 | uint8_t cipher_key_seq:4, cm_service_type:4; |
Pau Espin Pedrol | ba5a9b9 | 2019-11-04 15:41:32 +0100 | [diff] [blame] | 1050 | union { |
Neels Hofmeyr | 534f0f4 | 2020-05-14 17:28:39 +0200 | [diff] [blame] | 1051 | uint32_t classmark; |
Pau Espin Pedrol | ba5a9b9 | 2019-11-04 15:41:32 +0100 | [diff] [blame] | 1052 | struct { |
| 1053 | uint8_t cm2_len; |
| 1054 | struct gsm48_classmark2 classmark2; |
| 1055 | }; |
| 1056 | }; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1057 | uint8_t mi_len; |
| 1058 | uint8_t mi[0]; |
| 1059 | #endif |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1060 | } __attribute__ ((packed)); |
| 1061 | |
| 1062 | /* Section 9.1.31 System information Type 1 */ |
| 1063 | struct gsm48_system_information_type_1 { |
| 1064 | struct gsm48_system_information_type_header header; |
| 1065 | uint8_t cell_channel_description[16]; |
| 1066 | struct gsm48_rach_control rach_control; |
| 1067 | uint8_t rest_octets[0]; /* NCH position on the CCCH */ |
| 1068 | } __attribute__ ((packed)); |
| 1069 | |
| 1070 | /* Section 9.1.32 System information Type 2 */ |
| 1071 | struct gsm48_system_information_type_2 { |
| 1072 | struct gsm48_system_information_type_header header; |
| 1073 | uint8_t bcch_frequency_list[16]; |
| 1074 | uint8_t ncc_permitted; |
| 1075 | struct gsm48_rach_control rach_control; |
| 1076 | } __attribute__ ((packed)); |
| 1077 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1078 | /* Section 9.1.33 System information Type 2bis */ |
| 1079 | struct gsm48_system_information_type_2bis { |
| 1080 | struct gsm48_system_information_type_header header; |
| 1081 | uint8_t bcch_frequency_list[16]; |
| 1082 | struct gsm48_rach_control rach_control; |
| 1083 | uint8_t rest_octets[0]; |
| 1084 | } __attribute__ ((packed)); |
| 1085 | |
| 1086 | /* Section 9.1.34 System information Type 2ter */ |
| 1087 | struct gsm48_system_information_type_2ter { |
| 1088 | struct gsm48_system_information_type_header header; |
| 1089 | uint8_t ext_bcch_frequency_list[16]; |
| 1090 | uint8_t rest_octets[0]; |
| 1091 | } __attribute__ ((packed)); |
| 1092 | |
Max | e859aec | 2016-03-11 12:24:04 +0100 | [diff] [blame] | 1093 | /* Section 9.1.34a System information Type 2quater */ |
| 1094 | struct gsm48_system_information_type_2quater { |
| 1095 | struct gsm48_system_information_type_header header; |
| 1096 | uint8_t rest_octets[0]; |
| 1097 | } __attribute__ ((packed)); |
| 1098 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1099 | /* Section 9.1.35 System information Type 3 */ |
| 1100 | struct gsm48_system_information_type_3 { |
| 1101 | struct gsm48_system_information_type_header header; |
| 1102 | uint16_t cell_identity; |
| 1103 | struct gsm48_loc_area_id lai; |
| 1104 | struct gsm48_control_channel_descr control_channel_desc; |
| 1105 | struct gsm48_cell_options cell_options; |
| 1106 | struct gsm48_cell_sel_par cell_sel_par; |
| 1107 | struct gsm48_rach_control rach_control; |
| 1108 | uint8_t rest_octets[0]; |
| 1109 | } __attribute__ ((packed)); |
| 1110 | |
| 1111 | /* Section 9.1.36 System information Type 4 */ |
| 1112 | struct gsm48_system_information_type_4 { |
| 1113 | struct gsm48_system_information_type_header header; |
| 1114 | struct gsm48_loc_area_id lai; |
| 1115 | struct gsm48_cell_sel_par cell_sel_par; |
| 1116 | struct gsm48_rach_control rach_control; |
| 1117 | /* optional CBCH conditional CBCH... followed by |
| 1118 | mandantory SI 4 Reset Octets |
| 1119 | */ |
| 1120 | uint8_t data[0]; |
| 1121 | } __attribute__ ((packed)); |
| 1122 | |
| 1123 | /* Section 9.1.37 System information Type 5 */ |
| 1124 | struct gsm48_system_information_type_5 { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1125 | #if OSMO_IS_LITTLE_ENDIAN |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1126 | uint8_t rr_protocol_discriminator :4, |
Pau Espin Pedrol | ab6d6cf | 2019-10-31 13:34:57 +0100 | [diff] [blame] | 1127 | skip_indicator:4; |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1128 | uint8_t system_information; |
| 1129 | uint8_t bcch_frequency_list[16]; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1130 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 1131 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1132 | uint8_t skip_indicator:4, rr_protocol_discriminator:4; |
| 1133 | uint8_t system_information; |
| 1134 | uint8_t bcch_frequency_list[16]; |
| 1135 | #endif |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1136 | } __attribute__ ((packed)); |
| 1137 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1138 | /* Section 9.1.38 System information Type 5bis */ |
| 1139 | struct gsm48_system_information_type_5bis { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1140 | #if OSMO_IS_LITTLE_ENDIAN |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1141 | uint8_t rr_protocol_discriminator :4, |
| 1142 | skip_indicator:4; |
| 1143 | uint8_t system_information; |
| 1144 | uint8_t bcch_frequency_list[16]; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1145 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 1146 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1147 | uint8_t skip_indicator:4, rr_protocol_discriminator:4; |
| 1148 | uint8_t system_information; |
| 1149 | uint8_t bcch_frequency_list[16]; |
| 1150 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1151 | } __attribute__ ((packed)); |
| 1152 | |
| 1153 | /* Section 9.1.39 System information Type 5ter */ |
| 1154 | struct gsm48_system_information_type_5ter { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1155 | #if OSMO_IS_LITTLE_ENDIAN |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1156 | uint8_t rr_protocol_discriminator :4, |
| 1157 | skip_indicator:4; |
| 1158 | uint8_t system_information; |
| 1159 | uint8_t bcch_frequency_list[16]; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1160 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 1161 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1162 | uint8_t skip_indicator:4, rr_protocol_discriminator:4; |
| 1163 | uint8_t system_information; |
| 1164 | uint8_t bcch_frequency_list[16]; |
| 1165 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1166 | } __attribute__ ((packed)); |
| 1167 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1168 | /* Section 9.1.40 System information Type 6 */ |
| 1169 | struct gsm48_system_information_type_6 { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1170 | #if OSMO_IS_LITTLE_ENDIAN |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1171 | uint8_t rr_protocol_discriminator :4, |
Pau Espin Pedrol | ab6d6cf | 2019-10-31 13:34:57 +0100 | [diff] [blame] | 1172 | skip_indicator:4; |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1173 | uint8_t system_information; |
| 1174 | uint16_t cell_identity; |
| 1175 | struct gsm48_loc_area_id lai; |
| 1176 | struct gsm48_cell_options cell_options; |
| 1177 | uint8_t ncc_permitted; |
| 1178 | uint8_t rest_octets[0]; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1179 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 1180 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1181 | uint8_t skip_indicator:4, rr_protocol_discriminator:4; |
| 1182 | uint8_t system_information; |
| 1183 | uint16_t cell_identity; |
| 1184 | struct gsm48_loc_area_id lai; |
| 1185 | struct gsm48_cell_options cell_options; |
| 1186 | uint8_t ncc_permitted; |
| 1187 | uint8_t rest_octets[0]; |
| 1188 | #endif |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1189 | } __attribute__ ((packed)); |
| 1190 | |
Max | b31a2b5 | 2023-01-26 21:31:53 +0300 | [diff] [blame] | 1191 | /* Section 9.1.50 System Information type 10 (ASCI) */ |
| 1192 | struct gsm48_system_information_type_10 { |
| 1193 | #if OSMO_IS_LITTLE_ENDIAN |
Andreas Eversberg | 86efdf4 | 2023-05-15 11:44:12 +0200 | [diff] [blame] | 1194 | uint8_t l2_header:2, /* < short layer 2 header : bit(2) > See 3GPP TS 44.006 ยง6.4a */ |
Max | b31a2b5 | 2023-01-26 21:31:53 +0300 | [diff] [blame] | 1195 | msg_type:5, /* < message type : bit(5) > See 3GPP TS 44.018 Table 10.4.2 */ |
Andreas Eversberg | 86efdf4 | 2023-05-15 11:44:12 +0200 | [diff] [blame] | 1196 | rr_short_pd:1; /* < RR short PD : bit > See 3GPP TS 24.007 ยง11.3.2 */ |
Max | b31a2b5 | 2023-01-26 21:31:53 +0300 | [diff] [blame] | 1197 | uint8_t rest_octets[0]; /* < SI10 Rest Octets : bit(160) > See 3GPP TS 44.018 ยง10.5.2.44 */ |
| 1198 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 1199 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Andreas Eversberg | 86efdf4 | 2023-05-15 11:44:12 +0200 | [diff] [blame] | 1200 | uint8_t rr_short_pd:1, msg_type:5, l2_header:2; |
Max | b31a2b5 | 2023-01-26 21:31:53 +0300 | [diff] [blame] | 1201 | uint8_t rest_octets[0]; |
| 1202 | #endif |
| 1203 | } __attribute__ ((packed)); |
| 1204 | |
Andreas Eversberg | 29a9fc0 | 2023-06-12 13:46:52 +0200 | [diff] [blame] | 1205 | /* TS 44.018 Section 9.1.49 */ |
| 1206 | struct gsm0408_vgcs_ul_grant { |
| 1207 | struct gsm48_hdr hdr; |
| 1208 | struct gsm48_req_ref req_ref; |
| 1209 | uint8_t ta; |
| 1210 | } __attribute__ ((packed)); |
| 1211 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1212 | /* Section 9.1.43a System Information type 13 */ |
| 1213 | struct gsm48_system_information_type_13 { |
| 1214 | struct gsm48_system_information_type_header header; |
| 1215 | uint8_t rest_octets[0]; |
| 1216 | } __attribute__ ((packed)); |
| 1217 | |
| 1218 | /* Section 9.2.12 IMSI Detach Indication */ |
| 1219 | struct gsm48_imsi_detach_ind { |
| 1220 | struct gsm48_classmark1 classmark1; |
| 1221 | uint8_t mi_len; |
| 1222 | uint8_t mi[0]; |
| 1223 | } __attribute__ ((packed)); |
| 1224 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1225 | /* Section 9.1.1 */ |
| 1226 | struct gsm48_add_ass { |
| 1227 | /* Semantic is from 10.5.2.5 */ |
| 1228 | struct gsm48_chan_desc chan_desc; |
| 1229 | uint8_t data[0]; |
| 1230 | } __attribute__((packed)); |
| 1231 | |
| 1232 | /* Section 9.1.3 */ |
| 1233 | struct gsm48_ass_cpl { |
| 1234 | uint8_t rr_cause; |
| 1235 | } __attribute__((packed)); |
| 1236 | |
| 1237 | /* Section 9.1.4 */ |
| 1238 | struct gsm48_ass_fail { |
| 1239 | uint8_t rr_cause; |
| 1240 | } __attribute__((packed)); |
| 1241 | |
Andreas Eversberg | fa83201 | 2010-09-01 23:37:07 +0200 | [diff] [blame] | 1242 | /* Section 9.1.3 */ |
| 1243 | struct gsm48_ho_cpl { |
| 1244 | uint8_t rr_cause; |
| 1245 | uint8_t data[0]; |
| 1246 | } __attribute__((packed)); |
| 1247 | |
| 1248 | /* Section 9.1.4 */ |
| 1249 | struct gsm48_ho_fail { |
| 1250 | uint8_t rr_cause; |
| 1251 | } __attribute__((packed)); |
| 1252 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1253 | /* Section 9.1.7 */ |
| 1254 | struct gsm48_chan_rel { |
| 1255 | uint8_t rr_cause; |
| 1256 | uint8_t data[0]; |
| 1257 | } __attribute__((packed)); |
| 1258 | |
| 1259 | /* Section 9.1.9 */ |
| 1260 | struct gsm48_cip_mode_cmd { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1261 | #if OSMO_IS_LITTLE_ENDIAN |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1262 | uint8_t sc:1, |
| 1263 | alg_id:3, |
Sylvain Munaut | 77b6f6c | 2010-09-17 13:55:45 +0200 | [diff] [blame] | 1264 | cr:1, |
| 1265 | spare:3; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1266 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 1267 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1268 | uint8_t spare:3, cr:1, alg_id:3, sc:1; |
| 1269 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1270 | } __attribute__((packed)); |
| 1271 | |
| 1272 | /* Section 9.1.11 */ |
| 1273 | struct gsm48_cm_change { |
| 1274 | uint8_t cm2_len; |
| 1275 | struct gsm48_classmark2 cm2; |
| 1276 | uint8_t data[0]; |
| 1277 | } __attribute__((packed)); |
| 1278 | |
| 1279 | /* Section 9.1.19 */ |
| 1280 | struct gsm48_imm_ass_ext { |
| 1281 | uint8_t l2_plen; |
| 1282 | uint8_t proto_discr; |
| 1283 | uint8_t msg_type; |
| 1284 | uint8_t page_mode; |
| 1285 | struct gsm48_chan_desc chan_desc1; |
| 1286 | struct gsm48_req_ref req_ref1; |
| 1287 | uint8_t timing_advance1; |
| 1288 | struct gsm48_chan_desc chan_desc2; |
| 1289 | struct gsm48_req_ref req_ref2; |
| 1290 | uint8_t timing_advance2; |
| 1291 | uint8_t mob_alloc_len; |
| 1292 | uint8_t mob_alloc[0]; |
| 1293 | } __attribute__ ((packed)); |
| 1294 | |
| 1295 | /* Section 9.1.20 */ |
| 1296 | struct gsm48_imm_ass_rej { |
| 1297 | uint8_t l2_plen; |
| 1298 | uint8_t proto_discr; |
| 1299 | uint8_t msg_type; |
| 1300 | uint8_t page_mode; |
| 1301 | struct gsm48_req_ref req_ref1; |
| 1302 | uint8_t wait_ind1; |
| 1303 | struct gsm48_req_ref req_ref2; |
| 1304 | uint8_t wait_ind2; |
| 1305 | struct gsm48_req_ref req_ref3; |
| 1306 | uint8_t wait_ind3; |
| 1307 | struct gsm48_req_ref req_ref4; |
| 1308 | uint8_t wait_ind4; |
| 1309 | uint8_t rest[0]; |
| 1310 | } __attribute__ ((packed)); |
| 1311 | |
Andreas Eversberg | a0635fc | 2023-06-01 10:13:50 +0200 | [diff] [blame] | 1312 | /* Section 9.1.21b */ |
| 1313 | struct gsm48_notification_nch { |
| 1314 | uint8_t l2_plen; |
| 1315 | uint8_t proto_discr; |
| 1316 | uint8_t msg_type; |
| 1317 | uint8_t data[0]; |
| 1318 | } __attribute__((packed)); |
| 1319 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1320 | /* Section 9.1.22 */ |
| 1321 | struct gsm48_paging1 { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1322 | #if OSMO_IS_LITTLE_ENDIAN |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1323 | uint8_t l2_plen; |
| 1324 | uint8_t proto_discr; |
| 1325 | uint8_t msg_type; |
| 1326 | uint8_t pag_mode:2, |
| 1327 | spare:2, |
| 1328 | cneed1:2, |
| 1329 | cneed2:2; |
| 1330 | uint8_t data[0]; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1331 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 1332 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1333 | uint8_t l2_plen; |
| 1334 | uint8_t proto_discr; |
| 1335 | uint8_t msg_type; |
| 1336 | uint8_t cneed2:2, cneed1:2, spare:2, pag_mode:2; |
| 1337 | uint8_t data[0]; |
| 1338 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1339 | } __attribute__((packed)); |
| 1340 | |
| 1341 | /* Section 9.1.23 */ |
| 1342 | struct gsm48_paging2 { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1343 | #if OSMO_IS_LITTLE_ENDIAN |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1344 | uint8_t l2_plen; |
| 1345 | uint8_t proto_discr; |
| 1346 | uint8_t msg_type; |
| 1347 | uint8_t pag_mode:2, |
| 1348 | spare:2, |
| 1349 | cneed1:2, |
| 1350 | cneed2:2; |
| 1351 | uint32_t tmsi1; |
| 1352 | uint32_t tmsi2; |
| 1353 | uint8_t data[0]; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1354 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 1355 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1356 | uint8_t l2_plen; |
| 1357 | uint8_t proto_discr; |
| 1358 | uint8_t msg_type; |
| 1359 | uint8_t cneed2:2, cneed1:2, spare:2, pag_mode:2; |
| 1360 | uint32_t tmsi1; |
| 1361 | uint32_t tmsi2; |
| 1362 | uint8_t data[0]; |
| 1363 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1364 | } __attribute__((packed)); |
| 1365 | |
| 1366 | /* Section 9.1.24 */ |
| 1367 | struct gsm48_paging3 { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1368 | #if OSMO_IS_LITTLE_ENDIAN |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1369 | uint8_t l2_plen; |
| 1370 | uint8_t proto_discr; |
| 1371 | uint8_t msg_type; |
| 1372 | uint8_t pag_mode:2, |
| 1373 | spare:2, |
| 1374 | cneed1:2, |
| 1375 | cneed2:2; |
| 1376 | uint32_t tmsi1; |
| 1377 | uint32_t tmsi2; |
| 1378 | uint32_t tmsi3; |
| 1379 | uint32_t tmsi4; |
| 1380 | uint8_t cneed3:2, |
| 1381 | cneed4:2, |
| 1382 | spare2:4; |
| 1383 | uint8_t rest[0]; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1384 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 1385 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1386 | uint8_t l2_plen; |
| 1387 | uint8_t proto_discr; |
| 1388 | uint8_t msg_type; |
| 1389 | uint8_t cneed2:2, cneed1:2, spare:2, pag_mode:2; |
| 1390 | uint32_t tmsi1; |
| 1391 | uint32_t tmsi2; |
| 1392 | uint32_t tmsi3; |
| 1393 | uint32_t tmsi4; |
| 1394 | uint8_t spare2:4, cneed4:2, cneed3:2; |
| 1395 | uint8_t rest[0]; |
| 1396 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1397 | } __attribute__((packed)); |
| 1398 | |
| 1399 | /* Section 9.1.25 */ |
| 1400 | struct gsm48_pag_rsp { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1401 | #if OSMO_IS_LITTLE_ENDIAN |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1402 | uint8_t key_seq:3, |
| 1403 | spare:5; |
| 1404 | uint8_t cm2_len; |
| 1405 | struct gsm48_classmark2 cm2; |
| 1406 | uint8_t data[0]; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1407 | #elif OSMO_IS_BIG_ENDIAN |
Oliver Smith | 0b5c09b | 2023-02-17 10:35:38 +0100 | [diff] [blame] | 1408 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 1409 | uint8_t spare:5, key_seq:3; |
| 1410 | uint8_t cm2_len; |
| 1411 | struct gsm48_classmark2 cm2; |
| 1412 | uint8_t data[0]; |
| 1413 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1414 | } __attribute__((packed)); |
| 1415 | |
| 1416 | /* Section 9.1.29 */ |
| 1417 | struct gsm48_rr_status { |
| 1418 | uint8_t rr_cause; |
| 1419 | } __attribute__((packed)); |
| 1420 | |
Andreas Eversberg | 84d5a82 | 2023-09-11 18:26:45 +0200 | [diff] [blame] | 1421 | /* Section 9.1.44 */ |
| 1422 | struct gsm48_talker_indication { |
| 1423 | uint8_t cm2_len; |
| 1424 | struct gsm48_classmark2 cm2; |
| 1425 | uint8_t data[0]; |
| 1426 | } __attribute__((packed)); |
| 1427 | |
| 1428 | /* Section 9.1.48 */ |
| 1429 | struct gsm48_uplink_release { |
| 1430 | uint8_t rr_cause; |
| 1431 | } __attribute__((packed)); |
| 1432 | |
Harald Welte | 3f066dd | 2017-05-29 15:59:03 +0200 | [diff] [blame] | 1433 | /* Section 10.2 + GSM 04.07 12.2.3.1.1 + 3GPP TS 24.007 11.2.3.1.1 */ |
Harald Welte | 753ae49 | 2019-05-18 11:07:54 +0200 | [diff] [blame] | 1434 | #define GSM48_PDISC_GROUP_CC 0x00 |
| 1435 | #define GSM48_PDISC_BCAST_CC 0x01 |
| 1436 | #define GSM48_PDISC_PDSS1 0x02 /* 04.07 only */ |
| 1437 | #define GSM48_PDISC_CC 0x03 |
| 1438 | #define GSM48_PDISC_PDSS2 0x04 /* 04.07 only */ |
| 1439 | #define GSM48_PDISC_GTTP 0x04 /* 24.007 only */ |
| 1440 | #define GSM48_PDISC_MM 0x05 |
| 1441 | #define GSM48_PDISC_RR 0x06 |
| 1442 | #define GSM48_PDISC_MM_GPRS 0x08 |
| 1443 | #define GSM48_PDISC_SMS 0x09 |
| 1444 | #define GSM48_PDISC_SM_GPRS 0x0a |
| 1445 | #define GSM48_PDISC_NC_SS 0x0b |
| 1446 | #define GSM48_PDISC_LOC 0x0c |
| 1447 | #define GSM48_PDISC_EXTEND 0x0e |
| 1448 | #define GSM48_PDISC_TEST 0x0f /* as per 11.10, 04.14 */ |
| 1449 | #define GSM48_PDISC_MASK 0x0f |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1450 | |
Andreas Eversberg | bfb917f | 2023-05-10 17:07:36 +0200 | [diff] [blame] | 1451 | /* Section 11.3.2.1 3GPP TS 24.007: Short PDISC */ |
| 1452 | #define GSM48_PDISC_SH_RR 0 |
| 1453 | |
Neels Hofmeyr | dbd994c | 2017-03-09 23:07:02 +0100 | [diff] [blame] | 1454 | extern const struct value_string gsm48_pdisc_names[]; |
Harald Welte | 753ae49 | 2019-05-18 11:07:54 +0200 | [diff] [blame] | 1455 | static inline const char *gsm48_pdisc_name(uint8_t val) |
Neels Hofmeyr | dbd994c | 2017-03-09 23:07:02 +0100 | [diff] [blame] | 1456 | { return get_value_string(gsm48_pdisc_names, val); } |
| 1457 | |
Max | fdca25d | 2016-07-05 16:06:28 +0200 | [diff] [blame] | 1458 | bool gsm48_hdr_gmm_cipherable(const struct gsm48_hdr *hdr); |
| 1459 | |
Harald Welte | 753ae49 | 2019-05-18 11:07:54 +0200 | [diff] [blame] | 1460 | static inline uint8_t gsm48_hdr_pdisc(const struct gsm48_hdr *hdr) |
Neels Hofmeyr | 282e908 | 2016-03-14 16:06:46 +0100 | [diff] [blame] | 1461 | { |
| 1462 | /* |
| 1463 | * 3GPP TS 24.007 version 12.0.0 Release 12, |
| 1464 | * 11.2.3.1.1 Protocol discriminator |
| 1465 | */ |
| 1466 | uint8_t pdisc = hdr->proto_discr & GSM48_PDISC_MASK; |
| 1467 | if (pdisc == GSM48_PDISC_EXTEND) |
| 1468 | return hdr->proto_discr; |
| 1469 | return pdisc; |
| 1470 | } |
| 1471 | |
Neels Hofmeyr | da7bf4d | 2016-03-14 16:06:48 +0100 | [diff] [blame] | 1472 | static inline uint8_t gsm48_hdr_trans_id(const struct gsm48_hdr *hdr) |
| 1473 | { |
| 1474 | /* |
| 1475 | * 3GPP TS 24.007 version 12.0.0 Release 12, |
| 1476 | * 11.2.3.1.3 Transaction identifier |
| 1477 | */ |
| 1478 | return (hdr->proto_discr & 0xf0) >> 4; |
| 1479 | } |
| 1480 | |
Max | da34bf0 | 2016-07-17 16:37:56 +0200 | [diff] [blame] | 1481 | #define GSM48_TA_INVALID 220 |
| 1482 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 1483 | /*! Check if TA is valid according to 3GPP TS 44.018 ยง 10.5.2.40 |
Max | edb57e7 | 2016-07-14 11:35:17 +0200 | [diff] [blame] | 1484 | * \param[in] ta Timing Advance value |
| 1485 | * \returns true if ta is valid, false otherwise |
| 1486 | * Note: Rules for GSM400 band are ignored as it's not implemented in practice. |
| 1487 | */ |
| 1488 | static inline bool gsm48_ta_is_valid(uint8_t ta) |
| 1489 | { |
| 1490 | return (ta < 64); |
| 1491 | } |
| 1492 | |
Neels Hofmeyr | da7bf4d | 2016-03-14 16:06:48 +0100 | [diff] [blame] | 1493 | static inline uint8_t gsm48_hdr_trans_id_flip_ti(const struct gsm48_hdr *hdr) |
| 1494 | { |
| 1495 | return gsm48_hdr_trans_id(hdr) ^ 0x08; |
| 1496 | } |
| 1497 | |
| 1498 | static inline uint8_t gsm48_hdr_trans_id_no_ti(const struct gsm48_hdr *hdr) |
| 1499 | { |
| 1500 | return gsm48_hdr_trans_id(hdr) & 0x07; |
| 1501 | } |
| 1502 | |
Neels Hofmeyr | 282e908 | 2016-03-14 16:06:46 +0100 | [diff] [blame] | 1503 | static inline uint8_t gsm48_hdr_msg_type_r98(const struct gsm48_hdr *hdr) |
| 1504 | { |
| 1505 | /* |
| 1506 | * 3GPP TS 24.007 version 12.0.0 Release 12, |
| 1507 | * 11.2.3.2.1 Message type octet (when accessing Release 98 and older |
| 1508 | * networks only) |
| 1509 | */ |
| 1510 | switch (gsm48_hdr_pdisc(hdr)) { |
| 1511 | case GSM48_PDISC_MM: |
| 1512 | case GSM48_PDISC_CC: |
| 1513 | case GSM48_PDISC_NC_SS: |
| 1514 | case GSM48_PDISC_GROUP_CC: |
| 1515 | case GSM48_PDISC_BCAST_CC: |
| 1516 | case GSM48_PDISC_LOC: |
Harald Welte | 143aed7 | 2018-02-03 21:14:47 +0100 | [diff] [blame] | 1517 | return hdr->msg_type & 0x3f; |
Neels Hofmeyr | 282e908 | 2016-03-14 16:06:46 +0100 | [diff] [blame] | 1518 | default: |
| 1519 | return hdr->msg_type; |
| 1520 | } |
| 1521 | } |
| 1522 | |
| 1523 | static inline uint8_t gsm48_hdr_msg_type_r99(const struct gsm48_hdr *hdr) |
| 1524 | { |
| 1525 | /* |
| 1526 | * 3GPP TS 24.007 version 12.0.0 Release 12, |
| 1527 | * 11.2.3.2.2 Message type octet (when accessing Release 99 and newer |
| 1528 | * networks) |
| 1529 | */ |
| 1530 | switch (gsm48_hdr_pdisc(hdr)) { |
| 1531 | case GSM48_PDISC_MM: |
| 1532 | case GSM48_PDISC_CC: |
Neels Hofmeyr | 282e908 | 2016-03-14 16:06:46 +0100 | [diff] [blame] | 1533 | case GSM48_PDISC_NC_SS: |
Harald Welte | f1076ed | 2018-02-03 21:16:45 +0100 | [diff] [blame] | 1534 | return hdr->msg_type & 0x3f; |
Neels Hofmeyr | 282e908 | 2016-03-14 16:06:46 +0100 | [diff] [blame] | 1535 | case GSM48_PDISC_GROUP_CC: |
| 1536 | case GSM48_PDISC_BCAST_CC: |
| 1537 | case GSM48_PDISC_LOC: |
Harald Welte | 143aed7 | 2018-02-03 21:14:47 +0100 | [diff] [blame] | 1538 | return hdr->msg_type & 0x3f; |
Neels Hofmeyr | 282e908 | 2016-03-14 16:06:46 +0100 | [diff] [blame] | 1539 | default: |
| 1540 | return hdr->msg_type; |
| 1541 | } |
| 1542 | } |
| 1543 | |
Max | fe65fa7 | 2016-05-10 17:17:05 +0200 | [diff] [blame] | 1544 | void gsm48_set_dtx(struct gsm48_cell_options *op, enum gsm48_dtx_mode full, |
| 1545 | enum gsm48_dtx_mode half, bool is_bcch); |
| 1546 | |
Neels Hofmeyr | c656fae | 2016-03-14 16:06:47 +0100 | [diff] [blame] | 1547 | #define gsm48_hdr_msg_type gsm48_hdr_msg_type_r99 |
Neels Hofmeyr | 282e908 | 2016-03-14 16:06:46 +0100 | [diff] [blame] | 1548 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1549 | /* Section 10.4 */ |
| 1550 | #define GSM48_MT_RR_INIT_REQ 0x3c |
| 1551 | #define GSM48_MT_RR_ADD_ASS 0x3b |
| 1552 | #define GSM48_MT_RR_IMM_ASS 0x3f |
| 1553 | #define GSM48_MT_RR_IMM_ASS_EXT 0x39 |
| 1554 | #define GSM48_MT_RR_IMM_ASS_REJ 0x3a |
Philipp | 72e43f0 | 2016-10-27 13:35:20 +0200 | [diff] [blame] | 1555 | #define GSM48_MT_RR_DTM_ASS_FAIL 0x48 |
| 1556 | #define GSM48_MT_RR_DTM_REJECT 0x49 |
| 1557 | #define GSM48_MT_RR_DTM_REQUEST 0x4A |
| 1558 | #define GSM48_MT_RR_PACKET_ASS 0x4B |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1559 | |
| 1560 | #define GSM48_MT_RR_CIPH_M_CMD 0x35 |
| 1561 | #define GSM48_MT_RR_CIPH_M_COMPL 0x32 |
| 1562 | |
| 1563 | #define GSM48_MT_RR_CFG_CHG_CMD 0x30 |
| 1564 | #define GSM48_MT_RR_CFG_CHG_ACK 0x31 |
| 1565 | #define GSM48_MT_RR_CFG_CHG_REJ 0x33 |
| 1566 | |
| 1567 | #define GSM48_MT_RR_ASS_CMD 0x2e |
| 1568 | #define GSM48_MT_RR_ASS_COMPL 0x29 |
| 1569 | #define GSM48_MT_RR_ASS_FAIL 0x2f |
| 1570 | #define GSM48_MT_RR_HANDO_CMD 0x2b |
| 1571 | #define GSM48_MT_RR_HANDO_COMPL 0x2c |
| 1572 | #define GSM48_MT_RR_HANDO_FAIL 0x28 |
| 1573 | #define GSM48_MT_RR_HANDO_INFO 0x2d |
Philipp | 72e43f0 | 2016-10-27 13:35:20 +0200 | [diff] [blame] | 1574 | #define GSM48_MT_RR_HANDO_INFO 0x2d |
| 1575 | #define GSM48_MT_RR_DTM_ASS_CMD 0x4c |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1576 | |
| 1577 | #define GSM48_MT_RR_CELL_CHG_ORDER 0x08 |
| 1578 | #define GSM48_MT_RR_PDCH_ASS_CMD 0x23 |
| 1579 | |
| 1580 | #define GSM48_MT_RR_CHAN_REL 0x0d |
| 1581 | #define GSM48_MT_RR_PART_REL 0x0a |
| 1582 | #define GSM48_MT_RR_PART_REL_COMP 0x0f |
| 1583 | |
| 1584 | #define GSM48_MT_RR_PAG_REQ_1 0x21 |
| 1585 | #define GSM48_MT_RR_PAG_REQ_2 0x22 |
| 1586 | #define GSM48_MT_RR_PAG_REQ_3 0x24 |
| 1587 | #define GSM48_MT_RR_PAG_RESP 0x27 |
| 1588 | #define GSM48_MT_RR_NOTIF_NCH 0x20 |
Philipp | 72e43f0 | 2016-10-27 13:35:20 +0200 | [diff] [blame] | 1589 | #define GSM48_MT_RR_NOTIF_FACCH 0x25 /* (Reserved) */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1590 | #define GSM48_MT_RR_NOTIF_RESP 0x26 |
Philipp | 72e43f0 | 2016-10-27 13:35:20 +0200 | [diff] [blame] | 1591 | #define GSM48_MT_RR_PACKET_NOTIF 0x4e |
Philipp | 349784c | 2016-10-10 15:03:23 +0200 | [diff] [blame] | 1592 | #define GSM48_MT_RR_UTRAN_CLSM_CHG 0x60 |
| 1593 | #define GSM48_MT_RR_CDMA2K_CLSM_CHG 0x62 |
| 1594 | #define GSM48_MT_RR_IS_TO_UTRAN_HANDO 0x63 |
| 1595 | #define GSM48_MT_RR_IS_TO_CDMA2K_HANDO 0x64 |
| 1596 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1597 | #define GSM48_MT_RR_SYSINFO_8 0x18 |
| 1598 | #define GSM48_MT_RR_SYSINFO_1 0x19 |
| 1599 | #define GSM48_MT_RR_SYSINFO_2 0x1a |
| 1600 | #define GSM48_MT_RR_SYSINFO_3 0x1b |
| 1601 | #define GSM48_MT_RR_SYSINFO_4 0x1c |
| 1602 | #define GSM48_MT_RR_SYSINFO_5 0x1d |
| 1603 | #define GSM48_MT_RR_SYSINFO_6 0x1e |
| 1604 | #define GSM48_MT_RR_SYSINFO_7 0x1f |
| 1605 | |
| 1606 | #define GSM48_MT_RR_SYSINFO_2bis 0x02 |
| 1607 | #define GSM48_MT_RR_SYSINFO_2ter 0x03 |
Max | e859aec | 2016-03-11 12:24:04 +0100 | [diff] [blame] | 1608 | #define GSM48_MT_RR_SYSINFO_2quater 0x07 |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1609 | #define GSM48_MT_RR_SYSINFO_5bis 0x05 |
| 1610 | #define GSM48_MT_RR_SYSINFO_5ter 0x06 |
| 1611 | #define GSM48_MT_RR_SYSINFO_9 0x04 |
| 1612 | #define GSM48_MT_RR_SYSINFO_13 0x00 |
| 1613 | |
| 1614 | #define GSM48_MT_RR_SYSINFO_16 0x3d |
| 1615 | #define GSM48_MT_RR_SYSINFO_17 0x3e |
| 1616 | |
Philipp | 72e43f0 | 2016-10-27 13:35:20 +0200 | [diff] [blame] | 1617 | #define GSM48_MT_RR_SYSINFO_18 0x40 |
| 1618 | #define GSM48_MT_RR_SYSINFO_19 0x41 |
| 1619 | #define GSM48_MT_RR_SYSINFO_20 0x42 |
| 1620 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1621 | #define GSM48_MT_RR_CHAN_MODE_MODIF 0x10 |
| 1622 | #define GSM48_MT_RR_STATUS 0x12 |
| 1623 | #define GSM48_MT_RR_CHAN_MODE_MODIF_ACK 0x17 |
| 1624 | #define GSM48_MT_RR_FREQ_REDEF 0x14 |
| 1625 | #define GSM48_MT_RR_MEAS_REP 0x15 |
| 1626 | #define GSM48_MT_RR_CLSM_CHG 0x16 |
| 1627 | #define GSM48_MT_RR_CLSM_ENQ 0x13 |
| 1628 | #define GSM48_MT_RR_EXT_MEAS_REP 0x36 |
| 1629 | #define GSM48_MT_RR_EXT_MEAS_REP_ORD 0x37 |
| 1630 | #define GSM48_MT_RR_GPRS_SUSP_REQ 0x34 |
Philipp | 72e43f0 | 2016-10-27 13:35:20 +0200 | [diff] [blame] | 1631 | #define GSM48_MT_RR_DTM_INFO 0x4d |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1632 | |
Bhaskar | e6b45d8 | 2013-05-16 17:11:51 +0530 | [diff] [blame] | 1633 | #define GSM48_MT_RR_VGCS_UPL_GRANT 0x09 |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1634 | #define GSM48_MT_RR_UPLINK_RELEASE 0x0e |
| 1635 | #define GSM48_MT_RR_UPLINK_FREE 0x0c |
| 1636 | #define GSM48_MT_RR_UPLINK_BUSY 0x2a |
| 1637 | #define GSM48_MT_RR_TALKER_IND 0x11 |
| 1638 | |
| 1639 | #define GSM48_MT_RR_APP_INFO 0x38 |
| 1640 | |
Max | 600d4ee | 2023-01-23 21:49:52 +0300 | [diff] [blame] | 1641 | /* 3GPP TS 44.018 Table 10.4.2 */ |
| 1642 | #define GSM48_MT_RR_SH_SI10 0x0 |
| 1643 | #define GSM48_MT_RR_SH_FACCH 0x1 |
| 1644 | #define GSM48_MT_RR_SH_UL_FREE 0x2 |
| 1645 | #define GSM48_MT_RR_SH_MEAS_REP 0x4 |
| 1646 | #define GSM48_MT_RR_SH_MEAS_INFO 0x5 |
| 1647 | #define GSM48_MT_RR_SH_VGCS_RECON 0x6 |
| 1648 | #define GSM48_MT_RR_SH_VGCS_RECON2 0x7 |
| 1649 | #define GSM48_MT_RR_SH_VGCS_INFO 0x8 |
| 1650 | #define GSM48_MT_RR_SH_VGCS_SMS 0x9 |
| 1651 | #define GSM48_MT_RR_SH_SI10bis 0xA |
| 1652 | #define GSM48_MT_RR_SH_SI10ter 0xB |
| 1653 | #define GSM48_MT_RR_SH_VGCS_NEIGH 0xC |
| 1654 | #define GSM48_MT_RR_SH_APP_DATA 0xD |
| 1655 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1656 | /* Table 10.2/3GPP TS 04.08 */ |
| 1657 | #define GSM48_MT_MM_IMSI_DETACH_IND 0x01 |
| 1658 | #define GSM48_MT_MM_LOC_UPD_ACCEPT 0x02 |
| 1659 | #define GSM48_MT_MM_LOC_UPD_REJECT 0x04 |
| 1660 | #define GSM48_MT_MM_LOC_UPD_REQUEST 0x08 |
| 1661 | |
| 1662 | #define GSM48_MT_MM_AUTH_REJ 0x11 |
| 1663 | #define GSM48_MT_MM_AUTH_REQ 0x12 |
| 1664 | #define GSM48_MT_MM_AUTH_RESP 0x14 |
Neels Hofmeyr | 55a43b8 | 2017-02-02 20:27:55 +0100 | [diff] [blame] | 1665 | #define GSM48_MT_MM_AUTH_FAIL 0x1c |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1666 | #define GSM48_MT_MM_ID_REQ 0x18 |
| 1667 | #define GSM48_MT_MM_ID_RESP 0x19 |
| 1668 | #define GSM48_MT_MM_TMSI_REALL_CMD 0x1a |
| 1669 | #define GSM48_MT_MM_TMSI_REALL_COMPL 0x1b |
| 1670 | |
| 1671 | #define GSM48_MT_MM_CM_SERV_ACC 0x21 |
| 1672 | #define GSM48_MT_MM_CM_SERV_REJ 0x22 |
| 1673 | #define GSM48_MT_MM_CM_SERV_ABORT 0x23 |
| 1674 | #define GSM48_MT_MM_CM_SERV_REQ 0x24 |
| 1675 | #define GSM48_MT_MM_CM_SERV_PROMPT 0x25 |
| 1676 | #define GSM48_MT_MM_CM_REEST_REQ 0x28 |
| 1677 | #define GSM48_MT_MM_ABORT 0x29 |
| 1678 | |
| 1679 | #define GSM48_MT_MM_NULL 0x30 |
| 1680 | #define GSM48_MT_MM_STATUS 0x31 |
| 1681 | #define GSM48_MT_MM_INFO 0x32 |
| 1682 | |
| 1683 | /* Table 10.3/3GPP TS 04.08 */ |
| 1684 | #define GSM48_MT_CC_ALERTING 0x01 |
| 1685 | #define GSM48_MT_CC_CALL_CONF 0x08 |
| 1686 | #define GSM48_MT_CC_CALL_PROC 0x02 |
| 1687 | #define GSM48_MT_CC_CONNECT 0x07 |
| 1688 | #define GSM48_MT_CC_CONNECT_ACK 0x0f |
| 1689 | #define GSM48_MT_CC_EMERG_SETUP 0x0e |
| 1690 | #define GSM48_MT_CC_PROGRESS 0x03 |
| 1691 | #define GSM48_MT_CC_ESTAB 0x04 |
| 1692 | #define GSM48_MT_CC_ESTAB_CONF 0x06 |
| 1693 | #define GSM48_MT_CC_RECALL 0x0b |
| 1694 | #define GSM48_MT_CC_START_CC 0x09 |
| 1695 | #define GSM48_MT_CC_SETUP 0x05 |
| 1696 | |
| 1697 | #define GSM48_MT_CC_MODIFY 0x17 |
| 1698 | #define GSM48_MT_CC_MODIFY_COMPL 0x1f |
| 1699 | #define GSM48_MT_CC_MODIFY_REJECT 0x13 |
| 1700 | #define GSM48_MT_CC_USER_INFO 0x10 |
| 1701 | #define GSM48_MT_CC_HOLD 0x18 |
| 1702 | #define GSM48_MT_CC_HOLD_ACK 0x19 |
| 1703 | #define GSM48_MT_CC_HOLD_REJ 0x1a |
| 1704 | #define GSM48_MT_CC_RETR 0x1c |
| 1705 | #define GSM48_MT_CC_RETR_ACK 0x1d |
| 1706 | #define GSM48_MT_CC_RETR_REJ 0x1e |
| 1707 | |
| 1708 | #define GSM48_MT_CC_DISCONNECT 0x25 |
| 1709 | #define GSM48_MT_CC_RELEASE 0x2d |
| 1710 | #define GSM48_MT_CC_RELEASE_COMPL 0x2a |
| 1711 | |
| 1712 | #define GSM48_MT_CC_CONG_CTRL 0x39 |
| 1713 | #define GSM48_MT_CC_NOTIFY 0x3e |
| 1714 | #define GSM48_MT_CC_STATUS 0x3d |
| 1715 | #define GSM48_MT_CC_STATUS_ENQ 0x34 |
| 1716 | #define GSM48_MT_CC_START_DTMF 0x35 |
| 1717 | #define GSM48_MT_CC_STOP_DTMF 0x31 |
| 1718 | #define GSM48_MT_CC_STOP_DTMF_ACK 0x32 |
| 1719 | #define GSM48_MT_CC_START_DTMF_ACK 0x36 |
| 1720 | #define GSM48_MT_CC_START_DTMF_REJ 0x37 |
| 1721 | #define GSM48_MT_CC_FACILITY 0x3a |
| 1722 | |
Neels Hofmeyr | 00ab9ed | 2017-03-09 23:27:56 +0100 | [diff] [blame] | 1723 | extern const struct value_string gsm48_rr_msgtype_names[]; |
| 1724 | extern const struct value_string gsm48_mm_msgtype_names[]; |
| 1725 | extern const struct value_string gsm48_cc_msgtype_names[]; |
| 1726 | const char *gsm48_pdisc_msgtype_name(uint8_t pdisc, uint8_t msg_type); |
Harald Welte | 4a62eda | 2019-03-18 18:27:00 +0100 | [diff] [blame] | 1727 | char *gsm48_pdisc_msgtype_name_buf(char *buf, size_t buf_len, uint8_t pdisc, uint8_t msg_type); |
Harald Welte | 179f357 | 2019-03-18 18:38:47 +0100 | [diff] [blame] | 1728 | char *gsm48_pdisc_msgtype_name_c(const void *ctx, uint8_t pdisc, uint8_t msg_type); |
Neels Hofmeyr | 00ab9ed | 2017-03-09 23:27:56 +0100 | [diff] [blame] | 1729 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1730 | /* FIXME: Table 10.4 / 10.4a (GPRS) */ |
| 1731 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1732 | /* Section 10.5.3.3 CM service type */ |
Neels Hofmeyr | f8963f9 | 2019-01-10 23:33:32 +0100 | [diff] [blame] | 1733 | enum osmo_cm_service_type { |
| 1734 | GSM48_CMSERV_MO_CALL_PACKET = 1, |
| 1735 | GSM48_CMSERV_EMERGENCY = 2, |
| 1736 | GSM48_CMSERV_SMS = 4, |
| 1737 | GSM48_CMSERV_SUP_SERV = 8, |
| 1738 | GSM48_CMSERV_VGCS = 9, |
| 1739 | GSM48_CMSERV_VBS = 10, |
| 1740 | GSM48_CMSERV_LOC_SERV = 11, |
| 1741 | GSM48_CMSERV_MAX_VAL = GSM48_CMSERV_LOC_SERV |
| 1742 | }; |
| 1743 | |
| 1744 | extern const struct value_string osmo_cm_service_type_names[]; |
| 1745 | static inline const char *osmo_cm_service_type_name(enum osmo_cm_service_type val) |
| 1746 | { return get_value_string(osmo_cm_service_type_names, val); } |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1747 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1748 | /* Section 10.5.2.26, Table 10.5.64 */ |
| 1749 | #define GSM48_PM_MASK 0x03 |
| 1750 | #define GSM48_PM_NORMAL 0x00 |
| 1751 | #define GSM48_PM_EXTENDED 0x01 |
| 1752 | #define GSM48_PM_REORG 0x02 |
| 1753 | #define GSM48_PM_SAME 0x03 |
| 1754 | |
| 1755 | /* Chapter 10.5.3.5 / Table 10.5.93 */ |
| 1756 | #define GSM48_LUPD_NORMAL 0x0 |
| 1757 | #define GSM48_LUPD_PERIODIC 0x1 |
| 1758 | #define GSM48_LUPD_IMSI_ATT 0x2 |
| 1759 | #define GSM48_LUPD_RESERVED 0x3 |
| 1760 | |
Neels Hofmeyr | 92f3f5e | 2019-01-05 00:39:13 +0100 | [diff] [blame] | 1761 | extern const struct value_string osmo_lu_type_names[]; |
| 1762 | static inline const char *osmo_lu_type_name(uint8_t lu_type) |
| 1763 | { return get_value_string(osmo_lu_type_names, lu_type); } |
| 1764 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1765 | /* Table 10.5.4 */ |
| 1766 | #define GSM_MI_TYPE_MASK 0x07 |
| 1767 | #define GSM_MI_TYPE_NONE 0x00 |
| 1768 | #define GSM_MI_TYPE_IMSI 0x01 |
| 1769 | #define GSM_MI_TYPE_IMEI 0x02 |
| 1770 | #define GSM_MI_TYPE_IMEISV 0x03 |
| 1771 | #define GSM_MI_TYPE_TMSI 0x04 |
| 1772 | #define GSM_MI_ODD 0x08 |
| 1773 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1774 | #define GSM48_IE_MOBILE_ID 0x17 /* 10.5.1.4 */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1775 | #define GSM48_IE_NAME_LONG 0x43 /* 10.5.3.5a */ |
| 1776 | #define GSM48_IE_NAME_SHORT 0x45 /* 10.5.3.5a */ |
| 1777 | #define GSM48_IE_UTC 0x46 /* 10.5.3.8 */ |
| 1778 | #define GSM48_IE_NET_TIME_TZ 0x47 /* 10.5.3.9 */ |
| 1779 | #define GSM48_IE_LSA_IDENT 0x48 /* 10.5.3.11 */ |
Jacob Erlbeck | 1c3f088 | 2013-09-16 10:29:57 +0200 | [diff] [blame] | 1780 | #define GSM48_IE_NET_DST 0x49 /* 10.5.3.12 [24.008] */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1781 | |
| 1782 | #define GSM48_IE_BEARER_CAP 0x04 /* 10.5.4.5 */ |
| 1783 | #define GSM48_IE_CAUSE 0x08 /* 10.5.4.11 */ |
| 1784 | #define GSM48_IE_CC_CAP 0x15 /* 10.5.4.5a */ |
| 1785 | #define GSM48_IE_ALERT 0x19 /* 10.5.4.26 */ |
| 1786 | #define GSM48_IE_FACILITY 0x1c /* 10.5.4.15 */ |
| 1787 | #define GSM48_IE_PROGR_IND 0x1e /* 10.5.4.21 */ |
| 1788 | #define GSM48_IE_AUX_STATUS 0x24 /* 10.5.4.4 */ |
| 1789 | #define GSM48_IE_NOTIFY 0x27 /* 10.5.4.20 */ |
| 1790 | #define GSM48_IE_KPD_FACILITY 0x2c /* 10.5.4.17 */ |
| 1791 | #define GSM48_IE_SIGNAL 0x34 /* 10.5.4.23 */ |
| 1792 | #define GSM48_IE_CONN_BCD 0x4c /* 10.5.4.13 */ |
| 1793 | #define GSM48_IE_CONN_SUB 0x4d /* 10.5.4.14 */ |
| 1794 | #define GSM48_IE_CALLING_BCD 0x5c /* 10.5.4.9 */ |
| 1795 | #define GSM48_IE_CALLING_SUB 0x5d /* 10.5.4.10 */ |
| 1796 | #define GSM48_IE_CALLED_BCD 0x5e /* 10.5.4.7 */ |
| 1797 | #define GSM48_IE_CALLED_SUB 0x6d /* 10.5.4.8 */ |
| 1798 | #define GSM48_IE_REDIR_BCD 0x74 /* 10.5.4.21a */ |
| 1799 | #define GSM48_IE_REDIR_SUB 0x75 /* 10.5.4.21b */ |
| 1800 | #define GSM48_IE_LOWL_COMPAT 0x7c /* 10.5.4.18 */ |
| 1801 | #define GSM48_IE_HIGHL_COMPAT 0x7d /* 10.5.4.16 */ |
| 1802 | #define GSM48_IE_USER_USER 0x7e /* 10.5.4.25 */ |
| 1803 | #define GSM48_IE_SS_VERS 0x7f /* 10.5.4.24 */ |
| 1804 | #define GSM48_IE_MORE_DATA 0xa0 /* 10.5.4.19 */ |
| 1805 | #define GSM48_IE_CLIR_SUPP 0xa1 /* 10.5.4.11a */ |
| 1806 | #define GSM48_IE_CLIR_INVOC 0xa2 /* 10.5.4.11b */ |
| 1807 | #define GSM48_IE_REV_C_SETUP 0xa3 /* 10.5.4.22a */ |
| 1808 | #define GSM48_IE_REPEAT_CIR 0xd1 /* 10.5.4.22 */ |
| 1809 | #define GSM48_IE_REPEAT_SEQ 0xd3 /* 10.5.4.22 */ |
| 1810 | |
| 1811 | /* Section 10.5.4.11 / Table 10.5.122 */ |
| 1812 | #define GSM48_CAUSE_CS_GSM 0x60 |
| 1813 | |
| 1814 | /* Section 9.1.2 / Table 9.3 */ |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1815 | /* RR elements */ |
| 1816 | #define GSM48_IE_VGCS_TARGET 0x01 |
| 1817 | //#define GSM48_IE_VGCS_T_MODE_I 0x01 |
| 1818 | #define GSM48_IE_FRQSHORT_AFTER 0x02 |
| 1819 | #define GSM48_IE_MUL_RATE_CFG 0x03 /* 10.5.2.21aa */ |
| 1820 | #define GSM48_IE_FREQ_L_AFTER 0x05 |
Pau Espin Pedrol | 559a6ee | 2023-03-22 13:17:09 +0100 | [diff] [blame] | 1821 | #define GSM48_IE_GROUP_CIP_SEQ_HO 0x08 /* HO = Half Octet Tag */ |
| 1822 | #define GSM48_IE_CIP_MODE_SET_HO 0x09 /* HO = Half Octet Tag */ |
| 1823 | #define GSM48_IE_GPRS_RESUMPT_HO 0xc0 /* HO = Half Octet Tag */ |
| 1824 | #define GSM48_IE_SYNC_IND_HO 0x0d /* HO = Half Octet Tag */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1825 | #define GSM48_IE_MSLOT_DESC 0x10 |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1826 | #define GSM48_IE_CHANMODE_2 0x11 |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1827 | #define GSM48_IE_FRQSHORT_BEFORE 0x12 |
| 1828 | //#define GSM48_IE_FRQSHORT_BEFOR 0x12 |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1829 | #define GSM48_IE_CHANMODE_3 0x13 |
| 1830 | #define GSM48_IE_CHANMODE_4 0x14 |
| 1831 | #define GSM48_IE_CHANMODE_5 0x15 |
| 1832 | #define GSM48_IE_CHANMODE_6 0x16 |
| 1833 | #define GSM48_IE_CHANMODE_7 0x17 |
| 1834 | #define GSM48_IE_CHANMODE_8 0x18 |
| 1835 | #define GSM48_IE_CHANDESC_2 0x64 |
Harald Welte | 639f74b | 2010-06-15 09:32:14 +0200 | [diff] [blame] | 1836 | #define GSM48_IE_MA_AFTER 0x72 |
| 1837 | #define GSM48_IE_START_TIME 0x7c |
| 1838 | #define GSM48_IE_FREQ_L_BEFORE 0x19 |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1839 | //#define GSM48_IE_FRQLIST_BEFORE 0x19 |
Harald Welte | 639f74b | 2010-06-15 09:32:14 +0200 | [diff] [blame] | 1840 | #define GSM48_IE_CH_DESC_1_BEFORE 0x1c |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1841 | //#define GSM48_IE_CHDES_1_BEFORE 0x1c |
Harald Welte | 639f74b | 2010-06-15 09:32:14 +0200 | [diff] [blame] | 1842 | #define GSM48_IE_CH_DESC_2_BEFORE 0x1d |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1843 | //#define GSM48_IE_CHDES_2_BEFORE 0x1d |
Harald Welte | 639f74b | 2010-06-15 09:32:14 +0200 | [diff] [blame] | 1844 | #define GSM48_IE_F_CH_SEQ_BEFORE 0x1e |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1845 | //#define GSM48_IE_FRQSEQ_BEFORE 0x1e |
| 1846 | #define GSM48_IE_CLASSMARK3 0x20 |
Harald Welte | 639f74b | 2010-06-15 09:32:14 +0200 | [diff] [blame] | 1847 | #define GSM48_IE_MA_BEFORE 0x21 |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1848 | #define GSM48_IE_RR_PACKET_UL 0x22 |
| 1849 | #define GSM48_IE_RR_PACKET_DL 0x23 |
| 1850 | #define GSM48_IE_CELL_CH_DESC 0x62 |
| 1851 | #define GSM48_IE_CHANMODE_1 0x63 |
| 1852 | #define GSM48_IE_CHDES_2_AFTER 0x64 |
| 1853 | #define GSM48_IE_MODE_SEC_CH 0x66 |
| 1854 | #define GSM48_IE_F_CH_SEQ_AFTER 0x69 |
Neels Hofmeyr | 4b44ac4 | 2021-04-19 23:33:34 +0200 | [diff] [blame] | 1855 | #define GSM48_IE_EXTENDED_TSC_SET 0x6d |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1856 | #define GSM48_IE_MA_AFTER 0x72 |
| 1857 | #define GSM48_IE_BA_RANGE 0x73 |
| 1858 | #define GSM48_IE_GROUP_CHDES 0x74 |
| 1859 | #define GSM48_IE_BA_LIST_PREF 0x75 |
| 1860 | #define GSM48_IE_MOB_OVSERV_DIF 0x77 |
Harald Welte | cf2caeb | 2019-02-03 00:37:20 +0100 | [diff] [blame] | 1861 | #define GSM48_IE_CELL_SEL_IND_AFTER_REL 0x77 /* 44.018 Section 9.1.7 */ |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1862 | #define GSM48_IE_REALTIME_DIFF 0x7b |
| 1863 | #define GSM48_IE_START_TIME 0x7c |
Harald Welte | cf2caeb | 2019-02-03 00:37:20 +0100 | [diff] [blame] | 1864 | #define GSM48_IE_INDIVIDUAL_PRIORITIES 0x7c /* 44.018 Section 9.1.7 */ |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1865 | #define GSM48_IE_TIMING_ADVANCE 0x7d |
Pau Espin Pedrol | 559a6ee | 2023-03-22 13:17:09 +0100 | [diff] [blame] | 1866 | #define GSM48_IE_GROUP_CIP_SEQ 0x80 /* DEPRECATED, use GSM48_IE_GROUP_CIP_SEQ_HO instead */ |
| 1867 | #define GSM48_IE_CIP_MODE_SET 0x90 /* DEPRECATED, use GSM48_IE_CIP_MODE_SET_HO instead */ |
| 1868 | #define GSM48_IE_GPRS_RESUMPT 0xc0 /* DEPRECATED, use GSM48_IE_GPRS_RESUMPT_HO instead */ |
| 1869 | #define GSM48_IE_SYNC_IND 0xd0 /* DEPRECATED, use GSM48_IE_SYNC_IND_HO instead */ |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1870 | /* System Information 4 (types are equal IEs above) */ |
| 1871 | #define GSM48_IE_CBCH_CHAN_DESC 0x64 |
| 1872 | #define GSM48_IE_CBCH_MOB_AL 0x72 |
Harald Welte | 639f74b | 2010-06-15 09:32:14 +0200 | [diff] [blame] | 1873 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1874 | /* Additional MM elements */ |
Pau Espin Pedrol | 559a6ee | 2023-03-22 13:17:09 +0100 | [diff] [blame] | 1875 | #define GSM48_IE_PRIORITY_LEV_HO 0x08 /* HO = Half Octet Tag */ |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1876 | #define GSM48_IE_LOCATION_AREA 0x13 |
Harald Welte | 82f94ef | 2016-05-05 23:33:27 +0200 | [diff] [blame] | 1877 | #define GSM48_IE_AUTN 0x20 |
Neels Hofmeyr | 55a43b8 | 2017-02-02 20:27:55 +0100 | [diff] [blame] | 1878 | #define GSM48_IE_AUTH_RES_EXT 0x21 |
| 1879 | #define GSM48_IE_AUTS 0x22 |
Pau Espin Pedrol | 559a6ee | 2023-03-22 13:17:09 +0100 | [diff] [blame] | 1880 | #define GSM48_IE_PRIORITY_LEV 0x80 /* DEPRECATED, use GSM48_IE_PRIORITY_LEV_HO instead */ |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1881 | #define GSM48_IE_FOLLOW_ON_PROC 0xa1 |
| 1882 | #define GSM48_IE_CTS_PERMISSION 0xa2 |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1883 | |
Keith | 05d3278 | 2018-05-28 14:08:10 +0200 | [diff] [blame] | 1884 | /* Section 10.5.4.21 / Table 10.5.127 */ |
| 1885 | |
| 1886 | enum gsm48_progress_desc { |
| 1887 | GSM48_PROGR_NOT_E2E = 0x00, |
| 1888 | GSM48_PROGR_DEST_NOT_PLMN = 0x02, |
| 1889 | GSM48_PROGR_ORIG_NOT_PLMN = 0x03, |
| 1890 | GSM48_PROGR_RETURNED = 0x04, |
| 1891 | GSM48_PROGR_IN_BAND_AVAIL = 0x08, |
| 1892 | GSM48_PROGR_CALL_E2E = 0x20, |
| 1893 | GSM48_PROGR_QUEUEING = 0x40, |
| 1894 | }; |
| 1895 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1896 | /* Section 10.5.4.23 / Table 10.5.130 */ |
| 1897 | enum gsm48_signal_val { |
| 1898 | GSM48_SIGNAL_DIALTONE = 0x00, |
| 1899 | GSM48_SIGNAL_RINGBACK = 0x01, |
| 1900 | GSM48_SIGNAL_INTERCEPT = 0x02, |
| 1901 | GSM48_SIGNAL_NET_CONG = 0x03, |
| 1902 | GSM48_SIGNAL_BUSY = 0x04, |
| 1903 | GSM48_SIGNAL_CONFIRM = 0x05, |
| 1904 | GSM48_SIGNAL_ANSWER = 0x06, |
| 1905 | GSM48_SIGNAL_CALL_WAIT = 0x07, |
| 1906 | GSM48_SIGNAL_OFF_HOOK = 0x08, |
| 1907 | GSM48_SIGNAL_OFF = 0x3f, |
| 1908 | GSM48_SIGNAL_ALERT_OFF = 0x4f, |
| 1909 | }; |
| 1910 | |
Keith | adfa199 | 2018-05-25 15:24:06 +0200 | [diff] [blame] | 1911 | /* Section 10.5.4.11 / Table 10.5.122 */ |
| 1912 | enum gsm48_cause_coding { |
| 1913 | GSM48_CAUSE_CODING_CCITT_Q931 = 0x00, |
| 1914 | GSM48_CAUSE_CODING_RESERVED = 0x01, |
| 1915 | GSM48_CAUSE_CODING_NATIONAL = 0x02, |
| 1916 | GSM48_CAUSE_CODING_GSM = 0x03, |
| 1917 | }; |
| 1918 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1919 | enum gsm48_cause_loc { |
| 1920 | GSM48_CAUSE_LOC_USER = 0x00, |
| 1921 | GSM48_CAUSE_LOC_PRN_S_LU = 0x01, |
| 1922 | GSM48_CAUSE_LOC_PUN_S_LU = 0x02, |
| 1923 | GSM48_CAUSE_LOC_TRANS_NET = 0x03, |
| 1924 | GSM48_CAUSE_LOC_PUN_S_RU = 0x04, |
| 1925 | GSM48_CAUSE_LOC_PRN_S_RU = 0x05, |
| 1926 | /* not defined */ |
| 1927 | GSM48_CAUSE_LOC_INN_NET = 0x07, |
| 1928 | GSM48_CAUSE_LOC_NET_BEYOND = 0x0a, |
| 1929 | }; |
| 1930 | |
Neels Hofmeyr | 6ad50aa | 2019-01-14 20:28:56 +0100 | [diff] [blame] | 1931 | /* 3GPP TS 44.018 10.5.2.31 RR Cause / Table 10.5.70 */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1932 | enum gsm48_rr_cause { |
| 1933 | GSM48_RR_CAUSE_NORMAL = 0x00, |
| 1934 | GSM48_RR_CAUSE_ABNORMAL_UNSPEC = 0x01, |
| 1935 | GSM48_RR_CAUSE_ABNORMAL_UNACCT = 0x02, |
| 1936 | GSM48_RR_CAUSE_ABNORMAL_TIMER = 0x03, |
| 1937 | GSM48_RR_CAUSE_ABNORMAL_NOACT = 0x04, |
| 1938 | GSM48_RR_CAUSE_PREMPTIVE_REL = 0x05, |
Vadim Yanitskiy | f5f0d43 | 2020-10-29 18:21:53 +0700 | [diff] [blame] | 1939 | GSM48_RR_CAUSE_UTRAN_CFG_UNK = 0x06, |
Andreas Eversberg | c8cac64 | 2013-06-19 20:58:59 +0200 | [diff] [blame] | 1940 | GSM48_RR_CAUSE_HNDOVER_IMP = 0x08, |
| 1941 | GSM48_RR_CAUSE_CHAN_MODE_UNACCT = 0x09, |
| 1942 | GSM48_RR_CAUSE_FREQ_NOT_IMPL = 0x0a, |
Vadim Yanitskiy | f5f0d43 | 2020-10-29 18:21:53 +0700 | [diff] [blame] | 1943 | GSM48_RR_CAUSE_LEAVE_GROUP_CA = 0x0b, |
| 1944 | GSM48_RR_CAUSE_LOW_LEVEL_FAIL = 0x0c, |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1945 | GSM48_RR_CAUSE_CALL_CLEARED = 0x41, |
| 1946 | GSM48_RR_CAUSE_SEMANT_INCORR = 0x5f, |
| 1947 | GSM48_RR_CAUSE_INVALID_MAND_INF = 0x60, |
| 1948 | GSM48_RR_CAUSE_MSG_TYPE_N = 0x61, |
| 1949 | GSM48_RR_CAUSE_MSG_TYPE_N_COMPAT= 0x62, |
| 1950 | GSM48_RR_CAUSE_COND_IE_ERROR = 0x64, |
| 1951 | GSM48_RR_CAUSE_NO_CELL_ALLOC_A = 0x65, |
| 1952 | GSM48_RR_CAUSE_PROT_ERROR_UNSPC = 0x6f, |
| 1953 | }; |
| 1954 | |
| 1955 | /* Section 10.5.4.11 CC Cause / Table 10.5.123 */ |
| 1956 | enum gsm48_cc_cause { |
| 1957 | GSM48_CC_CAUSE_UNASSIGNED_NR = 1, |
| 1958 | GSM48_CC_CAUSE_NO_ROUTE = 3, |
| 1959 | GSM48_CC_CAUSE_CHAN_UNACCEPT = 6, |
| 1960 | GSM48_CC_CAUSE_OP_DET_BARRING = 8, |
| 1961 | GSM48_CC_CAUSE_NORM_CALL_CLEAR = 16, |
| 1962 | GSM48_CC_CAUSE_USER_BUSY = 17, |
| 1963 | GSM48_CC_CAUSE_USER_NOTRESPOND = 18, |
| 1964 | GSM48_CC_CAUSE_USER_ALERTING_NA = 19, |
| 1965 | GSM48_CC_CAUSE_CALL_REJECTED = 21, |
| 1966 | GSM48_CC_CAUSE_NUMBER_CHANGED = 22, |
| 1967 | GSM48_CC_CAUSE_PRE_EMPTION = 25, |
| 1968 | GSM48_CC_CAUSE_NONSE_USER_CLR = 26, |
| 1969 | GSM48_CC_CAUSE_DEST_OOO = 27, |
| 1970 | GSM48_CC_CAUSE_INV_NR_FORMAT = 28, |
| 1971 | GSM48_CC_CAUSE_FACILITY_REJ = 29, |
| 1972 | GSM48_CC_CAUSE_RESP_STATUS_INQ = 30, |
| 1973 | GSM48_CC_CAUSE_NORMAL_UNSPEC = 31, |
| 1974 | GSM48_CC_CAUSE_NO_CIRCUIT_CHAN = 34, |
| 1975 | GSM48_CC_CAUSE_NETWORK_OOO = 38, |
| 1976 | GSM48_CC_CAUSE_TEMP_FAILURE = 41, |
| 1977 | GSM48_CC_CAUSE_SWITCH_CONG = 42, |
| 1978 | GSM48_CC_CAUSE_ACC_INF_DISCARD = 43, |
| 1979 | GSM48_CC_CAUSE_REQ_CHAN_UNAVAIL = 44, |
| 1980 | GSM48_CC_CAUSE_RESOURCE_UNAVAIL = 47, |
| 1981 | GSM48_CC_CAUSE_QOS_UNAVAIL = 49, |
| 1982 | GSM48_CC_CAUSE_REQ_FAC_NOT_SUBSC= 50, |
| 1983 | GSM48_CC_CAUSE_INC_BARRED_CUG = 55, |
| 1984 | GSM48_CC_CAUSE_BEARER_CAP_UNAUTH= 57, |
| 1985 | GSM48_CC_CAUSE_BEARER_CA_UNAVAIL= 58, |
| 1986 | GSM48_CC_CAUSE_SERV_OPT_UNAVAIL = 63, |
| 1987 | GSM48_CC_CAUSE_BEARERSERV_UNIMPL= 65, |
| 1988 | GSM48_CC_CAUSE_ACM_GE_ACM_MAX = 68, |
| 1989 | GSM48_CC_CAUSE_REQ_FAC_NOTIMPL = 69, |
| 1990 | GSM48_CC_CAUSE_RESTR_BCAP_AVAIL = 70, |
| 1991 | GSM48_CC_CAUSE_SERV_OPT_UNIMPL = 79, |
| 1992 | GSM48_CC_CAUSE_INVAL_TRANS_ID = 81, |
| 1993 | GSM48_CC_CAUSE_USER_NOT_IN_CUG = 87, |
| 1994 | GSM48_CC_CAUSE_INCOMPAT_DEST = 88, |
| 1995 | GSM48_CC_CAUSE_INVAL_TRANS_NET = 91, |
| 1996 | GSM48_CC_CAUSE_SEMANTIC_INCORR = 95, |
| 1997 | GSM48_CC_CAUSE_INVAL_MAND_INF = 96, |
| 1998 | GSM48_CC_CAUSE_MSGTYPE_NOTEXIST = 97, |
| 1999 | GSM48_CC_CAUSE_MSGTYPE_INCOMPAT = 98, |
| 2000 | GSM48_CC_CAUSE_IE_NOTEXIST = 99, |
| 2001 | GSM48_CC_CAUSE_COND_IE_ERR = 100, |
| 2002 | GSM48_CC_CAUSE_MSG_INCOMP_STATE = 101, |
| 2003 | GSM48_CC_CAUSE_RECOVERY_TIMER = 102, |
| 2004 | GSM48_CC_CAUSE_PROTO_ERR = 111, |
| 2005 | GSM48_CC_CAUSE_INTERWORKING = 127, |
| 2006 | }; |
| 2007 | |
Keith | 3cdaa8d | 2018-08-31 20:09:18 +0200 | [diff] [blame] | 2008 | extern const struct value_string gsm48_cc_cause_names[]; |
| 2009 | static inline const char *gsm48_cc_cause_name(enum gsm48_cc_cause val) |
| 2010 | { return get_value_string(gsm48_cc_cause_names, val); } |
| 2011 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 2012 | /* Annex G, GSM specific cause values for mobility management */ |
| 2013 | enum gsm48_reject_value { |
| 2014 | GSM48_REJECT_IMSI_UNKNOWN_IN_HLR = 2, |
| 2015 | GSM48_REJECT_ILLEGAL_MS = 3, |
| 2016 | GSM48_REJECT_IMSI_UNKNOWN_IN_VLR = 4, |
| 2017 | GSM48_REJECT_IMEI_NOT_ACCEPTED = 5, |
| 2018 | GSM48_REJECT_ILLEGAL_ME = 6, |
| 2019 | GSM48_REJECT_PLMN_NOT_ALLOWED = 11, |
| 2020 | GSM48_REJECT_LOC_NOT_ALLOWED = 12, |
| 2021 | GSM48_REJECT_ROAMING_NOT_ALLOWED = 13, |
| 2022 | GSM48_REJECT_NETWORK_FAILURE = 17, |
Neels Hofmeyr | 55a43b8 | 2017-02-02 20:27:55 +0100 | [diff] [blame] | 2023 | GSM48_REJECT_SYNCH_FAILURE = 21, |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 2024 | GSM48_REJECT_CONGESTION = 22, |
| 2025 | GSM48_REJECT_SRV_OPT_NOT_SUPPORTED = 32, |
| 2026 | GSM48_REJECT_RQD_SRV_OPT_NOT_SUPPORTED = 33, |
| 2027 | GSM48_REJECT_SRV_OPT_TMP_OUT_OF_ORDER = 34, |
| 2028 | GSM48_REJECT_CALL_CAN_NOT_BE_IDENTIFIED = 38, |
| 2029 | GSM48_REJECT_INCORRECT_MESSAGE = 95, |
| 2030 | GSM48_REJECT_INVALID_MANDANTORY_INF = 96, |
| 2031 | GSM48_REJECT_MSG_TYPE_NOT_IMPLEMENTED = 97, |
| 2032 | GSM48_REJECT_MSG_TYPE_NOT_COMPATIBLE = 98, |
| 2033 | GSM48_REJECT_INF_ELEME_NOT_IMPLEMENTED = 99, |
| 2034 | GSM48_REJECT_CONDTIONAL_IE_ERROR = 100, |
| 2035 | GSM48_REJECT_MSG_NOT_COMPATIBLE = 101, |
| 2036 | GSM48_REJECT_PROTOCOL_ERROR = 111, |
| 2037 | |
| 2038 | /* according to G.6 Additional cause codes for GMM */ |
| 2039 | GSM48_REJECT_GPRS_NOT_ALLOWED = 7, |
| 2040 | GSM48_REJECT_SERVICES_NOT_ALLOWED = 8, |
| 2041 | GSM48_REJECT_MS_IDENTITY_NOT_DERVIVABLE = 9, |
| 2042 | GSM48_REJECT_IMPLICITLY_DETACHED = 10, |
| 2043 | GSM48_REJECT_GPRS_NOT_ALLOWED_IN_PLMN = 14, |
| 2044 | GSM48_REJECT_MSC_TMP_NOT_REACHABLE = 16, |
| 2045 | }; |
| 2046 | |
Neels Hofmeyr | aead241 | 2018-04-06 04:31:00 +0200 | [diff] [blame] | 2047 | extern const struct value_string gsm48_reject_value_names[]; |
| 2048 | static inline const char *gsm48_reject_value_name(enum gsm48_reject_value val) |
| 2049 | { return get_value_string(gsm48_reject_value_names, val); } |
| 2050 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 2051 | enum chreq_type { |
| 2052 | CHREQ_T_EMERG_CALL, |
| 2053 | CHREQ_T_CALL_REEST_TCH_F, |
| 2054 | CHREQ_T_CALL_REEST_TCH_H, |
| 2055 | CHREQ_T_CALL_REEST_TCH_H_DBL, |
| 2056 | CHREQ_T_SDCCH, |
| 2057 | CHREQ_T_TCH_F, |
| 2058 | CHREQ_T_VOICE_CALL_TCH_H, |
| 2059 | CHREQ_T_DATA_CALL_TCH_H, |
| 2060 | CHREQ_T_LOCATION_UPD, |
| 2061 | CHREQ_T_PAG_R_ANY_NECI0, |
| 2062 | CHREQ_T_PAG_R_ANY_NECI1, |
| 2063 | CHREQ_T_PAG_R_TCH_F, |
| 2064 | CHREQ_T_PAG_R_TCH_FH, |
| 2065 | CHREQ_T_LMU, |
| 2066 | CHREQ_T_RESERVED_SDCCH, |
| 2067 | CHREQ_T_RESERVED_IGNORE, |
Alexander Couzens | f48e8a8 | 2016-12-05 15:57:42 +0100 | [diff] [blame] | 2068 | CHREQ_T_PDCH_ONE_PHASE, |
| 2069 | CHREQ_T_PDCH_TWO_PHASE, |
Alexander Couzens | 953f929 | 2017-03-14 13:47:29 +0100 | [diff] [blame] | 2070 | _NUM_CHREQ_T, |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 2071 | }; |
| 2072 | |
| 2073 | /* Chapter 11.3 */ |
| 2074 | #define GSM48_T301 180, 0 |
| 2075 | #define GSM48_T303 30, 0 |
| 2076 | #define GSM48_T305 30, 0 |
| 2077 | #define GSM48_T306 30, 0 |
Harald Welte | e50b009 | 2018-01-27 09:40:34 +0100 | [diff] [blame] | 2078 | #define GSM48_T308 10, 0 /* no spec default */ |
Harald Welte | cd82710 | 2018-01-27 09:43:03 +0100 | [diff] [blame] | 2079 | #define GSM48_T310 30, 0 /* no spec default */ |
Harald Welte | e50b009 | 2018-01-27 09:40:34 +0100 | [diff] [blame] | 2080 | #define GSM48_T313 30, 0 /* no spec default */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 2081 | #define GSM48_T323 30, 0 |
Harald Welte | e50b009 | 2018-01-27 09:40:34 +0100 | [diff] [blame] | 2082 | #define GSM48_T331 30, 0 /* no spec default */ |
| 2083 | #define GSM48_T333 30, 0 /* no spec default */ |
| 2084 | #define GSM48_T334 25, 0 /* min 15s */ |
| 2085 | #define GSM48_T338 30, 0 /* no spec default */ |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 2086 | #define GSM48_T303_MS 30, 0 |
| 2087 | #define GSM48_T305_MS 30, 0 |
| 2088 | #define GSM48_T308_MS 30, 0 |
| 2089 | #define GSM48_T310_MS 30, 0 |
| 2090 | #define GSM48_T313_MS 30, 0 |
| 2091 | #define GSM48_T323_MS 30, 0 |
| 2092 | #define GSM48_T332_MS 30, 0 |
| 2093 | #define GSM48_T335_MS 30, 0 |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 2094 | |
| 2095 | /* Chapter 5.1.2.2 */ |
| 2096 | #define GSM_CSTATE_NULL 0 |
| 2097 | #define GSM_CSTATE_INITIATED 1 |
Andreas Eversberg | 1ef041f | 2010-04-09 07:52:12 +0200 | [diff] [blame] | 2098 | #define GSM_CSTATE_MM_CONNECTION_PEND 2 /* see 10.5.4.6 */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 2099 | #define GSM_CSTATE_MO_CALL_PROC 3 |
| 2100 | #define GSM_CSTATE_CALL_DELIVERED 4 |
| 2101 | #define GSM_CSTATE_CALL_PRESENT 6 |
| 2102 | #define GSM_CSTATE_CALL_RECEIVED 7 |
| 2103 | #define GSM_CSTATE_CONNECT_REQUEST 8 |
| 2104 | #define GSM_CSTATE_MO_TERM_CALL_CONF 9 |
| 2105 | #define GSM_CSTATE_ACTIVE 10 |
| 2106 | #define GSM_CSTATE_DISCONNECT_REQ 12 |
| 2107 | #define GSM_CSTATE_DISCONNECT_IND 12 |
| 2108 | #define GSM_CSTATE_RELEASE_REQ 19 |
| 2109 | #define GSM_CSTATE_MO_ORIG_MODIFY 26 |
| 2110 | #define GSM_CSTATE_MO_TERM_MODIFY 27 |
| 2111 | #define GSM_CSTATE_CONNECT_IND 28 |
| 2112 | |
| 2113 | #define SBIT(a) (1 << a) |
| 2114 | #define ALL_STATES 0xffffffff |
| 2115 | |
| 2116 | /* Table 10.5.3/3GPP TS 04.08: Location Area Identification information element */ |
| 2117 | #define GSM_LAC_RESERVED_DETACHED 0x0 |
| 2118 | #define GSM_LAC_RESERVED_ALL_BTS 0xfffe |
| 2119 | |
| 2120 | /* GSM 04.08 Bearer Capability: Information Transfer Capability */ |
| 2121 | enum gsm48_bcap_itcap { |
| 2122 | GSM48_BCAP_ITCAP_SPEECH = 0, |
| 2123 | GSM48_BCAP_ITCAP_UNR_DIG_INF = 1, |
| 2124 | GSM48_BCAP_ITCAP_3k1_AUDIO = 2, |
| 2125 | GSM48_BCAP_ITCAP_FAX_G3 = 3, |
| 2126 | GSM48_BCAP_ITCAP_OTHER = 5, |
| 2127 | GSM48_BCAP_ITCAP_RESERVED = 7, |
| 2128 | }; |
| 2129 | |
| 2130 | /* GSM 04.08 Bearer Capability: Transfer Mode */ |
| 2131 | enum gsm48_bcap_tmod { |
| 2132 | GSM48_BCAP_TMOD_CIRCUIT = 0, |
| 2133 | GSM48_BCAP_TMOD_PACKET = 1, |
| 2134 | }; |
| 2135 | |
| 2136 | /* GSM 04.08 Bearer Capability: Coding Standard */ |
| 2137 | enum gsm48_bcap_coding { |
| 2138 | GSM48_BCAP_CODING_GSM_STD = 0, |
| 2139 | }; |
| 2140 | |
| 2141 | /* GSM 04.08 Bearer Capability: Radio Channel Requirements */ |
| 2142 | enum gsm48_bcap_rrq { |
| 2143 | GSM48_BCAP_RRQ_FR_ONLY = 1, |
| 2144 | GSM48_BCAP_RRQ_DUAL_HR = 2, |
| 2145 | GSM48_BCAP_RRQ_DUAL_FR = 3, |
| 2146 | }; |
| 2147 | |
Harald Welte | c8a0b93 | 2012-08-24 21:27:26 +0200 | [diff] [blame] | 2148 | /* GSM 04.08 Bearer Capability: Rate Adaption */ |
| 2149 | enum gsm48_bcap_ra { |
| 2150 | GSM48_BCAP_RA_NONE = 0, |
| 2151 | GSM48_BCAP_RA_V110_X30 = 1, |
| 2152 | GSM48_BCAP_RA_X31 = 2, |
| 2153 | GSM48_BCAP_RA_OTHER = 3, |
| 2154 | }; |
| 2155 | |
| 2156 | /* GSM 04.08 Bearer Capability: Signalling access protocol */ |
| 2157 | enum gsm48_bcap_sig_access { |
| 2158 | GSM48_BCAP_SA_I440_I450 = 1, |
| 2159 | GSM48_BCAP_SA_X21 = 2, |
| 2160 | GSM48_BCAP_SA_X28_DP_IN = 3, |
| 2161 | GSM48_BCAP_SA_X28_DP_UN = 4, |
| 2162 | GSM48_BCAP_SA_X28_NDP = 5, |
| 2163 | GSM48_BCAP_SA_X32 = 6, |
| 2164 | }; |
| 2165 | |
| 2166 | /* GSM 04.08 Bearer Capability: User Rate */ |
| 2167 | enum gsm48_bcap_user_rate { |
| 2168 | GSM48_BCAP_UR_300 = 1, |
| 2169 | GSM48_BCAP_UR_1200 = 2, |
| 2170 | GSM48_BCAP_UR_2400 = 3, |
| 2171 | GSM48_BCAP_UR_4800 = 4, |
| 2172 | GSM48_BCAP_UR_9600 = 5, |
| 2173 | GSM48_BCAP_UR_12000 = 6, |
| 2174 | GSM48_BCAP_UR_1200_75 = 7, |
| 2175 | }; |
| 2176 | |
| 2177 | /* GSM 04.08 Bearer Capability: Parity */ |
| 2178 | enum gsm48_bcap_parity { |
| 2179 | GSM48_BCAP_PAR_ODD = 0, |
| 2180 | GSM48_BCAP_PAR_EVEN = 2, |
| 2181 | GSM48_BCAP_PAR_NONE = 3, |
| 2182 | GSM48_BCAP_PAR_ZERO = 4, |
| 2183 | GSM48_BCAP_PAR_ONE = 5, |
| 2184 | }; |
| 2185 | |
| 2186 | /* GSM 04.08 Bearer Capability: Intermediate Rate */ |
| 2187 | enum gsm48_bcap_interm_rate { |
| 2188 | GSM48_BCAP_IR_8k = 2, |
| 2189 | GSM48_BCAP_IR_16k = 3, |
| 2190 | }; |
| 2191 | |
| 2192 | /* GSM 04.08 Bearer Capability: Transparency */ |
| 2193 | enum gsm48_bcap_transp { |
| 2194 | GSM48_BCAP_TR_TRANSP = 0, |
| 2195 | GSM48_BCAP_TR_RLP = 1, |
| 2196 | GSM48_BCAP_TR_TR_PREF = 2, |
| 2197 | GSM48_BCAP_TR_RLP_PREF = 3, |
| 2198 | }; |
| 2199 | |
| 2200 | /* GSM 04.08 Bearer Capability: Modem Type */ |
| 2201 | enum gsm48_bcap_modem_type { |
| 2202 | GSM48_BCAP_MT_NONE = 0, |
| 2203 | GSM48_BCAP_MT_V21 = 1, |
| 2204 | GSM48_BCAP_MT_V22 = 2, |
| 2205 | GSM48_BCAP_MT_V22bis = 3, |
| 2206 | GSM48_BCAP_MT_V23 = 4, |
| 2207 | GSM48_BCAP_MT_V26ter = 5, |
| 2208 | GSM48_BCAP_MT_V32 = 6, |
| 2209 | GSM48_BCAP_MT_UNDEF = 7, |
| 2210 | GSM48_BCAP_MT_AUTO_1 = 8, |
| 2211 | }; |
| 2212 | |
Vadim Yanitskiy | 4a3d03e | 2024-01-25 05:14:22 +0700 | [diff] [blame^] | 2213 | /*! Table 10.5.112/3GPP TS 24.008: Other modem type (octet 6d) */ |
| 2214 | enum gsm48_bcap_other_modem_type { |
| 2215 | GSM48_BCAP_OTHER_MT_NONE = 0, /*!< No other modem type specified */ |
| 2216 | GSM48_BCAP_OTHER_MT_V34 = 2, /*!< According to ITU-T Rec. V.34 */ |
| 2217 | }; |
| 2218 | |
| 2219 | /*! Table 10.5.112/3GPP TS 24.008: Fixed network user rate (octet 6d) */ |
| 2220 | enum gsm48_bcap_fixed_net_user_rate { |
| 2221 | GSM48_BCAP_FNUR_NONE = 0, /*!< FNUR not applicable / No meaning associated */ |
| 2222 | GSM48_BCAP_FNUR_X1_V110_9600 = 1, /*!< 9.6 kbit/s (according to ITU-T Rec. X.1 and V.110) */ |
| 2223 | GSM48_BCAP_FNUR_X1_V110_14400 = 2, /*!< 14.4 kbit/s (according to ITU-T Rec. X.1 and V.110) */ |
| 2224 | GSM48_BCAP_FNUR_X1_V110_19200 = 3, /*!< 19.2 kbit/s (according to ITU-T Rec. X.1 and V.110) */ |
| 2225 | GSM48_BCAP_FNUR_X1_V110_28800 = 4, /*!< 28.8 kbit/s (according to ITU-T Rec. X.1 and V.110) */ |
| 2226 | GSM48_BCAP_FNUR_X1_V110_38400 = 5, /*!< 38.4 kbit/s (according to ITU-T Rec. X.1 and V.110) */ |
| 2227 | GSM48_BCAP_FNUR_X1_V110_48000 = 6, /*!< 48.0 kbit/s (according to ITU-T Rec. X.1 and V.110) */ |
| 2228 | GSM48_BCAP_FNUR_X1_V110_56000 = 7, /*!< 56.0 kbit/s (according to ITU-T Rec. X.1 and V.110) */ |
| 2229 | GSM48_BCAP_FNUR_BT_64000 = 8, /*!< 64.0 kbit/s bit transparent */ |
| 2230 | GSM48_BCAP_FNUR_BT_33600 = 9, /*!< 33.6 kbit/s bit transparent */ |
| 2231 | GSM48_BCAP_FNUR_I460_32000 = 10, /*!< 32.0 kbit/s (according to ITU-T Rec. I.460) */ |
| 2232 | GSM48_BCAP_FNUR_V34_31200 = 11, /*!< 31.2 kbit/s (according to ITU-T Rec. V.34) */ |
| 2233 | }; |
| 2234 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 2235 | /*! GSM 04.08 Bearer Capability: Speech Version Indication |
Philipp Maier | 3d9191e | 2017-05-31 17:22:03 +0200 | [diff] [blame] | 2236 | * (See also 3GPP TS 24.008, Table 10.5.103) */ |
Harald Welte | 30a8ec4 | 2012-08-24 23:00:05 +0200 | [diff] [blame] | 2237 | enum gsm48_bcap_speech_ver { |
Philipp Maier | a9e193b | 2017-06-16 16:47:06 +0200 | [diff] [blame] | 2238 | GSM48_BCAP_SV_FR = 0, /*!< GSM FR V1 (GSM FR) */ |
| 2239 | GSM48_BCAP_SV_HR = 1, /*!< GSM HR V1 (GSM HR) */ |
| 2240 | GSM48_BCAP_SV_EFR = 2, /*!< GSM FR V2 (GSM EFR) */ |
| 2241 | GSM48_BCAP_SV_AMR_F = 4, /*!< GSM FR V3 (FR AMR) */ |
| 2242 | GSM48_BCAP_SV_AMR_H = 5, /*!< GSM HR V3 (HR_AMR) */ |
Philipp Maier | 3d9191e | 2017-05-31 17:22:03 +0200 | [diff] [blame] | 2243 | GSM48_BCAP_SV_AMR_OFW = 6, /*!< GSM FR V4 (OFR AMR-WB) */ |
| 2244 | GSM48_BCAP_SV_AMR_OHW = 7, /*!< GSM HR V4 (OHR AMR-WB) */ |
| 2245 | GSM48_BCAP_SV_AMR_FW = 8, /*!< GSM FR V5 (FR AMR-WB) */ |
| 2246 | GSM48_BCAP_SV_AMR_OH = 11, /*!< GSM HR V6 (OHR AMR) */ |
Harald Welte | 30a8ec4 | 2012-08-24 23:00:05 +0200 | [diff] [blame] | 2247 | }; |
| 2248 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 2249 | #define GSM48_TMSI_LEN 5 |
| 2250 | #define GSM48_MID_TMSI_LEN (GSM48_TMSI_LEN + 2) |
| 2251 | #define GSM48_MI_SIZE 32 |
| 2252 | |
Max | ff2eeda | 2018-01-04 18:43:44 +0100 | [diff] [blame] | 2253 | /* 3GPP TS 24.008 ยง 10.5.5.15 Routing area identification */ |
Harald Welte | a1c4f76 | 2010-05-01 11:59:42 +0200 | [diff] [blame] | 2254 | struct gsm48_ra_id { |
| 2255 | uint8_t digits[3]; /* MCC + MNC BCD digits */ |
| 2256 | uint16_t lac; /* Location Area Code */ |
| 2257 | uint8_t rac; /* Routing Area Code */ |
| 2258 | } __attribute__ ((packed)); |
| 2259 | |
Harald Welte | b550313 | 2011-05-24 15:01:53 +0200 | [diff] [blame] | 2260 | #define GSM48_CELL_CHAN_DESC_SIZE 16 |
Harald Welte | a1c4f76 | 2010-05-01 11:59:42 +0200 | [diff] [blame] | 2261 | |
Harald Welte | b550313 | 2011-05-24 15:01:53 +0200 | [diff] [blame] | 2262 | #define GSM_MACBLOCK_LEN 23 |
| 2263 | #define GSM_MACBLOCK_PADDING 0x2b |
Harald Welte | 5547808 | 2018-02-09 22:39:29 +0100 | [diff] [blame] | 2264 | |
| 2265 | /* Table 10.5.118 / 3GPP TS 24.008 Section 10.5.4.7 */ |
| 2266 | enum gsm48_type_of_number { |
| 2267 | GSM48_TON_UNKNOWN = 0, |
| 2268 | GSM48_TON_INTERNATIONAL = 1, |
| 2269 | GSM48_TON_NATIONAL = 2, |
| 2270 | GSM48_TON_NET_SPEC = 3, |
| 2271 | GSM48_TON_SHORT_CODE = 4, |
| 2272 | /* reserved */ |
| 2273 | }; |
| 2274 | |
| 2275 | /* Table 10.5.118 / 3GPP TS 24.008 Section 10.5.4.7 */ |
| 2276 | enum gsm48_numbering_plan { |
| 2277 | GSM48_NPI_UNKNOWN = 0, |
| 2278 | GSM48_NPI_ISDN_E164 = 1, |
| 2279 | GSM48_NPI_DATA_X121 = 3, |
| 2280 | GSM48_NPI_TELEX_F69 = 4, |
| 2281 | GSM48_NPI_NATIONAL = 8, |
| 2282 | GSM48_NPI_PRIVATE = 9, |
| 2283 | GSM48_NPI_CTS = 11, |
| 2284 | /* reserved */ |
| 2285 | }; |