KasperskyOS Community Edition 1.0

init.yaml file

The init.yaml file (init description) is used by the einit tool to generate source code of the Einit initializing entity. This file contains data in YAML format. This data identifies the following:

  • Entities that are started when KasperskyOS is loaded.
  • IPC channels that are used by entities to interact with each other.

This data consists of a dictionary with the entities key containing a list of dictionaries of entities. Entity dictionary keys are presented in the table below.

Entity dictionary keys in an init description

Key

Required

Description

name

Yes

Name of the entity

task

No

Entity ID, which coincides with the entity name by default. Each entity must have a unique ID.

You can start multiple entities with the same name but different IDs.

path

No

Name of the executable file in ROMFS (in the solution image) from which the entity will be started. By default, the entity will be started from a file in ROMFS with a name that matches the short name of the entity. For example, the Client and net.Client entities will be started from the Client file by default.

You can start multiple entities with the same name from different executable files. However, the IDs of these entities must be different.

connections

No

Dictionary key containing a list of dictionaries of the IPC channels of the entity. This list defines the statically created IPC channels whose client handles will be owned by the entity. The list is empty by default. (In addition to statically created IPC channels, entities may use dynamically created IPC channels.)

Entity IPC channel dictionary keys are presented in the table below.

Entity IPC channel dictionary keys in an init description

Key

Required

Description

id

Yes

IPC channel ID, which can be defined as a specific value or as a link such as

{var: <constant name>, include: <path to header file>}.

Each IPC channel must have a unique ID.

(The IPC channel ID is used by entities to receive an IPC handle.)

target

Yes

ID of the entity that will own the server handle of the IPC channel.

Example init descriptions

In the provided examples, the file containing the init description is named init.yaml, but it can have any name.

init.yaml

# init description of the solution containing the client entity and server entity

entities:

# The Client entity will send requests to the Server entity.

- name: Client

connections:

# ID of the server entity to which the Client entity will

# send requests

- target: Server

# ID of the IPC channel for exchanging IPC messages

# between entities

id: server_connection

# The Server entity will perform the server role

# (will respond to requests from the Client entity).

- name: Server

init.yaml

# init description in which the IPC channel ID is defined by a link

entities:

- name: Client

connections:

- target: Server

# IPC channel ID is in the SERVER_CONN constant

# in the src/example.h file

id: {var: SERVER_CONN, include: src/example.h}

- name: Server

init.yaml

# init description that defines the names of executable files that

# will be used to start the entities named Client, ClientServer and

# MainServer

entities:

- name: Client

path: cl

connections:

- target: ClientServer

id: server_connection_cs

- name: ClientServer

path: csr

connections:

- target: MainServer

id: server_connection_ms

- name: MainServer

path: msr

init.yaml

# init description in which the MainServer and BkServer entities

# will be started from one executable file

entities:

- name: Client

connections:

- id: server_connection_ms

target: MainServer

- id: server_connection_bs

target: BkServer

- name: MainServer

path: srv

- name: BkServer

path: srv

init.yaml

# init description that will start two

# Server entities with different IDs from the same executable

# file

entities:

- name: Client

connections:

- id: server_connection_us

# Server entity ID

target: UserServer

- id: server_connection_ps

# Server entity ID

target: PrivilegedServer

- task: UserServer

name: Server

- task: PrivilegedServer

name: Server