Peer to Peer server functionality. More...
#include <p2pserver.hpp>
Public Member Functions | |
| void | disconnectAll () |
| Disconnects all connected peers. More... | |
| void | enableVerboseLogging (bool enable) |
| Controls verbose logging. More... | |
| void | flushPendingProviders () |
| Refresh updates pending for transfer credits. More... | |
| ClientIdManager & | getClientIdManager () const |
| Retrieve client id manager functionality. More... | |
| ConnectDomain * | getConnectDomain () const |
| Retrieve connect domain. More... | |
| string | getDiagnosticsCounters (vector< DiagnosticsObject > &objects) |
| Will fill the provided array with known diagnostics variables. More... | |
| vector< EndpointSharedPtr > | getEndpoints () |
| Gets all the endpoints this P2PServer has configured. More... | |
| RoutingRulesSharedPtr | getRoutingRules () |
| Retrieve routing rules for the bound service. More... | |
| bool | initialize (RoutingRules &rr, ConnectionAdapter::Parameters SSLParameters=ConnectionAdapter::Parameters()) |
| Initialize and instantiate all required connection adapters. More... | |
| P2PServer (ClientIdManager &cim, const string &reliableBearer, const string &unreliableBearer, ConnectDomain *domain, AbstractServiceSharedPtr service, RuntimeDataProvider *dataProvider) | |
| Constructor. More... | |
| void | registerMessageFilter (messagefilter::ServiceMessageFilterHandler handler) |
| Register a message filter callback that is invoked for each and every incoming message. More... | |
| void | reportServiceRuntimeData (const string &interfaceId, const string &path, const string &stream) |
| Invoked when-ever the runtime data of the hosted remote service changes. More... | |
| void | setDomain (ConnectDomain *domain) |
| Sets the domain to be used. More... | |
| bool | transmit (size_t clientId, const MessagePackage &message) |
| Transmits a provided message to specified client. More... | |
| bool | tryTransmitDirectly (const MessagePackage &message) |
| Try transmit message directly to peers shall there be a route(s) for such. More... | |
| virtual | ~P2PServer () |
| Destructor. More... | |
Protected Member Functions | |
| virtual void | onConnected (int, NetworkListener *) KZ_OVERRIDE |
| Callback to notify that connection has been established. More... | |
| virtual void | onDisconnected (int, NetworkListener *) KZ_OVERRIDE |
| Callback to notify that connection has been terminated. More... | |
| virtual void | onPacketReceived (int, NetworkListener *) KZ_OVERRIDE |
| Callback to notify that there is incoming data. More... | |
Peer to Peer server functionality.
|
explicit |
Constructor.
| cim | client identity manager |
| reliableBearer | the default bearer for reliable communication |
| unreliableBearer | the default bearer for unreliable communication |
| domain | server side connect domain |
| service | the service bound to this P2P functionality |
| dataProvider | runtime data provider. |
|
virtual |
Destructor.
| void kanzi::connect::p2p::P2PServer::disconnectAll | ( | ) |
Disconnects all connected peers.
| void kanzi::connect::p2p::P2PServer::enableVerboseLogging | ( | bool | enable | ) |
Controls verbose logging.
| enable | enables the verbose logging. |
| void kanzi::connect::p2p::P2PServer::flushPendingProviders | ( | ) |
Refresh updates pending for transfer credits.
| ClientIdManager& kanzi::connect::p2p::P2PServer::getClientIdManager | ( | ) | const |
Retrieve client id manager functionality.
| ConnectDomain* kanzi::connect::p2p::P2PServer::getConnectDomain | ( | ) | const |
Retrieve connect domain.
| string kanzi::connect::p2p::P2PServer::getDiagnosticsCounters | ( | vector< DiagnosticsObject > & | objects | ) |
Will fill the provided array with known diagnostics variables.
| objects | vector to be filled with diagnostics objects. |
| vector<EndpointSharedPtr> kanzi::connect::p2p::P2PServer::getEndpoints | ( | ) |
Gets all the endpoints this P2PServer has configured.
| RoutingRulesSharedPtr kanzi::connect::p2p::P2PServer::getRoutingRules | ( | ) |
Retrieve routing rules for the bound service.
| bool kanzi::connect::p2p::P2PServer::initialize | ( | RoutingRules & | rr, |
| ConnectionAdapter::Parameters | SSLParameters = ConnectionAdapter::Parameters() |
||
| ) |
Initialize and instantiate all required connection adapters.
| rr | routing rules that will be filled with connection endpoints accordingly. |
| SSLParameters | contains SSL parameters to be used with server side functionality. Required only if SSL bearer is to be used. Parameters should be passed with following keys "server_cert" Server certificate "server_pkey" Server private key "client_ca" Client CA certificate. "server_name" server name identitity (optional) |
|
protectedvirtual |
Callback to notify that connection has been established.
| clientId | The id of the connected client. |
| listener | Listener that triggered the notification. |
Reimplemented from kanzi::connect::NetworkListener::Observer.
|
protectedvirtual |
Callback to notify that connection has been terminated.
| clientId | The id of the disconnected client. |
| listener | Listener that triggered the notification. |
Reimplemented from kanzi::connect::NetworkListener::Observer.
|
protectedvirtual |
Callback to notify that there is incoming data.
| clientId | The id of the client that sent data. |
| listener | Listener that triggered the notification. |
Reimplemented from kanzi::connect::NetworkListener::Observer.
| void kanzi::connect::p2p::P2PServer::registerMessageFilter | ( | messagefilter::ServiceMessageFilterHandler | handler | ) |
Register a message filter callback that is invoked for each and every incoming message.
| handler | the handler to be invoked. |
| void kanzi::connect::p2p::P2PServer::reportServiceRuntimeData | ( | const string & | interfaceId, |
| const string & | path, | ||
| const string & | stream | ||
| ) |
Invoked when-ever the runtime data of the hosted remote service changes.
| interfaceId | the interface whom data got changed |
| path | the path that got changed. |
| stream | the serialized runtimedata stream. |
| void kanzi::connect::p2p::P2PServer::setDomain | ( | ConnectDomain * | domain | ) |
Sets the domain to be used.
| domain | the domain |
| bool kanzi::connect::p2p::P2PServer::transmit | ( | size_t | clientId, |
| const MessagePackage & | message | ||
| ) |
Transmits a provided message to specified client.
| clientId | the client to dispatch the message to |
| message | the message to dispatch |
| bool kanzi::connect::p2p::P2PServer::tryTransmitDirectly | ( | const MessagePackage & | message | ) |
Try transmit message directly to peers shall there be a route(s) for such.
| message | the message to send |