Remove the requirement for libevent, since it's a static library already
[tor/rransom.git] / src / common / torgzip.h
blob7f53fe86c14f7cd301f4573cf28f26ed4c07f74c
1 /* Copyright 2003 Roger Dingledine
2 * Copyright 2004-2007 Roger Dingledine, Nick Mathewson */
3 /* See LICENSE for licensing information */
4 /* $Id$ */
6 /**
7 * \file torgzip.h
8 * \brief Headers for torgzip.h
9 **/
11 #ifndef __TORGZIP_H
12 #define __TORGZIP_H
13 #define TORGZIP_H_ID "$Id$"
15 /** Enumeration of what kind of compression to use. Only ZLIB_METHOD is
16 * guaranteed to be supported by the compress/uncompress functions here;
17 * GZIP_METHOD may be supported if we built against zlib version 1.2 or later
18 * and is_gzip_supported() returns true. */
19 typedef enum {
20 NO_METHOD=0, GZIP_METHOD=1, ZLIB_METHOD=2, UNKNOWN_METHOD=3
21 } compress_method_t;
23 int
24 tor_gzip_compress(char **out, size_t *out_len,
25 const char *in, size_t in_len,
26 compress_method_t method);
27 int
28 tor_gzip_uncompress(char **out, size_t *out_len,
29 const char *in, size_t in_len,
30 compress_method_t method,
31 int complete_only,
32 int protocol_warn_level);
34 int is_gzip_supported(void);
36 compress_method_t detect_compression_method(const char *in, size_t in_len);
38 /** Return values from tor_zlib_process; see that function's documentation for
39 * details. */
40 typedef enum {
41 TOR_ZLIB_OK, TOR_ZLIB_DONE, TOR_ZLIB_BUF_FULL, TOR_ZLIB_ERR
42 } tor_zlib_output_t;
43 typedef struct tor_zlib_state_t tor_zlib_state_t;
44 tor_zlib_state_t *tor_zlib_new(int compress, compress_method_t method);
46 tor_zlib_output_t tor_zlib_process(tor_zlib_state_t *state,
47 char **out, size_t *out_len,
48 const char **in, size_t *in_len,
49 int finish);
50 void tor_zlib_free(tor_zlib_state_t *state);
52 #endif