public Packet GetSendPacket(PhysicalAddress sourceMAC, IPAddress sourceIPAddress) { // EthernetPacket ePacket = new EthernetPacket(PhysicalAddress.Parse("00-E0-4C-68-02-91"), PhysicalAddress.Parse("33-33-00-01-00-02"), EthernetPacketType.IpV6); // IPv6Packet ipPacket = new IPv6Packet(IPAddress.Parse("fe80::1c66:e750:c259:df88"), IPAddress.Parse("ff02::1:2")); EthernetPacket ePacket = new EthernetPacket(sourceMAC, PhysicalAddress.Parse("33-33-00-01-00-02"), EthernetPacketType.IpV6); IPv6Packet ipPacket = new IPv6Packet(sourceIPAddress, IPAddress.Parse("ff02::1:2")); ePacket.PayloadPacket = ipPacket; UdpPacket udpPacket = new UdpPacket(SOURCE_PORT, DEST_PORT); udpPacket.PayloadData = AddOtherOptions(DhcpV6MessagePacket).Encode().getAllBytes(); udpPacket.UpdateCalculatedValues(); ipPacket.PayloadPacket = udpPacket; udpPacket.UpdateUDPChecksum(); Console.WriteLine("Send Type({0}) transactionID:{1:X} ", DhcpV6MessagePacket.GetMessageType().ToString(), DhcpV6MessagePacket.GetTransactionId()); return(ePacket); }
public override bool assertDhcpV6Message(DhcpV6Message message) { if (message != null && message.GetMessageType() == DhcpConstants.V6MESSAGE_TYPE_REPLY && message.GetTransactionId() == _expectedTransactionId) { Console.WriteLine("Got Type({0}) transactionID:{1:X} Passed, COUNT({2})", message.GetMessageType(), message.GetTransactionId(), (++count)); return(true); } return(false); }