cpp-msgpack-rpc 0.2.0
An RPC library implementing MessagePack RPC.
Loading...
Searching...
No Matches
msgpack_rpc::transport::IConnection Class Referenceabstract

Interface of connections. More...

#include <msgpack_rpc/transport/i_connection.h>

Inheritance diagram for msgpack_rpc::transport::IConnection:
Collaboration diagram for msgpack_rpc::transport::IConnection:

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::IAddresslocal_address () const noexcept=0
 Get the address of the local endpoint.
IConnectionoperator= (const IConnection &)=delete
IConnectionoperator= (IConnection &&)=delete
virtual const addresses::IAddressremote_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.

Detailed Description

Interface of connections.

Definition at line 34 of file i_connection.h.

Member Typedef Documentation

◆ ConnectionClosedCallback

Type of callback functions called when a connection is closed.

Parameters:

  1. Status object specifying the reason.

Definition at line 59 of file i_connection.h.

◆ MessageReceivedCallback

Initial value:
std::function<void(messages::ParsedMessage)>
std::variant< ParsedRequest, ParsedResponse, ParsedNotification > ParsedMessage
Type of parsed messages.

Type of callback functions called when a message is received.

Parameters:

  1. Received message.

Definition at line 43 of file i_connection.h.

◆ MessageSentCallback

Type of callback functions called when a message is successfully sent.

Definition at line 50 of file i_connection.h.

Member Function Documentation

◆ async_close()

◆ async_send()

virtual void msgpack_rpc::transport::IConnection::async_send ( const messages::SerializedMessage & message)
pure virtual

◆ local_address()

virtual const addresses::IAddress & msgpack_rpc::transport::IConnection::local_address ( ) const
nodiscardpure virtualnoexcept

◆ remote_address()

virtual const addresses::IAddress & msgpack_rpc::transport::IConnection::remote_address ( ) const
nodiscardpure virtualnoexcept

◆ start()

virtual void msgpack_rpc::transport::IConnection::start ( MessageReceivedCallback on_received,
MessageSentCallback on_sent,
ConnectionClosedCallback on_closed )
pure virtual

Start process of this connection.

Parameters
[in]on_receivedCallback function called when a message is received.
[in]on_sentCallback function called when a message is sent.
[in]on_closedCallback 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 >.


The documentation for this class was generated from the following file: