///|
pub(all) enum ExpectedProtocol {
V1Only
V2Only
V1OrV2
} derive(Eq, Debug)
///|
pub(all) struct DecodePolicy {
expected_protocol : ExpectedProtocol
max_v1_line_bytes : Int
max_v2_payload_bytes : Int
verify_crc32c : Bool
require_crc32c : Bool
allow_local_command : Bool
allow_unspec : Bool
preserve_unknown_tlvs : Bool
} derive(Debug)
///|
pub fn DecodePolicy::strict() -> DecodePolicy {
{
expected_protocol: V1OrV2,
// The v1 specification limits the complete line, including CRLF, to 107 bytes.
max_v1_line_bytes: 107,
max_v2_payload_bytes: 65535,
verify_crc32c: true,
require_crc32c: false,
allow_local_command: true,
allow_unspec: true,
preserve_unknown_tlvs: true,
}
}
///|
pub fn DecodePolicy::v1_only() -> DecodePolicy {
{ ..DecodePolicy::strict(), expected_protocol: V1Only }
}
///|
pub fn DecodePolicy::v2_only() -> DecodePolicy {
{ ..DecodePolicy::strict(), expected_protocol: V2Only }
}