Commit graph

9 commits

Author SHA1 Message Date
Felix Walter
7330c79b52 style: Spacing, indentation, long lines, continuations
This harmonizes several style issues found by `checkpatch.pl` when using
strict mode.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-07-25 13:15:05 +02:00
Felix Walter
79aa631ac2 bundle7: Abort on errors in calculation of serialized size
This indicates a program bug and should trigger an assertion in debug
builds as it may otherwise lead to hard-to-debug issues.

Note that the parser already asserts EID validity, thus, this will never
be triggered for received bundles.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2022-11-22 08:09:48 +01:00
Felix Walter
7d646c1e50 bundle7: Allow "\0" as representation of the null EID
This is the equivalent of the CBOR encoding of dtn:none and, thus,
should be parsed properly.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2022-11-22 08:09:48 +01:00
Felix Walter
4bf6888a03 bundle7: Calculate ipn EID size using 64 bit integers
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>
2022-11-21 09:41:03 +01:00
Georg Alexander Murzik
298431c68f Insert SPDX license expression comments into our .c, .h, .py, and .sh code
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>
2022-02-20 16:24:38 +01:00
Felix Walter
fbd7819656 bundle7: Fix calculation of fragment header lengths
1) There was an obvious issue with the code here: We want to check that
   the bundle was NOT fragmented, thus, we have to negate the result of
   bundle_is_fragmented.

2) We under-estimated the possible size of bundle fragments if they have a
   fragment offset != 0 (the encoded fragment offset can occupy multiple
   bytes in this case). This uses a conservative estimation for allowing
   scheduling of the bundle such that contacts are never overbooked.

Fixes: #66

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2021-07-30 17:00:47 +02:00
Maximilian Nitsch
2a981e86e2 Change DTN timestamp to milliseconds
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>
2021-01-14 14:42:55 +01:00
Felix Walter
fb4238a97d Adapt core include path from upcn/ to ud3tn/
This moves all headers from upcn/ to ud3tn/ and adapts the #include
statements accordingly.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2020-11-17 15:51:10 +01:00
Felix Walter
0ce4bee910
Initial import of uPCN v0.8.0 source code
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>
2020-11-14 11:56:40 +01:00