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) {
174 for(i = 1, e =
list_head(dns); e != NULL && i <= num;
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)) {
struct uip_nameserver_record uip_nameserver_record
Nameserver record.
uint32_t uip_nameserver_next_expiration(void)
Get next expiration time.
#define UIP_NAMESERVER_INFINITE_LIFETIME
Infinite Lifetime indicator.
unsigned long clock_seconds(void)
Get the current value of the platform seconds.
void uip_nameserver_update(const uip_ipaddr_t *nameserver, uint32_t lifetime)
Initialize the module variables.
Linked list manipulation routines.
void * list_head(list_t list)
Get a pointer to the first element of a list.
#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.
Memory block allocation routines.
#define DNS_EXPIRATION(r)
Expiration time in seconds.
void list_add(list_t list, void *item)
Add an item at the end of a list.
void list_init(list_t list)
Initialize a list.
#define LIST(name)
Declare a linked list.
void * memb_alloc(struct memb *m)
Allocate a memory block from a block of memory declared with MEMB().
#define UIP_NAMESERVER_POOL_SIZE
Number of Nameservers to keep.
void memb_init(struct memb *m)
Initialize a memory block that was declared with MEMB().
char memb_free(struct memb *m, void *ptr)
Deallocate a memory block from a memory block previously declared with MEMB().
uint16_t uip_nameserver_count(void)
Get the number of recorded name servers.
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.
void * list_item_next(void *item)
Get the next item following this item.
#define MEMB(name, structure, num)
Declare a memory block.
int list_length(list_t list)
Get the length of a list.