pespin has submitted this change. (
https://gerrit.osmocom.org/c/libosmo-netif/+/35286?usp=email )
Change subject: stream_cli: Introduce API osmo_stream_srv_get_sockname()
......................................................................
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
---
M TODO-RELEASE
M include/osmocom/netif/stream.h
M src/stream_srv.c
3 files changed, 27 insertions(+), 0 deletions(-)
Approvals:
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
fixeria: Looks good to me, approved
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_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 @@
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 */
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-netif/+/35286?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: I171befd1fdf40c3cbb3fc7e4c3eedf82128b0712
Gerrit-Change-Number: 35286
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged