#[repr(C)]pub struct DhcpPacket {Show 15 fields
pub op: u8,
pub htype: u8,
pub hlen: u8,
pub hops: u8,
pub xid: u32,
pub secs: u16,
pub flags: u16,
pub ciaddr: Ipv4Address,
pub yiaddr: Ipv4Address,
pub siaddr: Ipv4Address,
pub giaddr: Ipv4Address,
pub chaddr: [u8; 16],
pub sname: [u8; 64],
pub file: [u8; 128],
pub options: Vec<u8>,
}Expand description
DHCP packet structure
Fields§
§op: u8Operation code (1 = request, 2 = reply)
htype: u8Hardware type (1 = Ethernet)
hlen: u8Hardware address length
hops: u8Hops
xid: u32Transaction ID
secs: u16Seconds elapsed
flags: u16Flags
ciaddr: Ipv4AddressClient IP address
yiaddr: Ipv4AddressYour (client) IP address
siaddr: Ipv4AddressServer IP address
giaddr: Ipv4AddressGateway IP address
chaddr: [u8; 16]Client hardware address (16 bytes)
sname: [u8; 64]Server host name (64 bytes)
file: [u8; 128]Boot file name (128 bytes)
options: Vec<u8>Options (variable length)
Implementations§
Source§impl DhcpPacket
impl DhcpPacket
Sourcepub fn new(
message_type: DhcpMessageType,
mac_address: MacAddress,
xid: u32,
) -> Self
pub fn new( message_type: DhcpMessageType, mac_address: MacAddress, xid: u32, ) -> Self
Create a new DHCP packet
Sourcepub fn add_parameter_request_list(&mut self)
pub fn add_parameter_request_list(&mut self)
Add parameter request list
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, KernelError>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, KernelError>
Parse from bytes
Sourcepub fn get_message_type(&self) -> Option<DhcpMessageType>
pub fn get_message_type(&self) -> Option<DhcpMessageType>
Get message type from options
Trait Implementations§
Source§impl Clone for DhcpPacket
impl Clone for DhcpPacket
Source§fn clone(&self) -> DhcpPacket
fn clone(&self) -> DhcpPacket
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DhcpPacket
impl RefUnwindSafe for DhcpPacket
impl Send for DhcpPacket
impl Sync for DhcpPacket
impl Unpin for DhcpPacket
impl UnwindSafe for DhcpPacket
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)