pkg/libcsp: add sock_udp [demonstrator] #18010
Draft
+3,534
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contribution description
For another project, I wanted to use CoAP and many applications depending on it on top of a non-IP stack (libCSP). Since all those are basically using the
sock
api, andsock
is IP based, I implementedsock_udp
ep that basically just ignores everything in the IP address but the last hex part, This is just meant to be able to have drop-in network stack replacements, and the same usage through the present CLI tools, but nothing related to IP addressing is actually used. I'm tagging it asdemonstrator
as this feels a bit like a hack, but might be useful for others.Testing procedure
There are some incomplete unittests, not sure it's worth the effort right now to pursue further.
Use gcoap as a CoAP server or a as a CoAP client, to do it must be patched a little:
The
gcoap
examples in master expects IPv6 addressing. But CSP is used here which does not use or supportIP. To work around this, destination addresses for requests should be formatted as IPv6 addresses with trailing zeros. Internal the CSP
sock_udp
module ignores all but the first 2 bytes.e.g.:
The CSP address
39:E5
or0x39E5
would become::39e5
Ipv6 address.Follow the instructions in README.native.can.md
to setup two virtual can interfaces.
Verify setup from RIOT terminal
Expected response:
Send query between RIOT instances
Issues/PRs references
Depends on #18009