SNode.C
Loading...
Searching...
No Matches
net::in6::stream::config::ConfigSocketServer Class Reference

#include <ConfigSocketServer.h>

Inheritance diagram for net::in6::stream::config::ConfigSocketServer:
Collaboration diagram for net::in6::stream::config::ConfigSocketServer:

Public Member Functions

ConfigSocketServersetReuseAddress (bool reuseAddress=true)
bool getReuseAddress () const
ConfigSocketServersetReusePort (bool reusePort=true)
bool getReusePort () const
ConfigSocketServersetIPv6Only (bool iPv6Only=true)
bool getIPv6Only () const
ConfigSocketServersetDisableNagleAlgorithm (bool disableNagleAlgorithm=true)
bool getDisableNagleAlgorithm () const
Public Member Functions inherited from net::in6::config::ConfigAddress< net::config::ConfigAddressLocal >
SocketAddress getSocketAddress (const SocketAddress::SockAddr &sockAddr, SocketAddress::SockLen sockAddrLen)
ConfigAddresssetSocketAddress (const SocketAddress &socketAddress)
ConfigAddresssetHost (const std::string &ipOrHostname)
std::string getHost () const
ConfigAddresssetPort (uint16_t port)
uint16_t getPort () const
ConfigAddresssetNumeric (bool numeric=true)
bool getNumeric () const
ConfigAddresssetNumericReverse (bool numeric=true)
bool getNumericReverse () const
Public Member Functions inherited from net::config::ConfigAddress< net::in6::SocketAddress >
net::in6::SocketAddress getSocketAddress (const typename net::in6::SocketAddress::SockAddr &sockAddr, typename net::in6::SocketAddress::SockLen sockAddrLen)
void renew ()
Public Member Functions inherited from net::config::ConfigAddressBase< net::in6::SocketAddress >
net::in6::SocketAddress getSocketAddress (const typename net::in6::SocketAddress::SockAddr &sockAddr, typename net::in6::SocketAddress::SockLen sockAddrLen)
Public Member Functions inherited from net::in6::config::ConfigAddressReverse< net::config::ConfigAddressReverse >
SocketAddress getSocketAddress (const SocketAddress::SockAddr &sockAddr, SocketAddress::SockLen sockAddrLen)
ConfigAddressReversesetNumericReverse (bool numeric=true)
bool getNumericReverse () const
Public Member Functions inherited from net::config::ConfigConnection
utils::Timeval getReadTimeout () const
ConfigConnectionsetReadTimeout (const utils::Timeval &newReadTimeoutSet)
utils::Timeval getWriteTimeout () const
ConfigConnectionsetWriteTimeout (const utils::Timeval &newWriteTimeoutSet)
std::size_t getReadBlockSize () const
ConfigConnectionsetReadBlockSize (std::size_t newReadBlockSize)
std::size_t getWriteBlockSize () const
ConfigConnectionsetWriteBlockSize (std::size_t newWriteBlockSize)
utils::Timeval getTerminateTimeout () const
ConfigConnectionsetTerminateTimeout (const utils::Timeval &newTerminateTimeout)
Public Member Functions inherited from net::config::ConfigPhysicalSocketServer
ConfigPhysicalSocketServersetBacklog (int newBacklog)
int getBacklog () const
ConfigPhysicalSocketServersetAcceptsPerTick (int acceptsPerTickSet)
int getAcceptsPerTick () const
ConfigPhysicalSocketServersetAcceptTimeout (const utils::Timeval &acceptTimeout)
utils::Timeval getAcceptTimeout () const
Public Member Functions inherited from net::config::ConfigPhysicalSocket
const std::map< int, std::map< int, net::phy::PhysicalSocketOption > > & getSocketOptions ()
ConfigPhysicalSocketaddSocketOption (int optLevel, int optName, int optValue)
ConfigPhysicalSocketaddSocketOption (int optLevel, int optName, const std::string &optValue)
ConfigPhysicalSocketaddSocketOption (int optLevel, int optName, const std::vector< char > &optValue)
ConfigPhysicalSocketremoveSocketOption (int optLevel, int optName)
ConfigPhysicalSocketsetRetry (bool retry=true)
bool getRetry () const
ConfigPhysicalSocketsetRetryOnFatal (bool retry=true)
bool getRetryOnFatal () const
ConfigPhysicalSocketsetRetryTimeout (double sec)
double getRetryTimeout () const
ConfigPhysicalSocketsetRetryTries (unsigned int tries=0)
unsigned int getRetryTries () const
ConfigPhysicalSocketsetRetryBase (double base)
double getRetryBase () const
ConfigPhysicalSocketsetRetryLimit (unsigned int limit)
unsigned int getRetryLimit () const
ConfigPhysicalSocketsetRetryJitter (double percent)
double getRetryJitter () const

