From b53fd4df37617364e6de2d9f880c03f3a9907450 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 25 Apr 2017 16:02:09 -0700 Subject: Add cronet_compression workaround filter --- tools/doxygen/Doxyfile.core.internal | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tools/doxygen') diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 924595eb95..ab23bf316e 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -971,6 +971,8 @@ src/core/ext/filters/max_age/max_age_filter.c \ src/core/ext/filters/max_age/max_age_filter.h \ src/core/ext/filters/message_size/message_size_filter.c \ src/core/ext/filters/message_size/message_size_filter.h \ +src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c \ +src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h \ src/core/ext/transport/README.md \ src/core/ext/transport/chttp2/README.md \ src/core/ext/transport/chttp2/alpn/alpn.c \ -- cgit v1.2.3 From f63afec89d2dcd7afc0c082618286358241549fd Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 27 Apr 2017 11:14:18 -0700 Subject: user-agent string filtering --- CMakeLists.txt | 2 + Makefile | 2 + binding.gyp | 1 + build.yaml | 9 +++ config.m4 | 1 + gRPC-Core.podspec | 5 +- grpc.gemspec | 2 + package.xml | 2 + .../workaround_cronet_compression_filter.c | 88 ++++++++++++++++++---- .../ext/filters/workarounds/workaround_utils.c | 57 ++++++++++++++ .../ext/filters/workarounds/workaround_utils.h | 54 +++++++++++++ src/python/grpcio/grpc_core_dependencies.py | 1 + tools/doxygen/Doxyfile.core.internal | 2 + tools/run_tests/generated/sources_and_headers.json | 20 +++++ vsprojects/vcxproj/grpc/grpc.vcxproj | 3 + vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 6 ++ .../vcxproj/grpc_unsecure/grpc_unsecure.vcxproj | 3 + .../grpc_unsecure/grpc_unsecure.vcxproj.filters | 6 ++ 18 files changed, 250 insertions(+), 14 deletions(-) create mode 100644 src/core/ext/filters/workarounds/workaround_utils.c create mode 100644 src/core/ext/filters/workarounds/workaround_utils.h (limited to 'tools/doxygen') diff --git a/CMakeLists.txt b/CMakeLists.txt index 106985a290..0e2f6d5044 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1150,6 +1150,7 @@ add_library(grpc src/core/ext/filters/max_age/max_age_filter.c src/core/ext/filters/message_size/message_size_filter.c src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c + src/core/ext/filters/workarounds/workaround_utils.c src/core/plugin_registry/grpc_plugin_registry.c ) @@ -2013,6 +2014,7 @@ add_library(grpc_unsecure src/core/ext/filters/max_age/max_age_filter.c src/core/ext/filters/message_size/message_size_filter.c src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c + src/core/ext/filters/workarounds/workaround_utils.c src/core/plugin_registry/grpc_unsecure_plugin_registry.c ) diff --git a/Makefile b/Makefile index 21cee50b4a..f71be07a21 100644 --- a/Makefile +++ b/Makefile @@ -3124,6 +3124,7 @@ LIBGRPC_SRC = \ src/core/ext/filters/max_age/max_age_filter.c \ src/core/ext/filters/message_size/message_size_filter.c \ src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c \ + src/core/ext/filters/workarounds/workaround_utils.c \ src/core/plugin_registry/grpc_plugin_registry.c \ PUBLIC_HEADERS_C += \ @@ -3956,6 +3957,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/filters/max_age/max_age_filter.c \ src/core/ext/filters/message_size/message_size_filter.c \ src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c \ + src/core/ext/filters/workarounds/workaround_utils.c \ src/core/plugin_registry/grpc_unsecure_plugin_registry.c \ PUBLIC_HEADERS_C += \ diff --git a/binding.gyp b/binding.gyp index 7487ca7f81..9bbfc5ab05 100644 --- a/binding.gyp +++ b/binding.gyp @@ -887,6 +887,7 @@ 'src/core/ext/filters/max_age/max_age_filter.c', 'src/core/ext/filters/message_size/message_size_filter.c', 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c', + 'src/core/ext/filters/workarounds/workaround_utils.c', 'src/core/plugin_registry/grpc_plugin_registry.c', ], "conditions": [ diff --git a/build.yaml b/build.yaml index 40333e40ff..2677dae0fb 100644 --- a/build.yaml +++ b/build.yaml @@ -634,6 +634,13 @@ filegroups: - grpc_base - grpc_transport_chttp2_alpn - tsi +- name: grpc_server_backward_compatibility + headers: + - src/core/ext/filters/workarounds/workaround_utils.h + src: + - src/core/ext/filters/workarounds/workaround_utils.c + uses: + - grpc_base - name: grpc_test_util_base build: test headers: @@ -1034,6 +1041,7 @@ libs: - grpc_message_size_filter - grpc_deadline_filter - grpc_workaround_cronet_compression_filter + - grpc_server_backward_compatibility generate_plugin_registry: true secure: true vs_packages: @@ -1134,6 +1142,7 @@ libs: - grpc_message_size_filter - grpc_deadline_filter - grpc_workaround_cronet_compression_filter + - grpc_server_backward_compatibility generate_plugin_registry: true secure: false vs_project_guid: '{46CEDFFF-9692-456A-AA24-38B5D6BCF4C5}' diff --git a/config.m4 b/config.m4 index 6fb709af46..b59b0f638b 100644 --- a/config.m4 +++ b/config.m4 @@ -323,6 +323,7 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/filters/max_age/max_age_filter.c \ src/core/ext/filters/message_size/message_size_filter.c \ src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c \ + src/core/ext/filters/workarounds/workaround_utils.c \ src/core/plugin_registry/grpc_plugin_registry.c \ src/boringssl/err_data.c \ third_party/boringssl/crypto/aes/aes.c \ diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 854e9b9cd0..61c441a500 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -460,6 +460,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/max_age/max_age_filter.h', 'src/core/ext/filters/message_size/message_size_filter.h', 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h', + 'src/core/ext/filters/workarounds/workaround_utils.h', 'src/core/lib/surface/init.c', 'src/core/lib/channel/channel_args.c', 'src/core/lib/channel/channel_stack.c', @@ -696,6 +697,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/max_age/max_age_filter.c', 'src/core/ext/filters/message_size/message_size_filter.c', 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c', + 'src/core/ext/filters/workarounds/workaround_utils.c', 'src/core/plugin_registry/grpc_plugin_registry.c' ss.private_header_files = 'src/core/lib/profiling/timers.h', @@ -916,7 +918,8 @@ Pod::Spec.new do |s| 'src/core/ext/census/tracing.h', 'src/core/ext/filters/max_age/max_age_filter.h', 'src/core/ext/filters/message_size/message_size_filter.h', - 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h' + 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h', + 'src/core/ext/filters/workarounds/workaround_utils.h' end s.subspec 'Cronet-Interface' do |ss| diff --git a/grpc.gemspec b/grpc.gemspec index 4d1c22cd5c..fcb05337ce 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -376,6 +376,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/max_age/max_age_filter.h ) s.files += %w( src/core/ext/filters/message_size/message_size_filter.h ) s.files += %w( src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h ) + s.files += %w( src/core/ext/filters/workarounds/workaround_utils.h ) s.files += %w( src/core/lib/surface/init.c ) s.files += %w( src/core/lib/channel/channel_args.c ) s.files += %w( src/core/lib/channel/channel_stack.c ) @@ -612,6 +613,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/max_age/max_age_filter.c ) s.files += %w( src/core/ext/filters/message_size/message_size_filter.c ) s.files += %w( src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c ) + s.files += %w( src/core/ext/filters/workarounds/workaround_utils.c ) s.files += %w( src/core/plugin_registry/grpc_plugin_registry.c ) s.files += %w( third_party/boringssl/crypto/aes/internal.h ) s.files += %w( third_party/boringssl/crypto/asn1/asn1_locl.h ) diff --git a/package.xml b/package.xml index 108b144e38..6638fcef3d 100644 --- a/package.xml +++ b/package.xml @@ -385,6 +385,7 @@ + @@ -621,6 +622,7 @@ + diff --git a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c index f78cfa2f55..6d00900ccc 100644 --- a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c +++ b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c @@ -31,22 +31,15 @@ #include "src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h" +#include #include -#include "src/core/lib/surface/channel_init.h" -#include "src/core/lib/channel/channel_stack_builder.h" -/* -#include #include -#include -#include -#include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/support/string.h" -#include "src/core/lib/transport/service_config.h" -*/ - -#define GRPC_WORKAROUND_PRIORITY_HIGH 9999 +#include "src/core/ext/filters/workarounds/workaround_utils.h" +#include "src/core/lib/surface/channel_init.h" +#include "src/core/lib/channel/channel_stack_builder.h" +#include "src/core/lib/transport/metadata.h" typedef struct call_data { // Receive closures are chained: we inject this closure as the @@ -57,18 +50,46 @@ typedef struct call_data { grpc_metadata_batch *recv_initial_metadata; // Original recv_initial_metadata_ready callback, invoked after our own. grpc_closure* next_recv_initial_metadata_ready; + + // Marks whether the workaround is active + bool workaround_active; } call_data; typedef struct channel_data { } channel_data; +// Find the user agent metadata element in the batch +static bool get_user_agent_mdelem(const grpc_metadata_batch *batch, + grpc_mdelem *md) { + grpc_linked_mdelem *t = batch->list.head; + while (t != NULL) { + *md = t->md; + if (grpc_slice_eq(GRPC_MDKEY(*md), GRPC_MDSTR_USER_AGENT)) { + return true; + } + t = t->next; + } + + return false; +} + // Callback invoked when we receive an initial metadata. static void recv_initial_metadata_ready(grpc_exec_ctx* exec_ctx, void* user_data, grpc_error* error) { grpc_call_element* elem = user_data; call_data* calld = elem->call_data; - + if (GRPC_ERROR_NONE == error) { + grpc_mdelem md; + if (get_user_agent_mdelem(calld->recv_initial_metadata, &md)) { + grpc_user_agent_md *user_agent_md = grpc_parse_user_agent(md); + if (user_agent_md->workaround_active[GRPC_WORKAROUND_ID_CRONET_COMPRESSION]) { + calld->workaround_active = true; + } + // Remove with caching + gpr_free(user_agent_md); + } + } // Invoke the next callback. grpc_closure_run(exec_ctx, calld->next_recv_initial_metadata_ready, GRPC_ERROR_REF(error)); @@ -98,6 +119,7 @@ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx, const grpc_call_element_args* args) { call_data* calld = elem->call_data; calld->next_recv_initial_metadata_ready = NULL; + calld->workaround_active = false; grpc_closure_init(&calld->recv_initial_metadata_ready, recv_initial_metadata_ready, elem, grpc_schedule_on_exec_ctx); return GRPC_ERROR_NONE; @@ -119,6 +141,44 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx, static void destroy_channel_elem(grpc_exec_ctx* exec_ctx, grpc_channel_element* elem) {} +// Parse the user agent +static bool parse_user_agent(grpc_mdelem md) { + const char grpc_objc_specifier[] = "grpc-objc/"; + const size_t grpc_objc_specifier_len = sizeof(grpc_objc_specifier) - 1; + const char cronet_specifier[] = "cronet_http"; + const size_t cronet_specifier_len = sizeof(cronet_specifier) - 1; + + char *user_agent_str = grpc_slice_to_c_string(GRPC_MDVALUE(md)); + bool grpc_objc_specifier_seen = false; + bool cronet_specifier_seen = false; + char *major_version = user_agent_str, *minor_version; + + char *head = strtok(user_agent_str, " "); + while (head != NULL) { + if (!grpc_objc_specifier_seen && + 0 == strncmp(head, grpc_objc_specifier, grpc_objc_specifier_len)) { + major_version = head + grpc_objc_specifier_len; + grpc_objc_specifier_seen = true; + } else if (grpc_objc_specifier_seen && + 0 == strncmp(head, cronet_specifier, cronet_specifier_len)) { + cronet_specifier_seen = true; + break; + } + + head = strtok(NULL, " "); + } + if (grpc_objc_specifier_seen) { + major_version = strtok(major_version, "."); + minor_version = strtok(NULL, "."); + } + + gpr_free(user_agent_str); + return (grpc_objc_specifier_seen && + cronet_specifier_seen && + (atol(major_version) < 1 || + (atol(major_version) == 1 && atol(minor_version) <= 3))); +} + const grpc_channel_filter grpc_workaround_cronet_compression_filter = { start_transport_stream_op_batch, grpc_channel_next_op, @@ -136,6 +196,8 @@ const grpc_channel_filter grpc_workaround_cronet_compression_filter = { static bool register_workaround_cronet_compression(grpc_exec_ctx* exec_ctx, grpc_channel_stack_builder* builder, void* arg) { + grpc_register_workaround(GRPC_WORKAROUND_ID_CRONET_COMPRESSION, + parse_user_agent); return grpc_channel_stack_builder_prepend_filter( builder, &grpc_workaround_cronet_compression_filter, NULL, NULL); } diff --git a/src/core/ext/filters/workarounds/workaround_utils.c b/src/core/ext/filters/workarounds/workaround_utils.c new file mode 100644 index 0000000000..14ed84599c --- /dev/null +++ b/src/core/ext/filters/workarounds/workaround_utils.c @@ -0,0 +1,57 @@ +// +// Copyright 2017, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// + +#include "src/core/ext/filters/workarounds/workaround_utils.h" + +#include +#include + +static user_agent_parser user_agent_parsers[GRPC_MAX_WORKAROUND_ID]; + +grpc_user_agent_md *grpc_parse_user_agent(grpc_mdelem md) { + grpc_user_agent_md *user_agent_md; + + // USE THE CACHE WHEN ABLE + + user_agent_md = gpr_malloc(sizeof(grpc_user_agent_md)); + for (int i = 0; i < GRPC_MAX_WORKAROUND_ID; i++) { + if (user_agent_parsers[i]) { + user_agent_md->workaround_active[i] = user_agent_parsers[i](md); + } + } + + return user_agent_md; +} + +void grpc_register_workaround(uint32_t id, user_agent_parser parser) { + GPR_ASSERT(id < GRPC_MAX_WORKAROUND_ID); + user_agent_parsers[id] = parser; +} diff --git a/src/core/ext/filters/workarounds/workaround_utils.h b/src/core/ext/filters/workarounds/workaround_utils.h new file mode 100644 index 0000000000..99363248cb --- /dev/null +++ b/src/core/ext/filters/workarounds/workaround_utils.h @@ -0,0 +1,54 @@ +// +// Copyright 2017, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_UTILS +#define GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_UTILS + +#include "src/core/lib/transport/metadata.h" + +#define GRPC_WORKAROUND_PRIORITY_HIGH 9999 + +typedef enum { + GRPC_WORKAROUND_ID_CRONET_COMPRESSION = 0, + GRPC_MAX_WORKAROUND_ID, +} grpc_workaround_list; + +typedef struct grpc_user_agent_md { + bool workaround_active[GRPC_MAX_WORKAROUND_ID]; +} grpc_user_agent_md; + +grpc_user_agent_md *grpc_parse_user_agent(grpc_mdelem md); + +typedef bool (*user_agent_parser)(grpc_mdelem); + +void grpc_register_workaround(uint32_t id, user_agent_parser parser); + +#endif diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 3620662276..606ec3c235 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -312,6 +312,7 @@ CORE_SOURCE_FILES = [ 'src/core/ext/filters/max_age/max_age_filter.c', 'src/core/ext/filters/message_size/message_size_filter.c', 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c', + 'src/core/ext/filters/workarounds/workaround_utils.c', 'src/core/plugin_registry/grpc_plugin_registry.c', 'src/boringssl/err_data.c', 'third_party/boringssl/crypto/aes/aes.c', diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index ab23bf316e..c22d0e9cfa 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -973,6 +973,8 @@ src/core/ext/filters/message_size/message_size_filter.c \ src/core/ext/filters/message_size/message_size_filter.h \ src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c \ src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h \ +src/core/ext/filters/workarounds/workaround_utils.c \ +src/core/ext/filters/workarounds/workaround_utils.h \ src/core/ext/transport/README.md \ src/core/ext/transport/chttp2/README.md \ src/core/ext/transport/chttp2/alpn/alpn.c \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index b62fa9939d..25acc88a55 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -5707,6 +5707,7 @@ "grpc_resolver_dns_native", "grpc_resolver_sockaddr", "grpc_secure", + "grpc_server_backward_compatibility", "grpc_transport_chttp2_client_insecure", "grpc_transport_chttp2_client_secure", "grpc_transport_chttp2_server_insecure", @@ -5812,6 +5813,7 @@ "grpc_resolver_dns_ares", "grpc_resolver_dns_native", "grpc_resolver_sockaddr", + "grpc_server_backward_compatibility", "grpc_transport_chttp2_client_insecure", "grpc_transport_chttp2_server_insecure", "grpc_workaround_cronet_compression_filter" @@ -8463,6 +8465,24 @@ "third_party": false, "type": "filegroup" }, + { + "deps": [ + "gpr", + "grpc_base" + ], + "headers": [ + "src/core/ext/filters/workarounds/workaround_utils.h" + ], + "is_filegroup": true, + "language": "c", + "name": "grpc_server_backward_compatibility", + "src": [ + "src/core/ext/filters/workarounds/workaround_utils.c", + "src/core/ext/filters/workarounds/workaround_utils.h" + ], + "third_party": false, + "type": "filegroup" + }, { "deps": [ "gpr_test_util", diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index 2a2c795428..22794648e6 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -505,6 +505,7 @@ + @@ -979,6 +980,8 @@ + + diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index fa043cfcf5..2524f63618 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -709,6 +709,9 @@ src\core\ext\filters\workarounds + + src\core\ext\filters\workarounds + src\core\plugin_registry @@ -1424,6 +1427,9 @@ src\core\ext\filters\workarounds + + src\core\ext\filters\workarounds + diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index 903a0e1b23..fadc99e689 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -471,6 +471,7 @@ + @@ -889,6 +890,8 @@ + + diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index 111e2418b6..731e304c43 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -625,6 +625,9 @@ src\core\ext\filters\workarounds + + src\core\ext\filters\workarounds + src\core\plugin_registry @@ -1265,6 +1268,9 @@ src\core\ext\filters\workarounds + + src\core\ext\filters\workarounds + -- cgit v1.2.3 From 937dba3ea1039abdd27295f1312c658b9e348cd3 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 9 May 2017 14:45:44 -0700 Subject: Put workaround list somewhere accessable by wrapping languages --- CMakeLists.txt | 1 + Makefile | 1 + build.yaml | 1 + gRPC-Core.podspec | 1 + grpc.gemspec | 1 + include/grpc/support/workaround_list.h | 37 ++++++++++++++++++++++ package.xml | 1 + .../ext/filters/workarounds/workaround_utils.h | 8 ++--- test/core/surface/public_headers_must_be_c89.c | 1 + third_party/protobuf | 2 +- tools/doxygen/Doxyfile.core | 3 +- tools/doxygen/Doxyfile.core.internal | 1 + tools/run_tests/generated/sources_and_headers.json | 2 ++ vsprojects/vcxproj/gpr/gpr.vcxproj | 1 + vsprojects/vcxproj/gpr/gpr.vcxproj.filters | 3 ++ 15 files changed, 57 insertions(+), 7 deletions(-) create mode 100644 include/grpc/support/workaround_list.h (limited to 'tools/doxygen') diff --git a/CMakeLists.txt b/CMakeLists.txt index e300bb67b4..a9954ed6b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -849,6 +849,7 @@ foreach(_hdr include/grpc/support/tls_msvc.h include/grpc/support/tls_pthread.h include/grpc/support/useful.h + include/grpc/support/workaround_list.h include/grpc/impl/codegen/atm.h include/grpc/impl/codegen/atm_gcc_atomic.h include/grpc/impl/codegen/atm_gcc_sync.h diff --git a/Makefile b/Makefile index f140df41cf..5038f331be 100644 --- a/Makefile +++ b/Makefile @@ -2829,6 +2829,7 @@ PUBLIC_HEADERS_C += \ include/grpc/support/tls_msvc.h \ include/grpc/support/tls_pthread.h \ include/grpc/support/useful.h \ + include/grpc/support/workaround_list.h \ include/grpc/impl/codegen/atm.h \ include/grpc/impl/codegen/atm_gcc_atomic.h \ include/grpc/impl/codegen/atm_gcc_sync.h \ diff --git a/build.yaml b/build.yaml index 2e80dd7cd8..bf980e65cd 100644 --- a/build.yaml +++ b/build.yaml @@ -83,6 +83,7 @@ filegroups: - include/grpc/support/tls_msvc.h - include/grpc/support/tls_pthread.h - include/grpc/support/useful.h + - include/grpc/support/workaround_list.h headers: - src/core/lib/profiling/timers.h - src/core/lib/support/arena.h diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 6b92646d93..0c38247714 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -145,6 +145,7 @@ Pod::Spec.new do |s| 'include/grpc/support/tls_msvc.h', 'include/grpc/support/tls_pthread.h', 'include/grpc/support/useful.h', + 'include/grpc/support/workaround_list.h', 'include/grpc/impl/codegen/atm.h', 'include/grpc/impl/codegen/atm_gcc_atomic.h', 'include/grpc/impl/codegen/atm_gcc_sync.h', diff --git a/grpc.gemspec b/grpc.gemspec index d098b8ae24..a0244e0162 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -69,6 +69,7 @@ Gem::Specification.new do |s| s.files += %w( include/grpc/support/tls_msvc.h ) s.files += %w( include/grpc/support/tls_pthread.h ) s.files += %w( include/grpc/support/useful.h ) + s.files += %w( include/grpc/support/workaround_list.h ) s.files += %w( include/grpc/impl/codegen/atm.h ) s.files += %w( include/grpc/impl/codegen/atm_gcc_atomic.h ) s.files += %w( include/grpc/impl/codegen/atm_gcc_sync.h ) diff --git a/include/grpc/support/workaround_list.h b/include/grpc/support/workaround_list.h new file mode 100644 index 0000000000..3e3b4847e2 --- /dev/null +++ b/include/grpc/support/workaround_list.h @@ -0,0 +1,37 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +typedef enum { + GRPC_WORKAROUND_ID_CRONET_COMPRESSION = 0, + GRPC_MAX_WORKAROUND_ID +} grpc_workaround_list; diff --git a/package.xml b/package.xml index c7896fdc91..d6e25d4906 100644 --- a/package.xml +++ b/package.xml @@ -78,6 +78,7 @@ + diff --git a/src/core/ext/filters/workarounds/workaround_utils.h b/src/core/ext/filters/workarounds/workaround_utils.h index e563f07632..19528ab165 100644 --- a/src/core/ext/filters/workarounds/workaround_utils.h +++ b/src/core/ext/filters/workarounds/workaround_utils.h @@ -32,14 +32,12 @@ #ifndef GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_UTILS_H #define GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_UTILS_H +#include + #include "src/core/lib/transport/metadata.h" #define GRPC_WORKAROUND_PRIORITY_HIGH 10001 - -typedef enum { - GRPC_WORKAROUND_ID_CRONET_COMPRESSION = 0, - GRPC_MAX_WORKAROUND_ID, -} grpc_workaround_list; +#define GRPC_WORKAROUND_PROIRITY_LOW 9999 typedef struct grpc_workaround_user_agent_md { bool workaround_active[GRPC_MAX_WORKAROUND_ID]; diff --git a/test/core/surface/public_headers_must_be_c89.c b/test/core/surface/public_headers_must_be_c89.c index 330da46849..aa4769c490 100644 --- a/test/core/surface/public_headers_must_be_c89.c +++ b/test/core/surface/public_headers_must_be_c89.c @@ -73,5 +73,6 @@ #include #include #include +#include int main(int argc, char **argv) { return 0; } diff --git a/third_party/protobuf b/third_party/protobuf index 593e917c17..a6189acd18 160000 --- a/third_party/protobuf +++ b/third_party/protobuf @@ -1 +1 @@ -Subproject commit 593e917c176b5bc5aafa57bf9f6030d749d91cd5 +Subproject commit a6189acd18b00611c1dc7042299ad75486f08a1a diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core index c3bfc6c4a8..d0fd82d1a3 100644 --- a/tools/doxygen/Doxyfile.core +++ b/tools/doxygen/Doxyfile.core @@ -860,7 +860,8 @@ include/grpc/support/tls.h \ include/grpc/support/tls_gcc.h \ include/grpc/support/tls_msvc.h \ include/grpc/support/tls_pthread.h \ -include/grpc/support/useful.h +include/grpc/support/useful.h \ +include/grpc/support/workaround_list.h # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index be341c3e62..946953c00c 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -861,6 +861,7 @@ include/grpc/support/tls_gcc.h \ include/grpc/support/tls_msvc.h \ include/grpc/support/tls_pthread.h \ include/grpc/support/useful.h \ +include/grpc/support/workaround_list.h \ src/core/README.md \ src/core/ext/README.md \ src/core/ext/census/README.md \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index bfdd32522e..15268777d6 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -7603,6 +7603,7 @@ "include/grpc/support/tls_msvc.h", "include/grpc/support/tls_pthread.h", "include/grpc/support/useful.h", + "include/grpc/support/workaround_list.h", "src/core/lib/profiling/timers.h", "src/core/lib/support/arena.h", "src/core/lib/support/atomic.h", @@ -7652,6 +7653,7 @@ "include/grpc/support/tls_msvc.h", "include/grpc/support/tls_pthread.h", "include/grpc/support/useful.h", + "include/grpc/support/workaround_list.h", "src/core/lib/profiling/basic_timers.c", "src/core/lib/profiling/stap_timers.c", "src/core/lib/profiling/timers.h", diff --git a/vsprojects/vcxproj/gpr/gpr.vcxproj b/vsprojects/vcxproj/gpr/gpr.vcxproj index 7fb81a7fbc..1bc4a2363b 100644 --- a/vsprojects/vcxproj/gpr/gpr.vcxproj +++ b/vsprojects/vcxproj/gpr/gpr.vcxproj @@ -173,6 +173,7 @@ + diff --git a/vsprojects/vcxproj/gpr/gpr.vcxproj.filters b/vsprojects/vcxproj/gpr/gpr.vcxproj.filters index 27d9d2f38f..4eae135066 100644 --- a/vsprojects/vcxproj/gpr/gpr.vcxproj.filters +++ b/vsprojects/vcxproj/gpr/gpr.vcxproj.filters @@ -219,6 +219,9 @@ include\grpc\support + + include\grpc\support + include\grpc\impl\codegen -- cgit v1.2.3