Struct stun_coder::StunHeader
source · [−]pub struct StunHeader {
pub message_class: StunMessageClass,
pub message_method: StunMessageMethod,
pub transaction_id: [u8; 12],
pub message_len: u16,
}
Expand description
All STUN messages MUST start with a 20-byte header followed by zero or more Attributes. The STUN header contains a STUN message type, magic cookie, transaction ID, and message length.
The most significant 2 bits of every STUN message MUST be zeroes. This can be used to differentiate STUN packets from other protocols when STUN is multiplexed with other protocols on the same port.
The message type defines the message class (request, success response, failure response, or indication) and the message method (the primary function) of the STUN message. Although there are four message classes, there are only two types of transactions in STUN: request/response transactions (which consist of a request message and a response message) and indication transactions (which consist of a single indication message). Response classes are split into error and success responses to aid in quickly processing the STUN message.
Fields
message_class: StunMessageClass
STUN message class
message_method: StunMessageMethod
STUN message method
transaction_id: [u8; 12]
STUN transaction id
message_len: u16
STUN message length Only set to a non-zero value when decoding the header
Trait Implementations
sourceimpl Clone for StunHeader
impl Clone for StunHeader
sourcefn clone(&self) -> StunHeader
fn clone(&self) -> StunHeader
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for StunHeader
impl Debug for StunHeader
impl Copy for StunHeader
Auto Trait Implementations
impl RefUnwindSafe for StunHeader
impl Send for StunHeader
impl Sync for StunHeader
impl Unpin for StunHeader
impl UnwindSafe for StunHeader
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more