pub struct StreamManager { /* private fields */ }Expand description
Central orchestrator for TCP stream processing.
Implementations§
Source§impl StreamManager
impl StreamManager
pub fn new(config: StreamConfig) -> Self
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create with default config and register default parsers.
Sourcepub fn with_keylog(self, keylog: KeyLog) -> Self
pub fn with_keylog(self, keylog: KeyLog) -> Self
Enable TLS decryption with the provided keylog.
This registers a DecryptingTlsStreamParser that will attempt to
decrypt TLS application data when matching keys are found in the keylog.
The keylog should be in SSLKEYLOGFILE format, as used by Wireshark and browsers.
§Example
use pcapsql_core::stream::{StreamConfig, StreamManager};
use pcapsql_core::tls::KeyLog;
let keylog = KeyLog::from_file("sslkeylog.txt").unwrap();
let manager = StreamManager::new(StreamConfig::default())
.with_keylog(keylog);Sourcepub fn has_keylog(&self) -> bool
pub fn has_keylog(&self) -> bool
Check if TLS decryption is enabled.
Sourcepub fn registry_mut(&mut self) -> &mut StreamRegistry
pub fn registry_mut(&mut self) -> &mut StreamRegistry
Get mutable access to the stream registry for parser registration.
Sourcepub fn process_segment(
&mut self,
src_ip: IpAddr,
dst_ip: IpAddr,
src_port: u16,
dst_port: u16,
seq: u32,
_ack: u32,
flags: TcpFlags,
payload: &[u8],
frame_number: u64,
timestamp: i64,
) -> Result<Vec<ParsedMessage>, Error>
pub fn process_segment( &mut self, src_ip: IpAddr, dst_ip: IpAddr, src_port: u16, dst_port: u16, seq: u32, _ack: u32, flags: TcpFlags, payload: &[u8], frame_number: u64, timestamp: i64, ) -> Result<Vec<ParsedMessage>, Error>
Process a TCP segment.
Returns any parsed messages.
Sourcepub fn cleanup_timeout(&mut self, current_time: i64) -> Vec<Connection>
pub fn cleanup_timeout(&mut self, current_time: i64) -> Vec<Connection>
Cleanup timed-out connections.
Sourcepub fn connections(&self) -> impl Iterator<Item = &Connection>
pub fn connections(&self) -> impl Iterator<Item = &Connection>
Get all tracked connections.
Sourcepub fn total_memory(&self) -> usize
pub fn total_memory(&self) -> usize
Get total memory usage.
Sourcepub fn memory_limit_exceeded(&self) -> bool
pub fn memory_limit_exceeded(&self) -> bool
Check if memory limit is exceeded.
Auto Trait Implementations§
impl Freeze for StreamManager
impl !RefUnwindSafe for StreamManager
impl Send for StreamManager
impl Sync for StreamManager
impl Unpin for StreamManager
impl !UnwindSafe for StreamManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more