openthread_sys

Function otDnsBrowseResponseGetServiceInfo

Source
pub unsafe extern "C" fn otDnsBrowseResponseGetServiceInfo(
    aResponse: *const otDnsBrowseResponse,
    aInstanceLabel: *const c_char,
    aServiceInfo: *mut otDnsServiceInfo,
) -> otError
Expand description

Gets info for a service instance from a DNS browse (service instance enumeration) response.

MUST only be used from otDnsBrowseCallback.

A browse DNS response can include SRV, TXT, and AAAA records for the service instances that are enumerated. This is a SHOULD and not a MUST requirement, and servers/resolvers are not required to provide this. This function attempts to retrieve this info for a given service instance when available.

  • If no matching SRV record is found in @p aResponse, OT_ERROR_NOT_FOUND is returned. In this case, no additional records (no TXT and/or AAAA) are read.
  • If a matching SRV record is found in @p aResponse, @p aServiceInfo is updated and OT_ERROR_NONE is returned.
  • If no matching TXT record is found in @p aResponse, mTxtDataSize in @p aServiceInfo is set to zero.
  • If TXT data length is greater than mTxtDataSize, it is read partially and mTxtDataTruncated is set to true.
  • If no matching AAAA record is found in @p aResponse, `mHostAddress is set to all zero or unspecified address.
  • If there are multiple AAAA records for the host name in @p aResponse, mHostAddress is set to the first one. The other addresses can be retrieved using otDnsBrowseResponseGetHostAddress().

@param[in] aResponse A pointer to the response. @param[in] aInstanceLabel The service instance label (MUST NOT be NULL). @param[out] aServiceInfo A ServiceInfo to output the service instance information (MUST NOT be NULL).

@retval OT_ERROR_NONE The service instance info was read. @p aServiceInfo is updated. @retval OT_ERROR_NOT_FOUND Could not find a matching SRV record for @p aInstanceLabel. @retval OT_ERROR_NO_BUFS The host name and/or TXT data could not fit in the given buffers. @retval OT_ERROR_PARSE Could not parse the records in the @p aResponse.