3 * Copyright 2015 gRPC authors.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 #ifndef GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H
20 #define GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H
22 #include <grpc/support/port_platform.h>
24 #include <grpc/compression.h>
25 #include "src/core/lib/compression/compression_internal.h"
26 #include "src/core/lib/transport/metadata.h"
28 /** Return compression algorithm based metadata value */
29 grpc_slice grpc_compression_algorithm_slice(
30 grpc_compression_algorithm algorithm);
32 /** Find compression algorithm based on passed in mdstr - returns
33 * GRPC_COMPRESS_ALGORITHM_COUNT on failure */
34 grpc_compression_algorithm grpc_compression_algorithm_from_slice(
35 const grpc_slice& str);
37 /** Return compression algorithm based metadata element */
38 grpc_mdelem grpc_compression_encoding_mdelem(
39 grpc_compression_algorithm algorithm);
41 /** Return message compression algorithm based metadata element (grpc-encoding:
43 grpc_mdelem grpc_message_compression_encoding_mdelem(
44 grpc_message_compression_algorithm algorithm);
46 /** Return stream compression algorithm based metadata element
47 * (content-encoding: xxx) */
48 grpc_mdelem grpc_stream_compression_encoding_mdelem(
49 grpc_stream_compression_algorithm algorithm);
51 /** Find compression algorithm based on passed in mdstr - returns
52 * GRPC_COMPRESS_ALGORITHM_COUNT on failure */
53 grpc_message_compression_algorithm
54 grpc_message_compression_algorithm_from_slice(const grpc_slice& str);
56 /** Find stream compression algorithm based on passed in mdstr - returns
57 * GRPC_STREAM_COMPRESS_ALGORITHM_COUNT on failure */
58 grpc_stream_compression_algorithm grpc_stream_compression_algorithm_from_slice(
59 const grpc_slice& str);
61 #endif /* GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H */