pub trait ProtocolBehavior: 'static {
type ProtocolTypes: ProtocolTypes;
type Claim: Claim<PT = Self::ProtocolTypes>;
type SecurityViolationPolicy: SecurityViolationPolicy<C = Self::Claim>;
type ProtocolMessage: ProtocolMessage<Self::ProtocolTypes, Self::OpaqueProtocolMessage>;
type OpaqueProtocolMessage: OpaqueProtocolMessage<Self::ProtocolTypes>;
type ProtocolMessageFlight: ProtocolMessageFlight<Self::ProtocolTypes, Self::ProtocolMessage, Self::OpaqueProtocolMessage, Self::OpaqueProtocolMessageFlight>;
type OpaqueProtocolMessageFlight: OpaqueProtocolMessageFlight<Self::ProtocolTypes, Self::OpaqueProtocolMessage> + From<Self::ProtocolMessageFlight>;
const ZOO_MAX_DEPTH: u16 = 14u16;
const ZOO_MAX_SIZE: usize = 64usize;
const ZOO_MAX_TRIES: usize = 140_000usize;
// Required method
fn try_read_bytes(
bitstring: &[u8],
ty: TypeId,
) -> Result<Box<dyn EvaluatedTerm<Self::ProtocolTypes>>, Error>;
// Provided methods
fn corpus_registry() -> Vec<(&'static str, CorpusBuilder<Self>)> { ... }
fn any_get_encoding(
message: &dyn EvaluatedTerm<Self::ProtocolTypes>,
) -> Vec<u8> ⓘ { ... }
}Expand description
Defines the protocol which is being tested.
The fuzzer is generally abstract over the used protocol. We assume that protocols have opaque messages, structured messages, and a way to deframe an arbitrary stream of bytes into messages.
Also the library allows the definition of a type for claims and a
(security policy)SecurityViolationPolicy over
sequences of them. Finally, there is a matcher which allows traces to include
queries for knowledge.
Provided Associated Constants§
Sourceconst ZOO_MAX_DEPTH: u16 = 14u16
const ZOO_MAX_DEPTH: u16 = 14u16
Budgets the term zoo generates with, see crate::fuzzer::term_zoo. The defaults are the
values tuned for tlspuffin; what they depend on is a property of the protocol, so every
protocol is expected to revisit them.
const ZOO_MAX_SIZE: usize = 64usize
const ZOO_MAX_TRIES: usize = 140_000usize
Required Associated Types§
type ProtocolTypes: ProtocolTypes
type Claim: Claim<PT = Self::ProtocolTypes>
type SecurityViolationPolicy: SecurityViolationPolicy<C = Self::Claim>
type ProtocolMessage: ProtocolMessage<Self::ProtocolTypes, Self::OpaqueProtocolMessage>
type OpaqueProtocolMessage: OpaqueProtocolMessage<Self::ProtocolTypes>
type ProtocolMessageFlight: ProtocolMessageFlight<Self::ProtocolTypes, Self::ProtocolMessage, Self::OpaqueProtocolMessage, Self::OpaqueProtocolMessageFlight>
type OpaqueProtocolMessageFlight: OpaqueProtocolMessageFlight<Self::ProtocolTypes, Self::OpaqueProtocolMessage> + From<Self::ProtocolMessageFlight>
Required Methods§
Sourcefn try_read_bytes(
bitstring: &[u8],
ty: TypeId,
) -> Result<Box<dyn EvaluatedTerm<Self::ProtocolTypes>>, Error>
fn try_read_bytes( bitstring: &[u8], ty: TypeId, ) -> Result<Box<dyn EvaluatedTerm<Self::ProtocolTypes>>, Error>
Try to read a bitstring and interpret it as the TypeShape, which is the type of a message
as per the PB’s internal structure This is expected to fail for many types of messages!
Provided Methods§
Sourcefn corpus_registry() -> Vec<(&'static str, CorpusBuilder<Self>)>
fn corpus_registry() -> Vec<(&'static str, CorpusBuilder<Self>)>
Named corpus builders offered by this protocol.
Each entry maps a corpus name (as accepted by the seed --corpus CLI
flag) to a CorpusBuilder producing that corpus’ seeds for a single
PUT. Registering a new corpus is a matter of adding one line here. The
list is ordered; the default is no corpus at all.
Sourcefn any_get_encoding(message: &dyn EvaluatedTerm<Self::ProtocolTypes>) -> Vec<u8> ⓘ
fn any_get_encoding(message: &dyn EvaluatedTerm<Self::ProtocolTypes>) -> Vec<u8> ⓘ
Downcast from Box<dyn Any> and encode as bitstring any message as per the PB’s internal
structure
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.