Struct stun_coder::StunHeader [−][src]
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
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
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self