KasperskyOS Community Edition 1.1
[Topic libkos_ns_cm]

KnCmAccept()

This function is declared in the coresrv/cm/cm_api.h file.

Retcode KnCmAccept(const char *client, const char *service, rtl_uint32_t rsid,

Handle listener, Handle *handle);

This function accepts the client process channel creation request that was previously received using the KnCmListen() call. This function is called by the server process.

Input parameters:

  • client is the name of the client process that sent the request to create the channel.
  • service is the fully qualified name of the endpoint requested by the client process (for example, blkdev.ata).
  • rsid is the endpoint ID.
  • listener is the listener handle; if it has the INVALID_HANDLE value, a new listener handle is created and will be used as the server IPC handle of the channel being created.

Output parameter handle contains the server IPC handle of the channel being created.

If successful, the function returns rcOk, otherwise it returns an error code.

Page top
[Topic kn_cm_accept]

KnCmConnect()

This function is declared in the coresrv/cm/cm_api.h file.

Retcode KnCmConnect(const char *server, const char *service,

rtl_uint32_t msecs, Handle *handle,

rtl_uint32_t *rsid);

This function sends a request to create a channel with the server process. This function is called by the client process.

Input parameters:

  • server is the name of the server process that provides the endpoint.
  • service is the fully qualified name of the endpoint (for example, blkdev.ata).
  • msecs is the timeout for accepting the request, in milliseconds.

Output parameters:

  • handle is the client IPC handle.
  • rsid is the endpoint ID.

If successful, the function returns rcOk, otherwise it returns an error code.

Page top
[Topic kn_cm_connect]

KnCmDrop()

This function is declared in the coresrv/cm/cm_api.h file.

Retcode KnCmDrop(const char *client, const char *service);

This function rejects the client process channel creation request that was previously received using the KnCmListen() call. This function is called by the server process.

Parameters:

  • client is the name of the client process that sent the request to create the channel.
  • service is the fully qualified name of the endpoint requested by the client process (for example, blkdev.ata).

If successful, the function returns rcOk, otherwise it returns an error code.

Page top
[Topic kn_cm_drop]

KnCmListen()

This function is declared in the coresrv/cm/cm_api.h file.

Retcode KnCmListen(const char *filter, rtl_uint32_t msecs, char *client,

char *service);

This function checks for channel creation requests from client processes. This function is called by the server process.

Input parameters:

  • filter is an unused parameter.
  • msecs is the request timeout, in milliseconds.

Output parameters:

  • client is the name of the client process.
  • service is the fully qualified name of the endpoint requested by the client process (for example, blkdev.ata).

If successful, the function returns rcOk, otherwise it returns an error code.

Page top
[Topic kn_cm_listen]

NsCreate()

This function is declared in the coresrv/ns/ns_api.h file.

Retcode NsCreate(const char *name, rtl_uint32_t msecs, NsHandle *ns);

This function attempts to connect to name server name for the specified number of milliseconds (msecs). If the name parameter has the RTL_NULL value, the function attempts to connect to name server ns (the default name server).

Output parameter ns contains the handle for the connection with the name server.

If successful, the function returns rcOk, otherwise it returns an error code.

Page top
[Topic ns_create]

NsEnumServices()

This function is declared in the coresrv/ns/ns_api.h file.

Retcode NsEnumServices(NsHandle ns, const char *type, unsigned index,

char *server, rtl_size_t serverSize,

char *service, rtl_size_t serviceSize);

This function enumerates the endpoints with the defined interface that are published on the name server.

Input parameters:

  • ns is the handle of the connection with the name server that was previously received by using the NsCreate() call.
  • type is the name of the interface implemented by the endpoint (for example, kl.drivers.Block).
  • index is the index for enumerating endpoints.
  • serverSize is the maximum size of the buffer for the server output parameter in bytes.
  • serviceSize is the maximum size of the buffer for the service output parameter in bytes.

Output parameters:

  • server is the name of the server process that provides the endpoint (for example, kl.drivers.Ata).
  • service is the fully qualified name of the endpoint (for example, blkdev.ata).

For example, you can receive a full list of server processes that provide an endpoint with the kl.drivers.Block interface as follows.

rc = NsEnumServices(ns, "kl.drivers.Block", 0, outServerName, ServerNameSize, outServiceName, ServiceNameSize);

rc = NsEnumServices(ns, "kl.drivers.Block", 1, outServerName, ServerNameSize, outServiceName, ServiceNameSize);

...

rc = NsEnumServices(ns, "kl.drivers.Block", N, outServerName, ServerNameSize, outServiceName, ServiceNameSize);

Function calls with index incrementation continue until the function returns rcResourceNotFound.

If successful, the function returns rcOk, otherwise it returns an error code.

Page top
[Topic ns_enum_services]

NsPublishService()

This function is declared in the coresrv/ns/ns_api.h file.

Retcode NsPublishService(NsHandle ns, const char *type, const char *server,

const char *service);

This function publishes the endpoint with the defined interface on the name server.

Parameters:

  • ns is the handle of the connection with the name server that was previously received by using the NsCreate() call.
  • type is the name of the interface implemented by the published endpoint (for example, kl.drivers.Block).
  • server is the name of the server process (for example, kl.drivers.Ata).
  • service is the fully qualified name of the endpoint (for example, blkdev.ata).

If successful, the function returns rcOk, otherwise it returns an error code.

Page top
[Topic ns_publish_service]

NsUnPublishService()

This function is declared in the coresrv/ns/ns_api.h file.

Retcode NsUnPublishService( NsHandle ns, const char *type, const char *server,

const char *service);

This function unpublishes the endpoint on the name server.

Parameters:

  • ns is the handle of the connection with the name server that was previously received by using the NsCreate() call.
  • type is the name of the interface implemented by the published endpoint (for example, kl.drivers.Block).
  • server is the name of the server process (for example, kl.drivers.Ata).
  • service is the fully qualified name of the endpoint (for example, blkdev.ata).

If successful, the function returns rcOk, otherwise it returns an error code.

Page top
[Topic ns_unpublish_service]