netif/internal.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 NET_GNRC_NETIF_INTERNAL_H
22 #define NET_GNRC_NETIF_INTERNAL_H
23 
24 #include "net/gnrc/netif.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
33 #define NETDEV_MSG_TYPE_EVENT (0x1234)
34 
42 void gnrc_netif_acquire(gnrc_netif_t *netif);
43 
51 void gnrc_netif_release(gnrc_netif_t *netif);
52 
53 #if defined(MODULE_GNRC_IPV6) || DOXYGEN
54 
88 int gnrc_netif_ipv6_addr_add(gnrc_netif_t *netif, const ipv6_addr_t *addr,
89  unsigned pfx_len, uint8_t flags);
90 
101 void gnrc_netif_ipv6_addr_remove(gnrc_netif_t *netif,
102  const ipv6_addr_t *addr);
103 
104 
121 int gnrc_netif_ipv6_addr_idx(gnrc_netif_t *netif,
122  const ipv6_addr_t *addr);
123 
132 static inline uint8_t gnrc_netif_ipv6_addr_get_state(const gnrc_netif_t *netif,
133  int idx)
134 {
136 }
137 
148 static inline uint8_t gnrc_netif_ipv6_addr_dad_trans(const gnrc_netif_t *netif,
149  int idx)
150 {
152 }
153 
172 int gnrc_netif_ipv6_addr_match(gnrc_netif_t *netif,
173  const ipv6_addr_t *addr);
174 
201 ipv6_addr_t *gnrc_netif_ipv6_addr_best_src(gnrc_netif_t *netif,
202  const ipv6_addr_t *dst,
203  bool ll_only);
204 
216 gnrc_netif_t *gnrc_netif_get_by_ipv6_addr(const ipv6_addr_t *addr);
217 
227 gnrc_netif_t *gnrc_netif_get_by_prefix(const ipv6_addr_t *prefix);
228 
243 int gnrc_netif_ipv6_group_join(gnrc_netif_t *netif,
244  const ipv6_addr_t *addr);
245 
256 void gnrc_netif_ipv6_group_leave(gnrc_netif_t *netif,
257  const ipv6_addr_t *addr);
258 
275 int gnrc_netif_ipv6_group_idx(gnrc_netif_t *netif,
276  const ipv6_addr_t *addr);
277 
288 int gnrc_netif_ipv6_get_iid(gnrc_netif_t *netif, eui64_t *eui64);
289 #endif /* MODULE_GNRC_IPV6 */
290 
303 static inline bool gnrc_netif_is_rtr(const gnrc_netif_t *netif)
304 {
305  return (netif->flags & GNRC_NETIF_FLAGS_IPV6_FORWARDING);
306 }
307 
319 static inline bool gnrc_netif_is_rtr_adv(const gnrc_netif_t *netif)
320 {
321  return (netif->flags & GNRC_NETIF_FLAGS_IPV6_RTR_ADV);
322 }
323 
337 bool gnrc_netif_is_6ln(const gnrc_netif_t *netif);
338 
352 static inline bool gnrc_netif_is_6lr(const gnrc_netif_t *netif)
353 {
354  return gnrc_netif_is_rtr(netif) && gnrc_netif_is_6ln(netif);
355 }
356 
370 static inline bool gnrc_netif_is_6lbr(const gnrc_netif_t *netif)
371 {
372  return (netif->flags & GNRC_NETIF_FLAGS_6LO_ABR) &&
373  gnrc_netif_is_6lr(netif);
374 }
375 
376 #ifdef __cplusplus
377 }
378 #endif
379 
380 #endif /* NET_GNRC_NETIF_INTERNAL_H */
381 
#define GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_TENTATIVE
Tentative states (with encoded DAD retransmissions)
uint32_t flags
Flags for the interface.
Definition: netif.h:76
#define GNRC_NETIF_FLAGS_6LO_ABR
This interface acts as a 6Lo border router to the LLN.
Definition: flags.h:103
#define GNRC_NETIF_FLAGS_IPV6_RTR_ADV
Network interface advertises itself as an IPv6 router (implies GNRC_NETIF_FLAGS_IPV6_FORWARDING to be...
Definition: flags.h:58
Definition for GNRC's network interfaces.
gnrc_netif_ipv6_t ipv6
IPv6 component.
Definition: netif.h:66
#define GNRC_NETIF_FLAGS_IPV6_FORWARDING
Network interface is enabled for IPv6 forwarding.
Definition: flags.h:52
uint8_t addrs_flags[GNRC_NETIF_IPV6_ADDRS_NUMOF]
Flags for gnrc_netif_t::ipv6_addrs.
Representation of a network interface.
Definition: netif.h:61
#define GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_MASK
Mask for the address' state.
Data type to represent an IPv6 address.
Definition: ipv6/addr.h:74
Data type to represent an EUI-64.
Definition: eui64.h:37