ExecutionManager component

The ExecutionManager component provides interfaces for managing the lifecycle of processes through IPC mechanisms and lets you do the following:

The ExecutionManager component usage scenario and description are provided in Starting processes using the system program ExecutionManager.

The ExecutionManager component's API is defined in the header files located in the directory sysroot-*-kos/include/component/execution_manager/ from the KasperskyOS Community Edition.

execution_manager_proxy.h interface

The API is defined in the header file sysroot-*-kos/include/component/execution_manager/kos_ipc/execution_manager_proxy.h from the KasperskyOS Community Edition.

The interface contains functions for getting the pointer to the instance of the IExecutionManager interface that is required for working with the ExecutionManager component.

Information about API functions is provided in the table below.

The API provides the following two ways to obtain a pointer to the IExecutionManager interface by connecting to the ExecutionManager process using static methods of the ExecutionManagerConnector object:

Using the cfg input parameter, the CreateExecutionManager() function accepts configuration parameters in the ExecutionManagerConfig structure. All fields of this structure are optional.

struct ExecutionManagerConfig

{

// Name of the IPC channel for connecting to the ExecutionManager process

char const* const mainConnection = KOS_EXECMGR_CONN_MAIN;

// Name of the endpoint that implements the IApplicationController interface

char const* const appControlInterface = KOS_EXECMGR_IFACE_AC;

// Name of the endpoint that implements the IStateProvider interface

char const* const appStateInterface = KOS_EXECMGR_IFACE_AS;

// Name of the endpoint that implements the ISystemController interface

char const* const systemControlInterface = KOS_EXECMGR_IFACE_SC;

// Name of the endpoint that implements the IProcessControl interface

char const* const processControlInterface = KOS_EXECMGR_IFACE_PC;

// ExecutionManager process class name

char const* const execmgrServerName = KOS_EXECMGR_SERVER_NAME;

};

execution_manager_proxy.h functions

Function

Information about the function

StaticConnect()

Purpose

Gets the pointer to an instance of the IExecutionManager interface using a static IPC channel to connect to the ExecutionManager process.

Parameters

  • [in] connName – name of the IPC channel.

Returned values

Pointer to the instance of the IExecutionManager interface.

DcmConnect()

Purpose

Gets the pointer to an instance of the IExecutionManager interface using the system program DCM to connect to the ExecutionManager process.

Parameters

  • [in] timeout – timeout (in milliseconds) for creating a connection to the name server. Default value: 30 sec.

Returned values

Pointer to the instance of the IExecutionManager interface.

CreateExecutionManager()

Purpose

Gets the pointer to the instance of the IExecutionManager interface that is required for working with the ExecutionManager component.

Obsolete function; you are advised to use other functions from this table.

Parameters

  • [in] cfg – ExecutionManagerConfig structure containing the configuration settings for the connection to the ExecutionManager process.
  • [out] emp – pointer to the instance of the IExecutionManager interface.

Returned values

If successful, the function returns kos::rtl::Ok, otherwise it returns an error code.

Usage example:

client.cpp

#include <component/execution_manager/kos_ipc/execution_manager_proxy.h>

int main(int argc, const char *argv[])

{

// ...

execmgr::IExecutionManagerPtr ptr = execution_manager::ipc::ExecutionManagerConnector::DcmConnect();

// ...

}

IExecutionManager interface

The API is defined in the header file sysroot-*-kos/include/component/execution_manager/i_execution_manager.h from the KasperskyOS Community Edition.

The IExecutionManager interface lets you access pointers to the following interfaces:

Usage example:

client.cpp

int main(int argc, const char *argv[])

{

// ...

alm::execution_manager::IProcessControlPtr pc;

res = emPtr->GetProcessController(pc);

if (res != kos::Ok)

{

std::cerr << fmt::format("[{}] Failed to create process controller. res=0x{:x}\n", selfName, res);

return EXIT_FAILURE;

}

execmgr::IApplicationControllerPtr ac;

if (ptr->GetApplicationController(ac) != kos::Ok)

{

std::cerr << "Cannot get application controller" << std::endl;

return EXIT_FAILURE;

}

execmgr::ISystemControllerPtr sc;

if (ptr->GetSystemController(sc) != kos::Ok)

{

std::cerr << "Cannot get system controller" << std::endl;

return EXIT_FAILURE;

}

// ...

}

Page top