Struct smoltcp::wire::TcpPacket
[−]
[src]
pub struct TcpPacket<T: AsRef<[u8]>> { /* fields omitted */ }
A read/write wrapper around an Transmission Control Protocol packet buffer.
Methods
impl<T: AsRef<[u8]>> Packet<T>
[src]
fn new(buffer: T) -> Result<Packet<T>, Error>
Wrap a buffer with a TCP packet. Returns an error if the buffer is too small to contain one.
fn into_inner(self) -> T
Consumes the packet, returning the underlying buffer.
fn src_port(&self) -> u16
Return the source port field.
fn dst_port(&self) -> u16
Return the destination port field.
fn seq_number(&self) -> SeqNumber
Return the sequence number field.
fn ack_number(&self) -> SeqNumber
Return the acknowledgement number field.
fn fin(&self) -> bool
Return the FIN flag.
fn syn(&self) -> bool
Return the SYN flag.
fn rst(&self) -> bool
Return the RST flag.
fn psh(&self) -> bool
Return the PSH flag.
fn ack(&self) -> bool
Return the ACK flag.
fn urg(&self) -> bool
Return the URG flag.
fn ece(&self) -> bool
Return the ECE flag.
fn cwr(&self) -> bool
Return the CWR flag.
fn ns(&self) -> bool
Return the NS flag.
fn header_len(&self) -> u8
Return the header length, in octets.
fn window_len(&self) -> u16
Return the window size field.
fn checksum(&self) -> u16
Return the checksum field.
fn urgent_at(&self) -> u16
Return the urgent pointer field.
fn segment_len(&self) -> usize
Return the length of the segment, in terms of sequence space.
fn verify_checksum(&self, src_addr: &IpAddress, dst_addr: &IpAddress) -> bool
Validate the packet checksum.
Panics
This function panics unless src_addr
and dst_addr
belong to the same family,
and that family is IPv4 or IPv6.
impl<'a, T: AsRef<[u8]> + ?Sized> Packet<&'a T>
[src]
impl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T>
[src]
fn set_src_port(&mut self, value: u16)
Set the source port field.
fn set_dst_port(&mut self, value: u16)
Set the destination port field.
fn set_seq_number(&mut self, value: SeqNumber)
Set the sequence number field.
fn set_ack_number(&mut self, value: SeqNumber)
Set the acknowledgement number field.
fn clear_flags(&mut self)
Clear the entire flags field.
fn set_fin(&mut self, value: bool)
Set the FIN flag.
fn set_syn(&mut self, value: bool)
Set the SYN flag.
fn set_rst(&mut self, value: bool)
Set the RST flag.
fn set_psh(&mut self, value: bool)
Set the PSH flag.
fn set_ack(&mut self, value: bool)
Set the ACK flag.
fn set_urg(&mut self, value: bool)
Set the URG flag.
fn set_ece(&mut self, value: bool)
Set the ECE flag.
fn set_cwr(&mut self, value: bool)
Set the CWR flag.
fn set_ns(&mut self, value: bool)
Set the NS flag.
fn set_header_len(&mut self, value: u8)
Set the header length, in octets.
fn set_window_len(&mut self, value: u16)
Return the window size field.
fn set_checksum(&mut self, value: u16)
Set the checksum field.
fn set_urgent_at(&mut self, value: u16)
Set the urgent pointer field.
fn fill_checksum(&mut self, src_addr: &IpAddress, dst_addr: &IpAddress)
Compute and fill in the header checksum.
Panics
This function panics unless src_addr
and dst_addr
belong to the same family,
and that family is IPv4 or IPv6.
impl<'a, T: AsRef<[u8]> + AsMut<[u8]> + ?Sized> Packet<&'a mut T>
[src]
fn payload_mut(&mut self) -> &mut [u8]
Return a mutable pointer to the payload data.
Trait Implementations
impl<T: Debug + AsRef<[u8]>> Debug for Packet<T>
[src]
impl<'a, T: AsRef<[u8]> + ?Sized> Display for Packet<&'a T>
[src]
impl<T: AsRef<[u8]>> PrettyPrint for Packet<T>
[src]
fn pretty_print(buffer: &AsRef<[u8]>,
f: &mut Formatter,
indent: &mut PrettyIndent)
-> Result
f: &mut Formatter,
indent: &mut PrettyIndent)
-> Result
Write a concise, formatted representation of a packet contained in the provided buffer, and any nested packets it may contain. Read more