45 #include "contiki-net.h"
59 #if UIP_NAMESERVER_POOL_SIZE > 1
61 static uint8_t initialized = 0;
67 #if UIP_NAMESERVER_POOL_SIZE > 1
71 static uip_ipaddr_t serveraddr;
72 static uint32_t serverlifetime;
77 #define DNS_EXPIRATION(r) \
78 (((UIP_NAMESERVER_INFINITE_LIFETIME - r->added) <= r->lifetime) ? \
79 UIP_NAMESERVER_INFINITE_LIFETIME : r->added + r->lifetime)
84 #if UIP_NAMESERVER_POOL_SIZE > 1
97 #if UIP_NAMESERVER_POOL_SIZE > 1
100 if(initialized == 0) {
105 if(uip_ipaddr_cmp(&e->ip, nameserver)) {
134 e->lifetime = lifetime;
140 serverlifetime = lifetime;
144 #if UIP_NAMESERVER_POOL_SIZE > 1
166 #if UIP_NAMESERVER_POOL_SIZE > 1
170 if(initialized == 0) {
193 #if UIP_NAMESERVER_POOL_SIZE > 1
211 return serverlifetime;
218 #if UIP_NAMESERVER_POOL_SIZE > 1
219 if(initialized == 0) {
224 #if NETSTACK_CONF_WITH_IPV6
227 if(uip_ipaddr_cmp(&serveraddr, &uip_all_zeroes_addr)) {
uip_ipaddr_t * uip_nameserver_get(uint8_t num)
Get a Nameserver ip address given in RA.
void list_remove(list_t list, void *item)
Remove a specific element from a list.
#define LIST(name)
Declare a linked list.
#define MEMB(name, structure, num)
Declare a memory block.
uint16_t uip_nameserver_count(void)
Get the number of recorded name servers.
#define UIP_NAMESERVER_POOL_SIZE
Number of Nameservers to keep.
void * list_item_next(void *item)
Get the next item following this item.
struct uip_nameserver_record uip_nameserver_record
Nameserver record.
#define uip_is_addr_unspecified(a)
Is IPv6 address a the unspecified address a is of type uip_ipaddr_t.
#define uip_ipaddr_copy(dest, src)
Copy an IP address from one place to another.
void uip_nameserver_update(const uip_ipaddr_t *nameserver, uint32_t lifetime)
Initialize the module variables.
void list_init(list_t list)
Initialize a list.
void memb_init(struct memb *m)
Initialize a memory block that was declared with MEMB().
void * list_head(list_t list)
Get a pointer to the first element of a list.
#define NULL
The null pointer.
#define DNS_EXPIRATION(r)
Expiration time in seconds.
uint32_t uip_nameserver_next_expiration(void)
Get next expiration time.
void list_add(list_t list, void *item)
Add an item at the end of a list.
Linked list manipulation routines.
#define UIP_NAMESERVER_INFINITE_LIFETIME
Infinite Lifetime indicator.
Memory block allocation routines.
CCIF unsigned long clock_seconds(void)
Get the current value of the platform seconds.
int list_length(list_t list)
Get the length of a list.
void * memb_alloc(struct memb *m)
Allocate a memory block from a block of memory declared with MEMB().
char memb_free(struct memb *m, void *ptr)
Deallocate a memory block from a memory block previously declared with MEMB().