Module types

Source
Expand description

§Types of Zeek’s WebSocket API

The main type of this module is Value which holds values of the Zeek API. Use its enum variants to create values of specific types, e.g.,

let value1 = Value::Count(0);
let value2 = Value::from(0u64);
assert_eq!(value1, value2);

We provide implementations of TryFrom to go from Zeek values to Rust types, e.g.,

assert_eq!(Value::Count(0).try_into(), Ok(0u64));
assert_eq!(u16::try_from(Value::Count(0)), Ok(0u16));

User types can be serialized and deserialized with ZeekType.

#[derive(ZeekType)]
struct X {
    message: String,
    count: u64,
}

let x = X { message: "Hello, world!".to_string(), count: 42 };
let value = Value::from(x);
let x = X::try_from(value);
assert!(matches!(x, Ok(X{ count: 42, .. })));

Structs§

DateTime
Compound struct, holds Date and Time.
Event
A Zeek event.
Port
A Zeek port which holds both a port number and a protocol identifier.
Subscriptions
Topics to subscribe to. This should be the first message sent to the server.
TableEntry
An entry in a table in a Value::Table.
TimeDelta
Time duration with nanosecond precision.

Enums§

ConversionError
Error enum for errors related to conversions from a Zeek value.
Data
Data payload of a Zeek API message.
DeserializationError
Error enum for Zeek-related deserialization errors.
IpNetwork
Represents a generic network range. This type can have two variants: the v4 and the v6 case.
Message
Data messages of the Zeek API.
ParseError
Error enum for Zeek-related deserialization errors.
Protocol
A network protocol understood by Zeek.
SerializationError
Error enum for Zeek-related serialization errors.
Value
Enum for all basic types understood by Zeek’s WebSocket API.