2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
42#ifndef NET_IN_STREAM_CONFIG_CONFIGSOCKETSERVER_H
43#define NET_IN_STREAM_CONFIG_CONFIGSOCKETSERVER_H
45#include "net/config/stream/ConfigSocketServer.h"
46#include "net/in/config/ConfigAddress.h"
52#ifndef DOXYGEN_SHOULD_SKIP_THIS
60namespace net::in::stream::
config {
#define DECLARE_ROOTROUTE_REQUESTMETHOD(METHOD)
#define DECLARE_ROUTE_REQUESTMETHOD(METHOD)
#define DEFINE_ROUTE_TEMPLATE_REQUESTMETHOD(METHOD, HTTP_METHOD)
#define DECLARE_ROUTER_REQUESTMETHOD(METHOD)
#define APPLICATION(req, res)
#define MIDDLEWARE(req, res, next)
#define DEFINE_ROUTER_TEMPLATE_REQUESTMETHOD(METHOD, HTTP_METHOD)
utils::Timeval lastTriggered
virtual void timeoutEvent()=0
const utils::Timeval initialTimeout
DescriptorEventReceiver(const std::string &name, DescriptorEventPublisher &descriptorEventPublisher, const utils::Timeval &timeout=TIMEOUT::DISABLE)
utils::Timeval maxInactivity
void onSignal(int signum)
void triggered(const utils::Timeval ¤tTime)
virtual void dispatchEvent()=0
DescriptorEventPublisher & descriptorEventPublisher
int getRegisteredFd() const
void setEnabled(const utils::Timeval ¤tTime)
void onEvent(const utils::Timeval ¤tTime) final
void setTimeout(const utils::Timeval &timeout)
virtual void signalEvent(int signum)=0
void checkTimeout(const utils::Timeval ¤tTime)
utils::Timeval getTimeout(const utils::Timeval ¤tTime) const
Descriptor(Descriptor &&descriptor) noexcept
Descriptor & operator=(const Descriptor &descriptor)=delete
Descriptor & operator=(int fd)
Descriptor & operator=(Descriptor &&descriptor) noexcept
Descriptor(const Descriptor &d)=delete
const std::string & getName() const
static void atNextTick(const std::function< void(void)> &callBack)
virtual void onEvent(const utils::Timeval ¤tTime)=0
EventReceiver & operator=(EventReceiver &&)=delete
virtual ~EventReceiver()=default
EventReceiver(EventReceiver &)=delete
EventReceiver(const std::string &name)
EventReceiver(EventReceiver &&)=delete
EventReceiver & operator=(EventReceiver &)=delete
const std::string & getName() const
void dispatch(const utils::Timeval ¤tTime)
EventMultiplexer & eventMultiplexer
EventReceiver * eventReceiver
Event(EventReceiver *eventReceiver, const std::string &name)
EventReceiver * getEventReceiver() const
Observer(Observer &&)=delete
Observer(Observer &)=delete
virtual void unobservedEvent()=0
static void init(int argc, char *argv[])
static int start(const utils::Timeval &timeOut={LONG_MAX, 0})
virtual void acceptTimeout()
void signalEvent(int signum) override
AcceptEventReceiver(const std::string &name, const utils::Timeval &timeout)
virtual void acceptEvent()=0
void dispatchEvent() final
void timeoutEvent() final
virtual void readTimeout()
void dispatchEvent() final
virtual void readEvent()=0
void signalEvent(int signum) override
void timeoutEvent() final
ReadEventReceiver(const std::string &name, const utils::Timeval &timeout)
virtual void writeTimeout()
void signalEvent(int signum) override
WriteEventReceiver(const std::string &name, const utils::Timeval &timeout)
void timeoutEvent() final
void dispatchEvent() final
virtual void writeEvent()=0
Socket & operator=(Socket &&) noexcept=delete
const std::shared_ptr< Config > config
Socket & operator=(const Socket &)=default
Socket(const Socket &)=default
Socket(const std::shared_ptr< Config > &config)
Config & getConfig() const
Socket(Socket &&) noexcept=delete
Socket(const std::string &name)
State & operator^=(int state)
State & operator&=(int state)
static constexpr int DISABLED
bool operator==(const int &state) const
State operator&(int state)
State & operator=(int state)
static constexpr int ERROR
static constexpr int FATAL
State(const int &state, const std::string &file, const int &line)
State operator^(int state)
State(const int &state, const std::string &file, const int &line, int errnum, const std::string &errstr)
std::string where() const
static constexpr int NO_RETRY
State operator|(int state)
State & operator|=(int state)
void stopReconnectAndRetry()
bool isReconnectEnabled() const
AutoConnectControl & operator=(AutoConnectControl &&)=delete
AutoConnectControl(const AutoConnectControl &)=delete
bool cancelRetryScheduled
AutoConnectControl & operator=(const AutoConnectControl &)=delete
void cancelReconnectTimer()
bool cancelReconnectScheduled
void armReconnectTimer(double timeoutSeconds, const std::function< void()> &dispatcher)
bool isRetryEnabled() const
void armRetryTimer(double timeoutSeconds, const std::function< void()> &dispatcher)
std::unique_ptr< core::timer::Timer > reconnectTimer
std::unique_ptr< core::timer::Timer > retryTimer
AutoConnectControl(AutoConnectControl &&)=delete
std::function< void(SocketConnection *)> onConnected
SocketConnectionT< PhysicalServerSocket, Config > SocketConnection
PhysicalSocketServerT PhysicalServerSocket
SocketAcceptor(const SocketAcceptor &socketAcceptor)
SocketAddress bindAddress
SocketAcceptor(const std::function< void(SocketConnection *)> &onConnect, const std::function< void(SocketConnection *)> &onConnected, const std::function< void(SocketConnection *)> &onDisconnect, const std::function< void(core::eventreceiver::AcceptEventReceiver *)> &onInitState, const std::function< void(const SocketAddress &, core::socket::State)> &onStatus, const std::shared_ptr< Config > &config)
std::function< void(SocketConnection *)> onConnect
std::function< void(SocketConnection *)> onDisconnect
void unobservedEvent() final
std::shared_ptr< Config > config
virtual void useNextSocketAddress()=0
typename PhysicalServerSocket::SocketAddress SocketAddress
~SocketAcceptor() override
PhysicalServerSocket physicalServerSocket
std::function< void(core::eventreceiver::AcceptEventReceiver *)> onInitState
std::function< void(const SocketAddress &, core::socket::State)> onStatus
SocketAddress remoteAddress
void onReceivedFromPeer(std::size_t available) final
void setReadTimeout(const utils::Timeval &timeout) final
bool streamToPeer(core::pipe::Source *source) final
std::size_t getTotalSent() const override
SocketConnectionT(PhysicalSocket &&physicalSocket, const std::function< void()> &onDisconnect, const std::shared_ptr< Config > &config)
core::socket::stream::SocketConnection Super
std::shared_ptr< Config > config
const SocketAddress & getBindAddress() const final
void doWriteShutdown(const std::function< void()> &onShutdown) override
void shutdownWrite() final
void writeTimeout() final
const SocketAddress & getRemoteAddress() const final
void sendToPeer(const char *chunk, std::size_t chunkLen) final
void setWriteTimeout(const utils::Timeval &timeout) final
std::function< void()> onDisconnect
void setTimeout(const utils::Timeval &timeout) final
PhysicalSocket physicalSocket
void onReadError(int errnum)
bool onSignal(int signum) final
std::size_t readFromPeer(char *chunk, std::size_t chunkLen) final
std::size_t getTotalProcessed() const override
SocketAddress localAddress
Config & getConfig() const
std::size_t getTotalRead() const override
void unobservedEvent() final
void onWriteError(int errnum)
SocketConnectionT()=delete
~SocketConnectionT() override
void shutdownRead() final
SocketWriterT SocketWriter
PhysicalSocketT PhysicalSocket
typename PhysicalSocket::SocketAddress SocketAddress
const SocketAddress & getLocalAddress() const final
std::size_t getTotalQueued() const override
SocketReaderT SocketReader
std::string connectionName
virtual void shutdownRead()=0
virtual void setReadTimeout(const utils::Timeval &timeout)=0
virtual void sendToPeer(const char *chunk, std::size_t chunkLen)=0
SocketConnection(int fd, const net::config::ConfigInstance *config)
core::socket::stream::SocketContext * newSocketContext
core::socket::stream::SocketContext * socketContext
virtual void setWriteTimeout(const utils::Timeval &timeout)=0
virtual const core::socket::SocketAddress & getLocalAddress() const =0
static std::string timePointToString(const std::chrono::time_point< std::chrono::system_clock > &timePoint)
virtual ~SocketConnection()
virtual void setTimeout(const utils::Timeval &timeout)=0
virtual const core::socket::SocketAddress & getBindAddress() const =0
void sentToPeer(const std::vector< char > &data)
const net::config::ConfigInstance * getConfigInstance() const
void sentToPeer(const std::vector< uint8_t > &data)
void setSocketContext(const std::shared_ptr< SocketContextFactory > &socketContextFactory)
static std::string durationToString(const std::chrono::time_point< std::chrono::system_clock > &bevore, const std::chrono::time_point< std::chrono::system_clock > &later=std::chrono::system_clock::now())
const std::string & getConnectionName() const
SocketConnection(const SocketConnection &)=delete
virtual void shutdownWrite()=0
void setSocketContext(SocketContext *socketContext)
virtual std::size_t getTotalRead() const =0
virtual std::size_t getTotalQueued() const =0
virtual const core::socket::SocketAddress & getRemoteAddress() const =0
virtual int getFd() const =0
virtual void streamEof()=0
void sendToPeer(const std::string &data)
virtual std::size_t readFromPeer(char *chunk, std::size_t chunkLen)=0
std::string getOnlineSince() const
std::string getOnlineDuration() const
virtual std::size_t getTotalSent() const =0
SocketContext * getSocketContext() const
std::chrono::time_point< std::chrono::system_clock > onlineSinceTimePoint
virtual bool streamToPeer(core::pipe::Source *source)=0
virtual std::size_t getTotalProcessed() const =0
const std::string & getInstanceName() const
std::size_t totalProcessed
void signalEvent(int sigNum) final
SocketReader(const std::string &instanceName, const std::function< void(int)> &onStatus, const utils::Timeval &timeout, std::size_t blockSize, const utils::Timeval &terminateTimeout)
std::vector< char > readBuffer
std::size_t readFromPeer(char *chunk, std::size_t chunkLen)
void setBlockSize(std::size_t readBlockSize)
utils::Timeval terminateTimeout
std::size_t getTotalProcessed() const
std::size_t getTotalRead() const
virtual void onReceivedFromPeer(std::size_t available)=0
virtual ssize_t read(char *chunk, std::size_t chunkLen)
std::function< void(int)> onStatus
SocketAcceptorT SocketAcceptor
SocketServer(Args &&... args)
const SocketServer & listen(const SocketAddress &localAddress, const std::function< void(const SocketAddress &, core::socket::State)> &onStatus) const
SocketServer(const std::shared_ptr< Config > &config, const std::shared_ptr< Context > &sharedContext)
std::shared_ptr< SocketContextFactory > getSocketContextFactory() const
SocketServer(const std::string &name, const std::function< void(SocketConnection *)> &onConnect, const std::function< void(SocketConnection *)> &onConnected, const std::function< void(SocketConnection *)> &onDisconnect, Args &&... args)
typename SocketAcceptor::SocketAddress SocketAddress
SocketServer(const std::string &name, Args &&... args)
SocketServer(const std::function< void(SocketConnection *)> &onConnect, const std::function< void(SocketConnection *)> &onConnected, const std::function< void(SocketConnection *)> &onDisconnect, Args &&... args)
core::socket::Socket< typename SocketAcceptor::Config > Super
std::function< void(SocketConnection *)> & getOnDisconnect() const
const SocketServer & realListen(const std::function< void(const SocketAddress &, core::socket::State)> &onStatus, unsigned int tries, double retryTimeoutScale) const
std::function< void(SocketConnection *)> & getOnConnected() const
std::function< void(core::eventreceiver::AcceptEventReceiver *)> & getOnInitState() const
const SocketServer & setOnConnected(const std::function< void(SocketConnection *)> &onConnected, bool initialize=false) const
const SocketServer & setOnConnect(const std::function< void(SocketConnection *)> &onConnect, bool initialize=false) const
const SocketServer & listen(const std::function< void(const SocketAddress &, core::socket::State)> &onStatus) const
std::shared_ptr< Context > sharedContext
typename SocketAcceptor::SocketConnection SocketConnection
SocketServer & setOnDisconnect(const std::function< void(SocketConnection *)> &onDisconnect, bool initialize=false)
std::function< void(SocketConnection *)> & getOnConnect() const
SocketContextFactoryT SocketContextFactory
SocketServer(const std::shared_ptr< Config > &config, const std::shared_ptr< SocketContextFactory > &socketContextFactory, const std::function< void(SocketConnection *)> onConnect, const std::function< void(SocketConnection *)> onConnected, const std::function< void(SocketConnection *)> onDisconnect)
const SocketServer & listen(const SocketAddress &localAddress, int backlog, const std::function< void(const SocketAddress &, core::socket::State)> &onStatus) const
const SocketServer & setOnInitState(const std::function< void(core::eventreceiver::AcceptEventReceiver *)> &onInitState, bool initialize=false) const
const SocketServer & setOnAutoConnectControl(const std::function< void(const std::shared_ptr< AutoConnectControl > &)> &onAutoConnectControl, bool initialize=false) const
typename SocketAcceptor::Config Config
std::function< void(const std::shared_ptr< AutoConnectControl > &)> & getOnAutoConnectControl()
virtual void doWriteShutdown(const std::function< void()> &onShutdown)=0
utils::Timeval terminateTimeout
std::function< void(int)> onStatus
void setBlockSize(std::size_t writeBlockSize)
void sendToPeer(const char *chunk, std::size_t chunkLen)
core::pipe::Source * source
std::vector< char > writePuffer
void signalEvent(int sigNum) final
std::function< void()> onShutdown
std::size_t getTotalSent() const
virtual bool onSignal(int sigNum)=0
void shutdownWrite(const std::function< void()> &onShutdown)
std::size_t getTotalQueued() const
bool streamToPeer(core::pipe::Source *source)
virtual ssize_t write(const char *chunk, std::size_t chunkLen)
SocketWriter(const std::string &instanceName, const std::function< void(int)> &onStatus, const utils::Timeval &timeout, std::size_t blockSize, const utils::Timeval &terminateTimeout)
SocketAcceptor(const std::shared_ptr< core::socket::stream::SocketContextFactory > &socketContextFactory, const std::function< void(SocketConnection *)> &onConnect, const std::function< void(SocketConnection *)> &onConnected, const std::function< void(SocketConnection *)> &onDisconnect, const std::function< void(core::eventreceiver::AcceptEventReceiver *)> &onInitState, const std::function< void(const SocketAddress &, core::socket::State)> &onStatus, const std::shared_ptr< Config > &config)
void useNextSocketAddress() override
typename Super::Config Config
typename Super::SocketAddress SocketAddress
typename Super::SocketConnection SocketConnection
core::socket::stream::SocketAcceptor< PhysicalServerSocketT, ConfigT, core::socket::stream::legacy::SocketConnection > Super
SocketAcceptor(const SocketAcceptor &socketAcceptor)
PhysicalSocketT PhysicalSocket
SocketConnection(PhysicalSocket &&physicalSocket, const std::function< void(SocketConnection *)> &onDisconnect, const std::shared_ptr< Config > &config)
typename Super::SocketWriter SocketWriter
typename Super::SocketReader SocketReader
core::socket::stream::SocketConnectionT< PhysicalSocketT, core::socket::stream::legacy::SocketReader, core::socket::stream::legacy::SocketWriter, ConfigT > Super
typename Super::SocketAddress SocketAddress
core::socket::stream::SocketReader Super
core::socket::stream::SocketWriter Super
void next(const std::string &how) const
const std::shared_ptr< Request > & getRequest()
bool dispatchNext(bool strictRouting, bool caseInsensitiveRouting, bool mergeParams)
Controller(const std::shared_ptr< web::http::server::Request > &request, const std::shared_ptr< web::http::server::Response > &response)
std::shared_ptr< Response > response
Controller(const Controller &controller)
void setCurrentRoute(Route *currentRoute)
void setRootRoute(RootRoute *rootRoute)
std::shared_ptr< Request > request
Controller & operator=(const Controller &controller) noexcept
const std::shared_ptr< Response > & getResponse()
void operator()(const std::string &how="") const
Next(Controller &controller)
web::http::CiStringMap< std::string > cookies
Request(Request &&) noexcept=delete
const std::string & cookie(const std::string &key) const
Request & operator=(Request &&) noexcept=delete
std::map< std::string, std::string > params
const std::string & get(const std::string &key, int i=0) const
Request(const std::shared_ptr< web::http::server::Request > &request) noexcept
std::shared_ptr< web::http::server::Request > requestBase
Request(Request &)=delete
const std::string & query(const std::string &key) const
web::http::CiStringMap< std::string > headers
const std::string & param(const std::string &id, const std::string &fallBack="")
std::map< std::string, std::string > queries
web::http::CiStringMap< std::string > trailer
Request & operator=(Request &)=delete
void download(const std::string &file, const std::string &fileName, const std::function< void(int)> &onError)
void redirect(const std::string &loc, const std::string &html={})
std::shared_ptr< web::http::server::Response > responseBase
Response & attachment(const std::string &fileName="")
Response & cookie(const std::string &name, const std::string &value, const std::map< std::string, std::string > &options={})
void redirect(int state, const std::string &loc, const std::string &html={})
Response & clearCookie(const std::string &name, const std::map< std::string, std::string > &options={})
Response(Response &&) noexcept=delete
Response & operator=(Response &&) noexcept=delete
void sendFile(const std::string &file, const std::function< void(int)> &callback)
void sendStatus(int state, const std::string &html={})
void download(const std::string &file, const std::function< void(int)> &onError)
Response & set(const std::string &field, const std::string &value, bool overwrite=true)
Response & setTrailer(const std::string &field, const std::string &value, bool overwrite=true)
Response & sendFragment(const char *chunk, std::size_t chunkLen)
Response & append(const std::string &field, const std::string &value)
Response & sendFragment(const std::string &chunk="")
void send(const std::string &chunk)
Response(const std::shared_ptr< web::http::server::Response > &response) noexcept
Response & status(int status)
Response(Response &)=delete
void send(const char *chunk, std::size_t chunkLen)
Response & vary(const std::string &field)
Response & operator=(Response &)=delete
Response & type(const std::string &type)
Response & set(const std::map< std::string, std::string > &headers, bool overwrite=true)
web::http::server::SocketContext * getSocketContext() const
const std::string & header(const std::string &field)
void json(const nlohmann::json &json)
void upgrade(const std::shared_ptr< Request > &request, const std::function< void(const std::string)> &status)
Response & location(const std::string &loc)
RootRoute & setMergeParams(bool mergeParams)
void dispatch(Controller &&controller)
void dispatch(Controller &controller)
Route & head(const RootRoute &rootRoute) const
Route & del(const RootRoute &rootRoute) const
bool getStrictRouting() const
Route & connect(const RootRoute &rootRoute) const
std::list< std::string > getRoutes() const
std::list< Route > & routes() const
Route & get(const RootRoute &rootRoute) const
Route & trace(const RootRoute &rootRoute) const
Route & use(const RootRoute &rootRoute) const
Route & post(const RootRoute &rootRoute) const
Route & put(const RootRoute &rootRoute) const
bool getMergeParams() const
bool getCaseInsensitiveRouting() const
RootRoute & setCaseInsensitiveRouting(bool caseInsensitiveRouting)
Route & options(const RootRoute &rootRoute) const
Route & all(const RootRoute &rootRoute) const
std::shared_ptr< dispatcher::RouterDispatcher > getDispatcher() const
Route & patch(const RootRoute &rootRoute) const
RootRoute & setStrictRouting(bool strictRouting)
Route & patch(const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
std::shared_ptr< Dispatcher > dispatcher
Route & put(const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
Route & head(const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
bool dispatchNext(Controller &controller, bool strictRouting, bool caseInsensitiveRouting, bool mergeParams)
Route & use(const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
Route & connect(const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
Route(const std::string &method, const std::string &relativeMountPath, const std::shared_ptr< Dispatcher > &dispatcher)
Route & options(const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
Route & all(const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
Route & del(const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
Route & get(const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
Route & post(const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
std::list< std::string > getRoute(const std::string &parentMountPath, bool strictRouting) const
bool dispatch(Controller &controller, bool strictRouting, bool caseInsensitiveRouting, bool mergeParams)
Route & trace(const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
Route & head(const Router &router) const
Route & all(const Router &router) const
const Router & setCaseInsensitiveRouting(bool caseInsensitiveRouting=true) const
const Router & setStrictRouting(bool strictRouting=true) const
Route & options(const Router &router) const
Route & connect(const Router &router) const
Route & post(const Router &router) const
Route & del(const Router &router) const
Router(const Router &)=default
Route & use(const Router &router) const
Route & get(const Router &router) const
Route & trace(const Router &router) const
Route & patch(const Router &router) const
const Router & setMergeParams(bool mergeParams=true) const
std::list< std::string > getRoutes() const
Route & put(const Router &router) const
std::shared_ptr< RootRoute > rootRoute
WebAppT(const std::string &name, const Router &router)
typename Server::SocketConnection SocketConnection
express::Response Response
typename Server::SocketAddress SocketAddress
WebAppT(const std::string &name)
static void init(int argc, char *argv[])
static core::TickStatus tick(const utils::Timeval &timeOut=0)
static core::State state()
static int start(const utils::Timeval &timeOut={LONG_MAX, 0})
WebApp(const Router &router)
SocketAddress(const SockAddr &sockAddr, SockLen sockAddrLen)
const SockLen & getSockAddrLen() const
SocketAddress & operator=(const SocketAddress &socketAddress)
SocketAddress(const SocketAddress &socketAddress)
SocketAddress(sa_family_t af, SockLen sockAddrLen=sizeof(SockAddr))
const sockaddr & getSockAddr()
sa_family_t getAddressFamily() const
net::config::ConfigSection * addSection(std::shared_ptr< net::config::ConfigSection > &&configSection)
ConfigInstance(ConfigInstance &&)=delete
std::vector< std::shared_ptr< net::config::ConfigSection > > configSections
virtual ~ConfigInstance()
void setDisabled(bool disabled=true)
void setInstanceName(const std::string &instanceName)
void configurable(bool configurable=true)
ConcreteConfigSection * addSection(Args &&... args)
ConfigInstance(ConfigInstance &)=delete
ConfigInstance(const std::string &instanceName, Role role)
CLI::App * newSection(std::shared_ptr< CLI::App > appWithPtr, const std::string &group)
static const std::string nameAnonymous
SectionTypeT * getSection() const
ConfigInstance & operator=(ConfigInstance &)=delete
void required(bool required=true)
const std::string & getInstanceName() const
ConfigInstance & operator=(ConfigInstance &&)=delete
const CLI::App * getSection(const std::string &name) const
bool gotSection(const std::string &name, bool recursive=false) const
void required(CLI::App *section, bool req=true)
static constexpr std::string_view name
ConfigLegacy(ConfigInstance *instance)
static constexpr std::string_view description
CLI::Option * addOption(const std::string &name, const std::string &description, const std::string &typeName, const CLI::Validator &additionalValidator)
void required(bool required=true)
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)
CLI::Option * addOption(const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue)
void setConfigurable(CLI::Option *option, bool configurable)
CLI::Option * addFlag(const std::string &name, const std::string &description)
ConfigSection(const ConfigSection &)=delete
ConfigSection & operator=(ConfigSection &&)=delete
CLI::Option * addFlag(const std::string &name, const std::string &description, const std::string &typeName, const CLI::Validator &additionalValidator)
CLI::Option * addOption(const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue, const CLI::Validator &additionalValidator)
CLI::Option * addOptionFunction(const std::string &name, const std::function< void(const std::string &)> &optionFunction, const std::string &description)
ConfigSection(ConfigInstance *instance, T *sectionPtr, const std::string &group="Sections")
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 * addFlag(const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue)
CLI::Option * addFlag(const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue, const CLI::Validator &additionalValidator)
ConfigSection(ConfigSection &&)=delete
ConfigInstance * instance
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)
CLI::Option * getOption(const std::string &name) const
ConfigSection & operator=(const ConfigSection &)=delete
CLI::Option * addFlag(const std::string &name, const std::string &description, const std::string &typeName)
void required(CLI::Option *opt, bool req=true)
ConfigSocketServer(const std::string &name)
SocketAddress & setPort(uint16_t port)
SocketAddress(const std::string &ipOrHostname, uint16_t port)
SocketAddress & setHost(const std::string &ipOrHostname)
SocketAddress(uint16_t port)
SocketAddress(const std::string &ipOrHostname)
std::string getHost() const
net::SocketAddress< sockaddr_in > Super
std::string getCanonName() const
std::shared_ptr< SocketAddrInfo > socketAddrInfo
SocketAddress(const SockAddr &sockAddr, SockLen sockAddrLen, bool numeric=true)
std::string getEndpoint(const std::string_view &format={}) const override
std::string toString(bool expanded=true) const override
void init(const Hints &hints={.aiFlags=0,.aiSockType=0,.aiProtocol=0})
~PhysicalSocket() override
PhysicalSocket(PhysicalSocket &&) noexcept=default
PhysicalSocket(int type, int protocol)
PhysicalPeerSocketT< net::in::SocketAddress > Super
PhysicalSocketServer(PhysicalSocketServer &&) noexcept=default
net::in::phy::stream::PhysicalSocket< net::phy::stream::PhysicalSocketServer > Super
~PhysicalSocketServer() override
~PhysicalSocket() override
PhysicalSocket(PhysicalSocket &&) noexcept=default
net::in::phy::PhysicalSocket< PhysicalPeerSocketT > Super
const Super & listen(const std::string &ipOrHostname, uint16_t port, int backlog, const std::function< void(const SocketAddress &, core::socket::State)> &onStatus) const
const Super & listen(uint16_t port, const std::function< void(const SocketAddress &, core::socket::State)> &onStatus) const
const Super & listen(uint16_t port, int backlog, const std::function< void(const SocketAddress &, core::socket::State)> &onStatus) const
const Super & listen(const std::string &ipOrHostname, uint16_t port, const std::function< void(const SocketAddress &, core::socket::State)> &onStatus) const
core::socket::stream:: SocketServer< SocketAcceptorT< net::in::phy::stream::PhysicalSocketServer, ConfigSocketServerT >, SocketContextFactoryT, Args... > Super
~ConfigSocketServer() override
CLI::Option * disableNagleAlgorithmOpt
bool getReusePort() const
ConfigSocketServer & setReusePort(bool reusePort=true)
bool getReuseAddress() const
bool getDisableNagleAlgorithm() const
ConfigSocketServer & setReuseAddress(bool reuseAddress=true)
ConfigSocketServer(net::config::ConfigInstance *instance)
CLI::Option * reusePortOpt
ConfigSocketServer & setDisableNagleAlgorithm(bool disableNagleAlgorithm=true)
CLI::Option * reuseAddressOpt
~ConfigSocketServer() override
ConfigSocketServer(const std::string &name)
PhysicalSocketOption()=default
socklen_t getOptLen() const
const void * getOptValue() const
PhysicalSocketOption(int optLevel, int optName, int optValue)
std::vector< char > optValue
PhysicalSocketOption(int optLevel, int optName, const std::vector< char > &optValue)
PhysicalSocketOption(int optLevel, int optName, const std::string &optValue)
int open(const std::map< int, std::map< int, PhysicalSocketOption > > &socketOptionsMapMap, Flags flags)
int getPeerName(typename SocketAddress::SockAddr &remoteSockAddr, typename SocketAddress::SockLen &remoteSockAddrLen)
PhysicalSocket(const PhysicalSocket &)=delete
PhysicalSocket(int domain, int type, int protocol)
SocketAddressT SocketAddress
int setSockopt(int level, int optname, const void *optval, typename SocketAddress::SockLen optlen) const
int getSockError(int &cErrno) const
PhysicalSocket(PhysicalSocket &&physicalSocket) noexcept=default
PhysicalSocket & operator=(PhysicalSocket &)=delete
PhysicalSocket & operator=(const PhysicalSocket &)=delete
~PhysicalSocket() override
PhysicalSocket(PhysicalSocket &)=delete
int bind(SocketAddress &bindAddress)
PhysicalSocket & operator=(PhysicalSocket &&) noexcept=default
PhysicalSocket(int fd, const SocketAddress &bindAddress)
int getSockName(typename SocketAddress::SockAddr &localSockAddr, typename SocketAddress::SockLen &localSockAddrLen)
SocketAddress bindAddress
const SocketAddress & getBindAddress() const
int getSockopt(int level, int optname, void *optval, typename SocketAddress::SockLen *optlen) const
net::phy::stream::PhysicalSocket< SocketAddressT > Super
SocketAddressT SocketAddress
SocketAddressT SocketAddress
net::phy::PhysicalSocket< SocketAddressT > Super
constexpr AttributeProxy(const Attribute &attribute)
constexpr Attribute & operator*()
constexpr bool setAttribute(const Attribute &&attribute, const std::string &subKey="", bool overwrite=false)
constexpr bool hasAttribute(const std::string &subKey="") const
constexpr bool delAttribute(const std::string &subKey="")
bool getAttribute(const std::function< void(Attribute &)> &onFound, const std::string &subKey="") const
std::map< std::string, std::shared_ptr< void > > attributes
void getAttribute(const std::function< void(Attribute &)> &onFound, const std::function< void(const std::string &)> &onNotFound, const std::string &subKey="") const
constexpr bool setAttribute(const Attribute &attribute, const std::string &subKey="", bool overwrite=false)
static double getInRange(double ll, double ul)
constexpr void getAttribute(const std::function< void(Attribute &)> &onFound, const std::function< void(const std::string &)> &onNotFound) const
std::string attributeType
constexpr bool setAttribute(const Attribute &attribute, bool overwrite=false)
constexpr bool setAttribute(const Attribute &&attribute, bool overwrite=false)
std::shared_ptr< void > attribute
constexpr bool getAttribute(const std::function< void(Attribute &)> &onFound) const
Timeval(const std::initializer_list< time_t > &initList) noexcept
int main(int argc, char *argv[])
std::vector< json > Trace
static void ensureTrace(const std::shared_ptr< express::Request > &req)
static void tracePush(const std::shared_ptr< express::Request > &req, const std::string &label)
static json snapshot(const std::shared_ptr< express::Request > &req, const std::string &label)
static json traceGet(const std::shared_ptr< express::Request > &req)
SocketServer Server(const std::string &instanceName, const std::function< void(typename SocketServer::Config &)> &configurator, Args &&... socketContextFactoryArgs)
SocketServer Server(const std::string &instanceName, Args &&... socketContextFactoryArgs)
SocketServer< SocketContextFactory, SocketContextFactoryArgs... > Server(const std::string &instanceName, const std::function< void(typename SocketServer< SocketContextFactory, SocketContextFactoryArgs... >::Config &)> &configurator, SocketContextFactoryArgs &&... socketContextFactoryArgs)
SocketServer< SocketContextFactory, SocketContextFactoryArgs... > Server(const std::string &instanceName, SocketContextFactoryArgs &&... socketContextFactoryArgs)
net::in::stream::SocketServer< core::socket::stream::legacy::SocketAcceptor, net::in::stream::legacy::config::ConfigSocketServer, SocketContextFactoryT, Args... > SocketServer
fixed_string(char const (&)[N]) -> fixed_string< N - 1 >
web::http::server::Server< net::in::stream::legacy::SocketServer > Server
static const utils::Timeval MAX
static const utils::Timeval DISABLE
static const utils::Timeval DEFAULT
std::shared_ptr< SocketContextFactory > socketContextFactory
std::function< void(SocketConnection *)> onConnected
std::function< void(SocketConnection *)> onConnect
std::function< void(core::eventreceiver::AcceptEventReceiver *)> onInitState
Context(const std::shared_ptr< SocketContextFactory > &socketContextFactory, const std::function< void(SocketConnection *)> &onConnect, const std::function< void(SocketConnection *)> &onConnected, const std::function< void(SocketConnection *)> &onDisconnect)
std::function< void(const std::shared_ptr< AutoConnectControl > &)> onAutoConnectControl
std::shared_ptr< AutoConnectControl > autoConnectControl
std::function< void(SocketConnection *)> onDisconnect
MountPoint(const std::string &method, const std::string &relativeMountPath)
std::string relativeMountPath
auto operator<=>(const fixed_string &) const =default
constexpr fixed_string(char const *s)
constexpr operator char const *() const