[][src]Struct srt::DataPacket

pub struct DataPacket {
    pub seq_number: SeqNumber,
    pub message_loc: PacketLocation,
    pub in_order_delivery: bool,
    pub message_number: MsgNumber,
    pub timestamp: TimeStamp,
    pub dest_sockid: SocketID,
    pub payload: Bytes,
}

A UDT packet carrying data

This example is not tested
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |0|                     Packet Sequence Number                  |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |FF |O|                     Message Number                      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                          Time Stamp                           |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                    Destination Socket ID                      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

(from https://tools.ietf.org/html/draft-gg-udt-03)

Fields

seq_number: SeqNumber

The sequence number is packet based, so if packet n has sequence number i, the next would have i + 1 Represented by a 31 bit unsigned integer, so Sequence number is wrapped after it recahed 2^31 - 1

message_loc: PacketLocation

Message location and delivery order Represented by the first two bits in the second row of 4 bytes

in_order_delivery: bool

In order delivery, the third bit in the second row of 4 bytes

message_number: MsgNumber

The message number, is the ID of the message being passed Represented by the final 29 bits of the third row It's only 29 bits long, so it's wrapped after 2^29 - 1

timestamp: TimeStamp

The timestamp, relative to when the connection was created.

dest_sockid: SocketID

The dest socket id, used for UDP multiplexing

payload: Bytes

The rest of the packet, the payload

Implementations

impl DataPacket[src]

pub fn parse(buf: &mut impl Buf) -> Result<DataPacket, PacketParseError>[src]

pub fn serialize(&self, into: &mut impl BufMut)[src]

Trait Implementations

impl Clone for DataPacket[src]

impl Debug for DataPacket[src]

impl Eq for DataPacket[src]

impl PartialEq<DataPacket> for DataPacket[src]

impl StructuralEq for DataPacket[src]

impl StructuralPartialEq for DataPacket[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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