Skip to content

Port NASA/bplib package#22091

Draft
RainbowSimon wants to merge 2 commits intoRIOT-OS:masterfrom
RainbowSimon:bplib-port
Draft

Port NASA/bplib package#22091
RainbowSimon wants to merge 2 commits intoRIOT-OS:masterfrom
RainbowSimon:bplib-port

Conversation

@RainbowSimon
Copy link
Contributor

@RainbowSimon RainbowSimon commented Feb 19, 2026

DTN is a protocol architecture to make communication delay / disruption tolerant. Originating from space communication, NASAs bplib implements the BPv7 bundle protocol.

Usually it sits on top of the trasport layer (CLAs for TCP and UDP are most common), but it does not have to. Convergence Layer Adapters can be anything, as long as they are defined on both sides.

In this current draft the UDP convergence layer for testing on native board is implemented.

Contribution description

Port into pkg/bplib. Also bump pkg/qcbor as required by bplib.

The changes (in the patches) are relatively small.

  • Storage (which natively used sqlite) was disabled and the functions are now extern, expected to be provided by a porting module.
  • Synchronization primitives are now RIOT mutexes, semas and not pthread ones
  • Builds using a Makefile, not with CMake
  • Bplibs Time module writes to vfs

It is still a draft. The following is a likely incomplete list of what still needs to be done:

  • Documentation in the package porting
  • Static Tests probably wont pass
  • The important tables (channel and contacts) are globals currently. Accessor functions to set certain things (like the contact CLA IP address) would likely be better
  • Most dynamic memory allocation is gone (there was not much in the first place) but in bplibs QM there are still callocs which I would like to remove.
  • An automated test or two would be nice
  • Storage is currently not maintaned (expired bundles are not kicked out)
  • Evaluation of the performance impact, especially of the storage pulling. It might currently try to fetch bundles from the storage constantly, which is okay for native but not on a flash. Add some kind of dirty flag and/or minimum timeouts for the storage search.
  • Right now the entire (applicable by the destination EID ranges) storage directory is searched for bundles, fed into the cache, to egress the ones with smalles remaining time to live first. Add an option to to reduce this, like just fill the cache with bundles and then return, even if there may be more urgend bundles.
  • Default more of the currently CFLAGS in the examples Makefile
  • I have a local ble_cla using nimble which also works in principle, get that one ready
  • Make a storage which just uses the RAM, which should be okay for leaf-nodes, which have just one next hop.

Testing procedure

The example under examples/networking/dtn/bplib/cla_udp can be run on native (or any board with gnrc + UDP).

Issues/PRs references

@github-actions github-actions bot added Area: doc Area: Documentation Area: pkg Area: External package ports Area: examples Area: Example Applications labels Feb 19, 2026
@crasbe crasbe added Type: new feature The issue requests / The PR implemements a new feature for RIOT CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Feb 19, 2026
@RainbowSimon RainbowSimon changed the title Bplib port Port NASA/bplib package Feb 19, 2026
@riot-ci
Copy link

riot-ci commented Feb 20, 2026

Murdock results

FAILED

042314f fixup! pkg/bplib: Initial port of NASA/bplib to RIOT

Success Failures Total Runtime
11005 1 11006 07m:22s

Artifacts

Copy link
Contributor

@crasbe crasbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Simon,

thank you for submitting the PR early. I have some general remarks that can also be applied to the other files, I did not want to mark every occurance in every file.
Also the static test has some remarks that have to be addressed.

One thing I do not understand yet is why you include some files of the bplib repository directly? If you do not want to fetch the full repository in the package, you can use so called "Sparse Paths". An example of how this works can be found here: https://github.com/RIOT-OS/RIOT/pull/22040/changes#diff-1a9efff322ab2483b57b549e33422bcb923a3d6fcfb62c61a65f95e9b9ad5874

Unfortunately our documentation about that is a bit slim at the moment I think.

@crasbe crasbe added the CI: no fast fail don't abort PR build after first error label Feb 20, 2026
@RainbowSimon
Copy link
Contributor Author

Thanks for your comments. Yes I am aware I need to integrate the RIOT coding conventions and fix the static tests.

Could you elaborate on your first comment? Of the https://github.com/nasa/bplib repo, the folders aa, bpa, ci, cla, inc (and version) are needed for the build. bpa/stor/src is not compiled, so that the implementation can be added from outside of bplib, to support different storage backends.

@crasbe
Copy link
Contributor

crasbe commented Feb 20, 2026

Could you elaborate on your first comment? Of the https://github.com/nasa/bplib repo, the folders aa, bpa, ci, cla, inc (and version) are needed for the build. bpa/stor/src is not compiled, so that the implementation can be added from outside of bplib, to support different storage backends.

You have files that are Copyright NASA, I assumed that you didn't write them, so they probably came from the bplib repository 😅

What is the reason for adding them to the RIOT source tree instead of fetching and patching them from the official repo?

Port https://github.com/nasa/bplib. This is work in progress. Allows
sending / receiving BPv7 bundles, currently only on the provided UDP
CLA, but custom CLAs can be added. Bundles not having a contact active
will be stored using the vfs backend and egressed when a link is
available.
Fix most of the coding conventions (except for vfs storage). The static
tests pass now at least locally (again, except for vfs storage).
Also add another patch to the port which saves around 20kB size.
The global extern config tables have also been changed to static local
tables with setter functions.
@RainbowSimon
Copy link
Contributor Author

For documentation purposes:

What is the reason for adding them to the RIOT source tree instead of fetching and patching them from the official repo?

I did not look into the copyright headers yet. These should be added everywhere now, except for the vfs storage.

Certain files, like NC "Node Config" and FWP "Framework Proxy" include OS specific callbacks or configuration tables. These are not part of the bplib core, but rather something that has to be implemented on the using environment. They come from the reference POSIX example in [bplib]/app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: doc Area: Documentation Area: examples Area: Example Applications Area: pkg Area: External package ports CI: no fast fail don't abort PR build after first error CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: new feature The issue requests / The PR implemements a new feature for RIOT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants