diff options
-rw-r--r-- | TODO-RELEASE | 1 | ||||
-rw-r--r-- | include/osmocom/netif/stream.h | 1 | ||||
-rw-r--r-- | src/stream_srv.c | 13 |
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 */ |