public static AuthenticationMoreDataPayload Create(PayloadData payload) { var reader = new ByteArrayReader(payload.ArraySegment); reader.ReadByte(Signature); return(new AuthenticationMoreDataPayload(reader.ReadByteArray(reader.BytesRemaining))); }
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); }
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)); }
public virtual async Task ReadPropertyValue(ByteArrayReader reader, int size, DomainHeader header) { DataReader = await reader.ReadByteArray(size); }
public async Task ReadCompressedChunkBlockData(ByteArrayReader reader) { CompressedData = await reader.ReadByteArray(CompressedSize); }