pub unsafe extern "C" fn otDnsClientResolveService(
aInstance: *mut otInstance,
aInstanceLabel: *const c_char,
aServiceName: *const c_char,
aCallback: otDnsServiceCallback,
aContext: *mut c_void,
aConfig: *const otDnsQueryConfig,
) -> otError
Expand description
Starts a DNS service instance resolution for a given service instance.
Is available when OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE
is enabled.
The @p aConfig can be NULL. In this case the default config (from otDnsClientGetDefaultConfig()
) will be used as
the config for this query. In a non-NULL @p aConfig, some of the fields can be left unspecified (value zero). The
unspecified fields are then replaced by the values from the default config.
The function sends queries for SRV and/or TXT records for the given service instance. The mServiceMode
field in
otDnsQueryConfig
determines which records to query (SRV only, TXT only, or both SRV and TXT) and how to perform
the query (together in the same message, separately in parallel, or in optimized mode where client will try in the
same message first and then separately if it fails to get a response).
The SRV record provides information about service port, priority, and weight along with the host name associated
with the service instance. This function DOES NOT perform address resolution for the host name discovered from SRV
record. The server/resolver may provide AAAA/A record(s) for the host name in the Additional Data section of the
response to SRV/TXT query and this information can be retrieved using otDnsServiceResponseGetServiceInfo()
in
otDnsServiceCallback
. Users of this API MUST NOT assume that host address will always be available from
otDnsServiceResponseGetServiceInfo()
.
@param[in] aInstance A pointer to an OpenThread instance. @param[in] aInstanceLabel The service instance label. @param[in] aServiceName The service name (together with @p aInstanceLabel form full instance name). @param[in] aCallback A function pointer that shall be called on response reception or time-out. @param[in] aContext A pointer to arbitrary context information. @param[in] aConfig A pointer to the config to use for this query.
@retval OT_ERROR_NONE Query sent successfully. @p aCallback will be invoked to report the status. @retval OT_ERROR_NO_BUFS Insufficient buffer to prepare and send query. @retval OT_ERROR_INVALID_ARGS @p aInstanceLabel is NULL.