libosmogsm
0.11.0-dirty
Osmocom GSM library
|
00001 00004 #pragma once 00005 00006 #include <stdint.h> 00007 #include <stdbool.h> 00008 00009 #include <osmocom/core/utils.h> 00010 #include <osmocom/core/endian.h> 00011 00012 struct gsm_lchan; 00013 00014 /* Chapter 10.5.1.5 */ 00015 struct gsm48_classmark1 { 00016 uint8_t pwr_lev:3, 00017 a5_1:1, 00018 es_ind:1, 00019 rev_lev:2, 00020 spare:1; 00021 } __attribute__ ((packed)); 00022 00023 /* Chapter 10.5.1.6 */ 00024 struct gsm48_classmark2 { 00025 uint8_t pwr_lev:3, 00026 a5_1:1, 00027 es_ind:1, 00028 rev_lev:2, 00029 spare:1; 00030 uint8_t fc:1, 00031 vgcs:1, 00032 vbs:1, 00033 sm_cap:1, 00034 ss_scr:2, 00035 ps_cap:1, 00036 spare2:1; 00037 uint8_t a5_2:1, 00038 a5_3:1, 00039 cmsp:1, 00040 solsa:1, 00041 spare3:1, 00042 lcsva_cap:1, 00043 spare4:1, 00044 cm3:1; 00045 } __attribute__ ((packed)); 00046 00047 /* Chapter 10.5.2.1b.3 */ 00048 #if OSMO_IS_LITTLE_ENDIAN == 1 00049 struct gsm48_range_1024 { 00050 uint8_t w1_hi:2, 00051 f0:1, 00052 form_id:5; 00053 uint8_t w1_lo; 00054 uint8_t w2_hi; 00055 uint8_t w3_hi:7, 00056 w2_lo:1; 00057 uint8_t w4_hi:6, 00058 w3_lo:2; 00059 uint8_t w5_hi:6, 00060 w4_lo:2; 00061 uint8_t w6_hi:6, 00062 w5_lo:2; 00063 uint8_t w7_hi:6, 00064 w6_lo:2; 00065 uint8_t w8_hi:6, 00066 w7_lo:2; 00067 uint8_t w9:7, 00068 w8_lo:1; 00069 uint8_t w11_hi:1, 00070 w10:7; 00071 uint8_t w12_hi:2, 00072 w11_lo:6; 00073 uint8_t w13_hi:3, 00074 w12_lo:5; 00075 uint8_t w14_hi:4, 00076 w13_lo:4; 00077 uint8_t w15_hi:5, 00078 w14_lo:3; 00079 uint8_t w16:6, 00080 w15_lo:2; 00081 } __attribute__ ((packed)); 00082 #else 00083 struct gsm48_range_1024 { 00084 uint8_t form_id:5, 00085 f0:1, 00086 w1_hi:2; 00087 uint8_t w1_lo; 00088 uint8_t w2_hi; 00089 uint8_t w2_lo:1, 00090 w3_hi:7; 00091 uint8_t w3_lo:2, 00092 w4_hi:6; 00093 uint8_t w4_lo:2, 00094 w5_hi:6; 00095 uint8_t w5_lo:2, 00096 w6_hi:6; 00097 uint8_t w6_lo:2, 00098 w7_hi:6; 00099 uint8_t w7_lo:2, 00100 w8_hi:6; 00101 uint8_t w8_lo:1, 00102 w9:7; 00103 uint8_t w10:7, 00104 w11_hi:1; 00105 uint8_t w11_lo:6, 00106 w12_hi:2; 00107 uint8_t w12_lo:5, 00108 w13_hi:3; 00109 uint8_t w13_lo:4, 00110 w14_hi:4; 00111 uint8_t w14_lo:3, 00112 w15_hi:5; 00113 uint8_t w15_lo:2, 00114 w16:6; 00115 } __attribute__ ((packed)); 00116 #endif 00117 00118 /* Chapter 10.5.2.1b.4 */ 00119 #if OSMO_IS_LITTLE_ENDIAN == 1 00120 struct gsm48_range_512 { 00121 uint8_t orig_arfcn_hi:1, 00122 form_id:7; 00123 uint8_t orig_arfcn_mid; 00124 uint8_t w1_hi:7, 00125 orig_arfcn_lo:1; 00126 uint8_t w2_hi:6, 00127 w1_lo:2; 00128 uint8_t w3_hi:6, 00129 w2_lo:2; 00130 uint8_t w4_hi:6, 00131 w3_lo:2; 00132 uint8_t w5:7, 00133 w4_lo:1; 00134 uint8_t w7_hi:1, 00135 w6:7; 00136 uint8_t w8_hi:2, 00137 w7_lo:6; 00138 uint8_t w9_hi:4, 00139 w8_lo:4; 00140 uint8_t w10:6, 00141 w9_lo:2; 00142 uint8_t w12_hi:2, 00143 w11:6; 00144 uint8_t w13_hi:4, 00145 w12_lo:4; 00146 uint8_t w14:6, 00147 w13_lo:2; 00148 uint8_t w16_hi:2, 00149 w15:6; 00150 uint8_t w17:5, 00151 w16_lo:3; 00152 } __attribute__ ((packed)); 00153 #else 00154 struct gsm48_range_512 { 00155 uint8_t form_id:7, 00156 orig_arfcn_hi:1; 00157 uint8_t orig_arfcn_mid; 00158 uint8_t orig_arfcn_lo:1, 00159 w1_hi:7; 00160 uint8_t w1_lo:2, 00161 w2_hi:6; 00162 uint8_t w2_lo:2, 00163 w3_hi:6; 00164 uint8_t w3_lo:2, 00165 w4_hi:6; 00166 uint8_t w4_lo:1, 00167 w5:7; 00168 uint8_t w6:7, 00169 w7_hi:1; 00170 uint8_t w7_lo:6, 00171 w8_hi:2; 00172 uint8_t w8_lo:4, 00173 w9_hi:4; 00174 uint8_t w9_lo:2, 00175 w10:6; 00176 uint8_t w11:6, 00177 w12_hi:2; 00178 uint8_t w12_lo:4, 00179 w13_hi:4; 00180 uint8_t w13_lo:2, 00181 w14:6; 00182 uint8_t w15:6, 00183 w16_hi:2; 00184 uint8_t w16_lo:3, 00185 w17:5; 00186 } __attribute__ ((packed)); 00187 #endif 00188 00189 /* Chapter 10.5.2.1b.5 */ 00190 #if OSMO_IS_LITTLE_ENDIAN == 1 00191 struct gsm48_range_256 { 00192 uint8_t orig_arfcn_hi:1, 00193 form_id:7; 00194 uint8_t orig_arfcn_mid; 00195 uint8_t w1_hi:7, 00196 orig_arfcn_lo:1; 00197 uint8_t w2:7, 00198 w1_lo:1; 00199 uint8_t w4_hi:1, 00200 w3:7; 00201 uint8_t w5_hi:3, 00202 w4_lo:5; 00203 uint8_t w6_hi:5, 00204 w5_lo:3; 00205 uint8_t w8_hi:1, 00206 w7:6, 00207 w6_lo:1; 00208 uint8_t w9_hi:4, 00209 w8_lo:4; 00210 uint8_t w11_hi:2, 00211 w10:5, 00212 w9_lo:1; 00213 uint8_t w12:5, 00214 w11_lo:3; 00215 uint8_t w14_hi:3, 00216 w13:5; 00217 uint8_t w16_hi:1, 00218 w15:5, 00219 w14_lo:2; 00220 uint8_t w18_hi:1, 00221 w17:4, 00222 w16_lo:3; 00223 uint8_t w20_hi:1, 00224 w19:4, 00225 w18_lo:3; 00226 uint8_t spare:1, 00227 w21:4, 00228 w20_lo:3; 00229 } __attribute__ ((packed)); 00230 #else 00231 struct gsm48_range_256 { 00232 uint8_t form_id:7, 00233 orig_arfcn_hi:1; 00234 uint8_t orig_arfcn_mid; 00235 uint8_t orig_arfcn_lo:1, 00236 w1_hi:7; 00237 uint8_t w1_lo:1, 00238 w2:7; 00239 uint8_t w3:7, 00240 w4_hi:1; 00241 uint8_t w4_lo:5, 00242 w5_hi:3; 00243 uint8_t w5_lo:3, 00244 w6_hi:5; 00245 uint8_t w6_lo:1, 00246 w7:6, 00247 w8_hi:1; 00248 uint8_t w8_lo:4, 00249 w9_hi:4; 00250 uint8_t w9_lo:1, 00251 w10:5, 00252 w11_hi:2; 00253 uint8_t w11_lo:3, 00254 w12:5; 00255 uint8_t w13:5, 00256 w14_hi:3; 00257 uint8_t w14_lo:2, 00258 w15:5, 00259 w16_hi:1; 00260 uint8_t w16_lo:3, 00261 w17:4, 00262 w18_hi:1; 00263 uint8_t w18_lo:3, 00264 w19:4, 00265 w20_hi:1; 00266 uint8_t w20_lo:3, 00267 w21:4, 00268 spare:1; 00269 } __attribute__ ((packed)); 00270 #endif 00271 00272 /* Chapter 10.5.2.1b.6 */ 00273 #if OSMO_IS_LITTLE_ENDIAN == 1 00274 struct gsm48_range_128 { 00275 uint8_t orig_arfcn_hi:1, 00276 form_id:7; 00277 uint8_t orig_arfcn_mid; 00278 uint8_t w1:7, 00279 orig_arfcn_lo:1; 00280 uint8_t w3_hi:2, 00281 w2:6; 00282 uint8_t w4_hi:4, 00283 w3_lo:4; 00284 uint8_t w6_hi:2, 00285 w5:5, 00286 w4_lo:1; 00287 uint8_t w7:5, 00288 w6_lo:3; 00289 uint8_t w9:4, 00290 w8:4; 00291 uint8_t w11:4, 00292 w10:4; 00293 uint8_t w13:4, 00294 w12:4; 00295 uint8_t w15:4, 00296 w14:4; 00297 uint8_t w18_hi:2, 00298 w17:3, 00299 w16:3; 00300 uint8_t w21_hi:1, 00301 w20:3, 00302 w19:3, 00303 w18_lo:1; 00304 uint8_t w23:3, 00305 w22:3, 00306 w21_lo:2; 00307 uint8_t w26_hi:2, 00308 w25:3, 00309 w24:3; 00310 uint8_t spare:1, 00311 w28:3, 00312 w27:3, 00313 w26_lo:1; 00314 } __attribute__ ((packed)); 00315 #else 00316 struct gsm48_range_128 { 00317 uint8_t form_id:7, 00318 orig_arfcn_hi:1; 00319 uint8_t orig_arfcn_mid; 00320 uint8_t orig_arfcn_lo:1, 00321 w1:7; 00322 uint8_t w2:6, 00323 w3_hi:2; 00324 uint8_t w3_lo:4, 00325 w4_hi:4; 00326 uint8_t w4_lo:1, 00327 w5:5, 00328 w6_hi:2; 00329 uint8_t w6_lo:3, 00330 w7:5; 00331 uint8_t w8:4, 00332 w9:4; 00333 uint8_t w10:4, 00334 w11:4; 00335 uint8_t w12:4, 00336 w13:4; 00337 uint8_t w14:4, 00338 w15:4; 00339 uint8_t w16:3, 00340 w17:3, 00341 w18_hi:2; 00342 uint8_t w18_lo:1, 00343 w19:3, 00344 w20:3, 00345 w21_hi:1; 00346 uint8_t w21_lo:2, 00347 w22:3, 00348 w23:3; 00349 uint8_t w24:3, 00350 w25:3, 00351 w26_hi:2; 00352 uint8_t w26_lo:1, 00353 w27:3, 00354 w28:3, 00355 spare:1; 00356 } __attribute__ ((packed)); 00357 #endif 00358 00359 /* Chapter 10.5.2.1b.7 */ 00360 struct gsm48_var_bit { 00361 uint8_t orig_arfcn_hi:1, 00362 form_id:7; 00363 uint8_t orig_arfcn_mid; 00364 uint8_t rrfcn1_7:7, 00365 orig_arfcn_lo:1; 00366 uint8_t rrfcn8_111[13]; 00367 } __attribute__ ((packed)); 00368 00369 /* Chapter 10.5.2.5 */ 00370 struct gsm48_chan_desc { 00371 uint8_t chan_nr; 00372 union { 00373 struct { 00374 uint8_t maio_high:4, 00375 h:1, 00376 tsc:3; 00377 uint8_t hsn:6, 00378 maio_low:2; 00379 } __attribute__ ((packed)) h1; 00380 struct { 00381 uint8_t arfcn_high:2, 00382 spare:2, 00383 h:1, 00384 tsc:3; 00385 uint8_t arfcn_low; 00386 } __attribute__ ((packed)) h0; 00387 } __attribute__ ((packed)); 00388 } __attribute__ ((packed)); 00389 00390 /* Chapter 10.5.2.20 */ 00391 struct gsm48_meas_res { 00392 uint8_t rxlev_full:6, 00393 dtx_used:1, 00394 ba_used:1; 00395 uint8_t rxlev_sub:6, 00396 meas_valid:1, 00397 spare:1; 00398 uint8_t no_nc_n_hi:1, 00399 rxqual_sub:3, 00400 rxqual_full:3, 00401 spare2:1; 00402 uint8_t rxlev_nc1:6, 00403 no_nc_n_lo:2; 00404 uint8_t bsic_nc1_hi:3, 00405 bcch_f_nc1:5; 00406 uint8_t rxlev_nc2_hi:5, 00407 bsic_nc1_lo:3; 00408 uint8_t bsic_nc2_hi:2, 00409 bcch_f_nc2:5, 00410 rxlev_nc2_lo:1; 00411 uint8_t rxlev_nc3_hi:4, 00412 bsic_nc2_lo:4; 00413 uint8_t bsic_nc3_hi:1, 00414 bcch_f_nc3:5, 00415 rxlev_nc3_lo:2; 00416 uint8_t rxlev_nc4_hi:3, 00417 bsic_nc3_lo:5; 00418 uint8_t bcch_f_nc4:5, 00419 rxlev_nc4_lo:3; 00420 uint8_t rxlev_nc5_hi:2, 00421 bsic_nc4:6; 00422 uint8_t bcch_f_nc5_hi:4, 00423 rxlev_nc5_lo:4; 00424 uint8_t rxlev_nc6_hi:1, 00425 bsic_nc5:6, 00426 bcch_f_nc5_lo:1; 00427 uint8_t bcch_f_nc6_hi:3, 00428 rxlev_nc6_lo:5; 00429 uint8_t bsic_nc6:6, 00430 bcch_f_nc6_lo:2; 00431 } __attribute__ ((packed)); 00432 00433 /* Chapter 10.5.2.21aa */ 00434 struct gsm48_multi_rate_conf { 00435 uint8_t smod : 2, 00436 spare: 1, 00437 icmi : 1, 00438 nscb : 1, 00439 ver : 3; 00440 uint8_t m4_75 : 1, 00441 m5_15 : 1, 00442 m5_90 : 1, 00443 m6_70 : 1, 00444 m7_40 : 1, 00445 m7_95 : 1, 00446 m10_2 : 1, 00447 m12_2 : 1; 00448 } __attribute__((packed)); 00449 00450 /* Chapter 10.5.2.28(a) */ 00451 struct gsm48_power_cmd { 00452 uint8_t power_level:5, 00453 spare:2, 00454 atc:1; 00455 } __attribute__((packed)); 00456 00457 /* Chapter 10.5.2.29 */ 00458 struct gsm48_rach_control { 00459 uint8_t re :1, 00460 cell_bar :1, 00461 tx_integer :4, 00462 max_trans :2; 00463 uint8_t t2; /* ACC 8-15 barred flags */ 00464 uint8_t t3; /* ACC 0-7 barred flags */ 00465 } __attribute__ ((packed)); 00466 00467 /* 00468 * Mark an Access Control Class as barred. 00469 * \param[in] rach_control A Rach Control Information Element. 00470 * \param[in] acc Access Control Class number (0 - 15) which shall be barred. 00471 */ 00472 static inline void gsm48_barr_acc(struct gsm48_rach_control *rach_control, unsigned int acc) 00473 { 00474 OSMO_ASSERT(acc >= 0 && acc <= 15); 00475 if (acc >= 8) 00476 rach_control->t2 |= (1 << (acc - 8)); 00477 else 00478 rach_control->t3 |= (1 << (acc)); 00479 } 00480 00481 /* 00482 * Mark an Access Control Class as allowed. 00483 * \param[in] rach_control A Rach Control Information Element. 00484 * \param[in] acc Access Control Class number (0 - 15) which shall be allowed. 00485 */ 00486 static inline void gsm48_allow_acc(struct gsm48_rach_control *rach_control, unsigned int acc) 00487 { 00488 OSMO_ASSERT(acc >= 0 && acc <= 15); 00489 if (acc >= 8) 00490 rach_control->t2 &= ~(1 << (acc - 8)); 00491 else 00492 rach_control->t3 &= ~(1 << (acc)); 00493 } 00494 00495 /* 00496 * Indicate whether an Access Control Class is barred. 00497 * \param[in] rach_control A Rach Control Information Element. 00498 * \param[in] acc Access Control Class number (0 - 15). 00499 * \returns true if the Access Control class is barred, false otherwise 00500 */ 00501 static inline bool gsm48_acc_is_barred(struct gsm48_rach_control *rach_control, unsigned int acc) 00502 { 00503 OSMO_ASSERT(acc >= 0 && acc <= 15); 00504 if (acc >= 8) 00505 return (rach_control->t2 & (1 << (acc - 8))) != 0; 00506 return (rach_control->t3 & (1 << (acc))) != 0; 00507 } 00508 00509 /* Chapter 10.5.2.30 */ 00510 struct gsm48_req_ref { 00511 uint8_t ra; 00512 uint8_t t3_high:3, 00513 t1:5; 00514 uint8_t t2:5, 00515 t3_low:3; 00516 } __attribute__ ((packed)); 00517 00518 /* Chapter 10.5.2.38 */ 00519 struct gsm48_start_time { 00520 uint8_t t3_high:3, 00521 t1:5; 00522 uint8_t t2:5, 00523 t3_low:3; 00524 } __attribute__ ((packed)); 00525 00526 /* Chapter 10.5.2.39 */ 00527 struct gsm48_sync_ind { 00528 uint8_t si:2, 00529 rot:1, 00530 nci:1, 00531 sync_ie:4; 00532 } __attribute__((packed)); 00533 00534 /* 00535 * Chapter 9.1.5/9.1.6 00536 * 00537 * For 9.1.6 the chan_desc has the meaning of 10.5.2.5a 00538 */ 00539 struct gsm48_chan_mode_modify { 00540 struct gsm48_chan_desc chan_desc; 00541 uint8_t mode; 00542 } __attribute__ ((packed)); 00543 00544 enum gsm48_chan_mode { 00545 GSM48_CMODE_SIGN = 0x00, 00546 GSM48_CMODE_SPEECH_V1 = 0x01, 00547 GSM48_CMODE_SPEECH_EFR = 0x21, 00548 GSM48_CMODE_SPEECH_AMR = 0x41, 00549 GSM48_CMODE_DATA_14k5 = 0x0f, 00550 GSM48_CMODE_DATA_12k0 = 0x03, 00551 GSM48_CMODE_DATA_6k0 = 0x0b, 00552 GSM48_CMODE_DATA_3k6 = 0x13, 00553 }; 00554 00555 extern const struct value_string gsm48_chan_mode_names[]; 00556 00557 /* Chapter 9.1.2 */ 00558 struct gsm48_ass_cmd { 00559 /* Semantic is from 10.5.2.5a */ 00560 struct gsm48_chan_desc chan_desc; 00561 uint8_t power_command; 00562 uint8_t data[0]; 00563 } __attribute__((packed)); 00564 00565 /* Chapter 9.1.13 */ 00566 struct gsm48_frq_redef { 00567 /* Semantic is from 10.5.2.5a */ 00568 struct gsm48_chan_desc chan_desc; 00569 uint8_t mob_alloc_len; 00570 uint8_t mob_alloc[0]; 00571 } __attribute__((packed)); 00572 00573 /* Chapter 9.1.13b GPRS suspension request */ 00574 struct gsm48_gprs_susp_req { 00575 uint32_t tlli; 00576 uint8_t ra_id[6]; 00577 uint8_t cause; 00578 uint8_t options[0]; 00579 } __attribute__ ((packed)); 00580 00581 /* Chapter 10.5.2.2 */ 00582 struct gsm48_cell_desc { 00583 uint8_t bcc:3, 00584 ncc:3, 00585 arfcn_hi:2; 00586 uint8_t arfcn_lo; 00587 } __attribute__((packed)); 00588 00589 /* Chapter 9.1.15 */ 00590 struct gsm48_ho_cmd { 00591 struct gsm48_cell_desc cell_desc; 00592 struct gsm48_chan_desc chan_desc; 00593 uint8_t ho_ref; 00594 uint8_t power_command; 00595 uint8_t data[0]; 00596 } __attribute__((packed)); 00597 00598 /* Chapter 9.1.18 */ 00599 struct gsm48_imm_ass { 00600 uint8_t l2_plen; 00601 uint8_t proto_discr; 00602 uint8_t msg_type; 00603 uint8_t page_mode; 00604 struct gsm48_chan_desc chan_desc; 00605 struct gsm48_req_ref req_ref; 00606 uint8_t timing_advance; 00607 uint8_t mob_alloc_len; 00608 uint8_t mob_alloc[0]; 00609 } __attribute__ ((packed)); 00610 00611 /* Chapter 9.1.25 */ 00612 struct gsm48_pag_resp { 00613 uint8_t spare:4, 00614 key_seq:4; 00615 uint32_t classmark2; 00616 uint8_t mi_len; 00617 uint8_t mi[0]; 00618 } __attribute__ ((packed)); 00619 00620 /* Chapter 10.5.1.3 */ 00621 struct gsm48_loc_area_id { 00622 uint8_t digits[3]; /* BCD! */ 00623 uint16_t lac; 00624 } __attribute__ ((packed)); 00625 00626 /* Section 9.2.2 */ 00627 struct gsm48_auth_req { 00628 uint8_t key_seq:4, 00629 spare:4; 00630 uint8_t rand[16]; 00631 } __attribute__ ((packed)); 00632 00633 /* Section 9.2.3 */ 00634 struct gsm48_auth_resp { 00635 uint8_t sres[4]; 00636 } __attribute__ ((packed)); 00637 00638 /* Section 9.2.15 */ 00639 struct gsm48_loc_upd_req { 00640 uint8_t type:4, 00641 key_seq:4; 00642 struct gsm48_loc_area_id lai; 00643 struct gsm48_classmark1 classmark1; 00644 uint8_t mi_len; 00645 uint8_t mi[0]; 00646 } __attribute__ ((packed)); 00647 00648 /* Section 10.1 */ 00649 struct gsm48_hdr { 00650 uint8_t proto_discr; 00651 uint8_t msg_type; 00652 uint8_t data[0]; 00653 } __attribute__ ((packed)); 00654 00655 /* Section 9.1.3x System information Type header */ 00656 struct gsm48_system_information_type_header { 00657 uint8_t l2_plen; 00658 uint8_t rr_protocol_discriminator :4, 00659 skip_indicator:4; 00660 uint8_t system_information; 00661 } __attribute__ ((packed)); 00662 00663 /* Section 10.5.2.4 Cell Selection Parameters */ 00664 struct gsm48_cell_sel_par { 00665 uint8_t ms_txpwr_max_ccch:5, /* GSM 05.08 MS-TXPWR-MAX-CCCH */ 00666 cell_resel_hyst:3; /* GSM 05.08 CELL-RESELECT-HYSTERESIS */ 00667 uint8_t rxlev_acc_min:6, /* GSM 05.08 RXLEV-ACCESS-MIN */ 00668 neci:1, 00669 acs:1; 00670 } __attribute__ ((packed)); 00671 00672 /* 3GPP TS 44.018 Section 10.5.2.11 Control Channel Description */ 00673 struct gsm48_control_channel_descr { 00674 uint8_t ccch_conf :3, 00675 bs_ag_blks_res :3, 00676 att :1, 00677 mscr :1; 00678 uint8_t bs_pa_mfrms : 3, 00679 spare_1 :2, 00680 cbq3 :2, 00681 spare_2 :1; 00682 uint8_t t3212; 00683 } __attribute__ ((packed)); 00684 00685 enum gsm48_dtx_mode { 00686 GSM48_DTX_MAY_BE_USED, 00687 GSM48_DTX_SHALL_BE_USED, 00688 GSM48_DTX_SHALL_NOT_BE_USED 00689 }; 00690 00691 /* Cell Options for SI6, SACCH (10.5.2.3a.2) or SI3, BCCH (Table 10.5.2.3.1), 00692 3GPP TS 44.018 */ 00693 struct gsm48_cell_options { 00694 uint8_t radio_link_timeout:4, 00695 dtx:2, 00696 pwrc:1, 00697 /* either DN-IND or top bit of DTX IND */ 00698 d:1; 00699 } __attribute__ ((packed)); 00700 00701 /* Section 9.2.9 CM service request */ 00702 struct gsm48_service_request { 00703 uint8_t cm_service_type : 4, 00704 cipher_key_seq : 4; 00705 /* length + 3 bytes */ 00706 uint32_t classmark; 00707 uint8_t mi_len; 00708 uint8_t mi[0]; 00709 /* optional priority level */ 00710 } __attribute__ ((packed)); 00711 00712 /* Section 9.1.31 System information Type 1 */ 00713 struct gsm48_system_information_type_1 { 00714 struct gsm48_system_information_type_header header; 00715 uint8_t cell_channel_description[16]; 00716 struct gsm48_rach_control rach_control; 00717 uint8_t rest_octets[0]; /* NCH position on the CCCH */ 00718 } __attribute__ ((packed)); 00719 00720 /* Section 9.1.32 System information Type 2 */ 00721 struct gsm48_system_information_type_2 { 00722 struct gsm48_system_information_type_header header; 00723 uint8_t bcch_frequency_list[16]; 00724 uint8_t ncc_permitted; 00725 struct gsm48_rach_control rach_control; 00726 } __attribute__ ((packed)); 00727 00728 /* Section 9.1.33 System information Type 2bis */ 00729 struct gsm48_system_information_type_2bis { 00730 struct gsm48_system_information_type_header header; 00731 uint8_t bcch_frequency_list[16]; 00732 struct gsm48_rach_control rach_control; 00733 uint8_t rest_octets[0]; 00734 } __attribute__ ((packed)); 00735 00736 /* Section 9.1.34 System information Type 2ter */ 00737 struct gsm48_system_information_type_2ter { 00738 struct gsm48_system_information_type_header header; 00739 uint8_t ext_bcch_frequency_list[16]; 00740 uint8_t rest_octets[0]; 00741 } __attribute__ ((packed)); 00742 00743 /* Section 9.1.34a System information Type 2quater */ 00744 struct gsm48_system_information_type_2quater { 00745 struct gsm48_system_information_type_header header; 00746 uint8_t rest_octets[0]; 00747 } __attribute__ ((packed)); 00748 00749 /* Section 9.1.35 System information Type 3 */ 00750 struct gsm48_system_information_type_3 { 00751 struct gsm48_system_information_type_header header; 00752 uint16_t cell_identity; 00753 struct gsm48_loc_area_id lai; 00754 struct gsm48_control_channel_descr control_channel_desc; 00755 struct gsm48_cell_options cell_options; 00756 struct gsm48_cell_sel_par cell_sel_par; 00757 struct gsm48_rach_control rach_control; 00758 uint8_t rest_octets[0]; 00759 } __attribute__ ((packed)); 00760 00761 /* Section 9.1.36 System information Type 4 */ 00762 struct gsm48_system_information_type_4 { 00763 struct gsm48_system_information_type_header header; 00764 struct gsm48_loc_area_id lai; 00765 struct gsm48_cell_sel_par cell_sel_par; 00766 struct gsm48_rach_control rach_control; 00767 /* optional CBCH conditional CBCH... followed by 00768 mandantory SI 4 Reset Octets 00769 */ 00770 uint8_t data[0]; 00771 } __attribute__ ((packed)); 00772 00773 /* Section 9.1.37 System information Type 5 */ 00774 struct gsm48_system_information_type_5 { 00775 uint8_t rr_protocol_discriminator :4, 00776 skip_indicator:4; 00777 uint8_t system_information; 00778 uint8_t bcch_frequency_list[16]; 00779 } __attribute__ ((packed)); 00780 00781 /* Section 9.1.38 System information Type 5bis */ 00782 struct gsm48_system_information_type_5bis { 00783 uint8_t rr_protocol_discriminator :4, 00784 skip_indicator:4; 00785 uint8_t system_information; 00786 uint8_t bcch_frequency_list[16]; 00787 } __attribute__ ((packed)); 00788 00789 /* Section 9.1.39 System information Type 5ter */ 00790 struct gsm48_system_information_type_5ter { 00791 uint8_t rr_protocol_discriminator :4, 00792 skip_indicator:4; 00793 uint8_t system_information; 00794 uint8_t bcch_frequency_list[16]; 00795 } __attribute__ ((packed)); 00796 00797 /* Section 9.1.40 System information Type 6 */ 00798 struct gsm48_system_information_type_6 { 00799 uint8_t rr_protocol_discriminator :4, 00800 skip_indicator:4; 00801 uint8_t system_information; 00802 uint16_t cell_identity; 00803 struct gsm48_loc_area_id lai; 00804 struct gsm48_cell_options cell_options; 00805 uint8_t ncc_permitted; 00806 uint8_t rest_octets[0]; 00807 } __attribute__ ((packed)); 00808 00809 /* Section 9.1.43a System Information type 13 */ 00810 struct gsm48_system_information_type_13 { 00811 struct gsm48_system_information_type_header header; 00812 uint8_t rest_octets[0]; 00813 } __attribute__ ((packed)); 00814 00815 /* Section 9.2.12 IMSI Detach Indication */ 00816 struct gsm48_imsi_detach_ind { 00817 struct gsm48_classmark1 classmark1; 00818 uint8_t mi_len; 00819 uint8_t mi[0]; 00820 } __attribute__ ((packed)); 00821 00822 /* Section 9.1.1 */ 00823 struct gsm48_add_ass { 00824 /* Semantic is from 10.5.2.5 */ 00825 struct gsm48_chan_desc chan_desc; 00826 uint8_t data[0]; 00827 } __attribute__((packed)); 00828 00829 /* Section 9.1.3 */ 00830 struct gsm48_ass_cpl { 00831 uint8_t rr_cause; 00832 } __attribute__((packed)); 00833 00834 /* Section 9.1.4 */ 00835 struct gsm48_ass_fail { 00836 uint8_t rr_cause; 00837 } __attribute__((packed)); 00838 00839 /* Section 9.1.3 */ 00840 struct gsm48_ho_cpl { 00841 uint8_t rr_cause; 00842 uint8_t data[0]; 00843 } __attribute__((packed)); 00844 00845 /* Section 9.1.4 */ 00846 struct gsm48_ho_fail { 00847 uint8_t rr_cause; 00848 } __attribute__((packed)); 00849 00850 /* Section 9.1.7 */ 00851 struct gsm48_chan_rel { 00852 uint8_t rr_cause; 00853 uint8_t data[0]; 00854 } __attribute__((packed)); 00855 00856 /* Section 9.1.9 */ 00857 struct gsm48_cip_mode_cmd { 00858 uint8_t sc:1, 00859 alg_id:3, 00860 cr:1, 00861 spare:3; 00862 } __attribute__((packed)); 00863 00864 /* Section 9.1.11 */ 00865 struct gsm48_cm_change { 00866 uint8_t cm2_len; 00867 struct gsm48_classmark2 cm2; 00868 uint8_t data[0]; 00869 } __attribute__((packed)); 00870 00871 /* Section 9.1.19 */ 00872 struct gsm48_imm_ass_ext { 00873 uint8_t l2_plen; 00874 uint8_t proto_discr; 00875 uint8_t msg_type; 00876 uint8_t page_mode; 00877 struct gsm48_chan_desc chan_desc1; 00878 struct gsm48_req_ref req_ref1; 00879 uint8_t timing_advance1; 00880 struct gsm48_chan_desc chan_desc2; 00881 struct gsm48_req_ref req_ref2; 00882 uint8_t timing_advance2; 00883 uint8_t mob_alloc_len; 00884 uint8_t mob_alloc[0]; 00885 } __attribute__ ((packed)); 00886 00887 /* Section 9.1.20 */ 00888 struct gsm48_imm_ass_rej { 00889 uint8_t l2_plen; 00890 uint8_t proto_discr; 00891 uint8_t msg_type; 00892 uint8_t page_mode; 00893 struct gsm48_req_ref req_ref1; 00894 uint8_t wait_ind1; 00895 struct gsm48_req_ref req_ref2; 00896 uint8_t wait_ind2; 00897 struct gsm48_req_ref req_ref3; 00898 uint8_t wait_ind3; 00899 struct gsm48_req_ref req_ref4; 00900 uint8_t wait_ind4; 00901 uint8_t rest[0]; 00902 } __attribute__ ((packed)); 00903 00904 /* Section 9.1.22 */ 00905 struct gsm48_paging1 { 00906 uint8_t l2_plen; 00907 uint8_t proto_discr; 00908 uint8_t msg_type; 00909 uint8_t pag_mode:2, 00910 spare:2, 00911 cneed1:2, 00912 cneed2:2; 00913 uint8_t data[0]; 00914 } __attribute__((packed)); 00915 00916 /* Section 9.1.23 */ 00917 struct gsm48_paging2 { 00918 uint8_t l2_plen; 00919 uint8_t proto_discr; 00920 uint8_t msg_type; 00921 uint8_t pag_mode:2, 00922 spare:2, 00923 cneed1:2, 00924 cneed2:2; 00925 uint32_t tmsi1; 00926 uint32_t tmsi2; 00927 uint8_t data[0]; 00928 } __attribute__((packed)); 00929 00930 /* Section 9.1.24 */ 00931 struct gsm48_paging3 { 00932 uint8_t l2_plen; 00933 uint8_t proto_discr; 00934 uint8_t msg_type; 00935 uint8_t pag_mode:2, 00936 spare:2, 00937 cneed1:2, 00938 cneed2:2; 00939 uint32_t tmsi1; 00940 uint32_t tmsi2; 00941 uint32_t tmsi3; 00942 uint32_t tmsi4; 00943 uint8_t cneed3:2, 00944 cneed4:2, 00945 spare2:4; 00946 uint8_t rest[0]; 00947 } __attribute__((packed)); 00948 00949 /* Section 9.1.25 */ 00950 struct gsm48_pag_rsp { 00951 uint8_t key_seq:3, 00952 spare:5; 00953 uint8_t cm2_len; 00954 struct gsm48_classmark2 cm2; 00955 uint8_t data[0]; 00956 } __attribute__((packed)); 00957 00958 /* Section 9.1.29 */ 00959 struct gsm48_rr_status { 00960 uint8_t rr_cause; 00961 } __attribute__((packed)); 00962 00963 /* Section 10.2 + GSM 04.07 12.2.3.1.1 + 3GPP TS 24.007 11.2.3.1.1 */ 00964 #define GSM48_PDISC_GROUP_CC 0x00 00965 #define GSM48_PDISC_BCAST_CC 0x01 00966 #define GSM48_PDISC_PDSS1 0x02 /* 04.07 only */ 00967 #define GSM48_PDISC_CC 0x03 00968 #define GSM48_PDISC_PDSS2 0x04 /* 04.07 only */ 00969 #define GSM48_PDISC_GTTP 0x04 /* 24.007 only */ 00970 #define GSM48_PDISC_MM 0x05 00971 #define GSM48_PDISC_RR 0x06 00972 #define GSM48_PDISC_MM_GPRS 0x08 00973 #define GSM48_PDISC_SMS 0x09 00974 #define GSM48_PDISC_SM_GPRS 0x0a 00975 #define GSM48_PDISC_NC_SS 0x0b 00976 #define GSM48_PDISC_LOC 0x0c 00977 #define GSM48_PDISC_EXTEND 0x0e 00978 #define GSM48_PDISC_TEST 0x0f /* as per 11.10, 04.14 */ 00979 #define GSM48_PDISC_MASK 0x0f 00980 00981 extern const struct value_string gsm48_pdisc_names[]; 00982 static inline const char *gsm48_pdisc_name(uint8_t val) 00983 { return get_value_string(gsm48_pdisc_names, val); } 00984 00985 bool gsm48_hdr_gmm_cipherable(const struct gsm48_hdr *hdr); 00986 00987 static inline uint8_t gsm48_hdr_pdisc(const struct gsm48_hdr *hdr) 00988 { 00989 /* 00990 * 3GPP TS 24.007 version 12.0.0 Release 12, 00991 * 11.2.3.1.1 Protocol discriminator 00992 */ 00993 uint8_t pdisc = hdr->proto_discr & GSM48_PDISC_MASK; 00994 if (pdisc == GSM48_PDISC_EXTEND) 00995 return hdr->proto_discr; 00996 return pdisc; 00997 } 00998 00999 static inline uint8_t gsm48_hdr_trans_id(const struct gsm48_hdr *hdr) 01000 { 01001 /* 01002 * 3GPP TS 24.007 version 12.0.0 Release 12, 01003 * 11.2.3.1.3 Transaction identifier 01004 */ 01005 return (hdr->proto_discr & 0xf0) >> 4; 01006 } 01007 01008 #define GSM48_TA_INVALID 220 01009 01015 static inline bool gsm48_ta_is_valid(uint8_t ta) 01016 { 01017 return (ta < 64); 01018 } 01019 01020 static inline uint8_t gsm48_hdr_trans_id_flip_ti(const struct gsm48_hdr *hdr) 01021 { 01022 return gsm48_hdr_trans_id(hdr) ^ 0x08; 01023 } 01024 01025 static inline uint8_t gsm48_hdr_trans_id_no_ti(const struct gsm48_hdr *hdr) 01026 { 01027 return gsm48_hdr_trans_id(hdr) & 0x07; 01028 } 01029 01030 static inline uint8_t gsm48_hdr_msg_type_r98(const struct gsm48_hdr *hdr) 01031 { 01032 /* 01033 * 3GPP TS 24.007 version 12.0.0 Release 12, 01034 * 11.2.3.2.1 Message type octet (when accessing Release 98 and older 01035 * networks only) 01036 */ 01037 switch (gsm48_hdr_pdisc(hdr)) { 01038 case GSM48_PDISC_MM: 01039 case GSM48_PDISC_CC: 01040 case GSM48_PDISC_NC_SS: 01041 case GSM48_PDISC_GROUP_CC: 01042 case GSM48_PDISC_BCAST_CC: 01043 case GSM48_PDISC_LOC: 01044 return hdr->msg_type & 0x3f; 01045 default: 01046 return hdr->msg_type; 01047 } 01048 } 01049 01050 static inline uint8_t gsm48_hdr_msg_type_r99(const struct gsm48_hdr *hdr) 01051 { 01052 /* 01053 * 3GPP TS 24.007 version 12.0.0 Release 12, 01054 * 11.2.3.2.2 Message type octet (when accessing Release 99 and newer 01055 * networks) 01056 */ 01057 switch (gsm48_hdr_pdisc(hdr)) { 01058 case GSM48_PDISC_MM: 01059 case GSM48_PDISC_CC: 01060 case GSM48_PDISC_NC_SS: 01061 return hdr->msg_type & 0x3f; 01062 case GSM48_PDISC_GROUP_CC: 01063 case GSM48_PDISC_BCAST_CC: 01064 case GSM48_PDISC_LOC: 01065 return hdr->msg_type & 0x3f; 01066 default: 01067 return hdr->msg_type; 01068 } 01069 } 01070 01071 void gsm48_set_dtx(struct gsm48_cell_options *op, enum gsm48_dtx_mode full, 01072 enum gsm48_dtx_mode half, bool is_bcch); 01073 01074 #define gsm48_hdr_msg_type gsm48_hdr_msg_type_r99 01075 01076 /* Section 10.4 */ 01077 #define GSM48_MT_RR_INIT_REQ 0x3c 01078 #define GSM48_MT_RR_ADD_ASS 0x3b 01079 #define GSM48_MT_RR_IMM_ASS 0x3f 01080 #define GSM48_MT_RR_IMM_ASS_EXT 0x39 01081 #define GSM48_MT_RR_IMM_ASS_REJ 0x3a 01082 #define GSM48_MT_RR_DTM_ASS_FAIL 0x48 01083 #define GSM48_MT_RR_DTM_REJECT 0x49 01084 #define GSM48_MT_RR_DTM_REQUEST 0x4A 01085 #define GSM48_MT_RR_PACKET_ASS 0x4B 01086 01087 #define GSM48_MT_RR_CIPH_M_CMD 0x35 01088 #define GSM48_MT_RR_CIPH_M_COMPL 0x32 01089 01090 #define GSM48_MT_RR_CFG_CHG_CMD 0x30 01091 #define GSM48_MT_RR_CFG_CHG_ACK 0x31 01092 #define GSM48_MT_RR_CFG_CHG_REJ 0x33 01093 01094 #define GSM48_MT_RR_ASS_CMD 0x2e 01095 #define GSM48_MT_RR_ASS_COMPL 0x29 01096 #define GSM48_MT_RR_ASS_FAIL 0x2f 01097 #define GSM48_MT_RR_HANDO_CMD 0x2b 01098 #define GSM48_MT_RR_HANDO_COMPL 0x2c 01099 #define GSM48_MT_RR_HANDO_FAIL 0x28 01100 #define GSM48_MT_RR_HANDO_INFO 0x2d 01101 #define GSM48_MT_RR_HANDO_INFO 0x2d 01102 #define GSM48_MT_RR_DTM_ASS_CMD 0x4c 01103 01104 #define GSM48_MT_RR_CELL_CHG_ORDER 0x08 01105 #define GSM48_MT_RR_PDCH_ASS_CMD 0x23 01106 01107 #define GSM48_MT_RR_CHAN_REL 0x0d 01108 #define GSM48_MT_RR_PART_REL 0x0a 01109 #define GSM48_MT_RR_PART_REL_COMP 0x0f 01110 01111 #define GSM48_MT_RR_PAG_REQ_1 0x21 01112 #define GSM48_MT_RR_PAG_REQ_2 0x22 01113 #define GSM48_MT_RR_PAG_REQ_3 0x24 01114 #define GSM48_MT_RR_PAG_RESP 0x27 01115 #define GSM48_MT_RR_NOTIF_NCH 0x20 01116 #define GSM48_MT_RR_NOTIF_FACCH 0x25 /* (Reserved) */ 01117 #define GSM48_MT_RR_NOTIF_RESP 0x26 01118 #define GSM48_MT_RR_PACKET_NOTIF 0x4e 01119 #define GSM48_MT_RR_UTRAN_CLSM_CHG 0x60 01120 #define GSM48_MT_RR_CDMA2K_CLSM_CHG 0x62 01121 #define GSM48_MT_RR_IS_TO_UTRAN_HANDO 0x63 01122 #define GSM48_MT_RR_IS_TO_CDMA2K_HANDO 0x64 01123 01124 #define GSM48_MT_RR_SYSINFO_8 0x18 01125 #define GSM48_MT_RR_SYSINFO_1 0x19 01126 #define GSM48_MT_RR_SYSINFO_2 0x1a 01127 #define GSM48_MT_RR_SYSINFO_3 0x1b 01128 #define GSM48_MT_RR_SYSINFO_4 0x1c 01129 #define GSM48_MT_RR_SYSINFO_5 0x1d 01130 #define GSM48_MT_RR_SYSINFO_6 0x1e 01131 #define GSM48_MT_RR_SYSINFO_7 0x1f 01132 01133 #define GSM48_MT_RR_SYSINFO_2bis 0x02 01134 #define GSM48_MT_RR_SYSINFO_2ter 0x03 01135 #define GSM48_MT_RR_SYSINFO_2quater 0x07 01136 #define GSM48_MT_RR_SYSINFO_5bis 0x05 01137 #define GSM48_MT_RR_SYSINFO_5ter 0x06 01138 #define GSM48_MT_RR_SYSINFO_9 0x04 01139 #define GSM48_MT_RR_SYSINFO_13 0x00 01140 01141 #define GSM48_MT_RR_SYSINFO_16 0x3d 01142 #define GSM48_MT_RR_SYSINFO_17 0x3e 01143 01144 #define GSM48_MT_RR_SYSINFO_18 0x40 01145 #define GSM48_MT_RR_SYSINFO_19 0x41 01146 #define GSM48_MT_RR_SYSINFO_20 0x42 01147 01148 #define GSM48_MT_RR_CHAN_MODE_MODIF 0x10 01149 #define GSM48_MT_RR_STATUS 0x12 01150 #define GSM48_MT_RR_CHAN_MODE_MODIF_ACK 0x17 01151 #define GSM48_MT_RR_FREQ_REDEF 0x14 01152 #define GSM48_MT_RR_MEAS_REP 0x15 01153 #define GSM48_MT_RR_CLSM_CHG 0x16 01154 #define GSM48_MT_RR_CLSM_ENQ 0x13 01155 #define GSM48_MT_RR_EXT_MEAS_REP 0x36 01156 #define GSM48_MT_RR_EXT_MEAS_REP_ORD 0x37 01157 #define GSM48_MT_RR_GPRS_SUSP_REQ 0x34 01158 #define GSM48_MT_RR_DTM_INFO 0x4d 01159 01160 #define GSM48_MT_RR_VGCS_UPL_GRANT 0x09 01161 #define GSM48_MT_RR_UPLINK_RELEASE 0x0e 01162 #define GSM48_MT_RR_UPLINK_FREE 0x0c 01163 #define GSM48_MT_RR_UPLINK_BUSY 0x2a 01164 #define GSM48_MT_RR_TALKER_IND 0x11 01165 01166 #define GSM48_MT_RR_APP_INFO 0x38 01167 01168 /* Table 10.2/3GPP TS 04.08 */ 01169 #define GSM48_MT_MM_IMSI_DETACH_IND 0x01 01170 #define GSM48_MT_MM_LOC_UPD_ACCEPT 0x02 01171 #define GSM48_MT_MM_LOC_UPD_REJECT 0x04 01172 #define GSM48_MT_MM_LOC_UPD_REQUEST 0x08 01173 01174 #define GSM48_MT_MM_AUTH_REJ 0x11 01175 #define GSM48_MT_MM_AUTH_REQ 0x12 01176 #define GSM48_MT_MM_AUTH_RESP 0x14 01177 #define GSM48_MT_MM_AUTH_FAIL 0x1c 01178 #define GSM48_MT_MM_ID_REQ 0x18 01179 #define GSM48_MT_MM_ID_RESP 0x19 01180 #define GSM48_MT_MM_TMSI_REALL_CMD 0x1a 01181 #define GSM48_MT_MM_TMSI_REALL_COMPL 0x1b 01182 01183 #define GSM48_MT_MM_CM_SERV_ACC 0x21 01184 #define GSM48_MT_MM_CM_SERV_REJ 0x22 01185 #define GSM48_MT_MM_CM_SERV_ABORT 0x23 01186 #define GSM48_MT_MM_CM_SERV_REQ 0x24 01187 #define GSM48_MT_MM_CM_SERV_PROMPT 0x25 01188 #define GSM48_MT_MM_CM_REEST_REQ 0x28 01189 #define GSM48_MT_MM_ABORT 0x29 01190 01191 #define GSM48_MT_MM_NULL 0x30 01192 #define GSM48_MT_MM_STATUS 0x31 01193 #define GSM48_MT_MM_INFO 0x32 01194 01195 /* Table 10.3/3GPP TS 04.08 */ 01196 #define GSM48_MT_CC_ALERTING 0x01 01197 #define GSM48_MT_CC_CALL_CONF 0x08 01198 #define GSM48_MT_CC_CALL_PROC 0x02 01199 #define GSM48_MT_CC_CONNECT 0x07 01200 #define GSM48_MT_CC_CONNECT_ACK 0x0f 01201 #define GSM48_MT_CC_EMERG_SETUP 0x0e 01202 #define GSM48_MT_CC_PROGRESS 0x03 01203 #define GSM48_MT_CC_ESTAB 0x04 01204 #define GSM48_MT_CC_ESTAB_CONF 0x06 01205 #define GSM48_MT_CC_RECALL 0x0b 01206 #define GSM48_MT_CC_START_CC 0x09 01207 #define GSM48_MT_CC_SETUP 0x05 01208 01209 #define GSM48_MT_CC_MODIFY 0x17 01210 #define GSM48_MT_CC_MODIFY_COMPL 0x1f 01211 #define GSM48_MT_CC_MODIFY_REJECT 0x13 01212 #define GSM48_MT_CC_USER_INFO 0x10 01213 #define GSM48_MT_CC_HOLD 0x18 01214 #define GSM48_MT_CC_HOLD_ACK 0x19 01215 #define GSM48_MT_CC_HOLD_REJ 0x1a 01216 #define GSM48_MT_CC_RETR 0x1c 01217 #define GSM48_MT_CC_RETR_ACK 0x1d 01218 #define GSM48_MT_CC_RETR_REJ 0x1e 01219 01220 #define GSM48_MT_CC_DISCONNECT 0x25 01221 #define GSM48_MT_CC_RELEASE 0x2d 01222 #define GSM48_MT_CC_RELEASE_COMPL 0x2a 01223 01224 #define GSM48_MT_CC_CONG_CTRL 0x39 01225 #define GSM48_MT_CC_NOTIFY 0x3e 01226 #define GSM48_MT_CC_STATUS 0x3d 01227 #define GSM48_MT_CC_STATUS_ENQ 0x34 01228 #define GSM48_MT_CC_START_DTMF 0x35 01229 #define GSM48_MT_CC_STOP_DTMF 0x31 01230 #define GSM48_MT_CC_STOP_DTMF_ACK 0x32 01231 #define GSM48_MT_CC_START_DTMF_ACK 0x36 01232 #define GSM48_MT_CC_START_DTMF_REJ 0x37 01233 #define GSM48_MT_CC_FACILITY 0x3a 01234 01235 extern const struct value_string gsm48_rr_msgtype_names[]; 01236 extern const struct value_string gsm48_mm_msgtype_names[]; 01237 extern const struct value_string gsm48_cc_msgtype_names[]; 01238 const char *gsm48_pdisc_msgtype_name(uint8_t pdisc, uint8_t msg_type); 01239 01240 /* FIXME: Table 10.4 / 10.4a (GPRS) */ 01241 01242 /* Section 10.5.3.3 CM service type */ 01243 #define GSM48_CMSERV_MO_CALL_PACKET 1 01244 #define GSM48_CMSERV_EMERGENCY 2 01245 #define GSM48_CMSERV_SMS 4 01246 #define GSM48_CMSERV_SUP_SERV 8 01247 #define GSM48_CMSERV_VGCS 9 01248 #define GSM48_CMSERV_VBS 10 01249 #define GSM48_CMSERV_LOC_SERV 11 01250 01251 /* Section 10.5.2.26, Table 10.5.64 */ 01252 #define GSM48_PM_MASK 0x03 01253 #define GSM48_PM_NORMAL 0x00 01254 #define GSM48_PM_EXTENDED 0x01 01255 #define GSM48_PM_REORG 0x02 01256 #define GSM48_PM_SAME 0x03 01257 01258 /* Chapter 10.5.3.5 / Table 10.5.93 */ 01259 #define GSM48_LUPD_NORMAL 0x0 01260 #define GSM48_LUPD_PERIODIC 0x1 01261 #define GSM48_LUPD_IMSI_ATT 0x2 01262 #define GSM48_LUPD_RESERVED 0x3 01263 01264 /* Table 10.5.4 */ 01265 #define GSM_MI_TYPE_MASK 0x07 01266 #define GSM_MI_TYPE_NONE 0x00 01267 #define GSM_MI_TYPE_IMSI 0x01 01268 #define GSM_MI_TYPE_IMEI 0x02 01269 #define GSM_MI_TYPE_IMEISV 0x03 01270 #define GSM_MI_TYPE_TMSI 0x04 01271 #define GSM_MI_ODD 0x08 01272 01273 #define GSM48_IE_MOBILE_ID 0x17 /* 10.5.1.4 */ 01274 #define GSM48_IE_NAME_LONG 0x43 /* 10.5.3.5a */ 01275 #define GSM48_IE_NAME_SHORT 0x45 /* 10.5.3.5a */ 01276 #define GSM48_IE_UTC 0x46 /* 10.5.3.8 */ 01277 #define GSM48_IE_NET_TIME_TZ 0x47 /* 10.5.3.9 */ 01278 #define GSM48_IE_LSA_IDENT 0x48 /* 10.5.3.11 */ 01279 #define GSM48_IE_NET_DST 0x49 /* 10.5.3.12 [24.008] */ 01280 01281 #define GSM48_IE_BEARER_CAP 0x04 /* 10.5.4.5 */ 01282 #define GSM48_IE_CAUSE 0x08 /* 10.5.4.11 */ 01283 #define GSM48_IE_CC_CAP 0x15 /* 10.5.4.5a */ 01284 #define GSM48_IE_ALERT 0x19 /* 10.5.4.26 */ 01285 #define GSM48_IE_FACILITY 0x1c /* 10.5.4.15 */ 01286 #define GSM48_IE_PROGR_IND 0x1e /* 10.5.4.21 */ 01287 #define GSM48_IE_AUX_STATUS 0x24 /* 10.5.4.4 */ 01288 #define GSM48_IE_NOTIFY 0x27 /* 10.5.4.20 */ 01289 #define GSM48_IE_KPD_FACILITY 0x2c /* 10.5.4.17 */ 01290 #define GSM48_IE_SIGNAL 0x34 /* 10.5.4.23 */ 01291 #define GSM48_IE_CONN_BCD 0x4c /* 10.5.4.13 */ 01292 #define GSM48_IE_CONN_SUB 0x4d /* 10.5.4.14 */ 01293 #define GSM48_IE_CALLING_BCD 0x5c /* 10.5.4.9 */ 01294 #define GSM48_IE_CALLING_SUB 0x5d /* 10.5.4.10 */ 01295 #define GSM48_IE_CALLED_BCD 0x5e /* 10.5.4.7 */ 01296 #define GSM48_IE_CALLED_SUB 0x6d /* 10.5.4.8 */ 01297 #define GSM48_IE_REDIR_BCD 0x74 /* 10.5.4.21a */ 01298 #define GSM48_IE_REDIR_SUB 0x75 /* 10.5.4.21b */ 01299 #define GSM48_IE_LOWL_COMPAT 0x7c /* 10.5.4.18 */ 01300 #define GSM48_IE_HIGHL_COMPAT 0x7d /* 10.5.4.16 */ 01301 #define GSM48_IE_USER_USER 0x7e /* 10.5.4.25 */ 01302 #define GSM48_IE_SS_VERS 0x7f /* 10.5.4.24 */ 01303 #define GSM48_IE_MORE_DATA 0xa0 /* 10.5.4.19 */ 01304 #define GSM48_IE_CLIR_SUPP 0xa1 /* 10.5.4.11a */ 01305 #define GSM48_IE_CLIR_INVOC 0xa2 /* 10.5.4.11b */ 01306 #define GSM48_IE_REV_C_SETUP 0xa3 /* 10.5.4.22a */ 01307 #define GSM48_IE_REPEAT_CIR 0xd1 /* 10.5.4.22 */ 01308 #define GSM48_IE_REPEAT_SEQ 0xd3 /* 10.5.4.22 */ 01309 01310 /* Section 10.5.4.11 / Table 10.5.122 */ 01311 #define GSM48_CAUSE_CS_GSM 0x60 01312 01313 /* Section 9.1.2 / Table 9.3 */ 01314 /* RR elements */ 01315 #define GSM48_IE_VGCS_TARGET 0x01 01316 //#define GSM48_IE_VGCS_T_MODE_I 0x01 01317 #define GSM48_IE_FRQSHORT_AFTER 0x02 01318 #define GSM48_IE_MUL_RATE_CFG 0x03 /* 10.5.2.21aa */ 01319 #define GSM48_IE_FREQ_L_AFTER 0x05 01320 #define GSM48_IE_MSLOT_DESC 0x10 01321 #define GSM48_IE_CHANMODE_2 0x11 01322 #define GSM48_IE_FRQSHORT_BEFORE 0x12 01323 //#define GSM48_IE_FRQSHORT_BEFOR 0x12 01324 #define GSM48_IE_CHANMODE_3 0x13 01325 #define GSM48_IE_CHANMODE_4 0x14 01326 #define GSM48_IE_CHANMODE_5 0x15 01327 #define GSM48_IE_CHANMODE_6 0x16 01328 #define GSM48_IE_CHANMODE_7 0x17 01329 #define GSM48_IE_CHANMODE_8 0x18 01330 #define GSM48_IE_CHANDESC_2 0x64 01331 #define GSM48_IE_MA_AFTER 0x72 01332 #define GSM48_IE_START_TIME 0x7c 01333 #define GSM48_IE_FREQ_L_BEFORE 0x19 01334 //#define GSM48_IE_FRQLIST_BEFORE 0x19 01335 #define GSM48_IE_CH_DESC_1_BEFORE 0x1c 01336 //#define GSM48_IE_CHDES_1_BEFORE 0x1c 01337 #define GSM48_IE_CH_DESC_2_BEFORE 0x1d 01338 //#define GSM48_IE_CHDES_2_BEFORE 0x1d 01339 #define GSM48_IE_F_CH_SEQ_BEFORE 0x1e 01340 //#define GSM48_IE_FRQSEQ_BEFORE 0x1e 01341 #define GSM48_IE_CLASSMARK3 0x20 01342 #define GSM48_IE_MA_BEFORE 0x21 01343 #define GSM48_IE_RR_PACKET_UL 0x22 01344 #define GSM48_IE_RR_PACKET_DL 0x23 01345 #define GSM48_IE_CELL_CH_DESC 0x62 01346 #define GSM48_IE_CHANMODE_1 0x63 01347 #define GSM48_IE_CHDES_2_AFTER 0x64 01348 #define GSM48_IE_MODE_SEC_CH 0x66 01349 #define GSM48_IE_F_CH_SEQ_AFTER 0x69 01350 #define GSM48_IE_MA_AFTER 0x72 01351 #define GSM48_IE_BA_RANGE 0x73 01352 #define GSM48_IE_GROUP_CHDES 0x74 01353 #define GSM48_IE_BA_LIST_PREF 0x75 01354 #define GSM48_IE_MOB_OVSERV_DIF 0x77 01355 #define GSM48_IE_REALTIME_DIFF 0x7b 01356 #define GSM48_IE_START_TIME 0x7c 01357 #define GSM48_IE_TIMING_ADVANCE 0x7d 01358 #define GSM48_IE_GROUP_CIP_SEQ 0x80 01359 #define GSM48_IE_CIP_MODE_SET 0x90 01360 #define GSM48_IE_GPRS_RESUMPT 0xc0 01361 #define GSM48_IE_SYNC_IND 0xd0 01362 /* System Information 4 (types are equal IEs above) */ 01363 #define GSM48_IE_CBCH_CHAN_DESC 0x64 01364 #define GSM48_IE_CBCH_MOB_AL 0x72 01365 01366 /* Additional MM elements */ 01367 #define GSM48_IE_LOCATION_AREA 0x13 01368 #define GSM48_IE_AUTN 0x20 01369 #define GSM48_IE_AUTH_RES_EXT 0x21 01370 #define GSM48_IE_AUTS 0x22 01371 #define GSM48_IE_PRIORITY_LEV 0x80 01372 #define GSM48_IE_FOLLOW_ON_PROC 0xa1 01373 #define GSM48_IE_CTS_PERMISSION 0xa2 01374 01375 /* Section 10.5.4.23 / Table 10.5.130 */ 01376 enum gsm48_signal_val { 01377 GSM48_SIGNAL_DIALTONE = 0x00, 01378 GSM48_SIGNAL_RINGBACK = 0x01, 01379 GSM48_SIGNAL_INTERCEPT = 0x02, 01380 GSM48_SIGNAL_NET_CONG = 0x03, 01381 GSM48_SIGNAL_BUSY = 0x04, 01382 GSM48_SIGNAL_CONFIRM = 0x05, 01383 GSM48_SIGNAL_ANSWER = 0x06, 01384 GSM48_SIGNAL_CALL_WAIT = 0x07, 01385 GSM48_SIGNAL_OFF_HOOK = 0x08, 01386 GSM48_SIGNAL_OFF = 0x3f, 01387 GSM48_SIGNAL_ALERT_OFF = 0x4f, 01388 }; 01389 01390 enum gsm48_cause_loc { 01391 GSM48_CAUSE_LOC_USER = 0x00, 01392 GSM48_CAUSE_LOC_PRN_S_LU = 0x01, 01393 GSM48_CAUSE_LOC_PUN_S_LU = 0x02, 01394 GSM48_CAUSE_LOC_TRANS_NET = 0x03, 01395 GSM48_CAUSE_LOC_PUN_S_RU = 0x04, 01396 GSM48_CAUSE_LOC_PRN_S_RU = 0x05, 01397 /* not defined */ 01398 GSM48_CAUSE_LOC_INN_NET = 0x07, 01399 GSM48_CAUSE_LOC_NET_BEYOND = 0x0a, 01400 }; 01401 01402 /* Section 10.5.2.31 RR Cause / Table 10.5.70 */ 01403 enum gsm48_rr_cause { 01404 GSM48_RR_CAUSE_NORMAL = 0x00, 01405 GSM48_RR_CAUSE_ABNORMAL_UNSPEC = 0x01, 01406 GSM48_RR_CAUSE_ABNORMAL_UNACCT = 0x02, 01407 GSM48_RR_CAUSE_ABNORMAL_TIMER = 0x03, 01408 GSM48_RR_CAUSE_ABNORMAL_NOACT = 0x04, 01409 GSM48_RR_CAUSE_PREMPTIVE_REL = 0x05, 01410 GSM48_RR_CAUSE_HNDOVER_IMP = 0x08, 01411 GSM48_RR_CAUSE_CHAN_MODE_UNACCT = 0x09, 01412 GSM48_RR_CAUSE_FREQ_NOT_IMPL = 0x0a, 01413 GSM48_RR_CAUSE_CALL_CLEARED = 0x41, 01414 GSM48_RR_CAUSE_SEMANT_INCORR = 0x5f, 01415 GSM48_RR_CAUSE_INVALID_MAND_INF = 0x60, 01416 GSM48_RR_CAUSE_MSG_TYPE_N = 0x61, 01417 GSM48_RR_CAUSE_MSG_TYPE_N_COMPAT= 0x62, 01418 GSM48_RR_CAUSE_COND_IE_ERROR = 0x64, 01419 GSM48_RR_CAUSE_NO_CELL_ALLOC_A = 0x65, 01420 GSM48_RR_CAUSE_PROT_ERROR_UNSPC = 0x6f, 01421 }; 01422 01423 /* Section 10.5.4.11 CC Cause / Table 10.5.123 */ 01424 enum gsm48_cc_cause { 01425 GSM48_CC_CAUSE_UNASSIGNED_NR = 1, 01426 GSM48_CC_CAUSE_NO_ROUTE = 3, 01427 GSM48_CC_CAUSE_CHAN_UNACCEPT = 6, 01428 GSM48_CC_CAUSE_OP_DET_BARRING = 8, 01429 GSM48_CC_CAUSE_NORM_CALL_CLEAR = 16, 01430 GSM48_CC_CAUSE_USER_BUSY = 17, 01431 GSM48_CC_CAUSE_USER_NOTRESPOND = 18, 01432 GSM48_CC_CAUSE_USER_ALERTING_NA = 19, 01433 GSM48_CC_CAUSE_CALL_REJECTED = 21, 01434 GSM48_CC_CAUSE_NUMBER_CHANGED = 22, 01435 GSM48_CC_CAUSE_PRE_EMPTION = 25, 01436 GSM48_CC_CAUSE_NONSE_USER_CLR = 26, 01437 GSM48_CC_CAUSE_DEST_OOO = 27, 01438 GSM48_CC_CAUSE_INV_NR_FORMAT = 28, 01439 GSM48_CC_CAUSE_FACILITY_REJ = 29, 01440 GSM48_CC_CAUSE_RESP_STATUS_INQ = 30, 01441 GSM48_CC_CAUSE_NORMAL_UNSPEC = 31, 01442 GSM48_CC_CAUSE_NO_CIRCUIT_CHAN = 34, 01443 GSM48_CC_CAUSE_NETWORK_OOO = 38, 01444 GSM48_CC_CAUSE_TEMP_FAILURE = 41, 01445 GSM48_CC_CAUSE_SWITCH_CONG = 42, 01446 GSM48_CC_CAUSE_ACC_INF_DISCARD = 43, 01447 GSM48_CC_CAUSE_REQ_CHAN_UNAVAIL = 44, 01448 GSM48_CC_CAUSE_RESOURCE_UNAVAIL = 47, 01449 GSM48_CC_CAUSE_QOS_UNAVAIL = 49, 01450 GSM48_CC_CAUSE_REQ_FAC_NOT_SUBSC= 50, 01451 GSM48_CC_CAUSE_INC_BARRED_CUG = 55, 01452 GSM48_CC_CAUSE_BEARER_CAP_UNAUTH= 57, 01453 GSM48_CC_CAUSE_BEARER_CA_UNAVAIL= 58, 01454 GSM48_CC_CAUSE_SERV_OPT_UNAVAIL = 63, 01455 GSM48_CC_CAUSE_BEARERSERV_UNIMPL= 65, 01456 GSM48_CC_CAUSE_ACM_GE_ACM_MAX = 68, 01457 GSM48_CC_CAUSE_REQ_FAC_NOTIMPL = 69, 01458 GSM48_CC_CAUSE_RESTR_BCAP_AVAIL = 70, 01459 GSM48_CC_CAUSE_SERV_OPT_UNIMPL = 79, 01460 GSM48_CC_CAUSE_INVAL_TRANS_ID = 81, 01461 GSM48_CC_CAUSE_USER_NOT_IN_CUG = 87, 01462 GSM48_CC_CAUSE_INCOMPAT_DEST = 88, 01463 GSM48_CC_CAUSE_INVAL_TRANS_NET = 91, 01464 GSM48_CC_CAUSE_SEMANTIC_INCORR = 95, 01465 GSM48_CC_CAUSE_INVAL_MAND_INF = 96, 01466 GSM48_CC_CAUSE_MSGTYPE_NOTEXIST = 97, 01467 GSM48_CC_CAUSE_MSGTYPE_INCOMPAT = 98, 01468 GSM48_CC_CAUSE_IE_NOTEXIST = 99, 01469 GSM48_CC_CAUSE_COND_IE_ERR = 100, 01470 GSM48_CC_CAUSE_MSG_INCOMP_STATE = 101, 01471 GSM48_CC_CAUSE_RECOVERY_TIMER = 102, 01472 GSM48_CC_CAUSE_PROTO_ERR = 111, 01473 GSM48_CC_CAUSE_INTERWORKING = 127, 01474 }; 01475 01476 /* Annex G, GSM specific cause values for mobility management */ 01477 enum gsm48_reject_value { 01478 GSM48_REJECT_IMSI_UNKNOWN_IN_HLR = 2, 01479 GSM48_REJECT_ILLEGAL_MS = 3, 01480 GSM48_REJECT_IMSI_UNKNOWN_IN_VLR = 4, 01481 GSM48_REJECT_IMEI_NOT_ACCEPTED = 5, 01482 GSM48_REJECT_ILLEGAL_ME = 6, 01483 GSM48_REJECT_PLMN_NOT_ALLOWED = 11, 01484 GSM48_REJECT_LOC_NOT_ALLOWED = 12, 01485 GSM48_REJECT_ROAMING_NOT_ALLOWED = 13, 01486 GSM48_REJECT_NETWORK_FAILURE = 17, 01487 GSM48_REJECT_SYNCH_FAILURE = 21, 01488 GSM48_REJECT_CONGESTION = 22, 01489 GSM48_REJECT_SRV_OPT_NOT_SUPPORTED = 32, 01490 GSM48_REJECT_RQD_SRV_OPT_NOT_SUPPORTED = 33, 01491 GSM48_REJECT_SRV_OPT_TMP_OUT_OF_ORDER = 34, 01492 GSM48_REJECT_CALL_CAN_NOT_BE_IDENTIFIED = 38, 01493 GSM48_REJECT_INCORRECT_MESSAGE = 95, 01494 GSM48_REJECT_INVALID_MANDANTORY_INF = 96, 01495 GSM48_REJECT_MSG_TYPE_NOT_IMPLEMENTED = 97, 01496 GSM48_REJECT_MSG_TYPE_NOT_COMPATIBLE = 98, 01497 GSM48_REJECT_INF_ELEME_NOT_IMPLEMENTED = 99, 01498 GSM48_REJECT_CONDTIONAL_IE_ERROR = 100, 01499 GSM48_REJECT_MSG_NOT_COMPATIBLE = 101, 01500 GSM48_REJECT_PROTOCOL_ERROR = 111, 01501 01502 /* according to G.6 Additional cause codes for GMM */ 01503 GSM48_REJECT_GPRS_NOT_ALLOWED = 7, 01504 GSM48_REJECT_SERVICES_NOT_ALLOWED = 8, 01505 GSM48_REJECT_MS_IDENTITY_NOT_DERVIVABLE = 9, 01506 GSM48_REJECT_IMPLICITLY_DETACHED = 10, 01507 GSM48_REJECT_GPRS_NOT_ALLOWED_IN_PLMN = 14, 01508 GSM48_REJECT_MSC_TMP_NOT_REACHABLE = 16, 01509 }; 01510 01511 extern const struct value_string gsm48_reject_value_names[]; 01512 static inline const char *gsm48_reject_value_name(enum gsm48_reject_value val) 01513 { return get_value_string(gsm48_reject_value_names, val); } 01514 01515 enum chreq_type { 01516 CHREQ_T_EMERG_CALL, 01517 CHREQ_T_CALL_REEST_TCH_F, 01518 CHREQ_T_CALL_REEST_TCH_H, 01519 CHREQ_T_CALL_REEST_TCH_H_DBL, 01520 CHREQ_T_SDCCH, 01521 CHREQ_T_TCH_F, 01522 CHREQ_T_VOICE_CALL_TCH_H, 01523 CHREQ_T_DATA_CALL_TCH_H, 01524 CHREQ_T_LOCATION_UPD, 01525 CHREQ_T_PAG_R_ANY_NECI0, 01526 CHREQ_T_PAG_R_ANY_NECI1, 01527 CHREQ_T_PAG_R_TCH_F, 01528 CHREQ_T_PAG_R_TCH_FH, 01529 CHREQ_T_LMU, 01530 CHREQ_T_RESERVED_SDCCH, 01531 CHREQ_T_RESERVED_IGNORE, 01532 CHREQ_T_PDCH_ONE_PHASE, 01533 CHREQ_T_PDCH_TWO_PHASE, 01534 _NUM_CHREQ_T, 01535 }; 01536 01537 /* Chapter 11.3 */ 01538 #define GSM48_T301 180, 0 01539 #define GSM48_T303 30, 0 01540 #define GSM48_T305 30, 0 01541 #define GSM48_T306 30, 0 01542 #define GSM48_T308 10, 0 /* no spec default */ 01543 #define GSM48_T310 30, 0 /* no spec default */ 01544 #define GSM48_T313 30, 0 /* no spec default */ 01545 #define GSM48_T323 30, 0 01546 #define GSM48_T331 30, 0 /* no spec default */ 01547 #define GSM48_T333 30, 0 /* no spec default */ 01548 #define GSM48_T334 25, 0 /* min 15s */ 01549 #define GSM48_T338 30, 0 /* no spec default */ 01550 #define GSM48_T303_MS 30, 0 01551 #define GSM48_T305_MS 30, 0 01552 #define GSM48_T308_MS 30, 0 01553 #define GSM48_T310_MS 30, 0 01554 #define GSM48_T313_MS 30, 0 01555 #define GSM48_T323_MS 30, 0 01556 #define GSM48_T332_MS 30, 0 01557 #define GSM48_T335_MS 30, 0 01558 01559 /* Chapter 5.1.2.2 */ 01560 #define GSM_CSTATE_NULL 0 01561 #define GSM_CSTATE_INITIATED 1 01562 #define GSM_CSTATE_MM_CONNECTION_PEND 2 /* see 10.5.4.6 */ 01563 #define GSM_CSTATE_MO_CALL_PROC 3 01564 #define GSM_CSTATE_CALL_DELIVERED 4 01565 #define GSM_CSTATE_CALL_PRESENT 6 01566 #define GSM_CSTATE_CALL_RECEIVED 7 01567 #define GSM_CSTATE_CONNECT_REQUEST 8 01568 #define GSM_CSTATE_MO_TERM_CALL_CONF 9 01569 #define GSM_CSTATE_ACTIVE 10 01570 #define GSM_CSTATE_DISCONNECT_REQ 12 01571 #define GSM_CSTATE_DISCONNECT_IND 12 01572 #define GSM_CSTATE_RELEASE_REQ 19 01573 #define GSM_CSTATE_MO_ORIG_MODIFY 26 01574 #define GSM_CSTATE_MO_TERM_MODIFY 27 01575 #define GSM_CSTATE_CONNECT_IND 28 01576 01577 #define SBIT(a) (1 << a) 01578 #define ALL_STATES 0xffffffff 01579 01580 /* Table 10.5.3/3GPP TS 04.08: Location Area Identification information element */ 01581 #define GSM_LAC_RESERVED_DETACHED 0x0 01582 #define GSM_LAC_RESERVED_ALL_BTS 0xfffe 01583 01584 /* GSM 04.08 Bearer Capability: Information Transfer Capability */ 01585 enum gsm48_bcap_itcap { 01586 GSM48_BCAP_ITCAP_SPEECH = 0, 01587 GSM48_BCAP_ITCAP_UNR_DIG_INF = 1, 01588 GSM48_BCAP_ITCAP_3k1_AUDIO = 2, 01589 GSM48_BCAP_ITCAP_FAX_G3 = 3, 01590 GSM48_BCAP_ITCAP_OTHER = 5, 01591 GSM48_BCAP_ITCAP_RESERVED = 7, 01592 }; 01593 01594 /* GSM 04.08 Bearer Capability: Transfer Mode */ 01595 enum gsm48_bcap_tmod { 01596 GSM48_BCAP_TMOD_CIRCUIT = 0, 01597 GSM48_BCAP_TMOD_PACKET = 1, 01598 }; 01599 01600 /* GSM 04.08 Bearer Capability: Coding Standard */ 01601 enum gsm48_bcap_coding { 01602 GSM48_BCAP_CODING_GSM_STD = 0, 01603 }; 01604 01605 /* GSM 04.08 Bearer Capability: Radio Channel Requirements */ 01606 enum gsm48_bcap_rrq { 01607 GSM48_BCAP_RRQ_FR_ONLY = 1, 01608 GSM48_BCAP_RRQ_DUAL_HR = 2, 01609 GSM48_BCAP_RRQ_DUAL_FR = 3, 01610 }; 01611 01612 /* GSM 04.08 Bearer Capability: Rate Adaption */ 01613 enum gsm48_bcap_ra { 01614 GSM48_BCAP_RA_NONE = 0, 01615 GSM48_BCAP_RA_V110_X30 = 1, 01616 GSM48_BCAP_RA_X31 = 2, 01617 GSM48_BCAP_RA_OTHER = 3, 01618 }; 01619 01620 /* GSM 04.08 Bearer Capability: Signalling access protocol */ 01621 enum gsm48_bcap_sig_access { 01622 GSM48_BCAP_SA_I440_I450 = 1, 01623 GSM48_BCAP_SA_X21 = 2, 01624 GSM48_BCAP_SA_X28_DP_IN = 3, 01625 GSM48_BCAP_SA_X28_DP_UN = 4, 01626 GSM48_BCAP_SA_X28_NDP = 5, 01627 GSM48_BCAP_SA_X32 = 6, 01628 }; 01629 01630 /* GSM 04.08 Bearer Capability: User Rate */ 01631 enum gsm48_bcap_user_rate { 01632 GSM48_BCAP_UR_300 = 1, 01633 GSM48_BCAP_UR_1200 = 2, 01634 GSM48_BCAP_UR_2400 = 3, 01635 GSM48_BCAP_UR_4800 = 4, 01636 GSM48_BCAP_UR_9600 = 5, 01637 GSM48_BCAP_UR_12000 = 6, 01638 GSM48_BCAP_UR_1200_75 = 7, 01639 }; 01640 01641 /* GSM 04.08 Bearer Capability: Parity */ 01642 enum gsm48_bcap_parity { 01643 GSM48_BCAP_PAR_ODD = 0, 01644 GSM48_BCAP_PAR_EVEN = 2, 01645 GSM48_BCAP_PAR_NONE = 3, 01646 GSM48_BCAP_PAR_ZERO = 4, 01647 GSM48_BCAP_PAR_ONE = 5, 01648 }; 01649 01650 /* GSM 04.08 Bearer Capability: Intermediate Rate */ 01651 enum gsm48_bcap_interm_rate { 01652 GSM48_BCAP_IR_8k = 2, 01653 GSM48_BCAP_IR_16k = 3, 01654 }; 01655 01656 /* GSM 04.08 Bearer Capability: Transparency */ 01657 enum gsm48_bcap_transp { 01658 GSM48_BCAP_TR_TRANSP = 0, 01659 GSM48_BCAP_TR_RLP = 1, 01660 GSM48_BCAP_TR_TR_PREF = 2, 01661 GSM48_BCAP_TR_RLP_PREF = 3, 01662 }; 01663 01664 /* GSM 04.08 Bearer Capability: Modem Type */ 01665 enum gsm48_bcap_modem_type { 01666 GSM48_BCAP_MT_NONE = 0, 01667 GSM48_BCAP_MT_V21 = 1, 01668 GSM48_BCAP_MT_V22 = 2, 01669 GSM48_BCAP_MT_V22bis = 3, 01670 GSM48_BCAP_MT_V23 = 4, 01671 GSM48_BCAP_MT_V26ter = 5, 01672 GSM48_BCAP_MT_V32 = 6, 01673 GSM48_BCAP_MT_UNDEF = 7, 01674 GSM48_BCAP_MT_AUTO_1 = 8, 01675 }; 01676 01679 enum gsm48_bcap_speech_ver { 01680 GSM48_BCAP_SV_FR = 0, 01681 GSM48_BCAP_SV_HR = 1, 01682 GSM48_BCAP_SV_EFR = 2, 01683 GSM48_BCAP_SV_AMR_F = 4, 01684 GSM48_BCAP_SV_AMR_H = 5, 01685 GSM48_BCAP_SV_AMR_OFW = 6, 01686 GSM48_BCAP_SV_AMR_OHW = 7, 01687 GSM48_BCAP_SV_AMR_FW = 8, 01688 GSM48_BCAP_SV_AMR_OH = 11, 01689 }; 01690 01691 #define GSM48_TMSI_LEN 5 01692 #define GSM48_MID_TMSI_LEN (GSM48_TMSI_LEN + 2) 01693 #define GSM48_MI_SIZE 32 01694 01695 /* 3GPP TS 24.008 ยง 10.5.5.15 Routing area identification */ 01696 struct gsm48_ra_id { 01697 uint8_t digits[3]; /* MCC + MNC BCD digits */ 01698 uint16_t lac; /* Location Area Code */ 01699 uint8_t rac; /* Routing Area Code */ 01700 } __attribute__ ((packed)); 01701 01702 #define GSM48_CELL_CHAN_DESC_SIZE 16 01703 01704 #define GSM_MACBLOCK_LEN 23 01705 #define GSM_MACBLOCK_PADDING 0x2b 01706 01707 /* Table 10.5.118 / 3GPP TS 24.008 Section 10.5.4.7 */ 01708 enum gsm48_type_of_number { 01709 GSM48_TON_UNKNOWN = 0, 01710 GSM48_TON_INTERNATIONAL = 1, 01711 GSM48_TON_NATIONAL = 2, 01712 GSM48_TON_NET_SPEC = 3, 01713 GSM48_TON_SHORT_CODE = 4, 01714 /* reserved */ 01715 }; 01716 01717 /* Table 10.5.118 / 3GPP TS 24.008 Section 10.5.4.7 */ 01718 enum gsm48_numbering_plan { 01719 GSM48_NPI_UNKNOWN = 0, 01720 GSM48_NPI_ISDN_E164 = 1, 01721 GSM48_NPI_DATA_X121 = 3, 01722 GSM48_NPI_TELEX_F69 = 4, 01723 GSM48_NPI_NATIONAL = 8, 01724 GSM48_NPI_PRIVATE = 9, 01725 GSM48_NPI_CTS = 11, 01726 /* reserved */ 01727 };