aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/compression/algorithm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/compression/algorithm.c')
-rw-r--r--src/core/compression/algorithm.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/core/compression/algorithm.c b/src/core/compression/algorithm.c
index 36ead843d2..06b034dee7 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,20 @@ 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:
+ case GRPC_COMPRESS_LEVEL_HIGH:
+ return GRPC_COMPRESS_DEFLATE;
+ default:
+ /* we shouldn't be making it here */
+ abort();
+ }
+}