示例#1
0
 Option IOptionComplexFactory.CreateInstance(byte[] buffer, ref int offset, byte valueLength)
 {
     if ((int)valueLength != 8)
     {
         return((Option)null);
     }
     return((Option) new TcpOptionTimestamp(ByteArrayExtensions.ReadUInt(buffer, ref offset, Endianity.Big), ByteArrayExtensions.ReadUInt(buffer, ref offset, Endianity.Big)));
 }
示例#2
0
 protected static bool TryRead(out uint connectionCount, byte[] buffer, ref int offset, byte valueLength)
 {
     if ((int)valueLength != 4)
     {
         connectionCount = 0U;
         return(false);
     }
     connectionCount = ByteArrayExtensions.ReadUInt(buffer, ref offset, Endianity.Big);
     return(true);
 }
        Option IOptionComplexFactory.CreateInstance(byte[] buffer, ref int offset, byte valueLength)
        {
            if ((int)valueLength < 0 || (int)valueLength % 8 != 0)
            {
                return((Option)null);
            }
            int length = (int)valueLength / 8;

            TcpOptionSelectiveAcknowledgmentBlock[] acknowledgmentBlockArray = new TcpOptionSelectiveAcknowledgmentBlock[length];
            for (int index = 0; index != length; ++index)
            {
                acknowledgmentBlockArray[index] = new TcpOptionSelectiveAcknowledgmentBlock(ByteArrayExtensions.ReadUInt(buffer, ref offset, Endianity.Big), ByteArrayExtensions.ReadUInt(buffer, ref offset, Endianity.Big));
            }
            return((Option) new TcpOptionSelectiveAcknowledgment((IList <TcpOptionSelectiveAcknowledgmentBlock>)acknowledgmentBlockArray));
        }
        Option IOptionComplexFactory.CreateInstance(byte[] buffer, ref int offset, byte valueLength)
        {
            if ((int)valueLength != 6)
            {
                return((Option)null);
            }
            byte num = buffer[offset++];

            return((Option) new IpV4OptionQuickStart((IpV4OptionQuickStartFunction)((uint)num & 240U), (byte)((uint)num & 15U), buffer[offset++], ByteArrayExtensions.ReadUInt(buffer, ref offset, Endianity.Big)));
        }