Struct t2plugin::Header

source ·
pub struct Header { /* private fields */ }
Expand description

This structure represents the output header of this plugin.

A header is defined as a set of columns. Each column is defined by its short name, long name and a definition of the type of data it contains.

Implementations§

source§

impl Header

source

pub fn new() -> Header

Creates a new empty header without any column.

source

pub fn _internal(&self) -> *mut BinaryValue

Returns Tranalyzer2 internal buffer representing the built header.

This method does not need to be manually called when the t2plugin! macro is used.

source

pub fn add_simple_col( &mut self, long_name: &str, short_name: &str, repeating: bool, bin_type: BinaryType )

Adds a simple column (without compound values) to the header.

Example
impl T2Plugin for ExamplePlugin {
    ...
    fn print_header() -> Header {
        let mut header = Header::new();
        header.add_simple_col("IPv4 source address", "srcIP4", false,
                BinaryType::bt_ip4_addr);
        header.add_simple_col("HTTP cookies", "httpCookies", true,
                BinaryType::bt_string);
        header
    }
}
source

pub fn add_compound_col( &mut self, long_name: &str, short_name: &str, repeating: bool, bin_types: &[BinaryType] )

Adds a compound column to the header.

Example
impl T2Plugin for ExamplePlugin {
    ...
    fn print_header() -> Header {
        let mut header = Header::new();
        // column which contains for each cookie a compound: count_key_value
        header.add_compound_col("HTTP cookies", "httpCookies", true,
                &[BinaryType::bt_uint_16, BinaryType::bt_string, BinaryType::bt_string]);
        header
    }
}

Auto Trait Implementations§

§

impl RefUnwindSafe for Header

§

impl !Send for Header

§

impl !Sync for Header

§

impl Unpin for Header

§

impl UnwindSafe for Header

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.