Traceroute.Protocols.TCP (traceroute v0.2.3)
View SourceParses TCP header for extracting information from ICMP error responses.
When an ICMP error (Time Exceeded, Destination Unreachable) is received, it contains the first 8 bytes of the original TCP header, which includes the source and destination ports needed for request correlation.
Summary
Functions
Parses the first 8 bytes of a TCP header.
Functions
@spec parse_header(binary()) :: Traceroute.Protocols.TCP.Header.t()
Parses the first 8 bytes of a TCP header.
This is sufficient for extracting the source port, destination port, and sequence number from ICMP error responses.
TCP Header Structure (first 8 bytes):
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Source Port | Destination Port |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Sequence Number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+