laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/36314?usp=email )


Change subject: introduce osmo_stream_cli_get_iofd() API
......................................................................

introduce osmo_stream_cli_get_iofd() API

Using this, a user can obtain the osmo_io_fd, for example in order to
perform configuration like osmo_iofd_set_alloc_info() or
osmo_iofd_set_txqueue_max_length().

Change-Id: Ie19c8294ddb12dfe5e0fd44e047c47e6f9cbd384
---
M include/osmocom/netif/stream.h
M src/stream_cli.c
M src/stream_srv.c
3 files changed, 37 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/14/36314/1

diff --git a/include/osmocom/netif/stream.h b/include/osmocom/netif/stream.h
index 1d97530..61bc1ad 100644
--- a/include/osmocom/netif/stream.h
+++ b/include/osmocom/netif/stream.h
@@ -109,6 +109,7 @@
 const char *osmo_stream_srv_get_sockname(const struct osmo_stream_srv *conn);
 struct osmo_fd *osmo_stream_srv_get_ofd(struct osmo_stream_srv *srv);
 int osmo_stream_srv_get_fd(const struct osmo_stream_srv *srv);
+struct osmo_io_fd *osmo_stream_srv_get_iofd(const struct osmo_stream_srv *srv);
 void osmo_stream_srv_destroy(struct osmo_stream_srv *conn);

 void osmo_stream_srv_set_flush_and_destroy(struct osmo_stream_srv *conn);
@@ -177,6 +178,7 @@
 char *osmo_stream_cli_get_sockname(const struct osmo_stream_cli *cli);
 struct osmo_fd *osmo_stream_cli_get_ofd(struct osmo_stream_cli *cli);
 int osmo_stream_cli_get_fd(const struct osmo_stream_cli *cli);
+struct osmo_io_fd *osmo_stream_cli_get_iofd(const struct osmo_stream_cli *cli);
 void osmo_stream_cli_set_connect_cb(struct osmo_stream_cli *cli, int 
(*connect_cb)(struct osmo_stream_cli *cli));
 void osmo_stream_cli_set_disconnect_cb(struct osmo_stream_cli *cli, int 
(*disconnect_cb)(struct osmo_stream_cli *cli));
 void osmo_stream_cli_set_read_cb(struct osmo_stream_cli *cli, int 
(*read_cb)(struct osmo_stream_cli *cli));
diff --git a/src/stream_cli.c b/src/stream_cli.c
index ca60e25..784aa84 100644
--- a/src/stream_cli.c
+++ b/src/stream_cli.c
@@ -222,6 +222,17 @@
        return -EINVAL;
 }

+/*! Retrieve osmo_io descriptor of the stream client socket.
+ *  This function must not be called on a stream client in legacy osmo_fd mode!
+ *  \param[in] cli Stream Client of which we want to obtain the file descriptor
+ *  \returns osmo_io_fd of stream client. */
+struct osmo_io_fd *
+osmo_stream_cli_get_iofd(const struct osmo_stream_cli *cli)
+{
+       OSMO_ASSERT(cli->mode == OSMO_STREAM_MODE_OSMO_IO);
+       return cli->iofd;
+}
+
 static void osmo_stream_cli_read(struct osmo_stream_cli *cli)
 {
        LOGSCLI(cli, LOGL_DEBUG, "message received\n");
diff --git a/src/stream_srv.c b/src/stream_srv.c
index 3220b9e..a02c1c2 100644
--- a/src/stream_srv.c
+++ b/src/stream_srv.c
@@ -1037,6 +1037,17 @@
        return -EINVAL;
 }

+/*! Retrieve osmo_io descriptor of the stream server socket.
+ *  This function must not be called on a stream server in legacy osmo_fd mode!
+ *  \param[in] srv Stream Server of which we want to obtain the osmo_io 
descriptor
+ *  \returns osmo_io_fd of stream server. */
+struct osmo_io_fd *
+osmo_stream_srv_get_iofd(const struct osmo_stream_srv *srv)
+{
+       OSMO_ASSERT(srv->mode == OSMO_STREAM_MODE_OSMO_IO);
+       return srv->iofd;
+}
+
 /*! Retrieve the master (Link) from a Stream Server.
  *  \param[in] conn Stream Server of which we want to know the Link
  *  \returns Link through which the given Stream Server is established */

--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/36314?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ie19c8294ddb12dfe5e0fd44e047c47e6f9cbd384
Gerrit-Change-Number: 36314
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <lafo...@osmocom.org>
Gerrit-MessageType: newchange

Reply via email to