5 #include <osmocom/core/write_queue.h>
6 #include <osmocom/core/select.h>
8 /* convert RSL channel number to GSMTAP channel type */
9 uint8_t chantype_rsl2gsmtap(uint8_t rsl_chantype, uint8_t rsl_link_id);
11 /* generate msgb from data + metadata */
12 struct msgb *gsmtap_makemsg(uint16_t arfcn, uint8_t ts, uint8_t chan_type,
13 uint8_t ss, uint32_t fn, int8_t signal_dbm,
14 uint8_t snr, const uint8_t *data, unsigned int len);
16 /* one gsmtap instance */
19 struct osmo_wqueue wq;
20 struct osmo_fd sink_ofd;
23 static inline int gsmtap_inst_fd(struct gsmtap_inst *gti)
25 return gti->wq.bfd.fd;
28 /* Open a GSMTAP source (sending) socket, conncet it to host/port and
29 * return resulting fd */
30 int gsmtap_source_init_fd(const char *host, uint16_t port);
32 /* Add a local sink to an existing GSMTAP source and return fd */
33 int gsmtap_source_add_sink_fd(int gsmtap_fd);
35 /* Open GSMTAP source (sending) socket, connect it to host/port,
36 * allocate 'struct gsmtap_inst' and optionally osmo_fd/osmo_wqueue
38 struct gsmtap_inst *gsmtap_source_init(const char *host, uint16_t port,
41 /* Add a local sink to an existing GSMTAP source instance */
42 int gsmtap_source_add_sink(struct gsmtap_inst *gti);
44 /* Send a msgb through a GSMTAP source */
45 int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg);
47 /* generate a message and send it via GSMTAP */
48 int gsmtap_send(struct gsmtap_inst *gti, uint16_t arfcn, uint8_t ts,
49 uint8_t chan_type, uint8_t ss, uint32_t fn,
50 int8_t signal_dbm, uint8_t snr, const uint8_t *data,
53 #endif /* _GSMTAP_UTIL_H */