libosmogsm 1.13.1.1-afb4 Osmocom GSM library

Functions | Variables
gsm48.c File Reference

GSM Mobile Radio Interface Layer 3 messages 3GPP TS 04.08 version 7.21.0 Release 1998 / ETSI TS 100 940 V7.21.0. More...

`#include <stdint.h>`
`#include <stdio.h>`
`#include <string.h>`
`#include <stdbool.h>`
`#include <inttypes.h>`
`#include <ctype.h>`
`#include <osmocom/core/utils.h>`
`#include <osmocom/core/byteswap.h>`
`#include <osmocom/core/bit16gen.h>`
`#include <osmocom/core/bit32gen.h>`
`#include <osmocom/core/talloc.h>`
`#include <osmocom/gsm/tlv.h>`
`#include <osmocom/gsm/gsm48.h>`
`#include <osmocom/gsm/gsm0502.h>`
`#include <osmocom/gsm/gsm_utils.h>`
`#include <osmocom/gsm/protocol/gsm_04_08.h>`
`#include <osmocom/gsm/protocol/gsm_04_80.h>`
`#include <osmocom/gsm/protocol/gsm_08_58.h>`
`#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>`
`#include <osmocom/gsm/protocol/gsm_23_003.h>`
`#include <osmocom/gsm/protocol/gsm_44_068.h>`

