aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc/impl/codegen/compression_types.h
diff options
context:
space:
mode:
authorGravatar Jorge Canizales <jcanizales@google.com>2016-06-30 15:37:11 -0700
committerGravatar Jorge Canizales <jcanizales@google.com>2016-06-30 15:37:11 -0700
commitc93d6a66a12110f82882807d95ad5dcb02370151 (patch)
treeefb5e632e8ad237e05d63af14e54c2a8d83ad87b /include/grpc/impl/codegen/compression_types.h
parent095172c3a52a11c42aed0150eb8dbb47186fd2a0 (diff)
parenta5596db1a53723789d7c90c23d9cbfbb8207f949 (diff)
Merge master into merge-0.14-into-master
Conflicts: - gRPC.podspec - Only had non-trivial changes in the core file list, which will need to be regenerated (in gRPC-Core.podspec). - src/objective-c/BoringSSL.podspec - Had trivial conflicts in the version. - src/objective-c/examples/RemoteTestClient/RemoteTest.podspec - Trivial conflicts in quoting. - src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj and src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj - The master version is used, pending testing. The 0.14 version had emoji and some unneeded entries. - src/objective-c/tests/Podfile - Added CronetFramework pod, and warning silencing from master. - templates/gRPC.podspec.template - Deleted. - third_party/protobuf - Using master commit, but need to verify if it works for frameworks.
Diffstat (limited to 'include/grpc/impl/codegen/compression_types.h')
-rw-r--r--include/grpc/impl/codegen/compression_types.h44
1 files changed, 39 insertions, 5 deletions
diff --git a/include/grpc/impl/codegen/compression_types.h b/include/grpc/impl/codegen/compression_types.h
index 0daccd92f2..9065d1edd0 100644
--- a/include/grpc/impl/codegen/compression_types.h
+++ b/include/grpc/impl/codegen/compression_types.h
@@ -35,16 +35,25 @@
#define GRPC_IMPL_CODEGEN_COMPRESSION_TYPES_H
#include <grpc/impl/codegen/port_platform.h>
+#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
+/** To be used as initial metadata key for the request of a concrete compression
+ * algorithm */
+#define GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY \
+ "grpc-internal-encoding-request"
+
/** To be used in channel arguments */
-#define GRPC_COMPRESSION_ALGORITHM_ARG "grpc.compression_algorithm"
-#define GRPC_COMPRESSION_ALGORITHM_STATE_ARG "grpc.compression_algorithm_state"
+#define GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM \
+ "grpc.default_compression_algorithm"
+#define GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL "grpc.default_compression_level"
+#define GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET \
+ "grpc.compression_enabled_algorithms_bitset"
-/* The various compression algorithms supported by GRPC */
+/* The various compression algorithms supported by gRPC */
typedef enum {
GRPC_COMPRESS_NONE = 0,
GRPC_COMPRESS_DEFLATE,
@@ -53,6 +62,10 @@ typedef enum {
GRPC_COMPRESS_ALGORITHMS_COUNT
} grpc_compression_algorithm;
+/** 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
+ * compression algorithms. */
typedef enum {
GRPC_COMPRESS_LEVEL_NONE = 0,
GRPC_COMPRESS_LEVEL_LOW,
@@ -62,8 +75,29 @@ typedef enum {
} grpc_compression_level;
typedef struct grpc_compression_options {
- uint32_t enabled_algorithms_bitset; /**< All algs are enabled by default */
- grpc_compression_algorithm default_compression_algorithm; /**< for channel */
+ /** All algs are enabled by default. This option corresponds to the channel
+ * argument key behind \a GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET
+ */
+ uint32_t enabled_algorithms_bitset;
+
+ /** The default channel compression level. It'll be used in the absence of
+ * call specific settings. This option corresponds to the channel argument key
+ * behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL. If present, takes
+ * precedence over \a default_algorithm.
+ * TODO(dgq): currently only available for server channels. */
+ struct {
+ bool is_set;
+ grpc_compression_level level;
+ } default_level;
+
+ /** The default channel compression algorithm. It'll be used in the absence of
+ * call specific settings. This option corresponds to the channel argument key
+ * behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM. */
+ struct {
+ bool is_set;
+ grpc_compression_algorithm algorithm;
+ } default_algorithm;
+
} grpc_compression_options;
#ifdef __cplusplus