aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2023-12-08 18:33:35 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2023-12-08 18:43:31 +0100
commit5aa00fe8854804cec1d5ebbb488c8cb6f3e49c99 (patch)
treeac0fbf6db6663890b7a1da52027159c6ccbba505
parentd4407a7f32186d4647dc887a0cb0e30db027fbae (diff)
stream_cli: Introduce API osmo_stream_srv_get_sockname()
Similar to what osmo_stream_srv_link and osmo_stream_cli already have. Change-Id: I171befd1fdf40c3cbb3fc7e4c3eedf82128b0712 Related: SYS#5580
-rw-r--r--TODO-RELEASE1
-rw-r--r--include/osmocom/netif/stream.h1
-rw-r--r--src/stream_srv.c13
3 files changed, 15 insertions, 0 deletions
diff --git a/TODO-RELEASE b/TODO-RELEASE
index ecfd3ae..492c205 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -9,3 +9,4 @@
#library what description / commit summary line
libosmocore >1.9.0 working osmo_sock_init2_multiaddr2() without setting flag OSMO_SOCK_F_BIND
libosmocore >1.9.0 use osmo_sock_multiaddr_get_name_buf()
+libosmo-netif added osmo_stream_srv_get_sockname() \ No newline at end of file
diff --git a/include/osmocom/netif/stream.h b/include/osmocom/netif/stream.h
index 681f9ec..2e6aa97 100644
--- a/include/osmocom/netif/stream.h
+++ b/include/osmocom/netif/stream.h
@@ -64,6 +64,7 @@ void osmo_stream_srv_set_read_cb(struct osmo_stream_srv *conn, int (*read_cb)(st
void osmo_stream_srv_set_closed_cb(struct osmo_stream_srv *conn, int (*closed_cb)(struct osmo_stream_srv *conn));
void *osmo_stream_srv_get_data(struct osmo_stream_srv *conn);
struct osmo_stream_srv_link *osmo_stream_srv_get_master(struct osmo_stream_srv *conn);
+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);
void osmo_stream_srv_destroy(struct osmo_stream_srv *conn);
diff --git a/src/stream_srv.c b/src/stream_srv.c
index f5a0b42..0dca10a 100644
--- a/src/stream_srv.c
+++ b/src/stream_srv.c
@@ -836,6 +836,19 @@ void *osmo_stream_srv_get_data(struct osmo_stream_srv *conn)
return conn->data;
}
+/*! \brief Get the stream server socket description.
+ * \param[in] cli Stream Server to examine
+ * \returns Socket description or NULL in case of error */
+const char *osmo_stream_srv_get_sockname(const struct osmo_stream_srv *conn)
+{
+ static char buf[OSMO_STREAM_MAX_ADDRS * OSMO_SOCK_NAME_MAXLEN];
+
+ osmo_sock_multiaddr_get_name_buf(buf, sizeof(buf),
+ osmo_stream_srv_get_fd(conn), conn->srv->proto);
+
+ return buf;
+}
+
/*! \brief Get Osmocom File Descriptor of the stream server
* \param[in] conn Stream Server
* \returns Pointer to \ref osmo_fd */