If the write method of the CLA fails, the serailizers will now return
early and this failure is handled properly by the TX task.
In the case of the BPv6 serializer, we add the necessary flow control to
the `write_bytes` macro, to prevent needing a conditional for every
write* or serialize* statement.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
Previously the fragmentation logic was very specific to uD3TN's
forwarding approach, modifying the original bundle in the process. With
BDMs supporting fragmentation we must make this more flexible. Thus, we
now pass an offset and length and always create a copy of the required
contents based on the original bundle.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This moves all definitions from config.h to individual header files and
makes them configurable (i.e., does not define when already defined).
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
The node and service number are 64 bit unsigned integers. This fixes the
validation and EID serialized size calculation and adds appropriate
tests to the serializer unit tests.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
ud3tn is available under multiple licenses and we want to reflect this in
our source code. But which license information should appear first and how
can we manage this efficiently in the future? The Linux Kernel uses SPDX
expressions instead of boilerplate sections. This seems to be a great
approach, so we do the same here.
Signed-off-by: Georg Alexander Murzik <georg.murzik@d3tn.com>
There was an issue in reports.c, that an error at specific points in
the code could lead to already malloc'ed fields not being freed properly.
This commit fixes this issue by introducing the function
free_record_fields() which frees all potentially malloc'ed fields in
the bundle_administrative_records struct before the struct itself
is freed.
Signed-off-by: Tobias Nöthlich <tobias.noethlich@d3tn.com>
Based on a contribution by @mnitsch, 351e1dae9.
This removes `hal_*` dependencies in the bundle processing components,
with the goal that these parts can be re-used without depending on the
uD3TN core functions and underlying system state. The required variables
are passed as function arguments from the uD3TN core components.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This adds the bundle sequence number as an argument to the bundle
creation functions and passes a sequence number which increases when
multiple bundles are generated by the application agent with the same
creation timestamp.
Fixes: #59
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
The Bundle Age block [...] contains the number of milliseconds
that have elapsed between the time the bundle was created and time at
which it was most recently forwarded. It is intended for use by nodes
lacking access to an accurate clock, to aid in determining the time at
which a bundle's lifetime expires. [...] If the bundle's creation time
is zero, then the bundle MUST contain exactly one (1) occurrence of this
type of block.[1]
In this implementation the age block is only evaluated if the creation
timestamp is 0. If a bundle age block exists, it will be updated
according to the specification, but an age block will never be
proactively inserted.
[1]: https://tools.ietf.org/html/draft-ietf-dtn-bpbis-30#section-4.4.2
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
To be compatible with the latest version of BPv7, the internal
representation of DTN timestamps, for both uD3TN and the Python library,
is changed to milliseconds.
For compatibility reasons, a conversion to seconds is performed during
the de-/serialization of BPv6.
Furthermore, additional test cases are added and the creation_time_ms of
the test bundle is set to a non-trivial timestamp.
Also, the Python functions for converting POSIX timestamps to DTN
timestamps are removed, as there is now a distinction between BPv6 and
BPv7 DTN timestamps. The conversion is now done in the corresponding BP
implementations themselves.
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
The re-name to "enum ud3tn_result" broke the indentation in some
function signatures, which is fixed by this commit.
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>