Struct netsim::wire::Ipv4Packet
[−]
[src]
pub struct Ipv4Packet { /* fields omitted */ }
An Ipv4 packet.
Methods
impl Ipv4Packet
[src]
fn new_from_fields(fields: Ipv4Fields, payload: &Ipv4Payload) -> Ipv4Packet
[src]
Create a new Ipv4Packet
with the given header fields and payload. If you are also
creating the packet's payload data it can be more efficient to use
new_from_fields_recursive
and save an allocation/copy.
fn new_from_fields_recursive(
fields: Ipv4Fields,
payload_fields: Ipv4PayloadFields
) -> Ipv4Packet
[src]
fields: Ipv4Fields,
payload_fields: Ipv4PayloadFields
) -> Ipv4Packet
Create a new Ipv4Packet
with the given header fields and payload fields.
fn write_to_buffer(
buffer: &mut [u8],
fields: Ipv4Fields,
payload_fields: Ipv4PayloadFields
)
[src]
buffer: &mut [u8],
fields: Ipv4Fields,
payload_fields: Ipv4PayloadFields
)
Create a new Ipv4 packet by writing it to the given empty buffer.
fn from_bytes(buffer: Bytes) -> Ipv4Packet
[src]
Parse an Ipv4 packet from the given buffer.
fn fields(&self) -> Ipv4Fields
[src]
Get the header of fields of this packet.
fn set_fields(&mut self, fields: Ipv4Fields)
[src]
Set the packet's header fields.
fn source_ip(&self) -> Ipv4Addr
[src]
Get the source Ipv4 address.
fn dest_ip(&self) -> Ipv4Addr
[src]
Get the destination Ipv4 address.
fn ttl(&self) -> u8
[src]
Get the hop count/time-to-live of this packet.
fn payload(&self) -> Ipv4Payload
[src]
Get the packet's payload
fn as_bytes(&self) -> &Bytes
[src]
Returns the underlying packet data.
fn verify_checksum(&self) -> bool
[src]
Check that this packet has a valid checksum.
Trait Implementations
impl Clone for Ipv4Packet
[src]
fn clone(&self) -> Ipv4Packet
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq for Ipv4Packet
[src]
fn eq(&self, __arg_0: &Ipv4Packet) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Ipv4Packet) -> bool
[src]
This method tests for !=
.