Struct netsim::wire::UdpPacket
[−]
[src]
pub struct UdpPacket { /* fields omitted */ }
A UDP packet
Methods
impl UdpPacket
[src]
fn new_from_fields(fields: UdpFields, payload: Bytes) -> UdpPacket
[src]
Create a new UDP packet from the given header fields and payload.
fn write_to_buffer(buffer: &mut [u8], fields: UdpFields, payload: Bytes)
[src]
Write a UDP packet to the given empty buffer.
fn from_bytes(buffer: Bytes) -> UdpPacket
[src]
Parse a UDP packet from the given buffer.
fn set_fields(&mut self, fields: UdpFields)
[src]
Set the header fields of this UDP packet.
fn source_port(&self) -> u16
[src]
Get the packet's source port.
fn dest_port(&self) -> u16
[src]
Get the packet's destination port.
fn payload(&self) -> Bytes
[src]
Get the packet's payload data.
fn as_bytes(&self) -> &Bytes
[src]
Get the entire packet as a raw byte buffer.
fn verify_checksum_v4(&self, source_ip: Ipv4Addr, dest_ip: Ipv4Addr) -> bool
[src]
Verify the checksum of the packet. The source/destination IP addresses of the packet are needed to calculate the checksum.
Trait Implementations
impl Clone for UdpPacket
[src]
fn clone(&self) -> UdpPacket
[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 UdpPacket
[src]
fn eq(&self, __arg_0: &UdpPacket) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &UdpPacket) -> bool
[src]
This method tests for !=
.