2014-06-16 08:13:40 +00:00
|
|
|
#pragma once
|
2010-06-29 18:51:13 +00:00
|
|
|
|
|
|
|
#include <stdint.h>
|
2011-05-21 16:54:32 +00:00
|
|
|
#include <osmocom/core/write_queue.h>
|
|
|
|
#include <osmocom/core/select.h>
|
2010-06-29 18:51:13 +00:00
|
|
|
|
2011-08-17 14:35:24 +00:00
|
|
|
/*! \defgroup gsmtap GSMTAP
|
|
|
|
* @{
|
2017-06-20 02:35:06 +00:00
|
|
|
* \file gsmtap_util.h */
|
2011-08-17 14:35:24 +00:00
|
|
|
|
2010-06-29 18:51:13 +00:00
|
|
|
uint8_t chantype_rsl2gsmtap(uint8_t rsl_chantype, uint8_t rsl_link_id);
|
2017-07-12 21:43:40 +00:00
|
|
|
void chantype_gsmtap2rsl(uint8_t gsmtap_chantype, uint8_t *rsl_chantype, uint8_t *link_id);
|
2010-06-29 18:51:13 +00:00
|
|
|
|
2011-09-26 11:05:07 +00:00
|
|
|
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);
|
|
|
|
|
2010-06-29 20:31:21 +00:00
|
|
|
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);
|
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! one gsmtap instance */
|
2011-05-21 16:54:32 +00:00
|
|
|
struct gsmtap_inst {
|
2017-06-19 22:17:59 +00:00
|
|
|
int ofd_wq_mode; /*!< wait queue mode? */
|
|
|
|
struct osmo_wqueue wq; /*!< the wait queue */
|
|
|
|
struct osmo_fd sink_ofd;/*!< file descriptor */
|
2011-05-21 16:54:32 +00:00
|
|
|
};
|
2010-06-29 18:51:13 +00:00
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! obtain the file descriptor associated with a gsmtap instance
|
2016-04-25 10:11:20 +00:00
|
|
|
* \param[in] gti GSMTAP instance
|
|
|
|
* \returns file descriptor of GSMTAP instance */
|
2011-05-21 16:54:32 +00:00
|
|
|
static inline int gsmtap_inst_fd(struct gsmtap_inst *gti)
|
|
|
|
{
|
|
|
|
return gti->wq.bfd.fd;
|
|
|
|
}
|
2010-06-29 18:51:13 +00:00
|
|
|
|
2011-05-21 16:54:32 +00:00
|
|
|
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);
|
|
|
|
|
2011-09-26 11:05:07 +00:00
|
|
|
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);
|
|
|
|
|
2011-05-21 16:54:32 +00:00
|
|
|
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);
|
2011-04-27 08:57:49 +00:00
|
|
|
|
2017-07-12 22:01:02 +00:00
|
|
|
extern const struct value_string gsmtap_gsm_channel_names[];
|
|
|
|
extern const struct value_string gsmtap_type_names[];
|
|
|
|
|
2013-02-15 12:27:59 +00:00
|
|
|
/*! @} */
|