compress_zlib.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* Copyright (c) 2003, Roger Dingledine
  2. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
  3. * Copyright (c) 2007-2019, The Tor Project, Inc. */
  4. /* See LICENSE for licensing information */
  5. /**
  6. * \file compress_zlib.h
  7. * \brief Header for compress_zlib.c
  8. **/
  9. #ifndef TOR_COMPRESS_ZLIB_H
  10. #define TOR_COMPRESS_ZLIB_H
  11. int tor_zlib_method_supported(void);
  12. const char *tor_zlib_get_version_str(void);
  13. const char *tor_zlib_get_header_version_str(void);
  14. /** Internal state for an incremental zlib/gzip compression/decompression. */
  15. typedef struct tor_zlib_compress_state_t tor_zlib_compress_state_t;
  16. tor_zlib_compress_state_t *
  17. tor_zlib_compress_new(int compress,
  18. compress_method_t method,
  19. compression_level_t compression_level);
  20. tor_compress_output_t
  21. tor_zlib_compress_process(tor_zlib_compress_state_t *state,
  22. char **out, size_t *out_len,
  23. const char **in, size_t *in_len,
  24. int finish);
  25. void tor_zlib_compress_free_(tor_zlib_compress_state_t *state);
  26. #define tor_zlib_compress_free(st) \
  27. FREE_AND_NULL(tor_zlib_compress_state_t, \
  28. tor_zlib_compress_free_, (st))
  29. size_t tor_zlib_compress_state_size(const tor_zlib_compress_state_t *state);
  30. size_t tor_zlib_get_total_allocation(void);
  31. void tor_zlib_init(void);
  32. #endif /* !defined(TOR_COMPRESS_ZLIB_H) */