pub struct TcpSegment<'a>(/* private fields */);Expand description
Wrapper around pnet’s TcpPacket for adding additional funcitonality
Implementations§
Source§impl TcpSegment<'_>
impl TcpSegment<'_>
pub fn new<'a>(packet: &'a [u8]) -> Option<TcpSegment<'a>>
Sourcepub fn has_payload(&self) -> bool
pub fn has_payload(&self) -> bool
Return true if the TCP segment has a payload
pub fn create_clone<'a>(&self) -> TcpSegment<'a>
Methods from Deref<Target = pnet_TcpPacket<'a>>§
Sourcepub fn to_immutable<'p>(&'p self) -> TcpPacket<'p>
pub fn to_immutable<'p>(&'p self) -> TcpPacket<'p>
Maps from a TcpPacket to a TcpPacket
Sourcepub fn get_source(&self) -> u16
pub fn get_source(&self) -> u16
Get the source field. This field is always stored big-endian within the struct, but this accessor returns host order.
Sourcepub fn get_destination(&self) -> u16
pub fn get_destination(&self) -> u16
Get the destination field. This field is always stored big-endian within the struct, but this accessor returns host order.
Sourcepub fn get_sequence(&self) -> u32
pub fn get_sequence(&self) -> u32
Get the sequence field. This field is always stored big-endian within the struct, but this accessor returns host order.
Sourcepub fn get_acknowledgement(&self) -> u32
pub fn get_acknowledgement(&self) -> u32
Get the acknowledgement field. This field is always stored big-endian within the struct, but this accessor returns host order.
Sourcepub fn get_data_offset(&self) -> u8
pub fn get_data_offset(&self) -> u8
Get the data_offset field.
Sourcepub fn get_reserved(&self) -> u8
pub fn get_reserved(&self) -> u8
Get the reserved field.
Sourcepub fn get_window(&self) -> u16
pub fn get_window(&self) -> u16
Get the window field. This field is always stored big-endian within the struct, but this accessor returns host order.
Sourcepub fn get_checksum(&self) -> u16
pub fn get_checksum(&self) -> u16
Get the checksum field. This field is always stored big-endian within the struct, but this accessor returns host order.
Sourcepub fn get_urgent_ptr(&self) -> u16
pub fn get_urgent_ptr(&self) -> u16
Get the urgent_ptr field. This field is always stored big-endian within the struct, but this accessor returns host order.
Sourcepub fn get_options_raw(&self) -> &[u8] ⓘ
pub fn get_options_raw(&self) -> &[u8] ⓘ
Get the raw &u8 value of the options field, without copying
Sourcepub fn get_options(&self) -> Vec<TcpOption>
pub fn get_options(&self) -> Vec<TcpOption>
Get the value of the options field (copies contents)
Sourcepub fn get_options_iter(&self) -> TcpOptionIterable<'_>
pub fn get_options_iter(&self) -> TcpOptionIterable<'_>
Get the value of the options field as iterator
Trait Implementations§
Source§impl<'a> Debug for TcpSegment<'a>
impl<'a> Debug for TcpSegment<'a>
Source§impl<'a> Deref for TcpSegment<'a>
impl<'a> Deref for TcpSegment<'a>
Source§impl<'a> From<TcpPacket<'a>> for TcpSegment<'a>
impl<'a> From<TcpPacket<'a>> for TcpSegment<'a>
Source§fn from(ipv4_packet: pnet_TcpPacket<'a>) -> Self
fn from(ipv4_packet: pnet_TcpPacket<'a>) -> Self
Source§impl<'a> FromIterator<TcpSegment<'a>> for TcpSegmentCollection<'a>
impl<'a> FromIterator<TcpSegment<'a>> for TcpSegmentCollection<'a>
Source§fn from_iter<I: IntoIterator<Item = TcpSegment<'a>>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = TcpSegment<'a>>>(iter: I) -> Self
Auto Trait Implementations§
impl<'a> Freeze for TcpSegment<'a>
impl<'a> RefUnwindSafe for TcpSegment<'a>
impl<'a> Send for TcpSegment<'a>
impl<'a> Sync for TcpSegment<'a>
impl<'a> Unpin for TcpSegment<'a>
impl<'a> UnwindSafe for TcpSegment<'a>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more