gnrc_ipv6_nib: provide functions to get offset of public timestamps
This commit is contained in:
parent
91fe57a4d1
commit
c33e40cce1
@ -23,6 +23,11 @@
|
|||||||
|
|
||||||
#include <kernel_defines.h>
|
#include <kernel_defines.h>
|
||||||
|
|
||||||
|
/* prevent cascading include error to xtimer if it is not compiled in or not
|
||||||
|
* supported by board */
|
||||||
|
#if IS_USED(MODULE_EVTIMER)
|
||||||
|
#include "evtimer.h"
|
||||||
|
#endif
|
||||||
#include "net/ipv6/addr.h"
|
#include "net/ipv6/addr.h"
|
||||||
#include "net/gnrc/ipv6/nib/conf.h"
|
#include "net/gnrc/ipv6/nib/conf.h"
|
||||||
|
|
||||||
@ -99,6 +104,22 @@ void gnrc_ipv6_nib_abr_del(const ipv6_addr_t *addr);
|
|||||||
*/
|
*/
|
||||||
bool gnrc_ipv6_nib_abr_iter(void **state, gnrc_ipv6_nib_abr_t *abr);
|
bool gnrc_ipv6_nib_abr_iter(void **state, gnrc_ipv6_nib_abr_t *abr);
|
||||||
|
|
||||||
|
#if IS_USED(MODULE_EVTIMER) || defined(DOXYGEN)
|
||||||
|
/**
|
||||||
|
* @brief Provides the time in minutes for which the authoritative border
|
||||||
|
* router entry is valid
|
||||||
|
*
|
||||||
|
* @param[in] abr An authoritative border router entry.
|
||||||
|
*
|
||||||
|
* @return The time in minutes for which the authoritative border router entry
|
||||||
|
* is valid.
|
||||||
|
*/
|
||||||
|
static inline uint32_t gnrc_ipv6_nib_abr_valid_offset(const gnrc_ipv6_nib_abr_t *abr)
|
||||||
|
{
|
||||||
|
return abr->valid_until - evtimer_now_min();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Prints an authoritative border router list entry
|
* @brief Prints an authoritative border router list entry
|
||||||
*
|
*
|
||||||
|
|||||||
@ -22,6 +22,9 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#if IS_USED(MODULE_EVTIMER)
|
||||||
|
#include "evtimer.h"
|
||||||
|
#endif
|
||||||
#include "net/ipv6/addr.h"
|
#include "net/ipv6/addr.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -122,6 +125,45 @@ void gnrc_ipv6_nib_pl_del(unsigned iface,
|
|||||||
bool gnrc_ipv6_nib_pl_iter(unsigned iface, void **state,
|
bool gnrc_ipv6_nib_pl_iter(unsigned iface, void **state,
|
||||||
gnrc_ipv6_nib_pl_t *ple);
|
gnrc_ipv6_nib_pl_t *ple);
|
||||||
|
|
||||||
|
#if IS_USED(MODULE_EVTIMER) || defined(DOXYGEN)
|
||||||
|
/**
|
||||||
|
* @brief Provides the time in milliseconds for which the prefix list
|
||||||
|
* entry is valid
|
||||||
|
*
|
||||||
|
* @param[in] ple A prefix list entry.
|
||||||
|
*
|
||||||
|
* @return The time in milliseconds for which the prefix list entry is valid.
|
||||||
|
* UINT32_MAX if it is valid forever.
|
||||||
|
*/
|
||||||
|
static inline uint32_t gnrc_ipv6_nib_pl_valid_offset(const gnrc_ipv6_nib_pl_t *ple)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (ple->valid_until == UINT32_MAX)
|
||||||
|
? UINT32_MAX
|
||||||
|
: (ple->valid_until - evtimer_now_msec());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Provides the time in milliseconds for which the prefix list
|
||||||
|
* entry is preferred
|
||||||
|
*
|
||||||
|
* A prefix for which the preference expired is deprecated (see [RFC 4862]
|
||||||
|
* (https://tools.ietf.org/html/rfc4862))
|
||||||
|
*
|
||||||
|
* @param[in] ple A prefix list entry.
|
||||||
|
*
|
||||||
|
* @return The time in milliseconds for which the prefix list entry is
|
||||||
|
* preferred. UINT32_MAX if it is preferred forever.
|
||||||
|
*/
|
||||||
|
static inline uint32_t gnrc_ipv6_nib_pl_pref_offset(const gnrc_ipv6_nib_pl_t *ple)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (ple->pref_until == UINT32_MAX)
|
||||||
|
? UINT32_MAX
|
||||||
|
: (ple->pref_until - evtimer_now_msec());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Prints a prefix list entry
|
* @brief Prints a prefix list entry
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user