Ejemplo n.º 1
0
        internal static int GetTotalLength(Datagram payload)
        {
            if (payload.Length <= HeaderLength)
            {
                return(payload.Length);
            }

            return(Math.Min(payload.Length, HeaderLength + payload.ReadUShort(Offset.PayloadLength, Endianity.Big)));
        }
Ejemplo n.º 2
0
        internal static int GetTotalLength(Datagram ipV4Datagram)
        {
            if (ipV4Datagram.Length < 20)
            {
                return(ipV4Datagram.Length);
            }
            ushort num = ipV4Datagram.ReadUShort(2, Endianity.Big);

            if (ipV4Datagram.Length < (int)num)
            {
                return(ipV4Datagram.Length);
            }
            return((int)num);
        }
Ejemplo n.º 3
0
        internal static int GetTotalLength(Datagram ipV4Datagram)
        {
            if (ipV4Datagram.Length < HeaderMinimumLength)
            {
                return(ipV4Datagram.Length);
            }

            ushort totalLength = ipV4Datagram.ReadUShort(Offset.TotalLength, Endianity.Big);

            if (ipV4Datagram.Length < totalLength)
            {
                return(ipV4Datagram.Length);
            }

            return(totalLength);
        }
Ejemplo n.º 4
0
        internal static int GetTotalLength(Datagram ipV4Datagram)
        {
            if (ipV4Datagram.Length < HeaderMinimumLength)
                return ipV4Datagram.Length;

            ushort totalLength = ipV4Datagram.ReadUShort(Offset.TotalLength, Endianity.Big);
            if (ipV4Datagram.Length < totalLength)
                return ipV4Datagram.Length;

            return totalLength;
        }
Ejemplo n.º 5
0
        internal static int GetTotalLength(Datagram payload)
        {
            if (payload.Length <= HeaderLength)
                return payload.Length;

            return Math.Min(payload.Length, HeaderLength + payload.ReadUShort(Offset.PayloadLength, Endianity.Big));
        }