TcpSegment

Struct TcpSegment 

Source
pub struct TcpSegment<'a>(/* private fields */);
Expand description

Wrapper around pnet’s TcpPacket for adding additional funcitonality

Implementations§

Source§

impl TcpSegment<'_>

Source

pub fn new<'a>(packet: &'a [u8]) -> Option<TcpSegment<'a>>

Source

pub fn has_payload(&self) -> bool

Return true if the TCP segment has a payload

Source

pub fn create_clone<'a>(&self) -> TcpSegment<'a>

Methods from Deref<Target = pnet_TcpPacket<'a>>§

Source

pub fn to_immutable<'p>(&'p self) -> TcpPacket<'p>

Maps from a TcpPacket to a TcpPacket

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn get_data_offset(&self) -> u8

Get the data_offset field.

Source

pub fn get_reserved(&self) -> u8

Get the reserved field.

Source

pub fn get_flags(&self) -> u8

Get the flags field.

Source

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.

Source

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.

Source

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.

Source

pub fn get_options_raw(&self) -> &[u8]

Get the raw &u8 value of the options field, without copying

Source

pub fn get_options(&self) -> Vec<TcpOption>

Get the value of the options field (copies contents)

Source

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>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Deref for TcpSegment<'a>

Source§

type Target = TcpPacket<'a>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'a> From<TcpPacket<'a>> for TcpSegment<'a>

Source§

fn from(ipv4_packet: pnet_TcpPacket<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> FromIterator<TcpSegment<'a>> for TcpSegmentCollection<'a>

Source§

fn from_iter<I: IntoIterator<Item = TcpSegment<'a>>>(iter: I) -> Self

Creates a value from an iterator. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.