pub struct Ipv4Packet {Show 15 fields
pub version: u8,
pub header_length: u8,
pub dscp: u8,
pub ecn: u8,
pub total_length: u16,
pub identification: u16,
pub flags: u8,
pub fragment_offset: u16,
pub ttl: u8,
pub next_protocol: IpNextLevelProtocol,
pub checksum: u16,
pub source: Ipv4Addr,
pub destination: Ipv4Addr,
pub options: Vec<Ipv4Option>,
pub payload: Vec<u8>,
}
Expand description
Represents an IPv4 packet.
Fields§
§version: u8
IP version
header_length: u8
IP header length
dscp: u8
Differentiated Services Code Point (DSCP)
ecn: u8
Explicit Congestion Notification (ECN)
total_length: u16
Total length
identification: u16
Identification
flags: u8
Flags
fragment_offset: u16
Fragment offset
ttl: u8
Time to live
next_protocol: IpNextLevelProtocol
Next level protocol
checksum: u16
Checksum
source: Ipv4Addr
Source IP address
destination: Ipv4Addr
Destination IP address
options: Vec<Ipv4Option>
Options
payload: Vec<u8>
Payload
Implementations§
Source§impl Ipv4Packet
impl Ipv4Packet
Sourcepub fn from_bytes(packet: &[u8]) -> Ipv4Packet
pub fn from_bytes(packet: &[u8]) -> Ipv4Packet
Constructs a new Ipv4Packet from bytes
Trait Implementations§
Source§impl Clone for Ipv4Packet
impl Clone for Ipv4Packet
Source§fn clone(&self) -> Ipv4Packet
fn clone(&self) -> Ipv4Packet
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Ipv4Packet
impl Debug for Ipv4Packet
Source§impl PartialEq for Ipv4Packet
impl PartialEq for Ipv4Packet
impl StructuralPartialEq for Ipv4Packet
Auto Trait Implementations§
impl Freeze for Ipv4Packet
impl RefUnwindSafe for Ipv4Packet
impl Send for Ipv4Packet
impl Sync for Ipv4Packet
impl Unpin for Ipv4Packet
impl UnwindSafe for Ipv4Packet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more