Expand description
Ethernet → VLAN → IP → UDP/TCP frame dissection.
This module walks a raw captured Ethernet frame down through optional VLAN tags, the IPv4 header, and finally UDP or TCP, handing back the transport-layer payload for protocol-specific parsers to consume.
Structs§
- IpHeader
- TcpSegment
- A dissected TCP segment: ports plus payload past the header/options.
Constants§
- ETHERTYPE_
8021AD - 802.1ad “Q-in-Q” outer service tag. Frames carrying this ethertype have a second, inner 802.1Q tag before the real payload ethertype.
- ETHERTYPE_
8021Q - 802.1Q VLAN tag (single tag).
- ETHERTYPE_
IP - PROTO_
TCP - PROTO_
UDP
Functions§
- extract_
ip - Extracts the IPv4 header and payload from a raw Ethernet frame, transparently handling untagged, 802.1Q, and 802.1ad Q-in-Q framing.
- extract_
tcp - Extracts ports and payload from an IP payload whose protocol is
PROTO_TCP, accounting for the variable-length TCP header (data offset field) so that TCP options don’t leak intopayload. - extract_
udp - Extracts
(src_port, dst_port, udp_payload)from an IP payload whose protocol isPROTO_UDP. - strip_
ethernet - Strips the Ethernet header (and any VLAN tags) from a raw frame, returning the IPv4 payload.