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

type Decoder: Default + TryTaggedDecode<Tag = AttributeType, Item = Self>[src]

The decoder of the value part of the attribute.

type Encoder: Default + SizedEncode<Item = Self>[src]

The encoder of the value part of the attribute.

Loading content...

Required methods

fn get_type(&self) -> AttributeType[src]

Returns the type of the attribute.

Loading content...

Provided methods

fn before_encode<A: Attribute>(&mut self, message: &Message<A>) -> Result<()>[src]

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(()).

fn after_decode<A: Attribute>(&mut self, message: &Message<A>) -> Result<()>[src]

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

The default implementation simply returns Ok(()).

Loading content...

Implementors

impl Attribute for stun_codec::rfc5245::Attribute[src]

type Decoder = AttributeDecoder

type Encoder = AttributeEncoder

impl Attribute for stun_codec::rfc5389::Attribute[src]

type Decoder = AttributeDecoder

type Encoder = AttributeEncoder

impl Attribute for stun_codec::rfc5766::Attribute[src]

type Decoder = AttributeDecoder

type Encoder = AttributeEncoder

impl Attribute for stun_codec::rfc5780::Attribute[src]

type Decoder = AttributeDecoder

type Encoder = AttributeEncoder

impl Attribute for IceControlled[src]

impl Attribute for IceControlling[src]

impl Attribute for Priority[src]

impl Attribute for UseCandidate[src]

impl Attribute for AlternateServer[src]

impl Attribute for ErrorCode[src]

impl Attribute for Fingerprint[src]

impl Attribute for MappedAddress[src]

impl Attribute for MessageIntegrity[src]

impl Attribute for Nonce[src]

impl Attribute for Realm[src]

impl Attribute for Software[src]

impl Attribute for UnknownAttributes[src]

impl Attribute for Username[src]

impl Attribute for XorMappedAddress2[src]

impl Attribute for XorMappedAddress[src]

impl Attribute for ChannelNumber[src]

impl Attribute for Data[src]

impl Attribute for DontFragment[src]

impl Attribute for EvenPort[src]

impl Attribute for Lifetime[src]

impl Attribute for RequestedTransport[src]

impl Attribute for ReservationToken[src]

impl Attribute for XorPeerAddress[src]

type Decoder = XorPeerAddressDecoder

type Encoder = XorPeerAddressEncoder

impl Attribute for XorRelayAddress[src]

type Decoder = XorRelayAddressDecoder

type Encoder = XorRelayAddressEncoder

impl Attribute for ChangeRequest[src]

impl Attribute for OtherAddress[src]

impl Attribute for ResponseOrigin[src]

impl Attribute for ResponsePort[src]

impl Attribute for RawAttribute[src]

Loading content...