Contiki-NG
uip-nameserver.h
Go to the documentation of this file.
1 /**
2  * \addtogroup uip
3  * @{
4  */
5 
6 /**
7  * \file
8  * uIP Name Server interface
9  * \author Víctor Ariño <victor.arino@tado.com>
10  */
11 
12 /*
13  * Copyright (c) 2014, tado° GmbH.
14  * All rights reserved.
15  *
16  * Redistribution and use in source and binary forms, with or without
17  * modification, are permitted provided that the following conditions
18  * are met:
19  * 1. Redistributions of source code must retain the above copyright
20  * notice, this list of conditions and the following disclaimer.
21  * 2. Redistributions in binary form must reproduce the above copyright
22  * notice, this list of conditions and the following disclaimer in the
23  * documentation and/or other materials provided with the distribution.
24  * 3. Neither the name of the Institute nor the names of its contributors
25  * may be used to endorse or promote products derived from this software
26  * without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
29  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31  * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
32  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38  * SUCH DAMAGE.
39  *
40  * This file is part of the Contiki operating system.
41  *
42  */
43 
44 #ifndef UIP_NAMESERVER_H_
45 #define UIP_NAMESERVER_H_
46 
47 #include "net/ipv6/uip.h"
48 
49 /**
50  * \name General
51  * @{
52  */
53 /** \brief Number of Nameservers to keep */
54 #ifndef UIP_CONF_NAMESERVER_POOL_SIZE
55 #define UIP_NAMESERVER_POOL_SIZE 1
56 #else /* UIP_CONF_NAMESERVER_POOL_SIZE */
57 #define UIP_NAMESERVER_POOL_SIZE UIP_CONF_NAMESERVER_POOL_SIZE
58 #endif /* UIP_CONF_NAMESERVER_POOL_SIZE */
59 /** \brief Infinite Lifetime indicator */
60 #define UIP_NAMESERVER_INFINITE_LIFETIME 0xFFFFFFFF
61 /** @} */
62 
63 /**
64  * \name Nameserver maintenance
65  * @{
66  */
67 /**
68  * \brief Insert or update a nameserver into/from the pool
69  *
70  * The list is kept according to the RFC6106, which indicates that new entries
71  * will replace old ones (with lower lifetime) and existing entries will update
72  * their lifetimes.
73  *
74  * \param nameserver Pointer to the nameserver ip address
75  * \param lifetime Life time of the given address. Minimum is 0, which is
76  * considered to remove an entry. Maximum is 0xFFFFFFFF which
77  * is considered infinite.
78  */
79 void uip_nameserver_update(const uip_ipaddr_t *nameserver, uint32_t lifetime);
80 
81 /**
82  * \brief Get a Nameserver ip address given in RA
83  *
84  * \param num The number of the nameserver to obtain, starting at 0 and going
85  * up to the pool size.
86  */
87 uip_ipaddr_t *uip_nameserver_get(uint8_t num);
88 
89 /**
90  * \brief Get next expiration time
91  *
92  * The least expiration time is returned
93  */
94 uint32_t uip_nameserver_next_expiration(void);
95 
96 /**
97  * \brief Get the number of recorded name servers
98  */
99 uint16_t uip_nameserver_count(void);
100 /** @} */
101 
102 #endif /* UIP_NAMESERVER_H_ */
103 /** @} */
uint32_t uip_nameserver_next_expiration(void)
Get next expiration time.
void uip_nameserver_update(const uip_ipaddr_t *nameserver, uint32_t lifetime)
Initialize the module variables.
Header file for the uIP TCP/IP stack.
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.