fn recv_response<N: Network>(&self, network: &mut N, st: &mut TracerState) -> TraceResult<()> {
        let next = match self.protocol {
            TracerProtocol::Icmp => network.recv_probe_resp_icmp(self.read_timeout)?,
            TracerProtocol::Udp => network.recv_probe_resp_udp(self.read_timeout)?,
            TracerProtocol::Tcp => network.recv_probe_resp_tcp(self.read_timeout)?,
        };
        match next {
            Some(ProbeResponse::TimeExceeded(data)) => {
                let sequence = Sequence(data.sequence);
                let received = data.recv;
                let ip = data.addr;
                let trace_id = TraceId::from(data.identifier);
                if self.check_trace_id(trace_id) && st.in_round(sequence) {
                    let probe = st
                        .probe_at(sequence)
                        .with_status(ProbeStatus::Complete)
                        .with_icmp_packet_type(IcmpPacketType::TimeExceeded)
                        .with_host(ip)
                        .with_received(received);
                    st.update_probe(sequence, probe, received, false);
                }
            }
            Some(ProbeResponse::DestinationUnreachable(data)) => {
                let sequence = Sequence(data.sequence);
                let received = data.recv;
                let ip = data.addr;
                let trace_id = TraceId::from(data.identifier);
                if self.check_trace_id(trace_id) && st.in_round(sequence) {
                    let probe = st
                        .probe_at(sequence)
                        .with_status(ProbeStatus::Complete)
                        .with_icmp_packet_type(IcmpPacketType::Unreachable)
                        .with_host(ip)
                        .with_received(received);
                    st.update_probe(sequence, probe, received, true);
                }
            }
            Some(ProbeResponse::EchoReply(data)) => {
                let sequence = Sequence(data.sequence);
                let received = data.recv;
                let ip = data.addr;
                let trace_id = TraceId::from(data.identifier);
                if self.check_trace_id(trace_id) && st.in_round(sequence) {
                    let probe = st
                        .probe_at(sequence)
                        .with_status(ProbeStatus::Complete)
                        .with_icmp_packet_type(IcmpPacketType::EchoReply)
                        .with_host(ip)
                        .with_received(received);
                    st.update_probe(sequence, probe, received, true);
                }
            }
            None => {}
        }
        Ok(())
    }
/// Read and process the next incoming `ICMP` packet.
///
/// We allow multiple probes to be in-flight at any time and we cannot guaranteed that responses will be
/// received in-order.  We therefore maintain a buffer which holds details of each `Probe` which is
/// indexed by the offset of the sequence number from the sequence number at the beginning of the round.  The
/// sequence number is set in the outgoing `ICMP` `EchoRequest` (or `UDP` / `TCP`) packet and returned in both
/// the `TimeExceeded` and `EchoReply` responses.
///
/// Each incoming `ICMP` packet contains the original `ICMP` `EchoRequest` packet from which we can read the
/// `identifier` that we set which we can now validate to ensure we only process responses which correspond to
/// packets sent from this process.  For The `UDP` and `TCP` protocols, only packets destined for our src port will
/// be delivered to us by the OS and so no other `identifier` is needed and so we allow the special case value of 0.
///
/// When we process an `EchoReply` from the target host we extract the time-to-live from the corresponding
/// original `EchoRequest`.  Note that this may not be the greatest time-to-live that was sent in the round as
/// the algorithm will send `EchoRequest` wih larger time-to-live values before the `EchoReply` is received.
Read and process the next incoming `ICMP` packet.
We allow multiple probes to be in-flight at any time and we cannot guaranteed that responses will be
received in-order.  We therefore maintain a buffer which holds details of each `Probe` which is
indexed by the offset of the sequence number from the sequence number at the beginning of the round.



