diff options
Diffstat (limited to 'include/osmocom/gsm/protocol/gsm_08_08.h')
-rw-r--r-- | include/osmocom/gsm/protocol/gsm_08_08.h | 175 |
1 files changed, 160 insertions, 15 deletions
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 */ |