This adds the JSON parser logic as an alternative to the custom legacy
format and also adds necessary tests.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
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 we did not update the pointer to the previous element when
*not* removing the current element. This may result in memory being
leaked if the following element is removed and the removal code assumes
that it is the first element in the list, setting the list head to the
element that follows.
The update of `prev->next` is removed as it should be set properly
anyway.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This improves const correctness, at least for pointers (making the
pointed-to data const where possible).
Some suppressions are added for false positive warnings, such as in
`simple_queue.c` where an arithmethic operation is used on the pointer
to calculate a non-const pointer that is returned (thus, the passed
pointer should also not point to const).
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
To prevent additional occupancy of a `contact_info_list` entry, new
contacts are first added to the list of added contacts and only later
shifted to the list of all current_contacts.
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
In addition to the previous commit, the local variables `added_contacts`
and `removed_contacts` are now also represented by a linked list to
eliminate limitations of a static array.
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
To eliminate the limitation of a statically allocated array to store
current contacts its replaced by a linked list.
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
Three messages that are printed quite often but are barely relevant,
either because there is another INFO-level message about the same thing
and they only confirm processing or because the behavior can be expected
anyway, are downgraded to DEBUG level, so they are not shown by default
and disabled in release builds.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
The FIB fulfils two purposes: 1) map node IDs to next-hop CLA addresses
and 2) store the current status of a link associated with a given CLA
address.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This prefixes all compile-time options of the compat. router with
`ROUTER_` and adds them to config.mk.example so they can be easily
discovered and adapted.
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>
This adds the code from e1621765a4 back
into the tree unchanged, but moved into two new directories, in
preparation of the following commit, which adds a routing agent on this
basis, to make it possible to review the diff properly.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>