diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:24:36 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:24:36 +0000 |
commit | 06eaf7232e9a920468c0f8d74dcf2fe8b555501c (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /include/providers | |
parent | Initial commit. (diff) | |
download | mariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.tar.xz mariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/providers')
-rw-r--r-- | include/providers/bzlib.h | 126 | ||||
-rw-r--r-- | include/providers/lz4.h | 63 | ||||
-rw-r--r-- | include/providers/lzma.h | 102 | ||||
-rw-r--r-- | include/providers/lzo/lzo1x.h | 62 | ||||
-rw-r--r-- | include/providers/snappy-c.h | 75 |
5 files changed, 428 insertions, 0 deletions
diff --git a/include/providers/bzlib.h b/include/providers/bzlib.h new file mode 100644 index 00000000..b48c940b --- /dev/null +++ b/include/providers/bzlib.h @@ -0,0 +1,126 @@ +/** + @file bzlib.h + This service provides dynamic access to BZip2. +*/ + +#ifndef BZIP2_INCLUDED +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef MYSQL_ABI_CHECK +#include <stdbool.h> +#endif + +#ifndef MYSQL_DYNAMIC_PLUGIN +#define provider_service_bzip2 provider_service_bzip2_static +#endif + +#ifndef BZ_RUN +#define BZ_RUN 0 +#define BZ_FINISH 2 + +#define BZ_OK 0 +#define BZ_RUN_OK 1 +#define BZ_FINISH_OK 3 +#define BZ_STREAM_END 4 + +typedef struct +{ + char *next_in; + unsigned int avail_in; + unsigned int total_in_lo32; + unsigned int total_in_hi32; + + char *next_out; + unsigned int avail_out; + unsigned int total_out_lo32; + unsigned int total_out_hi32; + + void *state; + + void *(*bzalloc)(void *, int, int); + void (*bzfree)(void *, void *); + void *opaque; +} bz_stream; + +#define BZ2_bzBuffToBuffCompress(...) provider_service_bzip2->BZ2_bzBuffToBuffCompress_ptr (__VA_ARGS__) +#define BZ2_bzBuffToBuffDecompress(...) provider_service_bzip2->BZ2_bzBuffToBuffDecompress_ptr (__VA_ARGS__) +#define BZ2_bzCompress(...) provider_service_bzip2->BZ2_bzCompress_ptr (__VA_ARGS__) +#define BZ2_bzCompressEnd(...) provider_service_bzip2->BZ2_bzCompressEnd_ptr (__VA_ARGS__) +#define BZ2_bzCompressInit(...) provider_service_bzip2->BZ2_bzCompressInit_ptr (__VA_ARGS__) +#define BZ2_bzDecompress(...) provider_service_bzip2->BZ2_bzDecompress_ptr (__VA_ARGS__) +#define BZ2_bzDecompressEnd(...) provider_service_bzip2->BZ2_bzDecompressEnd_ptr (__VA_ARGS__) +#define BZ2_bzDecompressInit(...) provider_service_bzip2->BZ2_bzDecompressInit_ptr (__VA_ARGS__) +#endif + +#define DEFINE_BZ2_bzBuffToBuffCompress(NAME) NAME( \ + char *dest, \ + unsigned int *destLen, \ + char *source, \ + unsigned int sourceLen, \ + int blockSize100k, \ + int verbosity, \ + int workFactor \ +) + +#define DEFINE_BZ2_bzBuffToBuffDecompress(NAME) NAME( \ + char *dest, \ + unsigned int *destLen, \ + char *source, \ + unsigned int sourceLen, \ + int small, \ + int verbosity \ +) + +#define DEFINE_BZ2_bzCompress(NAME) NAME( \ + bz_stream *strm, \ + int action \ +) + +#define DEFINE_BZ2_bzCompressEnd(NAME) NAME( \ + bz_stream *strm \ +) + +#define DEFINE_BZ2_bzCompressInit(NAME) NAME( \ + bz_stream *strm, \ + int blockSize100k, \ + int verbosity, \ + int workFactor \ +) + +#define DEFINE_BZ2_bzDecompress(NAME) NAME( \ + bz_stream *strm \ +) + +#define DEFINE_BZ2_bzDecompressEnd(NAME) NAME( \ + bz_stream *strm \ +) + +#define DEFINE_BZ2_bzDecompressInit(NAME) NAME( \ + bz_stream *strm, \ + int verbosity, \ + int small \ +) + +struct provider_service_bzip2_st{ + int DEFINE_BZ2_bzBuffToBuffCompress((*BZ2_bzBuffToBuffCompress_ptr)); + int DEFINE_BZ2_bzBuffToBuffDecompress((*BZ2_bzBuffToBuffDecompress_ptr)); + int DEFINE_BZ2_bzCompress((*BZ2_bzCompress_ptr)); + int DEFINE_BZ2_bzCompressEnd((*BZ2_bzCompressEnd_ptr)); + int DEFINE_BZ2_bzCompressInit((*BZ2_bzCompressInit_ptr)); + int DEFINE_BZ2_bzDecompress((*BZ2_bzDecompress_ptr)); + int DEFINE_BZ2_bzDecompressEnd((*BZ2_bzDecompressEnd_ptr)); + int DEFINE_BZ2_bzDecompressInit((*BZ2_bzDecompressInit_ptr)); + + bool is_loaded; +}; + +extern struct provider_service_bzip2_st *provider_service_bzip2; + +#ifdef __cplusplus +} +#endif + +#define BZIP2_INCLUDED +#endif diff --git a/include/providers/lz4.h b/include/providers/lz4.h new file mode 100644 index 00000000..4ac6b2c8 --- /dev/null +++ b/include/providers/lz4.h @@ -0,0 +1,63 @@ +/** + @file lz4.h + This service provides dynamic access to LZ4. +*/ + +#ifndef LZ4_INCLUDED +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef MYSQL_ABI_CHECK +#include <stdbool.h> +#include <stddef.h> +#include <stdint.h> +#endif + +#ifndef MYSQL_DYNAMIC_PLUGIN +#define provider_service_lz4 provider_service_lz4_static +#endif + +#ifndef LZ4_VERSION_NUMBER +#define LZ4_MAX_INPUT_SIZE 0x7E000000 + +#define LZ4_compressBound(...) provider_service_lz4->LZ4_compressBound_ptr (__VA_ARGS__) +#define LZ4_compress_default(...) provider_service_lz4->LZ4_compress_default_ptr (__VA_ARGS__) +#define LZ4_decompress_safe(...) provider_service_lz4->LZ4_decompress_safe_ptr (__VA_ARGS__) +#endif + +#define DEFINE_LZ4_compressBound(NAME) NAME( \ + int inputSize \ +) + +#define DEFINE_LZ4_compress_default(NAME) NAME( \ + const char *src, \ + char *dst, \ + int srcSize, \ + int dstCapacity \ +) + +#define DEFINE_LZ4_decompress_safe(NAME) NAME( \ + const char *src, \ + char *dst, \ + int compressedSize, \ + int dstCapacity \ +) + +struct provider_service_lz4_st +{ + int DEFINE_LZ4_compressBound((*LZ4_compressBound_ptr)); + int DEFINE_LZ4_compress_default((*LZ4_compress_default_ptr)); + int DEFINE_LZ4_decompress_safe((*LZ4_decompress_safe_ptr)); + + bool is_loaded; +}; + +extern struct provider_service_lz4_st *provider_service_lz4; + +#ifdef __cplusplus +} +#endif + +#define LZ4_INCLUDED +#endif diff --git a/include/providers/lzma.h b/include/providers/lzma.h new file mode 100644 index 00000000..8125bb8c --- /dev/null +++ b/include/providers/lzma.h @@ -0,0 +1,102 @@ +/** + @file lzma.h + This service provides dynamic access to LZMA. +*/ + +#ifndef LZMA_INCLUDED +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef MYSQL_ABI_CHECK +#include <stdbool.h> +#include <stdint.h> +#include <stddef.h> +#endif + +#ifndef MYSQL_DYNAMIC_PLUGIN +#define provider_service_lzma provider_service_lzma_static +#endif + +#ifndef LZMA_VERSION +typedef enum +{ + LZMA_OK = 0, + LZMA_STREAM_END = 1, + LZMA_NO_CHECK = 2, + LZMA_UNSUPPORTED_CHECK = 3, + LZMA_GET_CHECK = 4, + LZMA_MEM_ERROR = 5, + LZMA_MEMLIMIT_ERROR = 6, + LZMA_FORMAT_ERROR = 7, + LZMA_OPTIONS_ERROR = 8, + LZMA_DATA_ERROR = 9, + LZMA_BUF_ERROR = 10, + LZMA_PROG_ERROR = 11, +} lzma_ret; + +typedef struct +{ + void *(*alloc)(void *opaque, size_t nmemb, size_t size); + void (*free)(void *opaque, void *ptr); + void *opaque; +} lzma_allocator; + +typedef enum +{ + LZMA_CHECK_NONE = 0, + LZMA_CHECK_CRC32 = 1, + LZMA_CHECK_CRC64 = 4, + LZMA_CHECK_SHA256 = 10 +} lzma_check; + +#define lzma_stream_buffer_decode(...) provider_service_lzma->lzma_stream_buffer_decode_ptr (__VA_ARGS__) +#define lzma_easy_buffer_encode(...) provider_service_lzma->lzma_easy_buffer_encode_ptr (__VA_ARGS__) +#elif LZMA_VERSION < 50010030 +#define lzma_maybe_const +#endif + +#ifndef lzma_maybe_const +#define lzma_maybe_const const +#endif + +#define DEFINE_lzma_stream_buffer_decode(NAME) NAME( \ + uint64_t *memlimit, \ + uint32_t flags, \ + lzma_maybe_const lzma_allocator *allocator, \ + const uint8_t *in, \ + size_t *in_pos, \ + size_t in_size, \ + uint8_t *out, \ + size_t *out_pos, \ + size_t out_size \ +) + +#define DEFINE_lzma_easy_buffer_encode(NAME) NAME( \ + uint32_t preset, \ + lzma_check check, \ + lzma_maybe_const lzma_allocator *allocator, \ + const uint8_t *in, \ + size_t in_size, \ + uint8_t *out, \ + size_t *out_pos, \ + size_t out_size \ +) + +struct provider_service_lzma_st +{ + lzma_ret DEFINE_lzma_stream_buffer_decode((*lzma_stream_buffer_decode_ptr)); + lzma_ret DEFINE_lzma_easy_buffer_encode((*lzma_easy_buffer_encode_ptr)); + + bool is_loaded; +}; + +extern struct provider_service_lzma_st *provider_service_lzma; + + +#ifdef __cplusplus +} +#endif + +#define LZMA_INCLUDED +#endif diff --git a/include/providers/lzo/lzo1x.h b/include/providers/lzo/lzo1x.h new file mode 100644 index 00000000..93d1461f --- /dev/null +++ b/include/providers/lzo/lzo1x.h @@ -0,0 +1,62 @@ +/** + @file lzo/lzo1x.h + This service provides dynamic access to LZO. +*/ + +#ifndef LZO_INCLUDED +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef MYSQL_ABI_CHECK +#include <stdbool.h> +#endif + +#ifndef MYSQL_DYNAMIC_PLUGIN +#define provider_service_lzo provider_service_lzo_static +#endif + +#ifndef LZO_E_OK +#define LZO_E_OK 0 +#define LZO_E_INTERNAL_ERROR (-99) + +#define LZO1X_1_15_MEM_COMPRESS ((unsigned int) (32768L * ((unsigned) sizeof(unsigned char *)))) + +typedef size_t lzo_uint; + +#define lzo1x_1_15_compress(...) provider_service_lzo->lzo1x_1_15_compress_ptr (__VA_ARGS__) +#define lzo1x_decompress_safe(...) provider_service_lzo->lzo1x_decompress_safe_ptr (__VA_ARGS__) +#endif + +#define DEFINE_lzo1x_1_15_compress(NAME) NAME( \ + const unsigned char *src, \ + lzo_uint src_len, \ + unsigned char *dst, \ + lzo_uint *dst_len, \ + void *wrkmem \ +) + +#define DEFINE_lzo1x_decompress_safe(NAME) NAME( \ + const unsigned char *src, \ + lzo_uint src_len, \ + unsigned char *dst, \ + lzo_uint *dst_len, \ + void *wrkmem \ +) + +struct provider_service_lzo_st +{ + int DEFINE_lzo1x_1_15_compress((*lzo1x_1_15_compress_ptr)); + int DEFINE_lzo1x_decompress_safe((*lzo1x_decompress_safe_ptr)); + + bool is_loaded; +}; + +extern struct provider_service_lzo_st *provider_service_lzo; + +#ifdef __cplusplus +} +#endif + +#define LZO_INCLUDED +#endif diff --git a/include/providers/snappy-c.h b/include/providers/snappy-c.h new file mode 100644 index 00000000..afc6aef2 --- /dev/null +++ b/include/providers/snappy-c.h @@ -0,0 +1,75 @@ +/** + @file snappy-c.h + This service provides dynamic access to Snappy as a C header. +*/ + +#ifndef SNAPPY_C_INCLUDED +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef MYSQL_ABI_CHECK +#include <stddef.h> +#include <stdbool.h> +#endif + +#ifndef MYSQL_DYNAMIC_PLUGIN +#define provider_service_snappy provider_service_snappy_static +#endif + +#ifndef SNAPPY_C +typedef enum +{ + SNAPPY_OK = 0, + SNAPPY_INVALID_INPUT = 1, + SNAPPY_BUFFER_TOO_SMALL = 2 +} snappy_status; + +#define snappy_max_compressed_length(...) provider_service_snappy->snappy_max_compressed_length_ptr (__VA_ARGS__) +#define snappy_compress(...) provider_service_snappy->snappy_compress_ptr (__VA_ARGS__) +#define snappy_uncompressed_length(...) provider_service_snappy->snappy_uncompressed_length_ptr (__VA_ARGS__) +#define snappy_uncompress(...) provider_service_snappy->snappy_uncompress_ptr (__VA_ARGS__) +#endif + +#define DEFINE_snappy_max_compressed_length(NAME) NAME( \ + size_t source_length \ +) + +#define DEFINE_snappy_compress(NAME) NAME( \ + const char *input, \ + size_t input_length, \ + char *compressed, \ + size_t *compressed_length \ +) + +#define DEFINE_snappy_uncompressed_length(NAME) NAME( \ + const char *compressed, \ + size_t compressed_length, \ + size_t *result \ +) + +#define DEFINE_snappy_uncompress(NAME) NAME( \ + const char *compressed, \ + size_t compressed_length, \ + char *uncompressed, \ + size_t *uncompressed_length \ +) + +struct provider_service_snappy_st +{ + size_t DEFINE_snappy_max_compressed_length((*snappy_max_compressed_length_ptr)); + snappy_status DEFINE_snappy_compress((*snappy_compress_ptr)); + snappy_status DEFINE_snappy_uncompressed_length((*snappy_uncompressed_length_ptr)); + snappy_status DEFINE_snappy_uncompress((*snappy_uncompress_ptr)); + + bool is_loaded; +}; + +extern struct provider_service_snappy_st *provider_service_snappy; + +#ifdef __cplusplus +} +#endif + +#define SNAPPY_C_INCLUDED +#endif |