toe_beans/lib.rs
1//! Toe Beans is a DHCP library. It includes an optional DHCP client and server that implements the library.
2//!
3//! A DHCP client may use this library to encode a message it sends as a request to a DHCP server, or decode a response from a DHCP server.
4//!
5//! A DHCP server may use this library to decode a request from a DHCP client, perform some logic, and then encode a response.
6//!
7//! ```text
8//! DHCP Client DHCP Server
9//! +----------------+ +----------------+
10//! | encode message | ---request--> | decode message |
11//! | decode message | <--response-- | encode message |
12//! +----------------+ +----------------+
13//!
14//! ```
15//! Encoding converts a Message struct, that is easy for humans to use, into a byte array. The byte array contains many 1's and 0's that are easy for computers to use. Decoding, the reverse of encoding, is where the byte array is converted into a Message struct.
16//!
17//! **D**ynamic **H**ost **C**onfiguration **P**rotocol is a standard way of arranging those 1's and 0's that everyone can agree on. This library implements that protocol.
18//!
19//! ```text
20//! Message struct Message byte array
21//! +-------------------------+ ---encoding--> +--------------------+
22//! | op: Ops::Request | | 0000000100000001 |
23//! | htype: HTypes::Ethernet | | ... |
24//! | ... | | ... |
25//! +-------------------------+ <--decoding--- +--------------------+
26//! ```
27
28/// Used to lease [IPv4](https://en.wikipedia.org/wiki/Internet_Protocol_version_4) addresses to clients.
29///
30/// Implements DHCPv4 with the following RFCs:
31/// - [RFC-2131](https://datatracker.ietf.org/doc/html/rfc2131#section-2)
32pub mod v4;