Protected Member Functions

 ConfigSocketServer (net::config::ConfigInstance *instance)
 ~ConfigSocketServer () override
Protected Member Functions inherited from net::config::stream::ConfigSocketServer< net::in6::config::ConfigAddress, net::in6::config::ConfigAddressReverse >
 ConfigSocketServer (net::config::ConfigInstance *instance)
Protected Member Functions inherited from net::in6::config::ConfigAddress< net::config::ConfigAddressLocal >
 ConfigAddress (net::config::ConfigInstance *instance, const std::string &addressOptionName, const std::string &addressOptionDescription)
ConfigAddresssetIpv4Mapped (bool ipv4Mapped=true)
bool getIpv4Mapped () const
ConfigAddresssetAiFlags (int aiFlags)
int getAiFlags () const
ConfigAddresssetAiSockType (int aiSocktype)
int getAiSockType () const
ConfigAddresssetAiProtocol (int aiProtocol)
int getAiProtocol () const
ConfigAddresssetHostRequired (bool required=true)
ConfigAddresssetPortRequired (bool required=true)
Protected Member Functions inherited from net::config::ConfigAddress< net::in6::SocketAddress >
 ConfigAddress (ConfigInstance *instance, const std::string &addressOptionName, const std::string &addressOptionDescription)
 ~ConfigAddress () override
Protected Member Functions inherited from net::config::ConfigAddressBase< net::in6::SocketAddress >
 ConfigAddressBase (ConfigInstance *instance, const std::string &addressOptionName="", const std::string &addressOptionDescription="")
virtual ~ConfigAddressBase ()=default
Protected Member Functions inherited from net::config::ConfigSection
 ConfigSection (ConfigInstance *instance, const std::string &name, const std::string &description)
 ConfigSection (const ConfigSection &)=delete
 ConfigSection (ConfigSection &&)=delete
ConfigSectionoperator= (const ConfigSection &)=delete
ConfigSectionoperator= (ConfigSection &&)=delete
CLI::Option * addOption (const std::string &name, const std::string &description)
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName)
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName, const CLI::Validator &additionalValidator)
template<typename ValueTypeT>
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue)
template<typename ValueTypeT>
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue, const CLI::Validator &additionalValidator)
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName)
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName, const CLI::Validator &additionalValidator)
template<typename ValueTypeT>
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue)
template<typename ValueTypeT>
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue, const CLI::Validator &additionalValidator)
CLI::Option * addFlagFunction (const std::string &name, const std::function< void()> &callback, const std::string &description, const std::string &typeName, const std::string &defaultValue)
CLI::Option * addFlagFunction (const std::string &name, const std::function< void()> &callback, const std::string &description, const std::string &typeName, const std::string &defaultValue, const CLI::Validator &validator)
void required (CLI::Option *opt, bool req=true)
bool required () const
template<typename ValueType>
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName, ValueType defaultValue)
template<typename ValueType>
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName, ValueType defaultValue, const CLI::Validator &additionalValidator)
template<typename ValueType>
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName, ValueType defaultValue)
template<typename ValueType>
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName, ValueType defaultValue, const CLI::Validator &additionalValidator)
Protected Member Functions inherited from net::in6::config::ConfigAddressReverse< net::config::ConfigAddressReverse >
 ConfigAddressReverse (net::config::ConfigInstance *instance, const std::string &addressOptionName, const std::string &addressOptionDescription)
Protected Member Functions inherited from net::config::ConfigConnection
 ConfigConnection (ConfigInstance *instance)
Protected Member Functions inherited from net::config::ConfigPhysicalSocketServer
 ConfigPhysicalSocketServer (ConfigInstance *instance)
Protected Member Functions inherited from net::config::ConfigPhysicalSocket
 ConfigPhysicalSocket (ConfigInstance *instance)
CLI::Option * addSocketOption (const std::string &name, int optLevel, int optName, const std::string &description, const std::string &typeName, const std::string &defaultValue, const CLI::Validator &validator)

Private Attributes

