Skip to main content

toe_beans/v4/message/options/
mod.rs

1mod address;
2mod address_list;
3mod file;
4mod max_message;
5mod mtypes;
6mod opaque;
7mod options;
8mod overload_options;
9mod sname;
10mod string;
11mod time;
12mod time_offset;
13
14pub use self::address::*;
15pub use self::address_list::*;
16pub use self::file::*;
17pub use self::max_message::*;
18pub use self::mtypes::*;
19pub use self::opaque::*;
20pub use self::options::*;
21pub use self::overload_options::*;
22pub use self::sname::*;
23pub use self::string::*;
24pub use self::time::*;
25pub use self::time_offset::*;
26
27/// The amount of bytes in a message used for the magic portion of the options field.
28pub const MAGIC_SIZE: usize = 4;
29/// The amount of bytes in a message used for the options field minus the magic bytes.
30pub const NON_MAGIC_SIZE: usize = 308; // aside: does the word "magic" have an antonym?
31
32/// "A DHCP client must be prepared to receive DHCP messages with an options
33/// field of at least length 312 octets"
34pub const MIN_OPTIONS_SIZE: usize = MAGIC_SIZE + NON_MAGIC_SIZE;
35
36/// A type alias for an array of magic bytes
37pub type MagicBuffer = [u8; MAGIC_SIZE];
38
39/// The first four octets of options field with values 99, 130, 83, 99
40pub const MAGIC: MagicBuffer = [99, 130, 83, 99];
41
42/// A type alias for an array of option bytes (minus magic)
43pub type OptionsBuffer = [u8; NON_MAGIC_SIZE];