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