Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extension: User space io socket #14917

Merged
merged 23 commits into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/envoy/common/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ struct msghdr {
#define SOCKET_ERROR_ADDR_NOT_AVAIL WSAEADDRNOTAVAIL
#define SOCKET_ERROR_INVAL WSAEINVAL
#define SOCKET_ERROR_ADDR_IN_USE WSAEADDRINUSE
#define SOCKET_ERROR_BADF WSAEBADF

#define HANDLE_ERROR_PERM ERROR_ACCESS_DENIED
#define HANDLE_ERROR_INVALID ERROR_INVALID_HANDLE
Expand Down Expand Up @@ -255,6 +256,7 @@ typedef int signal_t; // NOLINT(modernize-use-using)
#define SOCKET_ERROR_ADDR_NOT_AVAIL EADDRNOTAVAIL
#define SOCKET_ERROR_INVAL EINVAL
#define SOCKET_ERROR_ADDR_IN_USE EADDRINUSE
#define SOCKET_ERROR_BADF EBADF

// Mapping POSIX file errors to common error names
#define HANDLE_ERROR_PERM EACCES
Expand Down
4 changes: 4 additions & 0 deletions source/common/network/io_socket_error_impl.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "common/network/io_socket_error_impl.h"

#include "envoy/common/platform.h"

#include "common/common/assert.h"
#include "common/common/utility.h"

Expand All @@ -26,6 +28,8 @@ Api::IoError::IoErrorCode IoSocketError::getErrorCode() const {
return IoErrorCode::Interrupt;
case SOCKET_ERROR_ADDR_NOT_AVAIL:
return IoErrorCode::AddressNotAvailable;
case SOCKET_ERROR_BADF:
return IoErrorCode::BadFd;
default:
ENVOY_LOG_MISC(debug, "Unknown error code {} details {}", errno_, getErrorDetails());
return IoErrorCode::UnknownError;
Expand Down
17 changes: 17 additions & 0 deletions source/extensions/io_socket/user_space/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,20 @@ envoy_cc_library(
"//include/envoy/event:dispatcher_interface",
],
)

envoy_cc_library(
name = "io_handle_impl_lib",
srcs = [
"io_handle_impl.cc",
],
hdrs = [
"io_handle_impl.h",
],
deps = [
":file_event_lib",
":io_handle_lib",
"//source/common/event:dispatcher_includes",
"//source/common/network:address_lib",
"//source/common/network:default_socket_interface_lib",
],
)
Loading