summaryrefslogtreecommitdiff
path: root/src/common/compress.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/compress.c')
-rw-r--r--src/common/compress.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/common/compress.c b/src/common/compress.c
index 52ff13258a..725dde53e0 100644
--- a/src/common/compress.c
+++ b/src/common/compress.c
@@ -154,6 +154,25 @@ detect_compression_method(const char *in, size_t in_len)
}
}
+/** Return 1 if a given <b>method</b> is supported; otherwise 0. */
+int
+tor_compress_supports_method(compress_method_t method)
+{
+ switch (method) {
+ case GZIP_METHOD:
+ case ZLIB_METHOD:
+ return tor_zlib_method_supported();
+ case LZMA_METHOD:
+ return tor_lzma_method_supported();
+ case ZSTD_METHOD:
+ return tor_zstd_method_supported();
+ case NO_METHOD:
+ case UNKNOWN_METHOD:
+ default:
+ return 0;
+ }
+}
+
/** Return the approximate number of bytes allocated for all
* supported compression schemas. */
size_t