Google is committed to advancing racial equity for Black communities. See how.

DNSv6

This module includes functions that control DNS communication.

Summary

Typedefs

otDnsQuery typedef
struct otDnsQuery
This structure implements DNS Query parameters.
otDnsResponseHandler)(void *aContext, const char *aHostname, const otIp6Address *aAddress, uint32_t aTtl, otError aResult) typedef
void(*
This function pointer is called when a DNS response is received.

Functions

otDnsClientQuery(otInstance *aInstance, const otDnsQuery *aQuery, otDnsResponseHandler aHandler, void *aContext)
This function sends a DNS query for AAAA (IPv6) record.

Structs

otDnsQuery

This structure implements DNS Query parameters.

Typedefs

otDnsQuery

struct otDnsQuery otDnsQuery

This structure implements DNS Query parameters.

otDnsResponseHandler

void(* otDnsResponseHandler)(void *aContext, const char *aHostname, const otIp6Address *aAddress, uint32_t aTtl, otError aResult)

This function pointer is called when a DNS response is received.

Details
Parameters
[in] aContext
A pointer to application-specific context.
[in] aHostname
Identifies hostname related with DNS response.
[in] aAddress
A pointer to the IPv6 address received in DNS response. May be null.
[in] aTtl
Specifies the maximum time in seconds that the resource record may be cached.
[in] aResult
A result of the DNS transaction.
Return Values
OT_ERROR_NONE
A response was received successfully and IPv6 address is provided in aAddress.
OT_ERROR_ABORT
A DNS transaction was aborted by stack.
OT_ERROR_RESPONSE_TIMEOUT
No DNS response has been received within timeout.
OT_ERROR_NOT_FOUND
A response was received but no IPv6 address has been found.
OT_ERROR_FAILED
A response was received but status code is different than success.

Functions

otDnsClientQuery

otError otDnsClientQuery(
  otInstance *aInstance,
  const otDnsQuery *aQuery,
  otDnsResponseHandler aHandler,
  void *aContext
)

This function sends a DNS query for AAAA (IPv6) record.

This function is available only if feature OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE is enabled.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aQuery
A pointer to specify DNS query parameters.
[in] aHandler
A function pointer that shall be called on response reception or time-out.
[in] aContext
A pointer to arbitrary context information.

Macros

OT_DNS_DEFAULT_SERVER_IP

 OT_DNS_DEFAULT_SERVER_IP "2001:4860:4860::8888"

Defines default DNS Server address - Google DNS.

OT_DNS_DEFAULT_SERVER_PORT

 OT_DNS_DEFAULT_SERVER_PORT 53

Defines default DNS Server port.

OT_DNS_MAX_HOSTNAME_LENGTH

 OT_DNS_MAX_HOSTNAME_LENGTH 62

Maximum allowed hostname length (maximum label size - 1 for compression).