libosmocore 1.10.0.10-24ad1
Osmocom core library
|
GSMTAP utility routines. More...
Files | |
file | gsmtap_util.h |
file | gsmtap_util.c |
GSMTAP support code in libosmocore. | |
Data Structures | |
struct | gsmtap_inst |
one gsmtap instance Until gsmtap_inst_fd() is removed from the API at some point in the future, we have to keep the first member as 'int' and the second as 'struct osmo_wqueue' (this effectively makes sure that the struct member wq.bfd.fd maintains the same memory offset from the start of the struct) to ensure that inlined static 'instances' of gsmtap_inst_fd() in old binaries keep working the way they used to even with gsmtap_inst objects obtained from newer versions of libosmocore More... | |
struct | _gsmtap_inst_legacy |
Functions | |
uint8_t | chantype_rsl2gsmtap2 (uint8_t rsl_chantype, uint8_t link_id, bool user_plane) |
convert RSL channel number to GSMTAP channel type More... | |
uint8_t | chantype_rsl2gsmtap (uint8_t rsl_chantype, uint8_t link_id) |
convert RSL channel number to GSMTAP channel type More... | |
void | chantype_gsmtap2rsl (uint8_t gsmtap_chantype, uint8_t *rsl_chantype, uint8_t *link_id) |
convert GSMTAP channel type to RSL channel number + Link ID More... | |
struct msgb * | gsmtap_makemsg_ex (uint8_t type, uint16_t arfcn, uint8_t ts, uint8_t chan_type, uint8_t ss, uint32_t fn, int8_t signal_dbm, int8_t snr, const uint8_t *data, unsigned int len) |
create an arbitrary type GSMTAP message More... | |
struct msgb * | gsmtap_makemsg (uint16_t arfcn, uint8_t ts, uint8_t chan_type, uint8_t ss, uint32_t fn, int8_t signal_dbm, int8_t snr, const uint8_t *data, unsigned int len) |
create L1/L2 data and put it into GSMTAP More... | |
int | gsmtap_inst_fd (struct gsmtap_inst *gti) |
Deprecated, use gsmtap_inst_fd2() instead. More... | |
int | gsmtap_inst_fd2 (const struct gsmtap_inst *gti) |
obtain the file descriptor associated with a gsmtap instance More... | |
int | gsmtap_source_init_fd (const char *host, uint16_t port) |
int | gsmtap_source_init_fd2 (const char *local_host, uint16_t local_port, const char *rem_host, uint16_t rem_port) |
int | gsmtap_source_add_sink_fd (int gsmtap_fd) |
struct gsmtap_inst * | gsmtap_source_init (const char *host, uint16_t port, int ofd_wq_mode) |
struct gsmtap_inst * | gsmtap_source_init2 (const char *local_host, uint16_t local_port, const char *rem_host, uint16_t rem_port, int ofd_wq_mode) |
void | gsmtap_source_free (struct gsmtap_inst *gti) |
int | gsmtap_source_add_sink (struct gsmtap_inst *gti) |
int | gsmtap_sendmsg (struct gsmtap_inst *gti, struct msgb *msg) |
int | gsmtap_sendmsg_free (struct gsmtap_inst *gti, struct msgb *msg) |
int | gsmtap_send_ex (struct gsmtap_inst *gti, uint8_t type, uint16_t arfcn, uint8_t ts, uint8_t chan_type, uint8_t ss, uint32_t fn, int8_t signal_dbm, int8_t snr, const uint8_t *data, unsigned int len) |
int | gsmtap_send (struct gsmtap_inst *gti, uint16_t arfcn, uint8_t ts, uint8_t chan_type, uint8_t ss, uint32_t fn, int8_t signal_dbm, int8_t snr, const uint8_t *data, unsigned int len) |
osmo_static_assert (offsetof(struct gsmtap_inst, wq)==offsetof(struct _gsmtap_inst_legacy, wq), gsmtap_inst_new_wq_offset_equals_legacy_wq_offset) | |
Variables | |
const struct value_string | gsmtap_gsm_channel_names [] |
const struct value_string | gsmtap_type_names [] |
const struct value_string | gsmtap_gsm_channel_names [] |
const struct value_string | gsmtap_type_names [] |
GSMTAP utility routines.
Encapsulates GSM messages over UDP.
void chantype_gsmtap2rsl | ( | uint8_t | gsmtap_chantype, |
uint8_t * | rsl_chantype, | ||
uint8_t * | link_id | ||
) |
convert GSMTAP channel type to RSL channel number + Link ID
[in] | gsmtap_chantype | GSMTAP channel type |
[out] | rsl_chantype | RSL channel mumber |
[out] | link_id | RSL link identifier |
References GSMTAP_CHANNEL_ACCH, GSMTAP_CHANNEL_AGCH, GSMTAP_CHANNEL_BCCH, GSMTAP_CHANNEL_FACCH_F, GSMTAP_CHANNEL_FACCH_H, GSMTAP_CHANNEL_PCH, GSMTAP_CHANNEL_PDCH, GSMTAP_CHANNEL_RACH, GSMTAP_CHANNEL_SDCCH4, GSMTAP_CHANNEL_SDCCH8, GSMTAP_CHANNEL_VOICE_F, GSMTAP_CHANNEL_VOICE_H, link_id, RSL_CHAN_BCCH, RSL_CHAN_Bm_ACCHs, RSL_CHAN_Lm_ACCHs, RSL_CHAN_OSMO_PDCH, RSL_CHAN_PCH_AGCH, RSL_CHAN_RACH, RSL_CHAN_SDCCH4_ACCH, and RSL_CHAN_SDCCH8_ACCH.
uint8_t chantype_rsl2gsmtap | ( | uint8_t | rsl_chantype, |
uint8_t | link_id | ||
) |
convert RSL channel number to GSMTAP channel type
[in] | rsl_chantype | RSL channel type |
[in] | link_id | RSL link identifier |
References chantype_rsl2gsmtap2(), and link_id.
uint8_t chantype_rsl2gsmtap2 | ( | uint8_t | rsl_chantype, |
uint8_t | link_id, | ||
bool | user_plane | ||
) |
convert RSL channel number to GSMTAP channel type
[in] | rsl_chantype | RSL channel type |
[in] | link_id | RSL link identifier |
[in] | user_plane | Is this voice/csd user plane (1) or signaling (0) |
References GSMTAP_CHANNEL_ACCH, GSMTAP_CHANNEL_BCCH, GSMTAP_CHANNEL_CBCH51, GSMTAP_CHANNEL_CBCH52, GSMTAP_CHANNEL_FACCH_F, GSMTAP_CHANNEL_FACCH_H, GSMTAP_CHANNEL_PCH, GSMTAP_CHANNEL_PDCH, GSMTAP_CHANNEL_RACH, GSMTAP_CHANNEL_SDCCH4, GSMTAP_CHANNEL_SDCCH8, GSMTAP_CHANNEL_UNKNOWN, GSMTAP_CHANNEL_VOICE_F, GSMTAP_CHANNEL_VOICE_H, link_id, RSL_CHAN_BCCH, RSL_CHAN_Bm_ACCHs, RSL_CHAN_Lm_ACCHs, RSL_CHAN_OSMO_CBCH4, RSL_CHAN_OSMO_CBCH8, RSL_CHAN_OSMO_PDCH, RSL_CHAN_OSMO_VAMOS_Bm_ACCHs, RSL_CHAN_OSMO_VAMOS_Lm_ACCHs, RSL_CHAN_PCH_AGCH, RSL_CHAN_RACH, RSL_CHAN_SDCCH4_ACCH, and RSL_CHAN_SDCCH8_ACCH.
Referenced by chantype_rsl2gsmtap().
int gsmtap_inst_fd | ( | struct gsmtap_inst * | gti | ) |
Deprecated, use gsmtap_inst_fd2() instead.
[in] | gti | GSMTAP instance |
References gsmtap_inst_fd2().
int gsmtap_inst_fd2 | ( | const struct gsmtap_inst * | gti | ) |
obtain the file descriptor associated with a gsmtap instance
[in] | gti | GSMTAP instance |
References osmo_wqueue::bfd, osmo_fd::fd, and gsmtap_inst::wq.
Referenced by gsmtap_inst_fd().
struct msgb * gsmtap_makemsg | ( | uint16_t | arfcn, |
uint8_t | ts, | ||
uint8_t | chan_type, | ||
uint8_t | ss, | ||
uint32_t | fn, | ||
int8_t | signal_dbm, | ||
int8_t | snr, | ||
const uint8_t * | data, | ||
unsigned int | len | ||
) |
create L1/L2 data and put it into GSMTAP
[in] | arfcn | GSM ARFCN (Channel Number) |
[in] | ts | GSM time slot |
[in] | chan_type | Channel Type |
[in] | ss | Sub-slot |
[in] | fn | GSM Frame Number |
[in] | signal_dbm | Signal Strength (dBm) |
[in] | snr | Signal/Noise Ratio (SNR) |
[in] | data | Pointer to data buffer |
[in] | len | Length of data |
This function will allocate a new msgb and fill it with a GSMTAP header containing the information
References arfcn, data, gsmtap_makemsg_ex(), GSMTAP_TYPE_UM, len(), signal_dbm, and ts.
struct msgb * gsmtap_makemsg_ex | ( | uint8_t | type, |
uint16_t | arfcn, | ||
uint8_t | ts, | ||
uint8_t | chan_type, | ||
uint8_t | ss, | ||
uint32_t | fn, | ||
int8_t | signal_dbm, | ||
int8_t | snr, | ||
const uint8_t * | data, | ||
unsigned int | len | ||
) |
create an arbitrary type GSMTAP message
[in] | type | The GSMTAP_TYPE_xxx constant of the message to create |
[in] | arfcn | GSM ARFCN (Channel Number) |
[in] | ts | GSM time slot |
[in] | chan_type | Channel Type |
[in] | ss | Sub-slot |
[in] | fn | GSM Frame Number |
[in] | signal_dbm | Signal Strength (dBm) |
[in] | snr | Signal/Noise Ratio (SNR) |
[in] | data | Pointer to data buffer |
[in] | len | Length of data |
This function will allocate a new msgb and fill it with a GSMTAP header containing the information
References gsmtap_hdr::antenna_nr, arfcn, gsmtap_hdr::arfcn, data, gsmtap_hdr::frame_number, GSMTAP_VERSION, gsmtap_hdr::hdr_len, len(), msg, msgb_alloc(), msgb_put(), osmo_htonl, osmo_htons, signal_dbm, gsmtap_hdr::signal_dbm, gsmtap_hdr::snr_db, gsmtap_hdr::sub_slot, gsmtap_hdr::sub_type, gsmtap_hdr::timeslot, ts, type, gsmtap_hdr::type, and gsmtap_hdr::version.
Referenced by gsmtap_makemsg().
int gsmtap_send | ( | struct gsmtap_inst * | gti, |
uint16_t | arfcn, | ||
uint8_t | ts, | ||
uint8_t | chan_type, | ||
uint8_t | ss, | ||
uint32_t | fn, | ||
int8_t | signal_dbm, | ||
int8_t | snr, | ||
const uint8_t * | data, | ||
unsigned int | len | ||
) |
int gsmtap_send_ex | ( | struct gsmtap_inst * | gti, |
uint8_t | type, | ||
uint16_t | arfcn, | ||
uint8_t | ts, | ||
uint8_t | chan_type, | ||
uint8_t | ss, | ||
uint32_t | fn, | ||
int8_t | signal_dbm, | ||
int8_t | snr, | ||
const uint8_t * | data, | ||
unsigned int | len | ||
) |
int gsmtap_sendmsg | ( | struct gsmtap_inst * | gti, |
struct msgb * | msg | ||
) |
Referenced by _gsmtap_raw_output().
int gsmtap_sendmsg_free | ( | struct gsmtap_inst * | gti, |
struct msgb * | msg | ||
) |
int gsmtap_source_add_sink | ( | struct gsmtap_inst * | gti | ) |
Referenced by log_target_create_gsmtap().
int gsmtap_source_add_sink_fd | ( | int | gsmtap_fd | ) |
void gsmtap_source_free | ( | struct gsmtap_inst * | gti | ) |
Referenced by log_target_destroy().
struct gsmtap_inst * gsmtap_source_init | ( | const char * | host, |
uint16_t | port, | ||
int | ofd_wq_mode | ||
) |
Referenced by log_target_create_gsmtap().
struct gsmtap_inst * gsmtap_source_init2 | ( | const char * | local_host, |
uint16_t | local_port, | ||
const char * | rem_host, | ||
uint16_t | rem_port, | ||
int | ofd_wq_mode | ||
) |
int gsmtap_source_init_fd | ( | const char * | host, |
uint16_t | port | ||
) |
int gsmtap_source_init_fd2 | ( | const char * | local_host, |
uint16_t | local_port, | ||
const char * | rem_host, | ||
uint16_t | rem_port | ||
) |
osmo_static_assert | ( | offsetof(struct gsmtap_inst, wq) | = =offsetof(struct _gsmtap_inst_legacy, wq) , |
gsmtap_inst_new_wq_offset_equals_legacy_wq_offset | |||
) |
|
extern |
const struct value_string gsmtap_gsm_channel_names[] |
|
extern |
const struct value_string gsmtap_type_names[] |