To implement a client program that calls a method of an endpoint provided by a server program:
*.edl.cpp.h
) of the client program description.*.idl.cpp.h
)./opt/KasperskyOS-Community-Edition-<version>/sysroot-*-kos/include/kosipc/application.h
/opt/KasperskyOS-Community-Edition-<version>/sysroot-*-kos/include/kosipc/api.h
/opt/KasperskyOS-Community-Edition-<version>/sysroot-*-kos/include/kosipc/connect_static_channel.h
kosipc::MakeApplicationAutodetect()
function. (You can also use the kosipc::MakeApplication()
and kosipc::MakeApplicationPureClient()
functions.)riid
) by calling the kosipc::ConnectStaticChannel()
function.This function gets the name of the IPC channel (from the init.yaml file) and the qualified name of the endpoint (from the CDL and EDL descriptions of the solution component).
MakeProxy()
function.Example
// Create and initialize the application object
kosipc::Application app = kosipc::MakeApplicationAutodetect();
// Create and initialize the proxy object
auto proxy = app.MakeProxy<IDLInterface>(
kosipc::ConnectStaticChannel(channelName, endpointName))
// Call the method of the required endpoint
proxy->DoSomeWork();
To implement a server program that provides endpoints to other programs:
*.edl.cpp.h
containing a description of the component structure of the program, including all provided endpoints./opt/KasperskyOS-Community-Edition-<version>/sysroot-*-kos/include/kosipc/event_loop.h
/opt/KasperskyOS-Community-Edition-<version>/sysroot-*-kos/include/kosipc/api.h
/opt/KasperskyOS-Community-Edition-<version>/sysroot-*-kos/include/kosipc/serve_static_channel.h
kosipc::MakeApplicationAutodetect()
function.kosipc::components::Root
structure, which describes the component structure of the program and describes the interfaces of all endpoints provided by the program.kosipc::components::Root
structure to the objects that implement the corresponding endpoints.Fields of the Root
structure replicate the hierarchy of components and endpoints that are collectively defined by the CDL and EDL files.
ServeStaticChannel()
function.This function gets the name of the IPC channel (from the init.yaml file) and the structure created at step 5.
kosipc::EventLoop
object by calling the MakeEventLoop()
function.Run()
method of the kosipc::EventLoop
object.Example
// Create class objects that implement interfaces
// provided by the server as endpoints
MyIDLInterfaceImp_1 impl_1;
MyIDLInterfaceImp_2 impl_2;
// Create and initialize the application object
kosipc::Application app = kosipc::MakeApplicationAutodetect();
// Create and initialize the root object that describes
// the components and endpoints of the server
kosipc::components::Root root;
// Bind the root object to the class objects that implement the server endpoints
root.component1.endpoint1 = &impl_1;
root.component2.endpoint2 = &impl_2;
// Create and initialize the object that implements the
// loop for dispatching incoming IPC messages
kosipc::EventLoop loop = app.MakeEventLoop(ServeStaticChannel(channelName, root));
// Start the loop in the current thread
loop.Run();
Page top