pub enum StunAttribute {
Show 16 variants
Unknown(Unknown),
AlternateServer(AlternateServer),
ErrorCode(ErrorCode),
Fingerprint(Fingerprint),
MappedAddress(MappedAddress),
MessageIntegrity(MessageIntegrity),
MessageIntegritySha256(MessageIntegritySha256),
Nonce(Nonce),
PasswordAlgorithm(PasswordAlgorithm),
PasswordAlgorithms(PasswordAlgorithms),
Realm(Realm),
Software(Software),
UnknownAttributes(UnknownAttributes),
UserHash(UserHash),
UserName(UserName),
XorMappedAddress(XorMappedAddress),
}Expand description
STUN Attributes that can be attached to a StunMessage
Variants§
Unknown(Unknown)
The Unknownatribute
AlternateServer(AlternateServer)
The AlternateServeratribute
ErrorCode(ErrorCode)
The ErrorCodeatribute
Fingerprint(Fingerprint)
The Fingerprintatribute
MappedAddress(MappedAddress)
The MappedAddressatribute
MessageIntegrity(MessageIntegrity)
The MessageIntegrityatribute
MessageIntegritySha256(MessageIntegritySha256)
The MessageIntegritySha256atribute
Nonce(Nonce)
The Nonceatribute
PasswordAlgorithm(PasswordAlgorithm)
The PasswordAlgorithmatribute
PasswordAlgorithms(PasswordAlgorithms)
The PasswordAlgorithmsatribute
Realm(Realm)
The Realmatribute
Software(Software)
The Softwareatribute
UnknownAttributes(UnknownAttributes)
The UnknownAttributesatribute
UserHash(UserHash)
The UserHashatribute
UserName(UserName)
The UserNameatribute
XorMappedAddress(XorMappedAddress)
The XorMappedAddressatribute
Implementations§
Source§impl StunAttribute
impl StunAttribute
Sourcepub fn attribute_type(&self) -> AttributeType
pub fn attribute_type(&self) -> AttributeType
Returns the STUN attribute type of this instance.
Sourcepub fn is_unknown(&self) -> bool
pub fn is_unknown(&self) -> bool
Returns true if this StunAttribute is Unknown
Sourcepub fn as_unknown(&self) -> Result<&Unknown, StunError>
pub fn as_unknown(&self) -> Result<&Unknown, StunError>
Returns a reference to the internal attribute value or an error if the type of the attribute is not Unknown
Sourcepub fn expect_unknown(&self) -> &Unknown
pub fn expect_unknown(&self) -> &Unknown
Sourcepub fn is_alternate_server(&self) -> bool
pub fn is_alternate_server(&self) -> bool
Returns true if this StunAttribute is AlternateServer
Sourcepub fn as_alternate_server(&self) -> Result<&AlternateServer, StunError>
pub fn as_alternate_server(&self) -> Result<&AlternateServer, StunError>
Returns a reference to the internal attribute value or an error if the type of the attribute is not AlternateServer
Sourcepub fn expect_alternate_server(&self) -> &AlternateServer
pub fn expect_alternate_server(&self) -> &AlternateServer
Returns a reference to the AlternateServer attribute.
§Panics
Panics if the attribute is not an AlternateServer
Sourcepub fn is_error_code(&self) -> bool
pub fn is_error_code(&self) -> bool
Returns true if this StunAttribute is ErrorCode
Sourcepub fn as_error_code(&self) -> Result<&ErrorCode, StunError>
pub fn as_error_code(&self) -> Result<&ErrorCode, StunError>
Returns a reference to the internal attribute value or an error if the type of the attribute is not ErrorCode
Sourcepub fn expect_error_code(&self) -> &ErrorCode
pub fn expect_error_code(&self) -> &ErrorCode
Sourcepub fn is_fingerprint(&self) -> bool
pub fn is_fingerprint(&self) -> bool
Returns true if this StunAttribute is Fingerprint
Sourcepub fn as_fingerprint(&self) -> Result<&Fingerprint, StunError>
pub fn as_fingerprint(&self) -> Result<&Fingerprint, StunError>
Returns a reference to the internal attribute value or an error if the type of the attribute is not Fingerprint
Sourcepub fn expect_fingerprint(&self) -> &Fingerprint
pub fn expect_fingerprint(&self) -> &Fingerprint
Returns a reference to the Fingerprint attribute.
§Panics
Panics if the attribute is not an Fingerprint
Sourcepub fn is_mapped_address(&self) -> bool
pub fn is_mapped_address(&self) -> bool
Returns true if this StunAttribute is MappedAddress
Sourcepub fn as_mapped_address(&self) -> Result<&MappedAddress, StunError>
pub fn as_mapped_address(&self) -> Result<&MappedAddress, StunError>
Returns a reference to the internal attribute value or an error if the type of the attribute is not MappedAddress
Sourcepub fn expect_mapped_address(&self) -> &MappedAddress
pub fn expect_mapped_address(&self) -> &MappedAddress
Returns a reference to the MappedAddress attribute.
§Panics
Panics if the attribute is not an MappedAddress
Sourcepub fn is_message_integrity(&self) -> bool
pub fn is_message_integrity(&self) -> bool
Returns true if this StunAttribute is MessageIntegrity
Sourcepub fn as_message_integrity(&self) -> Result<&MessageIntegrity, StunError>
pub fn as_message_integrity(&self) -> Result<&MessageIntegrity, StunError>
Returns a reference to the internal attribute value or an error if the type of the attribute is not MessageIntegrity
Sourcepub fn expect_message_integrity(&self) -> &MessageIntegrity
pub fn expect_message_integrity(&self) -> &MessageIntegrity
Returns a reference to the MessageIntegrity attribute.
§Panics
Panics if the attribute is not an MessageIntegrity
Sourcepub fn is_message_integrity_sha256(&self) -> bool
pub fn is_message_integrity_sha256(&self) -> bool
Returns true if this StunAttribute is MessageIntegritySha256
Sourcepub fn as_message_integrity_sha256(
&self,
) -> Result<&MessageIntegritySha256, StunError>
pub fn as_message_integrity_sha256( &self, ) -> Result<&MessageIntegritySha256, StunError>
Returns a reference to the internal attribute value or an error if the type of the attribute is not MessageIntegritySha256
Sourcepub fn expect_message_integrity_sha256(&self) -> &MessageIntegritySha256
pub fn expect_message_integrity_sha256(&self) -> &MessageIntegritySha256
Returns a reference to the MessageIntegritySha256 attribute.
§Panics
Panics if the attribute is not an MessageIntegritySha256
Sourcepub fn as_nonce(&self) -> Result<&Nonce, StunError>
pub fn as_nonce(&self) -> Result<&Nonce, StunError>
Returns a reference to the internal attribute value or an error if the type of the attribute is not Nonce
Sourcepub fn expect_nonce(&self) -> &Nonce
pub fn expect_nonce(&self) -> &Nonce
Sourcepub fn is_password_algorithm(&self) -> bool
pub fn is_password_algorithm(&self) -> bool
Returns true if this StunAttribute is PasswordAlgorithm
Sourcepub fn as_password_algorithm(&self) -> Result<&PasswordAlgorithm, StunError>
pub fn as_password_algorithm(&self) -> Result<&PasswordAlgorithm, StunError>
Returns a reference to the internal attribute value or an error if the type of the attribute is not PasswordAlgorithm
Sourcepub fn expect_password_algorithm(&self) -> &PasswordAlgorithm
pub fn expect_password_algorithm(&self) -> &PasswordAlgorithm
Returns a reference to the PasswordAlgorithm attribute.
§Panics
Panics if the attribute is not an PasswordAlgorithm
Sourcepub fn is_password_algorithms(&self) -> bool
pub fn is_password_algorithms(&self) -> bool
Returns true if this StunAttribute is PasswordAlgorithms
Sourcepub fn as_password_algorithms(&self) -> Result<&PasswordAlgorithms, StunError>
pub fn as_password_algorithms(&self) -> Result<&PasswordAlgorithms, StunError>
Returns a reference to the internal attribute value or an error if the type of the attribute is not PasswordAlgorithms
Sourcepub fn expect_password_algorithms(&self) -> &PasswordAlgorithms
pub fn expect_password_algorithms(&self) -> &PasswordAlgorithms
Returns a reference to the PasswordAlgorithms attribute.
§Panics
Panics if the attribute is not an PasswordAlgorithms
Sourcepub fn as_realm(&self) -> Result<&Realm, StunError>
pub fn as_realm(&self) -> Result<&Realm, StunError>
Returns a reference to the internal attribute value or an error if the type of the attribute is not Realm
Sourcepub fn expect_realm(&self) -> &Realm
pub fn expect_realm(&self) -> &Realm
Sourcepub fn is_software(&self) -> bool
pub fn is_software(&self) -> bool
Returns true if this StunAttribute is Software
Sourcepub fn as_software(&self) -> Result<&Software, StunError>
pub fn as_software(&self) -> Result<&Software, StunError>
Returns a reference to the internal attribute value or an error if the type of the attribute is not Software
Sourcepub fn expect_software(&self) -> &Software
pub fn expect_software(&self) -> &Software
Sourcepub fn is_unknown_attributes(&self) -> bool
pub fn is_unknown_attributes(&self) -> bool
Returns true if this StunAttribute is UnknownAttributes
Sourcepub fn as_unknown_attributes(&self) -> Result<&UnknownAttributes, StunError>
pub fn as_unknown_attributes(&self) -> Result<&UnknownAttributes, StunError>
Returns a reference to the internal attribute value or an error if the type of the attribute is not UnknownAttributes
Sourcepub fn expect_unknown_attributes(&self) -> &UnknownAttributes
pub fn expect_unknown_attributes(&self) -> &UnknownAttributes
Returns a reference to the UnknownAttributes attribute.
§Panics
Panics if the attribute is not an UnknownAttributes
Sourcepub fn is_user_hash(&self) -> bool
pub fn is_user_hash(&self) -> bool
Returns true if this StunAttribute is UserHash
Sourcepub fn as_user_hash(&self) -> Result<&UserHash, StunError>
pub fn as_user_hash(&self) -> Result<&UserHash, StunError>
Returns a reference to the internal attribute value or an error if the type of the attribute is not UserHash
Sourcepub fn expect_user_hash(&self) -> &UserHash
pub fn expect_user_hash(&self) -> &UserHash
Sourcepub fn is_user_name(&self) -> bool
pub fn is_user_name(&self) -> bool
Returns true if this StunAttribute is UserName
Sourcepub fn as_user_name(&self) -> Result<&UserName, StunError>
pub fn as_user_name(&self) -> Result<&UserName, StunError>
Returns a reference to the internal attribute value or an error if the type of the attribute is not UserName
Sourcepub fn expect_user_name(&self) -> &UserName
pub fn expect_user_name(&self) -> &UserName
Sourcepub fn is_xor_mapped_address(&self) -> bool
pub fn is_xor_mapped_address(&self) -> bool
Returns true if this StunAttribute is XorMappedAddress
Sourcepub fn as_xor_mapped_address(&self) -> Result<&XorMappedAddress, StunError>
pub fn as_xor_mapped_address(&self) -> Result<&XorMappedAddress, StunError>
Returns a reference to the internal attribute value or an error if the type of the attribute is not XorMappedAddress
Sourcepub fn expect_xor_mapped_address(&self) -> &XorMappedAddress
pub fn expect_xor_mapped_address(&self) -> &XorMappedAddress
Returns a reference to the XorMappedAddress attribute.
§Panics
Panics if the attribute is not an XorMappedAddress
Trait Implementations§
Source§impl Clone for StunAttribute
impl Clone for StunAttribute
Source§fn clone(&self) -> StunAttribute
fn clone(&self) -> StunAttribute
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more