pub struct Decoder { /* private fields */ }Expand description
Stateful IPFIX decoder holding the Template cache of one Transport Session
Implementations§
Source§impl Decoder
impl Decoder
Sourcepub fn with_config(config: DecoderConfig) -> Self
pub fn with_config(config: DecoderConfig) -> Self
Create a decoder with a custom configuration
Sourcepub fn template_count(&self) -> usize
pub fn template_count(&self) -> usize
Number of Templates and Options Templates in the cache
Sourcepub fn has_template(&self, observation_domain_id: u32, template_id: u16) -> bool
pub fn has_template(&self, observation_domain_id: u32, template_id: u16) -> bool
Whether a Template (or Options Template) is known for this Observation Domain and Template ID
Sourcepub fn template_last_received(
&self,
observation_domain_id: u32,
template_id: u16,
) -> Option<u32>
pub fn template_last_received( &self, observation_domain_id: u32, template_id: u16, ) -> Option<u32>
Export Time of the Message that last carried this Template (or Options Template), i.e. the “Last Received” of RFC 7011 Section 8.4
Sourcepub fn expire_templates(&mut self, now: u32)
pub fn expire_templates(&mut self, now: u32)
Discard the Templates not refreshed within
DecoderConfig::template_lifetime at time now (in seconds since the
UNIX epoch, like the Export Time). This runs automatically for each
decoded Message over UDP; call it to expire Templates with your own
clock, e.g. when an Exporter stopped sending. Does nothing without a
lifetime.
Sourcepub fn register_enterprise_element(
&mut self,
element: EnterpriseElement,
) -> Result<()>
pub fn register_enterprise_element( &mut self, element: EnterpriseElement, ) -> Result<()>
Register the definition of an enterprise-specific Information Element
(e.g. from vendor documentation), so that its fields are decoded with
its data type instead of being kept as FieldValue::Raw.
Registered definitions apply to all Observation Domains, survive
clear, and always take precedence over type records
sent by the Exporter (RFC 5610 Section 3.9). Registering the same
element again replaces the definition. Fails for reverse elements
(PEN 29305) and for IANA elements already in the registry.
Sourcepub fn enterprise_element(
&self,
observation_domain_id: u32,
enterprise_number: u32,
id: u16,
) -> Option<&EnterpriseElement>
pub fn enterprise_element( &self, observation_domain_id: u32, enterprise_number: u32, id: u16, ) -> Option<&EnterpriseElement>
The definition of an enterprise-specific Information Element: the
registered one, or else the one learned from type records (RFC 5610)
in this Observation Domain. With enterprise_number 0, the definition
of an IANA element newer than the registry.
Sourcepub fn learned_element_count(&self) -> usize
pub fn learned_element_count(&self) -> usize
Number of enterprise-specific Information Element definitions learned from type records (RFC 5610), excluding conflicting ones
Sourcepub fn field_name(
&self,
observation_domain_id: u32,
specifier: &FieldSpecifier,
) -> Option<&str>
pub fn field_name( &self, observation_domain_id: u32, specifier: &FieldSpecifier, ) -> Option<&str>
The name of a field’s Information Element: the IANA name (forward name for reverse elements), or the name of its enterprise-specific definition
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Remove all Templates and learned type records (e.g. at the end of the Transport Session). Registered definitions are kept.
Sourcepub fn remove_observation_domain(&mut self, observation_domain_id: u32)
pub fn remove_observation_domain(&mut self, observation_domain_id: u32)
Remove all Templates and learned type records of an Observation Domain