pub struct Via {
pub protocol: Vec<u8>,
pub version: Vec<u8>,
pub transport: Vec<u8>,
pub host: Host,
pub port: Option<u16>,
pub params: Vec<HeaderParam>,
}Expand description
One Via value.
Fields§
§protocol: Vec<u8>The protocol name, normally SIP.
version: Vec<u8>The protocol version, normally 2.0.
transport: Vec<u8>The transport: UDP, TCP, TLS, SCTP, WS, WSS, or anything else a peer sends
— RFC 4475 §3.1.1.10 requires unknown transports to parse.
host: HostThe host this hop wants responses sent to.
port: Option<u16>The port, if stated.
params: Vec<HeaderParam>The via parameters.
Implementations§
Source§impl Via
impl Via
Sourcepub fn overload(&self) -> Result<ViaOverload, HeaderError>
pub fn overload(&self) -> Result<ViaOverload, HeaderError>
Decode the RFC 7339/RFC 7415 overload-control parameters on this hop.
Presence and value of oc stay distinct because the client sends the former and only a
server may send the latter. Invalid numbers are errors rather than zero: zero has protocol
meaning for both loss/rate and validity.
Sourcepub fn has_rfc3261_branch(&self) -> bool
pub fn has_rfc3261_branch(&self) -> bool
Whether the branch carries the RFC 3261 magic cookie.
When it does not, the sender predates RFC 3261 and transaction matching must fall back to the rules in §17.2.3.
Sourcepub fn received(&self) -> Option<&[u8]>
pub fn received(&self) -> Option<&[u8]>
The received parameter: the source address the previous hop was actually seen from
(RFC 3261 §18.2.1).
Sourcepub fn rport(&self) -> Option<Option<&[u8]>>
pub fn rport(&self) -> Option<Option<&[u8]>>
The rport parameter (RFC 3581). Present with no value in a request means “tell me
what port you saw”; present with a value in a response is that port.
Sourcepub fn parse_one(value: &[u8]) -> Result<Self, HeaderError>
pub fn parse_one(value: &[u8]) -> Result<Self, HeaderError>
Parse one Via value — a single hop, not a comma-separated list.
Sourcepub fn parse_list(value: &[u8]) -> Result<Vec<Self>, HeaderError>
pub fn parse_list(value: &[u8]) -> Result<Vec<Self>, HeaderError>
Parse a header value that may carry several comma-separated hops.
Trait Implementations§
Source§impl TypedHeader for Via
impl TypedHeader for Via
Source§fn decode(value: &[u8]) -> Result<Self, HeaderError>
fn decode(value: &[u8]) -> Result<Self, HeaderError>
Decodes the first hop in the value.
A single Via header line may carry several comma-separated hops, so typed::<Via>()
gives the topmost one — which is the one that matters for routing a response. Use
Via::parse_list when every hop is needed.
Source§const NAME: HeaderName = HeaderName::Via
const NAME: HeaderName = HeaderName::Via
Source§fn decode_list(value: &[u8]) -> Result<Vec<Self>, HeaderError>
fn decode_list(value: &[u8]) -> Result<Vec<Self>, HeaderError>
Source§const VALIDATE_LIST: bool = false
const VALIDATE_LIST: bool = false
Headers::typed_all must collect and validate the complete field before yielding. Read more