compress_zstd.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* Copyright (c) 2003, Roger Dingledine
  2. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
  3. * Copyright (c) 2007-2018, The Tor Project, Inc. */
  4. /* See LICENSE for licensing information */
  5. /**
  6. * \file compress_zstd.h
  7. * \brief Header for compress_zstd.c
  8. **/
  9. #ifndef TOR_COMPRESS_ZSTD_H
  10. #define TOR_COMPRESS_ZSTD_H
  11. int tor_zstd_method_supported(void);
  12. const char *tor_zstd_get_version_str(void);
  13. const char *tor_zstd_get_header_version_str(void);
  14. int tor_zstd_can_use_static_apis(void);
  15. /** Internal state for an incremental Zstandard compression/decompression. */
  16. typedef struct tor_zstd_compress_state_t tor_zstd_compress_state_t;
  17. tor_zstd_compress_state_t *
  18. tor_zstd_compress_new(int compress,
  19. compress_method_t method,
  20. compression_level_t compression_level);
  21. tor_compress_output_t
  22. tor_zstd_compress_process(tor_zstd_compress_state_t *state,
  23. char **out, size_t *out_len,
  24. const char **in, size_t *in_len,
  25. int finish);
  26. void tor_zstd_compress_free_(tor_zstd_compress_state_t *state);
  27. #define tor_zstd_compress_free(st) \
  28. FREE_AND_NULL(tor_zstd_compress_state_t, \
  29. tor_zstd_compress_free_, (st))
  30. size_t tor_zstd_compress_state_size(const tor_zstd_compress_state_t *state);
  31. size_t tor_zstd_get_total_allocation(void);
  32. void tor_zstd_init(void);
  33. void tor_zstd_warn_if_version_mismatched(void);
  34. #ifdef TOR_UNIT_TESTS
  35. void tor_zstd_set_static_apis_disabled_for_testing(int disabled);
  36. #endif
  37. #endif /* !defined(TOR_COMPRESS_ZSTD_H) */