Loading...
Searching...
No Matches
gsmtap_util.h
Go to the documentation of this file.
#pragma once
#include <stdint.h>
#include <osmocom/core/write_queue.h>
#include <osmocom/core/select.h>
uint8_t chantype_rsl2gsmtap2(uint8_t rsl_chantype, uint8_t rsl_link_id, bool user_plane);
uint8_t chantype_rsl2gsmtap(uint8_t rsl_chantype, uint8_t rsl_link_id)
OSMO_DEPRECATED("Use chantype_rsl2gsmtap2() instead");
void chantype_gsmtap2rsl(uint8_t gsmtap_chantype, uint8_t *rsl_chantype, uint8_t *link_id);
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);
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);
struct gsmtap_inst {
int ofd_wq_mode;
struct osmo_wqueue wq;
struct osmo_fd sink_ofd;
};
static inline int gsmtap_inst_fd(struct gsmtap_inst *gti)
{
return gti->wq.bfd.fd;
}
int gsmtap_source_init_fd(const char *host, uint16_t 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);
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);
extern const struct value_string gsmtap_gsm_channel_names[];
extern const struct value_string gsmtap_type_names[];
gsmtap_makemsg
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
Definition gsmtap_util.c:222
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.
Definition gsmtap_util.c:422
gsmtap_source_add_sink_fd
int gsmtap_source_add_sink_fd(int gsmtap_fd)
Add a local sink to an existing GSMTAP source and return fd.
Definition gsmtap_util.c:268
chantype_rsl2gsmtap
uint8_t chantype_rsl2gsmtap(uint8_t rsl_chantype, uint8_t rsl_link_id) OSMO_DEPRECATED("Use chantype_rsl2gsmtap2() instead")
convert RSL channel number to GSMTAP channel type
Definition gsmtap_util.c:113
chantype_rsl2gsmtap2
uint8_t chantype_rsl2gsmtap2(uint8_t rsl_chantype, uint8_t rsl_link_id, bool user_plane)
convert RSL channel number to GSMTAP channel type
Definition gsmtap_util.c:56
chantype_gsmtap2rsl
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
Definition gsmtap_util.c:123
gsmtap_sendmsg
int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg)
Send a Message buffers through a GSMTAP source.
Definition gsmtap_util.c:298
gsmtap_makemsg_ex
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
Definition gsmtap_util.c:175
gsmtap_gsm_channel_names
const struct value_string gsmtap_gsm_channel_names[]
Definition gsmtap_util.c:507
gsmtap_inst_fd
static int gsmtap_inst_fd(struct gsmtap_inst *gti)
obtain the file descriptor associated with a gsmtap instance
Definition gsmtap_util.h:36
gsmtap_source_init
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.
Definition gsmtap_util.c:459
gsmtap_sendmsg_free
int gsmtap_sendmsg_free(struct gsmtap_inst *gti, struct msgb *msg)
Send a Message buffers through a GSMTAP source; free the message even if tx queue full.
Definition gsmtap_util.c:327
gsmtap_send_ex
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.
Definition gsmtap_util.c:339
gsmtap_source_free
void gsmtap_source_free(struct gsmtap_inst *gti)
Definition gsmtap_util.c:489
gsmtap_type_names
const struct value_string gsmtap_type_names[]
Definition gsmtap_util.c:535
gsmtap_source_init_fd
int gsmtap_source_init_fd(const char *host, uint16_t port)
Create a new (sending) GSMTAP source socket.
Definition gsmtap_util.c:245
gsmtap_send
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.
Definition gsmtap_util.c:364
OSMO_DEPRECATED
#define OSMO_DEPRECATED(text)
Set the deprecated attribute with a message.
Definition defs.h:41
ts
struct @6 ts
arfcn
uint16_t arfcn
ARFCN (frequency)
Definition gsmtap.h:5
signal_dbm
int8_t signal_dbm
signal level in dBm
Definition gsmtap.h:6
select.h
libmnl integration
gsmtap_inst
one gsmtap instance
Definition gsmtap_util.h:27
gsmtap_inst::ofd_wq_mode
int ofd_wq_mode
wait queue mode?
Definition gsmtap_util.h:28
gsmtap_inst::sink_ofd
struct osmo_fd sink_ofd
file descriptor
Definition gsmtap_util.h:30
gsmtap_inst::wq
struct osmo_wqueue wq
the wait queue
Definition gsmtap_util.h:29
host
msgb
Osmocom message buffer.
Definition msgb.h:31
msgb::len
uint16_t len
length of bytes used in msgb
Definition msgb.h:51
msgb::data
unsigned char * data
start of message in buffer
Definition msgb.h:55
osmo_fd
Structure representing a file dsecriptor.
Definition select.h:31
osmo_fd::fd
int fd
actual operating-system level file decriptor
Definition select.h:35
osmo_wqueue
write queue instance
Definition write_queue.h:30
osmo_wqueue::bfd
struct osmo_fd bfd
osmocom file descriptor
Definition write_queue.h:32
value_string
A mapping between human-readable string and numeric value.
Definition utils.h:51
write_queue.h
Generic write queue implementation.