Skip to main content

sipx_sip/
lib.rs

1//! Sans-IO SIP core.
2//!
3//! This crate implements SIP (RFC 3261) as pure state machines: message parsing and
4//! serialization, and the client and server transaction FSMs.
5//! It performs **no I/O**, spawns no tasks, and reads no clock. Time enters as a fired-timer
6//! input and leaves as a set-timer output; bytes enter as received data and leave as data to
7//! send. Async transports live in `sipx-transport`.
8//!
9//! That separation is deliberate. Every hard part of SIP — retransmission timing, transaction
10//! matching, malformed input handling — becomes testable without sockets and fuzzable without
11//! a runtime.
12//!
13//! # Reading hostile input
14//!
15//! Everything here parses data from the network, so nothing here panics. `unsafe` is
16//! forbidden, indexing is checked, and every fallible operation returns a `Result` whose error
17//! names the specific fault — the transaction layer picks a response status from it.
18//!
19//! Parsing is also *lazy and layered*: a message that frames correctly parses even if one of
20//! its headers is malformed, because a proxy must be able to forward what it cannot itself
21//! interpret. See `docs/specs/sip-message.md`.
22//!
23//! # Stability
24//!
25//! sipx is pre-1.0, so **neither word below means frozen**. `1.0.0` is what freezes an API, and its
26//! predicates are in `docs/roadmap.md`. Until then:
27//!
28//! - **Supported** — meant to be depended on. Breaking changes get a `CHANGELOG.md` entry saying what
29//!   to do instead. New enum variants and new struct fields may still appear in a minor release, so a
30//!   downstream `match` should carry a `_` arm.
31//! - **Experimental** — may change shape or be removed without a migration note. Depend on it only if
32//!   you are prepared to follow it.
33//!
34//!
35//! **Supported.** Parsing, serialisation and the §17 transaction machines are the most heavily tested
36//! surface in the workspace and are what everything above is built on.
37//!
38//! The public error enums are `#[non_exhaustive]`. New typed parse failures may be added without
39//! breaking downstream callers, so a `match` over one carries a `_` arm.
40
41pub mod auth;
42pub mod build;
43pub mod error;
44mod escape;
45pub mod event;
46pub mod gruu;
47pub mod headers;
48pub mod identity;
49pub mod message;
50pub mod name;
51pub mod params;
52pub mod parser;
53pub mod push;
54pub mod rel;
55pub mod session;
56pub mod transaction;
57pub mod update;
58pub mod uri;
59pub mod validate;
60
61pub use build::{RequestBuilder, ResponseBuilder};
62pub use error::{AddressEditError, BuildError, HeaderError, UriError, WarningEditError};
63pub use headers::{
64    Address, CSeq, CallId, HistoryEntry, HistoryIndex, HistoryInfo, IgnoredIdentity,
65    IgnoredIdentityReason, PAssertedIdentity, PAssertedIdentityList, PPreferredIdentity,
66    PPreferredIdentityList, Privacy, PrivacyList, PrivacyValue, Reason, ReasonValue, TargetChange,
67    TargetChangeKind, Via,
68};
69pub use message::{
70    Header, Headers, Message, Method, Request, Response, StatusCode, TypedHeader, Version,
71};
72pub use name::HeaderName;
73pub use params::{Param, Params};
74pub use parser::{Limits, StreamParser, parse_datagram};
75pub use transaction::{
76    ClientTransaction, Output, Reliability, ServerTransaction, Timer, Timers, TransactionKey,
77    TransactionLayer, TuEvent,
78};
79pub use uri::{
80    Host, HostName, Scheme, TelParameter, TelParameterError, TelParameterErrorKind, TelParameters,
81    TelUriParts, Uri, UriTransport, UriTransportError,
82};
83pub use validate::{Finding, validate, validate_request, validate_response};