blob: 73eb271731c4c908eb00296d0af7fdbe7f1c60b4 [file] [log] [blame]
David Garcia Quintas55b4ea12015-06-16 14:27:32 -07001/*
2 *
David Garcia Quintas3598d442016-03-15 14:53:05 -07003 * Copyright 2015-2016, Google Inc.
David Garcia Quintas55b4ea12015-06-16 14:27:32 -07004 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following disclaimer
14 * in the documentation and/or other materials provided with the
15 * distribution.
16 * * Neither the name of Google Inc. nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 */
33
Craig Tiller9a4dddd2016-03-25 17:08:13 -070034#ifndef GRPC_CORE_LIB_CHANNEL_COMPRESS_FILTER_H
35#define GRPC_CORE_LIB_CHANNEL_COMPRESS_FILTER_H
David Garcia Quintas55b4ea12015-06-16 14:27:32 -070036
37#include "src/core/channel/channel_stack.h"
38
Craig Tiller49772e02015-08-21 08:08:37 -070039#define GRPC_COMPRESS_REQUEST_ALGORITHM_KEY "grpc-internal-encoding-request"
David Garcia Quintasd7d9ce22015-06-30 23:29:03 -070040
David Garcia Quintas0c2f1622015-07-17 15:36:22 -070041/** Compression filter for outgoing data.
David Garcia Quintas5927aec2015-06-18 17:24:44 -070042 *
David Garcia Quintascadbf222015-07-17 15:33:13 -070043 * See <grpc/compression.h> for the available compression settings.
David Garcia Quintas5927aec2015-06-18 17:24:44 -070044 *
David Garcia Quintas0c2f1622015-07-17 15:36:22 -070045 * Compression settings may come from:
46 * - Channel configuration, as established at channel creation time.
47 * - The metadata accompanying the outgoing data to be compressed. This is
48 * taken as a request only. We may choose not to honor it. The metadata key
49 * is given by \a GRPC_COMPRESS_REQUEST_ALGORITHM_KEY.
50 *
51 * Compression can be disabled for concrete messages (for instance in order to
52 * prevent CRIME/BEAST type attacks) by having the GRPC_WRITE_NO_COMPRESS set in
53 * the BEGIN_MESSAGE flags.
54 *
55 * The attempted compression mechanism is added to the resulting initial
56 * metadata under the'grpc-encoding' key.
57 *
58 * If compression is actually performed, BEGIN_MESSAGE's flag is modified to
59 * incorporate GRPC_WRITE_INTERNAL_COMPRESS. Otherwise, and regardless of the
60 * aforementioned 'grpc-encoding' metadata value, data will pass through
61 * uncompressed. */
62
David Garcia Quintas55b4ea12015-06-16 14:27:32 -070063extern const grpc_channel_filter grpc_compress_filter;
64
Craig Tiller9a4dddd2016-03-25 17:08:13 -070065#endif /* GRPC_CORE_LIB_CHANNEL_COMPRESS_FILTER_H */