medea_turn/
attr.rs

1//! [STUN] and [TURN] attributes used by a [`Server`].
2//!
3//! [`Server`]: crate::Server
4//! [STUN]: https://en.wikipedia.org/wiki/STUN
5//! [TURN]: https://en.wikipedia.org/wiki/TURN
6
7use stun_codec::define_attribute_enums;
8pub use stun_codec::{
9    rfc5389::attributes::{
10        AlternateServer, ErrorCode, Fingerprint, MappedAddress,
11        MessageIntegrity, Nonce, Realm, Software, UnknownAttributes, Username,
12        XorMappedAddress,
13    },
14    rfc5766::attributes::{
15        ChannelNumber, Data, DontFragment, EvenPort, Lifetime,
16        RequestedTransport, ReservationToken, XorPeerAddress, XorRelayAddress,
17    },
18    rfc8656::attributes::{AddressFamily, RequestedAddressFamily},
19};
20
21/// UDP protocol number according to [IANA].
22///
23/// [IANA]: https://tinyurl.com/iana-protocol-numbers
24pub(crate) const PROTO_UDP: u8 = 17;
25
26/// TCP protocol number according to [IANA].
27///
28/// [IANA]: https://tinyurl.com/iana-protocol-numbers
29pub(crate) const PROTO_TCP: u8 = 6;
30
31define_attribute_enums!(
32    Attribute,
33    AttributeDecoder,
34    AttributeEncoder,
35    [
36        // RFC 5389
37        MappedAddress,
38        Username,
39        MessageIntegrity,
40        ErrorCode,
41        UnknownAttributes,
42        Realm,
43        Nonce,
44        XorMappedAddress,
45        Software,
46        AlternateServer,
47        Fingerprint,
48        // RFC 5766
49        ChannelNumber,
50        Lifetime,
51        XorPeerAddress,
52        Data,
53        XorRelayAddress,
54        EvenPort,
55        RequestedTransport,
56        DontFragment,
57        ReservationToken,
58        // RFC 8656
59        RequestedAddressFamily
60    ]
61);