Skip to main content

ferro_lumberjack/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2#![doc = include_str!("../README.md")]
3#![cfg_attr(docsrs, feature(doc_cfg))]
4#![deny(missing_docs)]
5
6mod error;
7pub mod frame;
8mod sequence;
9
10#[cfg(feature = "client")]
11#[cfg_attr(docsrs, doc(cfg(feature = "client")))]
12pub mod client;
13
14#[cfg(feature = "server")]
15#[cfg_attr(docsrs, doc(cfg(feature = "server")))]
16pub mod server;
17
18#[cfg(feature = "tls")]
19#[cfg_attr(docsrs, doc(cfg(feature = "tls")))]
20pub mod tls;
21
22pub use error::{FrameError, ProtocolError};
23pub use frame::{
24    Frame, FrameDecoder, FrameType, encode_ack, encode_compressed, encode_json_frame, encode_window,
25};
26pub use sequence::Sequence;
27
28/// Lumberjack v2 protocol version byte (`b'2'`).
29pub const PROTOCOL_VERSION: u8 = b'2';
30
31/// Default maximum decoded frame payload size (64 MiB).
32///
33/// Caps both raw frame payloads and the *decompressed* size of `C` frames,
34/// to make zlib-bomb attacks O(memory-bounded) instead of unbounded. Used
35/// by [`FrameDecoder::new`].
36pub const DEFAULT_MAX_FRAME_PAYLOAD: usize = 64 * 1024 * 1024;