_nib-6lr.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_6LR_H
20 #define PRIV_NIB_6LR_H
21 
22 
23 #include "net/gnrc/ipv6/nib/conf.h"
24 #include "net/ndp.h"
25 #include "net/sixlowpan/nd.h"
26 
27 #include "_nib-arsm.h"
28 #include "_nib-6ln.h"
29 #include "_nib-internal.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #if GNRC_IPV6_NIB_CONF_6LR || defined(DOXYGEN)
36 
43 static inline uint16_t _get_ar_state(const _nib_onl_entry_t *entry)
44 {
45  return (entry->info & GNRC_IPV6_NIB_NC_INFO_AR_STATE_MASK);
46 }
47 
54 static inline void _set_ar_state(_nib_onl_entry_t *entry, uint16_t state)
55 {
57  entry->info |= state;
58 }
59 
69 static inline bool _rtr_sol_on_6lr(const gnrc_netif_t *netif,
70  const icmpv6_hdr_t *icmpv6)
71 {
72  return gnrc_netif_is_6lr(netif) && (icmpv6->type == ICMPV6_RTR_SOL);
73 }
74 
93 uint8_t _reg_addr_upstream(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
94  const icmpv6_hdr_t *icmpv6,
95  const sixlowpan_nd_opt_ar_t *aro,
96  const ndp_opt_t *sl2ao, _nib_onl_entry_t *nce);
97 
98 
115  const ndp_nbr_sol_t *nbr_sol,
116  const sixlowpan_nd_opt_ar_t *aro,
117  const ndp_opt_t *sl2ao);
118 
124 void _set_rtr_adv(gnrc_netif_t *netif);
125 #else /* GNRC_IPV6_NIB_CONF_6LR || defined(DOXYGEN) */
126 #define _rtr_sol_on_6lr(netif, icmpv6) (false)
127 #define _get_ar_state(nbr) (_ADDR_REG_STATUS_IGNORE)
128 #define _set_ar_state(nbr, state) (void)nbr; (void)state
129 /* _reg_addr_upstream() doesn't make sense without 6LR so don't even use it
130  * => throw error in case it is compiled in => don't define it here as NOP macro
131  */
132 #define _copy_and_handle_aro(netif, ipv6, icmpv6, aro, sl2ao) \
133  (NULL)
134 #define _set_rtr_adv(netif) (void)netif
135 #endif /* GNRC_IPV6_NIB_CONF_6LR || defined(DOXYGEN) */
136 
137 #ifdef __cplusplus
138 }
139 #endif
140 
141 #endif /* PRIV_NIB_6LR_H */
142 
Address registration option format.
Definition: sixlowpan/nd.h:155
uint8_t _reg_addr_upstream(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)
Registers an address to the (upstream; in case of multihop DAD) router.
Neighbor solicitation message format.
Definition: ndp.h:223
uint8_t type
message type
Definition: icmpv6.h:142
#define ICMPV6_RTR_SOL
NDP router solicitation message.
Definition: icmpv6.h:60
void _set_rtr_adv(gnrc_netif_t *netif)
Sets the GNRC_NETIF_FLAGS_IPV6_RTR_ADV flags of an interface.
gnrc_pktsnip_t * _copy_and_handle_aro(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const ndp_nbr_sol_t *nbr_sol, const sixlowpan_nd_opt_ar_t *aro, const ndp_opt_t *sl2ao)
Handles and copies ARO from NS to NA.
Data type to represent an IPv6 packet header.
Definition: ipv6/hdr.h:68
static void _set_ar_state(_nib_onl_entry_t *entry, uint16_t state)
Sets address registration state of a neighbor.
Definition: _nib-6lr.h:54
uint16_t info
Information flags.
General NDP option format.
Definition: ndp.h:265
On-link NIB entry.
Definition: _nib-internal.h:92
Message type and helper function definitions for 6LoWPAN-ND.
#define GNRC_IPV6_NIB_NC_INFO_AR_STATE_MASK
Mask for 6LoWPAN address registration (6Lo-AR) states.
Definition: nc.h:111
Configuration macro definitions for neighbor information base.
Representation of a network interface.
Definition: netif.h:61
General ICMPv6 message format.
Definition: icmpv6.h:141
Type to represent parts (either headers or payload) of a packet, called snips.
IPv6 neighbor discovery message type definitions.
static bool _rtr_sol_on_6lr(const gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6)
Checks if the received message is a router solicitation and the interface represents a 6Lo router...
Definition: _nib-6lr.h:69
Definitions related to 6Lo node (6LN) functionality of the NIB.
static uint16_t _get_ar_state(const _nib_onl_entry_t *entry)
Gets address registration state of a neighbor.
Definition: _nib-6lr.h:43