Skip to content

pdh11/cotton

Repository files navigation

CI status codecov dependency status License: CC0-1.0

Cotton

A collection of Rust crates for low-level networking functionality.

So far:

  • cotton-netif Crates.io Crates.io docs.rs: enumerating available network interfaces and their IP addresses, including ongoing (asynchronous) comings and goings of network interfaces (e.g. on USB hotplug/unplug); so far, for Linux only.

  • cotton-scsi Crates.io Crates.io docs.rs: implementing SCSI direct-access storage device commands in terms of an abstract SCSI transport.

  • cotton-ssdp Crates.io Crates.io docs.rs: implementing SSDP, the Simple Service Discovery Protocol, a mechanism for discovering available resources (service) on a local network. Uses cotton-netif, in order to do the Right Thing on multi-homed hosts (but meaning that it is unlikely to work on Windows platforms).

  • cotton-unique Crates.io Crates.io docs.rs: creating deterministic but per-device unique identifiers such as MAC addresses.

  • cotton-usb-host Crates.io Crates.io docs.rs: a no-std, no-alloc asynchronous USB host stack, initially for RP2040.

  • cotton-usb-host-hid Crates.io Crates.io docs.rs: USB "Human Interface Device" (HID) keyboard & mouse support (i.e., supporting attaching USB keyboards & mice to a microcontroller, to allow keyboard & mouse input).

  • cotton-usb-host-msc Crates.io Crates.io docs.rs: USB mass-storage support for cotton-usb-host (i.e., supporting attaching USB mass-storage devices to a microcontroller, to give the microcontroller extra storage space).

  • cotton-w5500 Crates.io Crates.io docs.rs: smoltcp driver for the Wiznet W5500 Ethernet controller in MACRAW mode, including interrupt-driven mode.

These crates are no_std-compatible, meaning that they can be used on embedded systems. In fact, all pushes to my local (not Github) continuous-integration server are automatically tested on both STM32 and RP2040 platforms. You can read about how that is set up on my blog: Part one, Part two, Part three.

These system-tests also serve as example code combining the Cotton crates with the wider ecosystem, including examples where the combining of the wider ecosystem components needed a little research in its own right even before involving Cotton, so perhaps that in itself will be useful to others:

My long-term goals for this project as a whole:

  • provide useful, solid, well-tested components to folks needing Rust crates for networking, including UPnP and embedded devices

  • develop skills in Rust coding, including the packaging, distributing, and publicising of it, after a career spent with C++

MSRV policy

Cotton's MSRV is now 1.85, new enough to include the MSRV-aware dependency resolver. This means that future MSRV updates will be minor version bumps only, not major version bumps, because they will not break downstream builds.

The final releases which still built with pre-MSRV-aware versions (1.80) were cotton-netif 0.2, cotton-scsi 0.2, cotton-ssdp 0.2, cotton-unique&nbps;0.3, cotton-usb-host 0.2, cotton-usb-host-hid 0.1, cotton-usb-msc 0.2, and cotton-w5500 0.2.

Licence

Everything is licensed under Creative Commons CC0, qv.

About

Low-level networking functionality in Rust

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages