From 5fa2c3b3cb8fb04adb5dace900ce03e8b5a1c9b4 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 16 Mar 2020 08:41:17 +0100 Subject: record: Add zlib filter class Update #3904. --- trace/record/client.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'trace/record/client.h') diff --git a/trace/record/client.h b/trace/record/client.h index b4a0c26..62ffdb5 100644 --- a/trace/record/client.h +++ b/trace/record/client.h @@ -42,6 +42,11 @@ #include #include #include +#include + +#ifdef HAVE_ZLIB_H +#include +#endif class ErrnoException : public std::runtime_error { public: @@ -132,6 +137,25 @@ class Base64Filter : public Filter { bool DecodeChar(int c, char **target); }; +#ifdef HAVE_ZLIB_H +class ZlibFilter : public Filter { + public: + ZlibFilter(); + + ZlibFilter(const ZlibFilter&) = default; + + ZlibFilter& operator=(const ZlibFilter&) = default; + + virtual ~ZlibFilter(); + + virtual bool Run(void** buf, size_t* n); + + private: + z_stream stream_; + std::vector buffer_; +}; +#endif + class Client { public: Client() = default; -- cgit v1.2.3