pub struct Replaces {
pub call_id: Vec<u8>,
pub to_tag: Vec<u8>,
pub from_tag: Vec<u8>,
pub early_only: bool,
}Expand description
The dialog an INVITE asks to take the place of (RFC 3891).
All three fields are load-bearing, and the two tags are the security. A Call-ID is
carried in every message of a dialog and is visible to every element on the path — a proxy,
a load balancer, anything that logged a header. The tags are random and known only to the
two parties. Matching on the Call-ID alone would turn this header into a call-hijack
primitive: anyone who had seen one message of a call could ask to be put in the middle of it.
RFC 3891 §5 says as much, and it is the reason this type has no constructor that takes fewer than three fields.
Fields§
§call_id: Vec<u8>The Call-ID of the dialog to replace.
to_tag: Vec<u8>The To tag, from the point of view of whoever built this header.
from_tag: Vec<u8>The From tag, likewise.
early_only: boolWhether the sender will only replace a dialog that has not been answered yet.
Implementations§
Source§impl Replaces
impl Replaces
Sourcepub fn of(request: &Request) -> Option<Self>
pub fn of(request: &Request) -> Option<Self>
Read a Replaces header out of a request.
None when there is none, and also when there is one that is unusable — a header
missing either tag names no dialog, and treating it as though it named one with an empty
tag is how the tags stop being a secret.
Sourcepub fn parse(value: &[u8]) -> Option<Self>
pub fn parse(value: &[u8]) -> Option<Self>
Parse a header value: call-id;to-tag=x;from-tag=y[;early-only].
Sourcepub fn matches(&self, dialog: &Dialog) -> bool
pub fn matches(&self, dialog: &Dialog) -> bool
Whether this names that dialog.
The tags swap sides. A Replaces is built by the party that observed the dialog from
outside it — in an attended transfer, the transferor describing its own call to the
transferee — so the to-tag is the tag of the party receiving this INVITE, which is
that party’s local tag. Getting the orientation wrong makes every legitimate transfer
fail while leaving the hijack case wide open, because a mismatch is a mismatch either
way and only the successful case would have shown it up.
Trait Implementations§
impl Eq for Replaces
impl StructuralPartialEq for Replaces
Auto Trait Implementations§
impl Freeze for Replaces
impl RefUnwindSafe for Replaces
impl Send for Replaces
impl Sync for Replaces
impl Unpin for Replaces
impl UnsafeUnpin for Replaces
impl UnwindSafe for Replaces
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more