Loading...
Searching...
No Matches
_nib-arsm.h
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
21#ifndef PRIV_NIB_ARSM_H
22#define PRIV_NIB_ARSM_H
23
24#include <kernel_defines.h>
25#include <stdint.h>
26
28#include "net/gnrc/netif.h"
29#include "net/ndp.h"
30#include "net/icmpv6.h"
31#include "net/ipv6/hdr.h"
32
33#include "_nib-internal.h"
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
53void _snd_ns(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
54 const ipv6_addr_t *src, const ipv6_addr_t *dst);
55
68void _snd_uc_ns(_nib_onl_entry_t *nbr, bool reset);
69
83void _handle_sl2ao(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
84 const icmpv6_hdr_t *icmpv6, const ndp_opt_t *sl2ao);
85
105static inline uint32_t _exp_backoff_retrans_timer_factor(uint8_t ns_sent,
106 uint32_t retrans_timer,
107 uint32_t factor)
108{
109 assert(NDP_MIN_RANDOM_FACTOR <= factor);
111 assert(ns_sent <= NDP_MAX_NS_NUMOF);
112 /* backoff according to https://tools.ietf.org/html/rfc7048 with
113 * BACKOFF_MULTIPLE == 2 */
114 uint32_t res = (uint32_t)(((uint64_t)(((uint32_t) 1) << ns_sent) *
115 retrans_timer * factor) / US_PER_MS);
116 /* random factors were statically multiplied with 1000 */
117 if (res > NDP_MAX_RETRANS_TIMER_MS) {
119 }
120 return res;
121}
122
123#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) || defined(DOXYGEN)
130void _handle_snd_ns(_nib_onl_entry_t *nbr);
131
138void _handle_state_timeout(_nib_onl_entry_t *nbr);
139
146void _probe_nbr(_nib_onl_entry_t *nbr, bool reset);
147
163void _handle_adv_l2(gnrc_netif_t *netif, _nib_onl_entry_t *nce,
164 const icmpv6_hdr_t *icmpv6, const ndp_opt_t *tl2ao);
165
174void _recalc_reach_time(gnrc_netif_ipv6_t *netif);
175
183void _set_reachable(gnrc_netif_t *netif, _nib_onl_entry_t *nce);
184
190static inline void _init_iface_arsm(gnrc_netif_t *netif)
191{
193 _recalc_reach_time(&netif->ipv6);
194}
195
201static inline void _deinit_iface_arsm(gnrc_netif_t *netif)
202{
203 _evtimer_del(&netif->ipv6.recalc_reach_time);
204}
205
213static inline uint16_t _get_nud_state(_nib_onl_entry_t *nbr)
214{
216}
217
226void _set_nud_state(gnrc_netif_t *netif, _nib_onl_entry_t *nbr,
227 uint16_t state);
228
239bool _is_reachable(_nib_onl_entry_t *entry);
240#else /* CONFIG_GNRC_IPV6_NIB_ARSM || defined(DOXYGEN) */
241#define _handle_snd_ns(ctx) (void)ctx
242#define _handle_state_timeout(ctx) (void)ctx
243#define _probe_nbr(nbr, reset) (void)nbr; (void)reset
244#define _init_iface_arsm(netif) (void)netif
245#define _deinit_iface_arsm(netif) (void)netif
246#define _handle_adv_l2(netif, nce, icmpv6, tl2ao) (void)netif; (void)nce; \
247 (void)icmpv6; (void)tl2ao
248#define _recalc_reach_time(netif) (void)netif
249#define _set_reachable(netif, nce) (void)netif; (void)nce
250
251#define _get_nud_state(nbr) (GNRC_IPV6_NIB_NC_INFO_NUD_STATE_UNMANAGED)
252#define _set_nud_state(netif, nce, state) (void)netif; (void)nce; (void)state
253#define _is_reachable(entry) (true)
254#endif /* CONFIG_GNRC_IPV6_NIB_ARSM || defined(DOXYGEN) */
255
256#ifdef __cplusplus
257}
258#endif
259
260#endif /* PRIV_NIB_ARSM_H */
#define assert(cond)
abort the program if assertion is false
Definition assert.h:137
Definition for GNRC's network interfaces.
#define GNRC_IPV6_NIB_NC_INFO_NUD_STATE_MASK
Mask for neighbor unreachability detection (NUD) states.
Definition nc.h:47
void _snd_ns(const ipv6_addr_t *tgt, gnrc_netif_t *netif, const ipv6_addr_t *src, const ipv6_addr_t *dst)
Sends neighbor solicitation (including ARO if required)
#define NDP_MAX_RETRANS_TIMER_MS
MAX_RETRANS_TIMER (in ms)
Definition ndp.h:193
#define NDP_REACH_MS
REACHABLE_TIME (in ms)
Definition ndp.h:186
#define NDP_MAX_NS_NUMOF
Maximum retransmission of neighbor solicitations when UNREACHABLE.
Definition ndp.h:202
#define NDP_MAX_RANDOM_FACTOR
MAX_RANDOM_FACTOR (x 1000)
Definition ndp.h:205
#define NDP_MIN_RANDOM_FACTOR
MIN_RANDOM_FACTOR (x 1000)
Definition ndp.h:204
#define US_PER_MS
The number of microseconds per millisecond.
Definition time_units.h:90
ICMPv6 type and function definitions.
Configuration macro definitions for neighbor information base.
Common macros and compiler attributes/pragmas configuration.
IPv6 neighbor discovery message type definitions.
IPv6 header type and helper function definitions.
On-link NIB entry .
uint16_t info
Information flags.
IPv6 component for gnrc_netif_t.
Definition ipv6.h:78
evtimer_msg_event_t recalc_reach_time
Event for GNRC_IPV6_NIB_RECALC_REACH_TIME.
Definition ipv6.h:145
uint32_t reach_time_base
Base for random reachable time calculation and advertised reachable time in ms (if GNRC_NETIF_FLAGS_I...
Definition ipv6.h:189
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
Data type to represent an IPv6 address.
Definition addr.h:72