Trait stun_codec::Attribute[][src]

pub trait Attribute: Sized + Clone {
    type Decoder: Default + TryTaggedDecode<Tag = AttributeType, Item = Self>;
    type Encoder: Default + SizedEncode<Item = Self>;
    fn get_type(&self) -> AttributeType;

    fn before_encode<A: Attribute>(
        &mut self,
        message: &Message<A>
    ) -> Result<()> { ... }
fn after_decode<A: Attribute>(&mut self, message: &Message<A>) -> Result<()> { ... } }

STUN attribute.

Attribute: The STUN term for a Type-Length-Value (TLV) object that can be added to a STUN message. Attributes are divided into two types: comprehension-required and comprehension-optional. STUN agents can safely ignore comprehension-optional attributes they don't understand, but cannot successfully process a message if it contains comprehension-required attributes that are not understood.

RFC 5389 -- 5. Definitions

Associated Types

The decoder of the value part of the attribute.

The encoder of the value part of the attribute.

Required Methods

Returns the type of the attribute.

Provided Methods

This method is called before encoding the attribute.

message is the message to which the attribute belongs. The message only contains the attributes preceding to self.

The default implementation simply returns Ok(()).

This method is called after decoding the attribute and before being appended to the given message.

The default implementation simply returns Ok(()).

Implementors