public static Ipv4Header Create(byte[] ipv4Packet, ref int bytesCopied)
        {
            var ipv4Header = new Ipv4Header();

            if (ipv4Packet.Length < Ipv4HeaderLength)
            {
                return(null);
            }

            ipv4Header.Version       = (byte)((ipv4Packet[0] >> 4) & 0xF);
            ipv4Header.ipLength      = (byte)(ipv4Packet[0] & 0xF);
            ipv4Header.TypeOfService = ipv4Packet[1];
            ipv4Header.ipTotalLength = BitConverter.ToUInt16(ipv4Packet, 2);
            ipv4Header.ipId          = BitConverter.ToUInt16(ipv4Packet, 4);
            ipv4Header.ipOffset      = BitConverter.ToUInt16(ipv4Packet, 6);
            ipv4Header.Ttl           = ipv4Packet[8];
            ipv4Header.Protocol      = ipv4Packet[9];
            ipv4Header.ipChecksum    = BitConverter.ToUInt16(ipv4Packet, 10);

            ipv4Header.SourceAddress      = new IPAddress(BitConverter.ToUInt32(ipv4Packet, 12));
            ipv4Header.DestinationAddress = new IPAddress(BitConverter.ToUInt32(ipv4Packet, 16));

            bytesCopied = ipv4Header.Length;

            return(ipv4Header);
        }
        public UdpHeader()
        {
            srcPort     = 0;
            destPort    = 0;
            udpLength   = 0;
            udpChecksum = 0;

            Ipv6PacketHeader = null;
            Ipv4PacketHeader = null;
        }