diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/compression/algorithm.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/core/compression/algorithm.c b/src/core/compression/algorithm.c index 36ead843d2..6c25733ba9 100644 --- a/src/core/compression/algorithm.c +++ b/src/core/compression/algorithm.c @@ -31,6 +31,7 @@ * */ +#include <stdlib.h> #include <grpc/compression.h> const char *grpc_compression_algorithm_name( @@ -47,3 +48,21 @@ const char *grpc_compression_algorithm_name( } return "error"; } + +/* TODO(dgq): Add the ability to specify parameters to the individual + * compression algorithms */ +grpc_compression_algorithm grpc_compression_algorithm_for_level( + grpc_compression_level level) { + switch (level) { + case GRPC_COMPRESS_NONE: + return GRPC_COMPRESS_NONE; + case GRPC_COMPRESS_LEVEL_LOW: + case GRPC_COMPRESS_LEVEL_MED: + return GRPC_COMPRESS_DEFLATE; + case GRPC_COMPRESS_LEVEL_HIGH: + return GRPC_COMPRESS_GZIP; + default: + /* we shouldn't be making it here */ + abort(); + } +} |