Loading...
Searching...
No Matches
abr.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
21#ifndef NET_GNRC_IPV6_NIB_ABR_H
22#define NET_GNRC_IPV6_NIB_ABR_H
23
24#include "modules.h"
25
26/* prevent cascading include error to xtimer if it is not compiled in or not
27 * supported by board */
28#if IS_USED(MODULE_EVTIMER)
29#include "timex.h"
30#include "evtimer.h"
31#endif
32#include "net/ipv6/addr.h"
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
42typedef struct {
44 uint32_t version;
45 uint32_t valid_until_ms;
48
49#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) || defined(DOXYGEN)
50#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR) || defined(DOXYGEN)
62
69#else /* CONFIG_GNRC_IPV6_NIB_6LBR || defined(DOXYGEN) */
70#define gnrc_ipv6_nib_abr_add(addr) (-ENOTSUP)
71#define gnrc_ipv6_nib_abr_del(addr) (void)(addr)
72#endif /* CONFIG_GNRC_IPV6_NIB_6LBR || defined(DOXYGEN) */
73
107
108#if IS_USED(MODULE_EVTIMER) || defined(DOXYGEN)
118static inline uint32_t gnrc_ipv6_nib_abr_valid_offset(const gnrc_ipv6_nib_abr_t *abr)
119{
120 return (abr->valid_until_ms - evtimer_now_msec()) / ( MS_PER_SEC * SEC_PER_MIN);
121}
122#endif
123
132#else /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C || defined(DOXYGEN) */
133#define gnrc_ipv6_nib_abr_add(addr) (-ENOTSUP)
134#define gnrc_ipv6_nib_abr_del(addr) (void)(addr)
135#define gnrc_ipv6_nib_abr_iter(state, abr) (false)
136#define gnrc_ipv6_nib_abr_print(abr) (void)(abr)
137#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C || defined(DOXYGEN) */
138
139#ifdef __cplusplus
140}
141#endif
142
143#endif /* NET_GNRC_IPV6_NIB_ABR_H */
evtimer API definitions
bool gnrc_ipv6_nib_abr_iter(void **state, gnrc_ipv6_nib_abr_t *abr)
Iterates over all authoritative border router in the NIB.
int gnrc_ipv6_nib_abr_add(const ipv6_addr_t *addr)
Adds the address of an authoritative border router to the NIB.
static uint32_t gnrc_ipv6_nib_abr_valid_offset(const gnrc_ipv6_nib_abr_t *abr)
Provides the time in minutes for which the authoritative border router entry is valid.
Definition abr.h:118
void gnrc_ipv6_nib_abr_del(const ipv6_addr_t *addr)
Removes an authoritative border router from the NIB.
void gnrc_ipv6_nib_abr_print(gnrc_ipv6_nib_abr_t *abr)
Prints an authoritative border router list entry.
static uint32_t evtimer_now_msec(void)
Return the current system time in msec.
Definition evtimer.h:115
#define MS_PER_SEC
The number of milliseconds per second.
Definition time_units.h:75
#define SEC_PER_MIN
The number of seconds per minute.
Definition time_units.h:65
Definitions for IPv6 addresses.
Configuration macro definitions for neighbor information base.
Common macros and compiler attributes/pragmas configuration.
Authoritative border router list entry view on NIB.
Definition abr.h:42
uint32_t valid_until_ms
timestamp (in ms) until which the information is valid (needs resolution in minutes an 16 bits of the...
Definition abr.h:45
uint32_t version
last received version
Definition abr.h:44
ipv6_addr_t addr
The address of the border router.
Definition abr.h:43
Utility library for comparing and computing timestamps.
Data type to represent an IPv6 address.
Definition addr.h:72