DNS resolver
[Apps]
Detailed Description
The uIP DNS resolver functions are used to lookup a hostname and map it to a numerical 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-existant), the resolver code calls a callback function called resolv_found() that must be implemented by the module that uses the resolver.
Define Documentation
#define UIP_UDP_APPCALL resolv_appcall |
Typedef Documentation
Function Documentation
void resolv_appcall |
( |
void |
|
) |
|
void resolv_conf |
( |
u16_t * |
dnsserver |
) |
|
Configure which DNS server to use for queries.
- Parameters:
-
| dnsserver | A pointer to a 4-byte representation of the IP address of the DNS server to be configured. |
void resolv_found |
( |
char * |
name, |
|
|
u16_t * |
ipaddr | |
|
) |
| | |
Callback function which is called when a hostname is found.
This function must be implemented by the module that uses the DNS resolver. It is called when a hostname is found, or when a hostname was not found.
- Parameters:
-
| name | A pointer to the name that was looked up. |
| ipaddr | A pointer to a 4-byte array containing the IP address of the hostname, or NULL if the hostname could not be found. |
u16_t * resolv_getserver |
( |
void |
|
) |
|
Obtain the currently configured DNS server.
- Returns:
- A pointer to a 4-byte representation of the IP address of the currently configured DNS server or NULL if no DNS server has been configured.
void resolv_init |
( |
void |
|
) |
|
u16_t * resolv_lookup |
( |
char * |
name |
) |
|
Look up a hostname in the array of known hostnames.
- Note:
- This function only looks in the internal array of known hostnames, it does not send out a query for the hostname if none was found. The function resolv_query() can be used to send a query for a hostname.
- Returns:
- A pointer to a 4-byte representation of the hostname's IP address, or NULL if the hostname was not found in the array of hostnames.
void resolv_query |
( |
char * |
name |
) |
|
Queues a name so that a question for the name will be sent out.
- Parameters:
-
| name | The hostname that is to be queried. |