Expand description
HTTP/2 protocol layer (RFC 7540).
This module implements the HTTP/2 framing layer for Stackforge, including:
- Frame parsing and building (RFC 7540)
- HPACK header compression (RFC 7541)
- Layer integration with the Stackforge packet model
§Architecture
HTTP/2 operates over TCP as a sequence of frames. Each frame has a 9-byte header followed by a variable-length payload. A connection begins with a 24-byte “preface” string sent by the client.
The Http2Layer represents one “segment” of HTTP/2 traffic captured within
a packet buffer. It identifies whether the segment starts with the connection
preface and provides access to the contained frames.
§Usage
use stackforge_core::layer::http2::builder::{Http2Builder, Http2FrameBuilder};
use stackforge_core::layer::http2::{Http2Layer, Http2Frame};
use stackforge_core::layer::{LayerIndex, LayerKind};
// Build a connection initiation
let bytes = Http2Builder::new()
.frame(Http2FrameBuilder::settings())
.build();
// Parse it back
let layer = Http2Layer::new(0, bytes.len(), true);
let summary = layer.summary(&bytes);
assert!(summary.contains("HTTP/2"));Re-exports§
pub use builder::Http2Builder;pub use builder::Http2FrameBuilder;pub use builder::build_frame;pub use frames::HTTP2_FRAME_HEADER_LEN;pub use frames::HTTP2_PREFACE;pub use frames::Http2Frame;pub use frames::Http2FrameType;pub use frames::error_codes;pub use frames::flags;pub use frames::parse_all_frames;pub use frames::parse_goaway;pub use frames::parse_rst_stream;pub use frames::parse_settings;pub use frames::parse_window_update;pub use frames::settings_id;pub use hpack::HpackDecoder;pub use hpack::HpackEncoder;pub use hpack::STATIC_TABLE;
Modules§
- builder
- HTTP/2 frame and connection builders.
- frames
- HTTP/2 frame parsing (RFC 7540 Section 4).
- hpack
- HPACK header compression for HTTP/2 (RFC 7541).
Structs§
- Http2
Layer - HTTP/2 protocol layer view.
Constants§
- HTTP2_
FIELD_ NAMES - Field names exposed by the HTTP/2 layer.
Functions§
- is_
http2_ payload - Check if a TCP payload looks like HTTP/2 traffic.