#pragma once #include "envoy/common/platform.h" #include "envoy/config/core/v3/base.pb.h" #include "envoy/network/socket.h" #include "common/common/logger.h" #include "common/protobuf/protobuf.h" #include "absl/types/optional.h" namespace Envoy { namespace Network { struct TcpKeepaliveConfig { absl::optional keepalive_probes_; // Number of unanswered probes before the connection is dropped absl::optional keepalive_time_; // Connection idle time before probing will start, in ms absl::optional keepalive_interval_; // Interval between probes, in ms }; class SocketOptionFactory : Logger::Loggable { public: static std::unique_ptr buildTcpKeepaliveOptions(Network::TcpKeepaliveConfig keepalive_config); static std::unique_ptr buildIpFreebindOptions(); static std::unique_ptr buildIpTransparentOptions(); static std::unique_ptr buildSocketMarkOptions(uint32_t mark); static std::unique_ptr buildSocketNoSigpipeOptions(); static std::unique_ptr buildTcpFastOpenOptions(uint32_t queue_length); static std::unique_ptr buildLiteralOptions( const Protobuf::RepeatedPtrField& socket_options); static std::unique_ptr buildIpPacketInfoOptions(); static std::unique_ptr buildRxQueueOverFlowOptions(); static std::unique_ptr buildReusePortOptions(); static std::unique_ptr buildUdpGroOptions(); }; } // namespace Network } // namespace Envoy