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_rsl2gsmtap(uint8_t rsl_chantype, uint8_t rsl_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,
uint8_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,
uint8_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);
int gsmtap_source_add_sink(struct gsmtap_inst *gti);
int gsmtap_sendmsg(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, uint8_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, uint8_t snr, const uint8_t *data,
unsigned int len);
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, uint8_t snr, const uint8_t *data, unsigned int len)
create an arbitrary type GSMTAP message
Definition: gsmtap_util.c:106
chantype_rsl2gsmtap
uint8_t chantype_rsl2gsmtap(uint8_t rsl_chantype, uint8_t rsl_link_id)
convert RSL channel number to GSMTAP channel type
Definition: gsmtap_util.c:56
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, uint8_t snr, const uint8_t *data, unsigned int len)
create L1/L2 data and put it into GSMTAP
Definition: gsmtap_util.c:152
msgb::data
unsigned char * data
start of message in buffer
Definition: msgb.h:66
msgb
Osmocom message buffer.
Definition: msgb.h:42
gsmtap_inst
one gsmtap instance
Definition: gsmtap_util.h:23
msgb::len
uint16_t len
length of bytes used in msgb
Definition: msgb.h:62
osmo_wqueue
Definition: write_queue.h:36
gsmtap_source_add_sink
int gsmtap_source_add_sink(struct gsmtap_inst *gti)
Add a local sink to an existing GSMTAP source instance.
Definition: gsmtap_util.c:316
select.h
select loop abstraction
gsmtap_inst::sink_ofd
struct osmo_fd sink_ofd
file descriptor
Definition: gsmtap_util.h:26
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:348
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:197
write_queue.h
gsmtap_inst::ofd_wq_mode
int ofd_wq_mode
wait queue mode?
Definition: gsmtap_util.h:24
osmo_wqueue::bfd
struct osmo_fd bfd
osmocom file descriptor
Definition: write_queue.h:38
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:30
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:174
osmo_fd
Structure representing a file dsecriptor.
Definition: select.h:21
gsmtap_inst::wq
struct osmo_wqueue wq
the wait queue
Definition: gsmtap_util.h:25
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, uint8_t snr, const uint8_t *data, unsigned int len)
send an arbitrary type through GSMTAP. See gsmtap_makemsg_ex for arguments
Definition: gsmtap_util.c:248
gsmtap_sendmsg
int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg)
Send a Message buffers through a GSMTAP source.
Definition: gsmtap_util.c:221
osmo_fd::fd
int fd
Definition: select.h:25
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, uint8_t snr, const uint8_t *data, unsigned int len)
send a message from L1/L2 through GSMTAP. See gsmtap_makemsg for arguments
Definition: gsmtap_util.c:269