CatapultServer  v0.5.0.1 (Elephant)
ClientConnector.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "ConnectionSettings.h"
23 #include "PeerConnectCode.h"
24 #include "catapult/functions.h"
25 #include <memory>
26 
27 namespace catapult {
28  namespace crypto { class KeyPair; }
29  namespace ionet { class PacketSocket; }
30  namespace thread { class IoThreadPool; }
31 }
32 
33 namespace catapult { namespace net {
34 
37  public:
40 
41  public:
42  virtual ~ClientConnector() = default;
43 
44  public:
46  virtual size_t numActiveConnections() const = 0;
47 
48  public:
50  virtual void accept(const std::shared_ptr<ionet::PacketSocket>& pAcceptedSocket, const AcceptCallback& callback) = 0;
51 
53  virtual void shutdown() = 0;
54  };
55 
57  std::shared_ptr<ClientConnector> CreateClientConnector(
58  const std::shared_ptr<thread::IoThreadPool>& pPool,
59  const crypto::KeyPair& keyPair,
60  const ConnectionSettings& settings);
61 }}
ClientConnector.h
catapult::net::ClientConnector::~ClientConnector
virtual ~ClientConnector()=default
CATAPULT_LOG
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
catapult::net::CreateClientConnector
std::shared_ptr< ClientConnector > CreateClientConnector(const std::shared_ptr< thread::IoThreadPool > &pPool, const crypto::KeyPair &keyPair, const ConnectionSettings &settings)
Creates a client connector for a server with a key pair of keyPair using pPool and configured with se...
Definition: ClientConnector.cpp:104
catapult::timesync::filters::CreateClampingFilter
SynchronizationFilter CreateClampingFilter()
Creates a filter that filters out out samples that have a non tolerable high time offset.
Definition: ClampingFilter.cpp:35
catapult::net::ConnectionSettings
Settings used to configure connections.
Definition: ConnectionSettings.h:31
catapult::ionet::Secure
std::shared_ptr< PacketSocket > Secure(const std::shared_ptr< PacketSocket > &pSocket, ConnectionSecurityMode securityMode, const crypto::KeyPair &sourceKeyPair, const Key &remoteKey, utils::FileSize maxPacketDataSize)
Definition: SecurePacketSocketDecorator.cpp:85
catapult::net::ClientConnector::numActiveConnections
virtual size_t numActiveConnections() const =0
Gets the number of active connections.
m_sockets
utils::WeakContainer< ionet::PacketSocket > m_sockets
Definition: ClientConnector.cpp:100
colorPrint.warning
def warning(*args)
Definition: colorPrint.py:10
catapult::net::ClientConnector::AcceptCallback
consumer< PeerConnectCode, const std::shared_ptr< ionet::PacketSocket > &, const Key & > AcceptCallback
A callback that is passed the accept result as well as the client socket and public key (on success).
Definition: ClientConnector.h:39
VerifyPeer.h
functions.h
catapult::net::ClientConnector::accept
virtual void accept(const std::shared_ptr< ionet::PacketSocket > &pAcceptedSocket, const AcceptCallback &callback)=0
Accepts a connection represented by pAcceptedSocket and calls callback on completion.
PeerConnectCode.h
KeyPair.h
catapult::mongo::mappers::ToInt64
int64_t ToInt64(TBaseValue value)
Converts base value to int64_t.
Definition: MapperUtils.h:75
m_settings
ConnectionSettings m_settings
Definition: ClientConnector.cpp:99
catapult::timesync::filters::Decay_Strength
constexpr double Decay_Strength
Value that indicates the speed of the decay.
Definition: filter_constants.h:37
PacketSocket.h
catapult::thread::MakeTimedCallback
auto MakeTimedCallback(boost::asio::io_context &ioContext, TCallback callback, TCallbackArgs &&... timeoutArgs)
Definition: TimedCallback.h:170
catapult::crypto::KeyPair
Represents a pair of private key with associated public key.
Definition: KeyPair.h:33
m_pPool
std::shared_ptr< thread::IoThreadPool > m_pPool
Definition: ClientConnector.cpp:97
m_keyPair
const crypto::KeyPair & m_keyPair
Definition: ClientConnector.cpp:98
IoThreadPool.h
catapult::net::VerifyClient
void VerifyClient(const std::shared_ptr< ionet::PacketIo > &pClientIo, const crypto::KeyPair &keyPair, ionet::ConnectionSecurityMode allowedSecurityModes, const VerifyCallback &callback)
Definition: VerifyPeer.cpp:120
ConnectionSettings.h
forwardsValidation.info
def info(*args)
Definition: forwardsValidation.py:12
catapult::ionet::socket
boost::asio::ip::tcp::socket socket
Definition: IoTypes.h:30
catapult::ionet::AcceptCallback
consumer< const AcceptedPacketSocketInfo & > AcceptCallback
Callback for an accepted socket.
Definition: PacketSocket.h:106
filter_constants.h
catapult::timesync::filters::SynchronizationFilter
predicate< const TimeSynchronizationSample &, NodeAge > SynchronizationFilter
Signature of a synchronization filter.
Definition: SynchronizationFilters.h:29
pSocket
SocketPointer pSocket
Definition: PacketWriters.cpp:46
catapult::timesync::filters::Start_Decay_After_Round
constexpr int64_t Start_Decay_After_Round
Value that indicates after which round the decay starts.
Definition: filter_constants.h:34
catapult
Definition: AddressExtractionExtension.cpp:28
SynchronizationFilters.h
catapult::net::ClientConnector::shutdown
virtual void shutdown()=0
Shuts down all connections.
Logging.h
catapult::utils::ByteArray< Key_Size, Key_tag >
ContainerHelpers.h
catapult::consumer
std::function< void(TArgs...)> consumer
A consumer function.
Definition: functions.h:35
catapult::Key
utils::ByteArray< Key_Size, Key_tag > Key
Definition: src/catapult/types.h:41
WeakContainer.h
catapult::timesync::filters::Tolerated_Deviation_Start
constexpr auto Tolerated_Deviation_Start
Start value for the maximum tolerated deviation in ms.
Definition: filter_constants.h:28
catapult::net::ClientConnector
Accepts connections that are initiated by external nodes to this (local) node.
Definition: ClientConnector.h:36
SecurePacketSocketDecorator.h
catapult::timesync::filters::Tolerated_Deviation_Minimum
constexpr auto Tolerated_Deviation_Minimum
Minimum value for the maximum tolerated deviation in ms.
Definition: filter_constants.h:31
TimedCallback.h