diff options
Diffstat (limited to 'fluent-bit/lib/librdkafka-2.1.0/src/snappy.h')
-rw-r--r-- | fluent-bit/lib/librdkafka-2.1.0/src/snappy.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/fluent-bit/lib/librdkafka-2.1.0/src/snappy.h b/fluent-bit/lib/librdkafka-2.1.0/src/snappy.h new file mode 100644 index 00000000..b3742f1a --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/src/snappy.h @@ -0,0 +1,62 @@ +/* + * librdkafka - Apache Kafka C library + * + * Copyright (c) 2018 Magnus Edenhill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _LINUX_SNAPPY_H +#define _LINUX_SNAPPY_H 1 + +#include <stdbool.h> +#include <stddef.h> + +/* Only needed for compression. This preallocates the worst case */ +struct snappy_env { + unsigned short *hash_table; + void *scratch; + void *scratch_output; +}; + +struct iovec; +int rd_kafka_snappy_init_env(struct snappy_env *env); +int rd_kafka_snappy_init_env_sg(struct snappy_env *env, bool sg); +void rd_kafka_snappy_free_env(struct snappy_env *env); +int rd_kafka_snappy_uncompress_iov(struct iovec *iov_in, int iov_in_len, + size_t input_len, char *uncompressed); +int rd_kafka_snappy_uncompress(const char *compressed, size_t n, char *uncompressed); +char *rd_kafka_snappy_java_uncompress (const char *inbuf, size_t inlen, + size_t *outlenp, + char *errstr, size_t errstr_size); +int rd_kafka_snappy_compress_iov(struct snappy_env *env, + const struct iovec *iov_in, size_t iov_in_cnt, + size_t input_length, + struct iovec *iov_out); +bool rd_kafka_snappy_uncompressed_length(const char *buf, size_t len, size_t *result); +size_t rd_kafka_snappy_max_compressed_length(size_t source_len); + + + + +#endif |