pub enum TransactionKey {
Rfc3261 {
branch: Vec<u8>,
sent_by: Vec<u8>,
method: Vec<u8>,
},
Legacy {
request_uri: Vec<u8>,
top_via: Vec<u8>,
from_tag: Vec<u8>,
to_tag: Vec<u8>,
call_id: Vec<u8>,
cseq: u32,
method: Vec<u8>,
},
}Expand description
A key identifying a transaction.
Variants§
Rfc3261
RFC 3261 matching: the branch carries the magic cookie.
Fields
Legacy
RFC 2543 matching, reconstructed from the fields that were available before branch
meant anything.
Implementations§
Source§impl TransactionKey
impl TransactionKey
Sourcepub fn from_request(request: &Request) -> Option<Self>
pub fn from_request(request: &Request) -> Option<Self>
The key a received request belongs to (RFC 3261 §17.2.3).
Returns None if the request has no usable Via, which is not a transaction question
— a request without a Via cannot be answered at all, and validation reports it.
Sourcepub fn from_sent_request(request: &Request) -> Option<Self>
pub fn from_sent_request(request: &Request) -> Option<Self>
The key a request sent by this element belongs to (RFC 3261 §17.1.3).
Not Self::from_request’s derivation. §17.2.3 is the server rule, and it keys a
legacy transaction on the Request-URI and the To tag; a response has no Request-URI at
all, and carries the tag the UAS added rather than the one the request was sent with. A
client keyed by the server rule therefore never matches any of its own responses — it
does not fail, it retransmits until Timer F with the answer sitting in front of it.
§17.1.3 is narrower on purpose (docs/specs/sip-transaction.md §6.2): the key is the
branch and the CSeq method, over fields a response echoes back unchanged. This agrees
with Self::from_response field for field, which is the property that matters.
The legacy half of this is reached by an application that supplies its own cookieless
Via, not by an old peer: the topmost Via on a client transaction is ours, and the
transport gives it a z9hG4bK branch. Self::from_request is the one old peers meet.
Sourcepub fn from_response(response: &Response) -> Option<Self>
pub fn from_response(response: &Response) -> Option<Self>
The key a received response belongs to (RFC 3261 §17.1.3).
The branch of the topmost Via plus the CSeq method — and only those two. In
particular the sent-by is not part of it, because the response may come back from a
different address than the request went to.
Sourcepub fn for_cancelled_invite(request: &Request) -> Option<Self>
pub fn for_cancelled_invite(request: &Request) -> Option<Self>
The key of the INVITE a CANCEL refers to (RFC 3261 §9.2).
A CANCEL shares the INVITE’s branch and differs only in method, so this is that key
with the method put back. Returns None for anything that is not a CANCEL, since no
other request cancels one.
Trait Implementations§
Source§impl Clone for TransactionKey
impl Clone for TransactionKey
Source§fn clone(&self) -> TransactionKey
fn clone(&self) -> TransactionKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TransactionKey
impl Debug for TransactionKey
Source§impl Hash for TransactionKey
impl Hash for TransactionKey
Source§impl PartialEq for TransactionKey
impl PartialEq for TransactionKey
Source§fn eq(&self, other: &TransactionKey) -> bool
fn eq(&self, other: &TransactionKey) -> bool
self and other values to be equal, and is used by ==.