CatapultServer
v0.5.0.1 (Elephant)
|
Namespaces | |
detail | |
Classes | |
class | AsyncTcpServer |
An async TCP server. More... | |
struct | AsyncTcpServerSettings |
Settings used to configure AsyncTcpServer behavior. More... | |
class | BriefServerRequestor |
class | ChainedSocketReader |
struct | ClientChallengeResponse |
Packet representing a challenge response from a server to a client. More... | |
class | ClientConnector |
Accepts connections that are initiated by external nodes to this (local) node. More... | |
class | ConnectionContainer |
Manages a collection of connections. More... | |
struct | ConnectionSettings |
Settings used to configure connections. More... | |
class | PacketIoPicker |
An interface for picking packet io pairs. More... | |
class | PacketIoPickerContainer |
A collection of packet io pickers. More... | |
class | PacketReaders |
Manages a collection of connections that receive data from external nodes. More... | |
class | PacketWriters |
Manages a collection of connections that send data to external nodes. More... | |
struct | PeerConnectResult |
Peer connection result. More... | |
struct | ServerChallengeRequest |
Packet representing a challenge request from a server to a client. More... | |
struct | ServerChallengeResponse |
Packet representing a challenge response and new challenge request from a client to a server. More... | |
class | ServerConnector |
Establishes connections with external nodes that this (local) node initiates. More... | |
struct | VerifiedPeerInfo |
Information about the verified node. More... | |
Typedefs | |
using | AcceptHandler = consumer< const ionet::AcceptedPacketSocketInfo & > |
using | ConfigureSocketHandler = consumer< ionet::socket & > |
using | Challenge = std::array< uint8_t, 64 > |
Challenge data. More... | |
using | VerifyCallback = consumer< VerifyResult, const VerifiedPeerInfo & > |
Callback that is called with the result of a verify operation and verified peer information on success. More... | |
Enumerations | |
enum | NodeRequestResult { NodeRequestResult::NODE_REQUEST_RESULT_LIST } |
Enumeration of possible results of a ping operation. More... | |
enum | PeerConnectCode { PeerConnectCode::PEER_CONNECT_CODE_LIST } |
Enumeration of possible peer connection codes. More... | |
enum | VerifyResult { VerifyResult::VERIFY_RESULT_LIST } |
Enumeration of verification results. More... | |
Functions | |
std::shared_ptr< AsyncTcpServer > | CreateAsyncTcpServer (const std::shared_ptr< thread::IoThreadPool > &pPool, const boost::asio::ip::tcp::endpoint &endpoint, const AsyncTcpServerSettings &settings) |
template<typename TRequestor , typename TResult = std::pair<NodeRequestResult, typename TRequestor::ResponseType>> | |
thread::future< TResult > | BeginRequestFuture (TRequestor &requestor, const ionet::Node &node) |
Initiates a request for data from node using requestor and returns a future. More... | |
std::shared_ptr< ChainedSocketReader > | CreateChainedSocketReader (const std::shared_ptr< ionet::PacketSocket > &pPacketSocket, const ionet::ServerPacketHandlers &serverHandlers, const ionet::ReaderIdentity &identity) |
std::shared_ptr< ChainedSocketReader > | CreateChainedSocketReader (const std::shared_ptr< ionet::PacketSocket > &pPacketSocket, const ionet::ServerPacketHandlers &serverHandlers, const ionet::ReaderIdentity &identity, const ChainedSocketReader::CompletionHandler &completionHandler) |
std::shared_ptr< ServerChallengeRequest > | GenerateServerChallengeRequest () |
Generates a random server challenge request that is sent to a client. More... | |
std::shared_ptr< ServerChallengeResponse > | GenerateServerChallengeResponse (const ServerChallengeRequest &request, const crypto::KeyPair &keyPair, ionet::ConnectionSecurityMode securityMode) |
bool | VerifyServerChallengeResponse (const ServerChallengeResponse &response, const Challenge &challenge) |
Verifies a client's response to challenge. More... | |
std::shared_ptr< ClientChallengeResponse > | GenerateClientChallengeResponse (const ServerChallengeResponse &request, const crypto::KeyPair &keyPair) |
Generates a server response to a client challenge (request) using the server key pair (keyPair). More... | |
bool | VerifyClientChallengeResponse (const ClientChallengeResponse &response, const Key &serverPublicKey, const Challenge &challenge) |
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 settings. More... | |
std::ostream & | operator<< (std::ostream &out, NodeRequestResult value) |
Insertion operator for outputting value to out. More... | |
std::vector< ionet::NodePacketIoPair > | PickMultiple (PacketIoPicker &picker, size_t numRequested, const utils::TimeSpan &ioDuration) |
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) |
std::shared_ptr< PacketWriters > | CreatePacketWriters (const std::shared_ptr< thread::IoThreadPool > &pPool, const crypto::KeyPair &keyPair, const ConnectionSettings &settings) |
std::ostream & | operator<< (std::ostream &out, PeerConnectCode value) |
Insertion operator for outputting value to out. More... | |
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 settings. More... | |
void | VerifyClient (const std::shared_ptr< ionet::PacketIo > &pClientIo, const crypto::KeyPair &keyPair, ionet::ConnectionSecurityMode allowedSecurityModes, const VerifyCallback &callback) |
void | VerifyServer (const std::shared_ptr< ionet::PacketIo > &pServerIo, const VerifiedPeerInfo &serverPeerInfo, const crypto::KeyPair &keyPair, const VerifyCallback &callback) |
std::ostream & | operator<< (std::ostream &out, VerifyResult value) |
Insertion operator for outputting value to out. More... | |
using catapult::net::AcceptHandler = typedef consumer<const ionet::AcceptedPacketSocketInfo&> |
using catapult::net::Challenge = typedef std::array<uint8_t, 64> |
Challenge data.
using catapult::net::ConfigureSocketHandler = typedef consumer<ionet::socket&> |
using catapult::net::VerifyCallback = typedef consumer<VerifyResult, const VerifiedPeerInfo&> |
Callback that is called with the result of a verify operation and verified peer information on success.
|
strong |
|
strong |
|
strong |
thread::future<TResult> catapult::net::BeginRequestFuture | ( | TRequestor & | requestor, |
const ionet::Node & | node | ||
) |
Initiates a request for data from node using requestor and returns a future.
std::shared_ptr< AsyncTcpServer > catapult::net::CreateAsyncTcpServer | ( | const std::shared_ptr< thread::IoThreadPool > & | pPool, |
const boost::asio::ip::tcp::endpoint & | endpoint, | ||
const AsyncTcpServerSettings & | settings | ||
) |
Creates an async tcp server listening on endpoint with the specified settings using the specified thread pool (pPool).
std::shared_ptr< ChainedSocketReader > catapult::net::CreateChainedSocketReader | ( | const std::shared_ptr< ionet::PacketSocket > & | pPacketSocket, |
const ionet::ServerPacketHandlers & | serverHandlers, | ||
const ionet::ReaderIdentity & | identity | ||
) |
Creates a chained socket reader around pPacketSocket and serverHandlers with a default completion handler given an identity.
std::shared_ptr< ChainedSocketReader > catapult::net::CreateChainedSocketReader | ( | const std::shared_ptr< ionet::PacketSocket > & | pPacketSocket, |
const ionet::ServerPacketHandlers & | serverHandlers, | ||
const ionet::ReaderIdentity & | identity, | ||
const ChainedSocketReader::CompletionHandler & | completionHandler | ||
) |
Creates a chained socket reader around pPacketSocket and serverHandlers with a custom completion handler (completionHandler) given an identity.
std::shared_ptr< ClientConnector > catapult::net::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 settings.
std::shared_ptr< PacketReaders > catapult::net::CreatePacketReaders | ( | const std::shared_ptr< thread::IoThreadPool > & | pPool, |
const ionet::ServerPacketHandlers & | handlers, | ||
const crypto::KeyPair & | keyPair, | ||
const ConnectionSettings & | settings, | ||
uint32_t | maxConnectionsPerIdentity | ||
) |
Creates a packet readers container for a server with a key pair of keyPair using pPool and handlers, configured with settings and allowing maxConnectionsPerIdentity.
std::shared_ptr< PacketWriters > catapult::net::CreatePacketWriters | ( | const std::shared_ptr< thread::IoThreadPool > & | pPool, |
const crypto::KeyPair & | keyPair, | ||
const ConnectionSettings & | settings | ||
) |
Creates a packet writers container for a server with a key pair of keyPair using pPool and configured with settings.
std::shared_ptr< ServerConnector > catapult::net::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 settings.
std::shared_ptr< ClientChallengeResponse > catapult::net::GenerateClientChallengeResponse | ( | const ServerChallengeResponse & | request, |
const crypto::KeyPair & | keyPair | ||
) |
Generates a server response to a client challenge (request) using the server key pair (keyPair).
std::shared_ptr< ServerChallengeRequest > catapult::net::GenerateServerChallengeRequest | ( | ) |
Generates a random server challenge request that is sent to a client.
std::shared_ptr< ServerChallengeResponse > catapult::net::GenerateServerChallengeResponse | ( | const ServerChallengeRequest & | request, |
const crypto::KeyPair & | keyPair, | ||
ionet::ConnectionSecurityMode | securityMode | ||
) |
Generates a client response to a server challenge (request) using the client key pair (keyPair) and requests the specified security mode (securityMode).
std::ostream& catapult::net::operator<< | ( | std::ostream & | out, |
NodeRequestResult | value | ||
) |
Insertion operator for outputting value to out.
std::ostream& catapult::net::operator<< | ( | std::ostream & | out, |
PeerConnectCode | value | ||
) |
Insertion operator for outputting value to out.
std::ostream& catapult::net::operator<< | ( | std::ostream & | out, |
VerifyResult | value | ||
) |
Insertion operator for outputting value to out.
std::vector< ionet::NodePacketIoPair > catapult::net::PickMultiple | ( | PacketIoPicker & | picker, |
size_t | numRequested, | ||
const utils::TimeSpan & | ioDuration | ||
) |
Retrieves io interfaces to at most numRequested connections from picker. After ioDuration elapses, the connections will timeout.
void catapult::net::VerifyClient | ( | const std::shared_ptr< ionet::PacketIo > & | pClientIo, |
const crypto::KeyPair & | keyPair, | ||
ionet::ConnectionSecurityMode | allowedSecurityModes, | ||
const VerifyCallback & | callback | ||
) |
Attempts to verify a client (pClientIo) and calls callback on completion. Only security modes set in allowedSecurityModes are allowed. keyPair is used for responses from the server.
bool catapult::net::VerifyClientChallengeResponse | ( | const ClientChallengeResponse & | response, |
const Key & | serverPublicKey, | ||
const Challenge & | challenge | ||
) |
Verifies a server's response to challenge assuming the server has a public key of serverPublicKey.
void catapult::net::VerifyServer | ( | const std::shared_ptr< ionet::PacketIo > & | pServerIo, |
const VerifiedPeerInfo & | serverPeerInfo, | ||
const crypto::KeyPair & | keyPair, | ||
const VerifyCallback & | callback | ||
) |
Attempts to verify a server (pServerIo) using serverPeerInfo and calls callback on completion. keyPair is used for responses from the client.
bool catapult::net::VerifyServerChallengeResponse | ( | const ServerChallengeResponse & | response, |
const Challenge & | challenge | ||
) |
Verifies a client's response to challenge.