Struct librice::stun::attribute::UseCandidate
source · pub struct UseCandidate {}
Expand description
The UseCandidate Attribute
Implementations§
source§impl UseCandidate
impl UseCandidate
sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
More examples
src/conncheck.rs (line 171)
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
fn generate_stun_request(
conncheck: Arc<ConnCheck>,
username: String,
controlling: bool,
tie_breaker: u64,
) -> Result<StunRequest, StunError> {
let mut msg = Message::new_request(BINDING);
// XXX: this needs to be the priority as if the candidate was peer-reflexive
msg.add_attribute(Priority::new(conncheck.pair.local.priority))?;
if controlling {
msg.add_attribute(IceControlling::new(tie_breaker))?;
} else {
msg.add_attribute(IceControlled::new(tie_breaker))?;
}
if conncheck.nominate {
msg.add_attribute(UseCandidate::new())?;
}
msg.add_attribute(Username::new(&username)?)?;
msg.add_message_integrity(&conncheck.agent.local_credentials().unwrap())?;
msg.add_fingerprint()?;
let to = conncheck.pair.remote.address;
conncheck.agent.stun_request_transaction(&msg, to)?.build()
}
Trait Implementations§
source§impl Attribute for UseCandidate
impl Attribute for UseCandidate
source§fn get_type(&self) -> AttributeType
fn get_type(&self) -> AttributeType
Retrieve the
AttributeType
of an Attribute
source§fn length(&self) -> u16
fn length(&self) -> u16
Retrieve the length of an
Attribute
. This is not the padded length as stored in a
Message
source§fn to_raw(&self) -> RawAttribute
fn to_raw(&self) -> RawAttribute
Convert an
Attribute
to a RawAttribute
source§fn from_raw(raw: &RawAttribute) -> Result<Self, StunParseError>
fn from_raw(raw: &RawAttribute) -> Result<Self, StunParseError>
Convert an
Attribute
from a RawAttribute
source§impl Debug for UseCandidate
impl Debug for UseCandidate
source§impl Default for UseCandidate
impl Default for UseCandidate
source§impl Display for UseCandidate
impl Display for UseCandidate
source§impl From<UseCandidate> for RawAttribute
impl From<UseCandidate> for RawAttribute
source§fn from(f: UseCandidate) -> Self
fn from(f: UseCandidate) -> Self
Converts to this type from the input type.
source§impl TryFrom<&RawAttribute> for UseCandidate
impl TryFrom<&RawAttribute> for UseCandidate
§type Error = StunParseError
type Error = StunParseError
The type returned in the event of a conversion error.