catnip
A no-std, panic-never, heapless, minimally-featured UDP/IP stack for bare-metal. Intended for fixed-time data acquisition and controls on LAN.
Makes use of const generic expressions to provide flexibility in, and guaranteed correctness of, lengths of headers and data segments without dynamic allocation.
Because of this, the crate currently relies on the nightly channel, and as a result, may break regularly until the required features stabilize.
This library is under active development; major functionality is yet to be implemented and I'm sure some bugs are yet to be found.
use *;
// Some made-up data with two 32-bit words' worth of bytes and some arbitrary addresses
let data: = ByteArray;
// Build frame
let frame = ;
// Reduce to big-endian network bytes
let bytes = frame.to_be_bytes;
// Parse from bytes
let frame_parsed = read_bytes;
assert_eq!;
Features
- Ethernet II frames
- IPV4
- UDP
- ARP
To-do
- Add UDP psuedo-socket trait w/ arbitrary async send/receive functions
- Move to stable once constants defined in traits become available for parametrizing generics
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.