When we process an `EchoReply` from the target host we extract the time-to-live from the corresponding
original `EchoRequest`.  Note that this may not be the greatest time-to-live that was sent in the round as
the algorithm will send `EchoRequest` wih larger time-to-live values before the `EchoReply` is received.
Read and process the next incoming ` ICMP ` packet . We allow multiple probes to be in - flight at any time and we cannot guaranteed that responses will be received in - order . We therefore maintain a buffer which holds details of each ` Probe ` which is indexed by the offset of the sequence number from the sequence number at the beginning of the round . When we process an ` EchoReply ` from the target host we extract the time - to - live from the corresponding original ` EchoRequest ` . Note that this may not be the greatest time - to - live that was sent in the round as the algorithm will send ` EchoRequest ` wih larger time - to - live values before the ` EchoReply ` is received .
fn recv_response<N: Network>(&self, network: &mut N, st: &mut TracerState) -> TraceResult<()> {
        let next = match self.protocol {
            TracerProtocol::Icmp => network.recv_probe_resp_icmp(self.read_timeout)?,
            TracerProtocol::Udp => network.recv_probe_resp_udp(self.read_timeout)?,
            TracerProtocol::Tcp => network.recv_probe_resp_tcp(self.read_timeout)?,
        };
        match next {
            Some(ProbeResponse::TimeExceeded(data)) => {
                let sequence = Sequence(data.sequence);
                let received = data.recv;
                let ip = data.addr;
                let trace_id = TraceId::from(data.identifier);
                if self.check_trace_id(trace_id) && st.in_round(sequence) {
                    let probe = st
                        .probe_at(sequence)
                        .with_status(ProbeStatus::Complete)
                        .with_icmp_packet_type(IcmpPacketType::TimeExceeded)
                        .with_host(ip)
                        .with_received(received);
                    st.update_probe(sequence, probe, received, false);
                }
            }
            Some(ProbeResponse::DestinationUnreachable(data)) => {
                let sequence = Sequence(data.sequence);
                let received = data.recv;
                let ip = data.addr;
                let trace_id = TraceId::from(data.identifier);
                if self.check_trace_id(trace_id) && st.in_round(sequence) {
                    let probe = st
                        .probe_at(sequence)
                        .with_status(ProbeStatus::Complete)
                        .with_icmp_packet_type(IcmpPacketType::Unreachable)
                        .with_host(ip)
                        .with_received(received);
                    st.update_probe(sequence, probe, received, true);
                }
            }
            Some(ProbeResponse::EchoReply(data)) => {
                let sequence = Sequence(data.sequence);
                let received = data.recv;
                let ip = data.addr;
                let trace_id = TraceId::from(data.identifier);
                if self.check_trace_id(trace_id) && st.in_round(sequence) {
                    let probe = st
                        .probe_at(sequence)
                        .with_status(ProbeStatus::Complete)
                        .with_icmp_packet_type(IcmpPacketType::EchoReply)
                        .with_host(ip)
                        .with_received(received);
                    st.update_probe(sequence, probe, received, true);
                }
            }
            None => {}
        }
        Ok(())
    }
fn recv_response < N : Network > ( & self , network : & mut N , st : & mut TracerState ) -> TraceResult < ( ) > { let next = match self . protocol { TracerProtocol :: Icmp => network . recv_probe_resp_icmp ( self . read_timeout ) ? , TracerProtocol :: Udp => network . recv_probe_resp_udp ( self . read_timeout ) ? , TracerProtocol :: Tcp => network . recv_probe_resp_tcp ( self . read_timeout ) ? , } ; match next { Some ( ProbeResponse :: TimeExceeded ( data ) ) => { let sequence = Sequence ( data . sequence ) ; let received = data . recv ; let ip = data . addr ; let trace_id = TraceId :: from ( data . identifier ) ; if self . check_trace_id ( trace_id ) && st . in_round ( sequence ) { let probe = st . probe_at ( sequence ) . with_status ( ProbeStatus :: Complete ) . with_icmp_packet_type ( IcmpPacketType :: TimeExceeded ) . with_host ( ip ) . with_received ( received ) ; st . update_probe ( sequence , probe , received , false ) ; } } Some ( ProbeResponse :: DestinationUnreachable ( data ) ) => { let sequence = Sequence ( data . sequence ) ; let received = data . recv ; let ip = data . addr ; let trace_id = TraceId :: from ( data . identifier ) ; if self . check_trace_id ( trace_id ) && st . in_round ( sequence ) { let probe = st . probe_at ( sequence ) . with_status ( ProbeStatus :: Complete ) . with_icmp_packet_type ( IcmpPacketType :: Unreachable ) . with_host ( ip ) . with_received ( received ) ; st . update_probe ( sequence , probe , received , true ) ; } } Some ( ProbeResponse :: EchoReply ( data ) ) => { let sequence = Sequence ( data . sequence ) ; let received = data . recv ; let ip = data . addr ; let trace_id = TraceId :: from ( data . identifier ) ; if self . check_trace_id ( trace_id ) && st . in_round ( sequence ) { let probe = st . probe_at ( sequence ) . with_status ( ProbeStatus :: Complete ) . with_icmp_packet_type ( IcmpPacketType :: EchoReply ) . with_host ( ip ) . with_received ( received ) ; st . update_probe ( sequence , probe , received , true ) ; } } None => { } } Ok ( ( ) ) }
Read and process the next incoming `ICMP` packet.
Read and process the next incoming ` ICMP ` packet .
&self
network
&mut N
st
&mut TracerState