OpenSLP Programmers Guide - SLPFindSrvTypes()

## SLPFindSrvTypes

### Declaration

`#include <slp.h>`

`SLPError SLPFindSrvTypes( SLPHandle hslp,`
`const char* namingauthority,`
`const char* scopelist,`
`SLPSrvTypeCallback callback,`
`void* cookie)`

### Description

The `SLPFindSrvType()` function issues an SLP service type request for service types in the scopes indicated by the `scopelist`. The results are returned through the `callback` parameter. The service types are independent of language locale, but only for services registered in one of scopes and for the indicated naming authority.

If the `namingauthority` is "*", then results are returned for all naming authorities. If the naming authority is the empty string, i.e. "", then the default naming authority, "IANA", is used. "IANA" is not a valid naming authority name, and it is a `SLP_PARAMETER_BAD` error to include it explicitly.

The service type names are returned with the naming authority intact. If the naming authority is the default (i.e. empty string) then it is omitted, as is the separating ".". Service type names from URLs of the service: scheme are returned with the "service:" prefix intact.

### Parameters

`hslp` | The language specific `SLPHandle` on which to register the service.
`namingauthority` | The naming authorities to search. Use "*" for all naming authorities and the empty string, "", for the default naming authority (IANA). See Syntax for more information on naming authorities.
`scopelist` | A pointer to a comma separated list of scope names. May be the empty string if you wish to use scopes this machine is configured for. May not be NULL.
`callback` | The address of an `SLPSrvTypeCallback` function that will be called to report the operation completion status. May not be NULL. See Callbacks for more information on how callbacks are used by the SLPAPI.
`cookie` | Pointer to memory that gets passed to the callback code. May be NULL.

### Returns

SLP_OK | Indicates that the no error occurred during the operation.
SLP_PARSE_ERROR | The SLP message was rejected by a remote SLP agent. The API returns this error only when no information was retrieved, and at least one SA or DA indicated a protocol error. The data supplied through the API may be malformed or a may have been damaged in transit.
SLP_AUTHENTICATION_ABSENT | If the SLP framework supports authentication, this error arises when the UA or SA failed to send an authenticator for requests or registrations.
SLP_AUTHENTICATION_FAILED | If the SLP framework supports authentication, this error arises when a authentication on an SLP message failed.
SLP_NETWORK_TIMED_OUT | When no reply can be obtained in the time specified by the configured timeout interval for a unicast request, this error is returned. In other words, slpd is running, but something is wrong with it
SLP_NETWORK_INIT_FAILED | If the network cannot initialize properly, this error is returned.
SLP_MEMORY_ALLOC_FAILED | Out of memory error
SLP_PARAMETER_BAD | If a parameter passed into a function is bad, this error is returned.
SLP_NETWORK_ERROR | The failure of networking during normal operations causes this error to be returned. In OpenSLP, this is the error you'll get if an underlying socket() call failed.
SLP_INTERNAL_SYSTEM_ERROR | A basic failure of the API causes this error to be returned. This occurs when a system call or library fails. The operation could not recover.
SLP_HANDLE_IN_USE | Callback functions are not permitted to recursively call into the API on the same SLPHandle, either directly or indirectly. If an attempt is made to do so, this error is returned from the called API function.

If no service types can be found, no error is returned. However, no calls (other than the SLP_LAST_CALL) will be made to the SLPSrvTypesCallback. Be aware, especially if the call is async, of error codes that may be passed to the `SLPSrvTypeCallback` callback function.

### Status

OpenSLP 0.7.4 | Fully implemented as specified by RFC 2614

### See Also

SLPSrvTypeCallback, Syntax, Callbacks