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 | 6773304 | 2020-03-08 17:21:29 +0100 | [diff] [blame] | 11 | uint8_t chantype_rsl2gsmtap2(uint8_t rsl_chantype, uint8_t rsl_link_id, bool user_plane); |
| 12 | |
Harald Welte | d8c74b8 | 2020-03-08 17:37:21 +0100 | [diff] [blame] | 13 | uint8_t chantype_rsl2gsmtap(uint8_t rsl_chantype, uint8_t rsl_link_id) |
| 14 | OSMO_DEPRECATED("Use chantype_rsl2gsmtap2() instead"); |
Harald Welte | 6773304 | 2020-03-08 17:21:29 +0100 | [diff] [blame] | 15 | |
Harald Welte | 93713a5 | 2017-07-12 23:43:40 +0200 | [diff] [blame] | 16 | void chantype_gsmtap2rsl(uint8_t gsmtap_chantype, uint8_t *rsl_chantype, uint8_t *link_id); |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 17 | |
Sylvain Munaut | 15ae715 | 2011-09-26 13:05:07 +0200 | [diff] [blame] | 18 | struct msgb *gsmtap_makemsg_ex(uint8_t type, uint16_t arfcn, uint8_t ts, uint8_t chan_type, |
| 19 | uint8_t ss, uint32_t fn, int8_t signal_dbm, |
Vadim Yanitskiy | 833e8fa | 2021-01-04 17:40:05 +0100 | [diff] [blame] | 20 | int8_t snr, const uint8_t *data, unsigned int len); |
Sylvain Munaut | 15ae715 | 2011-09-26 13:05:07 +0200 | [diff] [blame] | 21 | |
Harald Welte | e34a940 | 2010-06-29 22:31:21 +0200 | [diff] [blame] | 22 | struct msgb *gsmtap_makemsg(uint16_t arfcn, uint8_t ts, uint8_t chan_type, |
| 23 | uint8_t ss, uint32_t fn, int8_t signal_dbm, |
Vadim Yanitskiy | 833e8fa | 2021-01-04 17:40:05 +0100 | [diff] [blame] | 24 | int8_t snr, const uint8_t *data, unsigned int len); |
Harald Welte | e34a940 | 2010-06-29 22:31:21 +0200 | [diff] [blame] | 25 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 26 | /*! one gsmtap instance */ |
arehbein | 1584b2a | 2023-10-12 00:20:17 +0200 | [diff] [blame^] | 27 | struct gsmtap_inst; |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 28 | |
arehbein | 1584b2a | 2023-10-12 00:20:17 +0200 | [diff] [blame^] | 29 | int gsmtap_inst_fd(struct gsmtap_inst *gti) |
| 30 | OSMO_DEPRECATED("Use gsmtap_inst_fd2() instead"); |
| 31 | |
| 32 | int gsmtap_inst_fd2(const struct gsmtap_inst *gti); |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 33 | |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 34 | int gsmtap_source_init_fd(const char *host, uint16_t port); |
Max | a747d36 | 2023-02-18 23:45:42 +0300 | [diff] [blame] | 35 | int gsmtap_source_init_fd2(const char *local_host, uint16_t local_port, const char *rem_host, uint16_t rem_port); |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 36 | |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 37 | int gsmtap_source_add_sink_fd(int gsmtap_fd); |
| 38 | |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 39 | struct gsmtap_inst *gsmtap_source_init(const char *host, uint16_t port, |
| 40 | int ofd_wq_mode); |
Max | a747d36 | 2023-02-18 23:45:42 +0300 | [diff] [blame] | 41 | struct gsmtap_inst *gsmtap_source_init2(const char *local_host, uint16_t local_port, |
| 42 | const char *rem_host, uint16_t rem_port, int ofd_wq_mode); |
| 43 | |
Vadim Yanitskiy | 2f4186a | 2021-12-29 21:58:19 +0600 | [diff] [blame] | 44 | void gsmtap_source_free(struct gsmtap_inst *gti); |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 45 | |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 46 | int gsmtap_source_add_sink(struct gsmtap_inst *gti); |
| 47 | |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 48 | int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg); |
Harald Welte | 9e34f08 | 2021-11-25 15:35:50 +0100 | [diff] [blame] | 49 | int gsmtap_sendmsg_free(struct gsmtap_inst *gti, struct msgb *msg); |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 50 | |
Sylvain Munaut | 15ae715 | 2011-09-26 13:05:07 +0200 | [diff] [blame] | 51 | int gsmtap_send_ex(struct gsmtap_inst *gti, uint8_t type, uint16_t arfcn, uint8_t ts, |
| 52 | uint8_t chan_type, uint8_t ss, uint32_t fn, |
Vadim Yanitskiy | 833e8fa | 2021-01-04 17:40:05 +0100 | [diff] [blame] | 53 | int8_t signal_dbm, int8_t snr, const uint8_t *data, |
Sylvain Munaut | 15ae715 | 2011-09-26 13:05:07 +0200 | [diff] [blame] | 54 | unsigned int len); |
| 55 | |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 56 | int gsmtap_send(struct gsmtap_inst *gti, uint16_t arfcn, uint8_t ts, |
| 57 | uint8_t chan_type, uint8_t ss, uint32_t fn, |
Vadim Yanitskiy | 833e8fa | 2021-01-04 17:40:05 +0100 | [diff] [blame] | 58 | int8_t signal_dbm, int8_t snr, const uint8_t *data, |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 59 | unsigned int len); |
Harald Welte | d58ba46 | 2011-04-27 10:57:49 +0200 | [diff] [blame] | 60 | |
Harald Welte | aa3ba46 | 2017-07-13 00:01:02 +0200 | [diff] [blame] | 61 | extern const struct value_string gsmtap_gsm_channel_names[]; |
| 62 | extern const struct value_string gsmtap_type_names[]; |
| 63 | |
Katerina Barone-Adesi | c28c6a0 | 2013-02-15 13:27:59 +0100 | [diff] [blame] | 64 | /*! @} */ |