#[repr(C)]
pub struct StreamFrame { pub sport: u16, pub dport: u16, pub flag: StreamFlag, pub data: Bytes, }
Expand description

Stream frame.

See PROTOCOL.md for details.

Fields§

§sport: u16

Source port (2 bytes)

§dport: u16

Destination port (2 bytes)

§flag: StreamFlag

Frame type (1 byte)

§data: Bytes

Data

Implementations§

source§

impl StreamFrame

source

pub fn new_syn(dest_host: &[u8], dest_port: u16, sport: u16, rwnd: u64) -> Self

Create a new StreamFlag::Syn frame.

Arguments
  • dest_host: The destination host to forward to.
  • dest_port: The destination port to forward to.
  • sport: The source port of this stream.
  • rwnd: Number of frames buffered in the client receive buffer.
source

pub fn new_synack(sport: u16, dport: u16, rwnd: u64) -> Self

Create a new StreamFlag::SynAck frame.

Arguments
  • sport: The source port of this stream.
  • dport: The destination port of this stream (i.e. the source port of the Syn frame).
  • rwnd: Number of frames buffered in the server receive buffer.
source

pub fn new_ack(sport: u16, dport: u16, psh_recvd_since: u64) -> Self

Create a new StreamFlag::Ack frame.

Arguments
  • sport: The source port of this stream.
  • dport: The destination port of this stream.
  • psh_recvd_since: The number of Psh frames received since the previous Ack frame.
source

pub const fn new_rst(sport: u16, dport: u16) -> Self

Create a new StreamFlag::Rst frame.

Arguments
  • sport: The destination port of the offending frame.
  • dport: The source port of the offending frame.
source

pub const fn new_fin(sport: u16, dport: u16) -> Self

Create a new StreamFlag::Fin frame.

Arguments
  • sport: The source port of this stream.
  • dport: The destination port of this stream.
source

pub const fn new_psh(sport: u16, dport: u16, data: Bytes) -> Self

Create a new StreamFlag::Psh frame.

Arguments
  • sport: The source port of this stream.
  • dport: The destination port of this stream.
  • data: The data to send.

Trait Implementations§

source§

impl Clone for StreamFrame

source§

fn clone(&self) -> StreamFrame

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for StreamFrame

source§

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

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

impl From<StreamFrame> for Message

source§

fn from(frame: StreamFrame) -> Self

Converts to this type from the input type.
source§

impl From<StreamFrame> for Vec<u8>

source§

fn from(frame: StreamFrame) -> Self

Convert a StreamFrame to bytes.

source§

impl PartialEq for StreamFrame

source§

fn eq(&self, other: &StreamFrame) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl TryFrom<Bytes> for StreamFrame

§

type Error = Error

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

fn try_from(data: Bytes) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for StreamFrame

source§

impl StructuralEq for StreamFrame

source§

impl StructuralPartialEq for StreamFrame

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere 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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more