Struct cross_socket::packet::ipv4::Ipv4Packet
source · 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_level_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_level_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 copy 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<Ipv4Packet> for Ipv4Packet
impl PartialEq<Ipv4Packet> for Ipv4Packet
source§fn eq(&self, other: &Ipv4Packet) -> bool
fn eq(&self, other: &Ipv4Packet) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for Ipv4Packet
Auto Trait Implementations§
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