36 lines
1.3 KiB
C
36 lines
1.3 KiB
C
#ifndef BLUELIB_COMPRESS_CSTREAM_H_
|
|
#define BLUELIB_COMPRESS_CSTREAM_H_
|
|
|
|
#include <blue/compress/function.h>
|
|
#include <blue/core/stream.h>
|
|
#include <stdbool.h>
|
|
|
|
typedef struct b_cstream b_cstream;
|
|
|
|
BLUE_API b_status b_cstream_open(
|
|
b_stream *endpoint, const b_compression_function *func,
|
|
b_compression_mode mode, b_cstream **out);
|
|
BLUE_API b_status b_cstream_close(b_cstream *stream);
|
|
|
|
BLUE_API b_status b_cstream_read(
|
|
b_cstream *stream, void *buf, size_t count, size_t *nr_read);
|
|
BLUE_API b_status b_cstream_write(
|
|
b_cstream *stream, const void *buf, size_t count, size_t *nr_written);
|
|
|
|
BLUE_API b_status b_cstream_begin_compressed_section(
|
|
b_cstream *stream, size_t *tx_uncompressed_bytes);
|
|
BLUE_API b_status b_cstream_end_compressed_section(
|
|
b_cstream *stream, size_t *tx_compressed_bytes,
|
|
size_t *tx_uncompressed_bytes);
|
|
BLUE_API bool b_cstream_in_compressed_section(const b_cstream *stream);
|
|
BLUE_API b_status b_cstream_tx_bytes(const b_cstream *stream, size_t *out);
|
|
BLUE_API b_status b_cstream_tx_bytes_compressed(
|
|
const b_cstream *stream, size_t *out);
|
|
BLUE_API b_status b_cstream_tx_bytes_uncompressed(
|
|
const b_cstream *stream, size_t *out);
|
|
|
|
BLUE_API b_status b_cstream_set_cursor_position(b_cstream *stream, size_t pos);
|
|
BLUE_API b_status b_cstream_restore_cursor_position(b_cstream *stream);
|
|
|
|
#endif
|