Skip to content

Commit

Permalink
Add documentation for PcapNGOption structure and fields
Browse files Browse the repository at this point in the history
  • Loading branch information
chifflier committed Aug 29, 2024
1 parent 2055396 commit 2cebff0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/pcapng/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,21 @@ impl fmt::Display for PcapNGOptionError {

impl std::error::Error for PcapNGOptionError {}

/// A PcapNG option
#[derive(Debug)]
pub struct PcapNGOption<'a> {
/// The numeric code for the option
///
/// Note that codes are relative to the block type, and same codes are used for different
/// things (for ex 2 is `shb_hardware` if the block is a SHB, but 2 is `if_name` for an IDB)
pub code: OptionCode,
/// The declared length for the option
///
/// Note that `value.len()` can be greater than `len`, because data is padded to a 32-bit boundary
pub len: u16,
/// The raw value (including padding) of the option
///
/// See [PcapNGOption::as_bytes] to get the value truncated to `len`.
pub value: Cow<'a, [u8]>,
}

Expand Down

0 comments on commit 2cebff0

Please sign in to comment.