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 Nov 15, 2024
1 parent 4562ac8 commit 0c685ec
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 @@ -383,6 +383,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 @@ -531,6 +532,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 @@ -452,6 +452,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 @@ -332,6 +332,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 0c685ec

Please sign in to comment.