Exemplo n.º 1
0
        public void ReadFromBitStream(ReadOnlyBitStream bitStream)
        {
            bool isBigEndian = bitStream.IsBigEndian();

            bitStream.SetBigEndian(true);

            version        = bitStream.ReadNibble();
            headerLength   = bitStream.ReadNibble();
            headerLength  *= 4;
            dsf            = bitStream.ReadByte();
            totalLength    = bitStream.ReadUInt16();
            identifier     = bitStream.ReadUInt16();
            flags          = bitStream.ReadUInt16();
            ttl            = bitStream.ReadByte();
            protocol       = bitStream.ReadByte();
            headerChecksum = bitStream.ReadUInt16();
            source         = bitStream.ReadBytes(4);
            destination    = bitStream.ReadBytes(4);

            bitStream.SetBigEndian(isBigEndian);

            if (protocol == 17)
            {
                datagram = new Datagram();
                datagram.ReadFromBitStream(bitStream);
            }
            else
            {
                bitStream.ReadBytes(totalLength - headerLength); // Skip if not UDP.
            }
        }
Exemplo n.º 2
0
        public override void ReadFromBitStream(ReadOnlyBitStream bitStream)
        {
            bool isBigEndian = bitStream.IsBigEndian();

            bitStream.SetBigEndian(false);

            ClientTimeUnix = bitStream.ReadInt64();

            bitStream.SetBigEndian(isBigEndian);
        }
Exemplo n.º 3
0
        public void ReadFromBitStream(ReadOnlyBitStream bitStream)
        {
            bool isBigEndian = bitStream.IsBigEndian();

            bitStream.SetBigEndian(true);

            sourcePort      = bitStream.ReadUInt16();
            destinationPort = bitStream.ReadUInt16();
            totalLength     = bitStream.ReadUInt16();
            checksum        = bitStream.ReadUInt16();
            data            = bitStream.ReadBytes(totalLength - 8);

            bitStream.SetBigEndian(isBigEndian);
        }