Kanzi Connect  3.9.8
Kanzi Connect C++ API
kanzi::connect::ConnectionManager Class Reference

A service class to manage clients on server side. Implements Connection Interface on server. More...

#include <connection_manager.hpp>

Inheritance diagram for kanzi::connect::ConnectionManager:
kanzi::connect::NetworkListener::Observer kanzi::connect::ConnectionManagerMessageHookInterface

Classes

class  Observer
 Observer for client connections. More...
 

Public Types

typedef map< int, ConnectedClientSharedPtrClientContainer
 Container for connected clients. More...
 
- Public Types inherited from kanzi::connect::ConnectionManagerMessageHookInterface
enum  MessageDirection { Incoming, Outgoing }
 

Public Member Functions

void addMessageHook (ConnectionManagerMessageHookInterface *messageInterface)
 Installs new message hook processor. More...
 
void addObserver (Observer *observer)
 Adds observer to listen for notifications on this service. More...
 
ClientContainer::const_iterator beginClients () const
 Return iterator to container for all connected clients (begin). More...
 
 ConnectionManager (ConnectDomainSharedPtr connectDomain, IncomingMessageInterface *messageRouterInterface, DiagnosticsManagerSharedPtr diagManager, ConnectionAdapterObjectFactorySharedPtr objectFactory=ConnectionAdapterObjectFactorySharedPtr())
 Constructor. More...
 
ClientContainer::const_iterator endClients () const
 Return iterator to container for all connected clients (end). More...
 
ClientIdManagergetClientIdManager ()
 Retrieve the client id manager class. More...
 
ConnectionAdaptergetConnectionAdapter (const int clientId) const
 Find the connection adapter that handles the connection for the given client. More...
 
ConnectionAdapterObjectFactorySharedPtr getConnectionAdapterObjectFactory ()
 Retrieve the Connection adapter factory. More...
 
NetworkListenerSharedPtr getNetworkListener (const int clientId) const
 Find the network listener that handlers the particular client. More...
 
void initialize (InterfaceDomainBase *domain, ContentClientSharedPtr contentClient, WorkQueueInterface *workQueue) override
 See AbstractService::initialize. More...
 
AbstractSessionSharedPtr onAcquireSession (int clientId, int sessionId, MessageDispatcher *dispatcher, const string &instanceName) override
 See AbstractService::onAcquireSession. More...
 
void removeMessageHook (ConnectionManagerMessageHookInterface *messageInterface)
 Removes existing message hook processor. More...
 
void removeObserver (Observer *observer)
 Remove observer to stop listening for notifications on this service. More...
 
void setHttpServer (shared_ptr< CivetServer > httpServer)
 Set HTTP server to handle HTTP requests. More...
 
void uninitialize () override
 See AbstractService::uninitialize. More...
 
 ~ConnectionManager () override
 Destructor. More...
 

Protected Member Functions

AbstractService::ServiceControlResult onResetServiceRequest (ServiceArgumentsSharedPtr arguments) override
 
int ping (const int &timeout) override
 This interface is not intended to be called directly, but using a message filter to complete it truly asynchronously. More...
 

Detailed Description

A service class to manage clients on server side. Implements Connection Interface on server.

Member Typedef Documentation

◆ ClientContainer

Container for connected clients.

Constructor & Destructor Documentation

◆ ConnectionManager()

kanzi::connect::ConnectionManager::ConnectionManager ( ConnectDomainSharedPtr  connectDomain,
IncomingMessageInterface messageRouterInterface,
DiagnosticsManagerSharedPtr  diagManager,
ConnectionAdapterObjectFactorySharedPtr  objectFactory = ConnectionAdapterObjectFactorySharedPtr() 
)

Constructor.

Parameters
connectDomainThe connect domain.
messageRouterInterfaceInterface to object that will handle incoming messages.
diagManagerThe diagnostics manager, used to deliver diagnostics related data.
objectFactoryFactory interface to create connection adapters.

◆ ~ConnectionManager()

kanzi::connect::ConnectionManager::~ConnectionManager ( )
override

Destructor.

Member Function Documentation

◆ addMessageHook()

void kanzi::connect::ConnectionManager::addMessageHook ( ConnectionManagerMessageHookInterface messageInterface)

Installs new message hook processor.

Parameters
messageInterfacethe message interface

◆ addObserver()

void kanzi::connect::ConnectionManager::addObserver ( Observer observer)

Adds observer to listen for notifications on this service.

Parameters
observerObserver to add.

◆ beginClients()

ClientContainer::const_iterator kanzi::connect::ConnectionManager::beginClients ( ) const

Return iterator to container for all connected clients (begin).

Returns
Iterator that points the beginning of the container.

◆ endClients()

ClientContainer::const_iterator kanzi::connect::ConnectionManager::endClients ( ) const

Return iterator to container for all connected clients (end).

Returns
Iterator that points the end of the container.

◆ getClientIdManager()

ClientIdManager& kanzi::connect::ConnectionManager::getClientIdManager ( )

Retrieve the client id manager class.

Returns
reference to ClientIdManager instance.

◆ getConnectionAdapter()

ConnectionAdapter* kanzi::connect::ConnectionManager::getConnectionAdapter ( const int  clientId) const

Find the connection adapter that handles the connection for the given client.

Parameters
clientIdIdentifies the client
Returns
Pointer to the connection adapter, null pointer if not found

◆ getConnectionAdapterObjectFactory()

ConnectionAdapterObjectFactorySharedPtr kanzi::connect::ConnectionManager::getConnectionAdapterObjectFactory ( )
inline

Retrieve the Connection adapter factory.

◆ getNetworkListener()

NetworkListenerSharedPtr kanzi::connect::ConnectionManager::getNetworkListener ( const int  clientId) const

Find the network listener that handlers the particular client.

Parameters
clientIdthe client identifier
Returns
shared pointer to network listener object

◆ initialize()

void kanzi::connect::ConnectionManager::initialize ( InterfaceDomainBase domain,
ContentClientSharedPtr  contentClient,
WorkQueueInterface workQueue 
)
override

◆ onAcquireSession()

AbstractSessionSharedPtr kanzi::connect::ConnectionManager::onAcquireSession ( int  clientId,
int  sessionId,
MessageDispatcher dispatcher,
const string &  instanceName 
)
override

◆ onResetServiceRequest()

AbstractService::ServiceControlResult kanzi::connect::ConnectionManager::onResetServiceRequest ( ServiceArgumentsSharedPtr  arguments)
overrideprotected

◆ ping()

int kanzi::connect::ConnectionManager::ping ( const int &  timeout)
inlineoverrideprotected

This interface is not intended to be called directly, but using a message filter to complete it truly asynchronously.

Parameters
timeoutnot used, returned.
Returns
return the given timeout value.

◆ removeMessageHook()

void kanzi::connect::ConnectionManager::removeMessageHook ( ConnectionManagerMessageHookInterface messageInterface)

Removes existing message hook processor.

Parameters
messageInterfacethe message interface

◆ removeObserver()

void kanzi::connect::ConnectionManager::removeObserver ( Observer observer)

Remove observer to stop listening for notifications on this service.

Parameters
observerObserver to remove.

◆ setHttpServer()

void kanzi::connect::ConnectionManager::setHttpServer ( shared_ptr< CivetServer >  httpServer)

Set HTTP server to handle HTTP requests.

Parameters
httpServerHTTP server to handle HTTP requests.

◆ uninitialize()

void kanzi::connect::ConnectionManager::uninitialize ( )
override

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