24 lines
643 B
C++
24 lines
643 B
C++
#pragma once
|
|
|
|
// QuickLZ level-1 decompression, used to inflate compressed command packets.
|
|
// Clients send commands uncompressed, so only decompression is needed.
|
|
// Ported from ts6-manager tslib/quicklz.ts (itself from TSLib QuickerLz.cs).
|
|
|
|
#include <cstdint>
|
|
#include <span>
|
|
#include <vector>
|
|
|
|
namespace Echoion::Protocol
|
|
{
|
|
|
|
using Bytes = std::vector<uint8_t>;
|
|
using ByteView = std::span<const uint8_t>;
|
|
|
|
uint32_t qlzDecompressedSize(ByteView data);
|
|
uint32_t qlzCompressedSize(ByteView data);
|
|
|
|
// Throws std::runtime_error on malformed input or unsupported level.
|
|
Bytes qlzDecompress(ByteView data);
|
|
|
|
} // namespace Echoion::Protocol
|