KasperskyOS Community Edition 1.1

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.