예제 #1
0
        public void Set()
        {
            var ipv4Packet = new IPv4Packet
            {
                Bytes = new Byte[32]
            };

            ipv4Packet.FlagMF = true;
            ipv4Packet.GetByte(6).Should().Be(0b_0010_0000);

            ipv4Packet.FlagMF = false;
            ipv4Packet.GetByte(6).Should().Be(0b_0000_0000);
        }
예제 #2
0
        public void Set()
        {
            var ipv4Packet = new IPv4Packet
            {
                Bytes = new Byte[40]
            };

            ipv4Packet.SetByte(6, 0b_1010_0000);
            ipv4Packet.FragmentOffset = 0b_1_1011_0101_1011;

            ipv4Packet.GetByte(6).Should().Be(0b_1011_1011);
            ipv4Packet.GetByte(7).Should().Be(0b_0101_1011);
        }
        public void Set()
        {
            var ipv4Packet = new IPv4Packet
            {
                Bytes = new Byte[40]
            };

            ipv4Packet.SetByte(1, 0b_0101_1011);
            ipv4Packet.DSCP = 0b_1101_1010;

            ipv4Packet.GetByte(1).Should().Be(0b_01_1010_11);
        }
        public void Set(Byte expected, IPPacketType input)
        {
            var ipv4Packet = new IPv4Packet
            {
                Bytes = new Byte[32]
            };

            ipv4Packet.Type = input;

            ipv4Packet.GetByte(9).Should().Be(expected);
            ipv4Packet.Type.Should().Be(input);
        }
        public void Set(Byte input)
        {
            var ipv4Packet = new IPv4Packet
            {
                Bytes = new Byte[32]
            };

            ipv4Packet.SetByte(0, 0x05);

            ipv4Packet.Version = (IPVersion)input;

            ipv4Packet.GetByte(0).Should().Be(0x45);
            ipv4Packet.Version.Should().Be(IPVersion.IPv4);
            ipv4Packet.HeaderLength.Should().Be(5);
        }