diff --git a/TODO-RELEASE b/TODO-RELEASE index 2f9903d09..b67161dd6 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -7,4 +7,5 @@ # If any interfaces have been added since the last public release: c:r:a + 1. # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line -core ADD osmo_sock_multiaddr_{add,del}_local_addr() \ No newline at end of file +core ADD osmo_sock_multiaddr_{add,del}_local_addr() +core ADD gsmtap_inst_fd2() core, DEPRECATE gsmtap_inst_fd() diff --git a/include/osmocom/core/gsmtap_util.h b/include/osmocom/core/gsmtap_util.h index 9137c1d25..d24ee95f7 100644 --- a/include/osmocom/core/gsmtap_util.h +++ b/include/osmocom/core/gsmtap_util.h @@ -24,19 +24,12 @@ struct msgb *gsmtap_makemsg(uint16_t arfcn, uint8_t ts, uint8_t chan_type, int8_t snr, const uint8_t *data, unsigned int len); /*! one gsmtap instance */ -struct gsmtap_inst { - int ofd_wq_mode; /*!< wait queue mode? */ - struct osmo_wqueue wq; /*!< the wait queue */ - struct osmo_fd sink_ofd;/*!< file descriptor */ -}; +struct gsmtap_inst; -/*! obtain the file descriptor associated with a gsmtap instance - * \param[in] gti GSMTAP instance - * \returns file descriptor of GSMTAP instance */ -static inline int gsmtap_inst_fd(struct gsmtap_inst *gti) -{ - return gti->wq.bfd.fd; -} +int gsmtap_inst_fd(struct gsmtap_inst *gti) + OSMO_DEPRECATED("Use gsmtap_inst_fd2() instead"); + +int gsmtap_inst_fd2(const struct gsmtap_inst *gti); int gsmtap_source_init_fd(const char *host, uint16_t port); int gsmtap_source_init_fd2(const char *local_host, uint16_t local_port, const char *rem_host, uint16_t rem_port); diff --git a/src/core/gsmtap_util.c b/src/core/gsmtap_util.c index 20c0ce1ae..dcbd30491 100644 --- a/src/core/gsmtap_util.c +++ b/src/core/gsmtap_util.c @@ -46,6 +46,28 @@ * * \file gsmtap_util.c */ +/*! one gsmtap instance */ +struct gsmtap_inst { + int ofd_wq_mode; /*!< wait queue mode? This field member may not be changed or moved (backwards compatibility) */ + struct osmo_wqueue wq; /*!< the wait queue. This field member may not be changed or moved (backwards compatibility) */ + struct osmo_fd sink_ofd; /*!< file descriptor */ +}; + +/*! Deprecated, use gsmtap_inst_fd2() instead + * \param[in] gti GSMTAP instance + * \returns file descriptor of GSMTAP instance */ +int gsmtap_inst_fd(struct gsmtap_inst *gti) +{ + return gsmtap_inst_fd2(gti); +} + +/*! obtain the file descriptor associated with a gsmtap instance + * \param[in] gti GSMTAP instance + * \returns file descriptor of GSMTAP instance */ +int gsmtap_inst_fd2(const struct gsmtap_inst *gti) +{ + return gti->wq.bfd.fd; +} /*! convert RSL channel number to GSMTAP channel type * \param[in] rsl_chantype RSL channel type @@ -330,7 +352,7 @@ int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg) /* try immediate send and return error if any */ int rc; - rc = write(gsmtap_inst_fd(gti), msg->data, msg->len); + rc = write(gsmtap_inst_fd2(gti), msg->data, msg->len); if (rc < 0) { return rc; } else if (rc >= msg->len) { @@ -447,7 +469,7 @@ int gsmtap_source_add_sink(struct gsmtap_inst *gti) { int fd, rc; - fd = gsmtap_source_add_sink_fd(gsmtap_inst_fd(gti)); + fd = gsmtap_source_add_sink_fd(gsmtap_inst_fd2(gti)); if (fd < 0) return fd; diff --git a/src/core/libosmocore.map b/src/core/libosmocore.map index 6c02cd30c..e5f8bd8c2 100644 --- a/src/core/libosmocore.map +++ b/src/core/libosmocore.map @@ -39,6 +39,8 @@ get_string_value; get_value_string; get_value_string_or_null; gsmtap_gsm_channel_names; +gsmtap_inst_fd; +gsmtap_inst_fd2; gsmtap_makemsg; gsmtap_makemsg_ex; gsmtap_send;