pub struct DataPacket<'a> {
pub seq_number: u32,
pub position: PacketPosition,
pub in_order: bool,
pub key_flag: EncryptionKeyField,
pub retransmitted: bool,
pub message_number: u32,
pub timestamp: u32,
pub dest_socket_id: u32,
pub data: &'a [u8],
}Expand description
An SRT data packet (draft-sharabayko-srt-01 §3.1, Figure 3).
Fields§
§seq_number: u32Packet Sequence Number — 31 bits.
position: PacketPositionPP: Packet Position Flag.
in_order: boolO: Order Flag — deliver in order (true) or not (false).
key_flag: EncryptionKeyFieldKK: Key-based Encryption Flag.
retransmitted: boolR: Retransmitted Packet Flag.
message_number: u32Message Number — 26 bits.
timestamp: u32Timestamp, in microseconds relative to connection establishment (§3).
dest_socket_id: u32Destination Socket ID (§3).
data: &'a [u8]The payload. Length is whatever remains of the UDP datagram.
Implementations§
Source§impl<'a> DataPacket<'a>
impl<'a> DataPacket<'a>
Sourcepub fn parse(bytes: &'a [u8]) -> Result<Self>
pub fn parse(bytes: &'a [u8]) -> Result<Self>
Parse a data packet from bytes (the full SRT packet, header + data).
§Errors
Error::BufferTooShort if shorter than the 16-byte header;
Error::WrongPacketKind if the F bit is set (this is a control
packet).
Sourcepub fn serialized_len(&self) -> usize
pub fn serialized_len(&self) -> usize
Number of bytes Self::serialize_into will write.
Sourcepub fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
pub fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
Serialize this data packet into buf.
Trait Implementations§
Source§impl<'a> Clone for DataPacket<'a>
impl<'a> Clone for DataPacket<'a>
Source§fn clone(&self) -> DataPacket<'a>
fn clone(&self) -> DataPacket<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for DataPacket<'a>
impl<'a> Debug for DataPacket<'a>
Source§impl<'a> PartialEq for DataPacket<'a>
impl<'a> PartialEq for DataPacket<'a>
Source§impl<'a> Serialize for DataPacket<'a>
Available on crate feature serde only.
impl<'a> Serialize for DataPacket<'a>
Available on crate feature
serde only.impl<'a> StructuralPartialEq for DataPacket<'a>
Auto Trait Implementations§
impl<'a> Freeze for DataPacket<'a>
impl<'a> RefUnwindSafe for DataPacket<'a>
impl<'a> Send for DataPacket<'a>
impl<'a> Sync for DataPacket<'a>
impl<'a> Unpin for DataPacket<'a>
impl<'a> UnsafeUnpin for DataPacket<'a>
impl<'a> UnwindSafe for DataPacket<'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
Mutably borrows from an owned value. Read more