pub struct TcpReassembler { /* private fields */ }Expand description
TCP stream reassembly engine using a BTreeMap for out-of-order segment management.
Mirrors Wireshark’s reassemble.c logic: segments are keyed by absolute TCP sequence number. In-order segments are immediately appended to the contiguous reassembled buffer, while out-of-order segments are cached until gaps are filled.
Implementations§
Source§impl TcpReassembler
impl TcpReassembler
Sourcepub fn initialize(&mut self, initial_seq: u32)
pub fn initialize(&mut self, initial_seq: u32)
Initialize with the first observed sequence number (ISN + 1 for data after SYN).
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Whether this reassembler has been initialized.
Sourcepub fn reassembled_data(&self) -> &[u8] ⓘ
pub fn reassembled_data(&self) -> &[u8] ⓘ
Get the contiguous reassembled data accumulated so far.
Sourcepub fn drain_reassembled(&mut self) -> Vec<u8> ⓘ
pub fn drain_reassembled(&mut self) -> Vec<u8> ⓘ
Drain and return the reassembled data, resetting the buffer.
Sourcepub fn buffered_bytes(&self) -> usize
pub fn buffered_bytes(&self) -> usize
Total bytes in the out-of-order buffer.
Sourcepub fn fragment_count(&self) -> usize
pub fn fragment_count(&self) -> usize
Number of out-of-order fragments.
Sourcepub fn process_segment(
&mut self,
seq: u32,
payload: &[u8],
config: &FlowConfig,
) -> Result<ReassemblyAction, FlowError>
pub fn process_segment( &mut self, seq: u32, payload: &[u8], config: &FlowConfig, ) -> Result<ReassemblyAction, FlowError>
Process an incoming TCP segment.
Handles in-order, out-of-order, overlapping, and duplicate segments according to the algorithm described in the architectural blueprint.