private void ICMPHandler(ref byte[] PacketData) { ICMPData ICMP = new ICMPData(); IPHandler(ICMP, ref PacketData); byte[] p_ICMPData = new byte[PacketData.Length - ICMP.IP_IHL]; Buffer.BlockCopy(PacketData, ICMP.IP_IHL, p_ICMPData, 0, p_ICMPData.Length); ICMP.ICMP_Type = p_ICMPData[0]; ICMP.ICMP_Code = p_ICMPData[1]; ICMP.ICMP_Checksum = (ushort)BitConverter.ToInt16(p_ICMPData, 2); if (!((ICMP.IP_TotalLength - (ICMP.IP_IHL + 4)) <= 0)) { byte[] p_DataSend = new byte[ICMP.IP_TotalLength - 4]; Buffer.BlockCopy(p_ICMPData, 4, p_DataSend, 0, p_DataSend.Length); ICMP.PacketDataCreate(ref p_DataSend); PRE.fire(ICMP); } else { return; } }
private void ICMPHandler(ref byte[] PacketData) { ICMPData ICMP = new ICMPData(); IPHandler(ICMP, ref PacketData); byte[] p_ICMPData = new byte[PacketData.Length - ICMP.IP_IHL]; Buffer.BlockCopy(PacketData, ICMP.IP_IHL, p_ICMPData, 0, p_ICMPData.Length); ICMP.ICMP_Type = p_ICMPData[0]; ICMP.ICMP_Code = p_ICMPData[1]; ICMP.ICMP_Checksum = (ushort) BitConverter.ToInt16(p_ICMPData, 2); if (!((ICMP.IP_TotalLength - (ICMP.IP_IHL + 4)) <= 0)) { byte[] p_DataSend = new byte[ICMP.IP_TotalLength - 4]; Buffer.BlockCopy(p_ICMPData, 4, p_DataSend, 0, p_DataSend.Length); ICMP.PacketDataCreate(ref p_DataSend); PRE.fire(ICMP); }else return; }