KasperskyOS Community Edition 1.3

net2_with_separate_vfs example

This example demonstrates the special features of a solution in which a program uses standard POSIX functions to interact with an external server.

The net2_with_separate_vfs example is a modified net_with_separate_vfs example. In contrast to the net_with_separate_vfs example, in this example a program interacts over the network with an external server rather than another program running in KasperskyOS.

This example consists of the Client program running in KasperskyOS on QEMU or Raspberry Pi and the Server program running in a Linux host operating system. The Client program and Server program are bound by a TCP socket. Standard POSIX functions are used in the code of the Client program.

To connect the Client program and the Server program using a socket, the Client program must interact with the VfsNet program. During the build, the VfsNet program is linked to a network driver that supports interaction with the Server program running in Linux.

Example files

The code of the example and build scripts are available at the following path:

/opt/KasperskyOS-Community-Edition-<version>/examples/net2_with_separate_vfs

The IP address of the Server program is defined in the ./CMakeList.txt file by using the SERVER_IP variable and is set to 10.0.2.2 by default. The default values for the Client program (interface name, address, network mask, and gateway address) are taken from the file /opt/KasperskyOS-Community-Edition-<version>/sysroot-aarch64-kos/include/kos_net.h. You can change these values according to the configuration of your network in the client/src/client.c file located in the example directory.

Building and running the example

The CMake system, which is included with KasperskyOS Community Edition, is used to build and run the example. See Building and running examples section.

To ensure that an example runs correctly, you must run the Server program in a Linux host operating system or on a computer connected to Raspberry Pi.

If the example is run in QEMU, the Server program will be built and run in the Linux host operating system automatically by the cross-build.sh script. After performing the build, the server executable file of the Server program is located in the following directory:

/opt/KasperskyOS-Community-Edition-<version>/examples/net2_with_separate_vfs/build/host/server/

If the example is run on Raspberry Pi, you must independently build the executable file of the Server program by running the following commands:

$ cd net2_with_separate_vfs/server/src/ $ gcc -o server server.c