David Garcia Quintas | 55b4ea1 | 2015-06-16 14:27:32 -0700 | [diff] [blame] | 1 | /* |
| 2 | * |
David Garcia Quintas | 3598d44 | 2016-03-15 14:53:05 -0700 | [diff] [blame] | 3 | * Copyright 2015-2016, Google Inc. |
David Garcia Quintas | 55b4ea1 | 2015-06-16 14:27:32 -0700 | [diff] [blame] | 4 | * 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 Tiller | 9a4dddd | 2016-03-25 17:08:13 -0700 | [diff] [blame] | 34 | #ifndef GRPC_CORE_LIB_CHANNEL_COMPRESS_FILTER_H |
| 35 | #define GRPC_CORE_LIB_CHANNEL_COMPRESS_FILTER_H |
David Garcia Quintas | 55b4ea1 | 2015-06-16 14:27:32 -0700 | [diff] [blame] | 36 | |
| 37 | #include "src/core/channel/channel_stack.h" |
| 38 | |
Craig Tiller | 49772e0 | 2015-08-21 08:08:37 -0700 | [diff] [blame] | 39 | #define GRPC_COMPRESS_REQUEST_ALGORITHM_KEY "grpc-internal-encoding-request" |
David Garcia Quintas | d7d9ce2 | 2015-06-30 23:29:03 -0700 | [diff] [blame] | 40 | |
David Garcia Quintas | 0c2f162 | 2015-07-17 15:36:22 -0700 | [diff] [blame] | 41 | /** Compression filter for outgoing data. |
David Garcia Quintas | 5927aec | 2015-06-18 17:24:44 -0700 | [diff] [blame] | 42 | * |
David Garcia Quintas | cadbf22 | 2015-07-17 15:33:13 -0700 | [diff] [blame] | 43 | * See <grpc/compression.h> for the available compression settings. |
David Garcia Quintas | 5927aec | 2015-06-18 17:24:44 -0700 | [diff] [blame] | 44 | * |
David Garcia Quintas | 0c2f162 | 2015-07-17 15:36:22 -0700 | [diff] [blame] | 45 | * 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 Quintas | 55b4ea1 | 2015-06-16 14:27:32 -0700 | [diff] [blame] | 63 | extern const grpc_channel_filter grpc_compress_filter; |
| 64 | |
Craig Tiller | 9a4dddd | 2016-03-25 17:08:13 -0700 | [diff] [blame] | 65 | #endif /* GRPC_CORE_LIB_CHANNEL_COMPRESS_FILTER_H */ |