Make DS6 neighbors use neighbor-table, and move all DS6 neighbor management from uip-ds6 to a new uip-ds6-neighbor module.

This commit is contained in:
Simon Duquennoy 2013-07-03 19:32:26 +02:00
parent 5a1d8d8006
commit ec609b49eb
8 changed files with 386 additions and 290 deletions

View file

@ -47,6 +47,7 @@
/* The size of uip_ds6_addr_t depends on UIP_ND6_DEF_MAXDADNS. Include uip-nd6.h to define it. */
#include "net/uip-nd6.h"
#include "net/uip-ds6-route.h"
#include "net/uip-ds6-neighbor.h"
/*--------------------------------------------------*/
/** Configuration. For all tables (Neighbor cache, Prefix List, Routing Table,
@ -56,14 +57,6 @@
* - the number of elements assigned by the system (name suffixed by _NBS)
* - the total number of elements is the sum (name suffixed by _NB)
*/
/* Neighbor cache */
#define UIP_DS6_NBR_NBS 0
#ifndef UIP_CONF_DS6_NBR_NBU
#define UIP_DS6_NBR_NBU 4
#else
#define UIP_DS6_NBR_NBU UIP_CONF_DS6_NBR_NBU
#endif
#define UIP_DS6_NBR_NB UIP_DS6_NBR_NBS + UIP_DS6_NBR_NBU
/* Default router list */
#define UIP_DS6_DEFRT_NBS 0
@ -155,22 +148,6 @@
#if UIP_CONF_IPV6_QUEUE_PKT
#include "net/uip-packetqueue.h"
#endif /*UIP_CONF_QUEUE_PKT */
/** \brief An entry in the nbr cache */
typedef struct uip_ds6_nbr {
uint8_t isused;
uip_ipaddr_t ipaddr;
uip_lladdr_t lladdr;
struct stimer reachable;
struct stimer sendns;
clock_time_t last_lookup;
uint8_t nscount;
uint8_t isrouter;
uint8_t state;
#if UIP_CONF_IPV6_QUEUE_PKT
struct uip_packetqueue_handle packethandle;
#define UIP_DS6_NBR_PACKET_LIFETIME CLOCK_SECOND * 4
#endif /*UIP_CONF_QUEUE_PKT */
} uip_ds6_nbr_t;
/** \brief A prefix list entry */
#if UIP_CONF_ROUTER
@ -226,8 +203,6 @@ typedef struct uip_ds6_maddr {
#endif /* UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED */
#endif /* UIP_CONF_IPV6_RPL */
/** \brief Interface structure (contains all the interface variables) */
typedef struct uip_ds6_netif {
uint32_t link_mtu;
@ -273,14 +248,6 @@ uint8_t uip_ds6_list_loop(uip_ds6_element_t *list, uint8_t size,
uint8_t ipaddrlen,
uip_ds6_element_t **out_element);
/** \name Neighbor Cache basic routines */
/** @{ */
uip_ds6_nbr_t *uip_ds6_nbr_add(uip_ipaddr_t *ipaddr, uip_lladdr_t *lladdr,
uint8_t isrouter, uint8_t state);
void uip_ds6_nbr_rm(uip_ds6_nbr_t *nbr);
uip_ds6_nbr_t *uip_ds6_nbr_lookup(uip_ipaddr_t *ipaddr);
uip_ds6_nbr_t *uip_ds6_nbr_ll_lookup(uip_lladdr_t *lladdr);
/** @} */
@ -371,15 +338,4 @@ uint32_t uip_ds6_compute_reachable_time(void); /** \brief compute random reachab
/** @} */
/** @} */
/**
* \brief
* This searches inside the neighbor table for the neighbor that is about to
* expire the next.
*
* \return
* A reference to the neighbor about to expire the next or NULL if
* table is empty.
*/
uip_ds6_nbr_t *uip_ds6_get_least_lifetime_neighbor(void);
#endif /* __UIP_DS6_H__ */