Struct t2plugin::Header [] [src]

pub struct Header { /* fields omitted */ }

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.

Methods

impl Header
[src]

Creates a new empty header without any column.

Returns Tranalyzer2 internal buffer representing the built header.

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

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
    }
}

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
    }
}