EncodeMessage

Trait EncodeMessage 

Source
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§

Source

fn encode_op(&self) -> u8

Represent any data type as the correct amount of op field bytes.

Source

fn encode_htype(&self) -> u8

Represent any data type as the correct amount of htype field bytes.

Source

fn encode_hlen(&self) -> u8

Represent any data type as the correct amount of hlen field bytes.

Source

fn encode_hops(&self) -> u8

Represent any data type as the correct amount of hops field bytes.

Source

fn encode_xid(&self) -> [u8; 4]

Represent any data type as the correct amount of xid field bytes.

Source

fn encode_secs(&self) -> [u8; 2]

Represent any data type as the correct amount of secs field bytes.

Source

fn encode_flags(&self) -> [u8; 2]

Represent any data type as the correct amount of flags field bytes.

Source

fn encode_ciaddr(&self) -> [u8; 4]

Represent any data type as the correct amount of ciaddr field bytes.

Source

fn encode_yiaddr(&self) -> [u8; 4]

Represent any data type as the correct amount of yiaddr field bytes.

Source

fn encode_siaddr(&self) -> [u8; 4]

Represent any data type as the correct amount of siaddr field bytes.

Source

fn encode_giaddr(&self) -> [u8; 4]

Represent any data type as the correct amount of giaddr field bytes.

Source

fn encode_chaddr(&self) -> [u8; 16]

Represent any data type as the correct amount of chaddr field bytes.

Source

fn encode_sname(&self) -> [u8; 64]

Represent any data type as the correct amount of sname field bytes.

Source

fn encode_file(&self) -> [u8; 128]

Represent any data type as the correct amount of file field bytes.

Source

fn encode_options(&self) -> Vec<u8>

Represent any data type as a variable amount of options field bytes.

Provided Methods§

Source

fn encode_magic(&self) -> [u8; 4]

Automagically defined because its a constant

Source

fn to_bytes(&self) -> Vec<u8>

Encodes a Message into a Vec of bytes by calling the encode_* methods defined in EncodeMessage, and uses a Encoder to store the output.

Implementors§