sixlowpan/nd/router.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
20 #ifndef NET_GNRC_SIXLOWPAN_ND_ROUTER_H
21 #define NET_GNRC_SIXLOWPAN_ND_ROUTER_H
22 
23 #include <stdbool.h>
24 
25 #include "bitfield.h"
26 #include "net/gnrc/sixlowpan/ctx.h"
27 #include "net/gnrc/ipv6/netif.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
40 #ifndef GNRC_SIXLOWPAN_ND_ROUTER_ABR_NUMOF
41 #define GNRC_SIXLOWPAN_ND_ROUTER_ABR_NUMOF (1)
42 #endif
43 
48 #ifndef GNRC_SIXLOWPAN_ND_ROUTER_ABR_PRF_NUMOF
49 /* One prefix per interface */
50 #define GNRC_SIXLOWPAN_ND_ROUTER_ABR_PRF_NUMOF \
51  (GNRC_SIXLOWPAN_ND_ROUTER_ABR_NUMOF * GNRC_NETIF_NUMOF)
52 #endif
53 
62 
66 typedef struct {
68  uint32_t version;
70  uint16_t ltime;
71 #ifdef MODULE_GNRC_SIXLOWPAN_CTX
73 #endif
78 
85 static inline void gnrc_sixlowpan_nd_router_gc_nc(gnrc_ipv6_nc_t *nc_entry)
86 {
87  switch (gnrc_ipv6_nc_get_type(nc_entry)) {
90  gnrc_ipv6_nc_remove(nc_entry->iface, &nc_entry->ipv6_addr);
91  break;
92  default:
93  break;
94  }
95 
96 }
97 
107 static inline void gnrc_sixlowpan_nd_router_set_router(gnrc_ipv6_netif_t *netif, bool enable)
108 {
109  if (enable) {
111  }
112  else {
114  }
115 }
116 
127 
135 
147 
155 
156 #ifdef MODULE_GNRC_SIXLOWPAN_ND_BORDER_ROUTER
157 
170  unsigned int ltime);
171 
187 
196  gnrc_ipv6_netif_t *iface, gnrc_ipv6_netif_addr_t *prefix);
197 
209 
217 #else
218 #define gnrc_sixlowpan_nd_router_abr_create(addr, ltime) (NULL)
219 #endif
220 
221 #ifdef __cplusplus
222 }
223 #endif
224 
225 #endif /* NET_GNRC_SIXLOWPAN_ND_ROUTER_H */
226 
msg_t ltimer_msg
msg_t for gnrc_sixlowpan_nd_router_abr_t::ltimer
uint16_t flags
flags for 6LoWPAN and Neighbor Discovery
Definition: ipv6/netif.h:286
Definition of IPv6 interface type.
Definition: ipv6/netif.h:279
Context buffer definitions.
ipv6_addr_t ipv6_addr
IPv6 address of the neighbor.
Definition: nc.h:126
void gnrc_sixlowpan_nd_router_abr_remove(gnrc_sixlowpan_nd_router_abr_t *abr)
Removes the border router and all the prefixes and contexts it disseminated through the network for t...
bitfields operations on bitfields of arbitrary length
bool gnrc_sixlowpan_nd_router_abr_older(sixlowpan_nd_opt_abr_t *abr_opt)
Checks if the version data abr_opt is older than the version of the currently registered border route...
gnrc_ipv6_netif_t * iface
interface the prefix is registered too
struct gnrc_sixlowpan_nd_router_prf * next
next prefix
Abstract representation of a border router on all (border) routers.
struct gnrc_sixlowpan_nd_router_prf gnrc_sixlowpan_nd_router_prf_t
Representation for prefixes coming from a router.
Authoritative border router option format.
Definition: sixlowpan/nd.h:178
Definitions for IPv6 specific information of network interfaces.
#define GNRC_IPV6_NC_TYPE_TENTATIVE
The entry is temporary.
Definition: nc.h:107
Representation for prefixes coming from a router.
gnrc_ipv6_netif_addr_t * prefix
prefix on the interface/in the prefix list
void gnrc_sixlowpan_nd_router_abr_rem_ctx(gnrc_sixlowpan_nd_router_abr_t *abr, uint8_t cid)
Removes a context from this border router.
void gnrc_ipv6_nc_remove(kernel_pid_t iface, const ipv6_addr_t *ipv6_addr)
Removes a neighbor from the neighbor cache.
ipv6_addr_t addr
the IPv6 address of the border router (BR)
void gnrc_sixlowpan_nd_router_set_rtr_adv(gnrc_ipv6_netif_t *netif, bool enable)
Set/Unset GNRC_IPV6_NETIF_FLAGS_RTR_ADV flag for netif.
gnrc_sixlowpan_nd_router_abr_t * gnrc_sixlowpan_nd_router_abr_get(void)
Get&#39;s the border router for this router.
gnrc_sixlowpan_nd_router_prf_t * prfs
prefixes associated with BR
#define BITFIELD(NAME, SIZE)
Declare a bitfield of a given size.
Definition: bitfield.h:42
Describes a message object which can be sent between threads.
Definition: msg.h:184
static uint8_t gnrc_ipv6_nc_get_type(const gnrc_ipv6_nc_t *entry)
Returns the type of a neighbor cache entry.
Definition: nc.h:252
static void gnrc_sixlowpan_nd_router_set_router(gnrc_ipv6_netif_t *netif, bool enable)
Set netif to router mode.
Type to represent an IPv6 address registered to an interface.
Definition: ipv6/netif.h:243
#define GNRC_SIXLOWPAN_CTX_SIZE
maximum number of entries in context buffer
Definition: ctx.h:38
static void gnrc_sixlowpan_nd_router_gc_nc(gnrc_ipv6_nc_t *nc_entry)
Removes tentetative neighbor cache entries or sets registered ones to garbage-collectible.
kernel_pid_t iface
PID to the interface where the neighbor is.
Definition: nc.h:130
int gnrc_sixlowpan_nd_router_abr_add_prf(gnrc_sixlowpan_nd_router_abr_t *abr, gnrc_ipv6_netif_t *iface, gnrc_ipv6_netif_addr_t *prefix)
Adds a prefix for this border router to manage.
Data type to represent an IPv6 address.
Definition: ipv6/addr.h:74
xtimer_t ltimer
timer for deletion
xtimer timer structure
Definition: xtimer.h:70
gnrc_sixlowpan_nd_router_abr_t * gnrc_sixlowpan_nd_router_abr_create(ipv6_addr_t *addr, unsigned int ltime)
Makes this node a new border router.
Neighbor cache entry as defined in RFC 4861, section 5.1 .
Definition: nc.h:122
int gnrc_sixlowpan_nd_router_abr_add_ctx(gnrc_sixlowpan_nd_router_abr_t *abr, uint8_t cid)
Adds a context for this border router to manage.
uint32_t version
version of the information dissiminated by the BR
void gnrc_sixlowpan_nd_router_abr_rem_prf(gnrc_sixlowpan_nd_router_abr_t *abr, gnrc_ipv6_netif_t *iface, gnrc_ipv6_netif_addr_t *prefix)
Removes a prefix from this border router.
uint16_t ltime
the time in minutes until deletion
#define GNRC_IPV6_NETIF_FLAGS_ROUTER
Flag to indicate that routing is enabled on the interface.
Definition: ipv6/netif.h:176
#define GNRC_IPV6_NC_TYPE_REGISTERED
The entry is registered.
Definition: nc.h:108