CatapultServer  v0.5.0.1 (Elephant)
PacketReaders.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "ConnectionContainer.h"
23 #include "ConnectionSettings.h"
24 #include "PeerConnectResult.h"
26 #include <functional>
27 #include <memory>
28 
29 namespace catapult {
30  namespace crypto { class KeyPair; }
31  namespace ionet {
32  class AcceptedPacketSocketInfo;
33  class PacketIo;
34  class PacketSocket;
35  }
36  namespace thread { class IoThreadPool; }
37 }
38 
39 namespace catapult { namespace net {
40 
43  public:
45 
46  public:
48  virtual size_t numActiveReaders() const = 0;
49 
50  public:
52  virtual void accept(const ionet::AcceptedPacketSocketInfo& socketInfo, const AcceptCallback& callback) = 0;
53 
55  virtual void shutdown() = 0;
56  };
57 
60  std::shared_ptr<PacketReaders> CreatePacketReaders(
61  const std::shared_ptr<thread::IoThreadPool>& pPool,
62  const ionet::ServerPacketHandlers& handlers,
63  const crypto::KeyPair& keyPair,
64  const ConnectionSettings& settings,
65  uint32_t maxConnectionsPerIdentity);
66 }}
ClientConnector.h
m_lock
utils::SpinLock m_lock
Definition: PacketReaders.cpp:149
CATAPULT_LOG
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
SpinLock.h
m_handlers
ionet::ServerPacketHandlers m_handlers
Definition: PacketReaders.cpp:230
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
Parser.debug
def debug(*args)
Definition: Parser.py:46
catapult::net::ConnectionSettings
Settings used to configure connections.
Definition: ConnectionSettings.h:31
catapult::net::PacketReaders::AcceptCallback
consumer< const PeerConnectResult & > AcceptCallback
Definition: PacketReaders.h:44
catapult::net::PacketReaders
Manages a collection of connections that receive data from external nodes.
Definition: PacketReaders.h:42
SocketReader.h
ChainedSocketReader.h
ConnectionContainer.h
PacketHandlers.h
catapult::net::PacketReaders::shutdown
virtual void shutdown()=0
Shuts down all connections.
PacketSocket.h
pReader
std::weak_ptr< ChainedSocketReader > pReader
Definition: PacketReaders.cpp:38
catapult::crypto::KeyPair
Represents a pair of private key with associated public key.
Definition: KeyPair.h:33
HexFormatter.h
m_pClientConnector
std::shared_ptr< ClientConnector > m_pClientConnector
Definition: PacketReaders.cpp:231
catapult::net::PacketReaders::accept
virtual void accept(const ionet::AcceptedPacketSocketInfo &socketInfo, const AcceptCallback &callback)=0
Accepts a connection represented by socketInfo and calls callback on completion.
ConnectionSettings.h
forwardsValidation.info
def info(*args)
Definition: forwardsValidation.py:12
PublicKey
Key PublicKey
Definition: PacketReaders.cpp:36
catapult::utils::KeySet
ArraySet< Key > KeySet
A key set.
Definition: ArraySet.h:64
pBufferedIo
std::shared_ptr< ionet::PacketIo > pBufferedIo
Definition: PacketReaders.cpp:37
size
uint64_t size
Definition: MemoryCounters.cpp:65
catapult::net::CreatePacketReaders
std::shared_ptr< PacketReaders > CreatePacketReaders(const std::shared_ptr< thread::IoThreadPool > &pPool, const ionet::ServerPacketHandlers &handlers, const crypto::KeyPair &keyPair, const ConnectionSettings &settings, uint32_t maxConnectionsPerIdentity)
Definition: PacketReaders.cpp:236
catapult::ionet::AcceptCallback
consumer< const AcceptedPacketSocketInfo & > AcceptCallback
Callback for an accepted socket.
Definition: PacketSocket.h:106
catapult::net::ConnectionContainer
Manages a collection of connections.
Definition: ConnectionContainer.h:27
catapult::net::CreateChainedSocketReader
std::shared_ptr< ChainedSocketReader > CreateChainedSocketReader(const std::shared_ptr< ionet::PacketSocket > &pPacketSocket, const ionet::ServerPacketHandlers &serverHandlers, const ionet::ReaderIdentity &identity)
Definition: ChainedSocketReader.cpp:79
m_readers
Readers m_readers
Definition: PacketReaders.cpp:148
PeerConnectResult.h
pSocket
SocketPointer pSocket
Definition: PacketWriters.cpp:46
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::ionet::AcceptedPacketSocketInfo
Result of a packet socket accept operation.
Definition: PacketSocket.h:68
PacketReaders.h
catapult::net::PacketReaders::numActiveReaders
virtual size_t numActiveReaders() const =0
Gets the number of active readers.
m_maxConnectionsPerIdentity
uint32_t m_maxConnectionsPerIdentity
Definition: PacketReaders.cpp:147
catapult::consumer
std::function< void(TArgs...)> consumer
A consumer function.
Definition: functions.h:35
catapult::ionet::ServerPacketHandlers
A collection of packet handlers where there is at most one handler per packet type.
Definition: PacketHandlers.h:62
catapult::Key
utils::ByteArray< Key_Size, Key_tag > Key
Definition: src/catapult/types.h:41
catapult::utils::SpinLockGuard
std::lock_guard< SpinLock > SpinLockGuard
A spin lock guard.
Definition: SpinLock.h:60