blob: 08feafc1bbe7c971d404386ffff7393b3a6b1128 [file] [log] [blame]
Craig Tillerebdef9d2015-11-19 17:09:49 -08001/*
2 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02003 * Copyright 2015 gRPC authors.
Craig Tillerebdef9d2015-11-19 17:09:49 -08004 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02005 * 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
Craig Tillerebdef9d2015-11-19 17:09:49 -08008 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02009 * http://www.apache.org/licenses/LICENSE-2.0
Craig Tillerebdef9d2015-11-19 17:09:49 -080010 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +020011 * 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.
Craig Tillerebdef9d2015-11-19 17:09:49 -080016 *
17 */
18
Craig Tiller9a4dddd2016-03-25 17:08:13 -070019#ifndef GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H
20#define GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H
Craig Tillerebdef9d2015-11-19 17:09:49 -080021
22#include <grpc/compression.h>
Craig Tiller9533d042016-03-25 17:11:06 -070023#include "src/core/lib/transport/metadata.h"
Craig Tillerebdef9d2015-11-19 17:09:49 -080024
25/** Return compression algorithm based metadata value */
Craig Tiller7c70b6c2017-01-23 07:48:42 -080026grpc_slice grpc_compression_algorithm_slice(
Craig Tillerebdef9d2015-11-19 17:09:49 -080027 grpc_compression_algorithm algorithm);
28
Muxi Yan68a0fd52017-07-21 09:26:04 -070029/** Return stream compression algorithm based metadata value */
30grpc_slice grpc_stream_compression_algorithm_slice(
31 grpc_stream_compression_algorithm algorithm);
32
Craig Tillerebdef9d2015-11-19 17:09:49 -080033/** Return compression algorithm based metadata element (grpc-encoding: xxx) */
Craig Tiller7c70b6c2017-01-23 07:48:42 -080034grpc_mdelem grpc_compression_encoding_mdelem(
Craig Tillerebdef9d2015-11-19 17:09:49 -080035 grpc_compression_algorithm algorithm);
36
Muxi Yan68a0fd52017-07-21 09:26:04 -070037/** Return stream compression algorithm based metadata element
38 * (content-encoding: xxx) */
39grpc_mdelem grpc_stream_compression_encoding_mdelem(
40 grpc_stream_compression_algorithm algorithm);
41
Craig Tillerebdef9d2015-11-19 17:09:49 -080042/** Find compression algorithm based on passed in mdstr - returns
43 * GRPC_COMPRESS_ALGORITHM_COUNT on failure */
Craig Tiller7c70b6c2017-01-23 07:48:42 -080044grpc_compression_algorithm grpc_compression_algorithm_from_slice(
45 grpc_slice str);
Craig Tillerebdef9d2015-11-19 17:09:49 -080046
Muxi Yan68a0fd52017-07-21 09:26:04 -070047/** Find stream compression algorithm based on passed in mdstr - returns
48 * GRPC_STREAM_COMPRESS_ALGORITHM_COUNT on failure */
49grpc_stream_compression_algorithm grpc_stream_compression_algorithm_from_slice(
50 grpc_slice str);
51
Craig Tiller9a4dddd2016-03-25 17:08:13 -070052#endif /* GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H */