KasperskyOS Community Edition 1.3

PackageManager component

The API is defined in the header files located in the directory sysroot-*-kos/include/component/package_manager/ from the KasperskyOS SDK.

The PackageManager component usage scenario is described in the article titled PackageManager component usage scenario.

The package_manager_proxy.h interface

This API is defined in the header file sysroot-*-kos/include/component/package_manager/kos_ipc/package_manager_proxy.h from the KasperskyOS SDK.

The interface contains function CreatePackageManager() for getting the pointer to the instance of the IPackageManager interface that is required for working with the PackageManager component. Using the cfg input parameter, this function accepts configuration parameters in the PackageManagerConfig structure. All fields of this structure are optional.

struct PackageManagerConfig { // Name of the IPC channel for connecting to the PackageManager process. std::string const mainConnection = KOS_PKGMGR_CONN_MAIN; // Name of the endpoint that implements the IPackageController interface. std::string const pkgControlInterface = KOS_PKGMGR_IFACE_PKGC; // PackageManager process class name. std::string const pkgMgrServerName = KOS_PKGMGR_SERVER_NAME; };

package_manager_proxy.h functions

Function

Information about the function

CreatePackageManager()

Purpose

Gets the pointer to the instance of the IPackageManager interface that is required for working with the PackageManager component.

Parameters

  • [in] cfg, PackageManagerConfig structure containing the configuration settings for the connection to the PackageManager process.
  • [out] iPkgMgr – pointer to the instance of the IPackageManager interface.

Returned values

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

Usage example:

client.cpp

#include <component/package_manager/kos_ipc/package_manager_proxy.h> namespace pkgmgr = package_manager; int main(int argc, const char *argv[]) { // ... pkgmgr::IPackageManagerPtr iPkgMgr; std::string mainConnection{"PkgMgrEntity"}; std::string pkgControlInterface{"kl.package_manager.PackageManager.ipkgc"}; pkgmgr::ipc::PackageManagerConfig cfg{mainConnection, pkgControlInterface}; if (CreatePackageManager(cfg, iPkgMgr) != kos::rtl::Ok) return EXIT_FAILURE; // ... }

IPackageManager interface

The API is defined in the header file sysroot-*-kos/include/component/package_manager/i_package_manager.h from the KasperskyOS SDK.

The IPackageManager interface lets you receive the pointer to the IPackageController interface. This interface is intended for installing KPA packages to a KasperskyOS-based solution, and gets information about these packages.

i_package_manager.h functions

Function

Information about the function

GetPackageController()

Purpose

Gets the pointer to an instance of the IPackageController interface.

Parameters

  • [out] pkgController – pointer to the instance of the IPackageController interface.

Returned values

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

Usage example:

client.cpp

int main(int argc, const char *argv[]) { // ... pkgmgr::IPackageControllerPtr pkgc; if (iPkgMgr->GetPackageController(pkgc) != kos::rtl::Ok) return EXIT_FAILURE; // ... }

In this section

IPackageController interface

IPackageManifest interface