summaryrefslogtreecommitdiffstats
path: root/libmariadb/include/ma_compress.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
commit3f619478f796eddbba6e39502fe941b285dd97b1 (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /libmariadb/include/ma_compress.h
parentInitial commit. (diff)
downloadmariadb-upstream.tar.xz
mariadb-upstream.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libmariadb/include/ma_compress.h')
-rw-r--r--libmariadb/include/ma_compress.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/libmariadb/include/ma_compress.h b/libmariadb/include/ma_compress.h
new file mode 100644
index 00000000..a1467452
--- /dev/null
+++ b/libmariadb/include/ma_compress.h
@@ -0,0 +1,48 @@
+/************************************************************************************
+ Copyright (C) 2022 MariaDB Corporation AB
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not see <http://www.gnu.org/licenses>
+ or write to the Free Software Foundation, Inc.,
+ 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
+
+*************************************************************************************/
+#ifndef __ma_compress_h__
+
+#include <ma_sys.h>
+
+#define COMPRESSION_LEVEL_DEFAULT INT_MAX
+
+#define compression_plugin(net) (net)->extension->compression_plugin
+#define compression_ctx(net) (net)->extension->compression_ctx
+
+typedef struct {
+ void *compress_ctx;
+ void *decompress_ctx;
+ int compression_level;
+ void *extra; /* reserved */
+} ma_compress_ctx;
+
+enum enum_ma_compression_algorithm {
+ COMPRESSION_NONE= 0,
+ COMPRESSION_ZLIB,
+ COMPRESSION_ZSTD,
+ COMPRESSION_UNKNOWN
+};
+
+const char *_mariadb_compression_algorithm_str(enum enum_ma_compression_algorithm algorithm);
+my_bool _mariadb_compress(NET *net, unsigned char *, size_t *, size_t *);
+my_bool _mariadb_uncompress(NET *net, unsigned char *, size_t *, size_t *);
+unsigned char *_mariadb_compress_alloc(NET *net, const unsigned char *packet, size_t *len, size_t *complen);
+
+#endif