Skip to main content

Crate sipx_sip

Crate sipx_sip 

Source
Expand description

Sans-IO SIP core.

This crate implements SIP (RFC 3261) as pure state machines: message parsing and serialization, and the client and server transaction FSMs. It performs no I/O, spawns no tasks, and reads no clock. Time enters as a fired-timer input and leaves as a set-timer output; bytes enter as received data and leave as data to send. Async transports live in sipx-transport.

That separation is deliberate. Every hard part of SIP — retransmission timing, transaction matching, malformed input handling — becomes testable without sockets and fuzzable without a runtime.

§Reading hostile input

Everything here parses data from the network, so nothing here panics. unsafe is forbidden, indexing is checked, and every fallible operation returns a Result whose error names the specific fault — the transaction layer picks a response status from it.

Parsing is also lazy and layered: a message that frames correctly parses even if one of its headers is malformed, because a proxy must be able to forward what it cannot itself interpret. See docs/specs/sip-message.md.

§Stability

sipx is pre-1.0, so neither word below means frozen. 1.0.0 is what freezes an API, and its predicates are in docs/roadmap.md. Until then:

  • Supported — meant to be depended on. Breaking changes get a CHANGELOG.md entry saying what to do instead. New enum variants and new struct fields may still appear in a minor release, so a downstream match should carry a _ arm.
  • Experimental — may change shape or be removed without a migration note. Depend on it only if you are prepared to follow it.

Supported. Parsing, serialisation and the §17 transaction machines are the most heavily tested surface in the workspace and are what everything above is built on.

The public error enums are #[non_exhaustive]. New typed parse failures may be added without breaking downstream callers, so a match over one carries a _ arm.

Re-exports§

pub use build::RequestBuilder;
pub use build::ResponseBuilder;
pub use error::AddressEditError;
pub use error::BuildError;
pub use error::HeaderError;
pub use error::UriError;
pub use error::WarningEditError;
pub use headers::Address;
pub use headers::CSeq;
pub use headers::CallId;
pub use headers::HistoryEntry;
pub use headers::HistoryIndex;
pub use headers::HistoryInfo;
pub use headers::IgnoredIdentity;
pub use headers::IgnoredIdentityReason;
pub use headers::PAssertedIdentity;
pub use headers::PAssertedIdentityList;
pub use headers::PPreferredIdentity;
pub use headers::PPreferredIdentityList;
pub use headers::Privacy;
pub use headers::PrivacyList;
pub use headers::PrivacyValue;
pub use headers::Reason;
pub use headers::ReasonValue;
pub use headers::TargetChange;
pub use headers::TargetChangeKind;
pub use headers::Via;
pub use message::Header;
pub use message::Headers;
pub use message::Message;
pub use message::Method;
pub use message::Request;
pub use message::Response;
pub use message::StatusCode;
pub use message::TypedHeader;
pub use message::Version;
pub use name::HeaderName;
pub use params::Param;
pub use params::Params;
pub use parser::Limits;
pub use parser::StreamParser;
pub use parser::parse_datagram;
pub use transaction::ClientTransaction;
pub use transaction::Output;
pub use transaction::Reliability;
pub use transaction::ServerTransaction;
pub use transaction::Timer;
pub use transaction::Timers;
pub use transaction::TransactionKey;
pub use transaction::TransactionLayer;
pub use transaction::TuEvent;
pub use uri::Host;
pub use uri::HostName;
pub use uri::Scheme;
pub use uri::TelParameter;
pub use uri::TelParameterError;
pub use uri::TelParameterErrorKind;
pub use uri::TelParameters;
pub use uri::TelUriParts;
pub use uri::Uri;
pub use uri::UriTransport;
pub use uri::UriTransportError;
pub use validate::Finding;
pub use validate::validate;
pub use validate::validate_request;
pub use validate::validate_response;

Modules§

auth
HTTP Digest authentication for SIP (RFC 7616, RFC 3261 §22).
build
Building messages.
error
Error types.
event
Subscriptions and notifications, as decisions (RFC 6665).
gruu
GRUUs — Globally Routable User Agent URIs (RFC 5627), at the URI level.
headers
Typed header values.
identity
SIP authenticated identity and PASSporT (RFC 8224 and RFC 8225).
message
The message model: requests, responses and their header collection.
name
Header field names (RFC 3261 §7.3, §20).
params
Ordered parameter lists: the ;name=value tails on URIs and header values.
parser
Turning bytes into messages.
push
Push notifications (RFC 8599), at the URI and header level.
rel
Reliable provisional responses (RFC 3262): 100rel, RSeq, RAck and PRACK.
session
Session timers (RFC 4028).
transaction
Transactions (RFC 3261 §17, amended by RFC 6026).
update
The UPDATE method (RFC 3311).
uri
SIP, SIPS and other URIs (RFC 3261 §19.1).
validate
Message validation — the checks that come after parsing.