The API is defined in the header files located in the directory sysroot-*-kos/include/component/execution_manager/
from the KasperskyOS SDK.
The ExecutionManager component usage scenario is described in the article titled Starting a processes using the ExecutionManager system program.
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 SDK.
The interface contains the CreateExecutionManager()
function for getting the pointer to the instance of the IExecutionManager
interface that is required for working with the ExecutionManager component. Using the cfg
input parameter, this 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 |
---|---|
|
Purpose Gets the pointer to the instance of the Parameters
Returned values If successful, the function returns |
Usage example:
client.cpp
#include <component/execution_manager/kos_ipc/execution_manager_proxy.h>
int main(int argc, const char *argv[])
{
// ...
execution_manager::ipc::ExecutionManagerConfig emCfg
{
// Name of the IPC channel for connecting to the ExecutionManager process.
// It must match the MAIN_CONN_NAME value in the
// CMakeLists.txt file for building the ExecutionManager component.
.mainConnection = "ExecMgrEntity",
// ExecutionManager process class name.
.execmgrServerName = "kl.ExecMgrEntity"
};
execution_manager::IExecutionManagerPtr emPtr;
kos::Result res = CreateExecutionManager(emCfg, emPtr);
if (res != kos::Ok)
{
std::cerr << fmt::format("[{}] Failed to create execution manager. res=0x{:x}\n", selfName, res);
return EXIT_FAILURE;
}
// ...
}
IExecutionManager interface
The API is defined in the header file sysroot-*-kos/include/component/execution_manager/i_execution_manager.h
from the KasperskyOS SDK.
The IExecutionManager
interface lets you access pointers to the following interfaces:
IProcessControl
– interface that lets you start a process from an executable file installed by the PackageManager component from the KPA package in a KasperskyOS-based solution, and lets you receive information about the process (including information about its completion) and stop this process.IApplicationController
– interface that lets you start a process from any executable file whose location in the file system is known, and lets you stop this process.IStateProvider
– interface for receiving information about a process that was started using the IApplicationController
interface.ISystemController
– interface for managing the system.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;
}
// ...
}