eventheader_macros 0.5.0

Rust macros for eventheader-encoded Linux Tracepoints via user_events
Documentation
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

use crate::enums::{FieldEncoding as E, FieldFormat as F};
use crate::field_option::{FieldOption as Opt, FieldStrategy::*};
use crate::strings::*;

/// List must be strcmp-sorted by option_name (for binary search).
/// (Verified by debug_assert in EventInfo::try_from_tokens.)
#[rustfmt::skip]
pub static FIELD_OPTIONS: &[Opt] = &[
    Opt::new("binary",              U8_PATH,    E::StringLength16Char8, F::HexBytes,    Str,        0),
    Opt::new("binaryc",             U8_PATH,    E::StringLength16Char8, F::HexBytes,    Str,        0),
    Opt::new("bool32",              I32_PATH,   E::Value32,             F::Boolean,     Scalar,     0),
    Opt::new("bool32_slice",        I32_PATH,   E::Value32,             F::Boolean,     Slice,      0),
    Opt::new("bool8",               BOOL_PATH,  E::Value8,              F::Boolean,     Scalar,     0),
    Opt::new("bool8_slice",         BOOL_PATH,  E::Value8,              F::Boolean,     Slice,      0),
    Opt::new("char16",              U16_PATH,   E::Value16,             F::StringUtf,   Scalar,     0),
    Opt::new("char16_slice",        U16_PATH,   E::Value16,             F::StringUtf,   Slice,      0),
    Opt::new("char8_cp1252",        U8_PATH,    E::Value8,              F::String8,     Scalar,     0),
    Opt::new("char8_cp1252_slice",  U8_PATH,    E::Value8,              F::String8,     Slice,      0),
    Opt::new("codepointer",         USIZE_PATH, E::ValueSize,           F::HexInt,      Scalar,     0),
    Opt::new("codepointer_slice",   USIZE_PATH, E::ValueSize,           F::HexInt,      Slice,      0),
    Opt::new("cstr16",              U16_PATH,   E::ZStringChar16,       F::Default,     CStr,       0),
    Opt::new("cstr16_json",         U16_PATH,   E::ZStringChar16,       F::StringJson,  CStr,       0),
    Opt::new("cstr16_xml",          U16_PATH,   E::ZStringChar16,       F::StringXml,   CStr,       0),
    Opt::new("cstr32",              U32_PATH,   E::ZStringChar32,       F::Default,     CStr,       0),
    Opt::new("cstr32_json",         U32_PATH,   E::ZStringChar32,       F::StringJson,  CStr,       0),
    Opt::new("cstr32_xml",          U32_PATH,   E::ZStringChar32,       F::StringXml,   CStr,       0),
    Opt::new("cstr8",               U8_PATH,    E::ZStringChar8,        F::Default,     CStr,       0),
    Opt::new("cstr8_cp1252",        U8_PATH,    E::ZStringChar8,        F::String8,     CStr,       0),
    Opt::new("cstr8_json",          U8_PATH,    E::ZStringChar8,        F::StringJson,  CStr,       0),
    Opt::new("cstr8_xml",           U8_PATH,    E::ZStringChar8,        F::StringXml,   CStr,       0),
    Opt::new("errno",               I32_PATH,   E::Value32,             F::Errno,       Scalar,     0),
    Opt::new("errno_slice",         I32_PATH,   E::Value32,             F::Errno,       Slice,      0),
    Opt::new("f32",                 F32_PATH,   E::Value32,             F::Float,       Scalar,     0),
    Opt::new("f32_slice",           F32_PATH,   E::Value32,             F::Float,       Slice,      0),
    Opt::new("f64",                 F64_PATH,   E::Value64,             F::Float,       Scalar,     0),
    Opt::new("f64_slice",           F64_PATH,   E::Value64,             F::Float,       Slice,      0),
    Opt::new("guid",                GUID_PATH,  E::Value128,            F::Uuid,        Scalar,     0),
    Opt::new("guid_slice",          GUID_PATH,  E::Value128,            F::Uuid,        Slice,      0),
    Opt::new("hresult",             I32_PATH,   E::Value32,             F::HexInt,      Scalar,     0),
    Opt::new("hresult_slice",       I32_PATH,   E::Value32,             F::HexInt,      Slice,      0),
    Opt::new("i16",                 I16_PATH,   E::Value16,             F::SignedInt,   Scalar,     0),
    Opt::new("i16_hex",             I16_PATH,   E::Value16,             F::HexInt,      Scalar,     0),
    Opt::new("i16_hex_slice",       I16_PATH,   E::Value16,             F::HexInt,      Slice,      0),
    Opt::new("i16_slice",           I16_PATH,   E::Value16,             F::SignedInt,   Slice,      0),
    Opt::new("i32",                 I32_PATH,   E::Value32,             F::SignedInt,   Scalar,     0),
    Opt::new("i32_hex",             I32_PATH,   E::Value32,             F::HexInt,      Scalar,     0),
    Opt::new("i32_hex_slice",       I32_PATH,   E::Value32,             F::HexInt,      Slice,      0),
    Opt::new("i32_slice",           I32_PATH,   E::Value32,             F::SignedInt,   Slice,      0),
    Opt::new("i64",                 I64_PATH,   E::Value64,             F::SignedInt,   Scalar,     0),
    Opt::new("i64_hex",             I64_PATH,   E::Value64,             F::HexInt,      Scalar,     0),
    Opt::new("i64_hex_slice",       I64_PATH,   E::Value64,             F::HexInt,      Slice,      0),
    Opt::new("i64_slice",           I64_PATH,   E::Value64,             F::SignedInt,   Slice,      0),
    Opt::new("i8",                  I8_PATH,    E::Value8,              F::SignedInt,   Scalar,     0),
    Opt::new("i8_hex",              I8_PATH,    E::Value8,              F::HexInt,      Scalar,     0),
    Opt::new("i8_hex_slice",        I8_PATH,    E::Value8,              F::HexInt,      Slice,      0),
    Opt::new("i8_slice",            I8_PATH,    E::Value8,              F::SignedInt,   Slice,      0),
    Opt::new("ipv4",                U8_PATH,    E::Value32,             F::IPv4,        Scalar,     4),
    Opt::new("ipv4_slice",          U8_PATH,    E::Value32,             F::IPv4,        Slice,      4),
    Opt::new("ipv6",                U8_PATH,    E::Value128,            F::IPv6,        Scalar,     16),
    Opt::new("ipv6c",               U8_PATH,    E::Value128,            F::IPv6,        Scalar,     16),
    Opt::new("isize",               ISIZE_PATH, E::ValueSize,           F::SignedInt,   Scalar,     0),
    Opt::new("isize_hex",           ISIZE_PATH, E::ValueSize,           F::HexInt,      Scalar,     0),
    Opt::new("isize_hex_slice",     ISIZE_PATH, E::ValueSize,           F::HexInt,      Slice,      0),
    Opt::new("isize_slice",         ISIZE_PATH, E::ValueSize,           F::SignedInt,   Slice,      0),
    Opt::new("pid",                 U32_PATH,   E::Value32,             F::Pid,         Scalar,     0),
    Opt::new("pid_slice",           U32_PATH,   E::Value32,             F::Pid,         Slice,      0),
    Opt::new("pointer",             USIZE_PATH, E::ValueSize,           F::HexInt,      Scalar,     0),
    Opt::new("pointer_slice",       USIZE_PATH, E::ValueSize,           F::HexInt,      Slice,      0),
    Opt::new("port",                U16_PATH,   E::Value16,             F::Port,        Scalar,     0),
    Opt::new("port_slice",          U16_PATH,   E::Value16,             F::Port,        Slice,      0),
    Opt::new("raw_data",            U8_PATH,    E::Invalid,             F::Default,     RawData,        0),
    Opt::new("raw_field",           U8_PATH,    E::Invalid,             F::Default,     RawField,       0),
    Opt::new("raw_field_slice",     U8_PATH,    E::Invalid,             F::Default,     RawFieldSlice,  0),
    Opt::new("raw_meta",            &[],        E::Invalid,             F::Default,     RawMeta,        0),
    Opt::new("raw_meta_slice",      &[],        E::Invalid,             F::Default,     RawMetaSlice,   0),
    Opt::new("raw_struct",          &[],        E::Struct,              F::Default,     RawStruct,      0),
    Opt::new("raw_struct_slice",    &[],        E::Struct,              F::Default,     RawStructSlice, 0),
    Opt::new("socketaddress",       U8_PATH,    E::StringLength16Char8, F::HexBytes,    Str,        0),
    Opt::new("socketaddressc",      U8_PATH,    E::StringLength16Char8, F::HexBytes,    Str,        0),
    Opt::new("str16",               U16_PATH,   E::StringLength16Char16,F::Default,     Str,        0),
    Opt::new("str16_json",          U16_PATH,   E::StringLength16Char16,F::StringJson,  Str,        0),
    Opt::new("str16_xml",           U16_PATH,   E::StringLength16Char16,F::StringXml,   Str,        0),
    Opt::new("str32",               U32_PATH,   E::StringLength16Char32,F::Default,     Str,        0),
    Opt::new("str32_json",          U32_PATH,   E::StringLength16Char32,F::StringJson,  Str,        0),
    Opt::new("str32_xml",           U32_PATH,   E::StringLength16Char32,F::StringXml,   Str,        0),
    Opt::new("str8",                U8_PATH,    E::StringLength16Char8, F::Default,     Str,        0),
    Opt::new("str8_cp1252",         U8_PATH,    E::StringLength16Char8, F::String8,     Str,        0),
    Opt::new("str8_json",           U8_PATH,    E::StringLength16Char8, F::StringJson,  Str,        0),
    Opt::new("str8_xml",            U8_PATH,    E::StringLength16Char8, F::StringXml,   Str,        0),
    Opt::new("struct",              &[],        E::Struct,              F::Default,     Struct,     0),
    Opt::new("systemtime",          I64_PATH,   E::Value64,             F::Time,        SystemTime, 0),
    Opt::new("tid",                 U32_PATH,   E::Value32,             F::Pid,         Scalar,     0),
    Opt::new("tid_slice",           U32_PATH,   E::Value32,             F::Pid,         Slice,      0),
    Opt::new("time32",              I32_PATH,   E::Value32,             F::Time,        Scalar,     0),
    Opt::new("time64",              I64_PATH,   E::Value64,             F::Time,        Scalar,     0),
    Opt::new("u16",                 U16_PATH,   E::Value16,             F::Default,     Scalar,     0),
    Opt::new("u16_hex",             U16_PATH,   E::Value16,             F::HexInt,      Scalar,     0),
    Opt::new("u16_hex_slice",       U16_PATH,   E::Value16,             F::HexInt,      Slice,      0),
    Opt::new("u16_slice",           U16_PATH,   E::Value16,             F::Default,     Slice,      0),
    Opt::new("u32",                 U32_PATH,   E::Value32,             F::Default,     Scalar,     0),
    Opt::new("u32_hex",             U32_PATH,   E::Value32,             F::HexInt,      Scalar,     0),
    Opt::new("u32_hex_slice",       U32_PATH,   E::Value32,             F::HexInt,      Slice,      0),
    Opt::new("u32_slice",           U32_PATH,   E::Value32,             F::Default,     Slice,      0),
    Opt::new("u64",                 U64_PATH,   E::Value64,             F::Default,     Scalar,     0),
    Opt::new("u64_hex",             U64_PATH,   E::Value64,             F::HexInt,      Scalar,     0),
    Opt::new("u64_hex_slice",       U64_PATH,   E::Value64,             F::HexInt,      Slice,      0),
    Opt::new("u64_slice",           U64_PATH,   E::Value64,             F::Default,     Slice,      0),
    Opt::new("u8",                  U8_PATH,    E::Value8,              F::Default,     Scalar,     0),
    Opt::new("u8_hex",              U8_PATH,    E::Value8,              F::HexInt,      Scalar,     0),
    Opt::new("u8_hex_slice",        U8_PATH,    E::Value8,              F::HexInt,      Slice,      0),
    Opt::new("u8_slice",            U8_PATH,    E::Value8,              F::Default,     Slice,      0),
    Opt::new("usize",               USIZE_PATH, E::ValueSize,           F::Default,     Scalar,     0),
    Opt::new("usize_hex",           USIZE_PATH, E::ValueSize,           F::HexInt,      Scalar,     0),
    Opt::new("usize_hex_slice",     USIZE_PATH, E::ValueSize,           F::HexInt,      Slice,      0),
    Opt::new("usize_slice",         USIZE_PATH, E::ValueSize,           F::Default,     Slice,      0),
];