Contiki-NG
Macros | Functions | Variables
uIP hostname resolver functions

The uIP DNS resolver functions are used to lookup a hostname and map it to a numerical IP address. More...

Macros

#define RESOLV_CONF_MAX_RETRIES   4
 The maximum number of retries when asking for a name. More...
 

Functions

static void newdata (void)
 
void resolv_set_hostname (const char *hostname)
 Changes the local hostname advertised by MDNS. More...
 
const char * resolv_get_hostname (void)
 Returns the local hostname being advertised via MDNS. More...
 
void resolv_query (const char *name)
 Queues a name so that a question for the name will be sent out. More...
 
resolv_status_t resolv_lookup (const char *name, uip_ipaddr_t **ipaddr)
 Look up a hostname in the array of known hostnames. More...
 

Variables

process_event_t resolv_event_found
 Event that is broadcasted when a DNS name has been resolved.
 

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.

The event resolv_event_found is posted when a hostname has been resolved. It is up to the receiving process to determine if the correct hostname has been found by calling the resolv_lookup() function with the hostname.

Macro Definition Documentation

◆ RESOLV_CONF_MAX_RETRIES

#define RESOLV_CONF_MAX_RETRIES   4

The maximum number of retries when asking for a name.

Definition at line 135 of file resolv.c.

Function Documentation

◆ newdata()

static void newdata ( void  )
static

QUESTION HANDLING SECTION

ANSWER HANDLING SECTION

Definition at line 754 of file resolv.c.

◆ resolv_get_hostname()

const char* resolv_get_hostname ( void  )

Returns the local hostname being advertised via MDNS.

Returns
C-string containing the local hostname.

Definition at line 1078 of file resolv.c.

◆ resolv_lookup()

resolv_status_t resolv_lookup ( const char *  name,
uip_ipaddr_t **  ipaddr 
)

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.

Definition at line 1313 of file resolv.c.

References RESOLV_STATUS_UNCACHED.

◆ resolv_query()

void resolv_query ( const char *  name)

Queues a name so that a question for the name will be sent out.

Parameters
nameThe hostname that is to be queried.

Definition at line 1234 of file resolv.c.

◆ resolv_set_hostname()

void resolv_set_hostname ( const char *  hostname)

Changes the local hostname advertised by MDNS.

Parameters
hostnameThe new hostname to advertise.

Definition at line 1058 of file resolv.c.