diff options
Diffstat (limited to 'include/grpc/compression.h')
-rw-r--r-- | include/grpc/compression.h | 52 |
1 files changed, 14 insertions, 38 deletions
diff --git a/include/grpc/compression.h b/include/grpc/compression.h index 31d048ba93..a2b65b0e8a 100644 --- a/include/grpc/compression.h +++ b/include/grpc/compression.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,67 +36,43 @@ #include <stdlib.h> -#include <grpc/support/port_platform.h> +#include <grpc/impl/codegen/port_platform.h> +#include <grpc/impl/codegen/compression_types.h> #ifdef __cplusplus extern "C" { #endif -/** To be used in channel arguments */ -#define GRPC_COMPRESSION_ALGORITHM_ARG "grpc.compression_algorithm" -#define GRPC_COMPRESSION_ALGORITHM_STATE_ARG "grpc.compression_algorithm_state" - -/* The various compression algorithms supported by GRPC */ -typedef enum { - GRPC_COMPRESS_NONE = 0, - GRPC_COMPRESS_DEFLATE, - GRPC_COMPRESS_GZIP, - /* TODO(ctiller): snappy */ - GRPC_COMPRESS_ALGORITHMS_COUNT -} grpc_compression_algorithm; - -typedef enum { - GRPC_COMPRESS_LEVEL_NONE = 0, - GRPC_COMPRESS_LEVEL_LOW, - GRPC_COMPRESS_LEVEL_MED, - GRPC_COMPRESS_LEVEL_HIGH, - GRPC_COMPRESS_LEVEL_COUNT -} 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 */ -} grpc_compression_options; - /** Parses the first \a name_length bytes of \a name as a * grpc_compression_algorithm instance, updating \a algorithm. Returns 1 upon * success, 0 otherwise. */ -int grpc_compression_algorithm_parse(const char *name, size_t name_length, - grpc_compression_algorithm *algorithm); +GRPC_API int grpc_compression_algorithm_parse( + const char *name, size_t name_length, + grpc_compression_algorithm *algorithm); /** Updates \a name with the encoding name corresponding to a valid \a * algorithm. Returns 1 upon success, 0 otherwise. */ -int grpc_compression_algorithm_name(grpc_compression_algorithm algorithm, - char **name); +GRPC_API int grpc_compression_algorithm_name( + grpc_compression_algorithm algorithm, char **name); /** Returns the compression algorithm corresponding to \a level. * * It abort()s for unknown levels . */ -grpc_compression_algorithm grpc_compression_algorithm_for_level( - grpc_compression_level level); +GRPC_API grpc_compression_algorithm +grpc_compression_algorithm_for_level(grpc_compression_level level); -void grpc_compression_options_init(grpc_compression_options *opts); +GRPC_API void grpc_compression_options_init(grpc_compression_options *opts); /** Mark \a algorithm as enabled in \a opts. */ -void grpc_compression_options_enable_algorithm( +GRPC_API void grpc_compression_options_enable_algorithm( grpc_compression_options *opts, grpc_compression_algorithm algorithm); /** Mark \a algorithm as disabled in \a opts. */ -void grpc_compression_options_disable_algorithm( +GRPC_API void grpc_compression_options_disable_algorithm( grpc_compression_options *opts, grpc_compression_algorithm algorithm); /** Returns true if \a algorithm is marked as enabled in \a opts. */ -int grpc_compression_options_is_algorithm_enabled( +GRPC_API int grpc_compression_options_is_algorithm_enabled( const grpc_compression_options *opts, grpc_compression_algorithm algorithm); #ifdef __cplusplus |