51 lines
1.6 KiB
C
51 lines
1.6 KiB
C
#ifndef BLUE_COMPRESS_CSTREAM_H_
|
|
#define BLUE_COMPRESS_CSTREAM_H_
|
|
|
|
#include <blue/core/macros.h>
|
|
#include <blue/core/stream.h>
|
|
#include <stdbool.h>
|
|
|
|
B_DECLS_BEGIN;
|
|
|
|
enum b_compressor_mode;
|
|
|
|
#define B_TYPE_CSTREAM (b_cstream_get_type())
|
|
|
|
B_DECLARE_TYPE(b_cstream);
|
|
|
|
B_TYPE_CLASS_DECLARATION_BEGIN(b_cstream)
|
|
B_TYPE_CLASS_DECLARATION_END(b_cstream)
|
|
|
|
BLUE_API b_type b_cstream_get_type(void);
|
|
|
|
BLUE_API b_status b_cstream_open(
|
|
b_stream *endpoint, b_type compressor_type, enum b_compressor_mode mode,
|
|
b_cstream **out);
|
|
|
|
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_skip(
|
|
b_cstream *stream, size_t count, size_t *nr_skipped);
|
|
BLUE_API b_status b_cstream_reset(b_cstream *stream);
|
|
|
|
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);
|
|
|
|
B_DECLS_END;
|
|
|
|
#endif
|