public void PingCompleate(object sender, PingCompletedEventArgs e) { Log_Verb("Ping Complete"); PingData seq = (PingData)e.UserState; PingReply rep = e.Reply; Ping ping = (Ping)sender; lock (sentry) { pings.Remove(ping); ping.Dispose(); switch (rep.Status) { case IPStatus.Success: ICMP retICMP = new ICMP(seq.Data); retICMP.HeaderData = seq.HeaderData; retICMP.Type = 0; //echo reply recvBuff.Add(retICMP); break; default: //ping failed open -= 1; if (open == 0) { RaiseEventConnectionClosed(); } break; } } }
public IPPacket(ICMP icmpkt) { if ((icmpkt.Data[0] & 0xF0) == (4 << 4)) { ReadBuffer(icmpkt.Data, 0, icmpkt.Data.Length, true); } else { //RE Outbreak creates malformed ICMP packets //the data in them is usable, but it's in the //wrong place, search for it. //This issue occurs on real hardware, so it's //not an emulation issue. Log_Error("Malformed ICMP Packet"); int off = 1; while ((icmpkt.Data[off] & 0xF0) != (4 << 4)) { off += 1; } Log_Error("Payload delayed " + off + " bytes"); ReadBuffer(icmpkt.Data, off, icmpkt.Data.Length, true); } }
public IPPacket(ICMP icmpkt) { ReadBuffer(icmpkt.Data, 0, icmpkt.Data.Length); }