nRF5 SDK for Thread and Zigbee v1.0.0
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

This module includes functions that control DNS communication. More...

Data Structures

struct  otDnsQuery
 

Macros

#define OT_DNS_MAX_HOSTNAME_LENGTH   62
 Maximum allowed hostname length (maximum label size - 1 for compression).
 
#define OT_DNS_DEFAULT_DNS_SERVER_IP   "2001:4860:4860::8888"
 Defines default DNS Server address - Google DNS.
 
#define OT_DNS_DEFAULT_DNS_SERVER_PORT   53
 Defines default DNS Server port.
 

Typedefs

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

Functions

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

Detailed Description

This module includes functions that control DNS communication.

Typedef Documentation

typedef struct otDnsQuery otDnsQuery

This structure implements DNS Query parameters.

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

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

Parameters
[in]aContextA pointer to application-specific context.
[in]aHostnameIdentifies hostname related with DNS response.
[in]aAddressA pointer to the IPv6 address received in DNS response. May be null.
[in]aTtlSpecifies the maximum time in seconds that the resource record may be cached.
[in]aResultA result of the DNS transaction.
Return values
OT_ERROR_NONEA response was received successfully and IPv6 address is provided in aAddress.
OT_ERROR_ABORTA DNS transaction was aborted by stack.
OT_ERROR_RESPONSE_TIMEOUTNo DNS response has been received within timeout.
OT_ERROR_NOT_FOUNDA response was received but no IPv6 address has been found.
OT_ERROR_FAILEDA response was received but status code is different than success.

Function Documentation

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_ENABLE_DNS_CLIENT is enabled.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aQueryA pointer to specify DNS query parameters.
[in]aHandlerA function pointer that shall be called on response reception or time-out.
[in]aContextA pointer to arbitrary context information.