00001
00002
00003
00004
00005
00011 #ifndef _TOR_TORGZIP_H
00012 #define _TOR_TORGZIP_H
00013
00018 typedef enum {
00019 NO_METHOD=0, GZIP_METHOD=1, ZLIB_METHOD=2, UNKNOWN_METHOD=3
00020 } compress_method_t;
00021
00022 int
00023 tor_gzip_compress(char **out, size_t *out_len,
00024 const char *in, size_t in_len,
00025 compress_method_t method);
00026 int
00027 tor_gzip_uncompress(char **out, size_t *out_len,
00028 const char *in, size_t in_len,
00029 compress_method_t method,
00030 int complete_only,
00031 int protocol_warn_level);
00032
00033 int is_gzip_supported(void);
00034
00035 compress_method_t detect_compression_method(const char *in, size_t in_len);
00036
00039 typedef enum {
00040 TOR_ZLIB_OK, TOR_ZLIB_DONE, TOR_ZLIB_BUF_FULL, TOR_ZLIB_ERR
00041 } tor_zlib_output_t;
00043 typedef struct tor_zlib_state_t tor_zlib_state_t;
00044 tor_zlib_state_t *tor_zlib_new(int compress, compress_method_t method);
00045
00046 tor_zlib_output_t tor_zlib_process(tor_zlib_state_t *state,
00047 char **out, size_t *out_len,
00048 const char **in, size_t *in_len,
00049 int finish);
00050 void tor_zlib_free(tor_zlib_state_t *state);
00051
00052 #endif
00053