Function t2plugin::output_bytes [] [src]

pub fn output_bytes(val: &[u8])

Appends bytes to Tranalyzer2 output buffer.

This function can be called in the on_flow_terminate function to append raw bytes in Tranalyzer2 output buffer. This can be used to output types which are neither a string, nor a number (e.g. MAC or IP addresses).

Example

impl T2Plugin for ExamplePlugin {
    ...
    #[allow(unused_variables)]
    fn on_flow_terminate(&mut self, flow: &mut Flow) {
        // output flow source IPv6 address in a bt_ip6_addr column
        match flow.src_ip6() {
            Some(ip) => output_bytes(&ip.octets()),
            None => output_bytes(&[0u8; 16]),
        }
    }
}