libosmocore
1.5.1
Osmocom core library
|
Files | |
file | gsmtap_util.h |
file | gsmtap_util.c |
Data Structures | |
struct | gsmtap_inst |
one gsmtap instance More... | |
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... | |
static int | gsmtap_inst_fd (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) |
Create a new (sending) GSMTAP source socket. More... | |
int | gsmtap_source_add_sink_fd (int gsmtap_fd) |
Add a local sink to an existing GSMTAP source and return fd. More... | |
struct gsmtap_inst * | gsmtap_source_init (const char *host, uint16_t port, int ofd_wq_mode) |
Open GSMTAP source socket, connect and register osmo_fd. More... | |
int | gsmtap_source_add_sink (struct gsmtap_inst *gti) |
Add a local sink to an existing GSMTAP source and return fd. More... | |
int | gsmtap_sendmsg (struct gsmtap_inst *gti, struct msgb *msg) |
Send a Message buffers through a GSMTAP source. More... | |
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) |
send an arbitrary type through GSMTAP. More... | |
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) |
send a message from L1/L2 through GSMTAP. More... | |
static int | gsmtap_wq_w_cb (struct osmo_fd *ofd, struct msgb *msg) |
static int | gsmtap_sink_fd_cb (struct osmo_fd *fd, unsigned int flags) |
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_PCH_AGCH, RSL_CHAN_RACH, RSL_CHAN_SDCCH4_ACCH, and RSL_CHAN_SDCCH8_ACCH.
Referenced by chantype_rsl2gsmtap().
|
inlinestatic |
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_sendmsg(), and gsmtap_source_add_sink().
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(), and gsmtap_send_ex().
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 | ||
) |
send a message from L1/L2 through GSMTAP.
See gsmtap_makemsg for arguments
References arfcn, data, gsmtap_send_ex(), GSMTAP_TYPE_UM, len(), signal_dbm, and ts.
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 | ||
) |
send an arbitrary type through GSMTAP.
See gsmtap_makemsg_ex for arguments
References arfcn, data, gsmtap_makemsg_ex(), gsmtap_sendmsg(), len(), msg, msgb_free(), signal_dbm, ts, and type.
Referenced by gsmtap_send().
int gsmtap_sendmsg | ( | struct gsmtap_inst * | gti, |
struct msgb * | msg | ||
) |
Send a Message buffers through a GSMTAP source.
[in] | gti | GSMTAP instance |
[in] | msg | message buffer |
References gsmtap_inst_fd(), msg, msgb_free(), gsmtap_inst::ofd_wq_mode, osmo_wqueue_enqueue(), and gsmtap_inst::wq.
Referenced by _gsmtap_raw_output(), and gsmtap_send_ex().
|
static |
References osmo_fd::fd, flags, and OSMO_FD_READ.
Referenced by gsmtap_source_add_sink().
int gsmtap_source_add_sink | ( | struct gsmtap_inst * | gti | ) |
Add a local sink to an existing GSMTAP source and return fd.
[in] | gti | existing GSMTAP source |
In case the GSMTAP socket is connected to a local destination IP/port, this function creates a corresponding receiving socket bound to that destination IP + port.
In case the gsmtap socket is not connected to a local IP/port, or creation of the receiving socket fails, a negative error code is returned.
The file descriptor of the receiving socket is automatically added to the libosmocore select() handling.
References osmo_fd::cb, osmo_fd::fd, gsmtap_inst_fd(), gsmtap_sink_fd_cb(), gsmtap_source_add_sink_fd(), gsmtap_inst::ofd_wq_mode, OSMO_FD_READ, osmo_fd_register(), gsmtap_inst::sink_ofd, and osmo_fd::when.
Referenced by log_target_create_gsmtap().
int gsmtap_source_add_sink_fd | ( | int | gsmtap_fd | ) |
Add a local sink to an existing GSMTAP source and return fd.
[in] | gsmtap_fd | file descriptor of the gsmtap socket |
In case the GSMTAP socket is connected to a local destination IP/port, this function creates a corresponding receiving socket bound to that destination IP + port.
In case the gsmtap socket is not connected to a local IP/port, or creation of the receiving socket fails, a negative error code is returned.
References OSMO_SOCK_F_BIND, OSMO_SOCK_F_UDP_REUSEADDR, osmo_sock_init_sa(), and osmo_sockaddr_is_local().
Referenced by gsmtap_source_add_sink().
struct gsmtap_inst * gsmtap_source_init | ( | const char * | host, |
uint16_t | port, | ||
int | ofd_wq_mode | ||
) |
Open GSMTAP source socket, connect and register osmo_fd.
[in] | host | host name or IP address in string format |
[in] | port | UDP port number in host byte order |
[in] | ofd_wq_mode | Register osmo_wqueue (1) or not (0) |
Open GSMTAP source (sending) socket, connect it to host/port, allocate 'struct gsmtap_inst' and optionally osmo_fd/osmo_wqueue registration.
Referenced by log_target_create_gsmtap().
int gsmtap_source_init_fd | ( | const char * | host, |
uint16_t | port | ||
) |
Create a new (sending) GSMTAP source socket.
[in] | host | host name or IP address in string format |
[in] | port | UDP port number in host byte order |
Opens a GSMTAP source (sending) socket, conncet it to host/port and return resulting fd. If host is NULL, the destination address will be localhost. If port is 0, the default GSMTAP_UDP_PORT will be used.
References GSMTAP_UDP_PORT, OSMO_SOCK_F_CONNECT, and osmo_sock_init().
References osmo_fd::fd, and msg.
const struct value_string gsmtap_gsm_channel_names[] |
const struct value_string gsmtap_gsm_channel_names[] |
const struct value_string gsmtap_type_names[] |
const struct value_string gsmtap_type_names[] |