cpp-msgpack-rpc 0.2.0
An RPC library implementing MessagePack RPC.
|
Class of connectors fo TCP. More...
#include <msgpack_rpc/transport/tcp/tcp_connector.h>
Public Types | |
using | AsioAddress = asio::ip::tcp::endpoint |
Type of addresses in asio library. | |
using | AsioResolver = asio::ip::tcp::resolver |
Type of resolvers in asio library. | |
using | AsioSocket = asio::ip::tcp::socket |
Type of sockets in asio library. | |
using | ConcreteAddress = addresses::TCPAddress |
Type of concrete addresses. | |
using | ConnectionType = Connection<AsioSocket, ConcreteAddress> |
Type of connections. | |
Public Types inherited from msgpack_rpc::transport::IConnector | |
using | ConnectionCallback |
Type of callback functions called when connecting process finished (even for failures). |
Public Member Functions | |
TCPConnector (const std::shared_ptr< executors::IExecutor > &executor, const config::MessageParserConfig &message_parser_config, std::shared_ptr< logging::Logger > logger) | |
Constructor. | |
void | async_connect (const addresses::URI &uri, ConnectionCallback on_connected) override |
Asynchronously connect to an endpoint. | |
Public Member Functions inherited from msgpack_rpc::transport::IConnector | |
IConnector (const IConnector &)=delete | |
IConnector (IConnector &&)=delete | |
virtual | ~IConnector () noexcept=default |
Destructor. | |
IConnector & | operator= (const IConnector &)=delete |
IConnector & | operator= (IConnector &&)=delete |
Private Member Functions | |
std::shared_ptr< executors::IExecutor > | get_executor () |
Get the executor. | |
void | on_connect (const asio::error_code &error, AsioSocket &&socket, const ConnectionCallback &on_connected, const AsioAddress &asio_address, const addresses::URI &uri) |
Handle the result of connect operation. | |
AsioResolver::results_type | resolve (const addresses::URI &uri) |
Resolve a URI. |
Private Attributes | |
std::weak_ptr< executors::IExecutor > | executor_ |
Executor. | |
std::string | log_name_ |
Name of the connection for logs. | |
std::shared_ptr< logging::Logger > | logger_ |
Logger. | |
config::MessageParserConfig | message_parser_config_ |
Configuration of parsers of messages. | |
AsioResolver | resolver_ |
Resolver. | |
std::string | scheme_ |
Scheme. |
Additional Inherited Members | |
Protected Member Functions inherited from msgpack_rpc::transport::IConnector | |
IConnector () noexcept=default | |
Constructor. |
Class of connectors fo TCP.
Definition at line 57 of file tcp_connector.h.
using msgpack_rpc::transport::tcp::TCPConnector::AsioAddress = asio::ip::tcp::endpoint |
Type of addresses in asio library.
Definition at line 67 of file tcp_connector.h.
using msgpack_rpc::transport::tcp::TCPConnector::AsioResolver = asio::ip::tcp::resolver |
Type of resolvers in asio library.
Definition at line 61 of file tcp_connector.h.
using msgpack_rpc::transport::tcp::TCPConnector::AsioSocket = asio::ip::tcp::socket |
Type of sockets in asio library.
Definition at line 64 of file tcp_connector.h.
Type of concrete addresses.
Definition at line 70 of file tcp_connector.h.
using msgpack_rpc::transport::tcp::TCPConnector::ConnectionType = Connection<AsioSocket, ConcreteAddress> |
Type of connections.
Definition at line 73 of file tcp_connector.h.
|
inline |
Constructor.
[in] | executor | Executor. |
[in] | message_parser_config | Configuration of parsers of messages. |
[in] | logger | Logger. |
Definition at line 82 of file tcp_connector.h.
|
inlineoverridevirtual |
Asynchronously connect to an endpoint.
[in] | uri | URI of the endpoint. |
[in] | on_connected | Callback function called when the process finished. |
Implements msgpack_rpc::transport::IConnector.
Definition at line 93 of file tcp_connector.h.
|
inlinenodiscardprivate |
|
inlineprivate |
Handle the result of connect operation.
[in] | error | Error. |
[in] | socket | Socket. |
[in] | on_connected | Callback function to tell the result to user. |
[in] | asio_address | Address in asio library. |
[in] | uri | URI. |
Definition at line 160 of file tcp_connector.h.
|
inlinenodiscardprivate |
Resolve a URI.
[in] | uri | URI. |
Definition at line 119 of file tcp_connector.h.
|
private |
Executor.
Definition at line 196 of file tcp_connector.h.
|
private |
Name of the connection for logs.
Definition at line 208 of file tcp_connector.h.
|
private |
Logger.
Definition at line 211 of file tcp_connector.h.
|
private |
Configuration of parsers of messages.
Definition at line 199 of file tcp_connector.h.
|
private |
Resolver.
Definition at line 202 of file tcp_connector.h.
|
private |
Scheme.
Definition at line 205 of file tcp_connector.h.