Tor
0.4.7.0-alpha-dev
|
Compression backend for LZMA. More...
#include "orconfig.h"
#include "lib/compress/compress.h"
#include "lib/compress/compress_lzma.h"
#include "lib/log/log.h"
#include "lib/log/util_bug.h"
#include "lib/malloc/malloc.h"
#include "lib/thread/threads.h"
Go to the source code of this file.
Data Structures | |
struct | tor_lzma_compress_state_t |
Macros | |
#define | MEMORY_LIMIT (16 * 1024 * 1024) |
Functions | |
int | tor_lzma_method_supported (void) |
const char * | tor_lzma_get_version_str (void) |
const char * | tor_lzma_get_header_version_str (void) |
tor_lzma_compress_state_t * | tor_lzma_compress_new (int compress, compress_method_t method, compression_level_t level) |
tor_compress_output_t | tor_lzma_compress_process (tor_lzma_compress_state_t *state, char **out, size_t *out_len, const char **in, size_t *in_len, int finish) |
void | tor_lzma_compress_free_ (tor_lzma_compress_state_t *state) |
size_t | tor_lzma_compress_state_size (const tor_lzma_compress_state_t *state) |
size_t | tor_lzma_get_total_allocation (void) |
void | tor_lzma_init (void) |
Variables | |
static atomic_counter_t | total_lzma_allocation |
Compression backend for LZMA.
This module should never be invoked directly. Use the compress module instead.
Definition in file compress_lzma.c.
#define MEMORY_LIMIT (16 * 1024 * 1024) |
The maximum amount of memory we allow the LZMA decoder to use, in bytes.
Definition at line 28 of file compress_lzma.c.
void tor_lzma_compress_free_ | ( | tor_lzma_compress_state_t * | state | ) |
Deallocate state.
Definition at line 328 of file compress_lzma.c.
tor_lzma_compress_state_t* tor_lzma_compress_new | ( | int | compress, |
compress_method_t | method, | ||
compression_level_t | level | ||
) |
Construct and return a tor_lzma_compress_state_t object using method. If compress, it's for compression; otherwise it's for decompression.
Definition at line 174 of file compress_lzma.c.
tor_compress_output_t tor_lzma_compress_process | ( | tor_lzma_compress_state_t * | state, |
char ** | out, | ||
size_t * | out_len, | ||
const char ** | in, | ||
size_t * | in_len, | ||
int | finish | ||
) |
Compress/decompress some bytes using state. Read up to *in_len bytes from *in, and write up to *out_len bytes to *out, adjusting the values as we go. If finish is true, we've reached the end of the input.
Return TOR_COMPRESS_DONE if we've finished the entire compression/decompression. Return TOR_COMPRESS_OK if we're processed everything from the input. Return TOR_COMPRESS_BUFFER_FULL if we're out of space on out. Return TOR_COMPRESS_ERROR if the stream is corrupt.
Definition at line 245 of file compress_lzma.c.
size_t tor_lzma_compress_state_size | ( | const tor_lzma_compress_state_t * | state | ) |
Return the approximate number of bytes allocated for state.
Definition at line 344 of file compress_lzma.c.
const char* tor_lzma_get_header_version_str | ( | void | ) |
Return a string representation of the version of liblzma used at compilation time. Returns NULL if LZMA is unsupported.
Definition at line 108 of file compress_lzma.c.
size_t tor_lzma_get_total_allocation | ( | void | ) |
Return the approximate number of bytes allocated for all LZMA states.
Definition at line 352 of file compress_lzma.c.
Referenced by tor_compress_get_total_allocation().
const char* tor_lzma_get_version_str | ( | void | ) |
Return a string representation of the version of the currently running version of liblzma. Returns NULL if LZMA is unsupported.
Definition at line 96 of file compress_lzma.c.
void tor_lzma_init | ( | void | ) |
Initialize the lzma module
Definition at line 359 of file compress_lzma.c.
Referenced by tor_compress_init().
int tor_lzma_method_supported | ( | void | ) |
Return 1 if LZMA compression is supported; otherwise 0.
Definition at line 84 of file compress_lzma.c.
|
static |
Total number of bytes allocated for LZMA state.
Definition at line 31 of file compress_lzma.c.
Referenced by tor_lzma_compress_free_(), tor_lzma_get_total_allocation(), and tor_lzma_init().