blob: ca8ca37f8e38f43c88d212a43a52f195c9014f2b [file] [log] [blame]
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -08001/*
2 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02003 * Copyright 2015 gRPC authors.
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -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
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -08008 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02009 * http://www.apache.org/licenses/LICENSE-2.0
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -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.
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080016 *
17 */
18
Craig Tiller9a4dddd2016-03-25 17:08:13 -070019#ifndef GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H
20#define GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080021
David Garcia Quintas59f905d2015-06-08 16:31:19 -070022#include <grpc/compression.h>
Craig Tillerb37d53e2016-10-26 16:16:35 -070023#include <grpc/slice_buffer.h>
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080024
25/* compress 'input' to 'output' using 'algorithm'.
26 On success, appends compressed slices to output and returns 1.
27 On failure, appends uncompressed slices to output and returns 0. */
Craig Tillera59c16c2016-10-31 07:25:01 -070028int grpc_msg_compress(grpc_exec_ctx* exec_ctx,
29 grpc_compression_algorithm algorithm,
Craig Tillerd41a4a72016-10-26 16:16:06 -070030 grpc_slice_buffer* input, grpc_slice_buffer* output);
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080031
32/* decompress 'input' to 'output' using 'algorithm'.
33 On success, appends slices to output and returns 1.
34 On failure, output is unchanged, and returns 0. */
Craig Tillera59c16c2016-10-31 07:25:01 -070035int grpc_msg_decompress(grpc_exec_ctx* exec_ctx,
36 grpc_compression_algorithm algorithm,
Craig Tillerd41a4a72016-10-26 16:16:06 -070037 grpc_slice_buffer* input, grpc_slice_buffer* output);
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080038
Craig Tiller9a4dddd2016-03-25 17:08:13 -070039#endif /* GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H */