CatapultServer  v0.5.0.1 (Elephant)
ToolNetworkUtils.h
Go to the documentation of this file.
1 
21 #pragma once
23 #include "catapult/thread/Future.h"
24 #include "catapult/types.h"
25 
26 namespace catapult {
27  namespace ionet {
28  class Node;
29  class PacketIo;
30  }
31  namespace thread { class IoThreadPool; }
32 }
33 
34 namespace catapult { namespace tools {
35 
38 
42  const crypto::KeyPair& clientKeyPair,
43  const Key& serverPublicKey,
44  const std::shared_ptr<thread::IoThreadPool>& pPool);
45 
48  const crypto::KeyPair& clientKeyPair,
49  const ionet::Node& node,
50  const std::shared_ptr<thread::IoThreadPool>& pPool);
51 
54  public:
57 
60 
61  public:
64 
65  public:
67  PacketIoFuture connect(const ionet::Node& node);
68 
69  private:
71  std::shared_ptr<thread::IoThreadPool> m_pPool;
72  };
73 }}
CATAPULT_LOG
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
catapult::net::ConnectionSettings
Settings used to configure connections.
Definition: ConnectionSettings.h:31
catapult::net::PeerConnectCode
PeerConnectCode
Enumeration of possible peer connection codes.
Definition: PeerConnectCode.h:44
catapult::ionet::Node::identityKey
const Key & identityKey() const
Gets the unique identifier (a public key).
Definition: Node.cpp:60
m_pPool
std::shared_ptr< thread::IoThreadPool > m_pPool
Definition: AsyncTcpServer.cpp:199
catapult::tools::MultiNodeConnector::~MultiNodeConnector
~MultiNodeConnector()
Destroys the connector.
Definition: ToolNetworkUtils.cpp:95
catapult::thread::IoThreadPool
Represents a thread pool that shares a single io context across multiple threads.
Definition: IoThreadPool.h:30
catapult::net::CreateServerConnector
std::shared_ptr< ServerConnector > CreateServerConnector(const std::shared_ptr< thread::IoThreadPool > &pPool, const crypto::KeyPair &keyPair, const ConnectionSettings &settings)
Creates a server connector for a server with a key pair of keyPair using pPool and configured with se...
Definition: ServerConnector.cpp:119
catapult::tools::ConnectToNode
PacketIoFuture ConnectToNode(const crypto::KeyPair &clientKeyPair, const ionet::Node &node, const std::shared_ptr< thread::IoThreadPool > &pPool)
Connects to node as a client with clientKeyPair using pPool.
Definition: ToolNetworkUtils.cpp:61
ToolThreadUtils.h
KeyPair.h
ToolKeys.h
catapult::tools::ConnectToLocalNode
PacketIoFuture ConnectToLocalNode(const crypto::KeyPair &clientKeyPair, const Key &serverPublicKey, const std::shared_ptr< thread::IoThreadPool > &pPool)
Definition: ToolNetworkUtils.cpp:38
ToolNetworkUtils.h
catapult::tools::MultiNodeConnector::pool
thread::IoThreadPool & pool()
Gets the underlying pool used by the connector.
Definition: ToolNetworkUtils.cpp:100
PacketSocket.h
catapult::crypto::KeyPair
Represents a pair of private key with associated public key.
Definition: KeyPair.h:33
catapult::local::CreateLocalNode
std::unique_ptr< LocalNode > CreateLocalNode(const crypto::KeyPair &keyPair, std::unique_ptr< extensions::ProcessBootstrapper > &&pBootstrapper)
Creates and boots a local node around the specified key pair (keyPair) and bootstrapper (pBootstrappe...
Definition: LocalNode.cpp:255
catapult::crypto::FormatKey
utils::ContainerHexFormatter< Key::const_iterator > FormatKey(const Key &key)
Formats a public key for printing.
Definition: KeyUtils.cpp:27
catapult::thread::future
Provides a way to access the result of an asynchronous operation.
Definition: Future.h:29
Node.h
IoThreadPool.h
catapult::catapult_runtime_error
catapult_error< std::runtime_error > catapult_runtime_error
Definition: exceptions.h:87
catapult::tools::MultiNodeConnector::MultiNodeConnector
MultiNodeConnector()
Creates a connector.
Definition: ToolNetworkUtils.cpp:90
pBufferedIo
std::shared_ptr< ionet::PacketIo > pBufferedIo
Definition: PacketReaders.cpp:37
KeyUtils.h
catapult::tools::CreateStartedThreadPool
std::shared_ptr< thread::IoThreadPool > CreateStartedThreadPool(uint32_t numThreads)
Creates a started thread pool with numThreads threads.
Definition: ToolThreadUtils.cpp:26
catapult::ionet::CreateBufferedPacketIo
std::shared_ptr< PacketIo > CreateBufferedPacketIo(const std::shared_ptr< PacketIo > &pIo, boost::asio::io_context::strand &strand)
Adds buffering to pIo using strand for synchronization.
Definition: BufferedPacketIo.cpp:178
ServerConnector.h
catapult::tools::MultiNodeConnector::connect
PacketIoFuture connect(const ionet::Node &node)
Connects to node.
Definition: ToolNetworkUtils.cpp:104
types.h
pSocket
SocketPointer pSocket
Definition: PacketWriters.cpp:46
Node
ionet::Node Node
Definition: PacketWriters.cpp:45
catapult
Definition: AddressExtractionExtension.cpp:28
Future.h
catapult::tools::MultiNodeConnector::m_clientKeyPair
crypto::KeyPair m_clientKeyPair
Definition: ToolNetworkUtils.h:70
catapult::tools::MultiNodeConnector
Helper class for connecting to multiple nodes.
Definition: ToolNetworkUtils.h:53
catapult::utils::ByteArray
Base class for wrappers of byte array types, to provide some type-safety.
Definition: ByteArray.h:29
catapult::ionet::Node
A node in the catapult network.
Definition: Node.h:82
catapult::Key
utils::ByteArray< Key_Size, Key_tag > Key
Definition: src/catapult/types.h:41
catapult::tools::MultiNodeConnector::m_pPool
std::shared_ptr< thread::IoThreadPool > m_pPool
Definition: ToolNetworkUtils.h:71
catapult::tools::GenerateRandomKeyPair
crypto::KeyPair GenerateRandomKeyPair()
Returns random key pair.
Definition: ToolKeys.cpp:50