V9Parser

Struct V9Parser 

Source
pub struct V9Parser {
    pub templates: LruCache<u16, TemplateWithTtl<Template>>,
    pub options_templates: LruCache<u16, TemplateWithTtl<OptionsTemplate>>,
    pub ttl_config: Option<TtlConfig>,
    pub max_template_cache_size: usize,
    pub max_error_sample_size: usize,
    pub enterprise_registry: EnterpriseFieldRegistry,
}

Fields§

§templates: LruCache<u16, TemplateWithTtl<Template>>§options_templates: LruCache<u16, TemplateWithTtl<OptionsTemplate>>§ttl_config: Option<TtlConfig>

Optional TTL configuration for template expiration

§max_template_cache_size: usize

Maximum number of templates to cache. Defaults to 1000.

§max_error_sample_size: usize

Maximum number of bytes to include in error samples to prevent memory exhaustion. Defaults to 256 bytes.

§enterprise_registry: EnterpriseFieldRegistry

Registry of custom enterprise field definitions

Implementations§

Source§

impl V9Parser

Source

pub fn try_new(config: Config) -> Result<Self, ConfigError>

Create a new V9 with a custom template cache size and optional TTL configuration.

§Arguments
  • config - Configuration struct containing max_template_cache_size and optional ttl_config
§Errors

Returns ConfigError if max_template_cache_size is 0

Source§

impl V9Parser

Source

pub fn parse<'a>(&mut self, packet: &'a [u8]) -> ParsedNetflow<'a>

Trait Implementations§

Source§

impl Debug for V9Parser

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for V9Parser

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl ParserConfig for V9Parser

Source§

fn add_config(&mut self, config: Config) -> Result<(), ConfigError>

Add or update the parser’s configuration.

§Arguments
  • config - Configuration struct containing max_template_cache_size and optional ttl_config
§Errors

Returns ConfigError if max_template_cache_size is 0

Source§

fn set_max_template_cache_size( &mut self, size: usize, ) -> Result<(), ConfigError>

Set the maximum template cache size
Source§

fn set_ttl_config( &mut self, ttl_config: Option<TtlConfig>, ) -> Result<(), ConfigError>

Set the TTL configuration for templates
Source§

fn resize_template_caches(&mut self, cache_size: NonZeroUsize)

Internal helper: resize all template caches to the given size

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.