CLI::Option * reuseAddressOpt = nullptr
CLI::Option * reusePortOpt = nullptr
CLI::Option * iPv6OnlyOpt = nullptr
CLI::Option * disableNagleAlgorithmOpt = nullptr

Additional Inherited Members

Public Types inherited from net::config::stream::ConfigSocketServer< net::in6::config::ConfigAddress, net::in6::config::ConfigAddressReverse >
using Local
using Remote
Public Types inherited from net::config::ConfigConnection
using Connection = ConfigConnection
Public Types inherited from net::config::ConfigPhysicalSocketServer
using Socket = ConfigPhysicalSocketServer
Protected Attributes inherited from net::config::ConfigSection
CLI::App * section = nullptr

Detailed Description

Definition at line 62 of file ConfigSocketServer.h.

Constructor & Destructor Documentation

◆ ConfigSocketServer()

net::in6::stream::config::ConfigSocketServer::ConfigSocketServer ( net::config::ConfigInstance * instance)
explicitprotected

Definition at line 78 of file ConfigSocketServer.cpp.

79 : net::config::stream::ConfigSocketServer<net::in6::config::ConfigAddress, net::in6::config::ConfigAddressReverse>(instance) {
81
85
87 "--reuse-address{true}",
88 SOL_SOCKET,
89 SO_REUSEADDR,
90 "Reuse socket address",
91 "bool",
92 XSTR(IN6_REUSE_ADDRESS),
93 CLI::IsMember({"true", "false"}));
94
96 "--reuse-port{true}",
97 SOL_SOCKET,
98 SO_REUSEPORT,
99 "Reuse port number",
100 "bool",
101 XSTR(IN6_REUSE_PORT),
102 CLI::IsMember({"true", "false"}));
103
105 "--ipv6-only{true}",
106 IPPROTO_IPV6,
107 IPV6_V6ONLY,
108 "Turn of IPv6 dual stack mode",
109 "tristat",
110 XSTR(IN6_IPV6_ONLY),
111 CLI::IsMember({"true", "false", "default"}));
112
114 "--disable-nagle-algorithm{true}",
115 IPPROTO_TCP,
116 TCP_NODELAY,
117 "Turn of Nagle algorithm",
118 "tristat",
119 XSTR(IN6_SERVER_DISABLE_NAGLE_ALGORITHM),
120 CLI::IsMember({"true", "false", "default"}));
121 }
#define XSTR(s)
ConfigPhysicalSocket & addSocketOption(int optLevel, int optName, int optValue)
ConfigAddress & setAiFlags(int aiFlags)
ConfigAddress & setPortRequired(bool required=true)
ConfigAddress & setAiSockType(int aiSocktype)
ConfigAddress & setAiProtocol(int aiProtocol)

References net::config::ConfigPhysicalSocket::addSocketOption(), net::config::stream::ConfigSocketServer< ConfigAddressLocalT, ConfigAddressRemoteT >::ConfigSocketServer(), disableNagleAlgorithmOpt, iPv6OnlyOpt, reuseAddressOpt, reusePortOpt, net::in6::config::ConfigAddress< ConfigAddressTypeT >::setAiProtocol(), net::in6::config::ConfigAddress< ConfigAddressTypeT >::setAiSockType(), and net::in6::config::ConfigAddress< ConfigAddressTypeT >::setPortRequired().

Here is the call graph for this function:

◆ ~ConfigSocketServer()

net::in6::stream::config::ConfigSocketServer::~ConfigSocketServer ( )
overrideprotected

Definition at line 123 of file ConfigSocketServer.cpp.

123 {
124 }

Member Function Documentation

◆ getDisableNagleAlgorithm()

bool net::in6::stream::config::ConfigSocketServer::getDisableNagleAlgorithm ( ) const

Definition at line 194 of file ConfigSocketServer.cpp.

194 {
195 return disableNagleAlgorithmOpt->as<bool>();
196 }

References disableNagleAlgorithmOpt.

◆ getIPv6Only()

bool net::in6::stream::config::ConfigSocketServer::getIPv6Only ( ) const

Definition at line 176 of file ConfigSocketServer.cpp.

176 {
177 return iPv6OnlyOpt->as<bool>();
178 }

References iPv6OnlyOpt.

◆ getReuseAddress()

bool net::in6::stream::config::ConfigSocketServer::getReuseAddress ( ) const

Definition at line 140 of file ConfigSocketServer.cpp.

