Client side handler for P2P client connections. More...
#include <p2pclient.hpp>
Classes | |
class | NetworkListenerRegistration |
Class to facade a network listener client and message dispatching. More... | |
class | RoutingHandler |
Map a stringular identifier (that being a service session or potentially a runtime data subscription or whatever) More... | |
Public Types | |
typedef function< void(P2PClient::NetworkListenerRegistration *, bool) | ConnectionStateChangedFunctionType) |
typedef shared_ptr< void > | ConnectionStateSubscriptionToken |
typedef shared_ptr< NetworkListenerRegistration > | NetworkListenerRegistrationSharedPtr |
typedef shared_ptr< RoutingHandler > | RoutingHandlerSharedPtr |
Public Member Functions | |
void | addRoutingHandler (RoutingHandlerSharedPtr handler, const char *context="", bool runtimeDataOnly=false) |
Installs a routing handler. | |
ConnectionStateSubscriptionToken | addStateChangeSubscription (ConnectionStateChangedFunctionType callback) |
Register a state change callback. | |
void | disconnectAll () |
Disconnects unconditionally all existing connections. | |
ClientSharedPtr | getClient () const |
Retrieve a client object bound to this P2P client instance. | |
NetworkListenerRegistrationSharedPtr | getRuntimeDataNetworkListener (AbstractSessionSharedPtr session) |
Gets network listener that is bound to this specific session. | |
P2PClient (ClientSharedPtr client) | |
Constructor. | |
void | removeRoutingHandler (AbstractSessionSharedPtr session, const char *context="") |
Remove existing routing handler. | |
void | removeStateChangeSubscription (ConnectionStateSubscriptionToken token) |
Unregisters a state change callback. | |
void | work () |
To be invoked when required from the application main thread context. | |
~P2PClient () | |
Destructor. | |
![]() | |
virtual | ~ConnectionAdapterProvider () |
Client side handler for P2P client connections.
typedef function<void(P2PClient::NetworkListenerRegistration*, bool) kanzi::connect::p2p::P2PClient::ConnectionStateChangedFunctionType) |
typedef shared_ptr<void> kanzi::connect::p2p::P2PClient::ConnectionStateSubscriptionToken |
typedef shared_ptr<NetworkListenerRegistration> kanzi::connect::p2p::P2PClient::NetworkListenerRegistrationSharedPtr |
typedef shared_ptr<RoutingHandler> kanzi::connect::p2p::P2PClient::RoutingHandlerSharedPtr |
|
explicit |
Constructor.
client | client instance this P2P connection adapter is bound to |
kanzi::connect::p2p::P2PClient::~P2PClient | ( | ) |
Destructor.
void kanzi::connect::p2p::P2PClient::addRoutingHandler | ( | RoutingHandlerSharedPtr | handler, |
const char * | context = "", | ||
bool | runtimeDataOnly = false ) |
Installs a routing handler.
handler | the routing handler to install |
context | installation context for debug purposes. |
runtimeDataOnly | if true, then route is handled only for runtimedata |
ConnectionStateSubscriptionToken kanzi::connect::p2p::P2PClient::addStateChangeSubscription | ( | ConnectionStateChangedFunctionType | callback | ) |
Register a state change callback.
callback | the function to register |
void kanzi::connect::p2p::P2PClient::disconnectAll | ( | ) |
Disconnects unconditionally all existing connections.
ClientSharedPtr kanzi::connect::p2p::P2PClient::getClient | ( | ) | const |
Retrieve a client object bound to this P2P client instance.
NetworkListenerRegistrationSharedPtr kanzi::connect::p2p::P2PClient::getRuntimeDataNetworkListener | ( | AbstractSessionSharedPtr | session | ) |
Gets network listener that is bound to this specific session.
session | the session where the listener is bound to |
void kanzi::connect::p2p::P2PClient::removeRoutingHandler | ( | AbstractSessionSharedPtr | session, |
const char * | context = "" ) |
Remove existing routing handler.
session | the kanzi connect session bound to routing handler that need to be removed |
context | removal context for debug purposes. |
void kanzi::connect::p2p::P2PClient::removeStateChangeSubscription | ( | ConnectionStateSubscriptionToken | token | ) |
Unregisters a state change callback.
token | the registration token to unregister. |
void kanzi::connect::p2p::P2PClient::work | ( | ) |
To be invoked when required from the application main thread context.
purges incoming messages.