1 /* 2 * 3 * Copyright 2015 gRPC authors. 4 * 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 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 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. 16 * 17 */ 18 19 #ifndef GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H 20 #define GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H 21 22 #include <grpc/support/port_platform.h> 23 24 #include <grpc/compression.h> 25 #include "src/core/lib/compression/compression_internal.h" 26 #include "src/core/lib/transport/metadata.h" 27 28 /** Return compression algorithm based metadata value */ 29 grpc_slice grpc_compression_algorithm_slice( 30 grpc_compression_algorithm algorithm); 31 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 grpc_slice str); 36 37 /** Return compression algorithm based metadata element */ 38 grpc_mdelem grpc_compression_encoding_mdelem( 39 grpc_compression_algorithm algorithm); 40 41 /** Return message compression algorithm based metadata element (grpc-encoding: 42 * xxx) */ 43 grpc_mdelem grpc_message_compression_encoding_mdelem( 44 grpc_message_compression_algorithm algorithm); 45 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); 50 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(grpc_slice str); 55 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 grpc_slice str); 60 61 #endif /* GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H */ 62