Loading...
Searching...
No Matches
schc_config.h
1/*
2 * Copyright (C) 2018 imec IDLab
3 * Copyright (C) 2022 Freie Universität Berlin
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
34#ifndef SCHC_CONFIG_H
35#define SCHC_CONFIG_H
36
37#include <stdio.h>
38#include <unistd.h>
39#include <inttypes.h>
40
41#include "kernel_defines.h"
42#include "libschc/config.h"
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48#define CLICK 0
49
50#define DYNAMIC_MEMORY 0
51#define STATIC_MEMORY_BUFFER_LENGTH CONFIG_LIBSCHC_STATIC_MEMBUF_LEN
52
53#define SCHC_CONF_RX_CONNS CONFIG_LIBSCHC_MAX_RX_CONNS
54#define SCHC_CONF_MBUF_POOL_LEN CONFIG_LIBSCHC_MBUF_POOL_SIZE
55
56#if IS_USED(MODULE_LIBSCHC_COAP)
57#define USE_COAP 1
58#else
59#define USE_COAP 0
60#endif
61
62#if IS_USED(MODULE_LIBSCHC_UDPV6)
63#define USE_IP6_UDP 1
64#else
65#define USE_IP6_UDP 0
66#endif
67
68/* the maximum length of a single header field
69 * e.g. you can use 4 ipv6 source iid addresses with match-mapping */
70#define MAX_FIELD_LENGTH 32
71
72/* maximum number of header fields present in a rule (vertical, top to bottom) */
73#define IP6_FIELDS 14
74#define UDP_FIELDS 4
75#define COAP_FIELDS 16
76
77#define MAX_HEADER_LENGTH 256
78
79#define MAX_COAP_HEADER_LENGTH 64
80#define MAX_PAYLOAD_LENGTH 256
81#define MAX_COAP_MSG_SIZE MAX_COAP_HEADER_LENGTH + MAX_PAYLOAD_LENGTH
82
83/* the maximum transfer unit of the underlying technology */
84#define MAX_MTU_LENGTH CONFIG_LIBSCHC_MAX_MTU_LEN
85
86/* the maximum number of tokens inside a JSON structure */
87#define JSON_TOKENS 16
88
89#define RULE_SIZE_BITS 8
90
91#if IS_ACTIVE(CONFIG_LIBSCHC_DEBUG)
92#define DEBUG_PRINTF(...) printf(__VA_ARGS__)
93#else
94#define DEBUG_PRINTF(...)
95#endif
96
97/* the number of ack attempts */
98#define MAX_ACK_REQUESTS 3
99
100/* the number of FCN bits */
101#if IS_USED(MODULE_LORA)
102#define FCN_SIZE_BITS 6
103#else
104#define FCN_SIZE_BITS 3
105#endif
106
107/* the number of DTAG bits */
108#define DTAG_SIZE_BITS 0
109
110/* the number of bytes the MIC consists of */
111#define MIC_SIZE_BYTES 4
112
113/* the length of the bitmap */
114#if IS_USED(MODULE_LORA)
115#define BITMAP_SIZE_BYTES 8 /* pow(2, FCN_SIZE_BITS) / 8 */
116#else
117#define BITMAP_SIZE_BYTES 2 /* pow(2, FCN_SIZE_BITS) / 8 */
118#endif
119
120#ifdef __cplusplus
121}
122#endif
123
124#endif /* SCHC_CONFIG_H */
Adds include for missing inttype definitions.
Common macros and compiler attributes/pragmas configuration.
RIOT-side compile-time configuration for libSCHC.
stdio wrapper to extend the C libs stdio