aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc/impl/codegen/compression_types.h
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2017-07-12 12:19:58 -0700
committerGravatar Muxi Yan <mxyan@google.com>2017-07-12 14:04:30 -0700
commita4dc077d3c1eef677102f68496732b7dd2374875 (patch)
tree5ed3896ce6db5112aa7e443aa8eef97d1bc0e864 /include/grpc/impl/codegen/compression_types.h
parent96e49785518fa6e8723a68433d783632acd43108 (diff)
Stream compression configuration
Diffstat (limited to 'include/grpc/impl/codegen/compression_types.h')
-rw-r--r--include/grpc/impl/codegen/compression_types.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/grpc/impl/codegen/compression_types.h b/include/grpc/impl/codegen/compression_types.h
index e39c13e88d..e51099f8d5 100644
--- a/include/grpc/impl/codegen/compression_types.h
+++ b/include/grpc/impl/codegen/compression_types.h
@@ -58,9 +58,21 @@ typedef enum {
GRPC_COMPRESS_DEFLATE,
GRPC_COMPRESS_GZIP,
/* TODO(ctiller): snappy */
+ GRPC_STREAM_COMPRESS_GZIP,
GRPC_COMPRESS_ALGORITHMS_COUNT
} grpc_compression_algorithm;
+#define GRPC_IS_STREAM_COMPRESSION_ALGORITHM(x) \
+ ((x) >= GRPC_STREAM_COMPRESS_GZIP && (x) < GRPC_COMPRESS_ALGORITHMS_COUNT)
+#define GRPC_IS_MESSAGE_COMPRESSION_ALGORITHM(x) \
+ ((x) >= GRPC_COMPRESS_DEFLATE && (x) <= GRPC_COMPRESS_GZIP)
+#define GRPC_STREAM_COMPRESS_FLAG_OFFSET \
+ (GRPC_STREAM_COMPRESS_GZIP - GRPC_COMPRESS_DEFLATE)
+#define GRPC_MESSAGE_COMPRESSION_ALGORITHM_MASK \
+ ((1u << GRPC_COMPRESS_DEFLATE) | (1u << GRPC_COMPRESS_GZIP))
+#define GRPC_STREAM_COMPRESSION_ALGORITHM_MASK \
+ ((1u << GRPC_STREAM_COMPRESS_GZIP))
+
/** Compression levels allow a party with knowledge of its peer's accepted
* encodings to request compression in an abstract way. The level-algorithm
* mapping is performed internally and depends on the peer's supported
@@ -70,9 +82,18 @@ typedef enum {
GRPC_COMPRESS_LEVEL_LOW,
GRPC_COMPRESS_LEVEL_MED,
GRPC_COMPRESS_LEVEL_HIGH,
+ GRPC_STREAM_COMPRESS_LEVEL_LOW,
+ GRPC_STREAM_COMPRESS_LEVEL_MED,
+ GRPC_STREAM_COMPRESS_LEVEL_HIGH,
GRPC_COMPRESS_LEVEL_COUNT
} grpc_compression_level;
+#define GRPC_IS_STREAM_COMPRESSION_LEVEL(x) \
+ (((x) >= GRPC_STREAM_COMPRESS_LEVEL_LOW) && \
+ ((x) <= GRPC_STREAM_COMPRESS_LEVEL_HIGH))
+#define GRPC_IS_MESSAGE_COMPRESSION_LEVEL(x) \
+ (((x) >= GRPC_COMPRESS_LEVEL_LOW) && ((x) <= GRPC_COMPRESS_LEVEL_HIGH))
+
typedef struct grpc_compression_options {
/** All algs are enabled by default. This option corresponds to the channel
* argument key behind \a GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET