Domain Name System module provides implementation of DNS6 service.
More...
Domain Name System module provides implementation of DNS6 service.
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_result | Notifies the application if the DNS module was processed successfully or if an error occurred, for example DNS server is unreachable. |
[in] | p_hostname | Identifies hostname (URL string) that was requested to bee resolved, e.g. "example.com". |
[in] | p_addr | Pointer 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_count | Number of IPv6 addresses being successfully resolved. |
- Return values
-
Function for initializing DNS6 module.
- Parameters
-
[in] | p_dns_init | Initialization 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_SUCCESS | on successful execution of procedure, else an error code indicating reason for failure. |
Function for querying given URL string to DNS server, in order to get IPv6 address of given hostname.
- Parameters
-
[in] | p_hostname | Identifies hostname (URL string) to be find, e.g. "example.com". Should not be NULL. |
[in] | evt_handler | Callback 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_SUCCESS | on 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_READY | if interface is not ready for sending packets e.g. interface is down. |
Other | errors indicates reason of failure. |
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_value | The value of the wall clock that triggered the callback. |
- Return values
-
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_SUCCESS | on successful execution of procedure, else an error code indicating reason for failure. |