libosmogsm
0.11.0-dirty
Osmocom GSM library
|
#include "config.h"
#include <osmocom/core/utils.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/byteswap.h>
#include <string.h>
#include <errno.h>
#include <osmocom/gsm/protocol/gsm_08_08.h>
#include <osmocom/gsm/gsm48.h>
#include <osmocom/gsm/gsm0808_utils.h>
Defines | |
#define | IP_V4_ADDR_LEN 4 |
#define | IP_V6_ADDR_LEN 16 |
#define | IP_PORT_LEN 2 |
#define | CHANNEL_TYPE_ELEMENT_MAXLEN 11 |
#define | CHANNEL_TYPE_ELEMENT_MINLEN 3 |
#define | ENCRYPT_INFO_ELEMENT_MINLEN 1 |
#define | APPEND_THING(func, args...) |
#define | APPEND_STR(fmt, args...) APPEND_THING(snprintf, fmt, ##args) |
#define | APPEND_CELL_ID_U(DISCR, U) APPEND_THING(gsm0808_cell_id_u_name, DISCR, U) |
Functions | |
static uint8_t | enc_speech_codec (struct msgb *msg, const struct gsm0808_speech_codec *sc) |
uint8_t | gsm0808_enc_speech_codec (struct msgb *msg, const struct gsm0808_speech_codec *sc) |
Encode TS 08.08 Speech Codec IE. | |
int | gsm0808_dec_speech_codec (struct gsm0808_speech_codec *sc, const uint8_t *elem, uint8_t len) |
Decode TS 08.08 Speech Codec IE. | |
uint8_t | gsm0808_enc_speech_codec_list (struct msgb *msg, const struct gsm0808_speech_codec_list *scl) |
Encode TS 08.08 Speech Codec list. | |
int | gsm0808_dec_speech_codec_list (struct gsm0808_speech_codec_list *scl, const uint8_t *elem, uint8_t len) |
Decode TS 08.08 Speech Codec list IE. | |
uint8_t | gsm0808_enc_channel_type (struct msgb *msg, const struct gsm0808_channel_type *ct) |
Encode TS 08.08 Channel Type IE. | |
int | gsm0808_dec_channel_type (struct gsm0808_channel_type *ct, const uint8_t *elem, uint8_t len) |
Decode TS 08.08 Channel Type IE. | |
uint8_t | gsm0808_enc_encrypt_info (struct msgb *msg, const struct gsm0808_encrypt_info *ei) |
Encode TS 08.08 Encryption Information IE. | |
int | gsm0808_dec_encrypt_info (struct gsm0808_encrypt_info *ei, const uint8_t *elem, uint8_t len) |
Decode TS 08.08 Encryption Information IE. | |
uint8_t | gsm0808_enc_cell_id_list2 (struct msgb *msg, const struct gsm0808_cell_id_list2 *cil) |
Encode TS 08.08 Cell Identifier List IE. | |
uint8_t | gsm0808_enc_cell_id_list (struct msgb *msg, const struct gsm0808_cell_id_list *cil) |
DEPRECATED: Use gsm0808_enc_cell_id_list2 instead. | |
static void | decode_lai (const uint8_t *data, struct osmo_location_area_id *decoded) |
static int | parse_cell_id_global_list (struct gsm0808_cell_id_list2 *cil, const uint8_t *data, size_t remain, size_t *consumed) |
static int | parse_cell_id_lac_and_ci_list (struct gsm0808_cell_id_list2 *cil, const uint8_t *data, size_t remain, size_t *consumed) |
static int | parse_cell_id_ci_list (struct gsm0808_cell_id_list2 *cil, const uint8_t *data, size_t remain, size_t *consumed) |
static int | parse_cell_id_lai_and_lac (struct gsm0808_cell_id_list2 *cil, const uint8_t *data, size_t remain, size_t *consumed) |
static int | parse_cell_id_lac_list (struct gsm0808_cell_id_list2 *cil, const uint8_t *data, size_t remain, size_t *consumed) |
int | gsm0808_dec_cell_id_list2 (struct gsm0808_cell_id_list2 *cil, const uint8_t *elem, uint8_t len) |
Decode Cell Identifier List IE. | |
int | gsm0808_dec_cell_id_list (struct gsm0808_cell_id_list *cil, const uint8_t *elem, uint8_t len) |
DEPRECATED: Use gsm0808_dec_cell_id_list2 instead. | |
static bool | same_cell_id_list_entries (const struct gsm0808_cell_id_list2 *a, int ai, const struct gsm0808_cell_id_list2 *b, int bi) |
int | gsm0808_cell_id_list_add (struct gsm0808_cell_id_list2 *dst, const struct gsm0808_cell_id_list2 *src) |
Append entries from one Cell Identifier List to another. | |
uint8_t | gsm0808_enc_cell_id (struct msgb *msg, const struct gsm0808_cell_id *ci) |
Encode Cell Identifier IE (3GPP TS 48.008 3.2.2.17). | |
int | gsm0808_dec_cell_id (struct gsm0808_cell_id *ci, const uint8_t *elem, uint8_t len) |
Decode Cell Identifier IE (3GPP TS 48.008 3.2.2.17). | |
int | gsm0808_chan_type_to_speech_codec (uint8_t perm_spch) |
Convert the representation of the permitted speech codec identifier that is used in struct gsm0808_channel_type to the speech codec representation we use in struct gsm0808_speech_codec. | |
int | gsm0808_speech_codec_from_chan_type (struct gsm0808_speech_codec *sc, uint8_t perm_spch) |
Extrapolate a speech codec field from a given permitted speech parameter (channel type). | |
int | gsm0808_cell_id_u_name (char *buf, size_t buflen, enum CELL_IDENT id_discr, const union gsm0808_cell_id_u *u) |
Print a human readable name of the cell identifier to the char buffer. | |
static const char * | gsm0808_cell_id_name_buf (const struct gsm0808_cell_id *cid, char *buf, size_t buflen) |
const char * | gsm0808_cell_id_name (const struct gsm0808_cell_id *cid) |
Return a human readable representation of a Cell Identifier, like "LAC:123" or "CGI:001-01-42-23". | |
const char * | gsm0808_cell_id_name2 (const struct gsm0808_cell_id *cid) |
Like gsm0808_cell_id_name() but uses a different static buffer. | |
int | gsm0808_cell_id_list_name_buf (char *buf, size_t buflen, const struct gsm0808_cell_id_list2 *cil) |
Return a human readable representation of the Cell Identifier List, like "LAC[2]:{123, 456}". | |
const char * | gsm0808_cell_id_list_name (const struct gsm0808_cell_id_list2 *cil) |
Return a human-readable representation of cil in a static buffer. | |
const char * | gsm0808_channel_type_name (const struct gsm0808_channel_type *ct) |
Variables | |
struct value_string | gsm0808_cell_id_discr_names [] |
value_string[] for enum CELL_IDENT. |
#define APPEND_CELL_ID_U | ( | DISCR, | |
U | |||
) | APPEND_THING(gsm0808_cell_id_u_name, DISCR, U) |
Referenced by gsm0808_cell_id_list_name_buf(), and gsm0808_cell_id_name_buf().
#define APPEND_STR | ( | fmt, | |
args... | |||
) | APPEND_THING(snprintf, fmt, ##args) |
Referenced by gsm0808_cell_id_list_name_buf(), and gsm0808_cell_id_name_buf().
#define APPEND_THING | ( | func, | |
args... | |||
) |
#define CHANNEL_TYPE_ELEMENT_MAXLEN 11 |
Referenced by gsm0808_enc_channel_type().
#define CHANNEL_TYPE_ELEMENT_MINLEN 3 |
#define ENCRYPT_INFO_ELEMENT_MINLEN 1 |
#define IP_PORT_LEN 2 |
#define IP_V4_ADDR_LEN 4 |
#define IP_V6_ADDR_LEN 16 |
static void decode_lai | ( | const uint8_t * | data, |
struct osmo_location_area_id * | decoded | ||
) | [static] |
References gsm48_decode_lai2().
Referenced by parse_cell_id_global_list(), and parse_cell_id_lai_and_lac().
static uint8_t enc_speech_codec | ( | struct msgb * | msg, |
const struct gsm0808_speech_codec * | sc | ||
) | [static] |
References gsm0808_speech_codec::cfg, gsm0808_speech_codec::fi, GSM0808_SCT_CSD, GSM0808_SCT_FR1, GSM0808_SCT_FR2, GSM0808_SCT_FR3, GSM0808_SCT_FR4, GSM0808_SCT_FR5, GSM0808_SCT_HR1, GSM0808_SCT_HR3, GSM0808_SCT_HR4, GSM0808_SCT_HR6, header, msgb_put_u16(), msgb_put_u8(), OSMO_ASSERT, osmo_ntohs, gsm0808_speech_codec::pi, gsm0808_speech_codec::pt, msgb::tail, gsm0808_speech_codec::tf, and gsm0808_speech_codec::type.
Referenced by gsm0808_enc_speech_codec(), and gsm0808_enc_speech_codec_list().
static const char* gsm0808_cell_id_name_buf | ( | const struct gsm0808_cell_id * | cid, |
char * | buf, | ||
size_t | buflen | ||
) | [static] |
References APPEND_CELL_ID_U, APPEND_STR, gsm0808_cell_id_discr_name(), gsm0808_cell_id::id, and gsm0808_cell_id::id_discr.
Referenced by gsm0808_cell_id_name(), and gsm0808_cell_id_name2().
static int parse_cell_id_ci_list | ( | struct gsm0808_cell_id_list2 * | cil, |
const uint8_t * | data, | ||
size_t | remain, | ||
size_t * | consumed | ||
) | [static] |
References gsm0808_cell_id_u::ci, GSM0808_CELL_ID_LIST2_MAXLEN, and gsm0808_cell_id_list2::id_list.
Referenced by gsm0808_dec_cell_id_list2().
static int parse_cell_id_global_list | ( | struct gsm0808_cell_id_list2 * | cil, |
const uint8_t * | data, | ||
size_t | remain, | ||
size_t * | consumed | ||
) | [static] |
References decode_lai(), gsm0808_cell_id_u::global, GSM0808_CELL_ID_LIST2_MAXLEN, gsm0808_cell_id_list2::id_list, and osmo_cell_global_id::lai.
Referenced by gsm0808_dec_cell_id_list2().
static int parse_cell_id_lac_and_ci_list | ( | struct gsm0808_cell_id_list2 * | cil, |
const uint8_t * | data, | ||
size_t | remain, | ||
size_t * | consumed | ||
) | [static] |
References GSM0808_CELL_ID_LIST2_MAXLEN, gsm0808_cell_id_list2::id_list, osmo_lac_and_ci_id::lac, and gsm0808_cell_id_u::lac_and_ci.
Referenced by gsm0808_dec_cell_id_list2().
static int parse_cell_id_lac_list | ( | struct gsm0808_cell_id_list2 * | cil, |
const uint8_t * | data, | ||
size_t | remain, | ||
size_t * | consumed | ||
) | [static] |
References GSM0808_CELL_ID_LIST2_MAXLEN, gsm0808_cell_id_list2::id_list, and gsm0808_cell_id_u::lac.
Referenced by gsm0808_dec_cell_id_list2().
static int parse_cell_id_lai_and_lac | ( | struct gsm0808_cell_id_list2 * | cil, |
const uint8_t * | data, | ||
size_t | remain, | ||
size_t * | consumed | ||
) | [static] |
References decode_lai(), GSM0808_CELL_ID_LIST2_MAXLEN, gsm0808_cell_id_list2::id_list, and gsm0808_cell_id_u::lai_and_lac.
Referenced by gsm0808_dec_cell_id_list2().
static bool same_cell_id_list_entries | ( | const struct gsm0808_cell_id_list2 * | a, |
int | ai, | ||
const struct gsm0808_cell_id_list2 * | b, | ||
int | bi | ||
) | [static] |