This adds a function to decode JSON configuration via Jansson to the
router agent. The JSON functionality and, thus, the dependency on
Jansson, can be disabled during the build process by setting the
`DISABLE_JSON` compile-time flag (see `config.mk.example` for details).
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
Previously it was not possible to disable SQLite because of a linker
error. Also, `sqlite3.h` was always required to be present. This adds
an example to `config.mk.example` and fixes both issues.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This makes µD3TN behave the same as v0.13.0 when executed without an
additional commandline argument. A new commandline argument `-d` /
`--external-dispatch` is added, which enables the use of external BDMs.
The default forwarding implementation is now again provided using the
v0.13 code, extracted from e1621765a4 and
adapted to the new agent-based forwarding implementation.
Central changes to the old code include:
- A new "Routing Agent" that handles incoming configuration commands,
FIB updates, and BDM dispatch requests.
- The use of the BDM authorization flag to authorize contact
configuration commands.
- The Contact Manager now only triggers the creation and removal of
links / FIB entries; bundle dispatch is triggered through the FIB and
BDM callback functions of the Routing Agent.
- The fragmentation logic is adapted to store the original bundle along
with an offset and length value, instead of pre-creating and storing
the fragments.
- The bundle re-scheduling logic integrated into the Routing Agent is
simplified and does not support changing the fragmentation parameters.
A new function is added to the Router that searches for a new route
for such fragments that were already scheduled at some point,
considering them as un-fragmentable bundle with overridden fragment
offset and length.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
Previously we were relying on the availability of a symlink/redirection
for `gcc` that points to `clang`, which is present by default on macOS
if the XCode developer tools are installed. When using Nix on macOS,
this is not the case and the build fails. As Clang is the default for
all macOS systems, we should just proactively set the `TOOLCHAIN`
variable to that value.
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
The SQLiteAgent enables SQLiteCLA to read packages from the database and
return them to μD3TN. For this purpose, the SQLiteAgent writes commands
to the queue that SQLiteCLA is waiting for.
The SQLiteAgent itself can be controlled by protobuf messages that
describe which action is to be applied to which set of bundles.
Currently the operations "Push" and "Delete" are implemented and a
filter based on a destination EID pattern.
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
In order to prepare the implementation of a SQLite-based storage CLA, a
basic structure of this CLA with empty functions is created and
adjustments are made to the configuration/initialization functions and
the build system.
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
This is a "meta-agent" based on the current AAPv1 implementation
(`application_agent.c`), which runs the new AAP2 protocol that is
implemented via Protobuf (using NanoPB). Please refer to the
corresponding design documents for further information on the protocol
itself.
Beside the on-wire encoding and future extension capabilities, the primary
difference from AAPv1 to AAP2 is that a connection is now a
unidirectional RPC-like channel. This ensures that acknowledgments
cannot be easily get out of order and makes client implementations
simpler. However, it also means that now a shared secret needs to be
passed by clients to enable registering for the same agent ID.
The following limitations of this first implementation are present:
- Only sending and receiving ADUs is supported.
- The shared secret is not checked - any app can register for the same
agent ID as long as no other app has yet registered for the requested
direction (subscribe or non-subscribe).
- Only one client per direction is supported at the moment. (It is at
least planned to support multiplke subscribers for an agent ID.)
- The server does not expect acknowledgments from clients when they
receive ADUs.
- The keepalive mechanism is not implemented.
In general, this reflects the feature set of AAPv1, but with massive
extension opportunities.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
We do not need the `components/` subdirectory and it makes the call to
the Protobuf compiler more complicated.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This adds the Nanopb library as submodule under `external/` and adds
corresponding build configuration to the Makefiles. Additionally, a
Protobuf stub for AAP 2.0 is included along with a `make` target to
build the corresponding C language files (`aap2-proto-headers`).
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
Previously we were setting this every time that it was defined. The
switch from defining _POSIX_C_SOURCE in some files to defining
_XOPEN_SOURCE in the build system made the symbol disappear on Linux
with GCC, thus, making our current AAP test (which reuses ports) fail.
As SO_REUSEPORT is probably unintended in most cases and may rather lead
to unexpected behavior or even security issues, we should disable it by
default. #144
This commit re-introduces _DEFAULT_SOURCE as feature-test macro to
provide the Linux- and BSD-specific API SO_REUSEPORT, which is not
available otherwise.
Fixes: #144
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
We want to be able to use POSIX extensions such as `strdup` and should
not define this in every individual source file. It is similar to the
definition of which C standard to use and should thus be defined in the
makefiles.
We use the X/Open feature test macro to include all needed functionality
also under other platforms such as BSD.
See also: https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This does not pass the `--gc-sections,--sort-common,--as-needed` and
`-Wl,-z,relro,-z,now,-z,noexecstack` linker flags when using the MacOS
linker. The OS detection is moved to `posix.mk`, which is included
earlier.
Fixes: #135
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This adds a target `data-decoder` which builds a binary to decode a
specified binary file using uD3TN's parsing logic (based on the CLA RX
subsystem) and print details about it. In this first version only the
decoding of BPv7 bundles is implemented.
This binary can be used, e.g., for fuzz testing.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
On some systems (incl. our x86_64 Debian based CI), the change of the
linker argument order in 602c4ce0 broke the build, as the flag was then
passed after the library options (i.e. `-lc -lm -lpthread`).
This change removes the modifications to the `LDFLAGS` and `LDFLAGS_PRE`
variables in `build.mk` by making use of the `LDFLAGS_EXECUTABLE` and
`LDFLAGS_LIB` variables directly in dedicated linker commands.
An additional variable `LDFLAGS_PRE_LIB` is introduced for adding
preceding flags specifically for the library build (as `LDFLAGS_PRE` is
not touched anymore in `build.mk`).
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This reverts commit 340e69165dd89bab9af9d607dda7ca3d8cb6b828.
Breaks build on some Linux with clang.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This is just a cleanup change - we do not want to include that stuff in
our main library and executable.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This adds a custom header that does explicitly not include the Unity
wrappers for malloc, free, etc. by defining the guard used by that header
file. This way we can remove the wrappers provided via the linker
altogether.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
The MacOS linker does not support linker groups, but the GNU / Linux
linker requires them in our case.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
For the executable we should not use this option as it unnecessarily
increases binary size.
There might also be incompatibilities with Mac, see #126
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This was only necessary for STM32 and it seems that there are
compatibility issues with LLVM on Mac.
See: #126
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This combines the static libraries into one libud3tn.a that can be used
for static linking. It shall be noted that we are using a "thin" archive
(containing symlinks) for maximum compatibility - e.g., the ARM version
of ar does not support conversion and we cannot always assume libtool to
be present. The main objective is to build a library usable for linking
it into uD3TN-NG.
See: https://stackoverflow.com/a/23621751
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
You can now specify `sanitize=yes` to the `make` command, which enables
the address and UB sanitizers. For Clang builds, it enables checks for
unsigned integer ovewrflow and implicit conversions, additionally. Thus,
it is advised to compile as follows:
make TOOLCHAIN=clang sanitize=yes
There also is the option to pass `sanitize-strict=yes`, which will set
`-fno-sanitize-recover=` such that the program execution aborts in case
the sanitizers detect something.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
Former releases of uD3TN have included support for STM32/FreeRTOS.
Having this support from the first moment on was a good thing in
order to optimize for platforms with limited resources. As this
platform is not used in current uD3TN setups and as it results in quite
some maintenance work, it is removed with this commit. The removed parts
cover the implementation itself, tests, tools, documentation, parts of
the build/make scripts as well as licensing information.
Signed-off-by: Marius Feldmann <marius.feldmann@d3tn.com>
Previously, none of the object files were linked into the shared object
libud3tn.so. This adds the appropriate linker flags (--whole-archive) to
add everything to the shared library. -fPIE cannot be used with libs,
thus, is replaced with -fPIC. Finally, the GC options (link-time removal
of unneccessary sections) are only applied for linking the executable.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This changes the core component name as well as the output binary names
(including the library and test binaries) from "upcn" to "ud3tn".
Additionally, the default configuration for the created socket and the
used EID is adapted.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This is the initial commit for uD3TN. uD3TN is a fork of uPCN v0.8.0,
which will be developed and maintained in a public Git repository.
For questions concerning the history of and code provided with uPCN,
please get in touch with us via: contact <at> d3tn <dot> com
Signed-off-by: Felix Walter <felix.walter@d3tn.com>