The uIP DNS resolver functions are used to lookup a hostname and map it to an IP address. It maintains a list of resolved hostnames that can be queried with the resolv_lookup() function. New hostnames can be resolved using the resolv_query() function.
When a hostname has been resolved (or found to be non-existent), the resolver code calls a callback function called resolv_found() that must be implemented by the module that uses the resolver.
Files | |
file | resolv.h |
DNS resolver definitions. | |
Defines | |
#define | MAX_DNS_RETRIES 8 |
The maximum number of DNS retries. | |
Functions | |
void | resolv_appcall (void) |
uIP event function for the DNS resolver | |
void | resolv_conf (uint16_t *dnsserver) |
Configure which DNS server to use for queries. | |
void | resolv_found (char *name, uint16_t *ipaddr) |
Callback function which is called after hostname look-up. | |
uint16_t * | resolv_getserver (void) |
Obtain the currently configured DNS server. | |
void | resolv_init (void) |
Initialise the resolver. | |
uint16_t * | resolv_lookup (char *name) |
Look up a hostname in the array of known hostnames. | |
void | resolv_query (char *name) |
Queues a name so that a question for the name will be sent out. |
void resolv_appcall | ( | void | ) |
uIP event function for the DNS resolver
Must only be called for the correct protocol / port (rport 53).
void resolv_found | ( | char * | name, |
uint16_t * | ipaddr | ||
) |
Callback function which is called after hostname look-up.
This function must be implemented by the module that uses the DNS resolver. It is called when the hostname requested got an IP address assigned by DNS server answer, or when such assignment could not be found.
name | pointer to the name that was to look up |
ipaddr | pointer to a 4-byte array containing the IP address of the hostname, or NULL if the hostname could not be found. |
void resolv_conf | ( | uint16_t * | dnsserver | ) |
uint16_t* resolv_getserver | ( | void | ) |
Obtain the currently configured DNS server.
uint16_t* resolv_lookup | ( | char * | name | ) |
Look up a hostname in the array of known hostnames.
void resolv_query | ( | char * | name | ) |
Queues a name so that a question for the name will be sent out.
name | The hostname that is to be queried. |