From 114890e5a23a84e960bb60d86cc161e2e2e7591d Mon Sep 17 00:00:00 2001 From: Dmytro Podgornyi Date: Sat, 28 Sep 2024 20:00:21 +0300 Subject: [PATCH] Implement xlio_socket_geetsockname() Signed-off-by: Dmytro Podgornyi --- src/core/sock/sock-extra.cpp | 8 ++++++++ src/core/xlio.h | 1 + src/core/xlio_extra.h | 1 + 3 files changed, 10 insertions(+) diff --git a/src/core/sock/sock-extra.cpp b/src/core/sock/sock-extra.cpp index 1b75376fd..f35538ced 100644 --- a/src/core/sock/sock-extra.cpp +++ b/src/core/sock/sock-extra.cpp @@ -382,6 +382,7 @@ struct xlio_api_t *extra_api() SET_EXTRA_API(xlio_socket_destroy, xlio_socket_destroy, XLIO_EXTRA_API_XLIO_SOCKET); SET_EXTRA_API(xlio_socket_update, xlio_socket_update, XLIO_EXTRA_API_XLIO_SOCKET); SET_EXTRA_API(xlio_socket_setsockopt, xlio_socket_setsockopt, XLIO_EXTRA_API_XLIO_SOCKET); + SET_EXTRA_API(xlio_socket_getsockname, xlio_socket_getsockname, XLIO_EXTRA_API_XLIO_SOCKET); SET_EXTRA_API(xlio_socket_getpeername, xlio_socket_getpeername, XLIO_EXTRA_API_XLIO_SOCKET); SET_EXTRA_API(xlio_socket_bind, xlio_socket_bind, XLIO_EXTRA_API_XLIO_SOCKET); SET_EXTRA_API(xlio_socket_connect, xlio_socket_connect, XLIO_EXTRA_API_XLIO_SOCKET); @@ -530,6 +531,13 @@ extern "C" int xlio_socket_setsockopt(xlio_socket_t sock, int level, int optname return rc; } +extern "C" int xlio_socket_getsockname(xlio_socket_t sock, struct sockaddr *addr, + socklen_t *addrlen) +{ + sockinfo_tcp *si = reinterpret_cast(sock); + return si->getsockname(addr, addrlen); +} + extern "C" int xlio_socket_getpeername(xlio_socket_t sock, struct sockaddr *addr, socklen_t *addrlen) { diff --git a/src/core/xlio.h b/src/core/xlio.h index d71cee26d..f1c2a4fca 100644 --- a/src/core/xlio.h +++ b/src/core/xlio.h @@ -451,6 +451,7 @@ int xlio_socket_update(xlio_socket_t sock, unsigned flags, uintptr_t userdata_sq int xlio_socket_setsockopt(xlio_socket_t sock, int level, int optname, const void *optval, socklen_t optlen); +int xlio_socket_getsockname(xlio_socket_t sock, struct sockaddr *addr, socklen_t *addrlen); int xlio_socket_getpeername(xlio_socket_t sock, struct sockaddr *addr, socklen_t *addrlen); int xlio_socket_bind(xlio_socket_t sock, const struct sockaddr *addr, socklen_t addrlen); diff --git a/src/core/xlio_extra.h b/src/core/xlio_extra.h index ce7a5deb1..ea4e55863 100644 --- a/src/core/xlio_extra.h +++ b/src/core/xlio_extra.h @@ -331,6 +331,7 @@ struct __attribute__((packed)) xlio_api_t { int (*xlio_socket_update)(xlio_socket_t sock, unsigned flags, uintptr_t userdata_sq); int (*xlio_socket_setsockopt)(xlio_socket_t sock, int level, int optname, const void *optval, socklen_t optlen); + int (*xlio_socket_getsockname)(xlio_socket_t sock, struct sockaddr *addr, socklen_t *addrlen); int (*xlio_socket_getpeername)(xlio_socket_t sock, struct sockaddr *addr, socklen_t *addrlen); int (*xlio_socket_bind)(xlio_socket_t sock, const struct sockaddr *addr, socklen_t addrlen); int (*xlio_socket_connect)(xlio_socket_t sock, const struct sockaddr *to, socklen_t tolen);