diff options
Diffstat (limited to 'src/common/compress.c')
-rw-r--r-- | src/common/compress.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/common/compress.c b/src/common/compress.c index 9a24025db0..8502dee25c 100644 --- a/src/common/compress.c +++ b/src/common/compress.c @@ -285,6 +285,26 @@ tor_compress_supports_method(compress_method_t method) } } +/** + * Return a bitmask of the supported compression types, where 1<<m is + * set in the bitmask if and only if compression with method <b>m</b> is + * supported. + */ +unsigned +tor_compress_get_supported_method_bitmask(void) +{ + static unsigned supported = 0; + if (supported == 0) { + compress_method_t m; + for (m = NO_METHOD; m <= UNKNOWN_METHOD; ++m) { + if (tor_compress_supports_method(m)) { + supported |= (1u << m); + } + } + } + return supported; +} + /** Table of compression method names. These should have an "x-" prefix, * if they are not listed in the IANA content coding registry. */ static const struct { |