## Functions
const char * | rr_cause_name (uint8_t cause)
| return string representation of RR Cause value More...
char * | osmo_rai_name_buf (char *buf, size_t buf_len, const struct gprs_ra_id *rai)
| Return MCC-MNC-LAC-RAC as string, in a caller-provided output buffer. More...
const char * | osmo_rai_name (const struct gprs_ra_id *rai)
| Return MCC-MNC-LAC-RAC as string, in a static buffer. More...
char * | osmo_rai_name_c (const void *ctx, const struct gprs_ra_id *rai)
| Return MCC-MNC-LAC-RAC as string, in dynamically-allocated output buffer. More...
void | osmo_rai_to_gprs (struct gprs_ra_id *dest, const struct osmo_routing_area_id *src)
| Convert osmo_routing_area_id (new) into gprs_ra_id (old) More...
void | gprs_rai_to_osmo (struct osmo_routing_area_id *dest, const struct gprs_ra_id *src)
| Convert gprs_ra_id (old) into osmo_routing_area_id (new) More...
const char * | gsm48_cc_state_name (uint8_t state)
| return string representation of CC State More...
const char * | gsm48_cc_msg_name (uint8_t msgtype)
| return string representation of CC Message Type More...
const char * | gsm48_rr_msg_name (uint8_t msgtype)
| return string representation of RR Message Type More...
const char * | gsm48_rr_short_pd_msg_name (uint8_t msgtype)
| return string representation of RR Message Type using the RR short protocol discriminator More...
enum gsm48_chan_mode | gsm48_chan_mode_to_vamos (enum gsm48_chan_mode mode)
| Translate GSM48_CMODE_SPEECH_* to its corresponding GSM48_CMODE_SPEECH_*_VAMOS mode. More...
enum gsm48_chan_mode | gsm48_chan_mode_to_non_vamos (enum gsm48_chan_mode mode)
| Translate GSM48_CMODE_SPEECH_*_VAMOS to its corresponding GSM48_CMODE_SPEECH_* non-vamos mode. More...
const char * | gsm48_mi_type_name (uint8_t mi)
| return string representation of Mobile Identity Type More...
char * | osmo_mi_name_buf (char *buf, size_t buf_len, const uint8_t *mi, uint8_t mi_len)
| Deprecated, see osmo_mobile_identity instead. More...
const char * | osmo_mi_name (const uint8_t *mi, uint8_t mi_len)
| Deprecated, see osmo_mobile_identity instead. More...
char * | osmo_mi_name_c (const void *ctx, const uint8_t *mi, uint8_t mi_len)
| Deprecated, see osmo_mobile_identity instead. More...
int | osmo_mobile_identity_decode (struct osmo_mobile_identity *mi, const uint8_t *mi_data, uint8_t mi_len, bool allow_hex)
| Extract Mobile Identity from encoded bytes (3GPP TS 24.008 10.5.1.4). More...
int | osmo_mobile_identity_encoded_len (const struct osmo_mobile_identity *mi, int *mi_digits)
| Return the number of encoded Mobile Identity octets, without actually encoding. More...
int | osmo_mobile_identity_encode_buf (uint8_t *buf, size_t buflen, const struct osmo_mobile_identity *mi, bool allow_hex)
| Encode Mobile Identity from uint32_t (TMSI) or digits string (all others) (3GPP TS 24.008 10.5.1.4). More...
int | osmo_mobile_identity_encode_msgb (struct msgb *msg, const struct osmo_mobile_identity *mi, bool allow_hex)
| Encode Mobile Identity type and BCD digits, appended to a msgb. More...
int | osmo_mobile_identity_decode_from_l3_buf (struct osmo_mobile_identity *mi, const uint8_t *l3_data, size_t l3_len, bool allow_hex)
| Extract Mobile Identity from a Complete Layer 3 message. More...
int | osmo_mobile_identity_decode_from_l3 (struct osmo_mobile_identity *mi, struct msgb *msg, bool allow_hex)
| Extract Mobile Identity from a Complete Layer 3 message. More...
int | osmo_mobile_identity_to_str_buf (char *buf, size_t buflen, const struct osmo_mobile_identity *mi)
| Return a human readable representation of a struct osmo_mobile_identity. More...
char * | osmo_mobile_identity_to_str_c (void *ctx, const struct osmo_mobile_identity *mi)
| Like osmo_mobile_identity_to_str_buf(), but return the string in a talloc buffer. More...
int | osmo_mobile_identity_cmp (const struct osmo_mobile_identity *a, const struct osmo_mobile_identity *b)
| Compare two osmo_mobile_identity structs, returning typical cmp() result. More...
bool | gsm48_hdr_gmm_cipherable (const struct gsm48_hdr *hdr)
| Checks is particular message is cipherable in A/Gb mode according to 3GPP TS 24.008 § 4.7.1.2. More...
void | gsm48_mcc_mnc_to_bcd (uint8_t *bcd_dst, uint16_t mcc, uint16_t mnc)
void | gsm48_mcc_mnc_from_bcd (uint8_t *bcd_src, uint16_t *mcc, uint16_t *mnc)
void | gsm48_generate_lai (struct gsm48_loc_area_id *lai48, uint16_t mcc, uint16_t mnc, uint16_t lac)
| Encode TS 04.08 Location Area Identifier, legacy implementation. More...
void | gsm48_generate_lai2 (struct gsm48_loc_area_id *lai48, const struct osmo_location_area_id *lai)
| Encode TS 04.08 Location Area Identifier. More...
int | gsm48_decode_lai (struct gsm48_loc_area_id *lai, uint16_t *mcc, uint16_t *mnc, uint16_t *lac)
| Decode TS 04.08 Location Area Identifier, legacy implementation. More...
void | gsm48_decode_lai2 (const struct gsm48_loc_area_id *lai, struct osmo_location_area_id *decoded)
| Decode TS 04.08 Location Area Identifier. More...
void | gsm48_set_dtx (struct gsm48_cell_options *op, enum gsm48_dtx_mode full, enum gsm48_dtx_mode half, bool is_bcch)
| Set DTX mode in Cell Options IE (3GPP TS 44.018) More...
int | gsm48_generate_mid_from_tmsi (uint8_t *buf, uint32_t tmsi)
| Deprecated, see osmo_mobile_identity instead. More...
uint8_t | gsm48_generate_mid (uint8_t *buf, const char *id, uint8_t mi_type)
| Deprecated, see osmo_mobile_identity instead. More...
int | gsm48_generate_mid_from_imsi (uint8_t *buf, const char *imsi)
| Deprecated, see osmo_mobile_identity instead. More...
int | gsm48_mi_to_string (char *string, int str_len, const uint8_t *mi, int mi_len)
| Deprecated, see osmo_mobile_identity instead. More...
int | osmo_routing_area_id_decode (struct osmo_routing_area_id *dst, const uint8_t *ra_data, size_t ra_data_len)
| Decode to struct osmo_routing_area_id from a 3GPP TS 24.008 § 10.5.5.15 Routing area identification. More...
int | osmo_routing_area_id_encode_buf (uint8_t *buf, size_t buflen, const struct osmo_routing_area_id *src)
| Encode struct osmo_routing_area_id to a 3GPP TS 24.008 § 10.5.5.15 Routing area identification: write to a buffer. More...
int | osmo_routing_area_id_encode_msgb (struct msgb *msg, const struct osmo_routing_area_id *src)
| Encode struct osmo_routing_area_id to a 3GPP TS 24.008 § 10.5.5.15 Routing area identification: append to msgb. More...
void | gsm48_parse_ra (struct gprs_ra_id *raid, const uint8_t *buf)
| Parse TS 04.08 Routing Area Identifier. More...
void | gsm48_encode_ra (struct gsm48_ra_id *out, const struct gprs_ra_id *raid)
| Encode a 3GPP TS 24.008 § 10.5.5.15 Routing area identification. More...
int | gsm48_construct_ra (uint8_t *buf, const struct gprs_ra_id *raid)
| Encode a TS 04.08 Routing Area Identifier. More...
bool | gsm48_ra_equal (const struct gprs_ra_id *raid1, const struct gprs_ra_id *raid2)
| Compare a TS 04.08 Routing Area Identifier. More...
int | gsm48_number_of_paging_subchannels (const struct gsm48_control_channel_descr *chan_desc)
| Determine number of paging sub-channels. More...
char * | gsm48_pdisc_msgtype_name_buf (char *buf, size_t buf_len, uint8_t pdisc, uint8_t msg_type)
| Compose a string naming the message type for given protocol, in a caller-provided buffer. More...
const char * | gsm48_pdisc_msgtype_name (uint8_t pdisc, uint8_t msg_type)
| Compose a string naming the message type for given protocol, in a static buffer. More...
char * | gsm48_pdisc_msgtype_name_c (const void *ctx, uint8_t pdisc, uint8_t msg_type)
| Compose a string naming the message type for given protocol, in a dynamically-allocated buffer. More...
struct gsm48_hdr * | gsm48_push_l3hdr (struct msgb *msg, uint8_t pdisc, uint8_t msg_type)
| Wrap a given msg with gsm48_hdr structure. More...
bool | osmo_gsm48_classmark1_is_r99 (const struct gsm48_classmark1 *cm1)
bool | osmo_gsm48_classmark2_is_r99 (const struct gsm48_classmark2 *cm2, uint8_t cm2_len)
bool | osmo_gsm48_classmark_is_r99 (const struct osmo_gsm48_classmark *cm)
| Return true if any of Classmark 1 or Classmark 2 are present and indicate R99 capability. More...
char * | osmo_gsm48_classmark_a5_name_buf (char *buf, size_t buf_len, const struct osmo_gsm48_classmark *cm)
| Return a string representation of A5 cipher algorithms indicated by Classmark 1, 2 and 3. More...
const char * | osmo_gsm48_classmark_a5_name (const struct osmo_gsm48_classmark *cm)
| Return a string representation of A5 cipher algorithms indicated by Classmark 1, 2 and 3. More...
char * | osmo_gsm48_classmark_a5_name_c (const void *ctx, const struct osmo_gsm48_classmark *cm)
| Return a string representation of A5 cipher algorithms indicated by Classmark 1, 2 and 3. More...
void | osmo_gsm48_classmark_update (struct osmo_gsm48_classmark *dst, const struct osmo_gsm48_classmark *src)
| Overwrite dst with the Classmark information present in src. More...
int | osmo_gsm48_classmark_supports_a5 (const struct osmo_gsm48_classmark *cm, uint8_t a5)
| Determine if the given Classmark (1/2/3) value permits a given A5/n cipher. More...
int8_t | osmo_gsm48_rfpowercap2powerclass (enum gsm_band band, uint8_t rf_power_cap)
| Decode power class from Classmark1/2 RF power capability field. More...

