private IPAddress getDestinationIPFromRawPacketData(ref byte[] data, EthernetPacketType ethernet_packet_type) { int offset = (ethernet_packet_type == EthernetPacketType.Arp) ? ARP_HEADER_DESTINATION_OFFSET : IP_HEADER_DESTINATION_OFFSET; return(IpPacket.GetIPAddress(System.Net.Sockets.AddressFamily.InterNetwork, offset, data)); }