Sylvain Munaut | 12ba778 | 2014-06-16 10:13:40 +0200 | [diff] [blame] | 1 | #pragma once |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 2 | |
| 3 | #include <stdint.h> |
Max | fe65fa7 | 2016-05-10 17:17:05 +0200 | [diff] [blame] | 4 | #include <stdbool.h> |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 5 | |
Max | fb348ee | 2016-03-30 21:14:53 +0200 | [diff] [blame] | 6 | #include <osmocom/core/utils.h> |
Ruben Undheim | 720ac4a | 2016-05-27 22:03:59 +0200 | [diff] [blame] | 7 | #include <osmocom/core/endian.h> |
| 8 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 9 | /* GSM TS 04.08 definitions */ |
| 10 | struct gsm_lchan; |
| 11 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 12 | /* Chapter 10.5.1.5 */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 13 | struct gsm48_classmark1 { |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 14 | uint8_t pwr_lev:3, |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 15 | a5_1:1, |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 16 | es_ind:1, |
| 17 | rev_lev:2, |
| 18 | spare:1; |
| 19 | } __attribute__ ((packed)); |
| 20 | |
| 21 | /* Chapter 10.5.1.6 */ |
| 22 | struct gsm48_classmark2 { |
| 23 | uint8_t pwr_lev:3, |
| 24 | a5_1:1, |
| 25 | es_ind:1, |
| 26 | rev_lev:2, |
| 27 | spare:1; |
| 28 | uint8_t fc:1, |
| 29 | vgcs:1, |
| 30 | vbs:1, |
| 31 | sm_cap:1, |
| 32 | ss_scr:2, |
| 33 | ps_cap:1, |
| 34 | spare2:1; |
| 35 | uint8_t a5_2:1, |
| 36 | a5_3:1, |
| 37 | cmsp:1, |
| 38 | solsa:1, |
| 39 | spare3:1, |
| 40 | lcsva_cap:1, |
| 41 | spare4:1, |
| 42 | cm3:1; |
| 43 | } __attribute__ ((packed)); |
| 44 | |
| 45 | /* Chapter 10.5.2.1b.3 */ |
Ruben Undheim | 720ac4a | 2016-05-27 22:03:59 +0200 | [diff] [blame] | 46 | #if OSMO_IS_LITTLE_ENDIAN == 1 |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 47 | struct gsm48_range_1024 { |
| 48 | uint8_t w1_hi:2, |
| 49 | f0:1, |
| 50 | form_id:5; |
| 51 | uint8_t w1_lo; |
| 52 | uint8_t w2_hi; |
| 53 | uint8_t w3_hi:7, |
| 54 | w2_lo:1; |
| 55 | uint8_t w4_hi:6, |
| 56 | w3_lo:2; |
| 57 | uint8_t w5_hi:6, |
| 58 | w4_lo:2; |
| 59 | uint8_t w6_hi:6, |
| 60 | w5_lo:2; |
| 61 | uint8_t w7_hi:6, |
| 62 | w6_lo:2; |
| 63 | uint8_t w8_hi:6, |
| 64 | w7_lo:2; |
| 65 | uint8_t w9:7, |
| 66 | w8_lo:1; |
| 67 | uint8_t w11_hi:1, |
| 68 | w10:7; |
| 69 | uint8_t w12_hi:2, |
| 70 | w11_lo:6; |
| 71 | uint8_t w13_hi:3, |
| 72 | w12_lo:5; |
| 73 | uint8_t w14_hi:4, |
| 74 | w13_lo:4; |
| 75 | uint8_t w15_hi:5, |
| 76 | w14_lo:3; |
| 77 | uint8_t w16:6, |
| 78 | w15_lo:2; |
| 79 | } __attribute__ ((packed)); |
Ruben Undheim | 720ac4a | 2016-05-27 22:03:59 +0200 | [diff] [blame] | 80 | #else |
| 81 | struct gsm48_range_1024 { |
| 82 | uint8_t form_id:5, |
| 83 | f0:1, |
| 84 | w1_hi:2; |
| 85 | uint8_t w1_lo; |
| 86 | uint8_t w2_hi; |
| 87 | uint8_t w2_lo:1, |
| 88 | w3_hi:7; |
| 89 | uint8_t w3_lo:2, |
| 90 | w4_hi:6; |
| 91 | uint8_t w4_lo:2, |
| 92 | w5_hi:6; |
| 93 | uint8_t w5_lo:2, |
| 94 | w6_hi:6; |
| 95 | uint8_t w6_lo:2, |
| 96 | w7_hi:6; |
| 97 | uint8_t w7_lo:2, |
| 98 | w8_hi:6; |
| 99 | uint8_t w8_lo:1, |
| 100 | w9:7; |
| 101 | uint8_t w10:7, |
| 102 | w11_hi:1; |
| 103 | uint8_t w11_lo:6, |
| 104 | w12_hi:2; |
| 105 | uint8_t w12_lo:5, |
| 106 | w13_hi:3; |
| 107 | uint8_t w13_lo:4, |
| 108 | w14_hi:4; |
| 109 | uint8_t w14_lo:3, |
| 110 | w15_hi:5; |
| 111 | uint8_t w15_lo:2, |
| 112 | w16:6; |
| 113 | } __attribute__ ((packed)); |
| 114 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 115 | |
| 116 | /* Chapter 10.5.2.1b.4 */ |
Ruben Undheim | 720ac4a | 2016-05-27 22:03:59 +0200 | [diff] [blame] | 117 | #if OSMO_IS_LITTLE_ENDIAN == 1 |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 118 | struct gsm48_range_512 { |
| 119 | uint8_t orig_arfcn_hi:1, |
| 120 | form_id:7; |
| 121 | uint8_t orig_arfcn_mid; |
| 122 | uint8_t w1_hi:7, |
| 123 | orig_arfcn_lo:1; |
| 124 | uint8_t w2_hi:6, |
| 125 | w1_lo:2; |
| 126 | uint8_t w3_hi:6, |
| 127 | w2_lo:2; |
| 128 | uint8_t w4_hi:6, |
| 129 | w3_lo:2; |
| 130 | uint8_t w5:7, |
| 131 | w4_lo:1; |
| 132 | uint8_t w7_hi:1, |
| 133 | w6:7; |
| 134 | uint8_t w8_hi:2, |
| 135 | w7_lo:6; |
| 136 | uint8_t w9_hi:4, |
| 137 | w8_lo:4; |
| 138 | uint8_t w10:6, |
| 139 | w9_lo:2; |
| 140 | uint8_t w12_hi:2, |
| 141 | w11:6; |
| 142 | uint8_t w13_hi:4, |
| 143 | w12_lo:4; |
| 144 | uint8_t w14:6, |
| 145 | w13_lo:2; |
| 146 | uint8_t w16_hi:2, |
| 147 | w15:6; |
| 148 | uint8_t w17:5, |
| 149 | w16_lo:3; |
| 150 | } __attribute__ ((packed)); |
Ruben Undheim | 720ac4a | 2016-05-27 22:03:59 +0200 | [diff] [blame] | 151 | #else |
| 152 | struct gsm48_range_512 { |
| 153 | uint8_t form_id:7, |
| 154 | orig_arfcn_hi:1; |
| 155 | uint8_t orig_arfcn_mid; |
| 156 | uint8_t orig_arfcn_lo:1, |
| 157 | w1_hi:7; |
| 158 | uint8_t w1_lo:2, |
| 159 | w2_hi:6; |
| 160 | uint8_t w2_lo:2, |
| 161 | w3_hi:6; |
| 162 | uint8_t w3_lo:2, |
| 163 | w4_hi:6; |
| 164 | uint8_t w4_lo:1, |
| 165 | w5:7; |
| 166 | uint8_t w6:7, |
| 167 | w7_hi:1; |
| 168 | uint8_t w7_lo:6, |
| 169 | w8_hi:2; |
| 170 | uint8_t w8_lo:4, |
| 171 | w9_hi:4; |
| 172 | uint8_t w9_lo:2, |
| 173 | w10:6; |
| 174 | uint8_t w11:6, |
| 175 | w12_hi:2; |
| 176 | uint8_t w12_lo:4, |
| 177 | w13_hi:4; |
| 178 | uint8_t w13_lo:2, |
| 179 | w14:6; |
| 180 | uint8_t w15:6, |
| 181 | w16_hi:2; |
| 182 | uint8_t w16_lo:3, |
| 183 | w17:5; |
| 184 | } __attribute__ ((packed)); |
| 185 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 186 | |
| 187 | /* Chapter 10.5.2.1b.5 */ |
Ruben Undheim | 720ac4a | 2016-05-27 22:03:59 +0200 | [diff] [blame] | 188 | #if OSMO_IS_LITTLE_ENDIAN == 1 |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 189 | struct gsm48_range_256 { |
| 190 | uint8_t orig_arfcn_hi:1, |
| 191 | form_id:7; |
| 192 | uint8_t orig_arfcn_mid; |
| 193 | uint8_t w1_hi:7, |
| 194 | orig_arfcn_lo:1; |
| 195 | uint8_t w2:7, |
| 196 | w1_lo:1; |
| 197 | uint8_t w4_hi:1, |
| 198 | w3:7; |
| 199 | uint8_t w5_hi:3, |
| 200 | w4_lo:5; |
| 201 | uint8_t w6_hi:5, |
| 202 | w5_lo:3; |
| 203 | uint8_t w8_hi:1, |
| 204 | w7:6, |
| 205 | w6_lo:1; |
| 206 | uint8_t w9_hi:4, |
| 207 | w8_lo:4; |
| 208 | uint8_t w11_hi:2, |
| 209 | w10:5, |
| 210 | w9_lo:1; |
| 211 | uint8_t w12:5, |
| 212 | w11_lo:3; |
| 213 | uint8_t w14_hi:3, |
| 214 | w13:5; |
| 215 | uint8_t w16_hi:1, |
| 216 | w15:5, |
| 217 | w14_lo:2; |
| 218 | uint8_t w18_hi:1, |
| 219 | w17:4, |
| 220 | w16_lo:3; |
| 221 | uint8_t w20_hi:1, |
| 222 | w19:4, |
| 223 | w18_lo:3; |
| 224 | uint8_t spare:1, |
| 225 | w21:4, |
| 226 | w20_lo:3; |
| 227 | } __attribute__ ((packed)); |
Ruben Undheim | 720ac4a | 2016-05-27 22:03:59 +0200 | [diff] [blame] | 228 | #else |
| 229 | struct gsm48_range_256 { |
| 230 | uint8_t form_id:7, |
| 231 | orig_arfcn_hi:1; |
| 232 | uint8_t orig_arfcn_mid; |
| 233 | uint8_t orig_arfcn_lo:1, |
| 234 | w1_hi:7; |
| 235 | uint8_t w1_lo:1, |
| 236 | w2:7; |
| 237 | uint8_t w3:7, |
| 238 | w4_hi:1; |
| 239 | uint8_t w4_lo:5, |
| 240 | w5_hi:3; |
| 241 | uint8_t w5_lo:3, |
| 242 | w6_hi:5; |
| 243 | uint8_t w6_lo:1, |
| 244 | w7:6, |
| 245 | w8_hi:1; |
| 246 | uint8_t w8_lo:4, |
| 247 | w9_hi:4; |
| 248 | uint8_t w9_lo:1, |
| 249 | w10:5, |
| 250 | w11_hi:2; |
| 251 | uint8_t w11_lo:3, |
| 252 | w12:5; |
| 253 | uint8_t w13:5, |
| 254 | w14_hi:3; |
| 255 | uint8_t w14_lo:2, |
| 256 | w15:5, |
| 257 | w16_hi:1; |
| 258 | uint8_t w16_lo:3, |
| 259 | w17:4, |
| 260 | w18_hi:1; |
| 261 | uint8_t w18_lo:3, |
| 262 | w19:4, |
| 263 | w20_hi:1; |
| 264 | uint8_t w20_lo:3, |
| 265 | w21:4, |
| 266 | spare:1; |
| 267 | } __attribute__ ((packed)); |
| 268 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 269 | |
| 270 | /* Chapter 10.5.2.1b.6 */ |
Ruben Undheim | 720ac4a | 2016-05-27 22:03:59 +0200 | [diff] [blame] | 271 | #if OSMO_IS_LITTLE_ENDIAN == 1 |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 272 | struct gsm48_range_128 { |
| 273 | uint8_t orig_arfcn_hi:1, |
| 274 | form_id:7; |
| 275 | uint8_t orig_arfcn_mid; |
| 276 | uint8_t w1:7, |
| 277 | orig_arfcn_lo:1; |
| 278 | uint8_t w3_hi:2, |
| 279 | w2:6; |
| 280 | uint8_t w4_hi:4, |
| 281 | w3_lo:4; |
| 282 | uint8_t w6_hi:2, |
| 283 | w5:5, |
| 284 | w4_lo:1; |
| 285 | uint8_t w7:5, |
| 286 | w6_lo:3; |
| 287 | uint8_t w9:4, |
| 288 | w8:4; |
| 289 | uint8_t w11:4, |
| 290 | w10:4; |
| 291 | uint8_t w13:4, |
| 292 | w12:4; |
| 293 | uint8_t w15:4, |
| 294 | w14:4; |
| 295 | uint8_t w18_hi:2, |
| 296 | w17:3, |
| 297 | w16:3; |
| 298 | uint8_t w21_hi:1, |
| 299 | w20:3, |
| 300 | w19:3, |
| 301 | w18_lo:1; |
| 302 | uint8_t w23:3, |
| 303 | w22:3, |
| 304 | w21_lo:2; |
| 305 | uint8_t w26_hi:2, |
| 306 | w25:3, |
| 307 | w24:3; |
| 308 | uint8_t spare:1, |
| 309 | w28:3, |
| 310 | w27:3, |
| 311 | w26_lo:1; |
| 312 | } __attribute__ ((packed)); |
Ruben Undheim | 720ac4a | 2016-05-27 22:03:59 +0200 | [diff] [blame] | 313 | #else |
| 314 | struct gsm48_range_128 { |
| 315 | uint8_t form_id:7, |
| 316 | orig_arfcn_hi:1; |
| 317 | uint8_t orig_arfcn_mid; |
| 318 | uint8_t orig_arfcn_lo:1, |
| 319 | w1:7; |
| 320 | uint8_t w2:6, |
| 321 | w3_hi:2; |
| 322 | uint8_t w3_lo:4, |
| 323 | w4_hi:4; |
| 324 | uint8_t w4_lo:1, |
| 325 | w5:5, |
| 326 | w6_hi:2; |
| 327 | uint8_t w6_lo:3, |
| 328 | w7:5; |
| 329 | uint8_t w8:4, |
| 330 | w9:4; |
| 331 | uint8_t w10:4, |
| 332 | w11:4; |
| 333 | uint8_t w12:4, |
| 334 | w13:4; |
| 335 | uint8_t w14:4, |
| 336 | w15:4; |
| 337 | uint8_t w16:3, |
| 338 | w17:3, |
| 339 | w18_hi:2; |
| 340 | uint8_t w18_lo:1, |
| 341 | w19:3, |
| 342 | w20:3, |
| 343 | w21_hi:1; |
| 344 | uint8_t w21_lo:2, |
| 345 | w22:3, |
| 346 | w23:3; |
| 347 | uint8_t w24:3, |
| 348 | w25:3, |
| 349 | w26_hi:2; |
| 350 | uint8_t w26_lo:1, |
| 351 | w27:3, |
| 352 | w28:3, |
| 353 | spare:1; |
| 354 | } __attribute__ ((packed)); |
| 355 | #endif |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 356 | |
| 357 | /* Chapter 10.5.2.1b.7 */ |
| 358 | struct gsm48_var_bit { |
| 359 | uint8_t orig_arfcn_hi:1, |
| 360 | form_id:7; |
| 361 | uint8_t orig_arfcn_mid; |
| 362 | uint8_t rrfcn1_7:7, |
| 363 | orig_arfcn_lo:1; |
| 364 | uint8_t rrfcn8_111[13]; |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 365 | } __attribute__ ((packed)); |
| 366 | |
| 367 | /* Chapter 10.5.2.5 */ |
| 368 | struct gsm48_chan_desc { |
| 369 | uint8_t chan_nr; |
| 370 | union { |
| 371 | struct { |
| 372 | uint8_t maio_high:4, |
| 373 | h:1, |
| 374 | tsc:3; |
| 375 | uint8_t hsn:6, |
| 376 | maio_low:2; |
Andreas Eversberg | 4b332d7 | 2012-02-07 20:02:17 +0100 | [diff] [blame] | 377 | } __attribute__ ((packed)) h1; |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 378 | struct { |
| 379 | uint8_t arfcn_high:2, |
| 380 | spare:2, |
| 381 | h:1, |
| 382 | tsc:3; |
| 383 | uint8_t arfcn_low; |
Andreas Eversberg | 4b332d7 | 2012-02-07 20:02:17 +0100 | [diff] [blame] | 384 | } __attribute__ ((packed)) h0; |
| 385 | } __attribute__ ((packed)); |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 386 | } __attribute__ ((packed)); |
| 387 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 388 | /* Chapter 10.5.2.20 */ |
| 389 | struct gsm48_meas_res { |
| 390 | uint8_t rxlev_full:6, |
| 391 | dtx_used:1, |
| 392 | ba_used:1; |
| 393 | uint8_t rxlev_sub:6, |
| 394 | meas_valid:1, |
| 395 | spare:1; |
| 396 | uint8_t no_nc_n_hi:1, |
| 397 | rxqual_sub:3, |
| 398 | rxqual_full:3, |
| 399 | spare2:1; |
| 400 | uint8_t rxlev_nc1:6, |
| 401 | no_nc_n_lo:2; |
| 402 | uint8_t bsic_nc1_hi:3, |
| 403 | bcch_f_nc1:5; |
| 404 | uint8_t rxlev_nc2_hi:5, |
| 405 | bsic_nc1_lo:3; |
| 406 | uint8_t bsic_nc2_hi:2, |
| 407 | bcch_f_nc2:5, |
| 408 | rxlev_nc2_lo:1; |
| 409 | uint8_t rxlev_nc3_hi:4, |
| 410 | bsic_nc2_lo:4; |
| 411 | uint8_t bsic_nc3_hi:1, |
| 412 | bcch_f_nc3:5, |
| 413 | rxlev_nc3_lo:2; |
| 414 | uint8_t rxlev_nc4_hi:3, |
| 415 | bsic_nc3_lo:5; |
| 416 | uint8_t bcch_f_nc4:5, |
| 417 | rxlev_nc4_lo:3; |
| 418 | uint8_t rxlev_nc5_hi:2, |
| 419 | bsic_nc4:6; |
| 420 | uint8_t bcch_f_nc5_hi:4, |
| 421 | rxlev_nc5_lo:4; |
| 422 | uint8_t rxlev_nc6_hi:1, |
| 423 | bsic_nc5:6, |
| 424 | bcch_f_nc5_lo:1; |
| 425 | uint8_t bcch_f_nc6_hi:3, |
| 426 | rxlev_nc6_lo:5; |
| 427 | uint8_t bsic_nc6:6, |
| 428 | bcch_f_nc6_lo:2; |
| 429 | } __attribute__ ((packed)); |
| 430 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 431 | /* Chapter 10.5.2.21aa */ |
| 432 | struct gsm48_multi_rate_conf { |
| 433 | uint8_t smod : 2, |
| 434 | spare: 1, |
| 435 | icmi : 1, |
| 436 | nscb : 1, |
| 437 | ver : 3; |
| 438 | uint8_t m4_75 : 1, |
| 439 | m5_15 : 1, |
| 440 | m5_90 : 1, |
| 441 | m6_70 : 1, |
| 442 | m7_40 : 1, |
| 443 | m7_95 : 1, |
| 444 | m10_2 : 1, |
| 445 | m12_2 : 1; |
| 446 | } __attribute__((packed)); |
| 447 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 448 | /* Chapter 10.5.2.28(a) */ |
| 449 | struct gsm48_power_cmd { |
| 450 | uint8_t power_level:5, |
| 451 | spare:2, |
| 452 | atc:1; |
| 453 | } __attribute__((packed)); |
| 454 | |
| 455 | /* Chapter 10.5.2.29 */ |
| 456 | struct gsm48_rach_control { |
| 457 | uint8_t re :1, |
| 458 | cell_bar :1, |
| 459 | tx_integer :4, |
| 460 | max_trans :2; |
| 461 | uint8_t t2; |
| 462 | uint8_t t3; |
| 463 | } __attribute__ ((packed)); |
| 464 | |
| 465 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 466 | /* Chapter 10.5.2.30 */ |
| 467 | struct gsm48_req_ref { |
| 468 | uint8_t ra; |
| 469 | uint8_t t3_high:3, |
Andreas Eversberg | 93364fc | 2010-06-25 02:50:06 +0200 | [diff] [blame] | 470 | t1:5; |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 471 | uint8_t t2:5, |
| 472 | t3_low:3; |
| 473 | } __attribute__ ((packed)); |
| 474 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 475 | /* Chapter 10.5.2.38 */ |
| 476 | struct gsm48_start_time { |
| 477 | uint8_t t3_high:3, |
| 478 | t1:5; |
| 479 | uint8_t t2:5, |
| 480 | t3_low:3; |
| 481 | } __attribute__ ((packed)); |
| 482 | |
| 483 | /* Chapter 10.5.2.39 */ |
| 484 | struct gsm48_sync_ind { |
| 485 | uint8_t si:2, |
| 486 | rot:1, |
| 487 | nci:1, |
| 488 | sync_ie:4; |
| 489 | } __attribute__((packed)); |
| 490 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 491 | /* |
| 492 | * Chapter 9.1.5/9.1.6 |
| 493 | * |
| 494 | * For 9.1.6 the chan_desc has the meaning of 10.5.2.5a |
| 495 | */ |
| 496 | struct gsm48_chan_mode_modify { |
| 497 | struct gsm48_chan_desc chan_desc; |
| 498 | uint8_t mode; |
| 499 | } __attribute__ ((packed)); |
| 500 | |
| 501 | enum gsm48_chan_mode { |
| 502 | GSM48_CMODE_SIGN = 0x00, |
| 503 | GSM48_CMODE_SPEECH_V1 = 0x01, |
| 504 | GSM48_CMODE_SPEECH_EFR = 0x21, |
| 505 | GSM48_CMODE_SPEECH_AMR = 0x41, |
| 506 | GSM48_CMODE_DATA_14k5 = 0x0f, |
| 507 | GSM48_CMODE_DATA_12k0 = 0x03, |
| 508 | GSM48_CMODE_DATA_6k0 = 0x0b, |
Bhaskar | 31e844b | 2013-05-16 17:06:35 +0530 | [diff] [blame] | 509 | GSM48_CMODE_DATA_3k6 = 0x13, |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 510 | }; |
| 511 | |
Max | fb348ee | 2016-03-30 21:14:53 +0200 | [diff] [blame] | 512 | extern const struct value_string gsm48_chan_mode_names[]; |
| 513 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 514 | /* Chapter 9.1.2 */ |
| 515 | struct gsm48_ass_cmd { |
| 516 | /* Semantic is from 10.5.2.5a */ |
| 517 | struct gsm48_chan_desc chan_desc; |
| 518 | uint8_t power_command; |
| 519 | uint8_t data[0]; |
| 520 | } __attribute__((packed)); |
| 521 | |
Andreas Eversberg | fa83201 | 2010-09-01 23:37:07 +0200 | [diff] [blame] | 522 | /* Chapter 9.1.13 */ |
| 523 | struct gsm48_frq_redef { |
| 524 | /* Semantic is from 10.5.2.5a */ |
| 525 | struct gsm48_chan_desc chan_desc; |
| 526 | uint8_t mob_alloc_len; |
| 527 | uint8_t mob_alloc[0]; |
| 528 | } __attribute__((packed)); |
| 529 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 530 | /* Chapter 10.5.2.2 */ |
| 531 | struct gsm48_cell_desc { |
| 532 | uint8_t bcc:3, |
| 533 | ncc:3, |
| 534 | arfcn_hi:2; |
| 535 | uint8_t arfcn_lo; |
| 536 | } __attribute__((packed)); |
| 537 | |
| 538 | /* Chapter 9.1.15 */ |
| 539 | struct gsm48_ho_cmd { |
| 540 | struct gsm48_cell_desc cell_desc; |
| 541 | struct gsm48_chan_desc chan_desc; |
| 542 | uint8_t ho_ref; |
| 543 | uint8_t power_command; |
| 544 | uint8_t data[0]; |
| 545 | } __attribute__((packed)); |
| 546 | |
| 547 | /* Chapter 9.1.18 */ |
| 548 | struct gsm48_imm_ass { |
| 549 | uint8_t l2_plen; |
| 550 | uint8_t proto_discr; |
| 551 | uint8_t msg_type; |
| 552 | uint8_t page_mode; |
| 553 | struct gsm48_chan_desc chan_desc; |
| 554 | struct gsm48_req_ref req_ref; |
| 555 | uint8_t timing_advance; |
| 556 | uint8_t mob_alloc_len; |
| 557 | uint8_t mob_alloc[0]; |
| 558 | } __attribute__ ((packed)); |
| 559 | |
Holger Hans Peter Freyther | 5dcef3c | 2010-05-15 22:35:25 +0800 | [diff] [blame] | 560 | /* Chapter 9.1.25 */ |
| 561 | struct gsm48_pag_resp { |
| 562 | uint8_t spare:4, |
| 563 | key_seq:4; |
| 564 | uint32_t classmark2; |
| 565 | uint8_t mi_len; |
| 566 | uint8_t mi[0]; |
| 567 | } __attribute__ ((packed)); |
| 568 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 569 | /* Chapter 10.5.1.3 */ |
| 570 | struct gsm48_loc_area_id { |
| 571 | uint8_t digits[3]; /* BCD! */ |
| 572 | uint16_t lac; |
| 573 | } __attribute__ ((packed)); |
| 574 | |
| 575 | /* Section 9.2.2 */ |
| 576 | struct gsm48_auth_req { |
| 577 | uint8_t key_seq:4, |
| 578 | spare:4; |
| 579 | uint8_t rand[16]; |
| 580 | } __attribute__ ((packed)); |
| 581 | |
Sylvain Munaut | d005eab | 2010-06-10 13:30:50 +0200 | [diff] [blame] | 582 | /* Section 9.2.3 */ |
| 583 | struct gsm48_auth_resp { |
| 584 | uint8_t sres[4]; |
| 585 | } __attribute__ ((packed)); |
| 586 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 587 | /* Section 9.2.15 */ |
| 588 | struct gsm48_loc_upd_req { |
| 589 | uint8_t type:4, |
| 590 | key_seq:4; |
| 591 | struct gsm48_loc_area_id lai; |
| 592 | struct gsm48_classmark1 classmark1; |
| 593 | uint8_t mi_len; |
| 594 | uint8_t mi[0]; |
| 595 | } __attribute__ ((packed)); |
| 596 | |
| 597 | /* Section 10.1 */ |
| 598 | struct gsm48_hdr { |
| 599 | uint8_t proto_discr; |
| 600 | uint8_t msg_type; |
| 601 | uint8_t data[0]; |
| 602 | } __attribute__ ((packed)); |
| 603 | |
| 604 | /* Section 9.1.3x System information Type header */ |
| 605 | struct gsm48_system_information_type_header { |
| 606 | uint8_t l2_plen; |
| 607 | uint8_t rr_protocol_discriminator :4, |
| 608 | skip_indicator:4; |
| 609 | uint8_t system_information; |
| 610 | } __attribute__ ((packed)); |
| 611 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 612 | /* Section 10.5.2.4 Cell Selection Parameters */ |
| 613 | struct gsm48_cell_sel_par { |
| 614 | uint8_t ms_txpwr_max_ccch:5, /* GSM 05.08 MS-TXPWR-MAX-CCCH */ |
| 615 | cell_resel_hyst:3; /* GSM 05.08 CELL-RESELECT-HYSTERESIS */ |
| 616 | uint8_t rxlev_acc_min:6, /* GSM 05.08 RXLEV-ACCESS-MIN */ |
| 617 | neci:1, |
| 618 | acs:1; |
| 619 | } __attribute__ ((packed)); |
| 620 | |
| 621 | /* Section 10.5.2.11 Control Channel Description , Figure 10.5.33 */ |
| 622 | struct gsm48_control_channel_descr { |
| 623 | uint8_t ccch_conf :3, |
| 624 | bs_ag_blks_res :3, |
| 625 | att :1, |
| 626 | spare1 :1; |
| 627 | uint8_t bs_pa_mfrms : 3, |
| 628 | spare2 :5; |
| 629 | uint8_t t3212; |
| 630 | } __attribute__ ((packed)); |
| 631 | |
Max | fe65fa7 | 2016-05-10 17:17:05 +0200 | [diff] [blame] | 632 | enum gsm48_dtx_mode { |
| 633 | GSM48_DTX_MAY_BE_USED, |
| 634 | GSM48_DTX_SHALL_BE_USED, |
| 635 | GSM48_DTX_SHALL_NOT_BE_USED |
| 636 | }; |
| 637 | |
| 638 | /* Cell Options for SI6, SACCH (10.5.2.3a.2) or SI3, BCCH (Table 10.5.2.3.1), |
| 639 | 3GPP TS 44.018 */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 640 | struct gsm48_cell_options { |
| 641 | uint8_t radio_link_timeout:4, |
| 642 | dtx:2, |
| 643 | pwrc:1, |
Max | fe65fa7 | 2016-05-10 17:17:05 +0200 | [diff] [blame] | 644 | /* either DN-IND or top bit of DTX IND */ |
| 645 | d:1; |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 646 | } __attribute__ ((packed)); |
| 647 | |
| 648 | /* Section 9.2.9 CM service request */ |
| 649 | struct gsm48_service_request { |
| 650 | uint8_t cm_service_type : 4, |
| 651 | cipher_key_seq : 4; |
| 652 | /* length + 3 bytes */ |
| 653 | uint32_t classmark; |
| 654 | uint8_t mi_len; |
| 655 | uint8_t mi[0]; |
| 656 | /* optional priority level */ |
| 657 | } __attribute__ ((packed)); |
| 658 | |
| 659 | /* Section 9.1.31 System information Type 1 */ |
| 660 | struct gsm48_system_information_type_1 { |
| 661 | struct gsm48_system_information_type_header header; |
| 662 | uint8_t cell_channel_description[16]; |
| 663 | struct gsm48_rach_control rach_control; |
| 664 | uint8_t rest_octets[0]; /* NCH position on the CCCH */ |
| 665 | } __attribute__ ((packed)); |
| 666 | |
| 667 | /* Section 9.1.32 System information Type 2 */ |
| 668 | struct gsm48_system_information_type_2 { |
| 669 | struct gsm48_system_information_type_header header; |
| 670 | uint8_t bcch_frequency_list[16]; |
| 671 | uint8_t ncc_permitted; |
| 672 | struct gsm48_rach_control rach_control; |
| 673 | } __attribute__ ((packed)); |
| 674 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 675 | /* Section 9.1.33 System information Type 2bis */ |
| 676 | struct gsm48_system_information_type_2bis { |
| 677 | struct gsm48_system_information_type_header header; |
| 678 | uint8_t bcch_frequency_list[16]; |
| 679 | struct gsm48_rach_control rach_control; |
| 680 | uint8_t rest_octets[0]; |
| 681 | } __attribute__ ((packed)); |
| 682 | |
| 683 | /* Section 9.1.34 System information Type 2ter */ |
| 684 | struct gsm48_system_information_type_2ter { |
| 685 | struct gsm48_system_information_type_header header; |
| 686 | uint8_t ext_bcch_frequency_list[16]; |
| 687 | uint8_t rest_octets[0]; |
| 688 | } __attribute__ ((packed)); |
| 689 | |
Max | e859aec | 2016-03-11 12:24:04 +0100 | [diff] [blame] | 690 | /* Section 9.1.34a System information Type 2quater */ |
| 691 | struct gsm48_system_information_type_2quater { |
| 692 | struct gsm48_system_information_type_header header; |
| 693 | uint8_t rest_octets[0]; |
| 694 | } __attribute__ ((packed)); |
| 695 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 696 | /* Section 9.1.35 System information Type 3 */ |
| 697 | struct gsm48_system_information_type_3 { |
| 698 | struct gsm48_system_information_type_header header; |
| 699 | uint16_t cell_identity; |
| 700 | struct gsm48_loc_area_id lai; |
| 701 | struct gsm48_control_channel_descr control_channel_desc; |
| 702 | struct gsm48_cell_options cell_options; |
| 703 | struct gsm48_cell_sel_par cell_sel_par; |
| 704 | struct gsm48_rach_control rach_control; |
| 705 | uint8_t rest_octets[0]; |
| 706 | } __attribute__ ((packed)); |
| 707 | |
| 708 | /* Section 9.1.36 System information Type 4 */ |
| 709 | struct gsm48_system_information_type_4 { |
| 710 | struct gsm48_system_information_type_header header; |
| 711 | struct gsm48_loc_area_id lai; |
| 712 | struct gsm48_cell_sel_par cell_sel_par; |
| 713 | struct gsm48_rach_control rach_control; |
| 714 | /* optional CBCH conditional CBCH... followed by |
| 715 | mandantory SI 4 Reset Octets |
| 716 | */ |
| 717 | uint8_t data[0]; |
| 718 | } __attribute__ ((packed)); |
| 719 | |
| 720 | /* Section 9.1.37 System information Type 5 */ |
| 721 | struct gsm48_system_information_type_5 { |
| 722 | uint8_t rr_protocol_discriminator :4, |
| 723 | skip_indicator:4; |
| 724 | uint8_t system_information; |
| 725 | uint8_t bcch_frequency_list[16]; |
| 726 | } __attribute__ ((packed)); |
| 727 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 728 | /* Section 9.1.38 System information Type 5bis */ |
| 729 | struct gsm48_system_information_type_5bis { |
| 730 | uint8_t rr_protocol_discriminator :4, |
| 731 | skip_indicator:4; |
| 732 | uint8_t system_information; |
| 733 | uint8_t bcch_frequency_list[16]; |
| 734 | } __attribute__ ((packed)); |
| 735 | |
| 736 | /* Section 9.1.39 System information Type 5ter */ |
| 737 | struct gsm48_system_information_type_5ter { |
| 738 | uint8_t rr_protocol_discriminator :4, |
| 739 | skip_indicator:4; |
| 740 | uint8_t system_information; |
| 741 | uint8_t bcch_frequency_list[16]; |
| 742 | } __attribute__ ((packed)); |
| 743 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 744 | /* Section 9.1.40 System information Type 6 */ |
| 745 | struct gsm48_system_information_type_6 { |
| 746 | uint8_t rr_protocol_discriminator :4, |
| 747 | skip_indicator:4; |
| 748 | uint8_t system_information; |
| 749 | uint16_t cell_identity; |
| 750 | struct gsm48_loc_area_id lai; |
| 751 | struct gsm48_cell_options cell_options; |
| 752 | uint8_t ncc_permitted; |
| 753 | uint8_t rest_octets[0]; |
| 754 | } __attribute__ ((packed)); |
| 755 | |
| 756 | /* Section 9.1.43a System Information type 13 */ |
| 757 | struct gsm48_system_information_type_13 { |
| 758 | struct gsm48_system_information_type_header header; |
| 759 | uint8_t rest_octets[0]; |
| 760 | } __attribute__ ((packed)); |
| 761 | |
| 762 | /* Section 9.2.12 IMSI Detach Indication */ |
| 763 | struct gsm48_imsi_detach_ind { |
| 764 | struct gsm48_classmark1 classmark1; |
| 765 | uint8_t mi_len; |
| 766 | uint8_t mi[0]; |
| 767 | } __attribute__ ((packed)); |
| 768 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 769 | /* Section 9.1.1 */ |
| 770 | struct gsm48_add_ass { |
| 771 | /* Semantic is from 10.5.2.5 */ |
| 772 | struct gsm48_chan_desc chan_desc; |
| 773 | uint8_t data[0]; |
| 774 | } __attribute__((packed)); |
| 775 | |
| 776 | /* Section 9.1.3 */ |
| 777 | struct gsm48_ass_cpl { |
| 778 | uint8_t rr_cause; |
| 779 | } __attribute__((packed)); |
| 780 | |
| 781 | /* Section 9.1.4 */ |
| 782 | struct gsm48_ass_fail { |
| 783 | uint8_t rr_cause; |
| 784 | } __attribute__((packed)); |
| 785 | |
Andreas Eversberg | fa83201 | 2010-09-01 23:37:07 +0200 | [diff] [blame] | 786 | /* Section 9.1.3 */ |
| 787 | struct gsm48_ho_cpl { |
| 788 | uint8_t rr_cause; |
| 789 | uint8_t data[0]; |
| 790 | } __attribute__((packed)); |
| 791 | |
| 792 | /* Section 9.1.4 */ |
| 793 | struct gsm48_ho_fail { |
| 794 | uint8_t rr_cause; |
| 795 | } __attribute__((packed)); |
| 796 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 797 | /* Section 9.1.7 */ |
| 798 | struct gsm48_chan_rel { |
| 799 | uint8_t rr_cause; |
| 800 | uint8_t data[0]; |
| 801 | } __attribute__((packed)); |
| 802 | |
| 803 | /* Section 9.1.9 */ |
| 804 | struct gsm48_cip_mode_cmd { |
| 805 | uint8_t sc:1, |
| 806 | alg_id:3, |
Sylvain Munaut | 77b6f6c | 2010-09-17 13:55:45 +0200 | [diff] [blame] | 807 | cr:1, |
| 808 | spare:3; |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 809 | } __attribute__((packed)); |
| 810 | |
| 811 | /* Section 9.1.11 */ |
| 812 | struct gsm48_cm_change { |
| 813 | uint8_t cm2_len; |
| 814 | struct gsm48_classmark2 cm2; |
| 815 | uint8_t data[0]; |
| 816 | } __attribute__((packed)); |
| 817 | |
| 818 | /* Section 9.1.19 */ |
| 819 | struct gsm48_imm_ass_ext { |
| 820 | uint8_t l2_plen; |
| 821 | uint8_t proto_discr; |
| 822 | uint8_t msg_type; |
| 823 | uint8_t page_mode; |
| 824 | struct gsm48_chan_desc chan_desc1; |
| 825 | struct gsm48_req_ref req_ref1; |
| 826 | uint8_t timing_advance1; |
| 827 | struct gsm48_chan_desc chan_desc2; |
| 828 | struct gsm48_req_ref req_ref2; |
| 829 | uint8_t timing_advance2; |
| 830 | uint8_t mob_alloc_len; |
| 831 | uint8_t mob_alloc[0]; |
| 832 | } __attribute__ ((packed)); |
| 833 | |
| 834 | /* Section 9.1.20 */ |
| 835 | struct gsm48_imm_ass_rej { |
| 836 | uint8_t l2_plen; |
| 837 | uint8_t proto_discr; |
| 838 | uint8_t msg_type; |
| 839 | uint8_t page_mode; |
| 840 | struct gsm48_req_ref req_ref1; |
| 841 | uint8_t wait_ind1; |
| 842 | struct gsm48_req_ref req_ref2; |
| 843 | uint8_t wait_ind2; |
| 844 | struct gsm48_req_ref req_ref3; |
| 845 | uint8_t wait_ind3; |
| 846 | struct gsm48_req_ref req_ref4; |
| 847 | uint8_t wait_ind4; |
| 848 | uint8_t rest[0]; |
| 849 | } __attribute__ ((packed)); |
| 850 | |
| 851 | /* Section 9.1.22 */ |
| 852 | struct gsm48_paging1 { |
| 853 | uint8_t l2_plen; |
| 854 | uint8_t proto_discr; |
| 855 | uint8_t msg_type; |
| 856 | uint8_t pag_mode:2, |
| 857 | spare:2, |
| 858 | cneed1:2, |
| 859 | cneed2:2; |
| 860 | uint8_t data[0]; |
| 861 | } __attribute__((packed)); |
| 862 | |
| 863 | /* Section 9.1.23 */ |
| 864 | struct gsm48_paging2 { |
| 865 | uint8_t l2_plen; |
| 866 | uint8_t proto_discr; |
| 867 | uint8_t msg_type; |
| 868 | uint8_t pag_mode:2, |
| 869 | spare:2, |
| 870 | cneed1:2, |
| 871 | cneed2:2; |
| 872 | uint32_t tmsi1; |
| 873 | uint32_t tmsi2; |
| 874 | uint8_t data[0]; |
| 875 | } __attribute__((packed)); |
| 876 | |
| 877 | /* Section 9.1.24 */ |
| 878 | struct gsm48_paging3 { |
| 879 | uint8_t l2_plen; |
| 880 | uint8_t proto_discr; |
| 881 | uint8_t msg_type; |
| 882 | uint8_t pag_mode:2, |
| 883 | spare:2, |
| 884 | cneed1:2, |
| 885 | cneed2:2; |
| 886 | uint32_t tmsi1; |
| 887 | uint32_t tmsi2; |
| 888 | uint32_t tmsi3; |
| 889 | uint32_t tmsi4; |
| 890 | uint8_t cneed3:2, |
| 891 | cneed4:2, |
| 892 | spare2:4; |
| 893 | uint8_t rest[0]; |
| 894 | } __attribute__((packed)); |
| 895 | |
| 896 | /* Section 9.1.25 */ |
| 897 | struct gsm48_pag_rsp { |
| 898 | uint8_t key_seq:3, |
| 899 | spare:5; |
| 900 | uint8_t cm2_len; |
| 901 | struct gsm48_classmark2 cm2; |
| 902 | uint8_t data[0]; |
| 903 | } __attribute__((packed)); |
| 904 | |
| 905 | /* Section 9.1.29 */ |
| 906 | struct gsm48_rr_status { |
| 907 | uint8_t rr_cause; |
| 908 | } __attribute__((packed)); |
| 909 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 910 | /* Section 10.2 + GSM 04.07 12.2.3.1.1 */ |
| 911 | #define GSM48_PDISC_GROUP_CC 0x00 |
| 912 | #define GSM48_PDISC_BCAST_CC 0x01 |
| 913 | #define GSM48_PDISC_PDSS1 0x02 |
| 914 | #define GSM48_PDISC_CC 0x03 |
| 915 | #define GSM48_PDISC_PDSS2 0x04 |
| 916 | #define GSM48_PDISC_MM 0x05 |
| 917 | #define GSM48_PDISC_RR 0x06 |
| 918 | #define GSM48_PDISC_MM_GPRS 0x08 |
| 919 | #define GSM48_PDISC_SMS 0x09 |
| 920 | #define GSM48_PDISC_SM_GPRS 0x0a |
| 921 | #define GSM48_PDISC_NC_SS 0x0b |
| 922 | #define GSM48_PDISC_LOC 0x0c |
Neels Hofmeyr | 282e908 | 2016-03-14 16:06:46 +0100 | [diff] [blame] | 923 | #define GSM48_PDISC_EXTEND 0x0e |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 924 | #define GSM48_PDISC_MASK 0x0f |
| 925 | #define GSM48_PDISC_USSD 0x11 |
| 926 | |
Max | fdca25d | 2016-07-05 16:06:28 +0200 | [diff] [blame] | 927 | bool gsm48_hdr_gmm_cipherable(const struct gsm48_hdr *hdr); |
| 928 | |
Neels Hofmeyr | 282e908 | 2016-03-14 16:06:46 +0100 | [diff] [blame] | 929 | static inline uint8_t gsm48_hdr_pdisc(const struct gsm48_hdr *hdr) |
| 930 | { |
| 931 | /* |
| 932 | * 3GPP TS 24.007 version 12.0.0 Release 12, |
| 933 | * 11.2.3.1.1 Protocol discriminator |
| 934 | */ |
| 935 | uint8_t pdisc = hdr->proto_discr & GSM48_PDISC_MASK; |
| 936 | if (pdisc == GSM48_PDISC_EXTEND) |
| 937 | return hdr->proto_discr; |
| 938 | return pdisc; |
| 939 | } |
| 940 | |
Neels Hofmeyr | da7bf4d | 2016-03-14 16:06:48 +0100 | [diff] [blame] | 941 | static inline uint8_t gsm48_hdr_trans_id(const struct gsm48_hdr *hdr) |
| 942 | { |
| 943 | /* |
| 944 | * 3GPP TS 24.007 version 12.0.0 Release 12, |
| 945 | * 11.2.3.1.3 Transaction identifier |
| 946 | */ |
| 947 | return (hdr->proto_discr & 0xf0) >> 4; |
| 948 | } |
| 949 | |
| 950 | static inline uint8_t gsm48_hdr_trans_id_flip_ti(const struct gsm48_hdr *hdr) |
| 951 | { |
| 952 | return gsm48_hdr_trans_id(hdr) ^ 0x08; |
| 953 | } |
| 954 | |
| 955 | static inline uint8_t gsm48_hdr_trans_id_no_ti(const struct gsm48_hdr *hdr) |
| 956 | { |
| 957 | return gsm48_hdr_trans_id(hdr) & 0x07; |
| 958 | } |
| 959 | |
Neels Hofmeyr | 282e908 | 2016-03-14 16:06:46 +0100 | [diff] [blame] | 960 | static inline uint8_t gsm48_hdr_msg_type_r98(const struct gsm48_hdr *hdr) |
| 961 | { |
| 962 | /* |
| 963 | * 3GPP TS 24.007 version 12.0.0 Release 12, |
| 964 | * 11.2.3.2.1 Message type octet (when accessing Release 98 and older |
| 965 | * networks only) |
| 966 | */ |
| 967 | switch (gsm48_hdr_pdisc(hdr)) { |
| 968 | case GSM48_PDISC_MM: |
| 969 | case GSM48_PDISC_CC: |
| 970 | case GSM48_PDISC_NC_SS: |
| 971 | case GSM48_PDISC_GROUP_CC: |
| 972 | case GSM48_PDISC_BCAST_CC: |
| 973 | case GSM48_PDISC_LOC: |
| 974 | return hdr->msg_type & 0xbf; |
| 975 | default: |
| 976 | return hdr->msg_type; |
| 977 | } |
| 978 | } |
| 979 | |
| 980 | static inline uint8_t gsm48_hdr_msg_type_r99(const struct gsm48_hdr *hdr) |
| 981 | { |
| 982 | /* |
| 983 | * 3GPP TS 24.007 version 12.0.0 Release 12, |
| 984 | * 11.2.3.2.2 Message type octet (when accessing Release 99 and newer |
| 985 | * networks) |
| 986 | */ |
| 987 | switch (gsm48_hdr_pdisc(hdr)) { |
| 988 | case GSM48_PDISC_MM: |
| 989 | case GSM48_PDISC_CC: |
| 990 | return hdr->msg_type & 0x3f; |
| 991 | case GSM48_PDISC_NC_SS: |
| 992 | case GSM48_PDISC_GROUP_CC: |
| 993 | case GSM48_PDISC_BCAST_CC: |
| 994 | case GSM48_PDISC_LOC: |
| 995 | return hdr->msg_type & 0xbf; |
| 996 | default: |
| 997 | return hdr->msg_type; |
| 998 | } |
| 999 | } |
| 1000 | |
Max | fe65fa7 | 2016-05-10 17:17:05 +0200 | [diff] [blame] | 1001 | void gsm48_set_dtx(struct gsm48_cell_options *op, enum gsm48_dtx_mode full, |
| 1002 | enum gsm48_dtx_mode half, bool is_bcch); |
| 1003 | |
Neels Hofmeyr | c656fae | 2016-03-14 16:06:47 +0100 | [diff] [blame] | 1004 | #define gsm48_hdr_msg_type gsm48_hdr_msg_type_r99 |
Neels Hofmeyr | 282e908 | 2016-03-14 16:06:46 +0100 | [diff] [blame] | 1005 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1006 | /* Section 10.4 */ |
| 1007 | #define GSM48_MT_RR_INIT_REQ 0x3c |
| 1008 | #define GSM48_MT_RR_ADD_ASS 0x3b |
| 1009 | #define GSM48_MT_RR_IMM_ASS 0x3f |
| 1010 | #define GSM48_MT_RR_IMM_ASS_EXT 0x39 |
| 1011 | #define GSM48_MT_RR_IMM_ASS_REJ 0x3a |
| 1012 | |
| 1013 | #define GSM48_MT_RR_CIPH_M_CMD 0x35 |
| 1014 | #define GSM48_MT_RR_CIPH_M_COMPL 0x32 |
| 1015 | |
| 1016 | #define GSM48_MT_RR_CFG_CHG_CMD 0x30 |
| 1017 | #define GSM48_MT_RR_CFG_CHG_ACK 0x31 |
| 1018 | #define GSM48_MT_RR_CFG_CHG_REJ 0x33 |
| 1019 | |
| 1020 | #define GSM48_MT_RR_ASS_CMD 0x2e |
| 1021 | #define GSM48_MT_RR_ASS_COMPL 0x29 |
| 1022 | #define GSM48_MT_RR_ASS_FAIL 0x2f |
| 1023 | #define GSM48_MT_RR_HANDO_CMD 0x2b |
| 1024 | #define GSM48_MT_RR_HANDO_COMPL 0x2c |
| 1025 | #define GSM48_MT_RR_HANDO_FAIL 0x28 |
| 1026 | #define GSM48_MT_RR_HANDO_INFO 0x2d |
| 1027 | |
| 1028 | #define GSM48_MT_RR_CELL_CHG_ORDER 0x08 |
| 1029 | #define GSM48_MT_RR_PDCH_ASS_CMD 0x23 |
| 1030 | |
| 1031 | #define GSM48_MT_RR_CHAN_REL 0x0d |
| 1032 | #define GSM48_MT_RR_PART_REL 0x0a |
| 1033 | #define GSM48_MT_RR_PART_REL_COMP 0x0f |
| 1034 | |
| 1035 | #define GSM48_MT_RR_PAG_REQ_1 0x21 |
| 1036 | #define GSM48_MT_RR_PAG_REQ_2 0x22 |
| 1037 | #define GSM48_MT_RR_PAG_REQ_3 0x24 |
| 1038 | #define GSM48_MT_RR_PAG_RESP 0x27 |
| 1039 | #define GSM48_MT_RR_NOTIF_NCH 0x20 |
| 1040 | #define GSM48_MT_RR_NOTIF_FACCH 0x25 |
| 1041 | #define GSM48_MT_RR_NOTIF_RESP 0x26 |
| 1042 | |
| 1043 | #define GSM48_MT_RR_SYSINFO_8 0x18 |
| 1044 | #define GSM48_MT_RR_SYSINFO_1 0x19 |
| 1045 | #define GSM48_MT_RR_SYSINFO_2 0x1a |
| 1046 | #define GSM48_MT_RR_SYSINFO_3 0x1b |
| 1047 | #define GSM48_MT_RR_SYSINFO_4 0x1c |
| 1048 | #define GSM48_MT_RR_SYSINFO_5 0x1d |
| 1049 | #define GSM48_MT_RR_SYSINFO_6 0x1e |
| 1050 | #define GSM48_MT_RR_SYSINFO_7 0x1f |
| 1051 | |
| 1052 | #define GSM48_MT_RR_SYSINFO_2bis 0x02 |
| 1053 | #define GSM48_MT_RR_SYSINFO_2ter 0x03 |
Max | e859aec | 2016-03-11 12:24:04 +0100 | [diff] [blame] | 1054 | #define GSM48_MT_RR_SYSINFO_2quater 0x07 |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1055 | #define GSM48_MT_RR_SYSINFO_5bis 0x05 |
| 1056 | #define GSM48_MT_RR_SYSINFO_5ter 0x06 |
| 1057 | #define GSM48_MT_RR_SYSINFO_9 0x04 |
| 1058 | #define GSM48_MT_RR_SYSINFO_13 0x00 |
| 1059 | |
| 1060 | #define GSM48_MT_RR_SYSINFO_16 0x3d |
| 1061 | #define GSM48_MT_RR_SYSINFO_17 0x3e |
| 1062 | |
| 1063 | #define GSM48_MT_RR_CHAN_MODE_MODIF 0x10 |
| 1064 | #define GSM48_MT_RR_STATUS 0x12 |
| 1065 | #define GSM48_MT_RR_CHAN_MODE_MODIF_ACK 0x17 |
| 1066 | #define GSM48_MT_RR_FREQ_REDEF 0x14 |
| 1067 | #define GSM48_MT_RR_MEAS_REP 0x15 |
| 1068 | #define GSM48_MT_RR_CLSM_CHG 0x16 |
| 1069 | #define GSM48_MT_RR_CLSM_ENQ 0x13 |
| 1070 | #define GSM48_MT_RR_EXT_MEAS_REP 0x36 |
| 1071 | #define GSM48_MT_RR_EXT_MEAS_REP_ORD 0x37 |
| 1072 | #define GSM48_MT_RR_GPRS_SUSP_REQ 0x34 |
| 1073 | |
Bhaskar | e6b45d8 | 2013-05-16 17:11:51 +0530 | [diff] [blame] | 1074 | #define GSM48_MT_RR_VGCS_UPL_GRANT 0x09 |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1075 | #define GSM48_MT_RR_UPLINK_RELEASE 0x0e |
| 1076 | #define GSM48_MT_RR_UPLINK_FREE 0x0c |
| 1077 | #define GSM48_MT_RR_UPLINK_BUSY 0x2a |
| 1078 | #define GSM48_MT_RR_TALKER_IND 0x11 |
| 1079 | |
| 1080 | #define GSM48_MT_RR_APP_INFO 0x38 |
| 1081 | |
| 1082 | /* Table 10.2/3GPP TS 04.08 */ |
| 1083 | #define GSM48_MT_MM_IMSI_DETACH_IND 0x01 |
| 1084 | #define GSM48_MT_MM_LOC_UPD_ACCEPT 0x02 |
| 1085 | #define GSM48_MT_MM_LOC_UPD_REJECT 0x04 |
| 1086 | #define GSM48_MT_MM_LOC_UPD_REQUEST 0x08 |
| 1087 | |
| 1088 | #define GSM48_MT_MM_AUTH_REJ 0x11 |
| 1089 | #define GSM48_MT_MM_AUTH_REQ 0x12 |
| 1090 | #define GSM48_MT_MM_AUTH_RESP 0x14 |
| 1091 | #define GSM48_MT_MM_ID_REQ 0x18 |
| 1092 | #define GSM48_MT_MM_ID_RESP 0x19 |
| 1093 | #define GSM48_MT_MM_TMSI_REALL_CMD 0x1a |
| 1094 | #define GSM48_MT_MM_TMSI_REALL_COMPL 0x1b |
| 1095 | |
| 1096 | #define GSM48_MT_MM_CM_SERV_ACC 0x21 |
| 1097 | #define GSM48_MT_MM_CM_SERV_REJ 0x22 |
| 1098 | #define GSM48_MT_MM_CM_SERV_ABORT 0x23 |
| 1099 | #define GSM48_MT_MM_CM_SERV_REQ 0x24 |
| 1100 | #define GSM48_MT_MM_CM_SERV_PROMPT 0x25 |
| 1101 | #define GSM48_MT_MM_CM_REEST_REQ 0x28 |
| 1102 | #define GSM48_MT_MM_ABORT 0x29 |
| 1103 | |
| 1104 | #define GSM48_MT_MM_NULL 0x30 |
| 1105 | #define GSM48_MT_MM_STATUS 0x31 |
| 1106 | #define GSM48_MT_MM_INFO 0x32 |
| 1107 | |
| 1108 | /* Table 10.3/3GPP TS 04.08 */ |
| 1109 | #define GSM48_MT_CC_ALERTING 0x01 |
| 1110 | #define GSM48_MT_CC_CALL_CONF 0x08 |
| 1111 | #define GSM48_MT_CC_CALL_PROC 0x02 |
| 1112 | #define GSM48_MT_CC_CONNECT 0x07 |
| 1113 | #define GSM48_MT_CC_CONNECT_ACK 0x0f |
| 1114 | #define GSM48_MT_CC_EMERG_SETUP 0x0e |
| 1115 | #define GSM48_MT_CC_PROGRESS 0x03 |
| 1116 | #define GSM48_MT_CC_ESTAB 0x04 |
| 1117 | #define GSM48_MT_CC_ESTAB_CONF 0x06 |
| 1118 | #define GSM48_MT_CC_RECALL 0x0b |
| 1119 | #define GSM48_MT_CC_START_CC 0x09 |
| 1120 | #define GSM48_MT_CC_SETUP 0x05 |
| 1121 | |
| 1122 | #define GSM48_MT_CC_MODIFY 0x17 |
| 1123 | #define GSM48_MT_CC_MODIFY_COMPL 0x1f |
| 1124 | #define GSM48_MT_CC_MODIFY_REJECT 0x13 |
| 1125 | #define GSM48_MT_CC_USER_INFO 0x10 |
| 1126 | #define GSM48_MT_CC_HOLD 0x18 |
| 1127 | #define GSM48_MT_CC_HOLD_ACK 0x19 |
| 1128 | #define GSM48_MT_CC_HOLD_REJ 0x1a |
| 1129 | #define GSM48_MT_CC_RETR 0x1c |
| 1130 | #define GSM48_MT_CC_RETR_ACK 0x1d |
| 1131 | #define GSM48_MT_CC_RETR_REJ 0x1e |
| 1132 | |
| 1133 | #define GSM48_MT_CC_DISCONNECT 0x25 |
| 1134 | #define GSM48_MT_CC_RELEASE 0x2d |
| 1135 | #define GSM48_MT_CC_RELEASE_COMPL 0x2a |
| 1136 | |
| 1137 | #define GSM48_MT_CC_CONG_CTRL 0x39 |
| 1138 | #define GSM48_MT_CC_NOTIFY 0x3e |
| 1139 | #define GSM48_MT_CC_STATUS 0x3d |
| 1140 | #define GSM48_MT_CC_STATUS_ENQ 0x34 |
| 1141 | #define GSM48_MT_CC_START_DTMF 0x35 |
| 1142 | #define GSM48_MT_CC_STOP_DTMF 0x31 |
| 1143 | #define GSM48_MT_CC_STOP_DTMF_ACK 0x32 |
| 1144 | #define GSM48_MT_CC_START_DTMF_ACK 0x36 |
| 1145 | #define GSM48_MT_CC_START_DTMF_REJ 0x37 |
| 1146 | #define GSM48_MT_CC_FACILITY 0x3a |
| 1147 | |
| 1148 | /* FIXME: Table 10.4 / 10.4a (GPRS) */ |
| 1149 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1150 | /* Section 10.5.3.3 CM service type */ |
| 1151 | #define GSM48_CMSERV_MO_CALL_PACKET 1 |
| 1152 | #define GSM48_CMSERV_EMERGENCY 2 |
| 1153 | #define GSM48_CMSERV_SMS 4 |
| 1154 | #define GSM48_CMSERV_SUP_SERV 8 |
| 1155 | #define GSM48_CMSERV_VGCS 9 |
| 1156 | #define GSM48_CMSERV_VBS 10 |
| 1157 | #define GSM48_CMSERV_LOC_SERV 11 |
| 1158 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1159 | /* Section 10.5.2.26, Table 10.5.64 */ |
| 1160 | #define GSM48_PM_MASK 0x03 |
| 1161 | #define GSM48_PM_NORMAL 0x00 |
| 1162 | #define GSM48_PM_EXTENDED 0x01 |
| 1163 | #define GSM48_PM_REORG 0x02 |
| 1164 | #define GSM48_PM_SAME 0x03 |
| 1165 | |
| 1166 | /* Chapter 10.5.3.5 / Table 10.5.93 */ |
| 1167 | #define GSM48_LUPD_NORMAL 0x0 |
| 1168 | #define GSM48_LUPD_PERIODIC 0x1 |
| 1169 | #define GSM48_LUPD_IMSI_ATT 0x2 |
| 1170 | #define GSM48_LUPD_RESERVED 0x3 |
| 1171 | |
| 1172 | /* Table 10.5.4 */ |
| 1173 | #define GSM_MI_TYPE_MASK 0x07 |
| 1174 | #define GSM_MI_TYPE_NONE 0x00 |
| 1175 | #define GSM_MI_TYPE_IMSI 0x01 |
| 1176 | #define GSM_MI_TYPE_IMEI 0x02 |
| 1177 | #define GSM_MI_TYPE_IMEISV 0x03 |
| 1178 | #define GSM_MI_TYPE_TMSI 0x04 |
| 1179 | #define GSM_MI_ODD 0x08 |
| 1180 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1181 | #define GSM48_IE_MOBILE_ID 0x17 /* 10.5.1.4 */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1182 | #define GSM48_IE_NAME_LONG 0x43 /* 10.5.3.5a */ |
| 1183 | #define GSM48_IE_NAME_SHORT 0x45 /* 10.5.3.5a */ |
| 1184 | #define GSM48_IE_UTC 0x46 /* 10.5.3.8 */ |
| 1185 | #define GSM48_IE_NET_TIME_TZ 0x47 /* 10.5.3.9 */ |
| 1186 | #define GSM48_IE_LSA_IDENT 0x48 /* 10.5.3.11 */ |
Jacob Erlbeck | 1c3f088 | 2013-09-16 10:29:57 +0200 | [diff] [blame] | 1187 | #define GSM48_IE_NET_DST 0x49 /* 10.5.3.12 [24.008] */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1188 | |
| 1189 | #define GSM48_IE_BEARER_CAP 0x04 /* 10.5.4.5 */ |
| 1190 | #define GSM48_IE_CAUSE 0x08 /* 10.5.4.11 */ |
| 1191 | #define GSM48_IE_CC_CAP 0x15 /* 10.5.4.5a */ |
| 1192 | #define GSM48_IE_ALERT 0x19 /* 10.5.4.26 */ |
| 1193 | #define GSM48_IE_FACILITY 0x1c /* 10.5.4.15 */ |
| 1194 | #define GSM48_IE_PROGR_IND 0x1e /* 10.5.4.21 */ |
| 1195 | #define GSM48_IE_AUX_STATUS 0x24 /* 10.5.4.4 */ |
| 1196 | #define GSM48_IE_NOTIFY 0x27 /* 10.5.4.20 */ |
| 1197 | #define GSM48_IE_KPD_FACILITY 0x2c /* 10.5.4.17 */ |
| 1198 | #define GSM48_IE_SIGNAL 0x34 /* 10.5.4.23 */ |
| 1199 | #define GSM48_IE_CONN_BCD 0x4c /* 10.5.4.13 */ |
| 1200 | #define GSM48_IE_CONN_SUB 0x4d /* 10.5.4.14 */ |
| 1201 | #define GSM48_IE_CALLING_BCD 0x5c /* 10.5.4.9 */ |
| 1202 | #define GSM48_IE_CALLING_SUB 0x5d /* 10.5.4.10 */ |
| 1203 | #define GSM48_IE_CALLED_BCD 0x5e /* 10.5.4.7 */ |
| 1204 | #define GSM48_IE_CALLED_SUB 0x6d /* 10.5.4.8 */ |
| 1205 | #define GSM48_IE_REDIR_BCD 0x74 /* 10.5.4.21a */ |
| 1206 | #define GSM48_IE_REDIR_SUB 0x75 /* 10.5.4.21b */ |
| 1207 | #define GSM48_IE_LOWL_COMPAT 0x7c /* 10.5.4.18 */ |
| 1208 | #define GSM48_IE_HIGHL_COMPAT 0x7d /* 10.5.4.16 */ |
| 1209 | #define GSM48_IE_USER_USER 0x7e /* 10.5.4.25 */ |
| 1210 | #define GSM48_IE_SS_VERS 0x7f /* 10.5.4.24 */ |
| 1211 | #define GSM48_IE_MORE_DATA 0xa0 /* 10.5.4.19 */ |
| 1212 | #define GSM48_IE_CLIR_SUPP 0xa1 /* 10.5.4.11a */ |
| 1213 | #define GSM48_IE_CLIR_INVOC 0xa2 /* 10.5.4.11b */ |
| 1214 | #define GSM48_IE_REV_C_SETUP 0xa3 /* 10.5.4.22a */ |
| 1215 | #define GSM48_IE_REPEAT_CIR 0xd1 /* 10.5.4.22 */ |
| 1216 | #define GSM48_IE_REPEAT_SEQ 0xd3 /* 10.5.4.22 */ |
| 1217 | |
| 1218 | /* Section 10.5.4.11 / Table 10.5.122 */ |
| 1219 | #define GSM48_CAUSE_CS_GSM 0x60 |
| 1220 | |
| 1221 | /* Section 9.1.2 / Table 9.3 */ |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1222 | /* RR elements */ |
| 1223 | #define GSM48_IE_VGCS_TARGET 0x01 |
| 1224 | //#define GSM48_IE_VGCS_T_MODE_I 0x01 |
| 1225 | #define GSM48_IE_FRQSHORT_AFTER 0x02 |
| 1226 | #define GSM48_IE_MUL_RATE_CFG 0x03 /* 10.5.2.21aa */ |
| 1227 | #define GSM48_IE_FREQ_L_AFTER 0x05 |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1228 | #define GSM48_IE_MSLOT_DESC 0x10 |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1229 | #define GSM48_IE_CHANMODE_2 0x11 |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1230 | #define GSM48_IE_FRQSHORT_BEFORE 0x12 |
| 1231 | //#define GSM48_IE_FRQSHORT_BEFOR 0x12 |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1232 | #define GSM48_IE_CHANMODE_3 0x13 |
| 1233 | #define GSM48_IE_CHANMODE_4 0x14 |
| 1234 | #define GSM48_IE_CHANMODE_5 0x15 |
| 1235 | #define GSM48_IE_CHANMODE_6 0x16 |
| 1236 | #define GSM48_IE_CHANMODE_7 0x17 |
| 1237 | #define GSM48_IE_CHANMODE_8 0x18 |
| 1238 | #define GSM48_IE_CHANDESC_2 0x64 |
Harald Welte | 639f74b | 2010-06-15 09:32:14 +0200 | [diff] [blame] | 1239 | #define GSM48_IE_MA_AFTER 0x72 |
| 1240 | #define GSM48_IE_START_TIME 0x7c |
| 1241 | #define GSM48_IE_FREQ_L_BEFORE 0x19 |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1242 | //#define GSM48_IE_FRQLIST_BEFORE 0x19 |
Harald Welte | 639f74b | 2010-06-15 09:32:14 +0200 | [diff] [blame] | 1243 | #define GSM48_IE_CH_DESC_1_BEFORE 0x1c |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1244 | //#define GSM48_IE_CHDES_1_BEFORE 0x1c |
Harald Welte | 639f74b | 2010-06-15 09:32:14 +0200 | [diff] [blame] | 1245 | #define GSM48_IE_CH_DESC_2_BEFORE 0x1d |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1246 | //#define GSM48_IE_CHDES_2_BEFORE 0x1d |
Harald Welte | 639f74b | 2010-06-15 09:32:14 +0200 | [diff] [blame] | 1247 | #define GSM48_IE_F_CH_SEQ_BEFORE 0x1e |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1248 | //#define GSM48_IE_FRQSEQ_BEFORE 0x1e |
| 1249 | #define GSM48_IE_CLASSMARK3 0x20 |
Harald Welte | 639f74b | 2010-06-15 09:32:14 +0200 | [diff] [blame] | 1250 | #define GSM48_IE_MA_BEFORE 0x21 |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1251 | #define GSM48_IE_RR_PACKET_UL 0x22 |
| 1252 | #define GSM48_IE_RR_PACKET_DL 0x23 |
| 1253 | #define GSM48_IE_CELL_CH_DESC 0x62 |
| 1254 | #define GSM48_IE_CHANMODE_1 0x63 |
| 1255 | #define GSM48_IE_CHDES_2_AFTER 0x64 |
| 1256 | #define GSM48_IE_MODE_SEC_CH 0x66 |
| 1257 | #define GSM48_IE_F_CH_SEQ_AFTER 0x69 |
| 1258 | #define GSM48_IE_MA_AFTER 0x72 |
| 1259 | #define GSM48_IE_BA_RANGE 0x73 |
| 1260 | #define GSM48_IE_GROUP_CHDES 0x74 |
| 1261 | #define GSM48_IE_BA_LIST_PREF 0x75 |
| 1262 | #define GSM48_IE_MOB_OVSERV_DIF 0x77 |
| 1263 | #define GSM48_IE_REALTIME_DIFF 0x7b |
| 1264 | #define GSM48_IE_START_TIME 0x7c |
| 1265 | #define GSM48_IE_TIMING_ADVANCE 0x7d |
| 1266 | #define GSM48_IE_GROUP_CIP_SEQ 0x80 |
| 1267 | #define GSM48_IE_CIP_MODE_SET 0x90 |
| 1268 | #define GSM48_IE_GPRS_RESUMPT 0xc0 |
| 1269 | #define GSM48_IE_SYNC_IND 0xd0 |
| 1270 | /* System Information 4 (types are equal IEs above) */ |
| 1271 | #define GSM48_IE_CBCH_CHAN_DESC 0x64 |
| 1272 | #define GSM48_IE_CBCH_MOB_AL 0x72 |
Harald Welte | 639f74b | 2010-06-15 09:32:14 +0200 | [diff] [blame] | 1273 | |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1274 | /* Additional MM elements */ |
| 1275 | #define GSM48_IE_LOCATION_AREA 0x13 |
Harald Welte | 82f94ef | 2016-05-05 23:33:27 +0200 | [diff] [blame] | 1276 | #define GSM48_IE_AUTN 0x20 |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1277 | #define GSM48_IE_PRIORITY_LEV 0x80 |
| 1278 | #define GSM48_IE_FOLLOW_ON_PROC 0xa1 |
| 1279 | #define GSM48_IE_CTS_PERMISSION 0xa2 |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1280 | |
| 1281 | /* Section 10.5.4.23 / Table 10.5.130 */ |
| 1282 | enum gsm48_signal_val { |
| 1283 | GSM48_SIGNAL_DIALTONE = 0x00, |
| 1284 | GSM48_SIGNAL_RINGBACK = 0x01, |
| 1285 | GSM48_SIGNAL_INTERCEPT = 0x02, |
| 1286 | GSM48_SIGNAL_NET_CONG = 0x03, |
| 1287 | GSM48_SIGNAL_BUSY = 0x04, |
| 1288 | GSM48_SIGNAL_CONFIRM = 0x05, |
| 1289 | GSM48_SIGNAL_ANSWER = 0x06, |
| 1290 | GSM48_SIGNAL_CALL_WAIT = 0x07, |
| 1291 | GSM48_SIGNAL_OFF_HOOK = 0x08, |
| 1292 | GSM48_SIGNAL_OFF = 0x3f, |
| 1293 | GSM48_SIGNAL_ALERT_OFF = 0x4f, |
| 1294 | }; |
| 1295 | |
| 1296 | enum gsm48_cause_loc { |
| 1297 | GSM48_CAUSE_LOC_USER = 0x00, |
| 1298 | GSM48_CAUSE_LOC_PRN_S_LU = 0x01, |
| 1299 | GSM48_CAUSE_LOC_PUN_S_LU = 0x02, |
| 1300 | GSM48_CAUSE_LOC_TRANS_NET = 0x03, |
| 1301 | GSM48_CAUSE_LOC_PUN_S_RU = 0x04, |
| 1302 | GSM48_CAUSE_LOC_PRN_S_RU = 0x05, |
| 1303 | /* not defined */ |
| 1304 | GSM48_CAUSE_LOC_INN_NET = 0x07, |
| 1305 | GSM48_CAUSE_LOC_NET_BEYOND = 0x0a, |
| 1306 | }; |
| 1307 | |
| 1308 | /* Section 10.5.2.31 RR Cause / Table 10.5.70 */ |
| 1309 | enum gsm48_rr_cause { |
| 1310 | GSM48_RR_CAUSE_NORMAL = 0x00, |
| 1311 | GSM48_RR_CAUSE_ABNORMAL_UNSPEC = 0x01, |
| 1312 | GSM48_RR_CAUSE_ABNORMAL_UNACCT = 0x02, |
| 1313 | GSM48_RR_CAUSE_ABNORMAL_TIMER = 0x03, |
| 1314 | GSM48_RR_CAUSE_ABNORMAL_NOACT = 0x04, |
| 1315 | GSM48_RR_CAUSE_PREMPTIVE_REL = 0x05, |
Andreas Eversberg | c8cac64 | 2013-06-19 20:58:59 +0200 | [diff] [blame] | 1316 | GSM48_RR_CAUSE_HNDOVER_IMP = 0x08, |
| 1317 | GSM48_RR_CAUSE_CHAN_MODE_UNACCT = 0x09, |
| 1318 | GSM48_RR_CAUSE_FREQ_NOT_IMPL = 0x0a, |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1319 | GSM48_RR_CAUSE_CALL_CLEARED = 0x41, |
| 1320 | GSM48_RR_CAUSE_SEMANT_INCORR = 0x5f, |
| 1321 | GSM48_RR_CAUSE_INVALID_MAND_INF = 0x60, |
| 1322 | GSM48_RR_CAUSE_MSG_TYPE_N = 0x61, |
| 1323 | GSM48_RR_CAUSE_MSG_TYPE_N_COMPAT= 0x62, |
| 1324 | GSM48_RR_CAUSE_COND_IE_ERROR = 0x64, |
| 1325 | GSM48_RR_CAUSE_NO_CELL_ALLOC_A = 0x65, |
| 1326 | GSM48_RR_CAUSE_PROT_ERROR_UNSPC = 0x6f, |
| 1327 | }; |
| 1328 | |
| 1329 | /* Section 10.5.4.11 CC Cause / Table 10.5.123 */ |
| 1330 | enum gsm48_cc_cause { |
| 1331 | GSM48_CC_CAUSE_UNASSIGNED_NR = 1, |
| 1332 | GSM48_CC_CAUSE_NO_ROUTE = 3, |
| 1333 | GSM48_CC_CAUSE_CHAN_UNACCEPT = 6, |
| 1334 | GSM48_CC_CAUSE_OP_DET_BARRING = 8, |
| 1335 | GSM48_CC_CAUSE_NORM_CALL_CLEAR = 16, |
| 1336 | GSM48_CC_CAUSE_USER_BUSY = 17, |
| 1337 | GSM48_CC_CAUSE_USER_NOTRESPOND = 18, |
| 1338 | GSM48_CC_CAUSE_USER_ALERTING_NA = 19, |
| 1339 | GSM48_CC_CAUSE_CALL_REJECTED = 21, |
| 1340 | GSM48_CC_CAUSE_NUMBER_CHANGED = 22, |
| 1341 | GSM48_CC_CAUSE_PRE_EMPTION = 25, |
| 1342 | GSM48_CC_CAUSE_NONSE_USER_CLR = 26, |
| 1343 | GSM48_CC_CAUSE_DEST_OOO = 27, |
| 1344 | GSM48_CC_CAUSE_INV_NR_FORMAT = 28, |
| 1345 | GSM48_CC_CAUSE_FACILITY_REJ = 29, |
| 1346 | GSM48_CC_CAUSE_RESP_STATUS_INQ = 30, |
| 1347 | GSM48_CC_CAUSE_NORMAL_UNSPEC = 31, |
| 1348 | GSM48_CC_CAUSE_NO_CIRCUIT_CHAN = 34, |
| 1349 | GSM48_CC_CAUSE_NETWORK_OOO = 38, |
| 1350 | GSM48_CC_CAUSE_TEMP_FAILURE = 41, |
| 1351 | GSM48_CC_CAUSE_SWITCH_CONG = 42, |
| 1352 | GSM48_CC_CAUSE_ACC_INF_DISCARD = 43, |
| 1353 | GSM48_CC_CAUSE_REQ_CHAN_UNAVAIL = 44, |
| 1354 | GSM48_CC_CAUSE_RESOURCE_UNAVAIL = 47, |
| 1355 | GSM48_CC_CAUSE_QOS_UNAVAIL = 49, |
| 1356 | GSM48_CC_CAUSE_REQ_FAC_NOT_SUBSC= 50, |
| 1357 | GSM48_CC_CAUSE_INC_BARRED_CUG = 55, |
| 1358 | GSM48_CC_CAUSE_BEARER_CAP_UNAUTH= 57, |
| 1359 | GSM48_CC_CAUSE_BEARER_CA_UNAVAIL= 58, |
| 1360 | GSM48_CC_CAUSE_SERV_OPT_UNAVAIL = 63, |
| 1361 | GSM48_CC_CAUSE_BEARERSERV_UNIMPL= 65, |
| 1362 | GSM48_CC_CAUSE_ACM_GE_ACM_MAX = 68, |
| 1363 | GSM48_CC_CAUSE_REQ_FAC_NOTIMPL = 69, |
| 1364 | GSM48_CC_CAUSE_RESTR_BCAP_AVAIL = 70, |
| 1365 | GSM48_CC_CAUSE_SERV_OPT_UNIMPL = 79, |
| 1366 | GSM48_CC_CAUSE_INVAL_TRANS_ID = 81, |
| 1367 | GSM48_CC_CAUSE_USER_NOT_IN_CUG = 87, |
| 1368 | GSM48_CC_CAUSE_INCOMPAT_DEST = 88, |
| 1369 | GSM48_CC_CAUSE_INVAL_TRANS_NET = 91, |
| 1370 | GSM48_CC_CAUSE_SEMANTIC_INCORR = 95, |
| 1371 | GSM48_CC_CAUSE_INVAL_MAND_INF = 96, |
| 1372 | GSM48_CC_CAUSE_MSGTYPE_NOTEXIST = 97, |
| 1373 | GSM48_CC_CAUSE_MSGTYPE_INCOMPAT = 98, |
| 1374 | GSM48_CC_CAUSE_IE_NOTEXIST = 99, |
| 1375 | GSM48_CC_CAUSE_COND_IE_ERR = 100, |
| 1376 | GSM48_CC_CAUSE_MSG_INCOMP_STATE = 101, |
| 1377 | GSM48_CC_CAUSE_RECOVERY_TIMER = 102, |
| 1378 | GSM48_CC_CAUSE_PROTO_ERR = 111, |
| 1379 | GSM48_CC_CAUSE_INTERWORKING = 127, |
| 1380 | }; |
| 1381 | |
| 1382 | /* Annex G, GSM specific cause values for mobility management */ |
| 1383 | enum gsm48_reject_value { |
| 1384 | GSM48_REJECT_IMSI_UNKNOWN_IN_HLR = 2, |
| 1385 | GSM48_REJECT_ILLEGAL_MS = 3, |
| 1386 | GSM48_REJECT_IMSI_UNKNOWN_IN_VLR = 4, |
| 1387 | GSM48_REJECT_IMEI_NOT_ACCEPTED = 5, |
| 1388 | GSM48_REJECT_ILLEGAL_ME = 6, |
| 1389 | GSM48_REJECT_PLMN_NOT_ALLOWED = 11, |
| 1390 | GSM48_REJECT_LOC_NOT_ALLOWED = 12, |
| 1391 | GSM48_REJECT_ROAMING_NOT_ALLOWED = 13, |
| 1392 | GSM48_REJECT_NETWORK_FAILURE = 17, |
| 1393 | GSM48_REJECT_CONGESTION = 22, |
| 1394 | GSM48_REJECT_SRV_OPT_NOT_SUPPORTED = 32, |
| 1395 | GSM48_REJECT_RQD_SRV_OPT_NOT_SUPPORTED = 33, |
| 1396 | GSM48_REJECT_SRV_OPT_TMP_OUT_OF_ORDER = 34, |
| 1397 | GSM48_REJECT_CALL_CAN_NOT_BE_IDENTIFIED = 38, |
| 1398 | GSM48_REJECT_INCORRECT_MESSAGE = 95, |
| 1399 | GSM48_REJECT_INVALID_MANDANTORY_INF = 96, |
| 1400 | GSM48_REJECT_MSG_TYPE_NOT_IMPLEMENTED = 97, |
| 1401 | GSM48_REJECT_MSG_TYPE_NOT_COMPATIBLE = 98, |
| 1402 | GSM48_REJECT_INF_ELEME_NOT_IMPLEMENTED = 99, |
| 1403 | GSM48_REJECT_CONDTIONAL_IE_ERROR = 100, |
| 1404 | GSM48_REJECT_MSG_NOT_COMPATIBLE = 101, |
| 1405 | GSM48_REJECT_PROTOCOL_ERROR = 111, |
| 1406 | |
| 1407 | /* according to G.6 Additional cause codes for GMM */ |
| 1408 | GSM48_REJECT_GPRS_NOT_ALLOWED = 7, |
| 1409 | GSM48_REJECT_SERVICES_NOT_ALLOWED = 8, |
| 1410 | GSM48_REJECT_MS_IDENTITY_NOT_DERVIVABLE = 9, |
| 1411 | GSM48_REJECT_IMPLICITLY_DETACHED = 10, |
| 1412 | GSM48_REJECT_GPRS_NOT_ALLOWED_IN_PLMN = 14, |
| 1413 | GSM48_REJECT_MSC_TMP_NOT_REACHABLE = 16, |
| 1414 | }; |
| 1415 | |
| 1416 | enum chreq_type { |
| 1417 | CHREQ_T_EMERG_CALL, |
| 1418 | CHREQ_T_CALL_REEST_TCH_F, |
| 1419 | CHREQ_T_CALL_REEST_TCH_H, |
| 1420 | CHREQ_T_CALL_REEST_TCH_H_DBL, |
| 1421 | CHREQ_T_SDCCH, |
| 1422 | CHREQ_T_TCH_F, |
| 1423 | CHREQ_T_VOICE_CALL_TCH_H, |
| 1424 | CHREQ_T_DATA_CALL_TCH_H, |
| 1425 | CHREQ_T_LOCATION_UPD, |
| 1426 | CHREQ_T_PAG_R_ANY_NECI0, |
| 1427 | CHREQ_T_PAG_R_ANY_NECI1, |
| 1428 | CHREQ_T_PAG_R_TCH_F, |
| 1429 | CHREQ_T_PAG_R_TCH_FH, |
| 1430 | CHREQ_T_LMU, |
| 1431 | CHREQ_T_RESERVED_SDCCH, |
| 1432 | CHREQ_T_RESERVED_IGNORE, |
| 1433 | }; |
| 1434 | |
| 1435 | /* Chapter 11.3 */ |
| 1436 | #define GSM48_T301 180, 0 |
| 1437 | #define GSM48_T303 30, 0 |
| 1438 | #define GSM48_T305 30, 0 |
| 1439 | #define GSM48_T306 30, 0 |
| 1440 | #define GSM48_T308 10, 0 |
| 1441 | #define GSM48_T310 180, 0 |
| 1442 | #define GSM48_T313 30, 0 |
| 1443 | #define GSM48_T323 30, 0 |
| 1444 | #define GSM48_T331 30, 0 |
| 1445 | #define GSM48_T333 30, 0 |
| 1446 | #define GSM48_T334 25, 0 /* min 15 */ |
| 1447 | #define GSM48_T338 30, 0 |
Andreas Eversberg | 014cb87 | 2010-07-12 09:11:00 +0200 | [diff] [blame] | 1448 | #define GSM48_T303_MS 30, 0 |
| 1449 | #define GSM48_T305_MS 30, 0 |
| 1450 | #define GSM48_T308_MS 30, 0 |
| 1451 | #define GSM48_T310_MS 30, 0 |
| 1452 | #define GSM48_T313_MS 30, 0 |
| 1453 | #define GSM48_T323_MS 30, 0 |
| 1454 | #define GSM48_T332_MS 30, 0 |
| 1455 | #define GSM48_T335_MS 30, 0 |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1456 | |
| 1457 | /* Chapter 5.1.2.2 */ |
| 1458 | #define GSM_CSTATE_NULL 0 |
| 1459 | #define GSM_CSTATE_INITIATED 1 |
Andreas Eversberg | 1ef041f | 2010-04-09 07:52:12 +0200 | [diff] [blame] | 1460 | #define GSM_CSTATE_MM_CONNECTION_PEND 2 /* see 10.5.4.6 */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1461 | #define GSM_CSTATE_MO_CALL_PROC 3 |
| 1462 | #define GSM_CSTATE_CALL_DELIVERED 4 |
| 1463 | #define GSM_CSTATE_CALL_PRESENT 6 |
| 1464 | #define GSM_CSTATE_CALL_RECEIVED 7 |
| 1465 | #define GSM_CSTATE_CONNECT_REQUEST 8 |
| 1466 | #define GSM_CSTATE_MO_TERM_CALL_CONF 9 |
| 1467 | #define GSM_CSTATE_ACTIVE 10 |
| 1468 | #define GSM_CSTATE_DISCONNECT_REQ 12 |
| 1469 | #define GSM_CSTATE_DISCONNECT_IND 12 |
| 1470 | #define GSM_CSTATE_RELEASE_REQ 19 |
| 1471 | #define GSM_CSTATE_MO_ORIG_MODIFY 26 |
| 1472 | #define GSM_CSTATE_MO_TERM_MODIFY 27 |
| 1473 | #define GSM_CSTATE_CONNECT_IND 28 |
| 1474 | |
| 1475 | #define SBIT(a) (1 << a) |
| 1476 | #define ALL_STATES 0xffffffff |
| 1477 | |
| 1478 | /* Table 10.5.3/3GPP TS 04.08: Location Area Identification information element */ |
| 1479 | #define GSM_LAC_RESERVED_DETACHED 0x0 |
| 1480 | #define GSM_LAC_RESERVED_ALL_BTS 0xfffe |
| 1481 | |
| 1482 | /* GSM 04.08 Bearer Capability: Information Transfer Capability */ |
| 1483 | enum gsm48_bcap_itcap { |
| 1484 | GSM48_BCAP_ITCAP_SPEECH = 0, |
| 1485 | GSM48_BCAP_ITCAP_UNR_DIG_INF = 1, |
| 1486 | GSM48_BCAP_ITCAP_3k1_AUDIO = 2, |
| 1487 | GSM48_BCAP_ITCAP_FAX_G3 = 3, |
| 1488 | GSM48_BCAP_ITCAP_OTHER = 5, |
| 1489 | GSM48_BCAP_ITCAP_RESERVED = 7, |
| 1490 | }; |
| 1491 | |
| 1492 | /* GSM 04.08 Bearer Capability: Transfer Mode */ |
| 1493 | enum gsm48_bcap_tmod { |
| 1494 | GSM48_BCAP_TMOD_CIRCUIT = 0, |
| 1495 | GSM48_BCAP_TMOD_PACKET = 1, |
| 1496 | }; |
| 1497 | |
| 1498 | /* GSM 04.08 Bearer Capability: Coding Standard */ |
| 1499 | enum gsm48_bcap_coding { |
| 1500 | GSM48_BCAP_CODING_GSM_STD = 0, |
| 1501 | }; |
| 1502 | |
| 1503 | /* GSM 04.08 Bearer Capability: Radio Channel Requirements */ |
| 1504 | enum gsm48_bcap_rrq { |
| 1505 | GSM48_BCAP_RRQ_FR_ONLY = 1, |
| 1506 | GSM48_BCAP_RRQ_DUAL_HR = 2, |
| 1507 | GSM48_BCAP_RRQ_DUAL_FR = 3, |
| 1508 | }; |
| 1509 | |
Harald Welte | c8a0b93 | 2012-08-24 21:27:26 +0200 | [diff] [blame] | 1510 | /* GSM 04.08 Bearer Capability: Rate Adaption */ |
| 1511 | enum gsm48_bcap_ra { |
| 1512 | GSM48_BCAP_RA_NONE = 0, |
| 1513 | GSM48_BCAP_RA_V110_X30 = 1, |
| 1514 | GSM48_BCAP_RA_X31 = 2, |
| 1515 | GSM48_BCAP_RA_OTHER = 3, |
| 1516 | }; |
| 1517 | |
| 1518 | /* GSM 04.08 Bearer Capability: Signalling access protocol */ |
| 1519 | enum gsm48_bcap_sig_access { |
| 1520 | GSM48_BCAP_SA_I440_I450 = 1, |
| 1521 | GSM48_BCAP_SA_X21 = 2, |
| 1522 | GSM48_BCAP_SA_X28_DP_IN = 3, |
| 1523 | GSM48_BCAP_SA_X28_DP_UN = 4, |
| 1524 | GSM48_BCAP_SA_X28_NDP = 5, |
| 1525 | GSM48_BCAP_SA_X32 = 6, |
| 1526 | }; |
| 1527 | |
| 1528 | /* GSM 04.08 Bearer Capability: User Rate */ |
| 1529 | enum gsm48_bcap_user_rate { |
| 1530 | GSM48_BCAP_UR_300 = 1, |
| 1531 | GSM48_BCAP_UR_1200 = 2, |
| 1532 | GSM48_BCAP_UR_2400 = 3, |
| 1533 | GSM48_BCAP_UR_4800 = 4, |
| 1534 | GSM48_BCAP_UR_9600 = 5, |
| 1535 | GSM48_BCAP_UR_12000 = 6, |
| 1536 | GSM48_BCAP_UR_1200_75 = 7, |
| 1537 | }; |
| 1538 | |
| 1539 | /* GSM 04.08 Bearer Capability: Parity */ |
| 1540 | enum gsm48_bcap_parity { |
| 1541 | GSM48_BCAP_PAR_ODD = 0, |
| 1542 | GSM48_BCAP_PAR_EVEN = 2, |
| 1543 | GSM48_BCAP_PAR_NONE = 3, |
| 1544 | GSM48_BCAP_PAR_ZERO = 4, |
| 1545 | GSM48_BCAP_PAR_ONE = 5, |
| 1546 | }; |
| 1547 | |
| 1548 | /* GSM 04.08 Bearer Capability: Intermediate Rate */ |
| 1549 | enum gsm48_bcap_interm_rate { |
| 1550 | GSM48_BCAP_IR_8k = 2, |
| 1551 | GSM48_BCAP_IR_16k = 3, |
| 1552 | }; |
| 1553 | |
| 1554 | /* GSM 04.08 Bearer Capability: Transparency */ |
| 1555 | enum gsm48_bcap_transp { |
| 1556 | GSM48_BCAP_TR_TRANSP = 0, |
| 1557 | GSM48_BCAP_TR_RLP = 1, |
| 1558 | GSM48_BCAP_TR_TR_PREF = 2, |
| 1559 | GSM48_BCAP_TR_RLP_PREF = 3, |
| 1560 | }; |
| 1561 | |
| 1562 | /* GSM 04.08 Bearer Capability: Modem Type */ |
| 1563 | enum gsm48_bcap_modem_type { |
| 1564 | GSM48_BCAP_MT_NONE = 0, |
| 1565 | GSM48_BCAP_MT_V21 = 1, |
| 1566 | GSM48_BCAP_MT_V22 = 2, |
| 1567 | GSM48_BCAP_MT_V22bis = 3, |
| 1568 | GSM48_BCAP_MT_V23 = 4, |
| 1569 | GSM48_BCAP_MT_V26ter = 5, |
| 1570 | GSM48_BCAP_MT_V32 = 6, |
| 1571 | GSM48_BCAP_MT_UNDEF = 7, |
| 1572 | GSM48_BCAP_MT_AUTO_1 = 8, |
| 1573 | }; |
| 1574 | |
Harald Welte | 30a8ec4 | 2012-08-24 23:00:05 +0200 | [diff] [blame] | 1575 | /* GSM 04.08 Bearer Capability: Speech Version Indication */ |
| 1576 | enum gsm48_bcap_speech_ver { |
| 1577 | GSM48_BCAP_SV_FR = 0, |
| 1578 | GSM48_BCAP_SV_HR = 1, |
| 1579 | GSM48_BCAP_SV_EFR = 2, |
| 1580 | GSM48_BCAP_SV_AMR_F = 4, |
| 1581 | GSM48_BCAP_SV_AMR_H = 5, |
| 1582 | }; |
| 1583 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1584 | #define GSM48_TMSI_LEN 5 |
| 1585 | #define GSM48_MID_TMSI_LEN (GSM48_TMSI_LEN + 2) |
| 1586 | #define GSM48_MI_SIZE 32 |
| 1587 | |
Harald Welte | a1c4f76 | 2010-05-01 11:59:42 +0200 | [diff] [blame] | 1588 | /* Chapter 10.4.4.15 */ |
| 1589 | struct gsm48_ra_id { |
| 1590 | uint8_t digits[3]; /* MCC + MNC BCD digits */ |
| 1591 | uint16_t lac; /* Location Area Code */ |
| 1592 | uint8_t rac; /* Routing Area Code */ |
| 1593 | } __attribute__ ((packed)); |
| 1594 | |
Harald Welte | b550313 | 2011-05-24 15:01:53 +0200 | [diff] [blame] | 1595 | #define GSM48_CELL_CHAN_DESC_SIZE 16 |
Harald Welte | a1c4f76 | 2010-05-01 11:59:42 +0200 | [diff] [blame] | 1596 | |
Harald Welte | b550313 | 2011-05-24 15:01:53 +0200 | [diff] [blame] | 1597 | #define GSM_MACBLOCK_LEN 23 |
| 1598 | #define GSM_MACBLOCK_PADDING 0x2b |