nRF5 IoT SDK  v0.9.0
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
DNS Application Interface for Nordic's IPv6 stack

Domain Name System module provides implementation of DNS6 service. More...

Data Structures

struct  dns6_server_param_t
 DNS Server parameter. More...
 
struct  dns6_init_t
 Initialization parameters type. More...
 

Typedefs

typedef void(* dns6_evt_handler_t )(uint32_t process_result, const char *p_hostname, ipv6_addr_t *p_addr, uint16_t addr_count)
 DNS event receive callback. More...
 

Functions

uint32_t dns6_init (const dns6_init_t *p_dns_init)
 Function for initializing DNS6 module. More...
 
uint32_t dns6_uninit (void)
 Function for uninitializing DNS6 module. More...
 
uint32_t dns6_query (const char *p_hostname, dns6_evt_handler_t evt_handler)
 Function for querying given URL string to DNS server, in order to get IPv6 address of given hostname. More...
 
void dns6_timeout_process (iot_timer_time_in_ms_t wall_clock_value)
 Function for performing retransmissions of DNS queries. More...
 

Detailed Description

Domain Name System module provides implementation of DNS6 service.

Typedef Documentation

typedef void(* dns6_evt_handler_t)(uint32_t process_result, const char *p_hostname, ipv6_addr_t *p_addr, uint16_t addr_count)

DNS event receive callback.

API used to notify the application of DNS Response on specific hostname or of an error during resolving process. The process_result parameter indicates whether the DNS module was successfully processed. If the received DNS Response is malformed in a way that allow to assign response with specific callback (e.g. timeout occurs or hostname is not found), information about error is still notified to the application. The application should check process_result and number of IPv6 address before reading them.

Parameters
[in]process_resultNotifies the application if the DNS module was processed successfully or if an error occurred, for example DNS server is unreachable.
[in]p_hostnameIdentifies hostname (URL string) that was requested to bee resolved, e.g. "example.com".
[in]p_addrPointer to the IPv6 addresses being resolved for given hostname. In case addr_count variable is 0, p_addr gets NULL value and should not be used.
[in]addr_countNumber of IPv6 addresses being successfully resolved.
Return values
None.

Function Documentation

uint32_t dns6_init ( const dns6_init_t p_dns_init)

Function for initializing DNS6 module.

Parameters
[in]p_dns_initInitialization structure for DNS client. Should not be NULL.
Note
DNS protocol module uses UDP transport layer, therefore one UDP socket is allocated inside function and uses for further communication.
Return values
NRF_SUCCESSon successful execution of procedure, else an error code indicating reason for failure.
uint32_t dns6_query ( const char *  p_hostname,
dns6_evt_handler_t  evt_handler 
)

Function for querying given URL string to DNS server, in order to get IPv6 address of given hostname.

Parameters
[in]p_hostnameIdentifies hostname (URL string) to be find, e.g. "example.com". Should not be NULL.
[in]evt_handlerCallback that is called once response is received, timeout occurred or internal error was detected. Should not be NULL.
Note
Function sends DNS Query to DNS Server to obtain all AAAA records (with IPv6 address) assigned to given hostname. In case DNS Server replies with more that one AAAA records DNS module call user defined evt_handler with addr_count indicates number of addresses.
Return values
NRF_SUCCESSon successful execution of procedure.
IOT_DNS6_ERR_BASE| NRF_ERROR_NO_MEM if there is no place in pending queries' queue.
IOT_PBUFFER_ERR_BASE| NRF_ERROR_NO_MEM if there is no memory for hostname allocation.
MEMORY_MANAGER_ERR_BASE| NRF_ERROR_NO_MEM if there is no memory for packet allocation.
UDP_INTERFACE_NOT_READYif interface is not ready for sending packets e.g. interface is down.
Othererrors indicates reason of failure.
void dns6_timeout_process ( iot_timer_time_in_ms_t  wall_clock_value)

Function for performing retransmissions of DNS queries.

Note
DNS module implements the retransmission mechanism by invoking this function periodically. So that method has to be added to IoT Timer client list and has to be called with minimum of DNS6_RETRANSMISSION_INTERVAL resolution.
Parameters
[in]wall_clock_valueThe value of the wall clock that triggered the callback.
Return values
None.
uint32_t dns6_uninit ( void  )

Function for uninitializing DNS6 module.

Note
Apart of DNS specific functionality, function frees previously allocated UDP socket. Function removes any pending queries from the sending queue, so registered user callbacks will not be executed.
Return values
NRF_SUCCESSon successful execution of procedure, else an error code indicating reason for failure.