private void ev_echo_reply(easy_socket.icmp.icmp_echo_reply sender, easy_socket.icmp.EventArgs_ipv4header_ReceiveData e)
        {
            int old_time = (int)((sender.identifier << 16) + sender.sequence_number);

            // if echo reply was not one of our
            if (!this.check_identifier(old_time))
            {
                return;
            }
            // else comput time needed
            int time = System.Environment.TickCount;

            time -= old_time;
            if (time == 0)
            {
                time = 1;
            }
            this.textBox_telnet_add(e.ipv4header.SourceAddress + " reply in time<" +
                                    time.ToString() + " ms\r\n");
            // in case of broadcast wait time out before sending another ping
            // else
            if (!this.checkBox_may_broadcast.Checked)
            {
                this.icmp_server.clear_wait_timeout();
                this.send_if_necessary();// send echo
            }
        }
        private void ev_echo_reply(easy_socket.icmp.icmp_echo_reply sender, easy_socket.icmp.EventArgs_ipv4header_ReceiveData e)
        {
            int old_time = (int)((sender.identifier << 16) + sender.sequence_number);

            // if echo reply was not one of our
            if (!this.check_identifier(old_time))
            {
                return;
            }
            this.icmp_server.clear_wait_timeout();
            // else comput time needed
            int time = System.Environment.TickCount;

            time -= old_time;
            if (time == 0)
            {
                time = 1;
            }
            this.textBox_telnet_add(e.ipv4header.SourceAddress + " reply in time<" +
                                    time.ToString() + " ms\r\n");
            if (this.checkBox_icmp_resolve_adresses.Checked)
            {
                this.dns_resolve(e.ipv4header.SourceAddress);
            }

            // we stop trace is finished
            this.allow_user_interface(true);
            this.icmp_server.stop();
        }
 private void ev_source_quench(easy_socket.icmp.icmp_source_quench sender, easy_socket.icmp.EventArgs_ipv4header_ReceiveData e)
 {
     if (!this.check_if_one_of_our_packets(sender.ih_and_original_dd))
     {
         return;
     }
     this.textBox_telnet_add("Icmp source quench message from: " +
                             e.ipv4header.SourceAddress + "\r\n");
     // we stop
     this.allow_user_interface(true);
     this.icmp_server.stop();
 }
 private void ev_source_quench(easy_socket.icmp.icmp_source_quench sender, easy_socket.icmp.EventArgs_ipv4header_ReceiveData e)
 {
     if (!this.check_if_one_of_our_packets(sender.ih_and_original_dd))
     {
         return;
     }
     this.textBox_telnet_add("Icmp source quench message from: " +
                             e.ipv4header.SourceAddress + "\r\n");
     // in case of broadcast wait time out before sending another ping
     if (!this.checkBox_may_broadcast.Checked)
     {
         this.send_if_necessary();
     }
 }
 private void ev_destination_unreachable(easy_socket.icmp.icmp_destination_unreachable sender, easy_socket.icmp.EventArgs_ipv4header_ReceiveData e)
 {
     if (!this.check_if_one_of_our_packets(sender.ih_and_original_dd))
     {
         return;
     }
     easy_socket.ip_header.ipv4_header initial_iph = new easy_socket.ip_header.ipv4_header();
     initial_iph.decode(sender.ih_and_original_dd);// may return the error error_datagram_not_complete but decode at least ip header
     this.textBox_telnet_add("Icmp destination unreachable from: " +
                             e.ipv4header.SourceAddress +
                             " for destination: " + initial_iph.DestinationAddress + "\r\n");
     // in case of broadcast wait time out before sending another ping
     if (!this.checkBox_may_broadcast.Checked)
     {
         this.send_if_necessary();
     }
 }
 private void ev_time_exceeded(easy_socket.icmp.icmp_time_exceeded_message sender, easy_socket.icmp.EventArgs_ipv4header_ReceiveData e)
 {
     if (!this.check_if_one_of_our_packets(sender.ih_and_original_dd))
     {
         return;
     }
     easy_socket.ip_header.ipv4_header initial_iph = new easy_socket.ip_header.ipv4_header();
     initial_iph.decode(sender.ih_and_original_dd);// may return the error error_datagram_not_complete but try to decode at least ip header
     this.textBox_telnet_add("Icmp time exceeded message from: " + e.ipv4header.SourceAddress + " for ip: " +
                             initial_iph.DestinationAddress +
                             " (packet ttl: " +
                             initial_iph.time_to_live.ToString()
                             + ")\r\n");
     // in case of broadcast wait time out before sending another ping
     if (!this.checkBox_may_broadcast.Checked)
     {
         this.send_if_necessary();
     }
 }
 private void ev_destination_unreachable(easy_socket.icmp.icmp_destination_unreachable sender, easy_socket.icmp.EventArgs_ipv4header_ReceiveData e)
 {
     if (!this.check_if_one_of_our_packets(sender.ih_and_original_dd))
     {
         return;
     }
     easy_socket.ip_header.ipv4_header initial_iph = new easy_socket.ip_header.ipv4_header();
     initial_iph.decode(sender.ih_and_original_dd);// may return the error error_datagram_not_complete but decode at least ip header
     this.textBox_telnet_add("Icmp destination unreachable from: " +
                             e.ipv4header.SourceAddress +
                             " for destination: " + initial_iph.DestinationAddress + "\r\n");
     // we stop
     this.allow_user_interface(true);
     this.icmp_server.stop();
 }
 private void ev_time_exceeded(easy_socket.icmp.icmp_time_exceeded_message sender, easy_socket.icmp.EventArgs_ipv4header_ReceiveData e)
 {
     if (!this.check_if_one_of_our_packets(sender.ih_and_original_dd))
     {
         return;
     }
     this.icmp_server.clear_wait_timeout();
     easy_socket.ip_header.ipv4_header initial_iph = new easy_socket.ip_header.ipv4_header();
     initial_iph.decode(sender.ih_and_original_dd);// may return the error error_datagram_not_complete but try to decode at least ip header
     this.textBox_telnet_add("Icmp time exceeded message from: " + e.ipv4header.SourceAddress + " for ip: " +
                             initial_iph.DestinationAddress +
                             " (packet ttl: " +
                             initial_iph.time_to_live.ToString()
                             + ")\r\n");
     this.textBox_telnet_add("Initial TTL:" + (this.b_current_hop - 1) + "\r\n");//this.b_current_hop has already been increased
     if (this.checkBox_icmp_resolve_adresses.Checked)
     {
         this.dns_resolve(e.ipv4header.SourceAddress);
     }
     this.send_if_necessary();
 }