mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-15 09:33:50 +01:00
164 lines
4.0 KiB
C
164 lines
4.0 KiB
C
/*
|
|
* Copyright (C) 2024-2025 Carl Seifert
|
|
* Copyright (C) 2024-2025 TU Dresden
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <assert.h>
|
|
|
|
#include "modules.h"
|
|
|
|
/**
|
|
* @defgroup net_unicoap_config unicoap Compile-Time Configuration
|
|
* @ingroup net_unicoap
|
|
* @ingroup config
|
|
* @brief Customize limits and capabilities of unicoap
|
|
* @{
|
|
*/
|
|
|
|
/**
|
|
* @file
|
|
* @brief Compile-time configuration parameters
|
|
* @author Carl Seifert <carl.seifert1@mailbox.tu-dresden.de>
|
|
*/
|
|
|
|
/* MARK: - Essentials */
|
|
/**
|
|
* @name Essentials
|
|
* @{
|
|
*/
|
|
/**
|
|
* @brief Enables debug logging in all `unicoap` source files, except where locally overwritten
|
|
*
|
|
* **Default**: enabled
|
|
*/
|
|
#if !defined(CONFIG_UNICOAP_DEBUG_LOGGING) || defined(DOXYGEN)
|
|
# define CONFIG_UNICOAP_DEBUG_LOGGING 0
|
|
#endif
|
|
/** @} */
|
|
|
|
/* MARK: - Limits */
|
|
/**
|
|
* @name Limits
|
|
* @{
|
|
*/
|
|
/**
|
|
* @brief Maximum number of options that can be present in a request or response
|
|
*
|
|
* **Default**: 16 options
|
|
*/
|
|
#if !defined(CONFIG_UNICOAP_OPTIONS_MAX) || defined(DOXYGEN)
|
|
# define CONFIG_UNICOAP_OPTIONS_MAX (16)
|
|
#endif
|
|
|
|
/**
|
|
* @brief Default buffer capacity unicoap chooses when you invoke @ref UNICOAP_OPTIONS_ALLOC_DEFAULT
|
|
*
|
|
* Options are stored in a contiguous memory region according to the format specified in
|
|
* [RFC 7252, Section 3.1](https://datatracker.ietf.org/doc/html/rfc7252#section-3.1).
|
|
* This parameter does not affect @ref UNICOAP_OPTIONS_ALLOC.
|
|
*
|
|
* **Default**: 32 bytes
|
|
*/
|
|
#if !defined(CONFIG_UNICOAP_OPTIONS_BUFFER_DEFAULT_CAPACITY) || defined(DOXYGEN)
|
|
# define CONFIG_UNICOAP_OPTIONS_BUFFER_DEFAULT_CAPACITY (32)
|
|
#endif
|
|
|
|
/**
|
|
* @brief Size of buffer unicoap allocates for a CoAP message header,
|
|
* including token length.
|
|
*/
|
|
#define UNICOAP_HEADER_SIZE_MAX (15)
|
|
/* MARK: unicoap_driver_extension_point */
|
|
/* Developer note: If you are adding another CoAP driver, you may need to increase this value. */
|
|
|
|
/**
|
|
* @brief Maximum length of a token received from a client
|
|
*
|
|
* **Default**: 8 bytes
|
|
*/
|
|
#if !defined(CONFIG_UNICOAP_EXTERNAL_TOKEN_LENGTH_MAX) || defined(DOXYGEN)
|
|
# define CONFIG_UNICOAP_EXTERNAL_TOKEN_LENGTH_MAX (8)
|
|
#endif
|
|
|
|
static_assert(CONFIG_UNICOAP_EXTERNAL_TOKEN_LENGTH_MAX > 0,
|
|
"CONFIG_UNICOAP_EXTERNAL_TOKEN_LENGTH_MAX must not be zero");
|
|
|
|
/**
|
|
* @brief Length of tokens generated by the unicoap client API
|
|
*
|
|
* **Default**: 2 bytes
|
|
*/
|
|
#if !defined(CONFIG_UNICOAP_GENERATED_TOKEN_LENGTH) || defined(DOXYGEN)
|
|
# define CONFIG_UNICOAP_GENERATED_TOKEN_LENGTH (2)
|
|
#endif
|
|
|
|
static_assert(CONFIG_UNICOAP_GENERATED_TOKEN_LENGTH > 0,
|
|
"CONFIG_UNICOAP_GENERATED_TOKEN_LENGTH must not be zero");
|
|
|
|
/**
|
|
* @brief Numbers of bits needed to represent a given ETag's length
|
|
*/
|
|
#define UNICOAP_ETAG_LENGTH_FIXED_WIDTH 4
|
|
/** @} */
|
|
|
|
/* MARK: - Timing */
|
|
/**
|
|
* @name Timing
|
|
*
|
|
* These parameters are defined as being configurable in [RFC 7252, section 4.8.1]
|
|
* (https://tools.ietf.org/html/rfc7252#section-4.8.1).
|
|
* @{
|
|
*/
|
|
|
|
/**
|
|
* @brief `NSTART` constant for multicast delay calculation
|
|
*/
|
|
#define UNICOAP_NSTART (1)
|
|
|
|
/**
|
|
* @brief `DEFAULT_LEISURE` constant for multicast delay calculation
|
|
*/
|
|
#define UNICOAP_DEFAULT_LEISURE (5)
|
|
/** @} */
|
|
|
|
/* MARK: - Resource observation */
|
|
/**
|
|
* @name Resource observation
|
|
* @{
|
|
*/
|
|
/**
|
|
* @brief Width in bytes of the Observe option value for a notification
|
|
*
|
|
* **Maximum allowed value**: 3 bytes
|
|
*/
|
|
#if !defined(CONFIG_UNICOAP_OBSERVE_VALUE_WIDTH) || defined(DOXYGEN)
|
|
# define CONFIG_UNICOAP_OBSERVE_VALUE_WIDTH (3)
|
|
#endif
|
|
|
|
/**
|
|
* @brief See @ref CONFIG_UNICOAP_OBSERVE_VALUE_WIDTH
|
|
*/
|
|
#if (CONFIG_UNICOAP_OBSERVE_VALUE_WIDTH == 3)
|
|
# define UNICOAP_OBS_TICK_EXPONENT (0)
|
|
#elif (CONFIG_UNICOAP_OBSERVE_VALUE_WIDTH == 2)
|
|
# define UNICOAP_OBS_TICK_EXPONENT (6)
|
|
#elif (CONFIG_UNICOAP_OBSERVE_VALUE_WIDTH == 1)
|
|
# define UNICOAP_OBS_TICK_EXPONENT (14)
|
|
#else
|
|
# error CONFIG_UNICOAP_OBSERVE_VALUE_WIDTH must not exceed 3
|
|
#endif
|
|
/** @} */
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
}
|
|
#endif
|
|
|
|
/** @} */
|