Liberty336 wanted its own custom experimental protocol.
Here are base experimental implementations and not complete for "production" use.
It can be used out of the box, but is -not intended for such purposes-.
It is intended:
- To be somewhat of an educational "guide" on how to implement certain concepts in Rust.
- To be modified by the user to meet the user's needs and then be deployed.
The key differences were:
Linux C: AF_PACKET raw socket, sendto()/recvfrom() syscalls
Embedded Rust: EthernetMac trait (hardware abstraction), real chip driver implements it
Linux C: stack array or heap malloc
Embedded Rust: fixed size stack array [u8; MAX_FRAME_SIZE], no heap or no allocator needed
Linux C: -DINTERFACE_NAME compile flag or env vars at runtime
Embedded Rust: compile-time constants, no OS, no env vars, no argv (could've done this in C also)
Linux C: return -1, check errno, call perror()
Embedded Rust: custom error enum, Result<T, EthError>
Linux C: process::exit() / exit(1)
Embedded Rust: loop {} or halt — nowhere to exit to
Linux C: segfault or undefined behaviour
Embedded Rust: panic-halt (disables interrupts, freezes, debugger shows you where)
Linux C: two separate binaries, sender and receiver
Embedded Rust: one firmware image, both roles handled in the main loop