Kanzi Connect  1.1.10
Kanzi Connect C++ API
kanzi::connect::p2p::P2PClient Class Reference

Client side handler for P2P client connections. More...

#include <p2pclient.hpp>

Inheritance diagram for kanzi::connect::p2p::P2PClient:
kanzi::connect::ConnectionAdapterProvider

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< NetworkListenerRegistrationNetworkListenerRegistrationSharedPtr
 
typedef shared_ptr< RoutingHandlerRoutingHandlerSharedPtr
 

Public Member Functions

void addRoutingHandler (RoutingHandlerSharedPtr handler, const char *context="", bool runtimeDataOnly=false)
 Installs a routing handler. More...
 
ConnectionStateSubscriptionToken addStateChangeSubscription (ConnectionStateChangedFunctionType callback)
 Register a state change callback. More...
 
void disconnectAll ()
 Disconnects unconditionally all existing connections. More...
 
ClientSharedPtr getClient () const
 Retrieve a client object bound to this P2P client instance. More...
 
NetworkListenerRegistrationSharedPtr getRuntimeDataNetworkListener (AbstractSessionSharedPtr session)
 Gets network listener that is bound to this specific session. More...
 
 P2PClient (ClientSharedPtr client)
 Constructor. More...
 
void removeRoutingHandler (AbstractSessionSharedPtr session, const char *context="")
 Remove existing routing handler. More...
 
void removeStateChangeSubscription (ConnectionStateSubscriptionToken token)
 Unregisters a state change callback. More...
 
void work ()
 To be invoked when required from the application main thread context. More...
 
 ~P2PClient ()
 Destructor. More...
 
- Public Member Functions inherited from kanzi::connect::ConnectionAdapterProvider
virtual ~ConnectionAdapterProvider ()
 

Detailed Description

Client side handler for P2P client connections.

Member Typedef Documentation

◆ ConnectionStateChangedFunctionType

◆ ConnectionStateSubscriptionToken

◆ NetworkListenerRegistrationSharedPtr

◆ RoutingHandlerSharedPtr

Constructor & Destructor Documentation

◆ P2PClient()

kanzi::connect::p2p::P2PClient::P2PClient ( ClientSharedPtr  client)
explicit

Constructor.

Parameters
clientclient instance this P2P connection adapter is bound to

◆ ~P2PClient()

kanzi::connect::p2p::P2PClient::~P2PClient ( )

Destructor.

Member Function Documentation

◆ addRoutingHandler()

void kanzi::connect::p2p::P2PClient::addRoutingHandler ( RoutingHandlerSharedPtr  handler,
const char *  context = "",
bool  runtimeDataOnly = false 
)

Installs a routing handler.

Parameters
handlerthe routing handler to install
contextinstallation context for debug purposes.
runtimeDataOnlyif true, then route is handled only for runtimedata

◆ addStateChangeSubscription()

ConnectionStateSubscriptionToken kanzi::connect::p2p::P2PClient::addStateChangeSubscription ( ConnectionStateChangedFunctionType  callback)

Register a state change callback.

Parameters
callbackthe function to register
Returns
subscription handle that can be used to unregister.

◆ disconnectAll()

void kanzi::connect::p2p::P2PClient::disconnectAll ( )

Disconnects unconditionally all existing connections.

◆ getClient()

ClientSharedPtr kanzi::connect::p2p::P2PClient::getClient ( ) const

Retrieve a client object bound to this P2P client instance.

Returns
Pointer to client instance. ownership not transfered.

◆ getRuntimeDataNetworkListener()

NetworkListenerRegistrationSharedPtr kanzi::connect::p2p::P2PClient::getRuntimeDataNetworkListener ( AbstractSessionSharedPtr  session)

Gets network listener that is bound to this specific session.

Parameters
sessionthe session where the listener is bound to
Returns
network registration object or empty

◆ removeRoutingHandler()

void kanzi::connect::p2p::P2PClient::removeRoutingHandler ( AbstractSessionSharedPtr  session,
const char *  context = "" 
)

Remove existing routing handler.

Parameters
sessionthe kanzi connect session bound to routing handler that need to be removed
contextremoval context for debug purposes.

◆ removeStateChangeSubscription()

void kanzi::connect::p2p::P2PClient::removeStateChangeSubscription ( ConnectionStateSubscriptionToken  token)

Unregisters a state change callback.

Parameters
tokenthe registration token to unregister.

◆ work()

void kanzi::connect::p2p::P2PClient::work ( )

To be invoked when required from the application main thread context.

purges incoming messages.


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