#[non_exhaustive]pub enum Header {
Authenticate(Authenticate),
Connect(Connect),
Packet(Packet),
Dissociate(Dissociate),
Heartbeat(Heartbeat),
}
Expand description
The command header for negotiating tasks
+-----+------+----------+
| VER | TYPE | OPT |
+-----+------+----------+
| 1 | 1 | Variable |
+-----+------+----------+
where:
VER
- the TUIC protocol versionTYPE
- command typeOPT
- command type specific data
Command Types
There are five types of command:
0x00
-Authenticate
- for authenticating the multiplexed stream0x01
-Connect
- for establishing a TCP relay0x02
-Packet
- for relaying (fragmented part of) a UDP packet0x03
-Dissociate
- for terminating a UDP relaying session0x04
-Heartbeat
- for keeping the QUIC connection alive
Command Connect
and Packet
carry payload (stream / packet fragment)
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Authenticate(Authenticate)
Connect(Connect)
Packet(Packet)
Dissociate(Dissociate)
Heartbeat(Heartbeat)
Implementations§
source§impl Header
impl Header
pub const TYPE_CODE_AUTHENTICATE: u8 = 0u8
pub const TYPE_CODE_CONNECT: u8 = 1u8
pub const TYPE_CODE_PACKET: u8 = 2u8
pub const TYPE_CODE_DISSOCIATE: u8 = 3u8
pub const TYPE_CODE_HEARTBEAT: u8 = 4u8
source§impl Header
impl Header
source§impl Header
impl Header
sourcepub async fn async_unmarshal(
s: &mut impl AsyncRead + Unpin
) -> Result<Self, UnmarshalError>
pub async fn async_unmarshal( s: &mut impl AsyncRead + Unpin ) -> Result<Self, UnmarshalError>
Unmarshals a header from an AsyncRead
stream
sourcepub fn unmarshal(s: &mut impl Read) -> Result<Self, UnmarshalError>
pub fn unmarshal(s: &mut impl Read) -> Result<Self, UnmarshalError>
Unmarshals a header from a Read
stream
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
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