Skip to main content

parse_tcp

Function parse_tcp 

Source
pub fn parse_tcp(
    packet_bytes: &[u8],
    sport: u16,
    is_traceroute: bool,
    meta: ReplyMeta,
) -> Option<Reply>
Expand description

Parse TCP packets into a Reply result. Only accepts packets with the RST flag set.

§Arguments

  • packet_bytes - the bytes of the packet to parse
  • sport - Source port used for outgoing packets (destination port of replies)
  • is_traceroute - If true, check for traceroute destination replies
  • meta - received packet metadata (source address, TTL, kernel receive time)

§Returns

  • Option<ResultData> - the received TCP reply

§Remarks

The function returns None if the packet is too short to contain a TCP header or if the RST flag is not set.