Skip to main content

ipfix_parser/
lib.rs

1//! IPFIX Parser Library
2//!
3//! This library provides parsing functionality for IP Flow Information Export
4//! (IPFIX) messages as specified in [RFC 7011](https://www.rfc-editor.org/rfc/rfc7011),
5//! with the Information Element registry maintained by
6//! [IANA](https://www.iana.org/assignments/ipfix/ipfix.xhtml).
7//!
8//! IPFIX is a template-based protocol: Data Records can only be decoded with a
9//! Template that the Exporter sent earlier. The [`Decoder`] keeps a Template
10//! cache and should be kept alive for the whole Transport Session (one
11//! `Decoder` per Exporter / TCP connection / UDP source). Template management
12//! depends on the transport (UDP by default), see [`DecoderConfig`].
13//!
14//! # Example
15//!
16//! ```no_run
17//! use ipfix_parser::Decoder;
18//!
19//! let mut decoder = Decoder::new();
20//! let data = std::fs::read("ipfix.bin").unwrap();
21//! let message = decoder.decode(&data).unwrap();
22//! for record in message.data_records() {
23//!     println!("{:?}", record.get("sourceIPv4Address"));
24//! }
25//! ```
26//!
27//! For a self-contained buffer (Templates and Data Records in the same
28//! buffer), [`parse_message`] and [`parse_messages`] can be used directly.
29
30pub mod models;
31pub mod parsers;
32pub mod registry;
33
34// Re-export commonly used types
35pub use models::{DataRecord, Field, FieldSpecifier, FieldValue, Message, MessageHeader, Set};
36pub use parsers::{parse_message, parse_messages, Decoder, DecoderConfig, ParseError, Transport};