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

#include <ConfigSocketServer.h>

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

Public Member Functions

ConfigSocketServersetReuseAddress (bool reuseAddress=true)
 
bool getReuseAddress () const
 
ConfigSocketServersetReusePort (bool reusePort=true)
 
bool getReusePort () const
 
ConfigSocketServersetDisableNagleAlgorithm (bool disableNagleAlgorithm=true)
 
bool getDisableNagleAlgorithm () const
 
- Public Member Functions inherited from net::in::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::in::SocketAddress >
SocketAddressgetSocketAddress ()
 
net::in::SocketAddress getSocketAddress (const typename net::in::SocketAddress::SockAddr &sockAddr, typename net::in::SocketAddress::SockLen sockAddrLen)
 
void renew ()
 
- Public Member Functions inherited from net::config::ConfigAddressBase< net::in::SocketAddress >
net::in::SocketAddress getSocketAddress (const typename net::in::SocketAddress::SockAddr &sockAddr, typename net::in::SocketAddress::SockLen sockAddrLen)
 
- Public Member Functions inherited from net::in::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, const 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::in::config::ConfigAddress, net::in::config::ConfigAddressReverse >
 ConfigSocketServer (net::config::ConfigInstance *instance)
 
- Protected Member Functions inherited from net::in::config::ConfigAddress< net::config::ConfigAddressLocal >
 ConfigAddress (net::config::ConfigInstance *instance, const std::string &addressOptionName, const std::string &addressOptionDescription)
 
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::in::SocketAddress >
 ConfigAddress (ConfigInstance *instance, const std::string &addressOptionName, const std::string &addressOptionDescription)
 
 ~ConfigAddress () override
 
- Protected Member Functions inherited from net::config::ConfigAddressBase< net::in::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::in::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 * disableNagleAlgorithmOpt = nullptr
 

Additional Inherited Members

- Public Types inherited from net::config::stream::ConfigSocketServer< net::in::config::ConfigAddress, net::in::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::in::stream::config::ConfigSocketServer::ConfigSocketServer ( net::config::ConfigInstance * instance)
explicitprotected

Definition at line 78 of file ConfigSocketServer.cpp.

84
86 "--reuse-address{true}",
87 SOL_SOCKET,
88 SO_REUSEADDR,
89 "Reuse socket address",
90 "bool",
91 XSTR(IN_REUSE_ADDRESS),
92 CLI::IsMember({"true", "false"}));
93
95 "--reuse-port{true}",
96 SOL_SOCKET,
97 SO_REUSEPORT,
98 "Reuse port number",
99 "bool",
100 XSTR(IN_REUSE_PORT),
101 CLI::IsMember({"true", "false"}));
102
104 "--disable-nagle-algorithm{true}",
105 IPPROTO_TCP,
106 TCP_NODELAY,
107 "Turn of Nagle algorithm",
108 "tristat",
109 XSTR(IN_SERVER_DISABLE_NAGLE_ALGORITHM),
110 CLI::IsMember({"true", "false", "default"}));
111 }
#define XSTR(s)
ConfigPhysicalSocket & addSocketOption(int optLevel, int optName, int optValue)
ConfigAddress & setPortRequired(bool required=true)
ConfigAddress & setAiSockType(int aiSocktype)
ConfigAddress & setAiFlags(int aiFlags)
ConfigAddress & setAiProtocol(int aiProtocol)

References ConfigSocketServer().

Referenced by ConfigSocketServer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~ConfigSocketServer()

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

Definition at line 113 of file ConfigSocketServer.cpp.

113 {
114 }

Member Function Documentation

◆ getDisableNagleAlgorithm()

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

Definition at line 166 of file ConfigSocketServer.cpp.

166 {
167 return disableNagleAlgorithmOpt->as<bool>();
168 }

References disableNagleAlgorithmOpt.

◆ getReuseAddress()

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

Definition at line 130 of file ConfigSocketServer.cpp.

130 {
131 return reuseAddressOpt->as<bool>();
132 }

References reuseAddressOpt.

◆ getReusePort()

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

Definition at line 148 of file ConfigSocketServer.cpp.

148 {
149 return reusePortOpt->as<bool>();
150 }

References reusePortOpt.

◆ setDisableNagleAlgorithm()

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

Definition at line 152 of file ConfigSocketServer.cpp.

152 {
153 if (disableNagleAlgorithm) {
154 addSocketOption(IPPROTO_TCP, TCP_NODELAY, 1);
155 } else {
156 addSocketOption(IPPROTO_TCP, TCP_NODELAY, 0);
157 }
158
160 ->default_val(disableNagleAlgorithm ? "true" : "false")
161 ->clear();
162
163 return *this;
164 }

References disableNagleAlgorithmOpt.

◆ setReuseAddress()

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

Definition at line 116 of file ConfigSocketServer.cpp.

116 {
117 if (reuseAddress) {
118 addSocketOption(SOL_SOCKET, SO_REUSEADDR, 1);
119 } else {
120 addSocketOption(SOL_SOCKET, SO_REUSEADDR, 0);
121 }
122
124 ->default_val(reuseAddress ? "true" : "false")
125 ->clear();
126
127 return *this;
128 }

References reuseAddressOpt.

◆ setReusePort()

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

Definition at line 134 of file ConfigSocketServer.cpp.

134 {
135 if (reusePort) {
136 addSocketOption(SOL_SOCKET, SO_REUSEPORT, 1);
137 } else {
138 addSocketOption(SOL_SOCKET, SO_REUSEPORT, 0);
139 }
140
141 reusePortOpt //
142 ->default_val(reusePort ? "true" : "false")
143 ->clear();
144
145 return *this;
146 }

References reusePortOpt.

Member Data Documentation

◆ disableNagleAlgorithmOpt

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

Definition at line 82 of file ConfigSocketServer.h.

Referenced by getDisableNagleAlgorithm(), and setDisableNagleAlgorithm().

◆ reuseAddressOpt

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

Definition at line 80 of file ConfigSocketServer.h.

Referenced by getReuseAddress(), and setReuseAddress().

◆ reusePortOpt

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

Definition at line 81 of file ConfigSocketServer.h.

Referenced by getReusePort(), and setReusePort().


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