## Variables
const struct tlv_definition | gsm48_att_tlvdef
| TLV parser definitions for TS 04.08 CC. More...
const struct tlv_definition | gsm48_rr_att_tlvdef
| TLV parser definitions for TS 04.08 RR. More...
const struct tlv_definition | gsm48_mm_att_tlvdef
| TLV parser definitions for TS 04.08 MM. More...
static const struct value_string | rr_cause_names []
static const char * | cc_state_names [32]
static const struct value_string | cc_msg_names []
static const struct value_string | rr_msg_names []
static const struct value_string | rr_msg_type_short_names []
const struct value_string | gsm48_chan_mode_names []
const struct value_string | gsm_chan_t_names []
static const struct value_string | mi_type_names []
const struct value_string | gsm48_pdisc_names []
| TS 04.08 Protocol Descriptor names. More...
const struct value_string | gsm48_rr_msgtype_names []
| TS 04.08 RR Message Type names. More...
const struct value_string | gsm48_mm_msgtype_names []
| TS 04.08 MM Message Type names. More...
const struct value_string | gsm48_cc_msgtype_names []
| TS 04.08 CC Message Type names. More...
const struct value_string | gsm48_cc_cause_names []
| TS 04.08 10.5..4.11 Call Control Cause Values. More...
const struct value_string | gsm48_nc_ss_msgtype_names []
| TS 04.80, section 3.4 Messages for supplementary services control. More...
const struct value_string | gsm48_reject_value_names []
const struct value_string | osmo_lu_type_names []
const struct value_string | osmo_cm_service_type_names []

## Detailed Description

GSM Mobile Radio Interface Layer 3 messages 3GPP TS 04.08 version 7.21.0 Release 1998 / ETSI TS 100 940 V7.21.0.