pub trait EncodeMessage {
Show 17 methods
// Required methods
fn encode_op(&self) -> u8;
fn encode_htype(&self) -> u8;
fn encode_hlen(&self) -> u8;
fn encode_hops(&self) -> u8;
fn encode_xid(&self) -> [u8; 4];
fn encode_secs(&self) -> [u8; 2];
fn encode_flags(&self) -> [u8; 2];
fn encode_ciaddr(&self) -> [u8; 4];
fn encode_yiaddr(&self) -> [u8; 4];
fn encode_siaddr(&self) -> [u8; 4];
fn encode_giaddr(&self) -> [u8; 4];
fn encode_chaddr(&self) -> [u8; 16];
fn encode_sname(&self) -> [u8; 64];
fn encode_file(&self) -> [u8; 128];
fn encode_options(&self) -> Vec<u8> ⓘ;
// Provided methods
fn encode_magic(&self) -> [u8; 4] { ... }
fn to_bytes(&self) -> Vec<u8> ⓘ { ... }
}Expand description
Define how your custom Message type encodes itself into the bytes of a DHCP message’s fields.
…or don’t and use our homemade Message with this already implemented.
If your type is in a different module you can define
From or Into
in that module and call that method in one of this trait’s encode_*
methods. See Message’s implementation for details.
Required Methods§
Sourcefn encode_htype(&self) -> u8
fn encode_htype(&self) -> u8
Represent any data type as the correct amount of htype field bytes.
Sourcefn encode_hlen(&self) -> u8
fn encode_hlen(&self) -> u8
Represent any data type as the correct amount of hlen field bytes.
Sourcefn encode_hops(&self) -> u8
fn encode_hops(&self) -> u8
Represent any data type as the correct amount of hops field bytes.
Sourcefn encode_xid(&self) -> [u8; 4]
fn encode_xid(&self) -> [u8; 4]
Represent any data type as the correct amount of xid field bytes.
Sourcefn encode_secs(&self) -> [u8; 2]
fn encode_secs(&self) -> [u8; 2]
Represent any data type as the correct amount of secs field bytes.
Sourcefn encode_flags(&self) -> [u8; 2]
fn encode_flags(&self) -> [u8; 2]
Represent any data type as the correct amount of flags field bytes.
Sourcefn encode_ciaddr(&self) -> [u8; 4]
fn encode_ciaddr(&self) -> [u8; 4]
Represent any data type as the correct amount of ciaddr field bytes.
Sourcefn encode_yiaddr(&self) -> [u8; 4]
fn encode_yiaddr(&self) -> [u8; 4]
Represent any data type as the correct amount of yiaddr field bytes.
Sourcefn encode_siaddr(&self) -> [u8; 4]
fn encode_siaddr(&self) -> [u8; 4]
Represent any data type as the correct amount of siaddr field bytes.
Sourcefn encode_giaddr(&self) -> [u8; 4]
fn encode_giaddr(&self) -> [u8; 4]
Represent any data type as the correct amount of giaddr field bytes.
Sourcefn encode_chaddr(&self) -> [u8; 16]
fn encode_chaddr(&self) -> [u8; 16]
Represent any data type as the correct amount of chaddr field bytes.
Sourcefn encode_sname(&self) -> [u8; 64]
fn encode_sname(&self) -> [u8; 64]
Represent any data type as the correct amount of sname field bytes.
Sourcefn encode_file(&self) -> [u8; 128]
fn encode_file(&self) -> [u8; 128]
Represent any data type as the correct amount of file field bytes.
Sourcefn encode_options(&self) -> Vec<u8> ⓘ
fn encode_options(&self) -> Vec<u8> ⓘ
Represent any data type as a variable amount of options field bytes.
Provided Methods§
Sourcefn encode_magic(&self) -> [u8; 4]
fn encode_magic(&self) -> [u8; 4]
Automagically defined because its a constant