Sylvain Munaut | 12ba778 | 2014-06-16 10:13:40 +0200 | [diff] [blame] | 1 | #pragma once |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 2 | |
| 3 | #include <stdint.h> |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 4 | #include <osmocom/core/write_queue.h> |
| 5 | #include <osmocom/core/select.h> |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 6 | |
Harald Welte | 47379ca | 2011-08-17 16:35:24 +0200 | [diff] [blame] | 7 | /*! \defgroup gsmtap GSMTAP |
| 8 | * @{ |
Neels Hofmeyr | 17518fe | 2017-06-20 04:35:06 +0200 | [diff] [blame] | 9 | * \file gsmtap_util.h */ |
Harald Welte | 47379ca | 2011-08-17 16:35:24 +0200 | [diff] [blame] | 10 | |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 11 | uint8_t chantype_rsl2gsmtap(uint8_t rsl_chantype, uint8_t rsl_link_id); |
| 12 | |
Sylvain Munaut | 15ae715 | 2011-09-26 13:05:07 +0200 | [diff] [blame] | 13 | struct msgb *gsmtap_makemsg_ex(uint8_t type, uint16_t arfcn, uint8_t ts, uint8_t chan_type, |
| 14 | uint8_t ss, uint32_t fn, int8_t signal_dbm, |
| 15 | uint8_t snr, const uint8_t *data, unsigned int len); |
| 16 | |
Harald Welte | e34a940 | 2010-06-29 22:31:21 +0200 | [diff] [blame] | 17 | struct msgb *gsmtap_makemsg(uint16_t arfcn, uint8_t ts, uint8_t chan_type, |
| 18 | uint8_t ss, uint32_t fn, int8_t signal_dbm, |
| 19 | uint8_t snr, const uint8_t *data, unsigned int len); |
| 20 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 21 | /*! one gsmtap instance */ |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 22 | struct gsmtap_inst { |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 23 | int ofd_wq_mode; /*!< wait queue mode? */ |
| 24 | struct osmo_wqueue wq; /*!< the wait queue */ |
| 25 | struct osmo_fd sink_ofd;/*!< file descriptor */ |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 26 | }; |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 27 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 28 | /*! obtain the file descriptor associated with a gsmtap instance |
Harald Welte | 2d2e2cc | 2016-04-25 12:11:20 +0200 | [diff] [blame] | 29 | * \param[in] gti GSMTAP instance |
| 30 | * \returns file descriptor of GSMTAP instance */ |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 31 | static inline int gsmtap_inst_fd(struct gsmtap_inst *gti) |
| 32 | { |
| 33 | return gti->wq.bfd.fd; |
| 34 | } |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 35 | |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 36 | int gsmtap_source_init_fd(const char *host, uint16_t port); |
| 37 | |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 38 | int gsmtap_source_add_sink_fd(int gsmtap_fd); |
| 39 | |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 40 | struct gsmtap_inst *gsmtap_source_init(const char *host, uint16_t port, |
| 41 | int ofd_wq_mode); |
| 42 | |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 43 | int gsmtap_source_add_sink(struct gsmtap_inst *gti); |
| 44 | |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 45 | int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg); |
| 46 | |
Sylvain Munaut | 15ae715 | 2011-09-26 13:05:07 +0200 | [diff] [blame] | 47 | int gsmtap_send_ex(struct gsmtap_inst *gti, uint8_t type, uint16_t arfcn, uint8_t ts, |
| 48 | uint8_t chan_type, uint8_t ss, uint32_t fn, |
| 49 | int8_t signal_dbm, uint8_t snr, const uint8_t *data, |
| 50 | unsigned int len); |
| 51 | |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 52 | int gsmtap_send(struct gsmtap_inst *gti, uint16_t arfcn, uint8_t ts, |
| 53 | uint8_t chan_type, uint8_t ss, uint32_t fn, |
| 54 | int8_t signal_dbm, uint8_t snr, const uint8_t *data, |
| 55 | unsigned int len); |
Harald Welte | d58ba46 | 2011-04-27 10:57:49 +0200 | [diff] [blame] | 56 | |
Katerina Barone-Adesi | c28c6a0 | 2013-02-15 13:27:59 +0100 | [diff] [blame] | 57 | /*! @} */ |