1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//! # Internet
//!
//! A networking library providing codecs, in-place parsing and mutation.
//!
//! ## Architecture
//!
//! ### Mappings: In-Place Parsing and Mutation
//!
//! Access protocol fields directly on the underlying buffer with zero allocations:
//!
//! ```rust
//! use internet::ietf::udp::{HeaderMapping, Port};
//!
//! // Parse in-place
//! let udp = HeaderMapping::new(&[0xaa, 0xaa, 0xbb, 0xbb, 0x66, 0x66, 0x00, 0x00]);
//! let src_port = udp.read_source_port();
//! let dst_port = udp.read_destination_port();
//! println!("{src_port:#?}, {dst_port:#?}");
//!
//! // Mutate in-place
//! let udp_mut_bytes = &mut [0xaa, 0xaa, 0xbb, 0xbb, 0x66, 0x66, 0x00, 0x00];
//! let mut udp = HeaderMapping::new(udp_mut_bytes);
//! udp.write_source_port(Port::from(443)).unwrap();
//! ```
//!
//! ### Codecs: Type-Safe Serialization and Deserialization
//!
//! High-level protocol types with `encode`/`decode` methods:
//!
//! ```rust
//! use internet::ietf::tls1_3::{Alert, AlertDescription};
//! use internet::{Codec, Cursor};
//!
//! // Decode from buffer
//! let mut alert = Alert::decode(&mut Cursor::new(&[0x02, 0xA]), ()).unwrap();
//! alert.description = AlertDescription::DecodeError;
//! println!("{alert:#?}");
//!
//! // Encode to buffer
//! let mut writer = Cursor::new(vec![]);
//! alert.encode(&mut writer, ()).unwrap();
//! ```
//!
//! ## Scope
//!
//! This library provides **zero-copy**, **type-safe** implementations
//! of **dozens of internet protocols** across all network layers:
//!
//! - **Layer 2 (Data Link)**: Ethernet, VLAN, ARP
//! - **Layer 3 (Network)**: IPv4, IPv6, ICMPv4/6, IGMP (v1-3), NDP, MLD (v1/2), SLAAC
//! - **Layer 4 (Transport)**: TCP, UDP, QUIC (v1/2)
//! - **Layer 5-7 (Application)**: HTTP/1.1, HTTP/2, HTTP/3, TLS (1.0-1.3), DHCPv4/6
//!
//! Future releases will expand coverage to **hundreds of protocols**
//! including BGP, DNS, SMTP, and 3GPP mobile standards.
//!
//! ## Modules
//!
//! - [`egpp`] — 3GPP mobile protocols (LTE, 5G, etc.)
//! - [`ieee`] — IEEE family (Ethernet, VLAN, Wi-Fi, etc.)
//! - [`ietf`] — IETF protocols (IP, TCP, UDP, HTTP, TLS, etc.)
//!
//! ## Core Traits
//!
//! - [`Buf`], [`BufMut`] — Buffer traits for zero-copy operations
//! - [`Codec`] — Trait for type-safe encoding/decoding
//! - [`Cursor`] — Cursor wrapper for buffer operations
//!
//! ## Design Goals
//!
//! - **Zero-copy**: Parse packets without allocations
//! - **Type-safe**: Compile-time guarantees on protocol structure
//! - **Comprehensive**: Cover the entire internet protocol stack
//! - **Extensible**: Easy to add new protocols following the same pattern
//!
//! ## Status
//!
//! This library is under active development. Currently implements **30+ protocols**
//! with more being added regularly.
//!
//! **Unstable API** — Breaking changes expected until 1.0.0.
//!
//! > Then more standards and protocols we met — then more ideas we got.
//! > Then more areas we explore — then more name spaces and conflicts we got.
//! > Then more goals we set — then more scales we got.
//! > Then more time we lived — then more times we changed.
pub use *;