SNode.C
Loading...
Searching...
No Matches
core::socket::stream Namespace Reference

Namespaces

namespace  legacy
namespace  tls
namespace  stream

Classes

class  SocketContext
class  SocketConnection
class  SocketConnectionT
class  ClientFlowController
class  ServerFlowController
class  SocketContextFactory
class  SocketReader
class  SocketWriter
class  SocketConnector
class  SocketAcceptor
class  FlowController
class  SocketClient
class  SocketServer

Functions

template<typename SocketAddress, typename PhysicalSocket, typename Config>
SocketAddress getLocalSocketAddress (PhysicalSocket &physicalSocket, Config &config)
template<typename SocketAddress, typename PhysicalSocket, typename Config>
SocketAddress getRemoteSocketAddress (PhysicalSocket &physicalSocket, Config &config)
template<typename SocketClient, typename... Args>
SocketClient Client (const std::string &instanceName, const std::function< void(typename SocketClient::Config *)> &configurator, Args &&... socketContextFactoryArgs)
template<typename SocketClient, typename... Args>
SocketClient Client (const std::string &instanceName, Args &&... socketContextFactoryArgs)
template<typename SocketServer, typename... Args>
SocketServer Server (const std::string &instanceName, const std::function< void(typename SocketServer::Config *)> &configurator, Args &&... socketContextFactoryArgs)
template<typename SocketServer, typename... Args>
SocketServer Server (const std::string &instanceName, Args &&... socketContextFactoryArgs)

Variables

template<typename ConcreteFlowController>
uint64_t FlowController< ConcreteFlowController >::idCounter = 0

Function Documentation

◆ Client() [1/2]

template<typename SocketClient, typename... Args>
SocketClient core::socket::stream::Client ( const std::string & instanceName,
Args &&... socketContextFactoryArgs )

Definition at line 361 of file SocketClient.h.

361 {
362 return SocketClient(instanceName, std::forward<Args>(socketContextFactoryArgs)...);
363 }

◆ Client() [2/2]

template<typename SocketClient, typename... Args>
SocketClient core::socket::stream::Client ( const std::string & instanceName,
const std::function< void(typename SocketClient::Config *)> & configurator,
Args &&... socketContextFactoryArgs )

Definition at line 350 of file SocketClient.h.

352 {
353 const SocketClient socketClient(instanceName, std::forward<Args>(socketContextFactoryArgs)...);
354
355 configurator(socketClient.getConfig());
356
357 return socketClient;
358 }

◆ getLocalSocketAddress()

template<typename SocketAddress, typename PhysicalSocket, typename Config>
SocketAddress core::socket::stream::getLocalSocketAddress ( PhysicalSocket & physicalSocket,
Config & config )

Definition at line 59 of file SocketConnection.hpp.

59 {
60 typename SocketAddress::SockAddr localSockAddr;
61 typename SocketAddress::SockLen localSockAddrLen = sizeof(typename SocketAddress::SockAddr);
62
63 SocketAddress localPeerAddress;
64 if (physicalSocket.getSockName(localSockAddr, localSockAddrLen) == 0) {
65 try {
66 localPeerAddress = config->Local::getSocketAddress(localSockAddr, localSockAddrLen);
67 LOG(TRACE) << config->getInstanceName() << " [" << physicalSocket.getFd() << "]" << std::setw(25)
68 << " PeerAddress (local): " << localPeerAddress.toString();
69 } catch (const typename SocketAddress::BadSocketAddress& badSocketAddress) {
70 LOG(WARNING) << config->getInstanceName() << " [" << physicalSocket.getFd() << "]" << std::setw(25)
71 << " PeerAddress (local): " << badSocketAddress.what();
72 }
73 } else {
74 PLOG(WARNING) << config->getInstanceName() << " [" << physicalSocket.getFd() << "]" << std::setw(25)
75 << " PeerAddress (local) not retrievable";
76 }
77
78 return localPeerAddress;
79 }
#define LOG(level)
Definition Logger.h:148
#define PLOG(level)
Definition Logger.h:152
virtual std::string toString(bool expanded=true) const =0

References logger::LogMessage::LogMessage(), logger::TRACE, and logger::WARNING.

Here is the call graph for this function:

◆ getRemoteSocketAddress()

template<typename SocketAddress, typename PhysicalSocket, typename Config>
SocketAddress core::socket::stream::getRemoteSocketAddress ( PhysicalSocket & physicalSocket,
Config & config )

Definition at line 82 of file SocketConnection.hpp.

82 {
83 typename SocketAddress::SockAddr remoteSockAddr;
84 typename SocketAddress::SockLen remoteSockAddrLen = sizeof(typename SocketAddress::SockAddr);
85
86 SocketAddress remotePeerAddress;
87 if (physicalSocket.getPeerName(remoteSockAddr, remoteSockAddrLen) == 0) {
88 try {
89 remotePeerAddress = config->Remote::getSocketAddress(remoteSockAddr, remoteSockAddrLen);
90 LOG(TRACE) << config->getInstanceName() << " [" << physicalSocket.getFd() << "]" << std::setw(25)
91 << " PeerAddress (remote): " << remotePeerAddress.toString();
92 } catch (const typename SocketAddress::BadSocketAddress& badSocketAddress) {
93 LOG(WARNING) << config->getInstanceName() << " [" << physicalSocket.getFd() << "]" << std::setw(25)
94 << " PeerAddress (remote): " << badSocketAddress.what();
95 }
96 } else {
97 PLOG(WARNING) << config->getInstanceName() << " [" << physicalSocket.getFd() << "]" << std::setw(25)
98 << " PeerAddress (remote) not retrievble";
99 }
100
101 return remotePeerAddress;
102 }

References logger::LogMessage::LogMessage(), logger::TRACE, and logger::WARNING.

Here is the call graph for this function:

◆ Server() [1/2]

template<typename SocketServer, typename... Args>
SocketServer core::socket::stream::Server ( const std::string & instanceName,
Args &&... socketContextFactoryArgs )

Definition at line 328 of file SocketServer.h.

328 {
329 return SocketServer(instanceName, std::forward<Args>(socketContextFactoryArgs)...);
330 }

◆ Server() [2/2]

template<typename SocketServer, typename... Args>
SocketServer core::socket::stream::Server ( const std::string & instanceName,
const std::function< void(typename SocketServer::Config *)> & configurator,
Args &&... socketContextFactoryArgs )

Definition at line 317 of file SocketServer.h.

319 {
320 const SocketServer socketServer(instanceName, std::forward<Args>(socketContextFactoryArgs)...);
321
322 configurator(socketServer.getConfig());
323
324 return socketServer;
325 }

Variable Documentation

◆ FlowController< ConcreteFlowController >::idCounter

template<typename ConcreteFlowController>
uint64_t core::socket::stream::FlowController< ConcreteFlowController >::idCounter = 0

Definition at line 54 of file FlowController.hpp.