Expand description
L2TP (Layer 2 Tunneling Protocol) layer implementation.
Implements L2TPv2 as defined in RFC 2661.
§Header Format
Bits: 0 1 2 3 4 5 6 7 | 8 9 10 11 12 13 14 15
T L X X S X X O | P X X X X Ver(4 bits)Where:
- T (bit 0): Message type: 0=data, 1=control
- L (bit 1): Length bit; if set, Length field is present
- S (bit 4): Sequence bit; if set, Ns and Nr fields are present
- O (bit 6): Offset bit; if set, Offset Size/Pad fields are present
- P (bit 8): Priority (data messages only)
- Ver (12-15): Must be 2 for L2TPv2
Fields present in order:
- Flags+Version (2 bytes, always)
- Length (2 bytes, only if L=1)
- Tunnel ID (2 bytes, always)
- Session ID (2 bytes, always)
- Ns (2 bytes, only if S=1)
- Nr (2 bytes, only if S=1)
- Offset Size (2 bytes, only if O=1)
- Offset Pad (variable, only if O=1)
Re-exports§
pub use builder::L2tpBuilder;
Modules§
- builder
- L2TP packet builder.
Structs§
- L2tp
Layer - L2TP layer — a zero-copy view into a packet buffer.
Constants§
- L2TP_
MIN_ HEADER_ LEN - Minimum L2TP header: flags+version (2) + tunnel_id (2) + session_id (2) = 6 bytes.
- L2TP_
PORT - L2TP UDP port.
- L2TP_
VERSION - L2TP version number (bits 12-15 of the flags word).
Statics§
- L2TP_
FIELD_ NAMES - Field names exported for Python/generic access.