/// <summary> /// Create packet that would be replied to by this listener if correctly injected /// </summary> /// <param name="data"></param> /// <returns></returns> public Packet GetReceivablePacket(byte[] data) { var ipBytes = LocalIp.GetAddressBytes(); ipBytes[3]++; var fakeIp = new IPAddress(ipBytes); var fakeMac = PhysicalAddress.Parse("001122334455"); var eth = new EthernetPacket(fakeMac, BroadcastMac, EthernetType.IPv6); var ip = new IPv4Packet(fakeIp, LocalIp); var udp = new UdpPacket(Port, Port); eth.PayloadPacket = ip; ip.PayloadPacket = udp; udp.PayloadData = data; udp.UpdateCalculatedValues(); ip.UpdateCalculatedValues(); udp.UpdateUdpChecksum(); ip.UpdateIPChecksum(); return(eth); }