The client and server IPC handles must be obtained if there are no ready-to-use transport libraries for the utilized endpoint (for example, if you wrote your own endpoint). To independently work with IPC transport, you need to first initialize it by using the NkKosTransport_Init()
method and pass the IPC handle of the utilized channel as the second argument.
For more details, see the echo and ping examples (/opt/KasperskyOS-Community-Edition-<version>/examples/
).
You do not need to get an IPC handle to utilize endpoints that are implemented in executable files provided in KasperskyOS Community Edition. The provided transport libraries are used to perform all transport operations, including obtaining IPC handles.
See the gpio_*, net_*, net2_* and multi_vfs_* examples (/opt/KasperskyOS-Community-Edition-<version>/examples/
).
Getting an IPC handle when statically creating a channel
When statically creating an IPC channel, both the client and server can obtain their IPC handles immediately after startup by using the ServiceLocatorRegister()
and ServiceLocatorConnect()
methods and specifying the name of the created IPC channel.
For example, if the IPC channel is named server_connection
, the following must be called on the client side:
#include <coresrv/sl/sl_api.h>
…
Handle handle = ServiceLocatorConnect("server_connection");
The following must be called on the server side:
#include <coresrv/sl/sl_api.h>
…
ServiceId id;
Handle handle = ServiceLocatorRegister("server_connection", NULL, 0, &id);
For more details, see the echo and ping examples (/opt/KasperskyOS-Community-Edition-<version>/examples/
), and the header file /opt/KasperskyOS-Community-Edition-<version>/sysroot-aarch64-kos/include/coresrv/sl/sl_api.h
.
Closing an obtained IPC handle will cause the IPC channel to become unavailable. After an IPC handle is closed, it is impossible to obtain it again or restore access to the IPC channel.
Getting an IPC handle when dynamically creating a channel
Both the client and server receive their own IPC handles immediately after dynamic creation of an IPC channel is successful.
The client IPC handle is one of the output (out
) arguments of the KnCmConnect()
method. The server IPC handle is an output argument of the KnCmAccept()
method. For more details, see the header file /opt/KasperskyOS-Community-Edition-<version>/sysroot-aarch64-kos/include/coresrv/cm/cm_api.h
.
If the dynamically created IPC channel is no longer required, its client and server handles should be closed. The IPC channel can be created again if necessary.
Page top