Network Component
Version 6.6
MDK-Professional Middleware for IP Networking
|
DNS Client routines help to resolve DNS requests using an external DNS server. More...
Functions | |
netStatus | get_host_by_name (const char *name, net_dns_client_cb_t cb_func) |
Resolve IP address of a host from a hostname. | |
enum | dnsClientEvent { dnsClientSuccess = 0, dnsClientTimeout, dnsClientNotResolved, dnsClientError } |
DNS Client Callback Events. More... | |
typedef void(* | net_dns_client_cb_t )(dnsClientEvent event, const uint8_t *ip_addr) |
DNS Client Event callback function. | |
DNS Client routines help to resolve DNS requests using an external DNS server.
Domain Name System (DNS) servers store and manage information about domains and respond to resolution requests for clients (in some cases millions of times each day). The DNS database is a distributed name database stored on many DNS servers. DNS uses a hierarchical tree structure for its name space and a hierarchical tree for name authorities and registration.
The DNS Client is capable of resolving the IP address of a host from the host's name. It does this by sending DNS requests to a DNS Server. The IP address of a DNS Server is specified in the network interface configuration file or can be obtained from the DHCP Server for the Local Area Network.
void(* net_dns_client_cb_t)(dnsClientEvent event, const uint8_t *ip_addr) |
DNS Client Event callback function.
[in] | event | DNS client event type as defined in dnsClientEvent. |
[in] | ip_addr | IP address of the host server. |
Is the type definition for the DNS callback function. The function is invoked by the DNS client when an event ends the DNS session. The DNS client specifies the event and the host IP address (in case of dnsClientSuccess) when calling the function.
Parameter for:
enum dnsClientEvent |
DNS Client Callback Events.
Parameter for:
netStatus get_host_by_name | ( | const char * | name, |
net_dns_client_cb_t | cb_func | ||
) |
Resolve IP address of a host from a hostname.
[in] | name | hostname, a null-terminated string. |
[in] | cb_func | callback function to call, when DNS session ends. |
The function get_host_by_name resolves the IP address of a host from a host name. It starts the DNS client and sends a request to the DNS server.
The argument name is a pointer to a NULL terminated string that specifies the host name.
The argument cb_func specifies a user-provided callback function. Refer to net_dns_client_cb_t.
Code Example