diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-01-06 13:52:54 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-01-06 13:52:54 -0500 |
commit | cf2ac8e2556849fdcace74adf36da876f86af30a (patch) | |
tree | 84a0f7f21309374f148760d0c416c5ae49803575 /src/common/torgzip.h | |
parent | 6f7a8f84d906a0a9d5fd88e49d352bb748a36b09 (diff) | |
parent | 734ba5cb0a0b6cc5376f8889305835224d814252 (diff) | |
download | tor-cf2ac8e2556849fdcace74adf36da876f86af30a.tar.gz tor-cf2ac8e2556849fdcace74adf36da876f86af30a.zip |
Merge remote-tracking branch 'public/feature11791'
Diffstat (limited to 'src/common/torgzip.h')
-rw-r--r-- | src/common/torgzip.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/common/torgzip.h b/src/common/torgzip.h index 89ca6a6613..0fc2deb6c4 100644 --- a/src/common/torgzip.h +++ b/src/common/torgzip.h @@ -19,6 +19,15 @@ typedef enum { NO_METHOD=0, GZIP_METHOD=1, ZLIB_METHOD=2, UNKNOWN_METHOD=3 } compress_method_t; +/** + * Enumeration to define tradeoffs between memory usage and compression level. + * HIGH_COMPRESSION saves the most bandwidth; LOW_COMPRESSION saves the most + * memory. + **/ +typedef enum { + HIGH_COMPRESSION, MEDIUM_COMPRESSION, LOW_COMPRESSION +} zlib_compression_level_t; + int tor_gzip_compress(char **out, size_t *out_len, const char *in, size_t in_len, @@ -47,7 +56,8 @@ typedef enum { } tor_zlib_output_t; /** Internal state for an incremental zlib compression/decompression. */ typedef struct tor_zlib_state_t tor_zlib_state_t; -tor_zlib_state_t *tor_zlib_new(int compress, compress_method_t method); +tor_zlib_state_t *tor_zlib_new(int compress, compress_method_t method, + zlib_compression_level_t level); tor_zlib_output_t tor_zlib_process(tor_zlib_state_t *state, char **out, size_t *out_len, |