p2p::P2PServer¶
-
class
kanzi::connect::p2p::P2PServer: public NetworkListener::Observer, public enable_shared_from_this<P2PServer>¶ Peer to Peer server functionality.
Public Functions
Constructor.
- Parameters
cim: client identity managerreliableBearer: the default bearer for reliable communicationunreliableBearer: the default bearer for unreliable communicationdomain: server side connect domainservice: the service bound to this P2P functionalitydataProvider: runtime data provider.
-
~P2PServer()¶ Destructor.
-
void
disconnectAll()¶ Disconnects all connected peers.
-
void
enableVerboseLogging(bool enable)¶ Controls verbose logging.
- Parameters
enable: enables the verbose logging.
-
void
flushPendingProviders()¶ Refresh updates pending for transfer credits.
-
ClientIdManager &
getClientIdManager() const¶ Retrieve client id manager functionality.
- Return
client id manager instance.
-
ConnectDomainSharedPtr
getConnectDomain() const¶ Retrieve connect domain.
- Return
connect domain pointer, ownership not transfered.
-
string
getDiagnosticsCounters(vector<DiagnosticsObject> &objects)¶ Will fill the provided array with known diagnostics variables.
- Return
the textual identifier (effectively a service name) to which entity the measurements belong into.
- Parameters
objects: vector to be filled with diagnostics objects.
-
vector<EndpointSharedPtr>
getEndpoints()¶ Gets all the endpoints this P2PServer has configured.
- Return
vector of endpoint definitions
-
RoutingRulesSharedPtr
getRoutingRules()¶ Retrieve routing rules for the bound service.
- Return
routing rules bound to this server.
-
bool
initialize(RoutingRules &rr, ConnectionAdapter::Parameters SSLParameters = ConnectionAdapter::Parameters())¶ Initialize and instantiate all required connection adapters.
- Return
true if succeeded and operational. false otherwise.
- Parameters
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)
-
void
registerMessageFilter(messagefilter::ServiceMessageFilterHandler handler)¶ Register a message filter callback that is invoked for each and every incoming message.
- Parameters
handler: the handler to be invoked.
-
void
reportServiceRuntimeData(const string &interfaceId, const string &path, const string &stream)¶ Invoked when-ever the runtime data of the hosted remote service changes.
- Parameters
interfaceId: the interface whom data got changedpath: the path that got changed.stream: the serialized runtimedata stream.
Sets the domain to be used.
- Parameters
domain: the domain
-
bool
transmit(size_t clientId, const MessagePackage &message)¶ Transmits a provided message to specified client.
- Parameters
clientId: the client to dispatch the message tomessage: the message to dispatch
-
bool
tryTransmitDirectly(const MessagePackage &message)¶ Try transmit message directly to peers shall there be a route(s) for such.
- Return
true if message got sent, false if should be dispatched further.
- Parameters
message: the message to send