140 {
141 return reuseAddressOpt->as<bool>();
142 }

References reuseAddressOpt.

◆ getReusePort()

bool net::in6::stream::config::ConfigSocketServer::getReusePort ( ) const

Definition at line 158 of file ConfigSocketServer.cpp.

158 {
159 return reusePortOpt->as<bool>();
160 }

References reusePortOpt.

◆ setDisableNagleAlgorithm()

ConfigSocketServer & net::in6::stream::config::ConfigSocketServer::setDisableNagleAlgorithm ( bool disableNagleAlgorithm = true)

Definition at line 180 of file ConfigSocketServer.cpp.

180 {
181 if (disableNagleAlgorithm) {
182 addSocketOption(IPPROTO_TCP, TCP_NODELAY, 1);
183 } else {
184 addSocketOption(IPPROTO_TCP, TCP_NODELAY, 0);
185 }
186
188 ->default_val(disableNagleAlgorithm ? "true" : "false")
189 ->clear();
190
191 return *this;
192 }

References net::config::ConfigPhysicalSocket::addSocketOption(), and disableNagleAlgorithmOpt.

Here is the call graph for this function:

◆ setIPv6Only()

ConfigSocketServer & net::in6::stream::config::ConfigSocketServer::setIPv6Only ( bool iPv6Only = true)

Definition at line 162 of file ConfigSocketServer.cpp.

162 {
163 if (iPv6Only) {
164 addSocketOption(IPPROTO_IPV6, IPV6_V6ONLY, 1);
165 } else {
166 addSocketOption(IPPROTO_IPV6, IPV6_V6ONLY, 0);
167 }
168
169 iPv6OnlyOpt //
170 ->default_val(iPv6Only ? "true" : "false")
171 ->clear();
172
173 return *this;
174 }

References net::config::ConfigPhysicalSocket::addSocketOption(), and iPv6OnlyOpt.

Here is the call graph for this function:

◆ setReuseAddress()

ConfigSocketServer & net::in6::stream::config::ConfigSocketServer::setReuseAddress ( bool reuseAddress = true)

Definition at line 126 of file ConfigSocketServer.cpp.

126 {
127 if (reuseAddress) {
128 addSocketOption(SOL_SOCKET, SO_REUSEADDR, 1);
129 } else {
130 addSocketOption(SOL_SOCKET, SO_REUSEADDR, 0);
131 }
132
134 ->default_val(reuseAddress ? "true" : "false")
135 ->clear();
136
137 return *this;
138 }

References net::config::ConfigPhysicalSocket::addSocketOption(), and reuseAddressOpt.

Here is the call graph for this function:

◆ setReusePort()

ConfigSocketServer & net::in6::stream::config::ConfigSocketServer::setReusePort ( bool reusePort = true)

Definition at line 144 of file ConfigSocketServer.cpp.

144 {
145 if (reusePort) {
146 addSocketOption(SOL_SOCKET, SO_REUSEPORT, 1);
147 } else {
148 addSocketOption(SOL_SOCKET, SO_REUSEPORT, 0);
149 }
150
151 reusePortOpt //
152 ->default_val(reusePort ? "true" : "false")
153 ->clear();
154
155 return *this;
156 }

References net::config::ConfigPhysicalSocket::addSocketOption(), and reusePortOpt.

Here is the call graph for this function:

Member Data Documentation

◆ disableNagleAlgorithmOpt

CLI::Option* net::in6::stream::config::ConfigSocketServer::disableNagleAlgorithmOpt = nullptr
private

◆ iPv6OnlyOpt

CLI::Option* net::in6::stream::config::ConfigSocketServer::iPv6OnlyOpt = nullptr
private

Definition at line 85 of file ConfigSocketServer.h.

Referenced by ConfigSocketServer(), getIPv6Only(), and setIPv6Only().

◆ reuseAddressOpt

CLI::Option* net::in6::stream::config::ConfigSocketServer::reuseAddressOpt = nullptr
private

Definition at line 83 of file ConfigSocketServer.h.

Referenced by ConfigSocketServer(), getReuseAddress(), and setReuseAddress().

◆ reusePortOpt

CLI::Option* net::in6::stream::config::ConfigSocketServer::reusePortOpt = nullptr
private

Definition at line 84 of file ConfigSocketServer.h.

Referenced by ConfigSocketServer(), getReusePort(), and setReusePort().


The documentation for this class was generated from the following files: