Struct stun_rs::attributes::stun::PasswordAlgorithm
source · [−]pub struct PasswordAlgorithm(_);Expand description
The PASSWORD-ALGORITHM attribute is present only in requests. It contains the algorithm that the server must use to derive a key from the long-term password.
Examples
// Creates a MD5 password algorithm without parameters
let attr = PasswordAlgorithm::new(Algorithm::from(AlgorithmId::MD5));
assert_eq!(attr.algorithm(), AlgorithmId::MD5);
assert_eq!(attr.parameters(), None);
// Creates a custom password algorithm with parameters
let params = [0x01, 0x02, 0x03, 0x04, 0x05];
let algorithm = Algorithm::new(AlgorithmId::Unassigned(255), params.as_ref());
let attr = PasswordAlgorithm::new(algorithm);
assert_eq!(attr.algorithm(), AlgorithmId::Unassigned(255));
assert_eq!(attr.parameters(), Some(params.as_ref()));Implementations
sourceimpl PasswordAlgorithm
impl PasswordAlgorithm
sourcepub fn new(algorithm: Algorithm) -> Self
pub fn new(algorithm: Algorithm) -> Self
Creates a new PasswordAlgorithm attribute.
Attributes:
algorithm- The Algorithm.value- Specific parameters for the algorithm, if any.
sourcepub fn algorithm(&self) -> AlgorithmId
pub fn algorithm(&self) -> AlgorithmId
Returns the algorithm
sourcepub fn parameters(&self) -> Option<&[u8]>
pub fn parameters(&self) -> Option<&[u8]>
Returns the parameters required by the algorithm.
Trait Implementations
sourceimpl Debug for PasswordAlgorithm
impl Debug for PasswordAlgorithm
sourceimpl From<PasswordAlgorithm> for StunAttribute
impl From<PasswordAlgorithm> for StunAttribute
sourcefn from(value: PasswordAlgorithm) -> Self
fn from(value: PasswordAlgorithm) -> Self
Converts to this type from the input type.
sourceimpl PartialEq<PasswordAlgorithm> for PasswordAlgorithm
impl PartialEq<PasswordAlgorithm> for PasswordAlgorithm
sourcefn eq(&self, other: &PasswordAlgorithm) -> bool
fn eq(&self, other: &PasswordAlgorithm) -> bool
sourceimpl StunAttributeType for PasswordAlgorithm
impl StunAttributeType for PasswordAlgorithm
sourcefn get_type() -> AttributeTypewhere
Self: Sized,
fn get_type() -> AttributeTypewhere
Self: Sized,
Returns the STUN attribute type.
sourcefn attribute_type(&self) -> AttributeType
fn attribute_type(&self) -> AttributeType
Returns the STUN attribute type of this instance.
impl Eq for PasswordAlgorithm
impl StructuralEq for PasswordAlgorithm
impl StructuralPartialEq for PasswordAlgorithm
Auto Trait Implementations
impl RefUnwindSafe for PasswordAlgorithm
impl Send for PasswordAlgorithm
impl Sync for PasswordAlgorithm
impl Unpin for PasswordAlgorithm
impl UnwindSafe for PasswordAlgorithm
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more