https://github.com/opencyphal/libudpard
A compact implementation of the Cyphal/UDP protocol in C for high-integrity real-time embedded systems
https://github.com/opencyphal/libudpard
Last synced: 9 months ago
JSON representation
A compact implementation of the Cyphal/UDP protocol in C for high-integrity real-time embedded systems
- Host: GitHub
- URL: https://github.com/opencyphal/libudpard
- Owner: OpenCyphal
- License: mit
- Created: 2022-08-05T17:03:43.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-29T11:04:09.000Z (about 1 year ago)
- Last Synced: 2025-05-01T07:45:16.943Z (10 months ago)
- Language: C
- Homepage:
- Size: 337 KB
- Stars: 14
- Watchers: 10
- Forks: 10
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Compact Cyphal/UDP in C
[](https://github.com/OpenCyphal-Garage/libudpard/actions/workflows/main.yml)
[](https://sonarcloud.io/summary?id=libudpard)
[](https://sonarcloud.io/summary?id=libudpard)
[](https://forum.opencyphal.org)
LibUDPard is a compact implementation of the Cyphal/UDP protocol in C99/C11 for high-integrity real-time
embedded systems.
[Cyphal](https://opencyphal.org) is an open lightweight data bus standard designed for reliable intravehicular
communication in aerospace and robotic applications via CAN bus, UDP, and other robust transports.
We pronounce LibUDPard as *lib-you-dee-pee-ard*.
## Features
Some of the features listed here are intrinsic properties of Cyphal.
- Full branch coverage and extensive static analysis.
- Compliance with automatically enforceable MISRA C rules (reach out to https://forum.opencyphal.org for details).
- Detailed time complexity and memory requirement models for the benefit of real-time high-integrity applications.
- Purely reactive time-deterministic API without the need for background servicing.
- Zero-copy data pipeline on reception --
payload is moved from the underlying NIC driver all the way to the application without copying.
- Support for redundant network interfaces with seamless interface aggregation and no fail-over delay.
- Out-of-order multi-frame transfer reassembly, including cross-transfer interleaved frames.
- Support for repetition-coding forward error correction (FEC) for lossy links (e.g., wireless)
transparent to the application.
- No dependency on heap memory; the library can be used with fixed-size block pool allocators.
- Compatibility with all conventional 8/16/32/64-bit platforms.
- Compatibility with extremely resource-constrained baremetal environments starting from 64K ROM and 64K RAM.
- Implemented in ≈2000 lines of code.
## Usage
The library implements the Cyphal/UDP protocol, which is a transport-layer entity.
An application using this library will need to implement the presentation layer above the library,
perhaps with the help of the [Nunavut transpiler](https://github.com/OpenCyphal/nunavut),
and the network layer below the library using a third-party UDP/IP stack implementation with multicast/IGMP support
(TCP and ARP are not needed).
In the most straightforward case, the network layer can be based on the standard Berkeley socket API
or a lightweight embedded stack such as LwIP.
```mermaid
%%{init: {"fontFamily": "Ubuntu Mono, monospace", "flowchart": {"curve": "basis"}}}%%
flowchart TD
classDef OpenCyphal color:#00DAC6,fill:#1700b3,stroke:#00DAC6,stroke-width:2px,font-weight:600
Application <-->|messages,\nrequests,\nresponses| LibUDPard[fa:fa-code LibUDPard]
class LibUDPard OpenCyphal
LibUDPard <-->|multicast datagrams| UDP
subgraph domain_udpip["3rd-party UDP/IP+IGMP stack"]
UDP <--> IP["IPv4, IGMPv1+"] <--> MAC
end
MAC <--> PHY
```
To integrate the library into your application, simply copy the files under `libudpard/` into your project tree,
or add this entire repository as a submodule.
The library contains only one translation unit named `udpard.c`;
no special compiler options are needed to build it.
The library should be compatible with all conventional computer architectures where a standards-compliant C99 compiler
is available.
**Read the API docs in [`libudpard/udpard.h`](libudpard/udpard.h).**
For complete usage examples, please refer to .
## Revisions
### v1.0
Initial release.