pub struct SflowParser { /* private fields */ }Expand description
Stateless sFlow v5 datagram parser.
Unlike NetFlow V9/IPFIX parsers, SflowParser requires no mutable state
between calls since sFlow v5 is fully self-describing. Each call to
parse_bytes is independent.
§Examples
use flowparser_sflow::SflowParser;
let parser = SflowParser::default();
let result = parser.parse_bytes(&[/* sflow datagram bytes */]);
for datagram in &result.datagrams {
println!("seq={} samples={}", datagram.sequence_number, datagram.samples.len());
}Implementations§
Source§impl SflowParser
impl SflowParser
Sourcepub fn builder() -> SflowParserBuilder
pub fn builder() -> SflowParserBuilder
Create a builder for configuring the parser.
Sourcepub fn parse_bytes(&self, packet: &[u8]) -> ParseResult
pub fn parse_bytes(&self, packet: &[u8]) -> ParseResult
Parse one or more sFlow v5 datagrams from a byte slice.
Returns a ParseResult containing all successfully parsed datagrams
and an optional error. Parsing is stateless — each call is independent.
Trait Implementations§
Source§impl Clone for SflowParser
impl Clone for SflowParser
Source§fn clone(&self) -> SflowParser
fn clone(&self) -> SflowParser
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SflowParser
impl Debug for SflowParser
Source§impl Default for SflowParser
impl Default for SflowParser
Source§fn default() -> SflowParser
fn default() -> SflowParser
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SflowParser
impl RefUnwindSafe for SflowParser
impl Send for SflowParser
impl Sync for SflowParser
impl Unpin for SflowParser
impl UnsafeUnpin for SflowParser
impl UnwindSafe for SflowParser
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