Beispiel #1
0
 /// <summary>
 /// True iff the two IPv4 layers have the same TypeOfService, Identification, Fragmentation, Ttl, Protocol, HeaderChecksum, Source, Destination and Options.
 /// </summary>
 public bool Equals(IpV6Layer other)
 {
     return(other != null &&
            TrafficClass == other.TrafficClass && FlowLabel == other.FlowLabel &&
            NextHeader == other.NextHeader && HopLimit == other.HopLimit &&
            Source == other.Source && CurrentDestination == other.CurrentDestination &&
            ExtensionHeaders.SequenceEqual(other.ExtensionHeaders));
 }
Beispiel #2
0
 /// <summary>
 /// True iff the two IPv4 layers have the same TypeOfService, Identification, Fragmentation, Ttl, Protocol, HeaderChecksum, Source, Destination and Options.
 /// </summary>
 public bool Equals(IpV6Layer other)
 {
     return other != null &&
            TrafficClass == other.TrafficClass && FlowLabel == other.FlowLabel &&
            NextHeader == other.NextHeader && HopLimit == other.HopLimit &&
            Source == other.Source && CurrentDestination == other.CurrentDestination &&
            ExtensionHeaders.SequenceEqual(other.ExtensionHeaders);
 }
Beispiel #3
0
        /// <summary>
        /// This function build an IPv6 over Ethernet with payload packet.
        /// </summary>
        private static Packet BuildIpV6Packet()
        {
            EthernetLayer ethernetLayer =
                new EthernetLayer
                {
                    Source = new MacAddress("01:01:01:01:01:01"),
                    Destination = new MacAddress("02:02:02:02:02:02"),
                    EtherType = EthernetType.None,
                };

            IpV6Layer ipV6Layer =
                new IpV6Layer
                {
                    Source = new IpV6Address("0123:4567:89AB:CDEF:0123:4567:89AB:CDEF"),
                    CurrentDestination = new IpV6Address("FEDC:BA98:7654:3210:FEDC:BA98:7654:3210"),
                    FlowLabel = 123,
                    HopLimit = 100,
                    NextHeader = IpV4Protocol.Udp,
                };

            PayloadLayer payloadLayer =
                new PayloadLayer
                {
                    Data = new Datagram(Encoding.ASCII.GetBytes("hello world")),
                };

            PacketBuilder builder = new PacketBuilder(ethernetLayer, ipV6Layer, payloadLayer);

            return builder.Build(DateTime.Now);
        }