ConnectDomain

class kanzi::connect::ConnectDomain

Domain definition for Kanzi Connect.

Public Functions

~ConnectDomain()
void cancelTimer(int64_t handle)

Cancel running timer.

Parameters

handle – timer identifier.

ClientRemoteServiceHostInterface *getClientRemoteServiceHostInterface() const

Retrieve remote service host interface.

Returns

pointer to remote service host interface. nullptr if run in context where its not available.

ModuleSharedPtr getModule(const string &name)

Lookup module by name.

Parameters

name – the name of the module

Returns

shared pointer to module with the name

ObjectFactory *getObjectFactory() const

Retrieve object factory instance.

Returns

pointer to object factory. ownership not transfered.

PolicyContextInterface *getPolicyContext()

Return the policy context object.

Returns

pointer to policy context. ownership not transfered.

SecurityContextInterface *getSecurityContext()

Return the security context object.

Returns

pointer to security context. ownership not transfered.

ServerConfig *getServerConfig()

Get server configuration handler.

Returns

pointer to server configuration. ownership not transfered.

ServerState *getServerState()

Get server state handler.

Returns

pointer to server state. ownership not transfered.

LocalServiceDiscoveryInterface *getServiceLookup() const

Retrieve the interface used to perform service lookup.

Returns

pointer to functionality that can be used to discover service within the local system.

bool loadModule(const string &modulename)

Loads a dynamic module from library.

Parameters

modulename – base for library name. No extension (libXXX.so, .dll) allowed..

Returns

true if successfully loaded, false if some error determined.

template<class _TModuleType>
inline bool registerModule(const string &name)

Template method to register a typed module into the system.

Parameters

name – the name of the module to register

Returns

true if registration successful, false on error.

void setClientRemoteServiceHostInterface(ClientRemoteServiceHostInterface &rshInterface)

Configure remoteservicehost interface.

Parameters

rshInterface – the interface to register.

void setServiceLookupInterface(LocalServiceDiscoveryInterface *lookupInterface)

Configure service lookup interface.

Parameters

lookupInterface – the service lookup interface.

int64_t setTimer(int ms, ConnectWorkItem::Executor executable)

Schedules an executable object to be run in future.

Execution conext for the executable is such that it is allowed to use any kanzi connect API’s from it.

Parameters
  • ms – timeout after which the executable is launched. Passing <= 0 indicates that object should be executed as soon as possible.

  • executable – executable object that is to be invoked.

Returns

handle to timer. This handle is valid (valid if != 0) if timeout is provided and can be used to cancel the object later on.

domain->setTimer(0, [](){ printf("Hey!\n"); });

void setWorkDispatcher(WorkQueueInterface *dispatcher)

Configure work item dispatcher to the domain.

Parameters

dispatcher – work item dispatcher.

Public Static Functions

static ConnectDomain *create()

Creates a default domain instance without configuration file.

This creates a stub server without any services or outgoing bearers so not much functional

Returns

newly allocated connect domain

static ConnectDomain *create(const string configurationFile)

Creates an instance of connect domain.

Parameters

configurationFile – the configuration file for server.

Returns

connect domain instance.

static ConnectDomain *create(FileSet &fileset)

Creates an instance of connect domain.

Parameters

fileset – set of configuration files passed during the construction

Returns

connect domain instance.

static ConnectDomain *createForClient(const string configurationFile = string())

Creates a reduced connect domain object to be used on client side.

Parameters

configurationFile – optional configuration filename to be used to initialize for example policy functionality.

Returns

newly allocation connect domain instance.