1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #11415 from miri64/gnrc_sixlowpan/enh/expose-config

gnrc_sixlowpan: clean-up configuration and expose via config group
This commit is contained in:
Martine Lenders 2019-04-18 16:01:04 +02:00 committed by GitHub
commit ca267fc78e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 123 additions and 66 deletions

View File

@ -138,6 +138,7 @@
#include "kernel_types.h"
#include "net/gnrc/sixlowpan/config.h"
#include "net/gnrc/sixlowpan/frag.h"
#include "net/gnrc/sixlowpan/internal.h"
#include "net/gnrc/sixlowpan/iphc.h"
@ -147,27 +148,6 @@
extern "C" {
#endif
/**
* @brief Default stack size to use for the 6LoWPAN thread.
*/
#ifndef GNRC_SIXLOWPAN_STACK_SIZE
#define GNRC_SIXLOWPAN_STACK_SIZE (THREAD_STACKSIZE_DEFAULT)
#endif
/**
* @brief Default priority for the 6LoWPAN thread.
*/
#ifndef GNRC_SIXLOWPAN_PRIO
#define GNRC_SIXLOWPAN_PRIO (THREAD_PRIORITY_MAIN - 4)
#endif
/**
* @brief Default message queue size to use for the 6LoWPAN thread.
*/
#ifndef GNRC_SIXLOWPAN_MSG_QUEUE_SIZE
#define GNRC_SIXLOWPAN_MSG_QUEUE_SIZE (8U)
#endif
/**
* @brief Initialization of the 6LoWPAN thread.
*

View File

@ -0,0 +1,94 @@
/*
* Copyright (C) 2019 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @defgroup net_gnrc_sixlowpan_config GNRC 6LoWPAN compile configurations
* @ingroup net_gnrc_sixlowpan
* @ingroup config
* @brief
* @{
*
* @file
* @brief Configuration macros for @ref net_gnrc_sixlowpan
*
* @author Martine Lenders <m.lenders@fu-berlin.de>
*/
#ifndef NET_GNRC_SIXLOWPAN_CONFIG_H
#define NET_GNRC_SIXLOWPAN_CONFIG_H
#include "timex.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Default stack size to use for the 6LoWPAN thread.
*/
#ifndef GNRC_SIXLOWPAN_STACK_SIZE
#define GNRC_SIXLOWPAN_STACK_SIZE (THREAD_STACKSIZE_DEFAULT)
#endif
/**
* @brief Default priority for the 6LoWPAN thread.
*/
#ifndef GNRC_SIXLOWPAN_PRIO
#define GNRC_SIXLOWPAN_PRIO (THREAD_PRIORITY_MAIN - 4)
#endif
/**
* @brief Default message queue size to use for the 6LoWPAN thread.
*/
#ifndef GNRC_SIXLOWPAN_MSG_QUEUE_SIZE
#define GNRC_SIXLOWPAN_MSG_QUEUE_SIZE (8U)
#endif
/**
* @brief Size of the reassembly buffer
*
* @note Only applicable with
* [gnrc_sixlowpan_frag](@ref net_gnrc_sixlowpan_frag) module
*/
#ifndef GNRC_SIXLOWPAN_FRAG_RBUF_SIZE
#define GNRC_SIXLOWPAN_FRAG_RBUF_SIZE (4U)
#endif
/**
* @brief Timeout for reassembly buffer entries in microseconds
*
* @note Only applicable with
* [gnrc_sixlowpan_frag](@ref net_gnrc_sixlowpan_frag) module
*/
#ifndef GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_MS
#define GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_MS (3U * US_PER_SEC)
#endif
/**
* @brief Registration lifetime in minutes for the address registration option
*
* This value should be adapted to the devices power-lifecycle so that it is
* greater than the time the device spends sleeping.
*
* @see [RFC 6775, section 5.8.1](https://tools.ietf.org/html/rfc6775#section-5.8.1)
*
* @note Only applicable with [gnrc_ipv6_nib](@ref net_gnrc_ipv6_nib) and
* [gnrc_sixlowpan_nd](@ref net_gnrc_sixlowpan_nd) modules. The first
* provides automatic sending of neighbor solicitations, the latter
* provides capabilities to build the address registration option as a
* @ref gnrc_pktsnip_t
*/
#ifndef GNRC_SIXLOWPAN_ND_AR_LTIME
#define GNRC_SIXLOWPAN_ND_AR_LTIME (15U)
#endif
#ifdef __cplusplus
}
#endif
#endif /* NET_GNRC_SIXLOWPAN_CONFIG_H */
/** @} */

View File

@ -1,43 +0,0 @@
/*
* Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @defgroup net_gnrc_sixlowpan_nd_border_router Border router part of 6LoWPAN-ND
* @ingroup net_gnrc_sixlowpan_nd
* @brief Border router part of 6LoWPAN-ND
* @{
*
* @file
* @brief Border router definitions for 6LoWPAN.
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
#ifndef NET_GNRC_SIXLOWPAN_ND_BORDER_ROUTER_H
#define NET_GNRC_SIXLOWPAN_ND_BORDER_ROUTER_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Default lifetime in minutes for 6LoWPAN border router information.
*
* @see <a href="https://tools.ietf.org/html/rfc6775#section-4.3">
* RFC 6775, section 4.3
* </a>
*/
#ifndef GNRC_SIXLOWPAN_ND_BORDER_ROUTER_DEFAULT_LTIME
#define GNRC_SIXLOWPAN_ND_BORDER_ROUTER_DEFAULT_LTIME (10000U)
#endif
#ifdef __cplusplus
}
#endif
#endif /* NET_GNRC_SIXLOWPAN_ND_BORDER_ROUTER_H */
/** @} */

View File

@ -25,14 +25,20 @@
#include "net/gnrc/netif/hdr.h"
#include "net/gnrc/pkt.h"
#include "net/gnrc/sixlowpan/config.h"
#include "net/gnrc/sixlowpan/frag.h"
#ifdef __cplusplus
extern "C" {
#endif
#define RBUF_SIZE (4U) /**< size of the reassembly buffer */
#define RBUF_TIMEOUT (3U * US_PER_SEC) /**< timeout for reassembly in microseconds */
/**
* @name Legacy defines
* @{
*/
#define RBUF_SIZE (GNRC_SIXLOWPAN_FRAG_RBUF_SIZE)
#define RBUF_TIMEOUT (GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_MS)
/** @} */
/**
* @brief Fragment intervals to identify limits of fragments.
@ -90,8 +96,28 @@ void rbuf_add(gnrc_netif_hdr_t *netif_hdr, gnrc_pktsnip_t *frag,
*/
void rbuf_gc(void);
/**
* @brief Unsets a reassembly buffer entry (but does not free
* rbuf_t::super::pkt)
*
* This functions sets rbuf_t::super::pkt to NULL and removes all rbuf::ints.
*
* @param[in] rbuf A reassembly buffer entry
*
* @internal
*/
void rbuf_rm(rbuf_t *rbuf);
/**
* @brief Checks if a reassembly buffer entry is unset
*
* @param[in] rbuf A reassembly buffer entry
*
* @return true, if @p rbuf is empty (i.e. rbuf->super.pkt is NULL).
* @return false, if @p rbuf is in use.
*
* @internal
*/
static inline bool rbuf_entry_empty(const rbuf_t *rbuf) {
return (rbuf->super.pkt == NULL);
}