cpp-msgpack-rpc 0.2.0
An RPC library implementing MessagePack RPC.
|
Interface of connections. More...
#include <msgpack_rpc/transport/i_connection.h>
Public Types | |
using | ConnectionClosedCallback = std::function<void(const Status&)> |
Type of callback functions called when a connection is closed. | |
using | MessageReceivedCallback |
Type of callback functions called when a message is received. | |
using | MessageSentCallback = std::function<void()> |
Type of callback functions called when a message is successfully sent. |
Public Member Functions | |
IConnection (const IConnection &)=delete | |
IConnection (IConnection &&)=delete | |
virtual | ~IConnection () noexcept=default |
Destructor. | |
virtual void | async_close ()=0 |
Asynchronously close this connection. | |
virtual void | async_send (const messages::SerializedMessage &message)=0 |
Asynchronously send a message. | |
virtual const addresses::IAddress & | local_address () const noexcept=0 |
Get the address of the local endpoint. | |
IConnection & | operator= (const IConnection &)=delete |
IConnection & | operator= (IConnection &&)=delete |
virtual const addresses::IAddress & | remote_address () const noexcept=0 |
Get the address of the remote endpoint. | |
virtual void | start (MessageReceivedCallback on_received, MessageSentCallback on_sent, ConnectionClosedCallback on_closed)=0 |
Start process of this connection. |
Protected Member Functions | |
IConnection () noexcept=default | |
Constructor. |
Interface of connections.
Definition at line 34 of file i_connection.h.
using msgpack_rpc::transport::IConnection::ConnectionClosedCallback = std::function<void(const Status&)> |
Type of callback functions called when a connection is closed.
Parameters:
Definition at line 59 of file i_connection.h.
Type of callback functions called when a message is received.
Parameters:
Definition at line 43 of file i_connection.h.
using msgpack_rpc::transport::IConnection::MessageSentCallback = std::function<void()> |
Type of callback functions called when a message is successfully sent.
Definition at line 50 of file i_connection.h.
|
pure virtual |
Asynchronously close this connection.
Implemented in msgpack_rpc::transport::Connection< AsioSocketType, ConcreteAddressType >, msgpack_rpc::transport::Connection< asio::ip::tcp::socket, addresses::TCPAddress >, and msgpack_rpc::transport::Connection< AsioSocket, ConcreteAddress >.
|
pure virtual |
Asynchronously send a message.
[in] | message | Message to send. |
Implemented in msgpack_rpc::transport::Connection< AsioSocketType, ConcreteAddressType >, msgpack_rpc::transport::Connection< asio::ip::tcp::socket, addresses::TCPAddress >, and msgpack_rpc::transport::Connection< AsioSocket, ConcreteAddress >.
|
nodiscardpure virtualnoexcept |
Get the address of the local endpoint.
Implemented in msgpack_rpc::transport::Connection< AsioSocketType, ConcreteAddressType >, msgpack_rpc::transport::Connection< asio::ip::tcp::socket, addresses::TCPAddress >, and msgpack_rpc::transport::Connection< AsioSocket, ConcreteAddress >.
|
nodiscardpure virtualnoexcept |
Get the address of the remote endpoint.
Implemented in msgpack_rpc::transport::Connection< AsioSocketType, ConcreteAddressType >, msgpack_rpc::transport::Connection< asio::ip::tcp::socket, addresses::TCPAddress >, and msgpack_rpc::transport::Connection< AsioSocket, ConcreteAddress >.
|
pure virtual |
Start process of this connection.
[in] | on_received | Callback function called when a message is received. |
[in] | on_sent | Callback function called when a message is sent. |
[in] | on_closed | Callback function called when this connection is closed. |
Implemented in msgpack_rpc::transport::Connection< AsioSocketType, ConcreteAddressType >, msgpack_rpc::transport::Connection< asio::ip::tcp::socket, addresses::TCPAddress >, and msgpack_rpc::transport::Connection< AsioSocket, ConcreteAddress >.