ud3tn/config.mk.example

315 lines
12 KiB
Text
Raw Permalink Normal View History

# Example for build-time configuration options.
# Copy this to `config.mk` and adjust as needed. The values shown below are
# usage examples, whereas the first one always represents the default value.
# Please note that you should trigger a clean build (`make clean && make`) after
# changing any of these settings.
##################
# Build settings #
##################
# Note: The following settings are expected to be provided mainly on the `make`
# command line. If needed, however, they can be specified here.
# If set to `release`, build without debug symbols and optimize the binary.
#type ?= debug
#type ?= release
# If set to `yes`, enable further warnings. If set to `all`, enable even more
# warnings, including those that could be false positive.
#wextra ?= yes
#wextra ?= no
#wextra ?= all
# If set to `yes`, make warnings terminate the build process.
#werror ?= no
#werror ?= yes
# If set to `yes`, print all commands issued during build.
#verbose ?= no
#verbose ?= yes
# Enable sanitizers. As some of them are incompatible, there are multiple
# options: `yes` means to use the address and UB sanitizers, `memory` (only
# available with Clang) the memory sanitizer, and `thread` (only available with
# Clang) the thread sanitizer.
#sanitize ?= no
#sanitize ?= yes
#sanitize ?= memory
#sanitize ?= thread
# If set to `yes`, terminate the program on sanitizer errors.
#sanitize-strict ?= no
#sanitize-strict ?= yes
# If set to `yes`, build a binary instrumented for coverage analysis.
#coverage ?= no
#coverage ?= yes
###############################
# Dependency-related settings #
###############################
# Some features can be disabled to reduce the number of dependencies.
# NOTE that these are NOT DEFINED and the features are enabled by default.
# Also NOTE that the value does not matter; even if you set it to zero, as
# long as it is defined, the feature(s) will be disabled!
# The persistent storage implementation requires SQLite.
#DISABLE_SQLITE_STORAGE := 0
# The JSON-based router configuration requires Jansson.
#DISABLE_JSON := 0
#####################
# Toolchain options #
#####################
# Toolchain to be used. `gcc` or `clang` can be selected. Note that this can
# also be specified on the command line, e.g.: `make TOOLCHAIN=clang`
#TOOLCHAIN := gcc
# Toolchain prefix, useful for cross-compilation.
# can be left empy most of the time (default: search in $PATH)
#TOOLCHAIN_POSIX :=
#TOOLCHAIN_POSIX := arm-linux-gnueabihf-
# Prefix for the Clang compiler
#CLANG_PREFIX :=
#CLANG_PREFIX := /opt/my-clang-installation/
# --sysroot provided to the Clang compiler, useful for providing the path to
# the embedded toolchain so the proper headers are found.
# If left empty, the option is not provided to the compiler.
#CLANG_SYSROOT_POSIX :=
# Value passed to the compiler via `-march`. If not specified, will use
# `-march=native` on x86/x86_64 platforms and not pass the parameter on others.
#ARCH :=
#ARCH := armv7-m
# Use flags suitable for the macOS linker. If not specified, autodetect.
#EXPECT_MACOS_LINKER := 0
# Additional compiler flags.
#CPPFLAGS +=
# Additional linker flags.
#LDFLAGS +=
# Additional flags passed to compiler and linker.
#ARCH_FLAGS +=
########################
# Compile-time defines #
########################
# The listen() backlog for incoming connections in the AAP 2.0 agent.
#CPPFLAGS += -DAAP2_AGENT_LISTEN_BACKLOG=2
aap2_agent: Switch to simple_queue to enforce clean termination This enables a clean termination of all agent connections on program exit without memory leaks that might previously occur due to the "pipe queue" still holding some data (pointer to allocated memory) when close() is called on the pipe. For that purpose, the "pipe queue" is replaced by our standard hal_queue implementation, which also has a higher performance as it does not require a syscall on every read/write operation. As hal_queue does not support poll() (it does not provide a fd), we cannot check whether the socket has been closed by a subscribing AAP2 client while concurrently waiting for the internal queue. As an alternative, this implements a liveliness check, which checks the sub. connection opportunistically from the agent manager: When a new registration is requested, existing registrations are first "health-checked" and removed if down, so the new connection can take over if an old one is down and this was not detected previously. Based on the new infrastructure, a clean termination routine is implemented that terminates all tasks transitively by terminating the listener. An AAP2 connection handler ("comm task") can terminate in two ways: 1. During runtime, when the connection is closed, it must clean up its own resources. 2. On program termination, all connections must be cleanly closed and all outstanding mesages handled. For 1., we keep using detached threads and allow them to release all the resources. This commit mainly introduces a mechanism for 2.: A list tracking all comm. tasks is added that can be used to terminate and wait for all of them on program termination. A "termination flag" indicates whether tasks should clean up by themselves or the listener task takes it over. Everything needs to be protected by mutexes for safe concurrency. There is specific handling for macOS, which does not signal other threads clocking on a socket that the socket has been closed when calling shutdown() but only when calling close() - thus, close() is executed earlier on macOS. Also, macOS does not unblock poll() when the socket is close()d, so we do not use it anymore to wait for data on an RPC connection, but rather set SO_RCVTIMEO for active-client (RPC) connections to enforce the keepalive timeout. Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-05-23 14:09:15 +02:00
# The maximum number of items waiting in the queue toward an AAP2 agent.
#CPPFLAGS += -DAAP2_AGENT_QUEUE_LENGTH=10
# The number of milliseconds the AAP 2.0 agent will wait for a response to an
# AAPMessage that it sends to a Client (before closing the connection).
#CPPFLAGS += -DAAP2_AGENT_TIMEOUT_MS=1000
# The minimum number of characters the pre-shared administrative secret for
# FIB and BDM operations is allowed to have. In debug builds, not providing
# a secret or providing a secret that is too short will only trigger a warning,
# while in release builds the program will abort.
#CPPFLAGS += -DAAP2_MINIMUM_PRE_SHARED_SECRET_LENGTH=16
# The sink identifier of the config agent for dtn-scheme EIDs.
#CPPFLAGS += -DAGENT_ID_CONFIG_DTN=\"config\"
# The sink identifier (service no.) of the config agent for ipn-scheme EIDs.
#CPPFLAGS += -DAGENT_ID_CONFIG_IPN=\"9000\"
# The sink identifier of the echo agent for dtn-scheme EIDs.
#CPPFLAGS += -DAGENT_ID_ECHO_DTN=\"echo\"
# The sink identifier (service no.) of the echo agent for ipn-scheme EIDs.
#CPPFLAGS += -DAGENT_ID_ECHO_IPN=\"9002\"
# The sink identifier of the sqlite agent for dtn-scheme EIDs.
#CPPFLAGS += -DAGENT_ID_SQLITE_DTN=\"sqlite\"
# The sink identifier (service no.) of the sqlite agent for ipn-scheme EIDs.
#CPPFLAGS += -DAGENT_ID_SQLITE_IPN=\"9003\"
# The socket `listen()` backlog length of the Application Agent.
#CPPFLAGS += -DAPPLICATION_AGENT_BACKLOG=2
# The size, in bytes, of the receive buffer used by the Application Agent.
#CPPFLAGS += -DAPPLICATION_AGENT_RX_BUFFER_SIZE=512
# Different versions of the Bundle-in-Bundle-Encapsulation draft use different
# AR type codes for the BPDU. ION uses 7 (from draft v1), drafts up to v4 use
# 3, and draft-ietf-dtn-bibect-05 64443 (default).
#CPPFLAGS += -DBIBE_AR_TYPE_CODE=64443
# Maximum number of fragments that may be created by the BPA.
#CPPFLAGS += -DBUNDLE_MAX_FRAGMENT_COUNT=65536
# The maximum size of bundles that the BPA is allowed to process.
#CPPFLAGS += -DBUNDLE_MAX_SIZE=1073741824
# The maximum length of the bundle processor queue until it starts blocking.
#CPPFLAGS += -DBUNDLE_QUEUE_LENGTH=4000
# The maximum number of milliseconds the bundle processor blocks when writing
# into the bundle transmission queue.
#CPPFLAGS += -DBUNDLE_SEND_TIMEOUT_MS=10
# Accept bundles that have no CRC for the primary block and no BIB.
#CPPFLAGS += -DBUNDLE7_ALLOW_NO_PRIMARY_CRC_NO_BIB=1
# Produce (insert) "previous node" extension blocks for all BPv7 bundles.
#CPPFLAGS += -DBUNDLE7_TX_PRODUCE_PREVIOUS_NODE_BLOCK=0
# Whether or not to close an active connection after the end of a contact.
# Note that closure by the other peer may often not be recognized and, thus,
# setting this to zero may lead to dead connections being used for some time.
#CPPFLAGS += -DCLA_MTCP_CLOSE_AFTER_CONTACT=1
# Use the ION STCP header format (a 32-bit unsigned integer length field).
#CPPFLAGS += -DCLA_MTCP_ION_STCP_COMPATIBILITY=0
# The size of the chunked-read buffer of the CLA RX task.
#CPPFLAGS += -DCLA_RX_BUFFER_SIZE=64
# The maximum time interval, in milliseconds, between receiving two bytes part
# of the same bundle. When this time has passed, all parsers are reset.
# Setting this can help when broken records may be part of the incoming data.
#CPPFLAGS += -DCLA_RX_READ_TIMEOUT=0
# The length of the command queue between the SQLiteCLA and the SQLiteAgent.
#CPPFLAGS += -DCLA_SQLITE_AGENT_QUEUE_LENGTH=10
# Set a SQLite busy timeout in milliseconds. Set to zero to turn off.
# See: https://www.sqlite.org/c3ref/busy_timeout.html
# Especially under load and with concurrent access to the storage agent it is
# necessary to use a timeout to prevent SQLITE_BUSY errors.
# See also: https://www.sqlite.org/src/doc/204dbc15a682125c/doc/wal-lock.md
#CPPFLAGS += -DCLA_SQLITE_BUSY_TIMEOUT_MS=100
# The node ID that the SQLite CLA will register (create a FIB entry) for.
#CPPFLAGS += -DCLA_SQLITE_NODE_ID=\"dtn:storage\"
# Whether to abort() uD3TN in case a TCP CLA terminates finally.
#CPPFLAGS += -DCLA_TCP_ABORT_ON_LINK_TASK_TERMINATION=0
# Whether to set SO_REUSEPORT on listening TCP sockets. Note that this may have
# security implications and it is Linux-/BSD-specific.
#CPPFLAGS += -DCLA_TCP_ALLOW_REUSE_PORT=0
# Maximum number of attempts to create a connection on contact start.
# The default value of 0 means infinite.
#CPPFLAGS += -DCLA_TCP_MAX_RETRY_ATTEMPTS=0
# The length of the listen backlog for multi-connection TCP CLAs.
#CPPFLAGS += -DCLA_TCP_MULTI_BACKLOG=64
# The number of slots in the TCP multi-connection CLA parameters hash table,
# which stores the currently-active connections to other nodes.
#CPPFLAGS += -DCLA_TCP_PARAM_HTAB_SLOT_COUNT=32
# Interval between attempts to create a connection on contact start, in ms.
#CPPFLAGS += -DCLA_TCP_RETRY_INTERVAL_MS=1000
# The length of the listen backlog for single-connection TCP CLAs.
#CPPFLAGS += -DCLA_TCP_SINGLE_BACKLOG=1
# The SPP timestamp format preamble to be sent by the TCPSPP CLA.
#CPPFLAGS += -DCLA_TCPSPP_TIMESTAMP_FORMAT_PREAMBLE=0x1c
# Whether or not to encode and read the SPP timestamp P-field.
#CPPFLAGS += -DCLA_TCPSPP_TIMESTAMP_USE_P_FIELD="(true)"
# Whether or not to encode and read the SPP CRC checksum.
#CPPFLAGS += -DCLA_TCPSPP_USE_CRC="(true)"
# The maximum size of space packets, which is used for calculating the maximum
# bundle size reported by the CLA.
#CPPFLAGS += -DCLA_TCPSPP_SPP_MAX_SIZE="(1 << 16)"
# The maximum number of bundles to be sent per second, to prevent overloading
# the underlying communication system (default: unlimited).
#CPPFLAGS += -DCLA_TX_RATE_LIMIT=0
# The length of the outgoing-bundle queue toward the TX task.
#CPPFLAGS += -DCONTACT_TX_TASK_QUEUE_LENGTH=100
# The default value for the `--aap-host` argument.
#CPPFLAGS += -DDEFAULT_AAP_NODE=\"0.0.0.0\"
# The default value for the `--aap-port` argument.
#CPPFLAGS += -DDEFAULT_AAP_SERVICE=\"4242\"
# The default value for the `--aap-socket` argument.
#CPPFLAGS += -DDEFAULT_AAP_SOCKET_FILENAME=\"ud3tn.socket\"
# The default value for the `--aap2-host` argument.
#CPPFLAGS += -DDEFAULT_AAP2_NODE=\"0.0.0.0\"
# The default value for the `--aap2-port` argument.
#CPPFLAGS += -DDEFAULT_AAP2_SERVICE=\"4244\"
# The default value for the `--aap2-socket` argument.
#CPPFLAGS += -DDEFAULT_AAP2_SOCKET_FILENAME=\"ud3tn.aap2.socket\"
# The default CRC type used for newly-created BPv7 bundles. See `bundle.h`.
#CPPFLAGS += -DDEFAULT_BPV7_CRC_TYPE=BUNDLE_CRC_TYPE_16
# The default value for the `--lifetime` argument, in seconds.
#CPPFLAGS += -DDEFAULT_BUNDLE_LIFETIME_S=86400
# The default value for the `--bp-version` argument - either `6` or `7`.
#CPPFLAGS += -DDEFAULT_BUNDLE_VERSION=7
# The default value for the `--cla` argument.
#CPPFLAGS += -DDEFAULT_CLA_OPTIONS="\"sqlite:file::memory:?cache=shared;tcpclv3:*,4556;smtcp:*,4222,false;mtcp:*,4224\""
# The default value for the `--log-level` argument.
# For release builds, if this is not set, the default value is 2 (WARNING).
# Note that log level 4 (DEBUG) is only available in debug builds.
#CPPFLAGS += -DDEFAULT_LOG_LEVEL=3
# The default value for the `--node-id` argument.
#CPPFLAGS += -DDEFAULT_NODE_ID=\"dtn://ud3tn.dtn/\"
# Force the use of the 2-element IPN EID format even when the 3-element format is available.
# This can be used for compatibility with BPv7 implementations that don't support RFC 9758.
#CPPFLAGS += -DEID_IPN_FORCE_2_ELEMENT=0
# The number of slots in the node hashtable of µD3TN's Forwarding Information
# Base (FIB).
#CPPFLAGS += -DFIB_NODE_HTAB_SLOT_COUNT=32
# The number of slots in the CLA-address hashtable of µD3TN's Forwarding
# Information Base (FIB).
#CPPFLAGS += -DFIB_CLA_ADDR_HTAB_SLOT_COUNT=64
# Compat. router: Agent ID of the config. agent if using the dtn scheme.
#CPPFLAGS += -DROUTER_AGENT_ID_CONFIG_DTN=\"config\"
# Compat. router: Agent ID of the config. agent if using the ipn scheme.
#CPPFLAGS += -DROUTER_AGENT_ID_CONFIG_IPN=\"9000\"
# Compat. router: Default minimum payload for creating a fragment.
#CPPFLAGS += -DROUTER_FRAGMENT_MIN_PAYLOAD=8
# Compat. router: Default maximum bundle size.
#CPPFLAGS += -DROUTER_GLOBAL_MBS=SIZE_MAX
# Compat. router: Maximum number of concurrent contacts that can be handled by
# the Contact Manager.
#CPPFLAGS += -DROUTER_MAX_CONCURRENT_CONTACTS=10
# Compat. router: Maximum number of fragments created by the router.
#CPPFLAGS += -DROUTER_MAX_FRAGMENTS=512
# Compat. router: Number of slots in the node hash table.
#CPPFLAGS += -DROUTER_NODE_HTAB_SLOT_COUNT=128