toe-beans 0.10.0

DHCP library, client, and server
Documentation
mod decode;
mod encode;
mod file;
mod flags;
mod helpers;
mod htype;
mod message;
mod op;
mod options;
mod slicer;
mod sname;
mod socket;
mod undecoded;

pub use self::decode::*;
pub use self::encode::*;
pub use self::file::*;
pub use self::flags::*;
pub use self::helpers::*;
pub use self::htype::*;
pub use self::message::*;
pub use self::op::*;
pub use self::options::*;
pub use self::slicer::*;
pub use self::sname::*;
pub use self::socket::*;
pub use self::undecoded::*;

/// All non-variable (not options) fields add to length 236
pub const MESSAGE_FIXED_FIELDS_SIZE: usize = 236;

/// "A DHCP client must be prepared to receive DHCP messages with an options
/// field of at least length 312 octets"
///
/// All other fields add to length 236, so 236 + 312 = 548
pub const MAX_MESSAGE_SIZE: usize = MESSAGE_FIXED_FIELDS_SIZE + MIN_OPTIONS_SIZE;

// ---

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_max_message_size_is_large_enough() {
        // Otherwise other code will not satisfy RFC
        // requirements and may cause panics.
        assert!(MAX_MESSAGE_SIZE >= 548);
    }
}