sipx_sip/headers/mod.rs
1//! Typed header values.
2//!
3//! Headers are parsed on demand, never during message parsing. A message with a malformed
4//! `CSeq` frames and forwards perfectly well; only a party that needs to *read* `CSeq` has a
5//! problem, and it finds out by asking:
6//!
7//! ```no_run
8//! # use sipx_sip::{Message, headers::CSeq};
9//! # fn example(message: &Message) {
10//! match message.headers().typed::<CSeq>() {
11//! None => { /* absent */ }
12//! Some(Err(_)) => { /* present and malformed — answer 400 */ }
13//! Some(Ok(cseq)) => { /* usable */ }
14//! }
15//! # }
16//! ```
17//!
18//! The `Option<Result<..>>` is deliberate. Collapsing it is how implementations end up
19//! treating a corrupt header as a missing one.
20//!
21//! Authentication headers are not here: they belong to the user-agent layer, which is where
22//! anything that can act on a challenge lives.
23
24pub mod address;
25pub(crate) mod grammar;
26pub mod history;
27pub mod identity;
28pub mod misc;
29pub mod privacy;
30pub mod via;
31pub(crate) mod warning;
32
33pub use address::{Address, Contact, ContactValue, From, RecordRoute, Route, To};
34pub use grammar::HeaderParam;
35pub use history::{
36 HistoryEntry, HistoryIndex, HistoryInfo, Reason, ReasonValue, TargetChange, TargetChangeKind,
37};
38pub use identity::{
39 IgnoredIdentity, IgnoredIdentityReason, PAssertedIdentity, PAssertedIdentityList,
40 PPreferredIdentity, PPreferredIdentityList,
41};
42pub use misc::{
43 Allow, CSeq, CallId, ContentLength, ContentType, Date, Expires, MaxForwards, ProxyRequire,
44 Require, Supported, TokenList, Unsupported,
45};
46pub use privacy::{Privacy, PrivacyList, PrivacyValue};
47pub use via::{
48 BRANCH_MAGIC_COOKIE, OcParameter, OverloadAlgorithm, OverloadSequence, Via, ViaOverload,
49 first_hop_end,
50};