_nib-6ln.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Freie Universität Berlin
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 
19 #ifndef PRIV_NIB_6LN_H
20 #define PRIV_NIB_6LN_H
21 
22 #include <kernel_defines.h>
23 #include <stdint.h>
24 
25 #include "net/gnrc/ipv6/nib/conf.h"
26 #include "net/sixlowpan/nd.h"
27 #include "timex.h"
28 #include "evtimer.h"
29 
30 #include "_nib-arsm.h"
31 #include "_nib-internal.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
41 #define _ADDR_REG_STATUS_TENTATIVE (3)
42 
47 #define _ADDR_REG_STATUS_IGNORE (4)
48 
57 #define _ADDR_REG_STATUS_UNAVAIL (255)
58 
59 #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) || defined(DOXYGEN)
71  gnrc_ipv6_nib_nc_t *nce);
72 
82 static inline uint32_t _get_next_rs_interval(const gnrc_netif_t *netif)
83 {
84  if (gnrc_netif_is_6ln(netif)) {
85  if (netif->ipv6.rs_sent < SIXLOWPAN_ND_MAX_RS_NUMOF) {
87  }
88  else {
89  unsigned exp = netif->ipv6.rs_sent - SIXLOWPAN_ND_MAX_RS_NUMOF;
90  uint32_t tmp = SIXLOWPAN_ND_RS_MSEC_INTERVAL +
91  ((1 << exp) * (NDP_RS_MS_INTERVAL));
92 
95  }
96  return tmp;
97  }
98  }
99  else {
100  return NDP_RS_MS_INTERVAL;
101  }
102 }
103 
117 uint8_t _handle_aro(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
118  const icmpv6_hdr_t *icmpv6,
119  const sixlowpan_nd_opt_ar_t *aro, const ndp_opt_t *sl2ao,
120  _nib_onl_entry_t *nce);
121 
128 
129 #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) || defined(DOXYGEN)
130 _nib_abr_entry_t *_handle_abro(const sixlowpan_nd_opt_abr_t *abro);
131 uint32_t _handle_6co(const icmpv6_hdr_t *icmpv6,
132  const sixlowpan_nd_opt_6ctx_t *sixco,
133  _nib_abr_entry_t *abr);
134 #else /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C || defined(DOXYGEN) */
135 uint32_t _handle_6co(const icmpv6_hdr_t *icmpv6,
136  const sixlowpan_nd_opt_6ctx_t *sixco);
137 #endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C || defined(DOXYGEN) */
138 #else /* CONFIG_GNRC_IPV6_NIB_6LN || defined(DOXYGEN) */
139 #define _resolve_addr_from_ipv6(dst, netif, nce) (false)
140 /* _handle_aro() doesn't make sense without 6LR so don't even use it
141  * => throw error in case it is compiled in => don't define it here as NOP macro
142  */
143 #define _get_next_rs_interval(netif) (NDP_RS_MS_INTERVAL)
144 #define _handle_rereg_address(netif) (void)netif
145 #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) || defined(DOXYGEN)
146 #define _handle_abro(abro) (NULL)
147 #define _handle_6co(icmpv6, sixco, abr) (UINT32_MAX)
148 #else /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C || defined(DOXYGEN) */
149 #define _handle_6co(icmpv6, sixco) (UINT32_MAX)
150 #endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C || defined(DOXYGEN) */
151 #endif /* CONFIG_GNRC_IPV6_NIB_6LN || defined(DOXYGEN) */
152 
153 #ifdef __cplusplus
154 }
155 #endif
156 
157 #endif /* PRIV_NIB_6LN_H */
uint8_t _handle_aro(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const icmpv6_hdr_t *icmpv6, const sixlowpan_nd_opt_ar_t *aro, const ndp_opt_t *sl2ao, _nib_onl_entry_t *nce)
Handles ARO.
bool _resolve_addr_from_ipv6(const ipv6_addr_t *dst, gnrc_netif_t *netif, gnrc_ipv6_nib_nc_t *nce)
Resolves address statically from destination address using reverse translation of the IID.
void _handle_rereg_address(const ipv6_addr_t *addr)
Handler for GNRC_IPV6_NIB_REREG_ADDRESS event handler.
static uint32_t _get_next_rs_interval(const gnrc_netif_t *netif)
Calculates exponential backoff for RS retransmissions.
Definition: _nib-6ln.h:82
evtimer API definitions
#define NDP_RS_MS_INTERVAL
RTR_SOLICITATION_INTERVAL (in ms)
Definition: ndp.h:164
#define SIXLOWPAN_ND_MAX_RS_SEC_INTERVAL
MAX_RTR_SOLICITATIONS_INTERVAL (in seconds)
Definition: nd.h:132
#define SIXLOWPAN_ND_MAX_RS_NUMOF
MAX_RTR_SOLICITATIONS.
Definition: nd.h:128
#define SIXLOWPAN_ND_RS_MSEC_INTERVAL
RTR_SOLICITATION_INTERVAL (in msec)
Definition: nd.h:127
#define MS_PER_SEC
The number of milliseconds per second.
Definition: time_units.h:75
Configuration macro definitions for neighbor information base.
Common macros and compiler attributes/pragmas configuration.
Message type and helper function definitions for 6LoWPAN-ND.
Internal NIB-representation of the authoritative border router for multihop prefix and 6LoWPAN contex...
On-link NIB entry .
Definition: _nib-internal.h:94
Neighbor cache entry view on NIB.
Definition: nc.h:142
uint8_t rs_sent
number of unsolicited router solicitations scheduled
Definition: ipv6.h:235
Representation of a network interface.
Definition: netif.h:135
gnrc_netif_ipv6_t ipv6
IPv6 component.
Definition: netif.h:147
General ICMPv6 message format.
Definition: icmpv6.h:138
Data type to represent an IPv6 packet header.
Definition: hdr.h:66
General NDP option format.
Definition: ndp.h:298
6LoWPAN context option format
Definition: nd.h:174
Authoritative border router option format.
Definition: nd.h:189
Address registration option format.
Definition: nd.h:158
Utility library for comparing and computing timestamps.
Data type to represent an IPv6 address.
Definition: addr.h:72