45#include "contiki-net.h"
52#define LOG_MODULE "IPv6"
53#define LOG_LEVEL LOG_LEVEL_NONE
56typedef struct uip_nameserver_record {
57 struct uip_nameserver_record *next;
63#if UIP_NAMESERVER_POOL_SIZE > 1
65static uint8_t initialized = 0;
71#if UIP_NAMESERVER_POOL_SIZE > 1
75static uip_ipaddr_t serveraddr;
76static 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
107 register uip_nameserver_record *e;
109 if(initialized == 0) {
114 if(uip_ipaddr_cmp(&e->ip, nameserver)) {
125 uip_nameserver_record *p;
143 e->lifetime = lifetime;
149 serverlifetime = lifetime;
153#if UIP_NAMESERVER_POOL_SIZE > 1
160 register uip_nameserver_record *e = NULL;
175#if UIP_NAMESERVER_POOL_SIZE > 1
177 uip_nameserver_record *e = NULL;
179 if(initialized == 0) {
183 for(i = 1, e =
list_head(dns); e != NULL && i <= num;
202#if UIP_NAMESERVER_POOL_SIZE > 1
203 register uip_nameserver_record *e = NULL;
220 return serverlifetime;
227#if UIP_NAMESERVER_POOL_SIZE > 1
228 if(initialized == 0) {
unsigned long clock_seconds(void)
Get the current value of the platform seconds.
static void list_init(list_t list)
Initialize a list.
#define LIST(name)
Declare a linked list.
static void * list_item_next(const void *item)
Get the next item following this item.
int list_length(const_list_t list)
Get the length of a list.
void list_add(list_t list, void *item)
Add an item at the end of a list.
void list_remove(list_t list, const void *item)
Remove a specific element from a list.
static void * list_head(const_list_t list)
Get a pointer to the first element of a list.
int memb_free(struct memb *m, void *ptr)
Deallocate a memory block from a memory block previously declared with MEMB().
void * memb_alloc(struct memb *m)
Allocate a memory block from a block of memory declared with MEMB().
void memb_init(struct memb *m)
Initialize a memory block that was declared with MEMB().
#define MEMB(name, structure, num)
Declare a memory block.
uint32_t uip_nameserver_next_expiration(void)
Get next expiration time.
#define uip_is_addr_unspecified(a)
Is IPv6 address a the unspecified address a is of type uip_ipaddr_t.
void uip_nameserver_update(const uip_ipaddr_t *nameserver, uint32_t lifetime)
Initialize the module variables.
struct uip_nameserver_record uip_nameserver_record
Nameserver record.
#define UIP_NAMESERVER_POOL_SIZE
Number of Nameservers to keep.
#define UIP_NAMESERVER_INFINITE_LIFETIME
Infinite Lifetime indicator.
#define DNS_EXPIRATION(r)
Expiration time in seconds.
uip_ipaddr_t * uip_nameserver_get(uint8_t num)
Get a Nameserver ip address given in RA.
uint16_t uip_nameserver_count(void)
Get the number of recorded name servers.
#define uip_ipaddr_copy(dest, src)
Copy an IP address from one place to another.
Linked list manipulation routines.
Header file for the logging system.
Memory block allocation routines.