Beispiel #1
0
        private static void CheckIfPacketIsCorrectReply(DHCPv6Packet request, DHCPv6Packet response)
        {
            Assert.Equal(request.Header.Source, response.Header.Destionation);
            Assert.Equal(request.Header.Destionation, response.Header.Source);

            if (response is DHCPv6RelayPacket)
            {
                Assert.IsAssignableFrom <DHCPv6RelayPacket>(response);

                Assert.Equal(DHCPv6PacketTypes.RELAY_REPL, response.PacketType);

                if (request.HasOption(DHCPv6PacketOptionTypes.InterfaceId) == true)
                {
                    var requestInterfaceIdOption = request.GetOption <DHCPv6PacketByteArrayOption>(DHCPv6PacketOptionTypes.InterfaceId);
                    Assert.True(request.HasOption(DHCPv6PacketOptionTypes.InterfaceId));
                    var responseInterfaceIdOption = response.GetOption <DHCPv6PacketByteArrayOption>(DHCPv6PacketOptionTypes.InterfaceId);

                    Assert.Equal(requestInterfaceIdOption, responseInterfaceIdOption);
                }
            }
        }