gsmtap: Hide implementation of gsmtap_inst
- Use forward decl. of struct gsmtap_inst in header
- Remove 'static inline' attributes from gsmtap_inst_fd() declaration,
move function definition to gsmtap_util.c and mark it as deprecated
- Add gsmtap_inst_fd2() as replacement for gsmtap_inst_fd()
Related: OS#6213
Change-Id: Ibe1a51205a6df764571b6d074e365825555609a5
diff --git a/src/core/gsmtap_util.c b/src/core/gsmtap_util.c
index 20c0ce1..dcbd304 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 @@
/* 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 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 6c02cd3..e5f8bd8 100644
--- a/src/core/libosmocore.map
+++ b/src/core/libosmocore.map
@@ -39,6 +39,8 @@
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;