45 #include "contiki-net.h" 52 #define LOG_MODULE "IPv6" 53 #define LOG_LEVEL LOG_LEVEL_NONE 63 #if UIP_NAMESERVER_POOL_SIZE > 1 65 static uint8_t initialized = 0;
71 #if UIP_NAMESERVER_POOL_SIZE > 1 75 static uip_ipaddr_t serveraddr;
76 static uint32_t serverlifetime;
81 #define DNS_EXPIRATION(r) \ 82 (((UIP_NAMESERVER_INFINITE_LIFETIME - r->added) <= r->lifetime) ? \ 83 UIP_NAMESERVER_INFINITE_LIFETIME : r->added + r->lifetime) 88 #if UIP_NAMESERVER_POOL_SIZE > 1 101 LOG_DBG(
"Nameserver update:");
102 LOG_DBG_6ADDR(nameserver);
106 #if UIP_NAMESERVER_POOL_SIZE > 1 109 if(initialized == 0) {
114 if(uip_ipaddr_cmp(&e->ip, nameserver)) {
143 e->lifetime = lifetime;
149 serverlifetime = lifetime;
153 #if UIP_NAMESERVER_POOL_SIZE > 1 175 #if UIP_NAMESERVER_POOL_SIZE > 1 179 if(initialized == 0) {
183 for(i = 1, e =
list_head(dns); e != NULL && i <= num;
202 #if UIP_NAMESERVER_POOL_SIZE > 1 220 return serverlifetime;
227 #if UIP_NAMESERVER_POOL_SIZE > 1 228 if(initialized == 0) {
struct uip_nameserver_record uip_nameserver_record
Nameserver record.
int memb_free(struct memb *m, void *ptr)
Deallocate a memory block from a memory block previously declared with MEMB().
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().
Header file for the logging system
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.