Expand description
TCP (Transmission Control Protocol) layer module.
This module implements the TCP protocol (RFC 793), providing packet parsing (via TcpLayer),
construction (via TcpBuilder), options handling, and checksum verification.
§Features
- Zero-copy parsing with lazy field access
- Complete TCP options support (MSS, Window Scale, SACK, Timestamps, etc.)
- TCP-AO (Authentication Option) support per RFC 5925
- Checksum calculation with IPv4/IPv6 pseudo-header
- Service name resolution for well-known ports
- Builder pattern for packet construction
§Example
use stackforge_core::layer::tcp::{TcpBuilder, TcpFlags};
// Build a SYN packet
let packet = TcpBuilder::new()
.src_port(12345)
.dst_port(80)
.seq(1000)
.syn()
.window(65535)
.mss(1460)
.build();Re-exports§
pub use builder::TcpBuilder;pub use checksum::tcp_checksum;pub use checksum::tcp_checksum_ipv4;pub use checksum::verify_tcp_checksum;pub use flags::TcpFlags;pub use header::FIELDS as TCP_FIELDS;pub use header::TCP_MAX_HEADER_LEN;pub use header::TCP_MIN_HEADER_LEN;pub use header::TcpLayer;pub use header::offsets as tcp_offsets;pub use options::TcpAoValue;pub use options::TcpOption;pub use options::TcpOptionKind;pub use options::TcpOptions;pub use options::TcpOptionsBuilder;pub use options::TcpSackBlock;pub use options::TcpTimestamp;pub use services::TCP_SERVICES;pub use services::service_name;pub use services::service_port;