Loading...
Searching...
No Matches
schc_config.h
1/*
2 * SPDX-FileCopyrightText: 2018 imec IDLab
3 * SPDX-FileCopyrightText: 2022 Freie Universität Berlin
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
7#pragma once
8
24
25#include <stdio.h>
26#include <unistd.h>
27#include <inttypes.h>
28
29#include "kernel_defines.h"
30#include "libschc/config.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36#define CLICK 0
37
38#define DYNAMIC_MEMORY 0
39#define STATIC_MEMORY_BUFFER_LENGTH CONFIG_LIBSCHC_STATIC_MEMBUF_LEN
40
41#define SCHC_CONF_RX_CONNS CONFIG_LIBSCHC_MAX_RX_CONNS
42#define SCHC_CONF_MBUF_POOL_LEN CONFIG_LIBSCHC_MBUF_POOL_SIZE
43
44#if IS_USED(MODULE_LIBSCHC_COAP)
45#define USE_COAP 1
46#else
47#define USE_COAP 0
48#endif
49
50#if IS_USED(MODULE_LIBSCHC_UDPV6)
51#define USE_IP6_UDP 1
52#else
53#define USE_IP6_UDP 0
54#endif
55
56/* the maximum length of a single header field
57 * e.g. you can use 4 ipv6 source iid addresses with match-mapping */
58#define MAX_FIELD_LENGTH 32
59
60/* maximum number of header fields present in a rule (vertical, top to bottom) */
61#define IP6_FIELDS 14
62#define UDP_FIELDS 4
63#define COAP_FIELDS 16
64
65#define MAX_HEADER_LENGTH 256
66
67#define MAX_COAP_HEADER_LENGTH 64
68#define MAX_PAYLOAD_LENGTH 256
69#define MAX_COAP_MSG_SIZE MAX_COAP_HEADER_LENGTH + MAX_PAYLOAD_LENGTH
70
71/* the maximum transfer unit of the underlying technology */
72#define MAX_MTU_LENGTH CONFIG_LIBSCHC_MAX_MTU_LEN
73
74/* the maximum number of tokens inside a JSON structure */
75#define JSON_TOKENS 16
76
77#define RULE_SIZE_BITS 8
78
79#if IS_ACTIVE(CONFIG_LIBSCHC_DEBUG)
80#define DEBUG_PRINTF(...) printf(__VA_ARGS__)
81#else
82#define DEBUG_PRINTF(...)
83#endif
84
85/* the number of ack attempts */
86#define MAX_ACK_REQUESTS 3
87
88/* the number of FCN bits */
89#if IS_USED(MODULE_LORA)
90#define FCN_SIZE_BITS 6
91#else
92#define FCN_SIZE_BITS 3
93#endif
94
95/* the number of DTAG bits */
96#define DTAG_SIZE_BITS 0
97
98/* the number of bytes the MIC consists of */
99#define MIC_SIZE_BYTES 4
100
101/* the length of the bitmap */
102#if IS_USED(MODULE_LORA)
103#define BITMAP_SIZE_BYTES 8 /* pow(2, FCN_SIZE_BITS) / 8 */
104#else
105#define BITMAP_SIZE_BYTES 2 /* pow(2, FCN_SIZE_BITS) / 8 */
106#endif
107
108#ifdef __cplusplus
109}
110#endif
111
Adds include for missing inttype definitions.
Common macros and compiler attributes/pragmas configuration.
RIOT-side compile-time configuration for libSCHC.