Skip to content

Liberty336/Custom_Protocol_Experimental_Base

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Custom_Protocol_Experimental_Base

image

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:

  1. To be somewhat of an educational "guide" on how to implement certain concepts in Rust.
  2. To be modified by the user to meet the user's needs and then be deployed.

Key differences between original Linux C version and Embedded Rust Version

The key differences were:

Transport

Linux C: AF_PACKET raw socket, sendto()/recvfrom() syscalls
Embedded Rust: EthernetMac trait (hardware abstraction), real chip driver implements it

Buffers

Linux C: stack array or heap malloc
Embedded Rust: fixed size stack array [u8; MAX_FRAME_SIZE], no heap or no allocator needed

Configuration

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)

Error handling

Linux C: return -1, check errno, call perror()
Embedded Rust: custom error enum, Result<T, EthError>

Failure/exit

Linux C: process::exit() / exit(1)
Embedded Rust: loop {} or halt — nowhere to exit to

Panic

Linux C: segfault or undefined behaviour
Embedded Rust: panic-halt (disables interrupts, freezes, debugger shows you where)

Structure

Linux C: two separate binaries, sender and receiver
Embedded Rust: one firmware image, both roles handled in the main loop

About

A base implementation of an experimental protocol project implemented in C & Rust

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors