Ed Tanous | b253906 | 2024-03-12 16:58:35 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: Apache-2.0 |
| 2 | // SPDX-FileCopyrightText: Copyright OpenBMC Authors |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #ifdef HAVE_ZSTD |
| 7 | #include <zstd.h> |
| 8 | #endif |
| 9 | |
| 10 | #include <boost/asio/buffer.hpp> |
| 11 | #include <boost/beast/core/flat_buffer.hpp> |
| 12 | |
| 13 | #include <optional> |
| 14 | |
| 15 | class ZstdDecompressor |
| 16 | { |
| 17 | boost::beast::flat_buffer compressionBuf; |
| 18 | |
| 19 | #ifdef HAVE_ZSTD |
| 20 | ZSTD_DCtx* dctx; |
| 21 | #endif |
| 22 | |
| 23 | public: |
| 24 | ZstdDecompressor(const ZstdDecompressor&) = delete; |
| 25 | ZstdDecompressor(ZstdDecompressor&&) = delete; |
| 26 | ZstdDecompressor& operator=(const ZstdDecompressor&) = delete; |
| 27 | ZstdDecompressor& operator=(ZstdDecompressor&&) = delete; |
| 28 | |
| 29 | ZstdDecompressor(); |
| 30 | std::optional<boost::asio::const_buffer> decompress( |
| 31 | boost::asio::const_buffer buffIn); |
| 32 | ~ZstdDecompressor(); |
| 33 | }; |