Skip to main content

TcpSegmentBuilder

Struct TcpSegmentBuilder 

Source
pub struct TcpSegmentBuilder<'a, 'b> { /* private fields */ }
Expand description

Builds a TCP header in caller-owned storage.

Implementations§

Source§

impl<'a, 'b> TcpSegmentBuilder<'a, 'b>

Source

pub fn new(buffer: &'a mut [u8], payload_length: usize) -> Self

Starts a builder for payload_length bytes, which are left untouched.

Source

pub fn source_port(self, value: u16) -> Self

Supplies the source port.

Source

pub fn destination_port(self, value: u16) -> Self

Supplies the destination port.

Source

pub fn options(self, value: &'b [u8]) -> Self

Supplies copied header options.

Source

pub fn sequence_number(self, value: u32) -> Self

Supplies the sequence number.

Source

pub fn acknowledgment_number(self, value: u32) -> Self

Supplies the acknowledgment number.

Source

pub fn flags(self, value: TcpFlags) -> Self

Supplies flags.

Source

pub fn window_size(self, value: u16) -> Self

Supplies the window size.

Source

pub fn checksum(self, value: u16) -> Self

Supplies the checksum.

Source

pub fn urgent_pointer(self, value: u16) -> Self

Supplies the urgent pointer.

Source

pub fn build(self) -> Result<TcpSegmentMut<'a>, TcpSegmentBuildError>

Validates inputs and writes only the TCP header and options.

Auto Trait Implementations§

§

impl<'a, 'b> !UnwindSafe for TcpSegmentBuilder<'a, 'b>

§

impl<'a, 'b> Freeze for TcpSegmentBuilder<'a, 'b>

§

impl<'a, 'b> RefUnwindSafe for TcpSegmentBuilder<'a, 'b>

§

impl<'a, 'b> Send for TcpSegmentBuilder<'a, 'b>

§

impl<'a, 'b> Sync for TcpSegmentBuilder<'a, 'b>

§

impl<'a, 'b> Unpin for TcpSegmentBuilder<'a, 'b>

§

impl<'a, 'b> UnsafeUnpin for TcpSegmentBuilder<'a, 'b>

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.