aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc/compression.h
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2017-07-21 09:26:04 -0700
committerGravatar Muxi Yan <mxyan@google.com>2017-07-26 14:20:01 -0700
commit68a0fd54169d165060b09efadb1e2c0df4a294cb (patch)
tree82192b7622e6fc80de3559f372b158c21a182227 /include/grpc/compression.h
parentc97fc14a0ece99339f56b313b862f1a28f48c8b8 (diff)
Separate stream compression from message-wise compression
Diffstat (limited to 'include/grpc/compression.h')
-rw-r--r--include/grpc/compression.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/include/grpc/compression.h b/include/grpc/compression.h
index d47074c9b7..15ae16c56c 100644
--- a/include/grpc/compression.h
+++ b/include/grpc/compression.h
@@ -36,19 +36,38 @@ extern "C" {
GRPCAPI int grpc_compression_algorithm_parse(
grpc_slice value, grpc_compression_algorithm *algorithm);
+/** Parses the first \a name_length bytes of \a name as a
+ * grpc_stream_compression_algorithm instance, updating \a algorithm. Returns 1
+ * upon success, 0 otherwise. */
+int grpc_stream_compression_algorithm_parse(
+ grpc_slice name, grpc_stream_compression_algorithm *algorithm);
+
/** Updates \a name with the encoding name corresponding to a valid \a
* algorithm. Note that \a name is statically allocated and must *not* be freed.
* Returns 1 upon success, 0 otherwise. */
GRPCAPI int grpc_compression_algorithm_name(
grpc_compression_algorithm algorithm, char **name);
+/** Updates \a name with the encoding name corresponding to a valid \a
+ * algorithm. Note that \a name is statically allocated and must *not* be freed.
+ * Returns 1 upon success, 0 otherwise. */
+GRPCAPI int grpc_stream_compression_algorithm_name(
+ grpc_stream_compression_algorithm algorithm, char **name);
+
/** Returns the compression algorithm corresponding to \a level for the
* compression algorithms encoded in the \a accepted_encodings bitset.
*
- * It abort()s for unknown levels . */
+ * It abort()s for unknown levels. */
GRPCAPI grpc_compression_algorithm grpc_compression_algorithm_for_level(
grpc_compression_level level, uint32_t accepted_encodings);
+/** Returns the stream compression algorithm corresponding to \a level for the
+ * compression algorithms encoded in the \a accepted_stream_encodings bitset.
+ * It abort()s for unknown levels. */
+GRPCAPI grpc_stream_compression_algorithm
+grpc_stream_compression_algorithm_for_level(grpc_stream_compression_level level,
+ uint32_t accepted_stream_encodings);
+
GRPCAPI void grpc_compression_options_init(grpc_compression_options *opts);
/** Mark \a algorithm as enabled in \a opts. */
@@ -63,6 +82,11 @@ GRPCAPI void grpc_compression_options_disable_algorithm(
GRPCAPI int grpc_compression_options_is_algorithm_enabled(
const grpc_compression_options *opts, grpc_compression_algorithm algorithm);
+/** Returns true if \a algorithm is marked as enabled in \a opts. */
+GRPCAPI int grpc_compression_options_is_stream_compression_algorithm_enabled(
+ const grpc_compression_options *opts,
+ grpc_stream_compression_algorithm algorithm);
+
#ifdef __cplusplus
}
#endif