Contiki 3.x
uip-nameserver.h
Go to the documentation of this file.
1 /**
2  * \addtogroup uip6
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 /**
48  * \name General
49  * @{
50  */
51 /** \brief Number of Nameservers to keep */
52 #ifndef UIP_CONF_NAMESERVER_POOL_SIZE
53 #define UIP_NAMESERVER_POOL_SIZE 1
54 #else /* UIP_CONF_NAMESERVER_POOL_SIZE */
55 #define UIP_NAMESERVER_POOL_SIZE UIP_CONF_NAMESERVER_POOL_SIZE
56 #endif /* UIP_CONF_NAMESERVER_POOL_SIZE */
57 /** \brief Infinite Lifetime indicator */
58 #define UIP_NAMESERVER_INFINITE_LIFETIME 0xFFFFFFFF
59 /** @} */
60 
61 /**
62  * \name Nameserver maintenance
63  * @{
64  */
65 /**
66  * \brief Insert or update a nameserver into/from the pool
67  *
68  * The list is kept according to the RFC6106, which indicates that new entries
69  * will replace old ones (with lower lifetime) and existing entries will update
70  * their lifetimes.
71  *
72  * \param nameserver Pointer to the nameserver ip address
73  * \param lifetime Life time of the given address. Minimum is 0, which is
74  * considered to remove an entry. Maximum is 0xFFFFFFFF which
75  * is considered infinite.
76  */
77 void uip_nameserver_update(const uip_ipaddr_t *nameserver, uint32_t lifetime);
78 
79 /**
80  * \brief Get a Nameserver ip address given in RA
81  *
82  * \param num The number of the nameserver to obtain, starting at 0 and going
83  * up to the pool size.
84  */
85 uip_ipaddr_t *uip_nameserver_get(uint8_t num);
86 
87 /**
88  * \brief Get next expiration time
89  *
90  * The least expiration time is returned
91  */
92 uint32_t uip_nameserver_next_expiration(void);
93 
94 /**
95  * \brief Get the number of recorded name servers
96  */
97 uint16_t uip_nameserver_count(void);
98 /** @} */
99 
100 #endif /* UIP_NAMESERVER_H_ */
101 /** @} */
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.
void uip_nameserver_update(const uip_ipaddr_t *nameserver, uint32_t lifetime)
Initialize the module variables.
uint32_t uip_nameserver_next_expiration(void)
Get next expiration time.