diff options
Diffstat (limited to 'include/osmocom/gsm/protocol')
21 files changed, 2339 insertions, 152 deletions
diff --git a/include/osmocom/gsm/protocol/Makefile.am b/include/osmocom/gsm/protocol/Makefile.am new file mode 100644 index 00000000..23429dcd --- /dev/null +++ b/include/osmocom/gsm/protocol/Makefile.am @@ -0,0 +1,30 @@ +osmogsmproto_HEADERS = \ + gsm_23_032.h \ + gsm_03_40.h \ + gsm_03_41.h \ + gsm_04_08.h \ + gsm_04_08_gprs.h \ + gsm_04_11.h \ + gsm_04_12.h \ + gsm_04_14.h \ + gsm_04_80.h \ + gsm_08_08.h \ + gsm_08_58.h \ + gsm_09_02.h \ + gsm_12_21.h \ + gsm_23_003.h \ + gsm_23_041.h \ + gsm_25_415.h \ + gsm_29_118.h \ + gsm_44_004.h \ + gsm_44_060.h \ + gsm_44_068.h \ + gsm_44_318.h \ + gsm_48_049.h \ + gsm_48_071.h \ + gsm_49_031.h \ + ipaccess.h \ + smpp34_osmocom.h \ + $(NULL) + +osmogsmprotodir = $(includedir)/osmocom/gsm/protocol diff --git a/include/osmocom/gsm/protocol/gsm_03_41.h b/include/osmocom/gsm/protocol/gsm_03_41.h index 1b399aee..f6c36cad 100644 --- a/include/osmocom/gsm/protocol/gsm_03_41.h +++ b/include/osmocom/gsm/protocol/gsm_03_41.h @@ -25,7 +25,7 @@ struct gsm341_ms_message { uint8_t update:4; uint8_t code_lo:4; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t gs:2, code_hi:6; uint8_t code_lo:4, update:4; #endif @@ -36,7 +36,7 @@ struct gsm341_ms_message { uint8_t language:4; uint8_t group:4; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t group:4, language:4; #endif } dcs; @@ -45,7 +45,7 @@ struct gsm341_ms_message { uint8_t total:4; uint8_t current:4; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t current:4, total:4; #endif } page; @@ -63,7 +63,7 @@ struct gsm341_etws_message { uint8_t update:4; uint8_t code_lo:4; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t gs:2, alert:1, popup:1, code_hi:4; uint8_t code_lo:4, update:4; #endif diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h index f8f2eabd..075b6ca6 100644 --- a/include/osmocom/gsm/protocol/gsm_04_08.h +++ b/include/osmocom/gsm/protocol/gsm_04_08.h @@ -22,7 +22,7 @@ struct gsm48_classmark1 { rev_lev:2, spare:1; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t spare:1, rev_lev:2, es_ind:1, a5_1:1, pwr_lev:3; #endif } __attribute__ ((packed)); @@ -51,13 +51,182 @@ struct gsm48_classmark2 { spare4:1, cm3:1; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t spare:1, rev_lev:2, es_ind:1, a5_1:1, pwr_lev:3; uint8_t spare2:1, ps_cap:1, ss_scr:2, sm_cap:1, vbs:1, vgcs:1, fc:1; uint8_t cm3:1, spare4:1, lcsva_cap:1, spare3:1, solsa:1, cmsp:1, a5_3:1, a5_2:1; #endif } __attribute__ ((packed)); +/* Chapter 10.5.1.7 */ +struct gsm48_classmark3 { + uint8_t a5_bits; + uint8_t mult_band_supp; + uint8_t assoc_radio_cap_1; + uint8_t assoc_radio_cap_2; + + struct { + bool present; + uint8_t r_gsm_assoc_radio_cap; + } r_support; + + struct { + bool present; + uint8_t mslot_class; + } hscsd_mult_slot_cap; + + bool ucs2_treatment; + bool extended_meas_cap; + + struct { + bool present; + uint8_t sms_value; + uint8_t sm_value; + } ms_meas_cap; + + struct { + bool present; + uint8_t method; + } ms_pos_method_cap; + + struct { + bool present; + uint8_t mslot_class; + } ecsd_multislot_cap; + + struct { + bool present; + bool mod_cap; + + struct { + bool present; + uint8_t value; + } rf_pwr_cap_1; + + struct { + bool present; + uint8_t value; + } rf_pwr_cap_2; + + } psk8_struct; + + struct { + bool present; + uint8_t value; + uint8_t assoc_radio_cap; + } gsm_400_bands_supp; + + struct { + bool present; + uint8_t value; + } gsm_850_assoc_radio_cap; + + struct { + bool present; + uint8_t value; + } gsm_1900_assoc_radio_cap; + + bool umts_fdd_rat_cap; + bool umts_tdd_rat_cap; + bool cdma200_rat_cap; + + struct { + bool present; + uint8_t mslot_class; + bool single_slot_dtm; + struct { + bool present; + uint8_t mslot_class; + } dtm_egprs_multislot_cap; + } dtm_gprs_multislot_cap; + + struct { + bool present; + uint8_t value; + } single_band_supp; + + struct { + bool present; + uint8_t value; + } gsm_750_assoc_radio_cap; + + bool umts_1_28_mcps_tdd_rat_cap; + bool geran_feature_package; + + struct { + bool present; + uint8_t mslot_class; + struct { + bool present; + uint8_t mslot_class; + } extended_dtm_egprs_multislot_cap; + } extended_dtm_gprs_multislot_cap; + + struct { + bool present; + uint8_t value; + } high_multislot_cap; + + bool geran_feature_package_2; + uint8_t gmsk_multislot_power_prof; + uint8_t psk8_multislot_power_prof; + + struct { + bool present; + uint8_t value; + uint8_t assoc_radio_cap; + } t_gsm_400_bands_supp; + + uint8_t dl_advanced_rx_perf; + bool dtm_enhancements_cap; + + struct { + bool present; + uint8_t mslot_class; + bool offset_required; + struct { + bool present; + uint8_t mslot_class; + } dtm_egprs_high_multislot_cap; + } dtm_gprs_high_multislot_cap; + + bool repeated_acch_capability; + + struct { + bool present; + uint8_t value; + } gsm_710_assoc_radio_cap; + + struct { + bool present; + uint8_t value; + } t_gsm_810_assoc_radio_cap; + + bool ciphering_mode_setting_cap; + bool add_pos_cap; + bool e_utra_fdd_supp; + bool e_utra_tdd_supp; + bool e_utra_meas_rep_supp; + bool prio_resel_supp; + bool utra_csg_cells_rep; + + uint8_t vamos_level; + uint8_t tighter_capability; + + bool sel_ciph_dl_sacch; + + uint8_t cs_ps_srvcc_geran_utra; + uint8_t cs_ps_srvcc_geran_eutra; + + bool geran_net_sharing; + bool e_utra_wb_rsrq_meas_supp; + bool er_band_support; + bool utra_mult_band_ind_supp; + bool e_utra_mult_band_ind_supp; + bool extended_tsc_set_cap_supp; + bool extended_earfcn_val_range; +}; + struct osmo_gsm48_classmark { bool classmark1_set; struct gsm48_classmark1 classmark1; @@ -111,7 +280,7 @@ struct gsm48_range_1024 { uint8_t w16:6, w15_lo:2; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t form_id:5, f0:1, w1_hi:2; uint8_t w1_lo; uint8_t w2_hi; @@ -166,7 +335,7 @@ struct gsm48_range_512 { uint8_t w17:5, w16_lo:3; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t form_id:7, orig_arfcn_hi:1; uint8_t orig_arfcn_mid; uint8_t orig_arfcn_lo:1, w1_hi:7; @@ -227,7 +396,7 @@ struct gsm48_range_256 { w21:4, w20_lo:3; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t form_id:7, orig_arfcn_hi:1; uint8_t orig_arfcn_mid; uint8_t orig_arfcn_lo:1, w1_hi:7; @@ -290,7 +459,7 @@ struct gsm48_range_128 { w27:3, w26_lo:1; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t form_id:7, orig_arfcn_hi:1; uint8_t orig_arfcn_mid; uint8_t orig_arfcn_lo:1, w1:7; @@ -320,7 +489,7 @@ struct gsm48_var_bit { orig_arfcn_lo:1; uint8_t rrfcn8_111[13]; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t form_id:7, orig_arfcn_hi:1; uint8_t orig_arfcn_mid; uint8_t orig_arfcn_lo:1, rrfcn1_7:7; @@ -340,7 +509,7 @@ struct gsm48_chan_desc { uint8_t hsn:6, maio_low:2; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t tsc:3, h:1, maio_high:4; uint8_t maio_low:2, hsn:6; #endif @@ -353,7 +522,7 @@ struct gsm48_chan_desc { tsc:3; uint8_t arfcn_low; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t tsc:3, h:1, spare:2, arfcn_high:2; uint8_t arfcn_low; #endif @@ -404,7 +573,7 @@ struct gsm48_meas_res { uint8_t bsic_nc6:6, bcch_f_nc6_lo:2; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t ba_used:1, dtx_used:1, rxlev_full:6; uint8_t spare:1, meas_valid:1, rxlev_sub:6; uint8_t spare2:1, rxqual_full:3, rxqual_sub:3, no_nc_n_hi:1; @@ -424,6 +593,12 @@ struct gsm48_meas_res { #endif } __attribute__ ((packed)); +/*! Check if the given mr contains valid measurement results */ +static inline bool gsm48_meas_res_is_valid(const struct gsm48_meas_res *mr) +{ + return (mr->meas_valid == 0); /* 0 means valid */ +} + /* Chapter 10.5.2.21aa */ struct gsm48_multi_rate_conf { #if OSMO_IS_LITTLE_ENDIAN @@ -441,7 +616,7 @@ struct gsm48_multi_rate_conf { m10_2 : 1, m12_2 : 1; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t ver:3, nscb:1, icmi:1, spare:1, smod:2; 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; #endif @@ -454,7 +629,7 @@ struct gsm48_power_cmd { spare:2, atc:1; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t atc:1, spare:2, power_level:5; #endif } __attribute__((packed)); @@ -469,7 +644,7 @@ struct gsm48_rach_control { uint8_t t2; /* ACC 8-15 barred flags */ uint8_t t3; /* ACC 0-7 barred flags */ #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t max_trans:2, tx_integer:4, cell_bar:1, re:1; uint8_t t2; uint8_t t3; @@ -527,7 +702,7 @@ struct gsm48_req_ref { uint8_t t2:5, t3_low:3; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t ra; uint8_t t1:5, t3_high:3; uint8_t t3_low:3, t2:5; @@ -542,7 +717,7 @@ struct gsm48_start_time { uint8_t t2:5, t3_low:3; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t t1:5, t3_high:3; uint8_t t3_low:3, t2:5; #endif @@ -556,7 +731,7 @@ struct gsm48_sync_ind { nci:1, sync_ie:4; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t sync_ie:4, nci:1, rot:1, si:2; #endif } __attribute__((packed)); @@ -571,15 +746,59 @@ struct gsm48_chan_mode_modify { uint8_t mode; } __attribute__ ((packed)); +/*! 10.5.2.6 Channel Mode value */ enum gsm48_chan_mode { + /*! Signalling only (TCH/F or TCH/H) */ GSM48_CMODE_SIGN = 0x00, + /*! Speech: FR (TCH/FS) or HR (TCH/HS) */ GSM48_CMODE_SPEECH_V1 = 0x01, - GSM48_CMODE_SPEECH_EFR = 0x21, - GSM48_CMODE_SPEECH_AMR = 0x41, + /*! Speech: EFR (TCH/EFS) */ + GSM48_CMODE_SPEECH_EFR = 0x21, /*!< a.k.a. V2 */ + /*! Speech: AMR (TCH/AFS or TCH/AHS) */ + GSM48_CMODE_SPEECH_AMR = 0x41, /*!< a.k.a. V3 */ + /*! Speech: OFR AMR-WB (O-TCH/WFS) or OHR AMR-WB (O-TCH/WHS) */ + GSM48_CMODE_SPEECH_V4 = 0x81, + /*! Speech: FR AMR-WB (TCH/WFS) */ + GSM48_CMODE_SPEECH_V5 = 0x82, + /*! Speech: OHR AMR (O-TCH/AHS) */ + GSM48_CMODE_SPEECH_V6 = 0x83, + + /* ECSD: 43.5 kbit/s (DL) + 14.5 kbit/s (UL) */ + GSM48_CMODE_DATA_43k5_14k5 = 0x61, + /* ECSD: 29.0 kbit/s (DL) + 14.5 kbit/s (UL) */ + GSM48_CMODE_DATA_29k0_14k5 = 0x62, + /* ECSD: 43.5 kbit/s (DL) + 29.0 kbit/s (UL) */ + GSM48_CMODE_DATA_43k5_29k0 = 0x64, + /* ECSD: 14.5 kbit/s (DL) + 43.5 kbit/s (UL) */ + GSM48_CMODE_DATA_14k5_43k5 = 0x67, + /* ECSD: 14.5 kbit/s (DL) + 29.0 kbit/s (UL) */ + GSM48_CMODE_DATA_14k5_29k0 = 0x65, + /* ECSD: 29.0 kbit/s (DL) + 43.5 kbit/s (UL) */ + GSM48_CMODE_DATA_29k0_43k5 = 0x66, + + /*! ECSD: 43.5 kbit/s radio interface rate, 43.2 kbit/s services (E-TCH/F43.2) */ + GSM48_CMODE_DATA_43k5 = 0x27, + /*! ECSD: 32.0 kbit/s radio interface rate, 32.0 kbit/s services (E-TCH/F32.0) */ + GSM48_CMODE_DATA_32k0 = 0x63, + /*! ECSD: 29.0 kbit/s radio interface rate, 28.8 kbit/s services (E-TCH/F28.8) */ + GSM48_CMODE_DATA_29k0 = 0x43, + /*! CSD: 14.5 kbit/s radio interface rate, 14.4 kbit/s services (TCH/F14.4) */ GSM48_CMODE_DATA_14k5 = 0x0f, + /*! CSD: 12.0 kbit/s radio interface rate, 9.6 kbit/s services (TCH/F9.6) */ GSM48_CMODE_DATA_12k0 = 0x03, + /*! CSD: 6.0 kbit/s radio interface rate, 4.8 kbit/s services (TCH/{F,H}4.8) */ GSM48_CMODE_DATA_6k0 = 0x0b, + /*! CSD: 3.6 kbit/s radio interface rate, 2.4 kbit/s and less services (TCH/{F,H}2.4) */ GSM48_CMODE_DATA_3k6 = 0x13, + + /*! Same as GSM48_CMODE_SPEECH_V1, in VAMOS mode */ + GSM48_CMODE_SPEECH_V1_VAMOS = 0xc1, + /*! Same as GSM48_CMODE_SPEECH_EFR, in VAMOS mode */ + GSM48_CMODE_SPEECH_V2_VAMOS = 0xc2, + /*! Same as GSM48_CMODE_SPEECH_AMR, in VAMOS mode */ + GSM48_CMODE_SPEECH_V3_VAMOS = 0xc3, + /*! Speech: GSM48_CMODE_SPEECH_V5, in VAMOS mode */ + GSM48_CMODE_SPEECH_V5_VAMOS = 0xc5, }; extern const struct value_string gsm48_chan_mode_names[]; @@ -618,7 +837,7 @@ struct gsm48_cell_desc { arfcn_hi:2; uint8_t arfcn_lo; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t arfcn_hi:2, ncc:3, bcc:3; uint8_t arfcn_lo; #endif @@ -661,7 +880,7 @@ struct gsm48_pag_resp { uint8_t mi_len; uint8_t mi[0]; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t key_seq:4, spare:4; union { uint32_t classmark2; @@ -688,7 +907,7 @@ struct gsm48_auth_req { spare:4; uint8_t rand[16]; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t spare:4, key_seq:4; uint8_t rand[16]; #endif @@ -709,7 +928,7 @@ struct gsm48_loc_upd_req { uint8_t mi_len; uint8_t mi[0]; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t key_seq:4, type:4; struct gsm48_loc_area_id lai; struct gsm48_classmark1 classmark1; @@ -725,6 +944,20 @@ struct gsm48_hdr { uint8_t data[0]; } __attribute__ ((packed)); +/* Short header */ +struct gsm48_hdr_sh { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t l2_header:2, /* < short layer 2 header : bit(2) > See 3GPP TS 44.006 §6.4a */ + msg_type:5, /* < message type : bit(5) > See 3GPP TS 44.018 Table 10.4.2 */ + rr_short_pd:1; /* < RR short PD : bit > See 3GPP TS 24.007 §11.3.2 */ + uint8_t data[0]; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t rr_short_pd:1, msg_type:5, l2_header:2; + uint8_t data[0]; +#endif +} __attribute__ ((packed)); + /* Section 9.1.3x System information Type header */ struct gsm48_system_information_type_header { #if OSMO_IS_LITTLE_ENDIAN @@ -733,7 +966,7 @@ struct gsm48_system_information_type_header { skip_indicator:4; uint8_t system_information; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t l2_plen; uint8_t skip_indicator:4, rr_protocol_discriminator:4; uint8_t system_information; @@ -749,7 +982,7 @@ struct gsm48_cell_sel_par { neci:1, acs:1; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t cell_resel_hyst:3, ms_txpwr_max_ccch:5; uint8_t acs:1, neci:1, rxlev_acc_min:6; #endif @@ -768,7 +1001,7 @@ struct gsm48_control_channel_descr { spare_2 :1; uint8_t t3212; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t mscr:1, att:1, bs_ag_blks_res:3, ccch_conf:3; uint8_t spare_2:1, cbq3:2, spare_1:2, bs_pa_mfrms:3; uint8_t t3212; @@ -791,7 +1024,7 @@ struct gsm48_cell_options { /* either DN-IND or top bit of DTX IND */ d:1; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t d:1, pwrc:1, dtx:2, radio_link_timeout:4; #endif } __attribute__ ((packed)); @@ -812,7 +1045,7 @@ struct gsm48_service_request { uint8_t mi[0]; /* optional priority level */ #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t cipher_key_seq:4, cm_service_type:4; union { uint32_t classmark; @@ -895,7 +1128,7 @@ struct gsm48_system_information_type_5 { uint8_t system_information; uint8_t bcch_frequency_list[16]; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t skip_indicator:4, rr_protocol_discriminator:4; uint8_t system_information; uint8_t bcch_frequency_list[16]; @@ -910,7 +1143,7 @@ struct gsm48_system_information_type_5bis { uint8_t system_information; uint8_t bcch_frequency_list[16]; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t skip_indicator:4, rr_protocol_discriminator:4; uint8_t system_information; uint8_t bcch_frequency_list[16]; @@ -925,7 +1158,7 @@ struct gsm48_system_information_type_5ter { uint8_t system_information; uint8_t bcch_frequency_list[16]; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t skip_indicator:4, rr_protocol_discriminator:4; uint8_t system_information; uint8_t bcch_frequency_list[16]; @@ -944,7 +1177,7 @@ struct gsm48_system_information_type_6 { uint8_t ncc_permitted; uint8_t rest_octets[0]; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t skip_indicator:4, rr_protocol_discriminator:4; uint8_t system_information; uint16_t cell_identity; @@ -955,6 +1188,27 @@ struct gsm48_system_information_type_6 { #endif } __attribute__ ((packed)); +/* Section 9.1.50 System Information type 10 (ASCI) */ +struct gsm48_system_information_type_10 { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t l2_header:2, /* < short layer 2 header : bit(2) > See 3GPP TS 44.006 §6.4a */ + msg_type:5, /* < message type : bit(5) > See 3GPP TS 44.018 Table 10.4.2 */ + rr_short_pd:1; /* < RR short PD : bit > See 3GPP TS 24.007 §11.3.2 */ + uint8_t rest_octets[0]; /* < SI10 Rest Octets : bit(160) > See 3GPP TS 44.018 §10.5.2.44 */ +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t rr_short_pd:1, msg_type:5, l2_header:2; + uint8_t rest_octets[0]; +#endif +} __attribute__ ((packed)); + +/* TS 44.018 Section 9.1.49 */ +struct gsm0408_vgcs_ul_grant { + struct gsm48_hdr hdr; + struct gsm48_req_ref req_ref; + uint8_t ta; +} __attribute__ ((packed)); + /* Section 9.1.43a System Information type 13 */ struct gsm48_system_information_type_13 { struct gsm48_system_information_type_header header; @@ -1010,7 +1264,7 @@ struct gsm48_cip_mode_cmd { cr:1, spare:3; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t spare:3, cr:1, alg_id:3, sc:1; #endif } __attribute__((packed)); @@ -1055,6 +1309,14 @@ struct gsm48_imm_ass_rej { uint8_t rest[0]; } __attribute__ ((packed)); +/* Section 9.1.21b */ +struct gsm48_notification_nch { + uint8_t l2_plen; + uint8_t proto_discr; + uint8_t msg_type; + uint8_t data[0]; +} __attribute__((packed)); + /* Section 9.1.22 */ struct gsm48_paging1 { #if OSMO_IS_LITTLE_ENDIAN @@ -1067,7 +1329,7 @@ struct gsm48_paging1 { cneed2:2; uint8_t data[0]; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t l2_plen; uint8_t proto_discr; uint8_t msg_type; @@ -1090,7 +1352,7 @@ struct gsm48_paging2 { uint32_t tmsi2; uint8_t data[0]; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t l2_plen; uint8_t proto_discr; uint8_t msg_type; @@ -1120,7 +1382,7 @@ struct gsm48_paging3 { spare2:4; uint8_t rest[0]; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t l2_plen; uint8_t proto_discr; uint8_t msg_type; @@ -1143,7 +1405,7 @@ struct gsm48_pag_rsp { struct gsm48_classmark2 cm2; uint8_t data[0]; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t spare:5, key_seq:3; uint8_t cm2_len; struct gsm48_classmark2 cm2; @@ -1156,6 +1418,18 @@ struct gsm48_rr_status { uint8_t rr_cause; } __attribute__((packed)); +/* Section 9.1.44 */ +struct gsm48_talker_indication { + uint8_t cm2_len; + struct gsm48_classmark2 cm2; + uint8_t data[0]; +} __attribute__((packed)); + +/* Section 9.1.48 */ +struct gsm48_uplink_release { + uint8_t rr_cause; +} __attribute__((packed)); + /* Section 10.2 + GSM 04.07 12.2.3.1.1 + 3GPP TS 24.007 11.2.3.1.1 */ #define GSM48_PDISC_GROUP_CC 0x00 #define GSM48_PDISC_BCAST_CC 0x01 @@ -1174,6 +1448,9 @@ struct gsm48_rr_status { #define GSM48_PDISC_TEST 0x0f /* as per 11.10, 04.14 */ #define GSM48_PDISC_MASK 0x0f +/* Section 11.3.2.1 3GPP TS 24.007: Short PDISC */ +#define GSM48_PDISC_SH_RR 0 + extern const struct value_string gsm48_pdisc_names[]; static inline const char *gsm48_pdisc_name(uint8_t val) { return get_value_string(gsm48_pdisc_names, val); } @@ -1361,6 +1638,21 @@ void gsm48_set_dtx(struct gsm48_cell_options *op, enum gsm48_dtx_mode full, #define GSM48_MT_RR_APP_INFO 0x38 +/* 3GPP TS 44.018 Table 10.4.2 */ +#define GSM48_MT_RR_SH_SI10 0x0 +#define GSM48_MT_RR_SH_FACCH 0x1 +#define GSM48_MT_RR_SH_UL_FREE 0x2 +#define GSM48_MT_RR_SH_MEAS_REP 0x4 +#define GSM48_MT_RR_SH_MEAS_INFO 0x5 +#define GSM48_MT_RR_SH_VGCS_RECON 0x6 +#define GSM48_MT_RR_SH_VGCS_RECON2 0x7 +#define GSM48_MT_RR_SH_VGCS_INFO 0x8 +#define GSM48_MT_RR_SH_VGCS_SMS 0x9 +#define GSM48_MT_RR_SH_SI10bis 0xA +#define GSM48_MT_RR_SH_SI10ter 0xB +#define GSM48_MT_RR_SH_VGCS_NEIGH 0xC +#define GSM48_MT_RR_SH_APP_DATA 0xD + /* Table 10.2/3GPP TS 04.08 */ #define GSM48_MT_MM_IMSI_DETACH_IND 0x01 #define GSM48_MT_MM_LOC_UPD_ACCEPT 0x02 @@ -1526,6 +1818,10 @@ static inline const char *osmo_lu_type_name(uint8_t lu_type) #define GSM48_IE_FRQSHORT_AFTER 0x02 #define GSM48_IE_MUL_RATE_CFG 0x03 /* 10.5.2.21aa */ #define GSM48_IE_FREQ_L_AFTER 0x05 +#define GSM48_IE_GROUP_CIP_SEQ_HO 0x08 /* HO = Half Octet Tag */ +#define GSM48_IE_CIP_MODE_SET_HO 0x09 /* HO = Half Octet Tag */ +#define GSM48_IE_GPRS_RESUMPT_HO 0xc0 /* HO = Half Octet Tag */ +#define GSM48_IE_SYNC_IND_HO 0x0d /* HO = Half Octet Tag */ #define GSM48_IE_MSLOT_DESC 0x10 #define GSM48_IE_CHANMODE_2 0x11 #define GSM48_IE_FRQSHORT_BEFORE 0x12 @@ -1556,6 +1852,7 @@ static inline const char *osmo_lu_type_name(uint8_t lu_type) #define GSM48_IE_CHDES_2_AFTER 0x64 #define GSM48_IE_MODE_SEC_CH 0x66 #define GSM48_IE_F_CH_SEQ_AFTER 0x69 +#define GSM48_IE_EXTENDED_TSC_SET 0x6d #define GSM48_IE_MA_AFTER 0x72 #define GSM48_IE_BA_RANGE 0x73 #define GSM48_IE_GROUP_CHDES 0x74 @@ -1566,20 +1863,21 @@ static inline const char *osmo_lu_type_name(uint8_t lu_type) #define GSM48_IE_START_TIME 0x7c #define GSM48_IE_INDIVIDUAL_PRIORITIES 0x7c /* 44.018 Section 9.1.7 */ #define GSM48_IE_TIMING_ADVANCE 0x7d -#define GSM48_IE_GROUP_CIP_SEQ 0x80 -#define GSM48_IE_CIP_MODE_SET 0x90 -#define GSM48_IE_GPRS_RESUMPT 0xc0 -#define GSM48_IE_SYNC_IND 0xd0 +#define GSM48_IE_GROUP_CIP_SEQ 0x80 /* DEPRECATED, use GSM48_IE_GROUP_CIP_SEQ_HO instead */ +#define GSM48_IE_CIP_MODE_SET 0x90 /* DEPRECATED, use GSM48_IE_CIP_MODE_SET_HO instead */ +#define GSM48_IE_GPRS_RESUMPT 0xc0 /* DEPRECATED, use GSM48_IE_GPRS_RESUMPT_HO instead */ +#define GSM48_IE_SYNC_IND 0xd0 /* DEPRECATED, use GSM48_IE_SYNC_IND_HO instead */ /* System Information 4 (types are equal IEs above) */ #define GSM48_IE_CBCH_CHAN_DESC 0x64 #define GSM48_IE_CBCH_MOB_AL 0x72 /* Additional MM elements */ +#define GSM48_IE_PRIORITY_LEV_HO 0x08 /* HO = Half Octet Tag */ #define GSM48_IE_LOCATION_AREA 0x13 #define GSM48_IE_AUTN 0x20 #define GSM48_IE_AUTH_RES_EXT 0x21 #define GSM48_IE_AUTS 0x22 -#define GSM48_IE_PRIORITY_LEV 0x80 +#define GSM48_IE_PRIORITY_LEV 0x80 /* DEPRECATED, use GSM48_IE_PRIORITY_LEV_HO instead */ #define GSM48_IE_FOLLOW_ON_PROC 0xa1 #define GSM48_IE_CTS_PERMISSION 0xa2 @@ -1638,9 +1936,12 @@ enum gsm48_rr_cause { GSM48_RR_CAUSE_ABNORMAL_TIMER = 0x03, GSM48_RR_CAUSE_ABNORMAL_NOACT = 0x04, GSM48_RR_CAUSE_PREMPTIVE_REL = 0x05, + GSM48_RR_CAUSE_UTRAN_CFG_UNK = 0x06, GSM48_RR_CAUSE_HNDOVER_IMP = 0x08, GSM48_RR_CAUSE_CHAN_MODE_UNACCT = 0x09, GSM48_RR_CAUSE_FREQ_NOT_IMPL = 0x0a, + GSM48_RR_CAUSE_LEAVE_GROUP_CA = 0x0b, + GSM48_RR_CAUSE_LOW_LEVEL_FAIL = 0x0c, GSM48_RR_CAUSE_CALL_CLEARED = 0x41, GSM48_RR_CAUSE_SEMANT_INCORR = 0x5f, GSM48_RR_CAUSE_INVALID_MAND_INF = 0x60, @@ -1909,8 +2210,31 @@ enum gsm48_bcap_modem_type { GSM48_BCAP_MT_AUTO_1 = 8, }; +/*! Table 10.5.112/3GPP TS 24.008: Other modem type (octet 6d) */ +enum gsm48_bcap_other_modem_type { + GSM48_BCAP_OTHER_MT_NONE = 0, /*!< No other modem type specified */ + GSM48_BCAP_OTHER_MT_V34 = 2, /*!< According to ITU-T Rec. V.34 */ +}; + +/*! Table 10.5.112/3GPP TS 24.008: Fixed network user rate (octet 6d) */ +enum gsm48_bcap_fixed_net_user_rate { + GSM48_BCAP_FNUR_NONE = 0, /*!< FNUR not applicable / No meaning associated */ + GSM48_BCAP_FNUR_X1_V110_9600 = 1, /*!< 9.6 kbit/s (according to ITU-T Rec. X.1 and V.110) */ + GSM48_BCAP_FNUR_X1_V110_14400 = 2, /*!< 14.4 kbit/s (according to ITU-T Rec. X.1 and V.110) */ + GSM48_BCAP_FNUR_X1_V110_19200 = 3, /*!< 19.2 kbit/s (according to ITU-T Rec. X.1 and V.110) */ + GSM48_BCAP_FNUR_X1_V110_28800 = 4, /*!< 28.8 kbit/s (according to ITU-T Rec. X.1 and V.110) */ + GSM48_BCAP_FNUR_X1_V110_38400 = 5, /*!< 38.4 kbit/s (according to ITU-T Rec. X.1 and V.110) */ + GSM48_BCAP_FNUR_X1_V110_48000 = 6, /*!< 48.0 kbit/s (according to ITU-T Rec. X.1 and V.110) */ + GSM48_BCAP_FNUR_X1_V110_56000 = 7, /*!< 56.0 kbit/s (according to ITU-T Rec. X.1 and V.110) */ + GSM48_BCAP_FNUR_BT_64000 = 8, /*!< 64.0 kbit/s bit transparent */ + GSM48_BCAP_FNUR_BT_33600 = 9, /*!< 33.6 kbit/s bit transparent */ + GSM48_BCAP_FNUR_I460_32000 = 10, /*!< 32.0 kbit/s (according to ITU-T Rec. I.460) */ + GSM48_BCAP_FNUR_V34_31200 = 11, /*!< 31.2 kbit/s (according to ITU-T Rec. V.34) */ +}; + /*! GSM 04.08 Bearer Capability: Speech Version Indication - * (See also 3GPP TS 24.008, Table 10.5.103) */ + * (See also 3GPP TS 24.008, Table 10.5.103 + * and 3GPP TS 26.103, Table 4.1 "Support of Codec Types in Radio Access Technologies") */ enum gsm48_bcap_speech_ver { GSM48_BCAP_SV_FR = 0, /*!< GSM FR V1 (GSM FR) */ GSM48_BCAP_SV_HR = 1, /*!< GSM HR V1 (GSM HR) */ diff --git a/include/osmocom/gsm/protocol/gsm_04_08_gprs.h b/include/osmocom/gsm/protocol/gsm_04_08_gprs.h index 86c5b016..2671aafb 100644 --- a/include/osmocom/gsm/protocol/gsm_04_08_gprs.h +++ b/include/osmocom/gsm/protocol/gsm_04_08_gprs.h @@ -1,7 +1,6 @@ /*! \file gsm_04_08_gprs.h */ -#ifndef _GSM48_GPRS_H -#define _GSM48_GPRS_H +#pragma once #include <stdint.h> #include <stdbool.h> @@ -83,6 +82,8 @@ extern const struct value_string *gprs_upd_t_strs; enum gsm48_gprs_ie_mm { GSM48_IE_GMM_CIPH_CKSN = 0x08, /* 10.5.1.2 */ + GSM48_IE_GMM_PTMSI_TYPE = 0x0e, /* 10.5.5.29 */ + GSM48_IE_GMM_TMSI_BASED_NRI_C = 0x10, /* 10.5.5.31 */ GSM48_IE_GMM_TIMER_READY = 0x17, /* 10.5.7.3 */ GSM48_IE_GMM_ALLOC_PTMSI = 0x18, /* 10.5.1.4 */ GSM48_IE_GMM_PTMSI_SIG = 0x19, /* 10.5.5.8 */ @@ -90,26 +91,39 @@ enum gsm48_gprs_ie_mm { GSM48_IE_GMM_AUTH_SRES = 0x22, /* 10.5.3.2 */ GSM48_IE_GMM_IMEISV = 0x23, /* 10.5.1.4 */ GSM48_IE_GMM_CAUSE = 0x25, /* 10.5.5.14 */ + GSM48_IE_GMM_RX_NPDU_NUM_LIST = 0x26, /* 10.5.5.11 */ GSM48_IE_GMM_DRX_PARAM = 0x27, /* 10.5.5.6 */ GSM48_IE_GMM_AUTN = 0x28, /* 10.5.3.1.1 */ GSM48_IE_GMM_AUTH_RES_EXT = 0x29, /* 10.5.3.2.1 */ + GSM48_IE_GMM_TIMER_T3302 = 0x2A, /* 10.5.7.4 */ GSM48_IE_GMM_AUTH_FAIL_PAR = 0x30, /* 10.5.3.2.2 */ GSM48_IE_GMM_MS_NET_CAPA = 0x31, /* 10.5.5.12 */ GSM48_IE_GMM_PDP_CTX_STATUS = 0x32, /* 10.5.7.1 */ GSM48_IE_GMM_PS_LCS_CAPA = 0x33, /* 10.5.5.22 */ GSM48_IE_GMM_GMM_MBMS_CTX_ST = 0x35, /* 10.5.7.6 */ + GSM48_IE_GMM_TIMER_T3346 = 0x3A, /* 10.5.7.4 */ + GSM48_IE_GMM_NET_FEAT_SUPPORT = 0xB0, /* 10.5.5.23 */ }; enum gsm48_gprs_ie_sm { + GSM48_IE_GSM_RADIO_PRIO = 0x08, /* 10.5.7.2 */ + GSM48_IE_GSM_DEV_PROP = 0x0C, /* 10.5.7.8 */ GSM48_IE_GSM_APN = 0x28, /* 10.5.6.1 */ GSM48_IE_GSM_PROTO_CONF_OPT = 0x27, /* 10.5.6.3 */ GSM48_IE_GSM_PDP_ADDR = 0x2b, /* 10.5.6.4 */ GSM48_IE_GSM_AA_TMR = 0x29, /* 10.5.7.3 */ + GSM48_IE_GSM_QOS = 0x30, /* 10.5.6.5 */ + GSM48_IE_GSM_TFT = 0x31, /* 10.5.6.12 */ + GSM48_IE_GSM_LLC_SAPI = 0x32, /* 10.5.6.9 */ + GSM48_IE_GSM_MBIFOM_CONT = 0x33, /* 10.5.6.21 */ + GSM48_IE_GSM_PFI = 0x34, /* 10.5.6.11 */ GSM48_IE_GSM_NAME_FULL = 0x43, /* 10.5.3.5a */ GSM48_IE_GSM_NAME_SHORT = 0x45, /* 10.5.3.5a */ GSM48_IE_GSM_TIMEZONE = 0x46, /* 10.5.3.8 */ GSM48_IE_GSM_UTC_AND_TZ = 0x47, /* 10.5.3.9 */ GSM48_IE_GSM_LSA_ID = 0x48, /* 10.5.3.11 */ + GSM48_IE_GSM_EXT_QOS = 0x5C, /* 10.5.6.5B */ + GSM48_IE_GSM_EXT_PROTO_CONF_OPT = 0x7B, /* 10.5.6.3a */ /* Fake IEs that are not present on the Layer3 air interface, * but which we use to simplify internal APIs */ @@ -128,7 +142,7 @@ struct gsm48_ra_upd_ack { struct gsm48_ra_id ra_id; /* 10.5.5.15 */ uint8_t data[0]; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t upd_result:4, force_stby:4; uint8_t ra_upd_timer; struct gsm48_ra_id ra_id; @@ -157,7 +171,7 @@ struct gsm48_attach_ack { struct gsm48_ra_id ra_id; /* 10.5.5.15 */ uint8_t data[0]; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t force_stby:4, att_result:4; uint8_t ra_upd_timer; uint8_t radio_prio; @@ -175,7 +189,7 @@ struct gsm48_auth_ciph_req { ac_ref_nr:4; /* 10.5.5.19 */ uint8_t data[0]; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t imeisv_req:4, ciph_alg:4; uint8_t ac_ref_nr:4, force_stby:4; uint8_t data[0]; @@ -189,7 +203,7 @@ struct gsm48_auth_ciph_resp { spare:4; uint8_t data[0]; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t spare:4, ac_ref_nr:4; uint8_t data[0]; #endif @@ -280,17 +294,52 @@ enum gsm48_pdp_state { PDP_S_MODIFY_PENDING, }; -/* Table 10.5.155/3GPP TS 24.008 */ +/* TS 24.008 Table 10.5.155/3GPP */ enum gsm48_pdp_type_org { PDP_TYPE_ORG_ETSI = 0x00, PDP_TYPE_ORG_IETF = 0x01, + PDP_TYPE_ORG_EMPTY = 0x0f, }; enum gsm48_pdp_type_nr { PDP_TYPE_N_ETSI_RESERVED = 0x00, PDP_TYPE_N_ETSI_PPP = 0x01, PDP_TYPE_N_IETF_IPv4 = 0x21, PDP_TYPE_N_IETF_IPv6 = 0x57, + PDP_TYPE_N_IETF_IPv4v6 = 0x8D, }; +/* TS 24.008 10.5.6.4 "Packet data protocol address" value + * Note: This can be reused for 3GPP TS 29.060 7.7.27 "End User Address" + * with minor changes in the values, like spare being 1111 instead. +*/ +struct gsm48_pdp_address { +#if OSMO_IS_LITTLE_ENDIAN +uint8_t organization:4, /* enum gsm48_pdp_type_org */ + spare:4; /* 0000 */ +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ +uint8_t spare:4, organization:4; +#endif +uint8_t type; /* enum gsm48_pdp_type_nr */ + union { + /* PDP_TYPE_ORG_ETSI */ + union { + } etsi; + /* PDP_TYPE_ORG_IETF */ + union { + /* PDP_TYPE_N_IETF_IPv4 */ + uint32_t v4; + + /* PDP_TYPE_N_IETF_IPv6 */ + uint8_t v6[16]; + + /* PDP_TYPE_N_IETF_IPv4v6 */ + struct { + uint32_t v4; + uint8_t v6[16]; + } __attribute__ ((packed)) v4v6; + } ietf; + }; +} __attribute__ ((packed)); /* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */ enum gsm48_qos_reliab_class { @@ -463,6 +512,3 @@ struct gsm48_qos { /* octet 16 */ uint8_t guar_bitrate_down_ext; }; - - -#endif /* _GSM48_GPRS_H */ diff --git a/include/osmocom/gsm/protocol/gsm_04_11.h b/include/osmocom/gsm/protocol/gsm_04_11.h index 31f25acb..90543020 100644 --- a/include/osmocom/gsm/protocol/gsm_04_11.h +++ b/include/osmocom/gsm/protocol/gsm_04_11.h @@ -62,6 +62,16 @@ enum gsm411_rp_ie { GSM411_IE_RP_CAUSE = 0x42, /* 8.2.5.4 */ }; +/* Sections 8.2.5.1 and 8.2.5.2 set limits on the length of an SMSC-address. + * The spec states these limits in terms of min and max values of the length + * octet in type 4 IEs SM-RP-OA and SM-RP-DA; these IE length limits translate + * into a minimum of 1 digit and a maximum of 20 digits. + */ +#define GSM411_SMSC_ADDR_MIN_OCTETS 2 +#define GSM411_SMSC_ADDR_MAX_OCTETS 11 +#define GSM411_SMSC_ADDR_MIN_DIGITS 1 +#define GSM411_SMSC_ADDR_MAX_DIGITS 20 + /* Chapter 8.2.5.4 Table 8.4 */ enum gsm411_rp_cause { /* valid only for MO */ diff --git a/include/osmocom/gsm/protocol/gsm_04_12.h b/include/osmocom/gsm/protocol/gsm_04_12.h index 3f34ee7f..17ac6454 100644 --- a/include/osmocom/gsm/protocol/gsm_04_12.h +++ b/include/osmocom/gsm/protocol/gsm_04_12.h @@ -23,7 +23,7 @@ struct gsm412_block_type { lpd : 2, spare : 1; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t spare:1, lpd:2, lb:1, seq_nr:4; #endif } __attribute__((packed)); @@ -37,7 +37,7 @@ struct gsm412_sched_msg { uint8_t cbsms_msg_map[6]; uint8_t data[0]; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t type:2, beg_slot_nr:6; uint8_t spare2:1, spare1:1, end_slot_nr:6; uint8_t cbsms_msg_map[6]; diff --git a/include/osmocom/gsm/protocol/gsm_04_14.h b/include/osmocom/gsm/protocol/gsm_04_14.h index deb474ec..dddec519 100644 --- a/include/osmocom/gsm/protocol/gsm_04_14.h +++ b/include/osmocom/gsm/protocol/gsm_04_14.h @@ -30,7 +30,7 @@ struct gsm414_close_mslot_loop_cmd { loop_mech:3, tn:3; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t tn:3, loop_mech:3, chc:2; #endif } __attribute__((packed)); @@ -43,7 +43,7 @@ struct gsm414_close_mslot_loop_ack { chc:2, spare:2; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t spare:2, chc:2, loop_mech:3, err_ind:1; #endif } __attribute__((packed)); @@ -70,7 +70,7 @@ struct gsm414_gprs_test_mode_cmd { dl_tx_offset:3, _spare:4; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint16_t d:12, spare:3, l:1; @@ -86,7 +86,7 @@ struct gsm414_egprs_st_sb_loop_cmd { dl_tx_offset:3, m:1; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t m:1, dl_tx_offset:3, _spare:4; #endif } __attribute__((packed)); diff --git a/include/osmocom/gsm/protocol/gsm_08_08.h b/include/osmocom/gsm/protocol/gsm_08_08.h index 1390f0e8..45396566 100644 --- a/include/osmocom/gsm/protocol/gsm_08_08.h +++ b/include/osmocom/gsm/protocol/gsm_08_08.h @@ -25,6 +25,10 @@ enum CELL_IDENT { CELL_IDENT_UTRAN_PLMN_LAC_RNC = 8, CELL_IDENT_UTRAN_RNC = 9, CELL_IDENT_UTRAN_LAC_RNC = 10, + CELL_IDENT_SAI = 11, + + /* Not in 03.03 nor 08.08. Place them > 0x0f (discr_id is 4 bits) */ + CELL_IDENT_WHOLE_GLOBAL_PS = 128, /* CGI + RAC, TS 48.018 8c.1.4.1.1 */ }; /* Keep this misnamed CELL_IDENT for API backwards compatibility (see OS#3124). */ #define CELL_IDENT_LAI_AND_LAC CELL_IDENT_LAI @@ -46,12 +50,12 @@ struct dtap_header { uint8_t link_id; /* Backward compatibility */ struct { #if OSMO_IS_LITTLE_ENDIAN - uint8_t dlci_cc:2, + uint8_t dlci_sapi:3, /* enum gsm0406_dlci_sapi */ dlci_spare:3, - dlci_sapi:3; /* enum gsm0406_dlc_sapi */ + dlci_cc:2; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ - uint8_t dlci_sapi:3, dlci_spare:3, dlci_cc:2; +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t dlci_cc:2, dlci_spare:3, dlci_sapi:3; #endif }; }; @@ -164,12 +168,15 @@ enum BSS_MAP_MSG_TYPE { BSS_MAP_MSG_VGCS_VBS_QUEUING_INDICATION = 30, BSS_MAP_MSG_UPLINK_RQST = 31, BSS_MAP_MSG_UPLINK_RQST_ACKNOWLEDGE = 39, + BSS_MAP_MSG_VGCS_VBS_ASSIGNMENT_STATUS = 59, + BSS_MAP_MSG_VGCS_VBS_AREA_CELL_INFO = 60, BSS_MAP_MSG_UPLINK_RQST_CONFIRMATION = 73, BSS_MAP_MSG_UPLINK_RELEASE_INDICATION = 74, BSS_MAP_MSG_UPLINK_REJECT_CMD = 75, BSS_MAP_MSG_UPLINK_RELEASE_CMD = 76, BSS_MAP_MSG_UPLINK_SEIZED_CMD = 77, BSS_MAP_MSG_VGCS_ADDL_INFO = 0x60, + BSS_MAP_MSG_VGCS_SMS = 0x61, BSS_MAP_MSG_NOTIFICATION_DATA = 0x62, BSS_MAP_MSG_UPLINK_APP_DATA = 0x63, @@ -262,7 +269,7 @@ enum GSM0808_IE_CODING { GSM0808_IE_SEGMENTATION = 79, GSM0808_IE_SERVICE_HANDOVER = 80, GSM0808_IE_SOURCE_RNC_TO_TARGET_RNC_TRANSPARENT_UMTS = 81, - GSM0808_IE_SOURCE_RNC_TO_TARGET_RNC_TRANSPARENT_CDMA2000= 82, + GSM0808_IE_SOURCE_RNC_TO_TARGET_RNC_TRANSPARENT_CDMA2000 = 82, GSM0808_IE_RESERVED_5 = 65, GSM0808_IE_RESERVED_6 = 66, GSM0808_IE_GERAN_CLASSMARK = 0x53, @@ -325,12 +332,14 @@ enum GSM0808_IE_CODING { GSM0808_IE_PS_REGISTERED_OPERATOR = 0x99, GSM0808_IE_CS_REGISTERED_OPERATOR = 0x9a, - /* Osmocom extensions: */ + /* Osmocom and Themyscira extensions: */ GSM0808_IE_OSMO_OSMUX_SUPPORT = 0xf0, GSM0808_IE_OSMO_OSMUX_CID = 0xf1, + GSM0808_IE_THEMWI_RTP_EXTENSIONS = 0xf2, }; -/* 3GPP TS 48.008 3.2.3 Signalling Field Element Coding */ +/* 3GPP TS 48.008 3.2.3 Signalling Field Element Coding. + See also extra fields in 3.2.2.58 and 3.2.2.80 */ enum GSM0808_SIGNALLING_FIELD_ELEMENT_CODING { GSM0808_FE_IE_EXTRA_INFORMATION = 0x01, /*< 3.2.3.1 */ GSM0808_FE_IE_CURRENT_CHANNEL_TYPE_2 = 0x02, /*< 3.2.3.2 */ @@ -350,6 +359,8 @@ enum GSM0808_SIGNALLING_FIELD_ELEMENT_CODING { GSM0808_FE_IE_IRAT_MEASUREMENT_CONFIGURATION = 0x0f, /*< 3.2.3.16 */ GSM0808_FE_IE_SOURCE_CELL_ID = 0x10, /*< 3.2.3.17 */ GSM0808_FE_IE_IRAT_MEASUREMENT_CONFIGURATION_EXTENDED_E_ARFCNS = 0x11, /*< 3.2.3.18 */ + GSM0808_FE_IE_VGCS_TALKER_MODE = 0x6f, /*< 3.2.2.93 */ + GSM0808_FE_IE_LAST_USED_EUTRAN_PLMN_ID = 0x95, /*< 3.2.2.127 */ }; /* 3GPP TS 48.008 3.2.2.5 Cause */ @@ -436,13 +447,15 @@ enum gsm0808_chan_indicator { GSM0808_CHAN_SPEECH = 1, GSM0808_CHAN_DATA = 2, GSM0808_CHAN_SIGN = 3, + GSM0808_CHAN_SPEECH_CTM_TEXT_TELEPHONY = 4, }; /* GSM 08.08 3.2.2.11 Channel Type */ +#define GSM0808_DATA_FULL_RPREF GSM0808_DATA_FULL_PREF enum gsm0808_chan_rate_type_data { GSM0808_DATA_FULL_BM = 0x8, GSM0808_DATA_HALF_LM = 0x9, - GSM0808_DATA_FULL_RPREF = 0xa, + GSM0808_DATA_FULL_PREF = 0xa, GSM0808_DATA_HALF_PREF = 0xb, GSM0808_DATA_FULL_PREF_NO_CHANGE = 0x1a, GSM0808_DATA_HALF_PREF_NO_CHANGE = 0x1b, @@ -491,6 +504,42 @@ enum gsm0808_permitted_speech { GSM0808_PERM_HR6 = 0x45, /*!< OHR AMR */ }; +/* 3GPP TS 48.008 3.2.2.11 Channel Type + * Transparent: Data Rate */ +enum gsm0808_data_rate_transp { + GSM0808_DATA_RATE_TRANSP_32k0 = 0x3a, + GSM0808_DATA_RATE_TRANSP_28k8 = 0x39, + GSM0808_DATA_RATE_TRANSP_14k4 = 0x18, + GSM0808_DATA_RATE_TRANSP_9k6 = 0x10, + GSM0808_DATA_RATE_TRANSP_4k8 = 0x11, + GSM0808_DATA_RATE_TRANSP_2k4 = 0x12, + GSM0808_DATA_RATE_TRANSP_1k2 = 0x13, + GSM0808_DATA_RATE_TRANSP_600 = 0x14, + GSM0808_DATA_RATE_TRANSP_1200_75 = 0x15, +}; + +/* 3GPP TS 48.008 3.2.2.11 Channel Type + * Non-Transparent: Radio Interface Data Rate (preferred) */ +enum gsm0808_data_rate_non_transp { + GSM0808_DATA_RATE_NON_TRANSP_12000_6000 = 0x00, + GSM0808_DATA_RATE_NON_TRANSP_43k5 = 0x34, + GSM0808_DATA_RATE_NON_TRANSP_29k0 = 0x31, + GSM0808_DATA_RATE_NON_TRANSP_14k5 = 0x14, + GSM0808_DATA_RATE_NON_TRANSP_12k0 = 0x10, + GSM0808_DATA_RATE_NON_TRANSP_6k0 = 0x11, +}; + +/* 3GPP TS 48.008 3.2.2.11 Channel Type + * Non-Transparent: Allowed Radio Interface Data Rate (all possible allowed) */ +enum gsm0808_data_rate_allowed_r_if { + GSM0808_DATA_RATE_NON_TRANSP_ALLOWED_43k5 = 0x40, + GSM0808_DATA_RATE_NON_TRANSP_ALLOWED_32k0 = 0x20, + GSM0808_DATA_RATE_NON_TRANSP_ALLOWED_29k0 = 0x10, + GSM0808_DATA_RATE_NON_TRANSP_ALLOWED_14k5 = 0x08, + GSM0808_DATA_RATE_NON_TRANSP_ALLOWED_12k0 = 0x02, + GSM0808_DATA_RATE_NON_TRANSP_ALLOWED_6k0 = 0x01, +}; + extern const struct value_string gsm0808_permitted_speech_names[]; static inline const char *gsm0808_permitted_speech_name(enum gsm0808_permitted_speech val) { return get_value_string(gsm0808_permitted_speech_names, val); } @@ -509,6 +558,12 @@ enum gsm0808_speech_codec_type { GSM0808_SCT_CSD = 0xfd, /*!< CSData (see also TS 26.103) */ }; +/* Codec Extension (the real Codec Type follows in the next octet). + * This value is intentionally not included in gsm0808_speech_codec_type, + * because {enc,dec}_speech_codec() functions take care of the extended + * encoding internally. It shall not be used in struct gsm0808_speech_codec. */ +#define GSM0808_SCT_EXT 0x0f + extern const struct value_string gsm0808_speech_codec_type_names[]; static inline const char *gsm0808_speech_codec_type_name(enum gsm0808_speech_codec_type val) { return get_value_string(gsm0808_speech_codec_type_names, val); } @@ -533,11 +588,16 @@ enum gsm0808_paging_info { GSM0808_PAGINF_FOR_USSD = 0x02, }; -/*! 3GPP TS 48.008 3.2.2.104 Speech Codec */ +/*! 3GPP TS 48.008 3.2.2.104 Speech Codec. + * Valid if (fi || pi || pt) == true, otherwise ignore. */ struct gsm0808_speech_codec { + /*! Full IP: AoIP with compressed speech via RTP/UDP/IP. */ bool fi; + /*! PCMoIP: PCM over A-Interface via RTP/UPD/IP. */ bool pi; + /*! PCMoTDM: PCM over A-Interface with TDM as transport. */ bool pt; + /*! TFO (Inband Tandem Free Operation). Only valid if (pi || pt) == true. */ bool tf; /*! See enum gsm0808_speech_codec_type. */ uint8_t type; @@ -556,7 +616,44 @@ struct gsm0808_speech_codec { * * Default values for FR_AMR_WB, OFR_AMR_WB and OHR_AMR_WB: * See also: 3GPP TS 26.103, Table 5.7-1: Allowed Configurations - * for the Adaptive Multi-Rate - Wideband Codec Types */ + * for the Adaptive Multi-Rate - Wideband Codec Types + * + * This is a copy of 3GPP TS 28.062, Table 7.11.3.1.3-2: + * + * S0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + * 12,20 (x) x x x + * 10,20 x x x + * 7,95 x x x + * 7,40 x x x x + * 6,70 x x x x x x + * 5,90 x x x x x x x x x x + * 5,15 + * 4,75 x x x x x x x x x x + * + * OM F F F F F F F F F F F A F A F A + * + * HR Y Y Y Y Y Y Y Y Y + * FR Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y + * + * Each bit allows one Codec Configuration. + * E.g. when bit S3 is set, look at column labeled "3", and see that only 6,7k is active in this configuration; it is + * "F" forbidden to change in Optimisation Mode, "Y" HR AMR supports this mode, and "Y" FR AMR can also do it. + * + * This means that whichever configuration is chosen from S0 thru S15, there are never more than four rates active. + * + * The spec praises S1 as the most desired configuration: "because it leads in all call cases to TFO/TrFO compatible + * connections with optimal voice quality." (Since HR AMR supports up to 7.95k, it seems that S14 would be more optimal + * voice quality, but it is not marked as supported by HR AMR.) + * + * For FR_AMR below, the default of 0x57ff means: + * 0x57ff = 0101 0111 1111 1111 + * ^14 ^10 ^0 + * allow config 0 thru 10, and configs 12 and 14. + * + * For HR_AMR, drop all those where there is no "Y" in the HR row: + * 0x073f = 0000 0111 0011 1111 + * ^15 ^11 ^6 ^0 + */ enum gsm0808_speech_codec_defaults { GSM0808_SC_CFG_DEFAULT_FR_AMR = 0x57ff, GSM0808_SC_CFG_DEFAULT_HR_AMR = 0x073f, @@ -566,9 +663,12 @@ enum gsm0808_speech_codec_defaults { GSM0808_SC_CFG_DEFAULT_OHR_AMR_WB = 0x01, }; -/*! Default speech codec configurations broken down by reate. +/*! Default speech codec configurations broken down by rate. * See also: 3GPP TS 28.062, Table 7.11.3.1.3-2: Preferred Configurations for - * the Adaptive Multi-Rate Codec Types. */ + * the Adaptive Multi-Rate Codec Types. + * + * Set all Sn bits that have this rate listed as active. + */ enum gsm0808_speech_codec_rate_defaults { GSM0808_SC_CFG_DEFAULT_AMR_4_75 = 0xff03, GSM0808_SC_CFG_DEFAULT_AMR_5_15 = 0x0000, @@ -580,9 +680,12 @@ enum gsm0808_speech_codec_rate_defaults { GSM0808_SC_CFG_DEFAULT_AMR_12_2 = 0xc082 }; -/*! Single speech codec configurations broken down by reate. +/*! Single speech codec configurations broken down by rate. * See also: 3GPP TS 28.062, Table 7.11.3.1.3-2: Preferred Configurations for - * the Adaptive Multi-Rate Codec Types. */ + * the Adaptive Multi-Rate Codec Types. + * + * Set bit Sn (S0 = 0x01), where Sn is identified by a descriptive name. + */ enum gsm0808_speech_codec_rate { GSM0808_SC_CFG_AMR_4_75 = 0x0001, GSM0808_SC_CFG_AMR_4_75_5_90_7_40_12_20 = 0x0002, @@ -594,6 +697,29 @@ enum gsm0808_speech_codec_rate { GSM0808_SC_CFG_AMR_12_2 = 0x0080, }; +/* Bit index of a mode as returned by gsm0808_amr_modes_from_cfg[]. + * Example: + * if (gsm0808_amr_modes_from_cfg[full_rate ? 1 : 0][9] & GSM0808_AMR_MODE_4_75) + * printf("S9 supports 4k75"); + */ +enum gsm0808_amr_mode { + GSM0808_AMR_MODE_4_75 = 0, + GSM0808_AMR_MODE_5_15, + GSM0808_AMR_MODE_5_90, + GSM0808_AMR_MODE_6_70, + GSM0808_AMR_MODE_7_40, + GSM0808_AMR_MODE_7_95, + GSM0808_AMR_MODE_10_2, + GSM0808_AMR_MODE_12_2, +}; +extern const struct value_string gsm0808_amr_mode_names[]; +static inline const char *gsm0808_amr_mode_name(enum gsm0808_amr_mode val) +{ + return get_value_string(gsm0808_amr_mode_names, val); +} + +extern const uint8_t gsm0808_amr_modes_from_cfg[2][16]; + /* 3GPP TS 48.008 3.2.2.103 Speech Codec List */ #define SPEECH_CODEC_MAXLEN 255 struct gsm0808_speech_codec_list { @@ -601,13 +727,32 @@ struct gsm0808_speech_codec_list { uint8_t len; }; +/* 3GPP TS 48.008 3.2.2.11 Channel Type + * Asymmetry Preference (used for data, non-transparent service) */ +enum gsm0808_channel_type_asym_pref { + GSM0808_CT_ASYM_PREF_NOT_APPLICABLE = 0, + GSM0808_CT_ASYM_PREF_UL = 1, + GSM0808_CT_ASYM_PREF_DL = 2, + GSM0808_CT_ASYM_PREF_SPARE = 3, +}; + /* 3GPP TS 48.008 3.2.2.11 Channel Type */ #define CH_TYPE_PERM_SPCH_MAXLEN 9 struct gsm0808_channel_type { uint8_t ch_indctr; uint8_t ch_rate_type; + + /* Speech only */ uint8_t perm_spch[CH_TYPE_PERM_SPCH_MAXLEN]; unsigned int perm_spch_len; + + /* Data only */ + bool data_transparent; + uint8_t data_rate; + bool data_rate_allowed_is_set; + uint8_t data_rate_allowed; + bool data_asym_pref_is_set; + enum gsm0808_channel_type_asym_pref data_asym_pref; }; /* 3GPP TS 48.008 3.2.2.10 Encryption Information */ @@ -671,7 +816,7 @@ struct gsm0808_diagnostics { uint8_t error_pointer_bit_spare:4, error_pointer_bit:4; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t error_pointer_bit:4, error_pointer_bit_spare:4; #endif uint8_t msg[0]; /*! received message which provoked the error */ diff --git a/include/osmocom/gsm/protocol/gsm_08_58.h b/include/osmocom/gsm/protocol/gsm_08_58.h index da55a8d9..13e84bad 100644 --- a/include/osmocom/gsm/protocol/gsm_08_58.h +++ b/include/osmocom/gsm/protocol/gsm_08_58.h @@ -15,10 +15,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once @@ -33,6 +29,7 @@ /* Channel Number 9.3.1 */ union abis_rsl_chan_nr { + struct { #if OSMO_IS_BIG_ENDIAN uint8_t cbits:5, tn:3; @@ -40,7 +37,8 @@ union abis_rsl_chan_nr { uint8_t tn:3, cbits:5; #endif - uint8_t chan_nr; + } __attribute__ ((packed)); + uint8_t chan_nr; } __attribute__ ((packed)); #define ABIS_RSL_CHAN_NR_CBITS_Bm_ACCHs 0x01 #define ABIS_RSL_CHAN_NR_CBITS_Lm_ACCHs(ss) (0x02 + (ss)) @@ -53,8 +51,13 @@ union abis_rsl_chan_nr { #define ABIS_RSL_CHAN_NR_CBITS_OSMO_CBCH4 0x19 /*< non-standard, for CBCH/SDCCH4 */ #define ABIS_RSL_CHAN_NR_CBITS_OSMO_CBCH8 0x1a /*< non-standard, for CBCH/SDCCH8 */ +/* non-standard, Osmocom specific Bm/Lm equivalents for VAMOS */ +#define ABIS_RSL_CHAN_NR_CBITS_OSMO_VAMOS_Bm_ACCHs 0x1d /*< VAMOS TCH/F */ +#define ABIS_RSL_CHAN_NR_CBITS_OSMO_VAMOS_Lm_ACCHs(ss) (0x1e + (ss)) /*< VAMOS TCH/H */ + /* Link Identifier 9.3.2 */ union abis_rsl_link_id { + struct { #if OSMO_IS_BIG_ENDIAN uint8_t cbits:2, na:1, @@ -66,7 +69,8 @@ union abis_rsl_link_id { na:1, cbits:2; #endif - uint8_t link_id; + } __attribute__ ((packed)); + uint8_t link_id; } __attribute__ ((packed)); #define ABIS_RSL_LINK_ID_CBITS_FACCH_SDCCH 0x00 #define ABIS_RSL_LINK_ID_CBITS_SACCH 0x01 @@ -116,6 +120,33 @@ struct abis_rsl_cchan_hdr { uint8_t data[0]; /*!< message payload data */ } __attribute__ ((packed)); +/* Osmocom specific IE to negotiate repeated ACCH capabilities */ +struct abis_rsl_osmo_rep_acch_cap { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t dl_facch_cmd:1, + dl_facch_all:1, + dl_sacch:1, + ul_sacch:1, + rxqual:3, + reserved:1; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t reserved:1, rxqual:3, ul_sacch:1, dl_sacch:1, dl_facch_all:1, dl_facch_cmd:1; +#endif +} __attribute__ ((packed)); + +/* Osmocom specific IE to negotiate temporary overpower of ACCH channels */ +struct abis_rsl_osmo_temp_ovp_acch_cap { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t overpower_db:3, + rxqual:3, + facch_enable:1, + sacch_enable:1; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t sacch_enable:1, facch_enable:1, rxqual:3, overpower_db:3; +#endif +} __attribute__ ((packed)); /* Chapter 9.1 */ /* RSL Message Discriminator: RLL */ @@ -337,6 +368,13 @@ enum abis_rsl_ie { RSL_IE_SIEMENS_HIGHEST_RATE = 0x4e, RSL_IE_SIEMENS_SUGGESTED_RATE = 0x4f, + /* Osmocom specific */ + RSL_IE_OSMO_REP_ACCH_CAP = 0x60, + RSL_IE_OSMO_TRAINING_SEQUENCE = 0x61, + RSL_IE_OSMO_TEMP_OVP_ACCH_CAP = 0x62, + RSL_IE_OSMO_OSMUX_CID = 0x63, + RSL_IE_OSMO_RTP_EXTENSIONS = 0x64, + /* ip.access */ RSL_IE_IPAC_SRTP_CONFIG = 0xe0, RSL_IE_IPAC_PROXY_UDP = 0xe1, @@ -353,9 +391,9 @@ enum abis_rsl_ie { RSL_IE_IPAC_RTP_CSD_FMT = 0xf9, RSL_IE_IPAC_RTP_JIT_BUF = 0xfa, RSL_IE_IPAC_RTP_COMPR = 0xfb, - RSL_IE_IPAC_RTP_PAYLOAD2= 0xfc, + RSL_IE_IPAC_RTP_PAYLOAD2 = 0xfc, RSL_IE_IPAC_RTP_MPLEX = 0xfd, - RSL_IE_IPAC_RTP_MPLEX_ID= 0xfe, + RSL_IE_IPAC_RTP_MPLEX_ID = 0xfe, }; /* Ericsson specific IEs, clash with above partially, so they're not @@ -385,10 +423,12 @@ enum abis_rsl_ie { enum { IPAC_UNWEIGHTED_AVE = 0, IPAC_WEIGHTED_AVE, - IPAC_MEDIAN_AVE + IPAC_MEDIAN_AVE, + /* EWMA is an Osmocom specific extension */ + IPAC_OSMO_EWMA_AVE, }; -/* IPAC MEAS_PREPROC AVERAGING PARAMID */ +/* IPAC MEAS_PREPROC AVERAGING PARAM ID */ enum { IPAC_RXLEV_AVE = 0, IPAC_RXQUAL_AVE, @@ -431,6 +471,11 @@ enum { #define RSL_CHAN_OSMO_CBCH4 0xc8 /*< non-standard, for CBCH/SDCCH4 */ #define RSL_CHAN_OSMO_CBCH8 0xd0 /*< non-standard, for CBCH/SDCCH8 */ +/* non-standard, Osmocom specific Bm/Lm equivalents for VAMOS */ +#define RSL_CHAN_OSMO_VAMOS_Bm_ACCHs 0xe8 /* VAMOS TCH/F */ +#define RSL_CHAN_OSMO_VAMOS_Lm_ACCHs 0xf0 /* VAMOS TCH/H */ +#define RSL_CHAN_OSMO_VAMOS_MASK 0xe0 /* VAMOS TCH/{F,H} */ + /* Chapter 9.3.3 */ #define RSL_ACT_TYPE_INITIAL 0x00 #define RSL_ACT_TYPE_REACT 0x80 @@ -456,34 +501,66 @@ enum rsl_cmod_spd { RSL_CMOD_SPD_DATA = 0x02, RSL_CMOD_SPD_SIGN = 0x03, }; -#define RSL_CMOD_CRT_SDCCH 0x01 -#define RSL_CMOD_CRT_TCH_Bm 0x08 /* full-rate */ -#define RSL_CMOD_CRT_TCH_Lm 0x09 /* half-rate */ -/* FIXME: More CRT types */ -/* Speech */ -#define RSL_CMOD_SP_GSM1 0x01 -#define RSL_CMOD_SP_GSM2 0x11 -#define RSL_CMOD_SP_GSM3 0x21 -/* non-transparent data */ -#define RSL_CMOD_CSD_NT_43k5 0x74 -#define RSL_CMOD_CSD_NT_28k8 0x71 -#define RSL_CMOD_CSD_NT_14k5 0x58 -#define RSL_CMOD_CSD_NT_12k0 0x50 -#define RSL_CMOD_CSD_NT_6k0 0x51 +/*! Channel rate and type */ +enum rsl_cmod_crt { + RSL_CMOD_CRT_SDCCH = 0x01, + RSL_CMOD_CRT_TCH_Bm = 0x08, /* full-rate */ + RSL_CMOD_CRT_TCH_Lm = 0x09, /* half-rate */ + RSL_CMOD_CRT_TCH_BI_Bm = 0x0a, /* full-rate: bi-directional (multislot) */ + RSL_CMOD_CRT_TCH_UNI_Bm = 0x1a, /* full-rate: uni-directional (multislot) */ + RSL_CMOD_CRT_TCH_GROUP_Bm = 0x18, /* full-rate: group call channel */ + RSL_CMOD_CRT_TCH_GROUP_Lm = 0x19, /* half-rate: group call channel */ + RSL_CMOD_CRT_TCH_BCAST_Bm = 0x28, /* full-rate: broadcast call channel */ + RSL_CMOD_CRT_TCH_BCAST_Lm = 0x29, /* half-rate: broadcast call channel */ + RSL_CMOD_CRT_OSMO_TCH_VAMOS_Bm = 0x88, /* full-rate in VAMOS mode */ + RSL_CMOD_CRT_OSMO_TCH_VAMOS_Lm = 0x89, /* half-rate in VAMOS mode */ +}; +/*! Speech */ +enum rsl_cmod_sp { + RSL_CMOD_SP_GSM1 = 0x01, + RSL_CMOD_SP_GSM2 = 0x11, + RSL_CMOD_SP_GSM3 = 0x21, + RSL_CMOD_SP_GSM4 = 0x31, + RSL_CMOD_SP_GSM5 = 0x09, + RSL_CMOD_SP_GSM6 = 0x0d, +}; +/*! Non-transparent data */ +enum rsl_cmod_csd_nt { + RSL_CMOD_CSD_NTA_43k5_14k5 = 0x61, /* asymmetric 43.5 kbit/s (DL) + 14.5 kbit/s (UL) */ + RSL_CMOD_CSD_NTA_29k0_14k5 = 0x62, /* asymmetric 29.0 kbit/s (DL) + 14.5 kbit/s (UL) */ + RSL_CMOD_CSD_NTA_43k5_29k0 = 0x63, /* asymmetric 43.5 kbit/s (DL) + 29.0 kbit/s (UL) */ + RSL_CMOD_CSD_NTA_14k5_43k5 = 0x69, /* asymmetric 14.5 kbit/s (DL) + 43.5 kbit/s (UL) */ + RSL_CMOD_CSD_NTA_14k5_29k0 = 0x6a, /* asymmetric 14.5 kbit/s (DL) + 29.0 kbit/s (UL) */ + RSL_CMOD_CSD_NTA_29k0_43k5 = 0x6b, /* asymmetric 29.0 kbit/s (DL) + 43.5 kbit/s (UL) */ + RSL_CMOD_CSD_NT_43k5 = 0x74, + RSL_CMOD_CSD_NT_28k8 = 0x71, + RSL_CMOD_CSD_NT_14k5 = 0x58, + RSL_CMOD_CSD_NT_12k0 = 0x50, + RSL_CMOD_CSD_NT_6k0 = 0x51, +}; /* legacy #defines with wrong name */ #define RSL_CMOD_SP_NT_14k5 RSL_CMOD_CSD_NT_14k5 #define RSL_CMOD_SP_NT_12k0 RSL_CMOD_CSD_NT_12k0 #define RSL_CMOD_SP_NT_6k0 RSL_CMOD_CSD_NT_6k0 -/* transparent data */ -#define RSL_CMOD_CSD_T_32000 0x38 -#define RSL_CMOD_CSD_T_29000 0x39 -#define RSL_CMOD_CSD_T_14400 0x18 -#define RSL_CMOD_CSD_T_9600 0x10 -#define RSL_CMOD_CSD_T_4800 0x11 -#define RSL_CMOD_CSD_T_2400 0x12 -#define RSL_CMOD_CSD_T_1200 0x13 -#define RSL_CMOD_CSD_T_600 0x14 -#define RSL_CMOD_CSD_T_1200_75 0x15 +#define RSL_CMOD_CSD_T_32000 RSL_CMOD_CSD_T_32k0 +#define RSL_CMOD_CSD_T_29000 RSL_CMOD_CSD_T_29k0 +#define RSL_CMOD_CSD_T_14400 RSL_CMOD_CSD_T_14k4 +#define RSL_CMOD_CSD_T_9600 RSL_CMOD_CSD_T_9k6 +#define RSL_CMOD_CSD_T_4800 RSL_CMOD_CSD_T_4k8 +#define RSL_CMOD_CSD_T_2400 RSL_CMOD_CSD_T_2k4 +#define RSL_CMOD_CSD_T_1200 RSL_CMOD_CSD_T_1k2 +/*! Transparent data */ +enum rsl_cmod_csd_t { + RSL_CMOD_CSD_T_32k0 = 0x38, + RSL_CMOD_CSD_T_29k0 = 0x39, + RSL_CMOD_CSD_T_14k4 = 0x18, + RSL_CMOD_CSD_T_9k6 = 0x10, + RSL_CMOD_CSD_T_4k8 = 0x11, + RSL_CMOD_CSD_T_2k4 = 0x12, + RSL_CMOD_CSD_T_1k2 = 0x13, + RSL_CMOD_CSD_T_600 = 0x14, + RSL_CMOD_CSD_T_1200_75 = 0x15, +}; /*! RSL Channel Identification IE (Chapter 9.3.5) */ struct rsl_ie_chan_ident { @@ -542,6 +619,9 @@ struct rsl_ie_chan_ident { #define RSL_ERR_CCCH_OVERLOAD 0x23 #define RSL_ERR_ACCH_OVERLOAD 0x24 #define RSL_ERR_PROCESSOR_OVERLOAD 0x25 +#define RSL_ERR_BTS_NOT_EQUIPPED 0x27 +#define RSL_ERR_REMOTE_TRANSC_FAIL 0x28 +#define RSL_ERR_NOTIFICATION_OVERFL 0x29 #define RSL_ERR_RES_UNAVAIL 0x2f /* service or option not available */ #define RSL_ERR_TRANSC_UNAVAIL 0x30 @@ -598,7 +678,7 @@ struct rsl_ie_chan_ident { #define RSL_CHANNEED_TCH_F 0x02 #define RSL_CHANNEED_TCH_ForH 0x03 -/*! RSL Cell Broadcast Command (Chapter 9.3.45) */ +/*! RSL Cell Broadcast Command (Chapter 9.3.41) */ struct rsl_ie_cb_cmd_type { #if OSMO_IS_LITTLE_ENDIAN uint8_t last_block:2; @@ -606,7 +686,7 @@ struct rsl_ie_cb_cmd_type { uint8_t def_bcast:1; uint8_t command:4; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t command:4, def_bcast:1, spare:1, last_block:2; #endif } __attribute__ ((packed)); @@ -624,6 +704,23 @@ struct rsl_ie_cb_cmd_type { #define RSL_CB_CMD_LASTBLOCK_2 2 #define RSL_CB_CMD_LASTBLOCK_3 3 +/*! NCH DRX Information (Chapter 9.3.47) */ +struct rsl_ie_nch_drx_info { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t nln:2; + uint8_t emlpp_priority:3; + uint8_t nln_status:1; + uint8_t spare:2; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t spare:2, nln_status:1, emlpp_priority:3, nln:2; +#endif +} __attribute__ ((packed)); + +/*! Command Indicator (Chapter 9.3.48) */ +#define RSL_CMD_INDICATOR_START 0x00 +#define RSL_CMD_INDICATOR_STOP 0x01 + /* Chapter 3.3.2.3 Brocast control channel */ /* CCCH-CONF, NC is not combined */ #define RSL_BCCH_CCCH_CONF_1_NC 0x00 @@ -669,10 +766,10 @@ enum rsl_ipac_speech_mode_m { /* RSL_IE_IPAC_RTP_CSD_FMT, lower four bits */ enum rsl_ipac_rtp_csd_format_d { - RSL_IPAC_RTP_CSD_EXT_TRAU = 0, - RSL_IPAC_RTP_CSD_NON_TRAU = 1, - RSL_IPAC_RTP_CSD_TRAU_BTS = 2, - RSL_IPAC_RTP_CSD_IWF_FREE = 3, + RSL_IPAC_RTP_CSD_EXT_TRAU = 0, /*!< TRAU-like RTP format, without leading zero-bits */ + RSL_IPAC_RTP_CSD_NON_TRAU = 1, /*!< packed 16k (252/288 bit) / 8k (126 bit) in RTP */ + RSL_IPAC_RTP_CSD_TRAU_BTS = 2, /*!< TRAU in BTS; V.110 in RTP/CLEARMODE */ + RSL_IPAC_RTP_CSD_IWF_FREE = 3, /*!< unknown proprietary IWF-free BTS-BTS data */ }; /* RSL_IE_IPAC_RTP_CSD_FMT, upper four bits */ enum rsl_ipac_rtp_csd_format_ir { @@ -740,8 +837,14 @@ enum rsl_ipac_embedded_ie { RSL_IPAC_EIE_SDCCH_CTL_PARAM = 0x1a, RSL_IPAC_EIE_AMR_CONV_THRESH = 0x1b, + /* Osmocom specific extensions: */ + RSL_IPAC_EIE_OSMO_MEAS_AVG_CFG = 0xf0, + RSL_IPAC_EIE_OSMO_MS_PWR_CTL = 0xf1, + RSL_IPAC_EIE_OSMO_PC_THRESH_COMP = 0xf2, + }; +/* Value of TLV IE RSL_IPAC_EIE_MEAS_AVG_CFG */ struct ipac_preproc_ave_cfg { #if OSMO_IS_LITTLE_ENDIAN uint8_t h_reqave:5, @@ -749,13 +852,67 @@ struct ipac_preproc_ave_cfg { reserved:1; uint8_t h_reqt:5, ave_method:3; + uint8_t params[0]; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t reserved:1, param_id:2, h_reqave:5; uint8_t ave_method:3, h_reqt:5; + uint8_t params[0]; #endif }__attribute__ ((packed)); + +struct osmo_preproc_ave_cfg_field { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t h_reqave:5, + ave_enabled:1, + reserved:2; + uint8_t h_reqt:5, + ave_method:3; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t reserved:2, ave_enabled:1, h_reqave:5; + uint8_t ave_method:3, h_reqt:5; +#endif +}__attribute__ ((packed)); +/* Value of TLV IE RSL_IPAC_EIE_OSMO_MEAS_AVG_CFG: */ +struct osmo_preproc_ave_cfg { + struct osmo_preproc_ave_cfg_field ci_fr; + struct osmo_preproc_ave_cfg_field ci_hr; + struct osmo_preproc_ave_cfg_field ci_amr_fr; + struct osmo_preproc_ave_cfg_field ci_amr_hr; + struct osmo_preproc_ave_cfg_field ci_sdcch; + struct osmo_preproc_ave_cfg_field ci_gprs; + uint8_t params[0]; /* Contains params for each above, appended one after the other */ +}__attribute__ ((packed)); + +/*! MS/BS Power Control Thresholds (RSL_IPAC_EIE_MS_PWR_CTL) */ +struct ipac_preproc_pc_thresh { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t l_rxlev:6, reserved_l_rxlev:2; + uint8_t u_rxlev:6, reserved_u_rxlev:2; + uint8_t u_rxqual:3, reserved_u_rxqual:1, + l_rxqual:3, reserved_l_rxqual:1; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t reserved_l_rxlev:2, l_rxlev:6; + uint8_t reserved_u_rxlev:2, u_rxlev:6; + uint8_t reserved_l_rxqual:1, l_rxqual:3, reserved_u_rxqual:1, u_rxqual:3; +#endif +}__attribute__ ((packed)); + +/*! Osmocom extension for: MS/BS Power Control Thresholds (RSL_IPAC_EIE_OSMO_MS_PWR_CTL) */ +struct osmo_preproc_pc_thresh { + /* Carrier-to-Interference (C/I), in dB: */ + int8_t l_ci_fr; int8_t u_ci_fr; /* FR/EFR */ + int8_t l_ci_hr; int8_t u_ci_hr; /* HR */ + int8_t l_ci_amr_fr; int8_t u_ci_amr_fr; /* AMR FR */ + int8_t l_ci_amr_hr; int8_t u_ci_amr_hr; /* AMR HR */ + int8_t l_ci_sdcch; int8_t u_ci_sdcch; /* SDCCH */ + int8_t l_ci_gprs; int8_t u_ci_gprs; /* GPRS */ +}__attribute__ ((packed)); + +/*! Handover Thresholds */ struct ipac_preproc_ho_thresh { #if OSMO_IS_LITTLE_ENDIAN uint8_t l_rxlev_ul_h:6, @@ -773,7 +930,7 @@ struct ipac_preproc_ho_thresh { uint8_t ms_range_max:6, reserved_ms_range:2; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t reserved_l_rxlev_ul:2, l_rxlev_ul_h:6; uint8_t reserved_l_rxlev_dl:2, l_rxlev_dl_h:6; uint8_t reserved_rxlev_ul:2, rxlev_ul_ih:6; @@ -783,6 +940,60 @@ struct ipac_preproc_ho_thresh { #endif }__attribute__ ((packed)); +/*! PC Threshold Comparators (RSL_IPAC_EIE_PC_THRESH_COMP) */ +struct ipac_preproc_pc_comp { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t p1:5, reserved_p1:3; + uint8_t n1:5, reserved_n1:3; + uint8_t p2:5, reserved_p2:3; + uint8_t n2:5, reserved_n2:3; + uint8_t p3:5, reserved_p3:3; + uint8_t n3:5, reserved_n3:3; + uint8_t p4:5, reserved_p4:3; + uint8_t n4:5, reserved_n4:3; + uint8_t pc_interval:5, reserved_pc:3; + uint8_t red_step_size:4, inc_step_size:4; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t reserved_p1:3, p1:5; + uint8_t reserved_n1:3, n1:5; + uint8_t reserved_p2:3, p2:5; + uint8_t reserved_n2:3, n2:5; + uint8_t reserved_p3:3, p3:5; + uint8_t reserved_n3:3, n3:5; + uint8_t reserved_p4:3, p4:5; + uint8_t reserved_n4:3, n4:5; + uint8_t reserved_pc:3, pc_interval:5; + uint8_t inc_step_size:4, red_step_size:4; +#endif +}__attribute__ ((packed)); + +/*! Osmocom extension for: PC Threshold Comparators (RSL_IPAC_EIE_OSMO_PC_THRESH_COMP) */ +struct ipac_preproc_pc_comp_field { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t lower_p:5, reserved_lower_p:3; + uint8_t lower_n:5, reserved_lower_n:3; + uint8_t upper_p:5, reserved_upper_p:3; + uint8_t upper_n:5, reserved_upper_n:3; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t reserved_lower_p:3, lower_p:5; + uint8_t reserved_lower_n:3, lower_n:5; + uint8_t reserved_upper_p:3, upper_p:5; + uint8_t reserved_upper_n:3, upper_n:5; +#endif +}__attribute__ ((packed)); +struct osmo_preproc_pc_comp { + /* Used for Carrier-to-Interference (C/I), in dB: */ + struct ipac_preproc_pc_comp_field ci_fr; + struct ipac_preproc_pc_comp_field ci_hr; + struct ipac_preproc_pc_comp_field ci_amr_fr; + struct ipac_preproc_pc_comp_field ci_amr_hr; + struct ipac_preproc_pc_comp_field ci_sdcch; + struct ipac_preproc_pc_comp_field ci_gprs; +}__attribute__ ((packed)); + +/*! HO Threshold Comparators */ struct ipac_preproc_ho_comp { #if OSMO_IS_LITTLE_ENDIAN uint8_t p5:5, @@ -806,7 +1017,7 @@ struct ipac_preproc_ho_comp { uint8_t reserved; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t reserved_p5:3, p5:5; uint8_t reserved_n5:3, n5:5; uint8_t reserved_p6:3, p6:5; @@ -829,7 +1040,7 @@ struct ipac_preproc_ho_candidates { s:1, reserved1:1; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t reserved0:2, bsic:6; uint8_t reserved1:1, s:1, ba_used:1, bcch_freq:5; #endif @@ -844,7 +1055,7 @@ struct ipac_preproc_ncell_dflts { uint8_t ms_txpwr_max_def:5, reserved_ms_txpwr_max_def:3; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t reserved_rxlev_min_def:2, rxlev_min_def:6; uint8_t reserved_ho_margin_def:3, ho_margin_def:5; uint8_t reserved_ms_txpwr_max_def:3, ms_txpwr_max_def:5; @@ -857,7 +1068,7 @@ struct ipac_preproc_ho_ctl_param { sdcch_ho_umts:1, reserved:6; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t reserved:6, sdcch_ho_umts:1, sdcch_ho_gsm:1; #endif }__attribute__ ((packed)); @@ -873,4 +1084,18 @@ struct ipac_preproc_cfg { struct ipac_preproc_ho_ctl_param ho_ctl_param; }; +struct rsl_l1_info { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t reserved:1, + srr_sro:1, + fpc_epc:1, + ms_pwr:5; + uint8_t ta; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t ms_pwr:5, fpc_epc:1, srr_sro:1, reserved:1; + uint8_t ta; +#endif +} __attribute__ ((packed)); + /*! @} */ diff --git a/include/osmocom/gsm/protocol/gsm_09_02.h b/include/osmocom/gsm/protocol/gsm_09_02.h index 0b54fb74..4d5ff13c 100644 --- a/include/osmocom/gsm/protocol/gsm_09_02.h +++ b/include/osmocom/gsm/protocol/gsm_09_02.h @@ -1,8 +1,7 @@ /*! \file gsm_09_02.h * GSM TS 09.02 definitions (MAP). */ -#ifndef PROTO_GSM_09_02_H -#define PROTO_GSM_09_02_H +#pragma once /* Section 17.7.4 */ /* SS-Status */ @@ -134,5 +133,3 @@ #define GSM0902_TS_CODE_PLMN_SPECIFIC_TS_C 0xDC #define GSM0902_TS_CODE_PLMN_SPECIFIC_TS_D 0xDD #define GSM0902_TS_CODE_PLMN_SPECIFIC_TS_E 0xDE - -#endif /* PROTO_GSM_09_02_H */ diff --git a/include/osmocom/gsm/protocol/gsm_12_21.h b/include/osmocom/gsm/protocol/gsm_12_21.h index 86d12ea7..39b1d45c 100644 --- a/include/osmocom/gsm/protocol/gsm_12_21.h +++ b/include/osmocom/gsm/protocol/gsm_12_21.h @@ -1,3 +1,4 @@ +/* 3GPP TS 12.21, nowadays 3GPP TS 52.021 */ /* * (C) 2008-2009 by Harald Welte <laforge@gnumonks.org> * All Rights Reserved @@ -12,10 +13,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once @@ -445,7 +442,7 @@ enum abis_nm_attr { NM_ATT_IPACC_NS_CFG = 0xa0, NM_ATT_IPACC_BSSGP_CFG = 0xa1, NM_ATT_IPACC_NS_LINK_CFG = 0xa2, - NM_ATT_IPACC_RLC_CFG = 0xa3, + NM_ATT_IPACC_RLC_CFG = 0xa3, NM_ATT_IPACC_ALM_THRESH_LIST = 0xa4, NM_ATT_IPACC_MONIT_VAL_LIST = 0xa5, NM_ATT_IPACC_TIB_CONTROL = 0xa6, @@ -462,7 +459,7 @@ enum abis_nm_attr { NM_ATT_BS11_RF_RES_IND_PER = 0x8f, - + NM_ATT_BS11_RX_LEV_MIN_CELL = 0x90, NM_ATT_BS11_ABIS_EXT_TIME = 0x91, NM_ATT_BS11_TIMER_HO_REQUEST = 0x92, @@ -511,6 +508,7 @@ enum abis_nm_attr { /* osmocom (osmo-bts) specific attributes, used in combination * with the "org.osmocom" manufacturer identification */ + NM_ATT_OSMO_NS_LINK_CFG = 0xfd, /* osmocom version supports IPv4 & IPv6 in difference to IPACC */ NM_ATT_OSMO_REDUCEPOWER = 0xfe, /* TLV_TYPE_TV */ }; #define NM_ATT_BS11_FILE_DATA NM_ATT_EVENT_TYPE @@ -525,9 +523,11 @@ enum abis_nm_adm_state { /*! OML Availability State (Section 9.4.7) */ enum abis_nm_avail_state { - NM_AVSTATE_IN_TEST = 1, + NM_AVSTATE_IN_TEST = 0, + NM_AVSTATE_FAILED = 1, NM_AVSTATE_POWER_OFF = 2, NM_AVSTATE_OFF_LINE = 3, + /* <not used> = 4, */ NM_AVSTATE_DEPENDENCY = 5, NM_AVSTATE_DEGRADED = 6, NM_AVSTATE_NOT_INSTALLED= 7, @@ -563,8 +563,10 @@ enum abis_nm_chan_comb { NM_CHANC_IPAC_TCHFull_PDCH = 0x80, NM_CHANC_IPAC_TCHFull_TCHHalf = 0x81, /* osmocom */ - NM_CHANC_OSMO_TCHFull_TCHHalf_PDCH = 0x90, + NM_CHANC_OSMO_DYN = 0x90, }; +/* Backward compatibility with older naming: */ +#define NM_CHANC_OSMO_TCHFull_TCHHalf_PDCH NM_CHANC_OSMO_DYN /*! Event Type (Section 9.4.16) */ enum abis_nm_event_type { @@ -773,6 +775,98 @@ enum ipac_eie { NM_IPAC_EIE_BTS_ID = 0x25, }; +/*! ip.access support flags for NM_IPAC_EIE_FREQ_BANDS */ +#define NM_IPAC_F_FREQ_BAND_PGSM (1 << 0) +#define NM_IPAC_F_FREQ_BAND_EGSM (1 << 1) +#define NM_IPAC_F_FREQ_BAND_RGSM (1 << 2) +#define NM_IPAC_F_FREQ_BAND_DCS (1 << 3) +#define NM_IPAC_F_FREQ_BAND_PCS (1 << 4) +#define NM_IPAC_F_FREQ_BAND_850 (1 << 5) +#define NM_IPAC_F_FREQ_BAND_480 (1 << 6) +#define NM_IPAC_F_FREQ_BAND_450 (1 << 7) + +/*! ip.access support flags for NM_IPAC_EIE_CIPH_ALGOS */ +#define NM_IPAC_F_CIPH_ALGO_A51 (1 << 0) +#define NM_IPAC_F_CIPH_ALGO_A52 (1 << 1) +#define NM_IPAC_F_CIPH_ALGO_A53 (1 << 2) +#define NM_IPAC_F_CIPH_ALGO_A54 (1 << 3) +#define NM_IPAC_F_CIPH_ALGO_A55 (1 << 4) +#define NM_IPAC_F_CIPH_ALGO_A56 (1 << 5) +#define NM_IPAC_F_CIPH_ALGO_A57 (1 << 6) +#define NM_IPAC_F_CIPH_ALGO_A58 (1 << 7) + +/*! ip.access support flags for NM_IPAC_EIE_CHAN_TYPES (1st octet) */ +#define NM_IPAC_F_CHANT_TCHF (1 << 0) +#define NM_IPAC_F_CHANT_TCHH (1 << 1) +#define NM_IPAC_F_CHANT_SDCCH8 (1 << 2) +#define NM_IPAC_F_CHANT_BCCH (1 << 3) +#define NM_IPAC_F_CHANT_BCCH_SDCCH4 (1 << 4) +#define NM_IPAC_F_CHANT_BCH (1 << 5) +#define NM_IPAC_F_CHANT_BCCH_SDCCH4_CBCH (1 << 6) +#define NM_IPAC_F_CHANT_SDCCH8_CBCH (1 << 7) +/*! ip.access support flags for NM_IPAC_EIE_CHAN_TYPES (2nd octet) */ +#define NM_IPAC_F_CHANT_PDCHF (1 << 8) +#define NM_IPAC_F_CHANT_TCHF_PDCHF (1 << 9) +#define NM_IPAC_F_CHANT_TCHH_PDCHH (1 << 10) +#define NM_IPAC_F_CHANT_TCHF_TCHH (1 << 11) + +/*! ip.access support flags for NM_IPAC_EIE_CHAN_MODES (speech codecs) */ +#define NM_IPAC_F_CHANM_SPEECH_FS (1 << 0) +#define NM_IPAC_F_CHANM_SPEECH_EFS (1 << 1) +#define NM_IPAC_F_CHANM_SPEECH_AFS (1 << 2) +#define NM_IPAC_F_CHANM_SPEECH_HS (1 << 3) +#define NM_IPAC_F_CHANM_SPEECH_AHS (1 << 4) +/*! ip.access support flags for NM_IPAC_EIE_CHAN_MODES (CSD non-transparent) */ +#define NM_IPAC_F_CHANM_CSD_NT_4k8 (1 << 8) +#define NM_IPAC_F_CHANM_CSD_NT_9k6 (1 << 9) +#define NM_IPAC_F_CHANM_CSD_NT_14k4 (1 << 10) +/*! ip.access support flags for NM_IPAC_EIE_CHAN_MODES (CSD transparent) */ +#define NM_IPAC_F_CHANM_CSD_T_1200_75 (1 << 16) +#define NM_IPAC_F_CHANM_CSD_T_600 (1 << 17) +#define NM_IPAC_F_CHANM_CSD_T_1k2 (1 << 18) +#define NM_IPAC_F_CHANM_CSD_T_2k4 (1 << 19) +#define NM_IPAC_F_CHANM_CSD_T_4k8 (1 << 20) +#define NM_IPAC_F_CHANM_CSD_T_9k6 (1 << 21) +#define NM_IPAC_F_CHANM_CSD_T_14k4 (1 << 22) + +/*! ip.access support flags for NM_IPAC_EIE_GPRS_CODING (GPRS) */ +#define NM_IPAC_F_GPRS_CODING_CS1 (1 << 0) +#define NM_IPAC_F_GPRS_CODING_CS2 (1 << 1) +#define NM_IPAC_F_GPRS_CODING_CS3 (1 << 2) +#define NM_IPAC_F_GPRS_CODING_CS4 (1 << 3) +/*! ip.access support flags for NM_IPAC_EIE_GPRS_CODING (EGPRS) */ +#define NM_IPAC_F_GPRS_CODING_MCS1 (1 << 7) +#define NM_IPAC_F_GPRS_CODING_MCS2 (1 << 8) +#define NM_IPAC_F_GPRS_CODING_MCS3 (1 << 9) +#define NM_IPAC_F_GPRS_CODING_MCS4 (1 << 10) +#define NM_IPAC_F_GPRS_CODING_MCS5 (1 << 11) +#define NM_IPAC_F_GPRS_CODING_MCS6 (1 << 12) +#define NM_IPAC_F_GPRS_CODING_MCS7 (1 << 13) +#define NM_IPAC_F_GPRS_CODING_MCS8 (1 << 14) +#define NM_IPAC_F_GPRS_CODING_MCS9 (1 << 15) + +/*! ip.access support flags for NM_IPAC_EIE_RTP_FEATURES */ +#define NM_IPAC_F_RTP_FEAT_COMPR_CONTROL (1 << 0) /* RTP Compression Control */ +#define NM_IPAC_F_RTP_FEAT_IR_8k (1 << 1) /* IR 8 kbit/s */ +#define NM_IPAC_F_RTP_FEAT_IR_16k (1 << 2) /* IR 16 kbit/s */ +#define NM_IPAC_F_RTP_FEAT_IR_32k (1 << 3) /* IR 32 kbit/s */ +#define NM_IPAC_F_RTP_FEAT_IR_64k (1 << 4) /* IR 64 kbit/s */ +#define NM_IPAC_F_RTP_FEAT_MULTIPLEX_RTP (1 << 6) /* RTP Multiplexing */ +#define NM_IPAC_F_RTP_FEAT_MULTIPLEX_SRTP (1 << 7) /* SRTP Multiplexing */ + +/*! ip.access support flags for NM_IPAC_EIE_RSL_FEATURES */ +#define NM_IPAC_F_RSL_FEAT_PHYSICAL_CONTEXT (1 << 0) +#define NM_IPAC_F_RSL_FEAT_DYN_PDCH_ACT (1 << 1) +#define NM_IPAC_F_RSL_FEAT_RTP_PT2 (1 << 2) + +extern const struct value_string abis_nm_ipacc_freq_band_desc[]; +extern const struct value_string abis_nm_ipacc_ciph_algo_desc[]; +extern const struct value_string abis_nm_ipacc_chant_desc[]; +extern const struct value_string abis_nm_ipacc_chanm_desc[]; +extern const struct value_string abis_nm_ipacc_gprs_coding_desc[]; +extern const struct value_string abis_nm_ipacc_rtp_feat_desc[]; +extern const struct value_string abis_nm_ipacc_rsl_feat_desc[]; + /*! ip.access NWL BCCH information type */ enum ipac_bcch_info_type { IPAC_BINF_RXLEV = (1 << 8), @@ -788,6 +882,69 @@ enum ipac_bcch_info_type { IPAC_BINF_CELL_ALLOC = (1 << 2), }; +/*! ip.access NM_ATT_IPACC_NS_CFG value */ +struct abis_nm_ipacc_att_ns_cfg { + uint8_t un_blocking_timer; /* (un)blocking Timer (Tns-block) timeout */ + uint8_t un_blocking_retries; /* (un)blocking Timer (Tns-block) number of retries */ + uint8_t reset_timer; /* Reset Timer (Tns-reset) timeout */ + uint8_t reset_retries; /* Reset Timer (Tns-reset) number of retries */ + uint8_t test_timer; /* Test Timer (Tns-test) timeout */ + uint8_t alive_timer; /* Alive Timer (Tns-alive) timeout */ + uint8_t alive_retries; /* Alive Timer (Tns-alive) number of retries */ +} __attribute__((packed)); + +/*! ip.access NM_ATT_IPACC_BSSGP_CFG value */ +struct abis_nm_ipacc_att_bssgp_cfg { + uint8_t t1_s; /* blocking timer (T1) */ + uint8_t t1_blocking_retries; /* blocking retries */ + uint8_t t1_unblocking_retries; /* unblocking retries */ + uint8_t t2_s; /* reset timer (T2) */ + uint8_t t2_retries; /* reset retries */ + uint8_t t3_100ms; /* suspend timer (T3) in 100ms */ + uint8_t t3_retries; /* suspend retries */ + uint8_t t4_100ms; /* resume timer (T4) in 100ms */ + uint8_t t4_retries; /* resume retries */ + uint8_t t5_s; /* capability update timer (T5) */ + uint8_t t5_retries; /* capability update retries */ +} __attribute__((packed)); + +/*! ip.access NM_ATT_IPACC_RLC_CFG value */ +struct abis_nm_ipacc_att_rlc_cfg { + uint8_t t3142; + uint8_t t3169; + uint8_t t3191; + uint8_t t3193_10ms; + uint8_t t3195; + uint8_t n3101; + uint8_t n3103; + uint8_t n3105; + uint8_t rlc_cv_countdown; +} __attribute__((packed)); + +/*! ip.access NM_ATT_IPACC_RLC_CFG_2 value */ +struct abis_nm_ipacc_att_rlc_cfg_2 { + /* T downlink TBF extension (0..500, network order) */ + uint16_t t_dl_tbf_ext_10ms; + /* T uplink TBF extension (0..500, network order) */ + uint16_t t_ul_tbf_ext_10ms; + /* Initial CS to use: CS1 -> 1, CS2 -> 2, CS3 -> 3, CS4 -> 4 */ + uint8_t initial_cs; +} __attribute__((packed)); + +/*! ip.access NM_ATT_IPACC_RLC_CFG_3 value */ +struct abis_nm_ipacc_att_rlc_cfg_3 { + /* Initial MCS to use when EGPRS is used: + * MCS1 -> 1, MCS2 -> 2, ..., MCS9 -> 9 */ + uint8_t initial_mcs; +} __attribute__((packed)); + +/*! Osmocom NSVC address type for NM_ATT_OSMO_NS_LINK_CFG */ +enum osmo_oml_nsvc_address_type { + OSMO_NSVC_ADDR_UNSPEC = 0x00, + OSMO_NSVC_ADDR_IPV4 = 0x04, + OSMO_NSVC_ADDR_IPV6 = 0x29, +}; + /*! 3GPP TS 52.021 §9.4.62 SW Description */ struct abis_nm_sw_desc { uint8_t file_id[UINT8_MAX]; diff --git a/include/osmocom/gsm/protocol/gsm_23_032.h b/include/osmocom/gsm/protocol/gsm_23_032.h new file mode 100644 index 00000000..6eb65ca2 --- /dev/null +++ b/include/osmocom/gsm/protocol/gsm_23_032.h @@ -0,0 +1,252 @@ +/*! \defgroup gad 3GPP TS 23.032 GAD: Universal Geographical Area Description. + * @{ + * \file gsm_23_032.h + */ +/* + * (C) 2020 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de> + * + * All Rights Reserved + * + * Author: Neels Hofmeyr <neels@hofmeyr.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#pragma once + +#include <stdint.h> +#include <osmocom/core/endian.h> + +enum gad_type { + /*! Ellipsoid point */ + GAD_TYPE_ELL_POINT = 0, + /*! Ellipsoid point with uncertainty circle. */ + GAD_TYPE_ELL_POINT_UNC_CIRCLE = 1, + /*! Ellipsoid point with uncertainty ellipse. */ + GAD_TYPE_ELL_POINT_UNC_ELLIPSE = 3, + GAD_TYPE_POLYGON = 5, + /*! Ellipsoid point with altitude. */ + GAD_TYPE_ELL_POINT_ALT = 8, + /*! Ellipsoid point with altitude and uncertainty ellipsoid. */ + GAD_TYPE_ELL_POINT_ALT_UNC_ELL = 9, + /*! Ellipsoid arc */ + GAD_TYPE_ELL_ARC = 10, + /*! High accuracy ellipsoid point with uncertainty ellipse. */ + GAD_TYPE_HA_ELL_POINT_UNC_ELLIPSE = 11, + /*! High accuracy ellipsoid point with altitude and uncertainty ellipsoid. */ + GAD_TYPE_HA_ELL_POINT_ALT_UNC_ELL = 12, +}; + +struct gad_raw_head { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t spare:4, + type:4; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t type:4, spare:4; +#endif +} __attribute__ ((packed)); + +struct gad_raw_ell_point { + struct gad_raw_head h; /*!< type = GAD_TYPE_ELL_POINT */ + uint8_t lat[3]; + uint8_t lon[3]; +} __attribute__ ((packed)); + +struct gad_raw_ell_point_unc_circle { +#if OSMO_IS_LITTLE_ENDIAN + struct gad_raw_head h; /*!< type = GAD_TYPE_ELL_POINT_UNC_CIRCLE */ + uint8_t lat[3]; + uint8_t lon[3]; + uint8_t unc:7, + spare2:1; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + struct gad_raw_head h; + uint8_t lat[3]; + uint8_t lon[3]; + uint8_t spare2:1, unc:7; +#endif +} __attribute__ ((packed)); + +struct gad_raw_ell_point_unc_ellipse { +#if OSMO_IS_LITTLE_ENDIAN + struct gad_raw_head h; /*!< type = GAD_TYPE_ELL_POINT_UNC_ELLIPSE */ + uint8_t lat[3]; + uint8_t lon[3]; + uint8_t unc_semi_major:7, + spare1:1; + uint8_t unc_semi_minor:7, + spare2:1; + uint8_t major_ori; + uint8_t confidence:7, + spare3:1; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + struct gad_raw_head h; + uint8_t lat[3]; + uint8_t lon[3]; + uint8_t spare1:1, unc_semi_major:7; + uint8_t spare2:1, unc_semi_minor:7; + uint8_t major_ori; + uint8_t spare3:1, confidence:7; +#endif +} __attribute__ ((packed)); + +struct gad_raw_polygon { + struct { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t num_points:4; + uint8_t type:4; /*!< type = GAD_TYPE_POLYGON */ +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t type:4, num_points:4; +#endif + } h; + struct { + uint8_t lat[3]; + uint8_t lon[3]; + } point[15]; +} __attribute__ ((packed)); + +struct gad_raw_ell_point_alt { + struct gad_raw_head h; /*!< type = GAD_TYPE_ELL_POINT_ALT */ + uint8_t lat[3]; + uint8_t lon[3]; + uint8_t alt[2]; +} __attribute__ ((packed)); + +struct gad_raw_ell_point_alt_unc_ell { +#if OSMO_IS_LITTLE_ENDIAN + struct gad_raw_head h; /*!< type = GAD_TYPE_ELL_POINT_ALT_UNC_ELL */ + uint8_t lat[3]; + uint8_t lon[3]; + uint8_t alt[2]; + uint8_t unc_semi_major:7, + spare1:1; + uint8_t unc_semi_minor:7, + spare2:1; + uint8_t major_ori; + uint8_t unc_alt:7, + spare3:1; + uint8_t confidence:7, + spare4:1; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + struct gad_raw_head h; + uint8_t lat[3]; + uint8_t lon[3]; + uint8_t alt[2]; + uint8_t spare1:1, unc_semi_major:7; + uint8_t spare2:1, unc_semi_minor:7; + uint8_t major_ori; + uint8_t spare3:1, unc_alt:7; + uint8_t spare4:1, confidence:7; +#endif +} __attribute__ ((packed)); + +struct gad_raw_ell_arc { +#if OSMO_IS_LITTLE_ENDIAN + struct gad_raw_head h; /*!< type = GAD_TYPE_ELL_ARC */ + uint8_t lat[3]; + uint8_t lon[3]; + uint8_t inner_r[2]; + uint8_t unc_r:7, + spare1:1; + uint8_t ofs_angle; + uint8_t incl_angle; + uint8_t confidence:7, + spare2:1; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + struct gad_raw_head h; + uint8_t lat[3]; + uint8_t lon[3]; + uint8_t inner_r[2]; + uint8_t spare1:1, unc_r:7; + uint8_t ofs_angle; + uint8_t incl_angle; + uint8_t spare2:1, confidence:7; +#endif +} __attribute__ ((packed)); + +struct gad_raw_ha_ell_point_unc_ell { +#if OSMO_IS_LITTLE_ENDIAN + struct gad_raw_head h; /*!< type = GAD_TYPE_HA_ELL_POINT_UNC_ELLIPSE */ + uint8_t lat[4]; + uint8_t lon[4]; + uint8_t alt[3]; + uint8_t unc_semi_major; + uint8_t unc_semi_minor; + uint8_t major_ori; + uint8_t confidence:7, + spare1:1; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + struct gad_raw_head h; + uint8_t lat[4]; + uint8_t lon[4]; + uint8_t alt[3]; + uint8_t unc_semi_major; + uint8_t unc_semi_minor; + uint8_t major_ori; + uint8_t spare1:1, confidence:7; +#endif +} __attribute__ ((packed)); + +struct gad_raw_ha_ell_point_alt_unc_ell { +#if OSMO_IS_LITTLE_ENDIAN + struct gad_raw_head h; /*!< type = GAD_TYPE_HA_ELL_POINT_ALT_UNC_ELL */ + uint8_t lat[4]; + uint8_t lon[4]; + uint8_t alt[3]; + uint8_t unc_semi_major; + uint8_t unc_semi_minor; + uint8_t major_ori; + uint8_t h_confidence:7, + spare1:1; + uint8_t unc_alt; + uint8_t v_confidence:7, + spare2:1; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + struct gad_raw_head h; + uint8_t lat[4]; + uint8_t lon[4]; + uint8_t alt[3]; + uint8_t unc_semi_major; + uint8_t unc_semi_minor; + uint8_t major_ori; + uint8_t spare1:1, h_confidence:7; + uint8_t unc_alt; + uint8_t spare2:1, v_confidence:7; +#endif +} __attribute__ ((packed)); + +/*! GAD PDU in network-byte-order according to 3GPP TS 23.032 GAD: Universal Geographical Area Description. */ +union gad_raw { + struct gad_raw_head h; + struct gad_raw_ell_point ell_point; + struct gad_raw_ell_point_unc_circle ell_point_unc_circle; + struct gad_raw_ell_point_unc_ellipse ell_point_unc_ellipse; + struct gad_raw_polygon polygon; + struct gad_raw_ell_point_alt ell_point_alt; + struct gad_raw_ell_point_alt_unc_ell ell_point_alt_unc_ell; + struct gad_raw_ell_arc ell_arc; + struct gad_raw_ha_ell_point_unc_ell ha_ell_point_unc_ell; + struct gad_raw_ha_ell_point_alt_unc_ell ha_ell_point_alt_unc_ell; +} __attribute__ ((packed)); + +/*! @} */ diff --git a/include/osmocom/gsm/protocol/gsm_23_041.h b/include/osmocom/gsm/protocol/gsm_23_041.h index e726cff2..2a2b006f 100644 --- a/include/osmocom/gsm/protocol/gsm_23_041.h +++ b/include/osmocom/gsm/protocol/gsm_23_041.h @@ -2,6 +2,16 @@ #include <osmocom/core/endian.h> +/* Section 9.3.24: Warning-Type */ +enum gsm23041_warning_type_value { + CBS_ETWS_WARN_TYPE_EARTHQUAKE = 0, + CBS_ETWS_WARN_TYPE_TSUNAMI = 1, + CBS_ETWS_WARN_TYPE_EARTHQUAKE_AND_TSUNAMI = 2, + CBS_ETWS_WARN_TYPE_TEST = 3, + CBS_ETWS_WARN_TYPE_OTHER = 4, + /* 0000101-1111111 Reserved for future use */ +}; + /* Section 9.4.1.2: GSM Message Format */ struct gsm23041_msg_param_gsm { uint16_t serial_nr; @@ -12,7 +22,7 @@ struct gsm23041_msg_param_gsm { uint8_t num_pages:4, page_nr:4; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t page_nr:4, num_pages:4; #endif } page_param; diff --git a/include/osmocom/gsm/protocol/gsm_25_415.h b/include/osmocom/gsm/protocol/gsm_25_415.h new file mode 100644 index 00000000..5c4dd2bb --- /dev/null +++ b/include/osmocom/gsm/protocol/gsm_25_415.h @@ -0,0 +1,222 @@ +#pragma once +/* Iu User Plane (IuUP) Definitions as per 3GPP TS 25.415 */ +/* (C) 2017 by Harald Welte <laforge@gnumonks.org> + * All Rights Reserved. + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <stdint.h> +#include <osmocom/core/endian.h> + +/* 3GPP TS 25.415 Section 6.6.2.1 */ +struct iuup_pdutype0_hdr { +#if OSMO_IS_LITTLE_ENDIAN + /* control part */ + uint8_t frame_nr:4, + pdu_type:4; + uint8_t rfci:6, + fqc:2; + /* checksum part */ + uint8_t payload_crc_hi:2, header_crc:6; + uint8_t payload_crc_lo; + + /* payload part */ + uint8_t payload[0]; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t pdu_type:4, frame_nr:4; + uint8_t fqc:2, rfci:6; + uint8_t header_crc:6, payload_crc_hi:2; + uint8_t payload_crc_lo; + uint8_t payload[0]; +#endif +} __attribute__((packed)); + +/* 3GPP TS 25.415 Section 6.6.2.2 */ +struct iuup_pdutype1_hdr { +#if OSMO_IS_LITTLE_ENDIAN + /* control part */ + uint8_t frame_nr:4, + pdu_type:4; + uint8_t rfci:6, + fqc:2; + /* checksum part */ + uint8_t spare:2, + header_crc:6; + /* payload part */ + uint8_t payload[0]; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t pdu_type:4, frame_nr:4; + uint8_t fqc:2, rfci:6; + uint8_t header_crc:6, spare:2; + uint8_t payload[0]; +#endif +} __attribute__((packed)); + +/* 3GPP TS 25.415 Section 6.6.2.3 */ +struct iuup_pdutype14_hdr { +#if OSMO_IS_LITTLE_ENDIAN + /* control part */ + uint8_t frame_nr:2, + ack_nack:2, + pdu_type:4; + uint8_t proc_ind:4, + mode_version:4; + /* checksum part */ + uint8_t payload_crc_hi:2, header_crc:6; + uint8_t payload_crc_lo; + /* payload part */ + uint8_t payload[0]; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t pdu_type:4, ack_nack:2, frame_nr:2; + uint8_t mode_version:4, proc_ind:4; + uint8_t header_crc:6, payload_crc_hi:2; + uint8_t payload_crc_lo; + uint8_t payload[0]; +#endif +} __attribute__((packed)); + +/* 3GPP TS 25.415 Section 6.6.2.3.4.1 */ +struct iuup_ctrl_init_rfci_hdr { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t rfci:6, + li:1, + lri:1; + uint8_t subflow_length[0]; /* 1 or 2 bytes depending on li */ +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t lri:1, li:1, rfci:6; + uint8_t subflow_length[0]; +#endif +} __attribute__((packed)); +struct iuup_ctrl_init_hdr { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t chain_ind:1, + num_subflows_per_rfci:3, + ti:1, + spare:3; + uint8_t rfci_data[0]; /* struct iuup_ctrl_init_rfci_hdr* */ +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t spare:3, ti:1, num_subflows_per_rfci:3, chain_ind:1; + uint8_t rfci_data[0]; /* struct iuup_ctrl_init_rfci_hdr* */ +; +#endif +} __attribute__((packed)); +struct iuup_ctrl_init_tail { +#if OSMO_IS_LITTLE_ENDIAN + uint16_t versions_supported; + uint8_t spare:4, + data_pdu_type:4; + uint8_t spare_extension[0]; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint16_t versions_supported; + uint8_t data_pdu_type:4, spare:4; + uint8_t spare_extension[0]; +#endif +} __attribute__((packed)); + +/* 3GPP TS 25.415 Section 6.6.2.3.4.4 */ +struct iuup_ctrl_error_event { +#if OSMO_IS_LITTLE_ENDIAN + struct iuup_pdutype14_hdr hdr; + uint8_t error_cause:6, + error_distance:2; + uint8_t spare_extension[0]; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + struct iuup_pdutype14_hdr hdr; + uint8_t error_distance:2, error_cause:6; + uint8_t spare_extension[0]; +#endif +} __attribute__((packed)); + +/* 3GPP TS 25.415 Section 6.6.2.3.2 */ +struct iuup_ctrl_ack { + struct iuup_pdutype14_hdr hdr; + uint8_t spare_extension[0]; +} __attribute__((packed)); + +/* 3GPP TS 25.415 Section 6.6.2.3.3 */ +struct iuup_ctrl_nack { +#if OSMO_IS_LITTLE_ENDIAN + struct iuup_pdutype14_hdr hdr; + uint8_t spare:2, + error_cause:6; + uint8_t spare_extension[0]; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + struct iuup_pdutype14_hdr hdr; + uint8_t error_cause:6, spare:2; + uint8_t spare_extension[0]; +#endif +} __attribute__((packed)); + +/* 3GPP TS 25.415 Section 6.6.2 + 6.6.3.1 */ +enum iuup_pdu_type { + IUUP_PDU_T_DATA_CRC = 0, + IUUP_PDU_T_DATA_NOCRC = 1, + IUUP_PDU_T_CONTROL = 14, +}; + +/* 3GPP TS 25.415 Section 6.6.3.2 */ +enum iuup_ack_nack { + IUUP_AN_PROCEDURE = 0, + IUUP_AN_ACK = 1, + IUUP_AN_NACK = 2, +}; + +/* 3GPP TS 25.415 Section 6.6.3.5 */ +enum iuup_fqc { + IUUP_FQC_FRAME_GOOD = 0, + IUUP_FQC_FRAME_BAD = 1, + IUUP_FQC_FRAME_BAD_RADIO = 2, +}; + +/* 3GPP TS 25.415 Section 6.6.3.7 */ +enum iuup_procedure { + IUUP_PROC_INIT = 0, + IUUP_PROC_RATE_CTRL = 1, + IUUP_PROC_TIME_ALIGN = 2, + IUUP_PROC_ERR_EVENT = 3, +}; + + +/* 3GPP TS 25.415 Section 6.6.3.15 */ +enum iuup_error_distance { + IUUP_ERR_DIST_LOCAL = 0, + IUUP_ERR_DIST_FIRST_FWD = 1, + IUUP_ERR_DIST_SECOND_FWD = 2, + IUUP_ERR_DIST_RESERVED = 3, +}; + + +/* 3GPP TS 25.415 Section 6.6.3.16 */ +enum iuup_error_cause { + IUUP_ERR_CAUSE_CRC_ERR_HDR = 0, + IUUP_ERR_CAUSE_CRC_ERR_DATA = 1, + IUUP_ERR_CAUSE_UNEXPECTED_FN = 2, + IUUP_ERR_CAUSE_FRAME_LOSS = 3, + IUUP_ERR_CAUSE_UNKNOWN_PDUTYPE = 4, + IUUP_ERR_CAUSE_UNKNOWN_PROC = 5, + IUUP_ERR_CAUSE_UNKNNOWN_RES_VAL = 6, + IUUP_ERR_CAUSE_UNKNNOWN_FIELD = 7, + IUUP_ERR_CAUSE_FRAME_TOO_SHORT = 8, + IUUP_ERR_CAUSE_MISSING_FIELDS = 9, + IUUP_ERR_CAUSE_UNEXPECTED_PDU_T = 16, + IUUP_ERR_CAUSE_UNEXPECTED_PROC = 18, + IUUP_ERR_CAUSE_UNEXPECTED_RFCI = 19, + IUUP_ERR_CAUSE_UNEXPECTED_VALUE = 20, + IUUP_ERR_CAUSE_INIT_FAILURE = 42, + IUUP_ERR_CAUSE_INIT_FAILURE_NET_TMR = 43, + IUUP_ERR_CAUSE_INIT_FAILURE_REP_NACK = 44, + IUUP_ERR_CAUSE_RATE_CTRL_FAILURE = 45, + IUUP_ERR_CAUSE_ERR_EVENT_FAIL = 46, + IUUP_ERR_CAUSE_TIME_ALIGN_NOTSUPP = 47, + IUUP_ERR_CAUSE_REQ_TIME_ALIGN_NOTPOSS = 48, + IUUP_ERR_CAUSE_MODE_VERSION_NOT_SUPPORTED = 49, +}; diff --git a/include/osmocom/gsm/protocol/gsm_44_004.h b/include/osmocom/gsm/protocol/gsm_44_004.h new file mode 100644 index 00000000..c30ba0c9 --- /dev/null +++ b/include/osmocom/gsm/protocol/gsm_44_004.h @@ -0,0 +1,19 @@ +#pragma once + +#include <osmocom/core/endian.h> + +/* TS 44.004 Section 7.1 */ + +struct gsm_sacch_l1_hdr { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t ms_pwr:5, + fpc_epc:1, + srr_sro:1, + reserved:1; + uint8_t ta; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t reserved:1, srr_sro:1, fpc_epc:1, ms_pwr:5; + uint8_t ta; +#endif +} __attribute__ ((packed)); diff --git a/include/osmocom/gsm/protocol/gsm_44_060.h b/include/osmocom/gsm/protocol/gsm_44_060.h new file mode 100644 index 00000000..1df2f800 --- /dev/null +++ b/include/osmocom/gsm/protocol/gsm_44_060.h @@ -0,0 +1,252 @@ +/*! \file gsm_44_060.h + * General Packet Radio Service (GPRS). + * Radio Link Control / Medium Access Control (RLC/MAC) protocol + * 3GPP TS 44.060 + */ + +#pragma once + +#include <stdint.h> +#include <osmocom/core/endian.h> + +/* TS 44.060 10.3a.4.1.1 */ +struct gprs_rlc_ul_header_egprs_1 { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t r:1, + si:1, + cv:4, + tfi_hi:2; + uint8_t tfi_lo:3, + bsn1_hi:5; + uint8_t bsn1_lo:6, + bsn2_hi:2; + uint8_t bsn2_lo:8; + uint8_t cps:5, + rsb:1, + pi:1, + spare_hi:1; + uint8_t spare_lo:6, + dummy:2; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t tfi_hi:2, cv:4, si:1, r:1; + uint8_t bsn1_hi:5, tfi_lo:3; + uint8_t bsn2_hi:2, bsn1_lo:6; + uint8_t bsn2_lo:8; + uint8_t spare_hi:1, pi:1, rsb:1, cps:5; + uint8_t dummy:2, spare_lo:6; +#endif +} __attribute__ ((packed)); + +/* TS 44.060 10.3a.4.2.1 */ +struct gprs_rlc_ul_header_egprs_2 { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t r:1, + si:1, + cv:4, + tfi_hi:2; + uint8_t tfi_lo:3, + bsn1_hi:5; + uint8_t bsn1_lo:6, + cps_hi:2; + uint8_t cps_lo:1, + rsb:1, + pi:1, + spare_hi:5; + uint8_t spare_lo:5, + dummy:3; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t tfi_hi:2, cv:4, si:1, r:1; + uint8_t bsn1_hi:5, tfi_lo:3; + uint8_t cps_hi:2, bsn1_lo:6; + uint8_t spare_hi:5, pi:1, rsb:1, cps_lo:1; + uint8_t dummy:3, spare_lo:5; +#endif +} __attribute__ ((packed)); + +/* TS 44.060 10.3a.4.3.1 */ +struct gprs_rlc_ul_header_egprs_3 { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t r:1, + si:1, + cv:4, + tfi_hi:2; + uint8_t tfi_lo:3, + bsn1_hi:5; + uint8_t bsn1_lo:6, + cps_hi:2; + uint8_t cps_lo:2, + spb:2, + rsb:1, + pi:1, + spare:1, + dummy:1; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t tfi_hi:2, cv:4, si:1, r:1; + uint8_t bsn1_hi:5, tfi_lo:3; + uint8_t cps_hi:2, bsn1_lo:6; + uint8_t dummy:1, spare:1, pi:1, rsb:1, spb:2, cps_lo:2; +#endif +} __attribute__ ((packed)); + +struct gprs_rlc_dl_header_egprs_1 { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t usf:3, + es_p:2, + rrbp:2, + tfi_hi:1; + uint8_t tfi_lo:4, + pr:2, + bsn1_hi:2; + uint8_t bsn1_mid:8; + uint8_t bsn1_lo:1, + bsn2_hi:7; + uint8_t bsn2_lo:3, + cps:5; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t tfi_hi:1, rrbp:2, es_p:2, usf:3; + uint8_t bsn1_hi:2, pr:2, tfi_lo:4; + uint8_t bsn1_mid:8; + uint8_t bsn2_hi:7, bsn1_lo:1; + uint8_t cps:5, bsn2_lo:3; +#endif +} __attribute__ ((packed)); + +struct gprs_rlc_dl_header_egprs_2 { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t usf:3, + es_p:2, + rrbp:2, + tfi_hi:1; + uint8_t tfi_lo:4, + pr:2, + bsn1_hi:2; + uint8_t bsn1_mid:8; + uint8_t bsn1_lo:1, + cps:3, + dummy:4; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t tfi_hi:1, rrbp:2, es_p:2, usf:3; + uint8_t bsn1_hi:2, pr:2, tfi_lo:4; + uint8_t bsn1_mid:8; + uint8_t dummy:4, cps:3, bsn1_lo:1; +#endif +} __attribute__ ((packed)); + +struct gprs_rlc_dl_header_egprs_3 { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t usf:3, + es_p:2, + rrbp:2, + tfi_hi:1; + uint8_t tfi_lo:4, + pr:2, + bsn1_hi:2; + uint8_t bsn1_mid:8; + uint8_t bsn1_lo:1, + cps:4, + spb:2, + dummy:1; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t tfi_hi:1, rrbp:2, es_p:2, usf:3; + uint8_t bsn1_hi:2, pr:2, tfi_lo:4; + uint8_t bsn1_mid:8; + uint8_t dummy:1, spb:2, cps:4, bsn1_lo:1; +#endif +} __attribute__ ((packed)); + +/* TS 44.060 Table 12.24.2 +* Meaning of values documented in TS 23.060 Chapter 6.3.3.1: Network Mode of Operation */ +enum osmo_gprs_nmo { + GPRS_NMO_I = 0, /* CS pagin on GPRS paging or traffic channel */ + GPRS_NMO_II = 1, /* all paging on CCCH */ + GPRS_NMO_III = 2, /* no paging coordination */ +}; + +/* TS 44.060 12.24 */ +struct osmo_gprs_cell_options { + enum osmo_gprs_nmo nmo; + /* T3168: wait for packet uplink assignment message */ + uint32_t t3168; /* in milliseconds */ + /* T3192: wait for release of the TBF after reception of the final block */ + uint32_t t3192; /* in milliseconds */ + uint32_t drx_timer_max;/* in seconds */ + uint32_t bs_cv_max; + uint8_t supports_egprs_11bit_rach; + bool ctrl_ack_type_use_block; /* use PACKET CONTROL ACKNOWLEDGMENT */ + + uint8_t ext_info_present; + struct { + uint8_t egprs_supported; + uint8_t use_egprs_p_ch_req; + uint8_t bep_period; + uint8_t pfc_supported; + uint8_t dtm_supported; + uint8_t bss_paging_coordination; + bool ccn_active; + } ext_info; +}; + +/* TS 44.060 Table 12.9.2 */ +struct osmo_gprs_power_ctrl_pars { + uint8_t alpha; + uint8_t t_avg_w; + uint8_t t_avg_t; + uint8_t pc_meas_chan; + uint8_t n_avg_i; +}; + + +/*! Structure for CPS coding and puncturing scheme (TS 44.060 10.4.8a) */ +struct egprs_cps { + uint8_t bits; + uint8_t mcs; + uint8_t p[2]; +}; + +/*! CPS puncturing table selection (TS 44.060 10.4.8a) */ +enum egprs_cps_punc { + EGPRS_CPS_P1, + EGPRS_CPS_P2, + EGPRS_CPS_P3, + EGPRS_CPS_NONE = -1, +}; + +/*! EGPRS header types (TS 44.060 10.0a.2) */ +enum egprs_hdr_type { + EGPRS_HDR_TYPE1, + EGPRS_HDR_TYPE2, + EGPRS_HDR_TYPE3, +}; + +enum osmo_gprs_cs { + OSMO_GPRS_CS_NONE, + OSMO_GPRS_CS1, + OSMO_GPRS_CS2, + OSMO_GPRS_CS3, + OSMO_GPRS_CS4, + OSMO_GPRS_MCS1, + OSMO_GPRS_MCS2, + OSMO_GPRS_MCS3, + OSMO_GPRS_MCS4, + OSMO_GPRS_MCS5, + OSMO_GPRS_MCS6, + OSMO_GPRS_MCS7, + OSMO_GPRS_MCS8, + OSMO_GPRS_MCS9, + _NUM_OSMO_GPRS_CS +}; + +int egprs_get_cps(struct egprs_cps *cps, uint8_t type, uint8_t bits); + +int osmo_gprs_ul_block_size_bits(enum osmo_gprs_cs cs); +int osmo_gprs_dl_block_size_bits(enum osmo_gprs_cs cs); +int osmo_gprs_ul_block_size_bytes(enum osmo_gprs_cs cs); +int osmo_gprs_dl_block_size_bytes(enum osmo_gprs_cs cs); +enum osmo_gprs_cs osmo_gprs_ul_cs_by_block_bytes(uint8_t block_size); +enum osmo_gprs_cs osmo_gprs_dl_cs_by_block_bytes(uint8_t block_size); diff --git a/include/osmocom/gsm/protocol/gsm_44_068.h b/include/osmocom/gsm/protocol/gsm_44_068.h new file mode 100644 index 00000000..3a33c163 --- /dev/null +++ b/include/osmocom/gsm/protocol/gsm_44_068.h @@ -0,0 +1,136 @@ +#pragma once +#include <stdint.h> +#include <osmocom/core/utils.h> + +/* Group Call Control (GCC) is an ETSI/3GPP standard protocol used between + * MS (Mobile Station) and MSC (Mobile Switchting Center) in 2G/GSM-R network. + * It is specified in 3GPP TS 44.068. + * + * (C) 2023 by Sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Andreas Eversberg + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +/* 9 Information Element Identifiers */ +enum osmo_gsm44068_iei { + OSMO_GSM44068_IEI_MOBILE_IDENTITY = 0x17, + OSMO_GSM44068_IEI_USER_USER = 0x7E, + OSMO_GSM44068_IEI_CALL_STATE = 0xA0, + OSMO_GSM44068_IEI_STATE_ATTRIBUTES = 0xB0, + OSMO_GSM44068_IEI_TALKER_PRIORITY = 0xC0, + OSMO_GSM44068_IEI_SMS_INDICATIONS = 0xD0, +}; + +/* 9.3 Message Type */ +enum osmo_gsm44068_msg_type { + OSMO_GSM44068_MSGT_IMMEDIATE_SETUP = 0x31, + OSMO_GSM44068_MSGT_SETUP = 0x32, + OSMO_GSM44068_MSGT_CONNECT = 0x33, + OSMO_GSM44068_MSGT_TERMINATION = 0x34, + OSMO_GSM44068_MSGT_TERMINATION_REQUEST = 0x35, + OSMO_GSM44068_MSGT_TERMINATION_REJECT = 0x36, + OSMO_GSM44068_MSGT_STATUS = 0x38, + OSMO_GSM44068_MSGT_GET_STATUS = 0x39, + OSMO_GSM44068_MSGT_SET_PARAMETER = 0x3a, + OSMO_GSM44068_MSGT_IMMEDIATE_SETUP_2 = 0x3b, +}; + +/* Table 9.2 priority */ +enum osmo_gsm44068_priority_level { + OSMO_GSM44068_PRIO_LEVEL_4 = 0x1, + OSMO_GSM44068_PRIO_LEVEL_3 = 0x2, + OSMO_GSM44068_PRIO_LEVEL_2 = 0x3, + OSMO_GSM44068_PRIO_LEVEL_1 = 0x4, + OSMO_GSM44068_PRIO_LEVEL_0 = 0x5, + OSMO_GSM44068_PRIO_LEVEL_B = 0x6, + OSMO_GSM44068_PRIO_LEVEL_A = 0x7, +}; + +/* 9.4.2 Call State */ +enum osmo_gsm44068_call_state { + OSMO_GSM44068_CSTATE_U0 = 0x0, + OSMO_GSM44068_CSTATE_U1 = 0x1, + OSMO_GSM44068_CSTATE_U2sl_U2 = 0x2, + OSMO_GSM44068_CSTATE_U3 = 0x3, + OSMO_GSM44068_CSTATE_U4 = 0x4, + OSMO_GSM44068_CSTATE_U5 = 0x5, + OSMO_GSM44068_CSTATE_U0p = 0x6, + OSMO_GSM44068_CSTATE_U2wr_U6 = 0x7, + OSMO_GSM44068_CSTATE_U2r = 0x8, + OSMO_GSM44068_CSTATE_U2ws = 0x9, + OSMO_GSM44068_CSTATE_U2sr = 0xa, + OSMO_GSM44068_CSTATE_U2nc = 0xb, +}; + +/* 9.4.3 Cause */ +enum osmo_gsm44068_cause { + OSMO_GSM44068_CAUSE_ILLEGAL_MS = 0x03, + OSMO_GSM44068_CAUSE_IMEI_NOT_ACCEPTED = 0x05, + OSMO_GSM44068_CAUSE_ILLEGAL_ME = 0x06, + OSMO_GSM44068_CAUSE_SERVICE_NOT_AUTHORIZED = 0x08, + OSMO_GSM44068_CAUSE_APP_NOT_SUPPORTED_ON_PROTO = 0x09, + OSMO_GSM44068_CAUSE_RR_CONNECTION_ABORTED = 0x0a, + OSMO_GSM44068_CAUSE_NORMAL_CALL_CLEARING = 0x10, + OSMO_GSM44068_CAUSE_NETWORK_FAILURE = 0x11, + OSMO_GSM44068_CAUSE_BUSY = 0x14, + OSMO_GSM44068_CAUSE_CONGESTION = 0x16, + OSMO_GSM44068_CAUSE_USER_NOT_ORIGINATOR = 0x17, + OSMO_GSM44068_CAUSE_NET_WANTS_TO_MAINTAIN_CALL = 0x18, + OSMO_GSM44068_CAUSE_RESPONSE_TO_GET_STATUS = 0x1e, + OSMO_GSM44068_CAUSE_SERVICE_OPTION_NOT_SUBSCR = 0x20, + OSMO_GSM44068_CAUSE_REQUESTED_SERVICE_NOT_SUB = 0x21, + OSMO_GSM44068_CAUSE_SERVICE_OPTION_OOO = 0x22, + OSMO_GSM44068_CAUSE_CALL_CANNOT_BE_IDENTIFIED = 0x26, + OSMO_GSM44068_CAUSE_RETRY_UPON_ENTRY_NEW_CALL = 0x30, /* up to 0x3f */ + OSMO_GSM44068_CAUSE_INVALID_TRANSACTION_ID = 0x51, + OSMO_GSM44068_CAUSE_SEMANTICALLY_INCORRECT_MSG = 0x5f, + OSMO_GSM44068_CAUSE_INVALID_MANDATORY_INFO = 0x60, + OSMO_GSM44068_CAUSE_MESSAGE_TYPE_NON_EXISTENT = 0x61, + OSMO_GSM44068_CAUSE_MESSAGE_TYPE_NOT_COMPAT = 0x62, + OSMO_GSM44068_CAUSE_IE_NON_EXISTENT = 0x63, + OSMO_GSM44068_CAUSE_IE_NOT_COMPAT = 0x64, + OSMO_GSM44068_CAUSE_PROTOCOL_ERROR = 0x70, +}; + +/* 9.4.4 Originator Indication */ +#define OSMO_GSM44068_OI_MS_IS_ORIGINATOR 0x01 + +/* 9.4.7 State Attributes */ +#define OSMO_GSM44068_DA_DOWNLINK_ATTACHED 0x08 +#define OSMO_GSM44068_UA_UPLINK_ATTACHED 0x04 +#define OSMO_GSM44068_COMM_T 0x02 + +/* 9.4.9 Talker Priority */ +enum osmo_gsm44068_talker_priority { + OSMO_GSM44068_PRIO_NORMAL = 0x0, + OSMO_GSM44068_PRIO_PRIVILEGED = 0x1, + OSMO_GSM44068_PRIO_EMERGENCY = 0x2, +}; + +/* 9.4.10 SMS Indications */ +#define OSMO_GSM44068_DC_DATA_CONFIDENTALLY_RQD 0x02 +#define OSMO_GSM44068_GP_GUARANTEED_PRIVACY_RQD 0x01 + +extern const struct value_string osmo_gsm44068_msg_type_names[]; +extern const struct value_string osmo_gsm44068_priority_level_names[]; +extern const struct value_string osmo_gsm44068_cause_names[]; +extern const struct value_string osmo_gsm44068_call_state_names[]; +extern const struct value_string osmo_gsm44068_talker_priority_names[]; + +extern const struct tlv_definition osmo_gsm44068_att_tlvdef; diff --git a/include/osmocom/gsm/protocol/gsm_44_318.h b/include/osmocom/gsm/protocol/gsm_44_318.h index b3942be2..f31a80ae 100644 --- a/include/osmocom/gsm/protocol/gsm_44_318.h +++ b/include/osmocom/gsm/protocol/gsm_44_318.h @@ -162,7 +162,7 @@ struct gan_rc_csr_hdr { uint8_t msg_type; uint8_t data[0]; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint16_t len; uint8_t skip_ind:4, pdisc:4; uint8_t msg_type; @@ -190,7 +190,7 @@ struct gan_cch_desc_ie { spare2:2; uint8_t access_class[2]; #elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ uint8_t mscr:1, att:1, dtm:1, gprs:1, nmo:2, ecmc:1, spare:1; uint8_t t3212; uint8_t rac; diff --git a/include/osmocom/gsm/protocol/gsm_48_071.h b/include/osmocom/gsm/protocol/gsm_48_071.h new file mode 100644 index 00000000..961211b3 --- /dev/null +++ b/include/osmocom/gsm/protocol/gsm_48_071.h @@ -0,0 +1,118 @@ +/*! \defgroup bsslap 3GPP TS 48.071 BSS LCS Assistance Protocol (BSSLAP). + * @{ + * \file gsm_48_071.h + */ +/* + * (C) 2020 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de> + * All Rights Reserved + * + * Author: Neels Hofmeyr <neels@hofmeyr.de> + * + * SPDX-License-Identifier: GPL-2.0+ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ +#pragma once + +#include <osmocom/gsm/protocol/gsm_04_08.h> + +enum bsslap_msgt { + BSSLAP_MSGT_TA_REQUEST = 0x1, + BSSLAP_MSGT_TA_RESPONSE = 0x2, + BSSLAP_MSGT_REJECT = 0xa, + BSSLAP_MSGT_RESET = 0xb, + BSSLAP_MSGT_ABORT = 0xc, + BSSLAP_MSGT_TA_LAYER3 = 0xd, + BSSLAP_MSGT_MS_POS_CMD = 0xf, + BSSLAP_MSGT_MS_POS_RESP = 0x10, + BSSLAP_MSGT_UTDOA_REQ = 0x11, + BSSLAP_MSGT_UTDOA_RESP = 0x12, +}; + +enum bsslap_cause { + BSSLAP_CAUSE_CONGESTION = 0x0, + BSSLAP_CAUSE_CHAN_MODE_NOT_SUPP = 0x1, + BSSLAP_CAUSE_POS_PROC_NOT_SUPP = 0x2, + BSSLAP_CAUSE_OTHER_RADIO_EVT_FAIL = 0x3, + BSSLAP_CAUSE_INTRA_BSS_HO = 0x4, + BSSLAP_CAUSE_SUPERV_TIMER_EXPIRED = 0x5, + BSSLAP_CAUSE_INTER_BSS_HO = 0x6, + BSSLAP_CAUSE_LOSS_SIG_CONN_MS = 0x7, + BSSLAP_CAUSE_INCORR_SERV_CELL_ID = 0x8, + BSSLAP_CAUSE_BSSAP_LE_SEGMENT_ERR = 0x9, + BSSLAP_CAUSE_CONCUR_POS_PROC_NOT_EN = 0xa, +}; + +enum bsslap_iei { + BSSLAP_IEI_TA = 0x1, + BSSLAP_IEI_CELL_ID = 0x9, + BSSLAP_IEI_CHAN_DESC = 0x10, + BSSLAP_IEI_MEAS_REP = 0x14, + BSSLAP_IEI_CAUSE = 0x18, + BSSLAP_IEI_RRLP_FLAG = 0x19, + BSSLAP_IEI_RRLP = 0x1b, + BSSLAP_IEI_CELL_ID_LIST = 0x1c, + BSSLAP_IEI_ENH_MEAS_REP = 0x1d, + BSSLAP_IEI_LAC = 0x1e, + BSSLAP_IEI_FREQ_LIST = 0x21, + BSSLAP_IEI_MS_POWER = 0x22, + BSSLAP_IEI_DELTA_TIMER = 0x23, + BSSLAP_IEI_SERVING_CELL_ID = 0x24, + BSSLAP_IEI_ENCR_KEY = 0x25, + BSSLAP_IEI_CIPH_MODE_SET = 0x26, + BSSLAP_IEI_CHAN_MODE = 0x27, + BSSLAP_IEI_MR_CONFIG = 0x28, + BSSLAP_IEI_POLLING_REPETITION = 0x29, + BSSLAP_IEI_PACKET_CHAN_DESC = 0x2a, + BSSLAP_IEI_TLLI = 0x2b, + BSSLAP_IEI_TFI = 0x2c, + BSSLAP_IEI_TBF_START_TIME = 0x2d, + BSSLAP_IEI_PWRUP_START_TIME = 0x2e, + BSSLAP_IEI_LONG_ENCR_KEY = 0x2f, + BSSLAP_IEI_CONCUR_POS_PROC_F = 0x30, +}; + +struct bsslap_ta_response { + uint16_t cell_id; + uint8_t ta; + + bool more_items; /*!< always set this to false */ +}; + +struct bsslap_ta_layer3 { + uint8_t ta; + + bool more_items; /*!< always set this to false */ +}; + +struct bsslap_reset { + uint16_t cell_id; + uint8_t ta; + struct gsm48_chan_desc chan_desc; + enum bsslap_cause cause; + + bool more_items; /*!< always set this to false */ +}; + +struct bsslap_pdu { + enum bsslap_msgt msg_type; + union { + /* ta_request: a TA Request message consists only of the message type. */ + struct bsslap_ta_response ta_response; + enum bsslap_cause reject; + struct bsslap_reset reset; + enum bsslap_cause abort; + struct bsslap_ta_layer3 ta_layer3; + }; +}; + +/*! @} */ diff --git a/include/osmocom/gsm/protocol/gsm_49_031.h b/include/osmocom/gsm/protocol/gsm_49_031.h new file mode 100644 index 00000000..463fabf5 --- /dev/null +++ b/include/osmocom/gsm/protocol/gsm_49_031.h @@ -0,0 +1,234 @@ +/*! \defgroup bssmap_le 3GPP TS 49.031 BSSMAP-LE. + * @{ + * \file gsm_49_031.h + */ +/* + * (C) 2020 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de> + * All Rights Reserved + * + * Author: Neels Hofmeyr <neels@hofmeyr.de> + * + * SPDX-License-Identifier: GPL-2.0+ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ +#pragma once + +#include <stdint.h> +#include <stdbool.h> + +#include <osmocom/core/endian.h> +#include <osmocom/gsm/protocol/gsm_48_071.h> +#include <osmocom/gsm/protocol/gsm_23_032.h> +#include <osmocom/gsm/gsm0808_utils.h> +#include <osmocom/gsm/gsm48.h> + +/*! 3GPP TS 49.031 10.13 LCS Cause, also in 3GPP TS 48.008 3.2.2.66, which simply refers to the former. */ +enum lcs_cause { + LCS_CAUSE_UNSPECIFIED = 0, + LCS_CAUSE_SYSTEM_FAILURE = 1, + LCS_CAUSE_PROTOCOL_ERROR = 2, + LCS_CAUSE_DATA_MISSING_IN_REQ = 3, + LCS_CAUSE_UNEXP_DATA_IN_REQ = 4, + LCS_CAUSE_POS_METH_FAILURE = 5, + LCS_CAUSE_TGT_MS_UNREACHABLE = 6, + LCS_CAUSE_REQUEST_ABORTED = 7, + LCS_CAUSE_FACILITY_NOTSUPP = 8, + LCS_CAUSE_INTER_BSC_HO = 9, + LCS_CAUSE_INTRA_BSC_HO = 10, + LCS_CAUSE_CONGESTION = 11, + LCS_CAUSE_INTER_NSE_CHG = 12, + LCS_CAUSE_RA_UPDAT = 13, + LCS_CAUSE_PTMSI_REALLOC = 14, + LCS_CAUSE_GPRS_SUSPENSION = 15, +}; + +/*! 3GPP TS 49.031 10.13 LCS Cause, also in 3GPP TS 48.008 3.2.2.66, which simply refers to the former. */ +struct lcs_cause_ie { + bool present; + enum lcs_cause cause_val; + bool diag_val_present; + uint8_t diag_val; +}; + +/* 3GPP TS 49.031 10.16 LCS QoS IE */ +struct osmo_bssmap_le_lcs_qos { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t vert:1, vel:1, spare1:6; + uint8_t ha_val:7, ha_ind:1; + uint8_t va_val:7, va_ind:1; + uint8_t spare3:6, rt:2; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t spare1:6, vel:1, vert:1; + uint8_t ha_ind:1, ha_val:7; + uint8_t va_ind:1, va_val:7; + uint8_t rt:2, spare3:6; +#endif +} __attribute__ ((packed)); + +enum bssap_le_msg_discr { + BSSAP_LE_MSG_DISCR_BSSMAP_LE = 0, +}; + +enum bssmap_le_msgt { + BSSMAP_LE_MSGT_PERFORM_LOC_REQ = 0x2b, + BSSMAP_LE_MSGT_PERFORM_LOC_RESP = 0x2d, + BSSMAP_LE_MSGT_PERFORM_LOC_ABORT = 0x2e, + BSSMAP_LE_MSGT_PERFORM_LOC_INFO = 0x2f, + BSSMAP_LE_MSGT_ASSIST_INFO_REQ = 0x20, + BSSMAP_LE_MSGT_ASSIST_INFO_RESP = 0x21, + BSSMAP_LE_MSGT_CONN_ORIENTED_INFO = 0x2a, + BSSMAP_LE_MSGT_CONN_LESS_INFO = 0x3a, + BSSMAP_LE_MSGT_RESET = 0x30, + BSSMAP_LE_MSGT_RESET_ACK = 0x31, +}; + +enum bssmap_le_iei { + BSSMAP_LE_IEI_LCS_QoS = 0x3e, + BSSMAP_LE_IEI_LCS_PRIORITY = 0x43, + BSSMAP_LE_IEI_LOCATION_TYPE = 0x44, + BSSMAP_LE_IEI_GANSS_LOCATION_TYPE = 0x82, + BSSMAP_LE_IEI_GEO_LOCATION = 0x45, + BSSMAP_LE_IEI_POSITIONING_DATA = 0x46, + BSSMAP_LE_IEI_GANSS_POS_DATA = 0x83, + BSSMAP_LE_IEI_VELOCITY_DATA = 0x55, + BSSMAP_LE_IEI_LCS_CAUSE = 0x47, + BSSMAP_LE_IEI_LCS_CLIENT_TYPE = 0x48, + BSSMAP_LE_IEI_APDU = 0x49, + BSSMAP_LE_IEI_NET_ELEM_ID = 0x4a, + BSSMAP_LE_IEI_REQ_GPS_ASS_D = 0x4b, + BSSMAP_LE_IEI_REQ_GANSS_ASS_D = 0x41, + BSSMAP_LE_IEI_DECIPH_KEYS = 0x4c, + BSSMAP_LE_IEI_RET_ERR_REQ = 0x4d, + BSSMAP_LE_IEI_RET_ERR_CAUSE = 0x4e, + BSSMAP_LE_IEI_SEGMENTATION = 0x4f, + BSSMAP_LE_IEI_CLASSMARK3_INFO = 0x13, + BSSMAP_LE_IEI_CAUSE = 0x4, + BSSMAP_LE_IEI_CELL_ID = 0x5, + BSSMAP_LE_IEI_CHOSEN_CHAN = 0x21, + BSSMAP_LE_IEI_IMSI = 0x0, + BSSMAP_LE_IEI_LCS_CAPABILITY = 0x50, + BSSMAP_LE_IEI_PKT_MEAS_REP = 0x51, + BSSMAP_LE_IEI_CELL_ID_LIST = 0x52, + BSSMAP_LE_IEI_IMEI = 0x80, + BSSMAP_LE_IEI_BSS_MLAT_CAP = 0x84, + BSSMAP_LE_IEI_CELL_INFO_LIST = 0x85, + BSSMAP_LE_IEI_BTS_RX_ACC_LVL = 0x86, + BSSMAP_LE_IEI_MLAT_METHOD = 0x87, + BSSMAP_LE_IEI_MLAT_TA = 0x88, + BSSMAP_LE_IEI_MS_SYNC_ACC = 0x89, + BSSMAP_LE_IEI_SHORT_ID_SET = 0x8a, + BSSMAP_LE_IEI_RANDOM_ID_SET = 0x8b, + BSSMAP_LE_IEI_SHORT_BSS_ID = 0x8c, + BSSMAP_LE_IEI_RANDOM_ID = 0x8d, + BSSMAP_LE_IEI_SHORT_ID = 0x8e, + BSSMAP_LE_IEI_COVERAGE_CLASS = 0x8f, + BSSMAP_LE_IEI_MTA_ACC_SEC_RQD = 0x90, +}; + +enum bssmap_le_apdu_proto { + BSSMAP_LE_APDU_PROT_RESERVED = 0, + BSSMAP_LE_APDU_PROT_BSSLAP = 1, + BSSMAP_LE_APDU_PROT_LLP = 2, + BSSMAP_LE_APDU_PROT_SMLCPP = 3, +}; + +enum bssmap_le_location_information { + BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC = 0x0, + BSSMAP_LE_LOC_INFO_ASSIST_TARGET_MS = 0x1, + BSSMAP_LE_LOC_INFO_BC_DECIPHER_KEYS = 0x2, +}; + +enum bssmap_le_positioning_method { + BSSMAP_LE_POS_METHOD_OMITTED = 0x0, + BSSMAP_LE_POS_METHOD_MOBILE_ASSISTED_E_OTD = 0x1, + BSSMAP_LE_POS_METHOD_MOBILE_BASED_E_OTD = 0x2, + BSSMAP_LE_POS_METHOD_ASSISTED_GPS = 0x3, +}; + +struct bssmap_le_location_type { + enum bssmap_le_location_information location_information; + enum bssmap_le_positioning_method positioning_method; +}; + +enum bssmap_le_lcs_client_type { + BSSMAP_LE_LCS_CTYPE_VALUE_ADDED_UNSPECIFIED = 0x0, + BSSMAP_LE_LCS_CTYPE_PLMN_OPER_UNSPECIFIED = 0x20, + BSSMAP_LE_LCS_CTYPE_PLMN_OPER_BCAST_SERVICE = 0x21, + BSSMAP_LE_LCS_CTYPE_PLMN_OPER_OAM = 0x22, + BSSMAP_LE_LCS_CTYPE_PLMN_OPER_ANON_STATS = 0x23, + BSSMAP_LE_LCS_CTYPE_PLMN_OPER_TGT_MS_SVC = 0x24, + BSSMAP_LE_LCS_CTYPE_EMERG_SVC_UNSPECIFIED = 0x30, + BSSMAP_LE_LCS_CTYPE_LI_UNSPECIFIED = 0x40, +}; + +struct bssmap_le_perform_loc_req { + struct bssmap_le_location_type location_type; + struct gsm0808_cell_id cell_id; + + bool lcs_client_type_present; + enum bssmap_le_lcs_client_type lcs_client_type; + + struct osmo_mobile_identity imsi; + struct osmo_mobile_identity imei; + + bool apdu_present; + struct bsslap_pdu apdu; + + bool more_items; /*!< set this to true iff any fields below are used */ + + bool lcs_priority_present; + uint8_t lcs_priority; /*!< see in 3GPP TS 29.002 */ + + bool lcs_qos_present; + struct osmo_bssmap_le_lcs_qos lcs_qos; + + bool more_items2; /*!< always set this to false */ +}; + +struct bssmap_le_perform_loc_resp { + bool location_estimate_present; + union gad_raw location_estimate; + + struct lcs_cause_ie lcs_cause; + + bool more_items; /*!< always set this to false */ +}; + +struct bssmap_le_conn_oriented_info { + struct bsslap_pdu apdu; + + bool more_items; /*!< always set this to false */ +}; + +struct bssmap_le_pdu { + enum bssmap_le_msgt msg_type; + union { + enum gsm0808_cause reset; + /* reset_ack consists only of the message type */ + struct bssmap_le_perform_loc_req perform_loc_req; + struct bssmap_le_perform_loc_resp perform_loc_resp; + struct lcs_cause_ie perform_loc_abort; + struct bssmap_le_conn_oriented_info conn_oriented_info; + }; +}; + +struct bssap_le_pdu { + enum bssap_le_msg_discr discr; + union { + struct bssmap_le_pdu bssmap_le; + /* future: add DTAP PDU, currently not implemented */ + }; +}; + +/*! @} */ diff --git a/include/osmocom/gsm/protocol/ipaccess.h b/include/osmocom/gsm/protocol/ipaccess.h index 80413d10..51827607 100644 --- a/include/osmocom/gsm/protocol/ipaccess.h +++ b/include/osmocom/gsm/protocol/ipaccess.h @@ -39,29 +39,39 @@ enum ipaccess_proto_ext { IPAC_PROTO_EXT_GSUP = 0x05, /* GSUP GPRS extension */ IPAC_PROTO_EXT_OAP = 0x06, /* Osmocom Authn Protocol */ IPAC_PROTO_EXT_RSPRO = 0x07, /* Remote SIM protocol */ + IPAC_PROTO_EXT_PCU = 0x08, /* BSC<->BTS<->PCU communication */ }; enum ipaccess_msgtype { - IPAC_MSGT_PING = 0x00, - IPAC_MSGT_PONG = 0x01, - IPAC_MSGT_ID_GET = 0x04, - IPAC_MSGT_ID_RESP = 0x05, - IPAC_MSGT_ID_ACK = 0x06, + IPAC_MSGT_PING = 0x00, /* Heartbeet */ + IPAC_MSGT_PONG = 0x01, /* Heartbeat Ack */ + IPAC_MSGT_ID_GET = 0x04, /* Identity Request */ + IPAC_MSGT_ID_RESP = 0x05, /* Identity */ + IPAC_MSGT_ID_ACK = 0x06, /* Identity Ack */ + IPAC_MSGT_ID_NACK = 0x07, /* Identity Nack */ + IPAC_MSGT_PROXY = 0x08, /* Proxy */ + IPAC_MSGT_PROXY_ACK = 0x09, /* Proxy Ack */ + IPAC_MSGT_PROXY_NACK = 0x0a, /* Proxy Nack */ + IPAC_MSGT_SSL_INFO = 0x0b, /* SSL Info */ /* OpenBSC extension */ IPAC_MSGT_SCCP_OLD = 0xff, }; enum ipaccess_id_tags { - IPAC_IDTAG_SERNR = 0x00, - IPAC_IDTAG_UNITNAME = 0x01, - IPAC_IDTAG_LOCATION1 = 0x02, - IPAC_IDTAG_LOCATION2 = 0x03, - IPAC_IDTAG_EQUIPVERS = 0x04, - IPAC_IDTAG_SWVERSION = 0x05, - IPAC_IDTAG_IPADDR = 0x06, - IPAC_IDTAG_MACADDR = 0x07, - IPAC_IDTAG_UNIT = 0x08, + IPAC_IDTAG_SERNR = 0x00, /* Unit Serial Number */ + IPAC_IDTAG_UNITNAME = 0x01, /* Unit Name */ + IPAC_IDTAG_LOCATION1 = 0x02, /* Unit Location */ + IPAC_IDTAG_LOCATION2 = 0x03, /* Unit Type */ + IPAC_IDTAG_EQUIPVERS = 0x04, /* Hardware Version */ + IPAC_IDTAG_SWVERSION = 0x05, /* Software Version */ + IPAC_IDTAG_IPADDR = 0x06, /* IP Address */ + IPAC_IDTAG_MACADDR = 0x07, /* Ethernet Address */ + IPAC_IDTAG_UNIT = 0x08, /* Unit ID */ + IPAC_IDTAG_USERNAME = 0x09, /* User Name */ + IPAC_IDTAG_PASSWORD = 0x0a, /* Password */ + IPAC_IDTAG_ACCESS_CLASS = 0x0b, /* Access Class */ + IPAC_IDTG_APP_PROTO_VER = 0x0c, /* Application Protocol Version */ }; /* |