Skip to content

Commit

Permalink
Implement xlio_socket_geetsockname()
Browse files Browse the repository at this point in the history
Signed-off-by: Dmytro Podgornyi <[email protected]>
  • Loading branch information
pasis committed Sep 28, 2024
1 parent b94b78b commit 114890e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/core/sock/sock-extra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<sockinfo_tcp *>(sock);
return si->getsockname(addr, addrlen);
}

extern "C" int xlio_socket_getpeername(xlio_socket_t sock, struct sockaddr *addr,
socklen_t *addrlen)
{
Expand Down
1 change: 1 addition & 0 deletions src/core/xlio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/core/xlio_extra.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 114890e

Please sign in to comment.