[−][src]Struct smoltcp::wire::TcpPacket
A read/write wrapper around a Transmission Control Protocol packet buffer.
Methods
impl<T: AsRef<[u8]>> Packet<T>
[src]
pub fn new_unchecked(buffer: T) -> Packet<T>
[src]
Imbue a raw octet buffer with TCP packet structure.
pub fn new_checked(buffer: T) -> Result<Packet<T>>
[src]
Shorthand for a combination of new_unchecked and check_len.
pub fn check_len(&self) -> Result<()>
[src]
Ensure that no accessor method will panic if called.
Returns Err(Error::Truncated)
if the buffer is too short.
Returns Err(Error::Malformed)
if the header length field has a value smaller
than the minimal header length.
The result of this check is invalidated by calling set_header_len.
pub fn into_inner(self) -> T
[src]
Consume the packet, returning the underlying buffer.
pub fn src_port(&self) -> u16
[src]
Return the source port field.
pub fn dst_port(&self) -> u16
[src]
Return the destination port field.
pub fn seq_number(&self) -> SeqNumber
[src]
Return the sequence number field.
pub fn ack_number(&self) -> SeqNumber
[src]
Return the acknowledgement number field.
pub fn fin(&self) -> bool
[src]
Return the FIN flag.
pub fn syn(&self) -> bool
[src]
Return the SYN flag.
pub fn rst(&self) -> bool
[src]
Return the RST flag.
pub fn psh(&self) -> bool
[src]
Return the PSH flag.
pub fn ack(&self) -> bool
[src]
Return the ACK flag.
pub fn urg(&self) -> bool
[src]
Return the URG flag.
pub fn ece(&self) -> bool
[src]
Return the ECE flag.
pub fn cwr(&self) -> bool
[src]
Return the CWR flag.
pub fn ns(&self) -> bool
[src]
Return the NS flag.
pub fn header_len(&self) -> u8
[src]
Return the header length, in octets.
pub fn window_len(&self) -> u16
[src]
Return the window size field.
pub fn checksum(&self) -> u16
[src]
Return the checksum field.
pub fn urgent_at(&self) -> u16
[src]
Return the urgent pointer field.
pub fn segment_len(&self) -> usize
[src]
Return the length of the segment, in terms of sequence space.
pub fn selective_ack_permitted(&self) -> Result<bool>
[src]
Returns whether the selective acknowledgement SYN flag is set or not.
pub fn selective_ack_ranges<'s>(&'s self) -> Result<[Option<(u32, u32)>; 3]>
[src]
Return the selective acknowledgement ranges, if any. If there are none in the packet, an
array of None
values will be returned.
pub fn verify_checksum(
&self,
src_addr: &IpAddress,
dst_addr: &IpAddress
) -> bool
[src]
&self,
src_addr: &IpAddress,
dst_addr: &IpAddress
) -> bool
impl<'a, T: AsRef<[u8]> + ?Sized> Packet<&'a T>
[src]
pub fn options(&self) -> &'a [u8]
[src]
Return a pointer to the options.
pub fn payload(&self) -> &'a [u8]
[src]
Return a pointer to the payload.
impl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T>
[src]
pub fn set_src_port(&mut self, value: u16)
[src]
Set the source port field.
pub fn set_dst_port(&mut self, value: u16)
[src]
Set the destination port field.
pub fn set_seq_number(&mut self, value: SeqNumber)
[src]
Set the sequence number field.
pub fn set_ack_number(&mut self, value: SeqNumber)
[src]
Set the acknowledgement number field.
pub fn clear_flags(&mut self)
[src]
Clear the entire flags field.
pub fn set_fin(&mut self, value: bool)
[src]
Set the FIN flag.
pub fn set_syn(&mut self, value: bool)
[src]
Set the SYN flag.
pub fn set_rst(&mut self, value: bool)
[src]
Set the RST flag.
pub fn set_psh(&mut self, value: bool)
[src]
Set the PSH flag.
pub fn set_ack(&mut self, value: bool)
[src]
Set the ACK flag.
pub fn set_urg(&mut self, value: bool)
[src]
Set the URG flag.
pub fn set_ece(&mut self, value: bool)
[src]
Set the ECE flag.
pub fn set_cwr(&mut self, value: bool)
[src]
Set the CWR flag.
pub fn set_ns(&mut self, value: bool)
[src]
Set the NS flag.
pub fn set_header_len(&mut self, value: u8)
[src]
Set the header length, in octets.
pub fn set_window_len(&mut self, value: u16)
[src]
Return the window size field.
pub fn set_checksum(&mut self, value: u16)
[src]
Set the checksum field.
pub fn set_urgent_at(&mut self, value: u16)
[src]
Set the urgent pointer field.
pub fn fill_checksum(&mut self, src_addr: &IpAddress, dst_addr: &IpAddress)
[src]
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.
pub fn options_mut(&mut self) -> &mut [u8]
[src]
Return a pointer to the options.
pub fn payload_mut(&mut self) -> &mut [u8]
[src]
Return a mutable pointer to the payload data.
Trait Implementations
impl<T: AsRef<[u8]>> AsRef<[u8]> for Packet<T>
[src]
impl<T: Clone + AsRef<[u8]>> Clone for Packet<T>
[src]
impl<T: Debug + AsRef<[u8]>> Debug for Packet<T>
[src]
impl<'a, T: AsRef<[u8]> + ?Sized> Display for Packet<&'a T>
[src]
impl<T: PartialEq + AsRef<[u8]>> PartialEq<Packet<T>> for Packet<T>
[src]
impl<T: AsRef<[u8]>> PrettyPrint for Packet<T>
[src]
fn pretty_print(
buffer: &dyn AsRef<[u8]>,
f: &mut Formatter,
indent: &mut PrettyIndent
) -> Result
[src]
buffer: &dyn AsRef<[u8]>,
f: &mut Formatter,
indent: &mut PrettyIndent
) -> Result
impl<T: AsRef<[u8]>> StructuralPartialEq for Packet<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Packet<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Packet<T> where
T: Send,
T: Send,
impl<T> Sync for Packet<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Packet<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Packet<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,