Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,13 @@ next-generation intelligent vehicles: manned and unmanned aircraft, spacecraft,
- Support for redundant network interfaces with seamless interface aggregation and zero fail-over delay.
- Robust message reassembler supporting highly distorted datagram streams:
out-of-order fragments, fragment/message deduplication, interleaving, variable MTU, ...
- Packet loss mitigation via:
- reliable topics (retransmit until acknowledged; callback notifications for successful/failed deliveries).
- redundant interfaces (packet lost on one interface may be received on another, transparent to the application);
- Heap not required (but supported); the library can be used with fixed-size block pool allocators.
- Detailed time complexity and memory requirement models for the benefit of real-time high-integrity applications.
- Scalable: designed to handle thousands of topics and hundreds of concurrent transfers with minimal resources.
- Scalable: designed to handle thousands of subjects and hundreds of concurrent transfers with minimal resources.
- Runs anywhere out of the box, including extremely resource-constrained baremetal environments with ~100K ROM/RAM.
No porting required.
- Partial MISRA C compliance (reach out to <https://forum.opencyphal.org>).
- Full implementation in a single C file with only 2k lines of straightforward C99!
- Full implementation in a single C file with less than 2k lines of straightforward C99!
- Extensive verification suite.

## Usage
Expand Down Expand Up @@ -71,7 +68,7 @@ standards-compliant C99 compiler is available.

### v3.0 -- WORK IN PROGRESS

The library has been redesigned from scratch to support Cyphal v1.1, named topics, and reliable transfers.
The library has been redesigned from scratch to support Cyphal v1.1 and named topics.
No porting guide is provided since the changes are too significant;
please refer to the new API docs in `libudpard/udpard.h`.

Expand Down
39 changes: 15 additions & 24 deletions cyphal_udp_header.dsdl
Original file line number Diff line number Diff line change
@@ -1,40 +1,31 @@
# Cyphal/UDP provides UNRELIABLE UNORDERED DEDUPLICATED (at most one) delivery of UNICAST or MULTICAST datagrams
# with GUARANTEED INTEGRITY (messages either delivered correct or not delivered).
#
# All Cyphal/UDP traffic is sent to port 9382.
# The subject multicast group address is composed as 239.0.0.0 (=0xEF000000) + subject_id (23 bits).
#
# All frames of a transfer must share the same field values unless otherwise noted.
# Frames may arrive out-of-order, possibly interleaved with neighboring transfers; implementations must cope.
#
# The origin UID is a 64-bit globally unique identifier (e.g., EUI-64). It allows nodes to use redundant interfaces
# without source address ambiguity, and also allows live interface migration.
#
# P2P traffic is sent directly to the source endpoint of the destination node, which is discovered dynamically.
# The destination UID is not included explicitly since the IP endpoint is considered adequate for node identification.

uint5 version #=2 in this version.
uint3 priority # 0=highest, 7=lowest.

uint2 KIND_MSG_BEST_EFFORT = 0 # No ack must be sent.
uint2 KIND_MSG_RELIABLE = 1 # Remote must acknowledge reception by sending an ACK frame back.
uint2 KIND_ACK = 2 # Sent P2P; the transfer_id is of the acknowledged frame. Payload empty/ignored.
uint2 kind
uint6 reserved_incompat # Discard frame if any incompatibility flags are set that are not understood.
void5 # Send zero, ignore on reception.
uint3 incompatibility # Send zero, drop frame if nonzero.

void16 # Reserved for compatibility flags and fields (transmit zero, ignore on reception).

# Payload reassembly information.
# We provide both the frame index and the frame payload offset to allow various reassembly strategies depending on the
# preferences of the implementation. The provided information is sufficient for zero-copy out-of-order reassembly.
# Offset 4 bytes.
uint48 transfer_id # For multi-frame reassembly and dedup.
uint64 sender_uid # Origin identifier ensures invariance to the source IP address for reassembly.

uint24 frame_index # Zero-based index of the payload fragment carried by this frame.
void8
uint32 frame_payload_offset # The offset of the frame payload relative to the start of the transfer payload.
uint32 transfer_payload_size # Total for all frames.

# Transfer identification information.
# The transfer-ID is a single field that segregates transfers by topic hash and epoch (publisher sequence restarts).
# Offset 16 bytes.

uint64 transfer_id # For multi-frame reassembly and dedup. ACK specifies the acked tfer here.
uint64 sender_uid # Origin identifier ensures invariance to the source IP address for reassembly.

# Integrity checking information.
# Offset 32 bytes.

uint32 prefix_crc32c # crc32c(payload[0:(frame_payload_offset+payload_size)])
uint32 header_crc32c # Covers all fields above. Same as the transfer payload CRC.

# End of header at 40 bytes. Payload follows.
# Header size 32 bytes; payload follows.
Loading