_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 #include <kernel_defines.h>
23 
24 #include "net/gnrc/ipv6/nib/conf.h"
25 #include "net/ndp.h"
26 #include "net/sixlowpan/nd.h"
27 
28 #include "_nib-arsm.h"
29 #include "_nib-6ln.h"
30 #include "_nib-internal.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) || defined(DOXYGEN)
44 static inline uint16_t _get_ar_state(const _nib_onl_entry_t *entry)
45 {
46  return (entry->info & GNRC_IPV6_NIB_NC_INFO_AR_STATE_MASK);
47 }
48 
55 static inline void _set_ar_state(_nib_onl_entry_t *entry, uint16_t state)
56 {
58  entry->info |= state;
59 }
60 
70 static inline bool _rtr_sol_on_6lr(const gnrc_netif_t *netif,
71  const icmpv6_hdr_t *icmpv6)
72 {
73  (void)netif; /* gnrc_netif_is_6lr() might just evaluate to false */
74  return gnrc_netif_is_6lr(netif) && (icmpv6->type == ICMPV6_RTR_SOL);
75 }
76 
95 uint8_t _reg_addr_upstream(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
96  const icmpv6_hdr_t *icmpv6,
97  const sixlowpan_nd_opt_ar_t *aro,
98  const ndp_opt_t *sl2ao, _nib_onl_entry_t *nce);
99 
116  const ndp_nbr_sol_t *nbr_sol,
117  const sixlowpan_nd_opt_ar_t *aro,
118  const ndp_opt_t *sl2ao);
119 
120 #else /* CONFIG_GNRC_IPV6_NIB_6LR || defined(DOXYGEN) */
121 #define _rtr_sol_on_6lr(netif, icmpv6) (false)
122 #define _get_ar_state(nbr) (_ADDR_REG_STATUS_IGNORE)
123 #define _set_ar_state(nbr, state) (void)nbr; (void)state
124 /* _reg_addr_upstream() doesn't make sense without 6LR so don't even use it
125  * => throw error in case it is compiled in => don't define it here as NOP macro
126  */
127 #define _copy_and_handle_aro(netif, ipv6, icmpv6, aro, sl2ao) \
128  (NULL)
129 #endif /* CONFIG_GNRC_IPV6_NIB_6LR || defined(DOXYGEN) */
130 
131 #ifdef __cplusplus
132 }
133 #endif
134 
135 #endif /* PRIV_NIB_6LR_H */
Definitions related to 6Lo node (6LN) functionality of the NIB.
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:70
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.
static uint16_t _get_ar_state(const _nib_onl_entry_t *entry)
Gets address registration state of a neighbor.
Definition: _nib-6lr.h:44
static void _set_ar_state(_nib_onl_entry_t *entry, uint16_t state)
Sets address registration state of a neighbor.
Definition: _nib-6lr.h:55
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.
#define GNRC_IPV6_NIB_NC_INFO_AR_STATE_MASK
Mask for 6LoWPAN address registration (6Lo-AR) states.
Definition: nc.h:111
#define ICMPV6_RTR_SOL
NDP router solicitation message.
Definition: icmpv6.h:60
Configuration macro definitions for neighbor information base.
Common macros and compiler attributes/pragmas configuration.
IPv6 neighbor discovery message type definitions.
Message type and helper function definitions for 6LoWPAN-ND.
On-link NIB entry .
Definition: _nib-internal.h:94
uint16_t info
Information flags.
Representation of a network interface.
Definition: netif.h:135
Type to represent parts (either headers or payload) of a packet, called snips.
Definition: pkt.h:108
General ICMPv6 message format.
Definition: icmpv6.h:138
uint8_t type
message type
Definition: icmpv6.h:139
Data type to represent an IPv6 packet header.
Definition: hdr.h:66
Neighbor solicitation message format.
Definition: ndp.h:256
General NDP option format.
Definition: ndp.h:298
Address registration option format.
Definition: nd.h:158