pub struct ValidatedMessage { /* private fields */ }Expand description
A received message that passed a Validator, reduced to what its checks cover.
It dereferences to a Message that holds the header and the attributes ahead of the
first integrity attribute: get, contains and every
Getter work on it and cannot see an attribute that was appended after the integrity
attribute. The integrity attributes and FINGERPRINT are not in it either; ask
integrity and has_fingerprint.
Implementations§
Source§impl ValidatedMessage
impl ValidatedMessage
Sourcepub fn into_message(self) -> Message
pub fn into_message(self) -> Message
Gives up the wrapper and returns the message with the covered attributes only.
Sourcepub fn integrity(&self) -> Option<IntegrityAlgorithm>
pub fn integrity(&self) -> Option<IntegrityAlgorithm>
The integrity attribute that was verified, or None for a message accepted through
Validator::unauthenticated.
A response to this message carries the same one and no other (RFC 8489 section 9.1.3).
Sourcepub fn is_authenticated(&self) -> bool
pub fn is_authenticated(&self) -> bool
Whether the message was authenticated.
Sourcepub fn has_fingerprint(&self) -> bool
pub fn has_fingerprint(&self) -> bool
Whether the message carried a (correct) FINGERPRINT.
Methods from Deref<Target = Message>§
Sourcepub fn marshal_binary(&self) -> Result<Vec<u8>>
pub fn marshal_binary(&self) -> Result<Vec<u8>>
Marshal_binary implements the encoding.BinaryMarshaler interface.
Sourcepub fn write_to<W: Write>(&self, writer: &mut W) -> Result<usize>
pub fn write_to<W: Write>(&self, writer: &mut W) -> Result<usize>
WriteTo implements WriterTo via calling Write(m.Raw) on w and returning call result.
Sourcepub fn clone_to(&self, b: &mut Message) -> Result<()>
pub fn clone_to(&self, b: &mut Message) -> Result<()>
CloneTo clones m to b securing any further m mutations.
Sourcepub fn contains(&self, t: AttrType) -> bool
pub fn contains(&self, t: AttrType) -> bool
Contains return true if message contain t attribute.
Sourcepub fn get(&self, t: AttrType) -> Result<Vec<u8>>
pub fn get(&self, t: AttrType) -> Result<Vec<u8>>
Get returns byte slice that represents attribute value, if there is no attribute with such type, ErrAttributeNotFound is returned.
Sourcepub fn unknown_required_attributes(&self, known: &[AttrType]) -> Vec<AttrType>
pub fn unknown_required_attributes(&self, known: &[AttrType]) -> Vec<AttrType>
The comprehension-required attributes of this message (types below 0x8000) that are
not in known, in the order they appear, each once.
RFC 8489 section 6.3: a request that has any is answered 420 (Unknown Attribute) with
them in UNKNOWN-ATTRIBUTES (section 6.3.1); an indication or a response that has any is
discarded (sections 6.3.2 to 6.3.4). known is what the usage understands:
STUN_ATTRIBUTES plus its own.
This looks at every attribute. In an authenticated message only the attributes ahead
of the integrity attribute count: use
Validator, which does both.