2010-03-12 16:19:19 +00:00
|
|
|
/**
|
|
|
|
* \addtogroup uip6
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \file
|
2015-02-15 18:02:07 +00:00
|
|
|
* Header file for IPv6-related data structures
|
2010-03-12 16:19:19 +00:00
|
|
|
* \author Mathilde Durvy <mdurvy@cisco.com>
|
|
|
|
* \author Julien Abeille <jabeille@cisco.com>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. Neither the name of the Institute nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2010-03-15 16:41:24 +00:00
|
|
|
|
2013-11-24 15:57:08 +00:00
|
|
|
#ifndef UIP_DS6_H_
|
|
|
|
#define UIP_DS6_H_
|
2010-03-12 16:19:19 +00:00
|
|
|
|
2013-11-22 08:17:54 +00:00
|
|
|
#include "net/ip/uip.h"
|
2010-03-12 16:19:19 +00:00
|
|
|
#include "sys/stimer.h"
|
2012-05-28 14:01:34 +00:00
|
|
|
/* The size of uip_ds6_addr_t depends on UIP_ND6_DEF_MAXDADNS. Include uip-nd6.h to define it. */
|
2013-11-22 08:17:54 +00:00
|
|
|
#include "net/ipv6/uip-nd6.h"
|
|
|
|
#include "net/ipv6/uip-ds6-route.h"
|
|
|
|
#include "net/ipv6/uip-ds6-nbr.h"
|
2010-03-12 16:19:19 +00:00
|
|
|
|
|
|
|
/*--------------------------------------------------*/
|
|
|
|
/** Configuration. For all tables (Neighbor cache, Prefix List, Routing Table,
|
2010-03-15 16:41:24 +00:00
|
|
|
* Default Router List, Unicast address list, multicast address list, anycast address list),
|
2010-03-12 16:19:19 +00:00
|
|
|
* we define:
|
|
|
|
* - the number of elements requested by the user in contiki configuration (name suffixed by _NBU)
|
|
|
|
* - the number of elements assigned by the system (name suffixed by _NBS)
|
|
|
|
* - the total number of elements is the sum (name suffixed by _NB)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Default router list */
|
|
|
|
#define UIP_DS6_DEFRT_NBS 0
|
|
|
|
#ifndef UIP_CONF_DS6_DEFRT_NBU
|
|
|
|
#define UIP_DS6_DEFRT_NBU 2
|
2010-03-15 16:41:24 +00:00
|
|
|
#else
|
2010-03-12 16:19:19 +00:00
|
|
|
#define UIP_DS6_DEFRT_NBU UIP_CONF_DS6_DEFRT_NBU
|
2010-03-15 16:41:24 +00:00
|
|
|
#endif
|
2010-03-12 16:19:19 +00:00
|
|
|
#define UIP_DS6_DEFRT_NB UIP_DS6_DEFRT_NBS + UIP_DS6_DEFRT_NBU
|
|
|
|
|
2015-09-30 14:06:58 +00:00
|
|
|
/* Default prefix */
|
|
|
|
#ifdef UIP_CONF_DS6_DEFAULT_PREFIX
|
|
|
|
#define UIP_DS6_DEFAULT_PREFIX UIP_CONF_DS6_DEFAULT_PREFIX
|
|
|
|
#else
|
|
|
|
/* From RFC4193, section 3.1:
|
|
|
|
* | 7 bits |1| 40 bits | 16 bits | 64 bits |
|
|
|
|
* +--------+-+------------+-----------+----------------------------+
|
|
|
|
* | Prefix |L| Global ID | Subnet ID | Interface ID |
|
|
|
|
* +--------+-+------------+-----------+----------------------------+
|
|
|
|
* Prefix FC00::/7 prefix to identify Local IPv6 unicast
|
|
|
|
* addresses.
|
|
|
|
* L Set to 1 if the prefix is locally assigned.
|
|
|
|
* Set to 0 may be defined in the future. See
|
|
|
|
* Section 3.2 for additional information.
|
|
|
|
* Global ID 40-bit global identifier used to create a
|
|
|
|
* globally unique prefix. See Section 3.2 for
|
|
|
|
* additional information.
|
|
|
|
*
|
|
|
|
* We set prefix to 0xfc00 and set the local bit, resulting in 0xfd00.
|
|
|
|
* For high probability of network uniqueness, Global ID must be generated
|
|
|
|
* pseudo-randomly. As this is a hard-coded default prefix, we simply use
|
|
|
|
* a Global ID of 0. For real deployments, make sure to install a pseudo-random
|
|
|
|
* Global ID, e.g. in a RPL network, by configuring it at the root.
|
|
|
|
*/
|
|
|
|
#define UIP_DS6_DEFAULT_PREFIX 0xfd00
|
|
|
|
#endif /* UIP_CONF_DS6_DEFAULT_PREFIX */
|
|
|
|
|
|
|
|
#define UIP_DS6_DEFAULT_PREFIX_0 ((UIP_DS6_DEFAULT_PREFIX >> 8) & 0xff)
|
|
|
|
#define UIP_DS6_DEFAULT_PREFIX_1 (UIP_DS6_DEFAULT_PREFIX & 0xff)
|
|
|
|
|
2010-03-12 16:19:19 +00:00
|
|
|
/* Prefix list */
|
2010-03-15 16:41:24 +00:00
|
|
|
#define UIP_DS6_PREFIX_NBS 1
|
2010-03-12 16:19:19 +00:00
|
|
|
#ifndef UIP_CONF_DS6_PREFIX_NBU
|
|
|
|
#define UIP_DS6_PREFIX_NBU 2
|
2010-03-15 16:41:24 +00:00
|
|
|
#else
|
2010-03-12 16:19:19 +00:00
|
|
|
#define UIP_DS6_PREFIX_NBU UIP_CONF_DS6_PREFIX_NBU
|
2010-03-15 16:41:24 +00:00
|
|
|
#endif
|
2010-03-12 16:19:19 +00:00
|
|
|
#define UIP_DS6_PREFIX_NB UIP_DS6_PREFIX_NBS + UIP_DS6_PREFIX_NBU
|
|
|
|
|
|
|
|
/* Unicast address list*/
|
|
|
|
#define UIP_DS6_ADDR_NBS 1
|
|
|
|
#ifndef UIP_CONF_DS6_ADDR_NBU
|
|
|
|
#define UIP_DS6_ADDR_NBU 2
|
2010-03-15 16:41:24 +00:00
|
|
|
#else
|
2010-03-12 16:19:19 +00:00
|
|
|
#define UIP_DS6_ADDR_NBU UIP_CONF_DS6_ADDR_NBU
|
2010-03-15 16:41:24 +00:00
|
|
|
#endif
|
2010-03-12 16:19:19 +00:00
|
|
|
#define UIP_DS6_ADDR_NB UIP_DS6_ADDR_NBS + UIP_DS6_ADDR_NBU
|
|
|
|
|
|
|
|
/* Multicast address list */
|
|
|
|
#if UIP_CONF_ROUTER
|
2010-03-15 16:41:24 +00:00
|
|
|
#define UIP_DS6_MADDR_NBS 2 + UIP_DS6_ADDR_NB /* all routers + all nodes + one solicited per unicast */
|
2010-03-12 16:19:19 +00:00
|
|
|
#else
|
2010-03-15 16:41:24 +00:00
|
|
|
#define UIP_DS6_MADDR_NBS 1 + UIP_DS6_ADDR_NB /* all nodes + one solicited per unicast */
|
2010-03-12 16:19:19 +00:00
|
|
|
#endif
|
|
|
|
#ifndef UIP_CONF_DS6_MADDR_NBU
|
|
|
|
#define UIP_DS6_MADDR_NBU 0
|
2010-03-15 16:41:24 +00:00
|
|
|
#else
|
2010-03-12 16:19:19 +00:00
|
|
|
#define UIP_DS6_MADDR_NBU UIP_CONF_DS6_MADDR_NBU
|
2010-03-15 16:41:24 +00:00
|
|
|
#endif
|
2010-03-12 16:19:19 +00:00
|
|
|
#define UIP_DS6_MADDR_NB UIP_DS6_MADDR_NBS + UIP_DS6_MADDR_NBU
|
|
|
|
|
|
|
|
/* Anycast address list */
|
|
|
|
#if UIP_CONF_ROUTER
|
|
|
|
#define UIP_DS6_AADDR_NBS UIP_DS6_PREFIX_NB - 1 /* One per non link local prefix (subnet prefix anycast address) */
|
|
|
|
#else
|
|
|
|
#define UIP_DS6_AADDR_NBS 0
|
|
|
|
#endif
|
|
|
|
#ifndef UIP_CONF_DS6_AADDR_NBU
|
|
|
|
#define UIP_DS6_AADDR_NBU 0
|
|
|
|
#else
|
|
|
|
#define UIP_DS6_AADDR_NBU UIP_CONF_DS6_AADDR_NBU
|
|
|
|
#endif
|
|
|
|
#define UIP_DS6_AADDR_NB UIP_DS6_AADDR_NBS + UIP_DS6_AADDR_NBU
|
|
|
|
|
2011-07-11 12:19:14 +00:00
|
|
|
/*--------------------------------------------------*/
|
|
|
|
/* Should we use LinkLayer acks in NUD ?*/
|
|
|
|
#ifndef UIP_CONF_DS6_LL_NUD
|
|
|
|
#define UIP_DS6_LL_NUD 0
|
|
|
|
#else
|
|
|
|
#define UIP_DS6_LL_NUD UIP_CONF_DS6_LL_NUD
|
|
|
|
#endif
|
2010-03-12 16:19:19 +00:00
|
|
|
|
|
|
|
/** \brief Possible states for the an address (RFC 4862) */
|
|
|
|
#define ADDR_TENTATIVE 0
|
|
|
|
#define ADDR_PREFERRED 1
|
2010-03-15 16:41:24 +00:00
|
|
|
#define ADDR_DEPRECATED 2
|
2010-03-12 16:19:19 +00:00
|
|
|
|
|
|
|
/** \brief How the address was acquired: Autoconf, DHCP or manually */
|
|
|
|
#define ADDR_ANYTYPE 0
|
|
|
|
#define ADDR_AUTOCONF 1
|
|
|
|
#define ADDR_DHCP 2
|
|
|
|
#define ADDR_MANUAL 3
|
|
|
|
|
|
|
|
/** \brief General DS6 definitions */
|
2014-02-07 11:34:49 +00:00
|
|
|
/** Period for uip-ds6 periodic task*/
|
2014-04-18 11:32:40 +00:00
|
|
|
#ifndef UIP_DS6_CONF_PERIOD
|
2014-02-07 11:34:49 +00:00
|
|
|
#define UIP_DS6_PERIOD (CLOCK_SECOND/10)
|
|
|
|
#else
|
2014-04-18 11:32:40 +00:00
|
|
|
#define UIP_DS6_PERIOD UIP_DS6_CONF_PERIOD
|
|
|
|
#endif
|
|
|
|
|
2010-03-12 16:19:19 +00:00
|
|
|
#define FOUND 0
|
|
|
|
#define FREESPACE 1
|
|
|
|
#define NOSPACE 2
|
|
|
|
/*--------------------------------------------------*/
|
2012-11-26 18:53:38 +00:00
|
|
|
|
2010-10-28 15:42:56 +00:00
|
|
|
#if UIP_CONF_IPV6_QUEUE_PKT
|
2013-11-22 08:17:54 +00:00
|
|
|
#include "net/ip/uip-packetqueue.h"
|
2010-10-28 15:42:56 +00:00
|
|
|
#endif /*UIP_CONF_QUEUE_PKT */
|
2010-03-12 16:19:19 +00:00
|
|
|
|
|
|
|
/** \brief A prefix list entry */
|
|
|
|
#if UIP_CONF_ROUTER
|
|
|
|
typedef struct uip_ds6_prefix {
|
2010-03-15 16:41:24 +00:00
|
|
|
uint8_t isused;
|
2010-03-12 16:19:19 +00:00
|
|
|
uip_ipaddr_t ipaddr;
|
|
|
|
uint8_t length;
|
|
|
|
uint8_t advertise;
|
2012-02-17 22:45:13 +00:00
|
|
|
uint32_t vlifetime;
|
|
|
|
uint32_t plifetime;
|
2010-03-12 16:19:19 +00:00
|
|
|
uint8_t l_a_reserved; /**< on-link and autonomous flags + 6 reserved bits */
|
2010-03-15 16:41:24 +00:00
|
|
|
} uip_ds6_prefix_t;
|
2010-03-12 16:19:19 +00:00
|
|
|
#else /* UIP_CONF_ROUTER */
|
|
|
|
typedef struct uip_ds6_prefix {
|
|
|
|
uint8_t isused;
|
|
|
|
uip_ipaddr_t ipaddr;
|
|
|
|
uint8_t length;
|
|
|
|
struct stimer vlifetime;
|
|
|
|
uint8_t isinfinite;
|
2010-03-15 16:41:24 +00:00
|
|
|
} uip_ds6_prefix_t;
|
|
|
|
#endif /*UIP_CONF_ROUTER */
|
2010-03-12 16:19:19 +00:00
|
|
|
|
|
|
|
/** * \brief Unicast address structure */
|
|
|
|
typedef struct uip_ds6_addr {
|
|
|
|
uint8_t isused;
|
|
|
|
uip_ipaddr_t ipaddr;
|
|
|
|
uint8_t state;
|
|
|
|
uint8_t type;
|
|
|
|
uint8_t isinfinite;
|
|
|
|
struct stimer vlifetime;
|
2011-07-11 11:24:17 +00:00
|
|
|
#if UIP_ND6_DEF_MAXDADNS > 0
|
2010-03-12 16:19:19 +00:00
|
|
|
struct timer dadtimer;
|
|
|
|
uint8_t dadnscount;
|
2011-07-11 11:24:17 +00:00
|
|
|
#endif /* UIP_ND6_DEF_MAXDADNS > 0 */
|
2010-03-15 16:41:24 +00:00
|
|
|
} uip_ds6_addr_t;
|
2010-03-12 16:19:19 +00:00
|
|
|
|
|
|
|
/** \brief Anycast address */
|
|
|
|
typedef struct uip_ds6_aaddr {
|
|
|
|
uint8_t isused;
|
|
|
|
uip_ipaddr_t ipaddr;
|
2010-03-15 16:41:24 +00:00
|
|
|
} uip_ds6_aaddr_t;
|
2010-03-12 16:19:19 +00:00
|
|
|
|
|
|
|
/** \brief A multicast address */
|
|
|
|
typedef struct uip_ds6_maddr {
|
|
|
|
uint8_t isused;
|
|
|
|
uip_ipaddr_t ipaddr;
|
2010-03-15 16:41:24 +00:00
|
|
|
} uip_ds6_maddr_t;
|
2010-03-12 16:19:19 +00:00
|
|
|
|
2010-09-21 13:13:09 +00:00
|
|
|
/* only define the callback if RPL is active */
|
|
|
|
#if UIP_CONF_IPV6_RPL
|
2010-05-01 12:02:25 +00:00
|
|
|
#ifndef UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED
|
2010-06-14 18:35:04 +00:00
|
|
|
#define UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED rpl_ipv6_neighbor_callback
|
2010-05-01 12:02:25 +00:00
|
|
|
#endif /* UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED */
|
2010-09-21 13:15:25 +00:00
|
|
|
#endif /* UIP_CONF_IPV6_RPL */
|
2010-05-01 12:02:25 +00:00
|
|
|
|
2013-07-29 19:50:33 +00:00
|
|
|
#if UIP_CONF_IPV6_RPL
|
|
|
|
#ifndef UIP_CONF_DS6_LINK_NEIGHBOR_CALLBACK
|
|
|
|
#define UIP_CONF_DS6_LINK_NEIGHBOR_CALLBACK rpl_link_neighbor_callback
|
|
|
|
#endif /* UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED */
|
|
|
|
#endif /* UIP_CONF_IPV6_RPL */
|
|
|
|
|
|
|
|
|
2010-03-12 16:19:19 +00:00
|
|
|
/** \brief Interface structure (contains all the interface variables) */
|
|
|
|
typedef struct uip_ds6_netif {
|
|
|
|
uint32_t link_mtu;
|
2010-03-15 16:41:24 +00:00
|
|
|
uint8_t cur_hop_limit;
|
2010-03-12 16:19:19 +00:00
|
|
|
uint32_t base_reachable_time; /* in msec */
|
2010-03-15 16:41:24 +00:00
|
|
|
uint32_t reachable_time; /* in msec */
|
|
|
|
uint32_t retrans_timer; /* in msec */
|
2010-03-12 16:19:19 +00:00
|
|
|
uint8_t maxdadns;
|
2015-10-04 20:32:12 +00:00
|
|
|
#if UIP_DS6_ADDR_NB
|
2010-03-15 16:41:24 +00:00
|
|
|
uip_ds6_addr_t addr_list[UIP_DS6_ADDR_NB];
|
2015-10-04 20:32:12 +00:00
|
|
|
#endif /* UIP_DS6_ADDR_NB */
|
|
|
|
#if UIP_DS6_AADDR_NB
|
2010-03-15 16:41:24 +00:00
|
|
|
uip_ds6_aaddr_t aaddr_list[UIP_DS6_AADDR_NB];
|
2015-10-04 20:32:12 +00:00
|
|
|
#endif /* UIP_DS6_AADDR_NB */
|
|
|
|
#if UIP_DS6_MADDR_NB
|
2010-03-15 16:41:24 +00:00
|
|
|
uip_ds6_maddr_t maddr_list[UIP_DS6_MADDR_NB];
|
2015-10-04 20:32:12 +00:00
|
|
|
#endif /* UIP_DS6_MADDR_NB */
|
2010-03-15 16:41:24 +00:00
|
|
|
} uip_ds6_netif_t;
|
2010-03-12 16:19:19 +00:00
|
|
|
|
|
|
|
/** \brief Generic type for a DS6, to use a common loop though all DS */
|
|
|
|
typedef struct uip_ds6_element {
|
|
|
|
uint8_t isused;
|
|
|
|
uip_ipaddr_t ipaddr;
|
2010-03-15 16:41:24 +00:00
|
|
|
} uip_ds6_element_t;
|
2010-03-12 16:19:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*/
|
2010-03-15 16:41:24 +00:00
|
|
|
extern uip_ds6_netif_t uip_ds6_if;
|
2010-03-12 16:19:19 +00:00
|
|
|
extern struct etimer uip_ds6_timer_periodic;
|
2010-03-15 16:41:24 +00:00
|
|
|
|
2010-03-12 16:19:19 +00:00
|
|
|
#if UIP_CONF_ROUTER
|
2010-03-15 16:41:24 +00:00
|
|
|
extern uip_ds6_prefix_t uip_ds6_prefix_list[UIP_DS6_PREFIX_NB];
|
2010-03-12 16:19:19 +00:00
|
|
|
#else /* UIP_CONF_ROUTER */
|
|
|
|
extern struct etimer uip_ds6_timer_rs;
|
|
|
|
#endif /* UIP_CONF_ROUTER */
|
|
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
/** \brief Initialize data structures */
|
|
|
|
void uip_ds6_init(void);
|
|
|
|
|
|
|
|
/** \brief Periodic processing of data structures */
|
|
|
|
void uip_ds6_periodic(void);
|
|
|
|
|
2010-03-15 16:41:24 +00:00
|
|
|
/** \brief Generic loop routine on an abstract data structure, which generalizes
|
2010-03-12 16:19:19 +00:00
|
|
|
* all data structures used in DS6 */
|
2010-03-23 14:21:04 +00:00
|
|
|
uint8_t uip_ds6_list_loop(uip_ds6_element_t *list, uint8_t size,
|
|
|
|
uint16_t elementsize, uip_ipaddr_t *ipaddr,
|
2010-03-15 16:41:24 +00:00
|
|
|
uint8_t ipaddrlen,
|
2010-03-23 14:21:04 +00:00
|
|
|
uip_ds6_element_t **out_element);
|
2010-03-12 16:19:19 +00:00
|
|
|
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
|
|
|
|
/** \name Prefix list basic routines */
|
|
|
|
/** @{ */
|
|
|
|
#if UIP_CONF_ROUTER
|
2010-03-23 14:21:04 +00:00
|
|
|
uip_ds6_prefix_t *uip_ds6_prefix_add(uip_ipaddr_t *ipaddr, uint8_t length,
|
2010-03-15 16:41:24 +00:00
|
|
|
uint8_t advertise, uint8_t flags,
|
|
|
|
unsigned long vtime,
|
|
|
|
unsigned long ptime);
|
2010-03-12 16:19:19 +00:00
|
|
|
#else /* UIP_CONF_ROUTER */
|
2010-03-23 14:21:04 +00:00
|
|
|
uip_ds6_prefix_t *uip_ds6_prefix_add(uip_ipaddr_t *ipaddr, uint8_t length,
|
2010-03-15 16:41:24 +00:00
|
|
|
unsigned long interval);
|
2010-03-12 16:19:19 +00:00
|
|
|
#endif /* UIP_CONF_ROUTER */
|
2010-03-23 14:21:04 +00:00
|
|
|
void uip_ds6_prefix_rm(uip_ds6_prefix_t *prefix);
|
|
|
|
uip_ds6_prefix_t *uip_ds6_prefix_lookup(uip_ipaddr_t *ipaddr,
|
2010-03-15 16:41:24 +00:00
|
|
|
uint8_t ipaddrlen);
|
2010-03-23 14:21:04 +00:00
|
|
|
uint8_t uip_ds6_is_addr_onlink(uip_ipaddr_t *ipaddr);
|
2010-03-15 16:41:24 +00:00
|
|
|
|
2010-03-12 16:19:19 +00:00
|
|
|
/** @} */
|
|
|
|
|
|
|
|
/** \name Unicast address list basic routines */
|
|
|
|
/** @{ */
|
2015-10-30 07:55:11 +00:00
|
|
|
/** \brief Add a unicast address to the interface */
|
2010-03-23 14:21:04 +00:00
|
|
|
uip_ds6_addr_t *uip_ds6_addr_add(uip_ipaddr_t *ipaddr,
|
2010-03-15 16:41:24 +00:00
|
|
|
unsigned long vlifetime, uint8_t type);
|
2010-03-23 14:21:04 +00:00
|
|
|
void uip_ds6_addr_rm(uip_ds6_addr_t *addr);
|
|
|
|
uip_ds6_addr_t *uip_ds6_addr_lookup(uip_ipaddr_t *ipaddr);
|
2010-05-09 17:52:37 +00:00
|
|
|
uip_ds6_addr_t *uip_ds6_get_link_local(int8_t state);
|
2010-06-15 19:16:22 +00:00
|
|
|
uip_ds6_addr_t *uip_ds6_get_global(int8_t state);
|
2010-03-15 16:41:24 +00:00
|
|
|
|
2010-03-12 16:19:19 +00:00
|
|
|
/** @} */
|
|
|
|
|
|
|
|
/** \name Multicast address list basic routines */
|
|
|
|
/** @{ */
|
2013-01-17 04:33:17 +00:00
|
|
|
uip_ds6_maddr_t *uip_ds6_maddr_add(const uip_ipaddr_t *ipaddr);
|
2010-03-23 14:21:04 +00:00
|
|
|
void uip_ds6_maddr_rm(uip_ds6_maddr_t *maddr);
|
2013-01-17 04:33:17 +00:00
|
|
|
uip_ds6_maddr_t *uip_ds6_maddr_lookup(const uip_ipaddr_t *ipaddr);
|
2010-03-15 16:41:24 +00:00
|
|
|
|
2010-03-12 16:19:19 +00:00
|
|
|
/** @} */
|
|
|
|
|
|
|
|
/** \name Anycast address list basic routines */
|
|
|
|
/** @{ */
|
2010-03-23 14:21:04 +00:00
|
|
|
uip_ds6_aaddr_t *uip_ds6_aaddr_add(uip_ipaddr_t *ipaddr);
|
|
|
|
void uip_ds6_aaddr_rm(uip_ds6_aaddr_t *aaddr);
|
|
|
|
uip_ds6_aaddr_t *uip_ds6_aaddr_lookup(uip_ipaddr_t *ipaddr);
|
2010-03-15 16:41:24 +00:00
|
|
|
|
2010-03-12 16:19:19 +00:00
|
|
|
/** @} */
|
|
|
|
|
|
|
|
|
|
|
|
/** \brief set the last 64 bits of an IP address based on the MAC address */
|
2012-04-21 22:31:56 +00:00
|
|
|
void uip_ds6_set_addr_iid(uip_ipaddr_t *ipaddr, uip_lladdr_t *lladdr);
|
2010-03-12 16:19:19 +00:00
|
|
|
|
|
|
|
/** \brief Get the number of matching bits of two addresses */
|
2012-04-21 22:31:56 +00:00
|
|
|
uint8_t get_match_length(uip_ipaddr_t *src, uip_ipaddr_t *dst);
|
2010-03-12 16:19:19 +00:00
|
|
|
|
2011-07-11 11:24:17 +00:00
|
|
|
#if UIP_ND6_DEF_MAXDADNS >0
|
2010-03-12 16:19:19 +00:00
|
|
|
/** \brief Perform Duplicate Address Selection on one address */
|
2012-04-21 22:31:56 +00:00
|
|
|
void uip_ds6_dad(uip_ds6_addr_t *ifaddr);
|
2010-03-12 16:19:19 +00:00
|
|
|
|
|
|
|
/** \brief Callback when DAD failed */
|
2012-04-21 22:31:56 +00:00
|
|
|
int uip_ds6_dad_failed(uip_ds6_addr_t *ifaddr);
|
2011-07-11 11:24:17 +00:00
|
|
|
#endif /* UIP_ND6_DEF_MAXDADNS */
|
2010-03-12 16:19:19 +00:00
|
|
|
|
|
|
|
/** \brief Source address selection, see RFC 3484 */
|
2012-04-21 22:31:56 +00:00
|
|
|
void uip_ds6_select_src(uip_ipaddr_t *src, uip_ipaddr_t *dst);
|
2010-03-12 16:19:19 +00:00
|
|
|
|
|
|
|
#if UIP_CONF_ROUTER
|
|
|
|
#if UIP_ND6_SEND_RA
|
|
|
|
/** \brief Send a RA as an asnwer to a RS */
|
|
|
|
void uip_ds6_send_ra_sollicited(void);
|
|
|
|
|
|
|
|
/** \brief Send a periodic RA */
|
|
|
|
void uip_ds6_send_ra_periodic(void);
|
|
|
|
#endif /* UIP_ND6_SEND_RA */
|
|
|
|
#else /* UIP_CONF_ROUTER */
|
|
|
|
/** \brief Send periodic RS to find router */
|
2010-03-15 16:41:24 +00:00
|
|
|
void uip_ds6_send_rs(void);
|
2010-03-12 16:19:19 +00:00
|
|
|
#endif /* UIP_CONF_ROUTER */
|
|
|
|
|
|
|
|
/** \brief Compute the reachable time based on base reachable time, see RFC 4861*/
|
|
|
|
uint32_t uip_ds6_compute_reachable_time(void); /** \brief compute random reachable timer */
|
|
|
|
|
|
|
|
/** \name Macros to check if an IP address (unicast, multicast or anycast) is mine */
|
|
|
|
/** @{ */
|
|
|
|
#define uip_ds6_is_my_addr(addr) (uip_ds6_addr_lookup(addr) != NULL)
|
|
|
|
#define uip_ds6_is_my_maddr(addr) (uip_ds6_maddr_lookup(addr) != NULL)
|
|
|
|
#define uip_ds6_is_my_aaddr(addr) (uip_ds6_aaddr_lookup(addr) != NULL)
|
|
|
|
/** @} */
|
|
|
|
/** @} */
|
|
|
|
|
2013-11-24 15:57:08 +00:00
|
|
|
#endif /* UIP_DS6_H_ */
|