コード例 #1
0
        public static AuthenticationMoreDataPayload Create(PayloadData payload)
        {
            var reader = new ByteArrayReader(payload.ArraySegment);

            reader.ReadByte(Signature);
            return(new AuthenticationMoreDataPayload(reader.ReadByteArray(reader.BytesRemaining)));
        }
コード例 #2
0
        public async Task <int> BuildCompressedChunkHeader(ByteArrayReader reader, uint flags)
        {
            Signature = Signatures.Signature;
            BlockSize = 0x00020000;

            CompressedSize   = 0;
            UncompressedSize = reader.Remaining;

            int blockCount = (reader.Remaining + BlockSize - 1) / BlockSize;

            int builderSize = 0;

            Blocks.Clear();

            for (int i = 0; i < blockCount; ++i)
            {
                DomainCompressedChunkBlock block = new DomainCompressedChunkBlock();

                ByteArrayReader uncompressed = await reader.ReadByteArray(Math.Min(BlockSize, reader.Remaining));

                builderSize += await block.BuildCompressedChunkBlockData(uncompressed);

                CompressedSize += block.CompressedSize;

                Blocks.Add(block);
            }

            builderSize += sizeof(uint)
                           + sizeof(int) * 3;

            return(builderSize);
        }
コード例 #3
0
        public static AuthenticationMethodSwitchRequestPayload Create(PayloadData payload)
        {
            var reader = new ByteArrayReader(payload.ArraySegment);

            reader.ReadByte(Signature);
            string name;

            byte[] data;
            if (payload.ArraySegment.Count == 1)
            {
                // if the packet is just the header byte (0xFE), it's an "Old Authentication Method Switch Request Packet"
                // (possibly sent by a server that doesn't support CLIENT_PLUGIN_AUTH)
                name = "mysql_old_password";
                data = new byte[0];
            }
            else
            {
                name = Encoding.UTF8.GetString(reader.ReadNullTerminatedByteString());
                data = reader.ReadByteArray(reader.BytesRemaining);
            }
            return(new AuthenticationMethodSwitchRequestPayload(name, data));
        }
コード例 #4
0
 public virtual async Task ReadPropertyValue(ByteArrayReader reader, int size, DomainHeader header)
 {
     DataReader = await reader.ReadByteArray(size);
 }
コード例 #5
0
 public async Task ReadCompressedChunkBlockData(ByteArrayReader reader)
 {
     CompressedData = await reader.ReadByteArray(CompressedSize);
 }