Class Receiver

Inheritance Relationships

Derived Types

Class Documentation

class Receiver

Interface class to any receiver implemented by the network backend.

Subclassed by NetioBufferedReceiver, NetioUnbufferedReceiver

Public Types

using OnMsg = std::function<void(const std::vector<ToFlxMessage>&)>
using OnConnOpen = std::function<void(const std::string&)>
using OnConnClose = std::function<void(const std::string&)>

Public Functions

virtual ~Receiver() = default
virtual bool declare(const std::vector<Elink> &elinks) = 0

advertise e-links services by the receiver.

Parameters:

elinks -- to advertise.

Returns:

whether the operation was succesfull.

virtual void set_conn_open_callback(OnConnOpen callback) = 0

application callback for new connections.

Parameters:

callback -- the std::function<void (std::string &)> to invoked when a new connection is established.

virtual void set_conn_close_callback(OnConnClose callback) = 0

application callback for closed connections.

Parameters:

callback -- the std::function<void (std::string &)> to be invoked when a new connection is closed.

virtual void set_on_msg_callback(OnMsg callback) = 0

application callback for received messages.

Parameters:

callback -- the std::function<void(uint8_t*, size_t)> to invoke when a message is received.

virtual int get_number_of_connections() = 0

Monitor the number of open connetions.

Returns:

the number of open connections.