1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! Streaming parser for FreeSWITCH `mod_sofia` SIP trace dump files.
//!
//! FreeSWITCH logs SIP traffic to dump files at
//! `/var/log/freeswitch/sip_traces/{profile}/{profile}.dump`, rotated as
//! `.dump.1.xz`, `.dump.2.xz`, etc. This library provides a multi-level
//! streaming parser that processes these files with constant memory.
//!
//! # Architecture
//!
//! Three parsing levels, each wrapping the previous:
//!
//! - **Level 1** ([`FrameIterator`]) — splits raw bytes on `\x0B\n` boundaries,
//! parses frame headers (direction, byte count, transport, address, timestamp).
//! - **Level 2** ([`MessageIterator`]) — reassembles TCP segments by connection,
//! splits aggregated messages by Content-Length, passes UDP frames through.
//! - **Level 3** ([`ParsedMessageIterator`]) — parses SIP request/status lines,
//! headers, and bodies. Supports multipart MIME splitting and JSON body unescaping.
//!
//! Every level accepts [`std::io::Read`], so they compose with files, pipes,
//! `xzcat` subprocesses, [`std::io::Read::chain`] for file concatenation, and
//! [`GrepFilter`] for grep-piped input.
//!
//! # Quick Start
//!
//! ```no_run
//! use std::fs::File;
//! use freeswitch_sofia_trace_parser::ParsedMessageIterator;
//!
//! let file = File::open("profile.dump").unwrap();
//! for result in ParsedMessageIterator::new(file) {
//! let msg = result.unwrap();
//! println!("{} {} {} call-id={}",
//! msg.timestamp, msg.direction, msg.message_type,
//! msg.call_id().unwrap_or("-"));
//! }
//! ```
//!
//! # Input Coverage Tracking
//!
//! Every byte in the input is either parsed into a frame or classified with a
//! [`SkipReason`]. Access parse statistics via the `stats()` / `parse_stats()`
//! methods on each iterator. See [`ParseStats`] and [`SkipTracking`] for details.
/// Level 1: frame boundary detection and header parsing.
/// `Read` adapter that strips `grep -C` separator lines from piped input.
/// Level 2: TCP reassembly and Content-Length-based message splitting.
/// Level 3: SIP message parsing, multipart MIME, and JSON body handling.
/// Core data types shared across all parsing levels.
pub use ;
pub use GrepFilter;
pub use MessageIterator;
pub use ParsedMessageIterator;
pub use *;