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:
nsis the handle of the connection with the name server that was previously received by using theNsCreate()call.typeis the name of the interface implemented by the endpoint (for example,kl.drivers.Block).indexis the index for enumerating endpoints.serverSizeis the maximum size of the buffer for theserveroutput parameter in bytes.serviceSizeis the maximum size of the buffer for theserviceoutput parameter in bytes.
Output parameters:
serveris the name of the server process that provides the endpoint (for example,kl.drivers.Ata).serviceis 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.