From 6bf9590aedfcc48895c9b033e6d2b4d105453630 Mon Sep 17 00:00:00 2001 From: Michael Warres Date: Wed, 9 Jan 2019 01:10:13 -0500 Subject: [PATCH 01/11] Import current snapshot of QUICHE as an external dependency. QUICHE (https://quiche.googlesource.com/quiche/) is Google's implementation of QUIC and related protocols. It is the same code used in Chromium and Google's servers, but packaged in a form that is intended to be easier to incorporate into third-party projects. QUICHE is still a work in progress, with current efforts focusing on eliminating diffs between Google-internal and Chromium variants of the code, as well as providing buildfiles and a default implementation of the QUICHE platform API (the platform-dependent porting layer that sits underneath the main body of QUICHE, which is platform-independent). In the interim, the Google QUIC team has created a branch of QUICHE, envoy-integration (https://quiche.googlesource.com/quiche/+/envoy-integration), to provide access to the full set of QUICHE source files, while the work above continues. Since Envoy can overlay its own build rules on top of external dependencies, this should allow Envoy/QUICHE integration work to move forwards, without being blocked by completion of "full" QUICHE. When QUICHE is fully complete, we can just update the dependency to point to the official QUICHE release, making whatever buildfile adjustments are necessary. This PR is limited to setting up a basic import of QUICHE with a bare skeleton of build rules to build and test one element of the platform API. The plan is to add more build rules and platform implementation classes incrementally, in a series of follow-on CLs. The end milestone of the platform implementation phase will be when we can run the QUIC end-to-end tests included in QUICHE on top of the Envoy platform implementation. Signed-off-by: Michael Warres --- bazel/external/quiche.BUILD | 48 +++++++++++++++++++ bazel/repositories.bzl | 11 +++++ bazel/repository_locations.bzl | 5 ++ source/extensions/quic_listeners/quiche/BUILD | 16 +++++++ .../extensions/quic_listeners/quiche/dummy.cc | 17 +++++++ .../extensions/quic_listeners/quiche/dummy.h | 15 ++++++ .../quic_listeners/quiche/platform/BUILD | 32 +++++++++++++ .../quiche/platform/http2_arraysize_impl.h | 3 ++ .../quiche/platform/http2_bug_tracker_impl.h | 5 ++ .../quiche/platform/http2_containers_impl.h | 8 ++++ .../http2_estimate_memory_usage_impl.h | 10 ++++ .../quiche/platform/http2_export_impl.h | 4 ++ .../quiche/platform/http2_flag_utils_impl.h | 3 ++ .../quiche/platform/http2_flags_impl.h | 4 ++ .../quiche/platform/http2_macros_impl.h | 5 ++ .../quiche/platform/http2_mock_log_impl.h | 5 ++ .../quiche/platform/http2_optional_impl.h | 8 ++++ .../quiche/platform/http2_ptr_util_impl.h | 10 ++++ .../platform/http2_reconstruct_object_impl.h | 25 ++++++++++ .../quiche/platform/http2_string_impl.h | 9 ++++ .../quiche/platform/http2_string_piece_impl.h | 7 +++ .../quiche/platform/http2_string_utils_impl.h | 39 +++++++++++++++ .../quiche/platform/http2_test_helpers_impl.h | 1 + test/extensions/quic_listeners/quiche/BUILD | 23 +++++++++ .../quic_listeners/quiche/dummy_test.cc | 19 ++++++++ 25 files changed, 332 insertions(+) create mode 100644 bazel/external/quiche.BUILD create mode 100644 source/extensions/quic_listeners/quiche/BUILD create mode 100644 source/extensions/quic_listeners/quiche/dummy.cc create mode 100644 source/extensions/quic_listeners/quiche/dummy.h create mode 100644 source/extensions/quic_listeners/quiche/platform/BUILD create mode 100644 source/extensions/quic_listeners/quiche/platform/http2_arraysize_impl.h create mode 100644 source/extensions/quic_listeners/quiche/platform/http2_bug_tracker_impl.h create mode 100644 source/extensions/quic_listeners/quiche/platform/http2_containers_impl.h create mode 100644 source/extensions/quic_listeners/quiche/platform/http2_estimate_memory_usage_impl.h create mode 100644 source/extensions/quic_listeners/quiche/platform/http2_export_impl.h create mode 100644 source/extensions/quic_listeners/quiche/platform/http2_flag_utils_impl.h create mode 100644 source/extensions/quic_listeners/quiche/platform/http2_flags_impl.h create mode 100644 source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h create mode 100644 source/extensions/quic_listeners/quiche/platform/http2_mock_log_impl.h create mode 100644 source/extensions/quic_listeners/quiche/platform/http2_optional_impl.h create mode 100644 source/extensions/quic_listeners/quiche/platform/http2_ptr_util_impl.h create mode 100644 source/extensions/quic_listeners/quiche/platform/http2_reconstruct_object_impl.h create mode 100644 source/extensions/quic_listeners/quiche/platform/http2_string_impl.h create mode 100644 source/extensions/quic_listeners/quiche/platform/http2_string_piece_impl.h create mode 100644 source/extensions/quic_listeners/quiche/platform/http2_string_utils_impl.h create mode 100644 source/extensions/quic_listeners/quiche/platform/http2_test_helpers_impl.h create mode 100644 test/extensions/quic_listeners/quiche/BUILD create mode 100644 test/extensions/quic_listeners/quiche/dummy_test.cc diff --git a/bazel/external/quiche.BUILD b/bazel/external/quiche.BUILD new file mode 100644 index 0000000000000..d70638fd13aa3 --- /dev/null +++ b/bazel/external/quiche.BUILD @@ -0,0 +1,48 @@ +# Transformations to QUICHE tarball: +# - Move subtree under quiche/ base dir, for clarity in #include statements. +# - Rewrite include directives for platform/impl files. +# +# The mechanics of this are likely to change as QUICHE evolves, supplies its own +# Bazel buildfiles, and perhaps provides a more graceful way to override +# platform impl directory location. However, the end result (QUICHE files placed +# under quiche/{http2,quic,spdy}/, with the Envoy-specific implementation of the +# QUICHE platform APIs in //source/extensions/quic_listeners/quiche/platform/, +# should remain the same. + +src_files = glob(["**/*.h", "**/*.c", "**/*.cc", "**/*.inc", "**/*.proto"]) + +genrule( + name = "quiche_files", + srcs = src_files, + outs = ["quiche/" + f for f in src_files], + cmd = "\n".join( + ["sed -e '/^#include/ s!net/\(http2\|quic\|spdy\)/platform/impl/!extensions/quic_listeners/quiche/platform/!' $(location %s) > $(location :%s)" % (f, "quiche/" + f) for f in src_files], + ), + visibility = ["//visibility:private"], +) + +cc_library( + name = "http2_platform", + hdrs = [ + "quiche/http2/platform/api/http2_arraysize.h", + "quiche/http2/platform/api/http2_bug_tracker.h", + "quiche/http2/platform/api/http2_containers.h", + "quiche/http2/platform/api/http2_estimate_memory_usage.h", + "quiche/http2/platform/api/http2_export.h", + "quiche/http2/platform/api/http2_flags.h", + "quiche/http2/platform/api/http2_flag_utils.h", + "quiche/http2/platform/api/http2_macros.h", + "quiche/http2/platform/api/http2_mock_log.h", + "quiche/http2/platform/api/http2_optional.h", + "quiche/http2/platform/api/http2_ptr_util.h", + "quiche/http2/platform/api/http2_reconstruct_object.h", + "quiche/http2/platform/api/http2_string.h", + "quiche/http2/platform/api/http2_string_piece.h", + "quiche/http2/platform/api/http2_string_utils.h", + "quiche/http2/platform/api/http2_test_helpers.h", + ], + visibility = ["//visibility:public"], + deps = [ + "@envoy//source/extensions/quic_listeners/quiche/platform:http2_platform_impl_lib", + ], +) diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 7e4e63b092e36..6728d41d5747a 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -297,6 +297,7 @@ def envoy_dependencies(path = "@envoy_deps//", skip_targets = []): _com_github_tencent_rapidjson() _com_google_googletest() _com_google_protobuf() + _com_google_quiche() # Used for bundling gcovr into a relocatable .par file. _repository_impl("subpar") @@ -539,6 +540,16 @@ def _com_google_protobuf(): actual = "@com_google_protobuf//util/python:python_headers", ) +def _com_google_quiche(): + _repository_impl( + name = "com_google_quiche", + build_file = "@envoy//bazel/external:quiche.BUILD", + ) + native.bind( + name = "quiche_http2_platform", + actual = "@com_google_quiche//:http2_platform", + ) + def _com_github_grpc_grpc(): _repository_impl("com_github_grpc_grpc") diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index a9c2a968f4437..eb9dd12ea90a1 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -191,4 +191,9 @@ REPOSITORY_LOCATIONS = dict( strip_prefix = "subpar-1.3.0", urls = ["https://github.com/google/subpar/archive/1.3.0.tar.gz"], ), + com_google_quiche = dict( + # Static snapshot of https://quiche.googlesource.com/quiche/+archive/c9b2cecd1d005893114a03c101532017ddfa12cb.tar.gz + sha256 = "c8faea835132103d574cc2769a58e244bee3de02669471330a174f2ffae6fcc3", + urls = ["https://storage.googleapis.com/quiche-envoy-integration/c9b2cecd1d005893114a03c101532017ddfa12cb.tar.gz"], + ), ) diff --git a/source/extensions/quic_listeners/quiche/BUILD b/source/extensions/quic_listeners/quiche/BUILD new file mode 100644 index 0000000000000..3a3b592647f73 --- /dev/null +++ b/source/extensions/quic_listeners/quiche/BUILD @@ -0,0 +1,16 @@ +licenses(["notice"]) # Apache 2 + +load( + "//bazel:envoy_build_system.bzl", + "envoy_cc_library", + "envoy_package", +) + +envoy_package() + +envoy_cc_library( + name = "dummy_lib", + srcs = ["dummy.cc"], + hdrs = ["dummy.h"], + external_deps = ["quiche_http2_platform"], +) diff --git a/source/extensions/quic_listeners/quiche/dummy.cc b/source/extensions/quic_listeners/quiche/dummy.cc new file mode 100644 index 0000000000000..117564bfd5b50 --- /dev/null +++ b/source/extensions/quic_listeners/quiche/dummy.cc @@ -0,0 +1,17 @@ +#include "extensions/quic_listeners/quiche/dummy.h" + +using http2::Http2String; + +namespace Envoy { +namespace Extensions { +namespace QuicListeners { +namespace Quiche { + +Http2String moreCowbell(const Http2String& s) { + return s + " cowbell"; +} + +} // namespace Quiche +} // namespace QuicListeners +} // namespace Extensions +} // namespace Envoy diff --git a/source/extensions/quic_listeners/quiche/dummy.h b/source/extensions/quic_listeners/quiche/dummy.h new file mode 100644 index 0000000000000..620b898c18fb4 --- /dev/null +++ b/source/extensions/quic_listeners/quiche/dummy.h @@ -0,0 +1,15 @@ +#pragma once + +#include "quiche/http2/platform/api/http2_string.h" + +namespace Envoy { +namespace Extensions { +namespace QuicListeners { +namespace Quiche { + +http2::Http2String moreCowbell(const http2::Http2String& s); + +} // namespace Quiche +} // namespace QuicListeners +} // namespace Extensions +} // namespace Envoy diff --git a/source/extensions/quic_listeners/quiche/platform/BUILD b/source/extensions/quic_listeners/quiche/platform/BUILD new file mode 100644 index 0000000000000..6d158e366fa3c --- /dev/null +++ b/source/extensions/quic_listeners/quiche/platform/BUILD @@ -0,0 +1,32 @@ +licenses(["notice"]) # Apache 2 + +load( + "//bazel:envoy_build_system.bzl", + "envoy_cc_library", + "envoy_package", +) + +envoy_package() + +envoy_cc_library( + name = "http2_platform_impl_lib", + hdrs = [ + "http2_arraysize_impl.h", + "http2_bug_tracker_impl.h", + "http2_containers_impl.h", + "http2_estimate_memory_usage_impl.h", + "http2_export_impl.h", + "http2_flag_utils_impl.h", + "http2_flags_impl.h", + "http2_macros_impl.h", + "http2_mock_log_impl.h", + "http2_optional_impl.h", + "http2_ptr_util_impl.h", + "http2_reconstruct_object_impl.h", + "http2_string_impl.h", + "http2_string_piece_impl.h", + "http2_string_utils_impl.h", + "http2_test_helpers_impl.h", + ], + visibility = ["//visibility:public"], +) diff --git a/source/extensions/quic_listeners/quiche/platform/http2_arraysize_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_arraysize_impl.h new file mode 100644 index 0000000000000..2e12c5f9bd3f0 --- /dev/null +++ b/source/extensions/quic_listeners/quiche/platform/http2_arraysize_impl.h @@ -0,0 +1,3 @@ +#pragma once + +#define HTTP2_ARRAYSIZE_IMPL(x) 0 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_bug_tracker_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_bug_tracker_impl.h new file mode 100644 index 0000000000000..930f2f8039cfb --- /dev/null +++ b/source/extensions/quic_listeners/quiche/platform/http2_bug_tracker_impl.h @@ -0,0 +1,5 @@ +#pragma once + +#define HTTP2_BUG_IMPL 0 +#define HTTP2_BUG_IF_IMPL 0 +#define FLAGS_http2_always_log_bugs_for_tests_IMPL 0 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_containers_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_containers_impl.h new file mode 100644 index 0000000000000..3c4a105bf4271 --- /dev/null +++ b/source/extensions/quic_listeners/quiche/platform/http2_containers_impl.h @@ -0,0 +1,8 @@ +#pragma once + +namespace http2 { + +template +class Http2DequeImpl {}; + +} // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_estimate_memory_usage_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_estimate_memory_usage_impl.h new file mode 100644 index 0000000000000..b75121087763c --- /dev/null +++ b/source/extensions/quic_listeners/quiche/platform/http2_estimate_memory_usage_impl.h @@ -0,0 +1,10 @@ +#pragma once + +namespace http2 { + +template +size_t Http2EstimateMemoryUsageImpl(const T& object) { + return 0; +} + +} // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_export_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_export_impl.h new file mode 100644 index 0000000000000..04aae9ac87a80 --- /dev/null +++ b/source/extensions/quic_listeners/quiche/platform/http2_export_impl.h @@ -0,0 +1,4 @@ +#pragma once + +#define HTTP2_EXPORT +#define HTTP2_EXPORT_PRIVATE diff --git a/source/extensions/quic_listeners/quiche/platform/http2_flag_utils_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_flag_utils_impl.h new file mode 100644 index 0000000000000..ecae5d8fadb97 --- /dev/null +++ b/source/extensions/quic_listeners/quiche/platform/http2_flag_utils_impl.h @@ -0,0 +1,3 @@ +#pragma once + +#define HTTP2_RELOADABLE_FLAG_COUNT_IMPL(flag) 0 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_flags_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_flags_impl.h new file mode 100644 index 0000000000000..25dd62cce4b98 --- /dev/null +++ b/source/extensions/quic_listeners/quiche/platform/http2_flags_impl.h @@ -0,0 +1,4 @@ +#pragma once + +#define GetHttp2ReloadableFlagImpl(flag) 0 +#define SetHttp2ReloadableFlagImpl(flag, value) 0 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h new file mode 100644 index 0000000000000..160da9445629b --- /dev/null +++ b/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h @@ -0,0 +1,5 @@ +#pragma once + +#define HTTP2_FALLTHROUGH_IMPL 0 +#define HTTP2_UNREACHABLE_IMPL() 0 +#define HTTP2_DIE_IF_NULL_IMPL(ptr) 0 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_mock_log_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_mock_log_impl.h new file mode 100644 index 0000000000000..6e8d5257b22c4 --- /dev/null +++ b/source/extensions/quic_listeners/quiche/platform/http2_mock_log_impl.h @@ -0,0 +1,5 @@ +#pragma once + +#define CREATE_HTTP2_MOCK_LOG_IMPL(log) 0 +#define EXPECT_HTTP2_LOG_CALL_IMPL(log) 0 +#define EXPECT_HTTP2_LOG_CALL_CONTAINS_IMPL(log, level, content) 0 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_optional_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_optional_impl.h new file mode 100644 index 0000000000000..0809d60c6134c --- /dev/null +++ b/source/extensions/quic_listeners/quiche/platform/http2_optional_impl.h @@ -0,0 +1,8 @@ +#pragma once + +namespace http2 { + +template +class Http2OptionalImpl {}; + +} // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_ptr_util_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_ptr_util_impl.h new file mode 100644 index 0000000000000..eb746cb12afd4 --- /dev/null +++ b/source/extensions/quic_listeners/quiche/platform/http2_ptr_util_impl.h @@ -0,0 +1,10 @@ +#pragma once + +namespace http2 { + +template +std::unique_ptr Http2MakeUniqueImpl(Args&&... args) { + return nullptr; +} + +} // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_reconstruct_object_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_reconstruct_object_impl.h new file mode 100644 index 0000000000000..69f2c5cd035b0 --- /dev/null +++ b/source/extensions/quic_listeners/quiche/platform/http2_reconstruct_object_impl.h @@ -0,0 +1,25 @@ +#pragma once + +namespace http2 { +namespace test { + +void MarkMemoryUninitialized(void* ptr, size_t num_bytes) {} +void MarkMemoryUninitialized(void* ptr, size_t num_bytes, Http2Random* rng) {} + +template +void MarkObjectUninitialized(T* ptr) {} +template +void MarkObjectUninitialized(T* ptr, Http2Random* rng) {} + +template +void MarkArrayUninitialized(T (&array)[N]) {} +template +void MarkArrayUninitialized(T (&array)[N], Http2Random* rng) {} + +template +void Http2ReconstructObjectImpl(T* ptr, Http2Random* rng, Args&&... args) {} +template +void Http2DefaultReconstructObjectImpl(T* ptr, Http2Random* rng) {} + +} // namespace test +} // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_string_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_string_impl.h new file mode 100644 index 0000000000000..b6fc203e2b302 --- /dev/null +++ b/source/extensions/quic_listeners/quiche/platform/http2_string_impl.h @@ -0,0 +1,9 @@ +#pragma once + +#include + +namespace http2 { + +using Http2StringImpl = std::string; + +} // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_string_piece_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_string_piece_impl.h new file mode 100644 index 0000000000000..6e26f8a4c9fb7 --- /dev/null +++ b/source/extensions/quic_listeners/quiche/platform/http2_string_piece_impl.h @@ -0,0 +1,7 @@ +#pragma once + +namespace http2 { + +class Http2StringPieceImpl {}; + +} // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_string_utils_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_string_utils_impl.h new file mode 100644 index 0000000000000..8ee16abaea650 --- /dev/null +++ b/source/extensions/quic_listeners/quiche/platform/http2_string_utils_impl.h @@ -0,0 +1,39 @@ +#pragma once + +namespace http2 { + +template +inline Http2String Http2StrCatImpl(const Args&... args) { + return Http2String(); +} + +template +inline void Http2StrAppendImpl(Http2String* output, const Args&... args) {} + +template +inline Http2String Http2StringPrintfImpl(const Args&... args) { + return Http2String(); +} + +inline Http2String Http2HexEncodeImpl(const void* bytes, size_t size) { + return Http2String(); +} + +inline Http2String Http2HexDecodeImpl(Http2StringPiece data) { + return Http2String(); +} + +inline Http2String Http2HexDumpImpl(Http2StringPiece data) { + return Http2String(); +} + +inline Http2String Http2HexEscapeImpl(Http2StringPiece data) { + return Http2String(); +} + +template +inline Http2String Http2HexImpl(Number number) { + return Http2String(); +} + +} // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_test_helpers_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_test_helpers_impl.h new file mode 100644 index 0000000000000..6f70f09beec22 --- /dev/null +++ b/source/extensions/quic_listeners/quiche/platform/http2_test_helpers_impl.h @@ -0,0 +1 @@ +#pragma once diff --git a/test/extensions/quic_listeners/quiche/BUILD b/test/extensions/quic_listeners/quiche/BUILD new file mode 100644 index 0000000000000..3195a9bff53af --- /dev/null +++ b/test/extensions/quic_listeners/quiche/BUILD @@ -0,0 +1,23 @@ +licenses(["notice"]) # Apache 2 + +load( + "//bazel:envoy_build_system.bzl", + "envoy_cc_fuzz_test", + "envoy_cc_test", + "envoy_cc_test_binary", + "envoy_cc_test_library", + "envoy_package", + "envoy_proto_library", +) + +envoy_package() + +envoy_cc_test( + name = "dummy_test", + srcs = ["dummy_test.cc"], + external_deps = ["quiche_http2_platform"], + deps = [ + "//source/extensions/quic_listeners/quiche:dummy_lib", + "//test/test_common:utility_lib", + ], +) diff --git a/test/extensions/quic_listeners/quiche/dummy_test.cc b/test/extensions/quic_listeners/quiche/dummy_test.cc new file mode 100644 index 0000000000000..1d454c41e6a91 --- /dev/null +++ b/test/extensions/quic_listeners/quiche/dummy_test.cc @@ -0,0 +1,19 @@ +#include "extensions/quic_listeners/quiche/dummy.h" + +#include "gtest/gtest.h" +#include "quiche/http2/platform/api/http2_string.h" + +namespace Envoy { +namespace Extensions { +namespace QuicListeners { +namespace Quiche { + +TEST(DummyTest, Dummy) { + http2::Http2String foo = "bar"; + EXPECT_EQ("bar cowbell", moreCowbell(foo)); +} + +} // namespace Quiche +} // namespace QuicListeners +} // namespace Extensions +} // namespace Envoy From 1d4525539749f342a93a4297622fc400598d1d59 Mon Sep 17 00:00:00 2001 From: Michael Warres Date: Wed, 9 Jan 2019 22:57:22 -0500 Subject: [PATCH 02/11] Address htuch@ review comments. Signed-off-by: Michael Warres --- bazel/repositories.bzl | 8 ++++---- bazel/repository_locations.bzl | 2 +- source/extensions/quic_listeners/quiche/BUILD | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 6728d41d5747a..e181c60902cd2 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -297,7 +297,7 @@ def envoy_dependencies(path = "@envoy_deps//", skip_targets = []): _com_github_tencent_rapidjson() _com_google_googletest() _com_google_protobuf() - _com_google_quiche() + _com_googlesource_quiche() # Used for bundling gcovr into a relocatable .par file. _repository_impl("subpar") @@ -540,14 +540,14 @@ def _com_google_protobuf(): actual = "@com_google_protobuf//util/python:python_headers", ) -def _com_google_quiche(): +def _com_googlesource_quiche(): _repository_impl( - name = "com_google_quiche", + name = "com_googlesource_quiche", build_file = "@envoy//bazel/external:quiche.BUILD", ) native.bind( name = "quiche_http2_platform", - actual = "@com_google_quiche//:http2_platform", + actual = "@com_googlesource_quiche//:http2_platform", ) def _com_github_grpc_grpc(): diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index eb9dd12ea90a1..14e9651b0daa8 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -191,7 +191,7 @@ REPOSITORY_LOCATIONS = dict( strip_prefix = "subpar-1.3.0", urls = ["https://github.com/google/subpar/archive/1.3.0.tar.gz"], ), - com_google_quiche = dict( + com_googlesource_quiche = dict( # Static snapshot of https://quiche.googlesource.com/quiche/+archive/c9b2cecd1d005893114a03c101532017ddfa12cb.tar.gz sha256 = "c8faea835132103d574cc2769a58e244bee3de02669471330a174f2ffae6fcc3", urls = ["https://storage.googleapis.com/quiche-envoy-integration/c9b2cecd1d005893114a03c101532017ddfa12cb.tar.gz"], diff --git a/source/extensions/quic_listeners/quiche/BUILD b/source/extensions/quic_listeners/quiche/BUILD index 3a3b592647f73..da9cbb62cb5e8 100644 --- a/source/extensions/quic_listeners/quiche/BUILD +++ b/source/extensions/quic_listeners/quiche/BUILD @@ -8,6 +8,8 @@ load( envoy_package() +// Placeholder library to verify/illustrate depending on a QUICHE build target. +// TODO(mpwarres): remove once real build rules added here. envoy_cc_library( name = "dummy_lib", srcs = ["dummy.cc"], From 858799188c8de41733e5b788763e83d1ce4504e9 Mon Sep 17 00:00:00 2001 From: Michael Warres Date: Sat, 12 Jan 2019 22:44:03 -0500 Subject: [PATCH 03/11] Apply fix_format changes. Signed-off-by: Michael Warres --- bazel/external/quiche.BUILD | 17 ++++++++-- source/extensions/quic_listeners/quiche/BUILD | 4 +-- .../extensions/quic_listeners/quiche/dummy.cc | 4 +-- .../quiche/platform/http2_arraysize_impl.h | 2 ++ .../quiche/platform/http2_bug_tracker_impl.h | 2 ++ .../quiche/platform/http2_containers_impl.h | 7 +++-- .../http2_estimate_memory_usage_impl.h | 9 +++--- .../quiche/platform/http2_export_impl.h | 2 ++ .../quiche/platform/http2_flag_utils_impl.h | 2 ++ .../quiche/platform/http2_flags_impl.h | 2 ++ .../quiche/platform/http2_macros_impl.h | 2 ++ .../quiche/platform/http2_mock_log_impl.h | 2 ++ .../quiche/platform/http2_optional_impl.h | 7 +++-- .../quiche/platform/http2_ptr_util_impl.h | 7 +++-- .../platform/http2_reconstruct_object_impl.h | 21 ++++++------- .../quiche/platform/http2_string_impl.h | 4 ++- .../quiche/platform/http2_string_piece_impl.h | 4 ++- .../quiche/platform/http2_string_utils_impl.h | 31 ++++++------------- .../quiche/platform/http2_test_helpers_impl.h | 2 ++ 19 files changed, 74 insertions(+), 57 deletions(-) diff --git a/bazel/external/quiche.BUILD b/bazel/external/quiche.BUILD index d70638fd13aa3..6b3ca9d57348b 100644 --- a/bazel/external/quiche.BUILD +++ b/bazel/external/quiche.BUILD @@ -1,3 +1,5 @@ +licenses(["notice"]) # Apache 2 + # Transformations to QUICHE tarball: # - Move subtree under quiche/ base dir, for clarity in #include statements. # - Rewrite include directives for platform/impl files. @@ -9,14 +11,23 @@ # QUICHE platform APIs in //source/extensions/quic_listeners/quiche/platform/, # should remain the same. -src_files = glob(["**/*.h", "**/*.c", "**/*.cc", "**/*.inc", "**/*.proto"]) +src_files = glob([ + "**/*.h", + "**/*.c", + "**/*.cc", + "**/*.inc", + "**/*.proto", +]) genrule( name = "quiche_files", srcs = src_files, outs = ["quiche/" + f for f in src_files], cmd = "\n".join( - ["sed -e '/^#include/ s!net/\(http2\|quic\|spdy\)/platform/impl/!extensions/quic_listeners/quiche/platform/!' $(location %s) > $(location :%s)" % (f, "quiche/" + f) for f in src_files], + ["sed -e '/^#include/ s!net/\(http2\|quic\|spdy\)/platform/impl/!extensions/quic_listeners/quiche/platform/!' $(location %s) > $(location :%s)" % ( + f, + "quiche/" + f, + ) for f in src_files], ), visibility = ["//visibility:private"], ) @@ -29,8 +40,8 @@ cc_library( "quiche/http2/platform/api/http2_containers.h", "quiche/http2/platform/api/http2_estimate_memory_usage.h", "quiche/http2/platform/api/http2_export.h", - "quiche/http2/platform/api/http2_flags.h", "quiche/http2/platform/api/http2_flag_utils.h", + "quiche/http2/platform/api/http2_flags.h", "quiche/http2/platform/api/http2_macros.h", "quiche/http2/platform/api/http2_mock_log.h", "quiche/http2/platform/api/http2_optional.h", diff --git a/source/extensions/quic_listeners/quiche/BUILD b/source/extensions/quic_listeners/quiche/BUILD index da9cbb62cb5e8..17444da358f8c 100644 --- a/source/extensions/quic_listeners/quiche/BUILD +++ b/source/extensions/quic_listeners/quiche/BUILD @@ -8,8 +8,8 @@ load( envoy_package() -// Placeholder library to verify/illustrate depending on a QUICHE build target. -// TODO(mpwarres): remove once real build rules added here. +# Placeholder library to verify/illustrate depending on a QUICHE build target. +# TODO(mpwarres): remove once real build rules added here. envoy_cc_library( name = "dummy_lib", srcs = ["dummy.cc"], diff --git a/source/extensions/quic_listeners/quiche/dummy.cc b/source/extensions/quic_listeners/quiche/dummy.cc index 117564bfd5b50..c94ee584fa466 100644 --- a/source/extensions/quic_listeners/quiche/dummy.cc +++ b/source/extensions/quic_listeners/quiche/dummy.cc @@ -7,9 +7,7 @@ namespace Extensions { namespace QuicListeners { namespace Quiche { -Http2String moreCowbell(const Http2String& s) { - return s + " cowbell"; -} +Http2String moreCowbell(const Http2String& s) { return s + " cowbell"; } } // namespace Quiche } // namespace QuicListeners diff --git a/source/extensions/quic_listeners/quiche/platform/http2_arraysize_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_arraysize_impl.h index 2e12c5f9bd3f0..102df895fc920 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_arraysize_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_arraysize_impl.h @@ -1,3 +1,5 @@ #pragma once +// NOLINT(namespace-envoy) + #define HTTP2_ARRAYSIZE_IMPL(x) 0 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_bug_tracker_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_bug_tracker_impl.h index 930f2f8039cfb..7e6117d27880b 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_bug_tracker_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_bug_tracker_impl.h @@ -1,5 +1,7 @@ #pragma once +// NOLINT(namespace-envoy) + #define HTTP2_BUG_IMPL 0 #define HTTP2_BUG_IF_IMPL 0 #define FLAGS_http2_always_log_bugs_for_tests_IMPL 0 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_containers_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_containers_impl.h index 3c4a105bf4271..0934886f43127 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_containers_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_containers_impl.h @@ -1,8 +1,9 @@ #pragma once +// NOLINT(namespace-envoy) + namespace http2 { -template -class Http2DequeImpl {}; +template class Http2DequeImpl {}; -} // namespace http2 +} // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_estimate_memory_usage_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_estimate_memory_usage_impl.h index b75121087763c..de8e0865db81e 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_estimate_memory_usage_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_estimate_memory_usage_impl.h @@ -1,10 +1,9 @@ #pragma once +// NOLINT(namespace-envoy) + namespace http2 { -template -size_t Http2EstimateMemoryUsageImpl(const T& object) { - return 0; -} +template size_t Http2EstimateMemoryUsageImpl(const T& object) { return 0; } -} // namespace http2 +} // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_export_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_export_impl.h index 04aae9ac87a80..cf916a1a652b7 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_export_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_export_impl.h @@ -1,4 +1,6 @@ #pragma once +// NOLINT(namespace-envoy) + #define HTTP2_EXPORT #define HTTP2_EXPORT_PRIVATE diff --git a/source/extensions/quic_listeners/quiche/platform/http2_flag_utils_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_flag_utils_impl.h index ecae5d8fadb97..68966aa175e47 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_flag_utils_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_flag_utils_impl.h @@ -1,3 +1,5 @@ #pragma once +// NOLINT(namespace-envoy) + #define HTTP2_RELOADABLE_FLAG_COUNT_IMPL(flag) 0 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_flags_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_flags_impl.h index 25dd62cce4b98..2adb6b4d5bf0a 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_flags_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_flags_impl.h @@ -1,4 +1,6 @@ #pragma once +// NOLINT(namespace-envoy) + #define GetHttp2ReloadableFlagImpl(flag) 0 #define SetHttp2ReloadableFlagImpl(flag, value) 0 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h index 160da9445629b..8908255a85f48 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h @@ -1,5 +1,7 @@ #pragma once +// NOLINT(namespace-envoy) + #define HTTP2_FALLTHROUGH_IMPL 0 #define HTTP2_UNREACHABLE_IMPL() 0 #define HTTP2_DIE_IF_NULL_IMPL(ptr) 0 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_mock_log_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_mock_log_impl.h index 6e8d5257b22c4..b8808888dbc23 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_mock_log_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_mock_log_impl.h @@ -1,5 +1,7 @@ #pragma once +// NOLINT(namespace-envoy) + #define CREATE_HTTP2_MOCK_LOG_IMPL(log) 0 #define EXPECT_HTTP2_LOG_CALL_IMPL(log) 0 #define EXPECT_HTTP2_LOG_CALL_CONTAINS_IMPL(log, level, content) 0 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_optional_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_optional_impl.h index 0809d60c6134c..bbf8aa56d626d 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_optional_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_optional_impl.h @@ -1,8 +1,9 @@ #pragma once +// NOLINT(namespace-envoy) + namespace http2 { -template -class Http2OptionalImpl {}; +template class Http2OptionalImpl {}; -} // namespace http2 +} // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_ptr_util_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_ptr_util_impl.h index eb746cb12afd4..b30e07d0cea93 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_ptr_util_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_ptr_util_impl.h @@ -1,10 +1,11 @@ #pragma once +// NOLINT(namespace-envoy) + namespace http2 { -template -std::unique_ptr Http2MakeUniqueImpl(Args&&... args) { +template std::unique_ptr Http2MakeUniqueImpl(Args&&... args) { return nullptr; } -} // namespace http2 +} // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_reconstruct_object_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_reconstruct_object_impl.h index 69f2c5cd035b0..b8da6a136d2ba 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_reconstruct_object_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_reconstruct_object_impl.h @@ -1,25 +1,22 @@ #pragma once +// NOLINT(namespace-envoy) + namespace http2 { namespace test { void MarkMemoryUninitialized(void* ptr, size_t num_bytes) {} void MarkMemoryUninitialized(void* ptr, size_t num_bytes, Http2Random* rng) {} -template -void MarkObjectUninitialized(T* ptr) {} -template -void MarkObjectUninitialized(T* ptr, Http2Random* rng) {} +template void MarkObjectUninitialized(T* ptr) {} +template void MarkObjectUninitialized(T* ptr, Http2Random* rng) {} -template -void MarkArrayUninitialized(T (&array)[N]) {} -template -void MarkArrayUninitialized(T (&array)[N], Http2Random* rng) {} +template void MarkArrayUninitialized(T (&array)[N]) {} +template void MarkArrayUninitialized(T (&array)[N], Http2Random* rng) {} template void Http2ReconstructObjectImpl(T* ptr, Http2Random* rng, Args&&... args) {} -template -void Http2DefaultReconstructObjectImpl(T* ptr, Http2Random* rng) {} +template void Http2DefaultReconstructObjectImpl(T* ptr, Http2Random* rng) {} -} // namespace test -} // namespace http2 +} // namespace test +} // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_string_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_string_impl.h index b6fc203e2b302..b11bba0c13c25 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_string_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_string_impl.h @@ -2,8 +2,10 @@ #include +// NOLINT(namespace-envoy) + namespace http2 { using Http2StringImpl = std::string; -} // namespace http2 +} // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_string_piece_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_string_piece_impl.h index 6e26f8a4c9fb7..bb7fd2e1c0eba 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_string_piece_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_string_piece_impl.h @@ -1,7 +1,9 @@ #pragma once +// NOLINT(namespace-envoy) + namespace http2 { class Http2StringPieceImpl {}; -} // namespace http2 +} // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_string_utils_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_string_utils_impl.h index 8ee16abaea650..bb9588086fb0f 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_string_utils_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_string_utils_impl.h @@ -1,39 +1,28 @@ #pragma once +// NOLINT(namespace-envoy) + namespace http2 { -template -inline Http2String Http2StrCatImpl(const Args&... args) { +template inline Http2String Http2StrCatImpl(const Args&... args) { return Http2String(); } template inline void Http2StrAppendImpl(Http2String* output, const Args&... args) {} -template -inline Http2String Http2StringPrintfImpl(const Args&... args) { +template inline Http2String Http2StringPrintfImpl(const Args&... args) { return Http2String(); } -inline Http2String Http2HexEncodeImpl(const void* bytes, size_t size) { - return Http2String(); -} +inline Http2String Http2HexEncodeImpl(const void* bytes, size_t size) { return Http2String(); } -inline Http2String Http2HexDecodeImpl(Http2StringPiece data) { - return Http2String(); -} +inline Http2String Http2HexDecodeImpl(Http2StringPiece data) { return Http2String(); } -inline Http2String Http2HexDumpImpl(Http2StringPiece data) { - return Http2String(); -} +inline Http2String Http2HexDumpImpl(Http2StringPiece data) { return Http2String(); } -inline Http2String Http2HexEscapeImpl(Http2StringPiece data) { - return Http2String(); -} +inline Http2String Http2HexEscapeImpl(Http2StringPiece data) { return Http2String(); } -template -inline Http2String Http2HexImpl(Number number) { - return Http2String(); -} +template inline Http2String Http2HexImpl(Number number) { return Http2String(); } -} // namespace http2 +} // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_test_helpers_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_test_helpers_impl.h index 6f70f09beec22..9e8d0338597bd 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_test_helpers_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_test_helpers_impl.h @@ -1 +1,3 @@ #pragma once + +// NOLINT(namespace-envoy) From afde556a0bb66e418abbfae87afec63164267022 Mon Sep 17 00:00:00 2001 From: Michael Warres Date: Sun, 13 Jan 2019 23:30:26 -0500 Subject: [PATCH 04/11] Fix clang-tidy errors. Signed-off-by: Michael Warres --- .../http2_estimate_memory_usage_impl.h | 4 +- .../quiche/platform/http2_ptr_util_impl.h | 4 +- .../platform/http2_reconstruct_object_impl.h | 20 ++++++---- .../quiche/platform/http2_string_utils_impl.h | 40 ++++++++++++++----- 4 files changed, 48 insertions(+), 20 deletions(-) diff --git a/source/extensions/quic_listeners/quiche/platform/http2_estimate_memory_usage_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_estimate_memory_usage_impl.h index de8e0865db81e..37ca31999caff 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_estimate_memory_usage_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_estimate_memory_usage_impl.h @@ -1,9 +1,11 @@ #pragma once +#include + // NOLINT(namespace-envoy) namespace http2 { -template size_t Http2EstimateMemoryUsageImpl(const T& object) { return 0; } +template size_t Http2EstimateMemoryUsageImpl(const T& /*object*/) { return 0; } } // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_ptr_util_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_ptr_util_impl.h index b30e07d0cea93..e9bba4254cb34 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_ptr_util_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_ptr_util_impl.h @@ -1,10 +1,12 @@ #pragma once +#include + // NOLINT(namespace-envoy) namespace http2 { -template std::unique_ptr Http2MakeUniqueImpl(Args&&... args) { +template std::unique_ptr Http2MakeUniqueImpl(Args&&... /*args*/) { return nullptr; } diff --git a/source/extensions/quic_listeners/quiche/platform/http2_reconstruct_object_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_reconstruct_object_impl.h index b8da6a136d2ba..12cfa8d75f480 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_reconstruct_object_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_reconstruct_object_impl.h @@ -1,22 +1,26 @@ #pragma once +#include + // NOLINT(namespace-envoy) namespace http2 { namespace test { -void MarkMemoryUninitialized(void* ptr, size_t num_bytes) {} -void MarkMemoryUninitialized(void* ptr, size_t num_bytes, Http2Random* rng) {} +class Http2Random; + +void MarkMemoryUninitialized(void* /*ptr*/, size_t /*num_bytes*/) {} +void MarkMemoryUninitialized(void* /*ptr*/, size_t /*num_bytes*/, Http2Random* /*rng*/) {} -template void MarkObjectUninitialized(T* ptr) {} -template void MarkObjectUninitialized(T* ptr, Http2Random* rng) {} +template void MarkObjectUninitialized(T* /*ptr*/) {} +template void MarkObjectUninitialized(T* /*ptr*/, Http2Random* /*rng*/) {} -template void MarkArrayUninitialized(T (&array)[N]) {} -template void MarkArrayUninitialized(T (&array)[N], Http2Random* rng) {} +template void MarkArrayUninitialized(T (&/*array*/)[N]) {} +template void MarkArrayUninitialized(T (&/*array*/)[N], Http2Random* /*rng*/) {} template -void Http2ReconstructObjectImpl(T* ptr, Http2Random* rng, Args&&... args) {} -template void Http2DefaultReconstructObjectImpl(T* ptr, Http2Random* rng) {} +void Http2ReconstructObjectImpl(T* /*ptr*/, Http2Random* /*rng*/, Args&&... /*args*/) {} +template void Http2DefaultReconstructObjectImpl(T* /*ptr*/, Http2Random* /*rng*/) {} } // namespace test } // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_string_utils_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_string_utils_impl.h index bb9588086fb0f..f450e02ecec87 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_string_utils_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_string_utils_impl.h @@ -1,28 +1,48 @@ #pragma once +#include + +// The following includes should be: +// +// #include "extensions/quic_listeners/quiche/platform/http2_string_impl.h" +// #include "extensions/quic_listeners/quiche/platform/http2_string_piece_impl.h" +// +// However, for some reason, bazel.clang_tidy cannot resolve the files when specified this way. +// TODO(mpw): fix includes to use full paths. +#include "http2_string_impl.h" +#include "http2_string_piece_impl.h" + // NOLINT(namespace-envoy) namespace http2 { -template inline Http2String Http2StrCatImpl(const Args&... args) { - return Http2String(); +template inline Http2StringImpl Http2StrCatImpl(const Args&... /*args*/) { + return Http2StringImpl(); } template -inline void Http2StrAppendImpl(Http2String* output, const Args&... args) {} +inline void Http2StrAppendImpl(Http2StringImpl* /*output*/, const Args&... /*args*/) {} -template inline Http2String Http2StringPrintfImpl(const Args&... args) { - return Http2String(); +template inline Http2StringImpl Http2StringPrintfImpl(const Args&... /*args*/) { + return Http2StringImpl(); } -inline Http2String Http2HexEncodeImpl(const void* bytes, size_t size) { return Http2String(); } +inline Http2StringImpl Http2HexEncodeImpl(const void* /*bytes*/, size_t /*size*/) { + return Http2StringImpl(); +} -inline Http2String Http2HexDecodeImpl(Http2StringPiece data) { return Http2String(); } +inline Http2StringImpl Http2HexDecodeImpl(Http2StringPieceImpl /*data*/) { + return Http2StringImpl(); +} -inline Http2String Http2HexDumpImpl(Http2StringPiece data) { return Http2String(); } +inline Http2StringImpl Http2HexDumpImpl(Http2StringPieceImpl /*data*/) { return Http2StringImpl(); } -inline Http2String Http2HexEscapeImpl(Http2StringPiece data) { return Http2String(); } +inline Http2StringImpl Http2HexEscapeImpl(Http2StringPieceImpl /*data*/) { + return Http2StringImpl(); +} -template inline Http2String Http2HexImpl(Number number) { return Http2String(); } +template inline Http2StringImpl Http2HexImpl(Number /*number*/) { + return Http2StringImpl(); +} } // namespace http2 From 02219bad212954afe35d4abc87936a253f5b8214 Mon Sep 17 00:00:00 2001 From: Michael Warres Date: Mon, 14 Jan 2019 08:38:36 -0500 Subject: [PATCH 05/11] Fix mac ci failure caused by differences in OS X version of sed. Signed-off-by: Michael Warres --- bazel/external/quiche.BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bazel/external/quiche.BUILD b/bazel/external/quiche.BUILD index 6b3ca9d57348b..51da3c2414b23 100644 --- a/bazel/external/quiche.BUILD +++ b/bazel/external/quiche.BUILD @@ -24,7 +24,7 @@ genrule( srcs = src_files, outs = ["quiche/" + f for f in src_files], cmd = "\n".join( - ["sed -e '/^#include/ s!net/\(http2\|quic\|spdy\)/platform/impl/!extensions/quic_listeners/quiche/platform/!' $(location %s) > $(location :%s)" % ( + ["sed -e '/^#include/ s!net/[^/]*/platform/impl/!extensions/quic_listeners/quiche/platform/!' $(location %s) > $(location :%s)" % ( f, "quiche/" + f, ) for f in src_files], From 90a5c018b172addc3e088c11f6ab137f1f5a5f47 Mon Sep 17 00:00:00 2001 From: Michael Warres Date: Mon, 14 Jan 2019 17:37:38 -0500 Subject: [PATCH 06/11] Add explanatory comments to quiche.BUILD, along with misc TODOs. Signed-off-by: Michael Warres --- bazel/external/quiche.BUILD | 31 +++++++++++++++++++++++++------ bazel/repositories.bzl | 3 +++ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/bazel/external/quiche.BUILD b/bazel/external/quiche.BUILD index 51da3c2414b23..04a3870226063 100644 --- a/bazel/external/quiche.BUILD +++ b/bazel/external/quiche.BUILD @@ -1,15 +1,32 @@ licenses(["notice"]) # Apache 2 -# Transformations to QUICHE tarball: +# QUICHE is Google's implementation of QUIC and related protocols. It is the +# same code used in Chromium and Google's servers, but packaged in a form that +# is intended to be easier to incorporate into third-party projects. +# +# QUICHE code falls into three groups: +# 1. Platform-independent code. Most QUICHE code is in this category. +# 2. APIs and type aliases to platform-dependent code/types, referenced by code +# in group 1. This group is called the "Platform API". +# 3. Definitions of types declared in group 2. This group is called the +# "Platform impl", and must be provided by the codebase that embeds QUICHE. +# +# Concretely, header files in group 2 (the Platform API) #include header and +# source files in group 3 (the Platform impl). Unfortunately, QUICHE does not +# yet provide a built-in way to customize this dependency, e.g. to override the +# directory or namespace in which Platform impl types are defined. Hence the +# gross hacks in this file. +# +# Transformations to QUICHE tarball performed here: # - Move subtree under quiche/ base dir, for clarity in #include statements. # - Rewrite include directives for platform/impl files. # -# The mechanics of this are likely to change as QUICHE evolves, supplies its own -# Bazel buildfiles, and perhaps provides a more graceful way to override -# platform impl directory location. However, the end result (QUICHE files placed -# under quiche/{http2,quic,spdy}/, with the Envoy-specific implementation of the +# The mechanics of this will change as QUICHE evolves, supplies its own Bazel +# buildfiles, and provides a built-in way to override platform impl directory +# location. However, the end result (QUICHE files placed under +# quiche/{http2,quic,spdy}/, with the Envoy-specific implementation of the # QUICHE platform APIs in //source/extensions/quic_listeners/quiche/platform/, -# should remain the same. +# should remain largely the same. src_files = glob([ "**/*.h", @@ -19,6 +36,8 @@ src_files = glob([ "**/*.proto", ]) +# TODO(mpwarres): remove use of sed once QUICHE provides a cleaner way to +# override platform impl directory location. genrule( name = "quiche_files", srcs = src_files, diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index e181c60902cd2..30d06737bd8c9 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -545,6 +545,9 @@ def _com_googlesource_quiche(): name = "com_googlesource_quiche", build_file = "@envoy//bazel/external:quiche.BUILD", ) + + # TODO: add bindings for quiche_quic_platform and quiche_spdy_platform once + # those build targets have been defined. native.bind( name = "quiche_http2_platform", actual = "@com_googlesource_quiche//:http2_platform", From 09a72b8af94f58e754c40755a2832523c4bb5c91 Mon Sep 17 00:00:00 2001 From: Michael Warres Date: Mon, 14 Jan 2019 17:39:05 -0500 Subject: [PATCH 07/11] Flesh out QUICHE http2 platform impls. For the impl files that are trivially implemented, add the implementation. For the impl files that require more work, add TODO comments. Signed-off-by: Michael Warres --- .../extensions/quic_listeners/quiche/dummy.cc | 2 ++ source/extensions/quic_listeners/quiche/dummy.h | 2 ++ .../quic_listeners/quiche/platform/BUILD | 8 ++++++++ .../quiche/platform/http2_arraysize_impl.h | 4 +++- .../quiche/platform/http2_bug_tracker_impl.h | 2 ++ .../quiche/platform/http2_containers_impl.h | 4 +++- .../quiche/platform/http2_flag_utils_impl.h | 4 +++- .../quiche/platform/http2_flags_impl.h | 2 ++ .../quiche/platform/http2_macros_impl.h | 10 +++++++--- .../quiche/platform/http2_mock_log_impl.h | 2 ++ .../quiche/platform/http2_optional_impl.h | 4 +++- .../quiche/platform/http2_ptr_util_impl.h | 5 +++-- .../platform/http2_reconstruct_object_impl.h | 2 ++ .../quiche/platform/http2_string_piece_impl.h | 4 +++- .../quiche/platform/http2_string_utils_impl.h | 2 ++ .../quiche/platform/http2_test_helpers_impl.h | 17 +++++++++++++++++ 16 files changed, 64 insertions(+), 10 deletions(-) diff --git a/source/extensions/quic_listeners/quiche/dummy.cc b/source/extensions/quic_listeners/quiche/dummy.cc index c94ee584fa466..f09ec04b42bc3 100644 --- a/source/extensions/quic_listeners/quiche/dummy.cc +++ b/source/extensions/quic_listeners/quiche/dummy.cc @@ -7,6 +7,8 @@ namespace Extensions { namespace QuicListeners { namespace Quiche { +// Placeholder use of a QUICHE platform type. +// TODO(mpwarres): remove once real uses of QUICHE platform added. Http2String moreCowbell(const Http2String& s) { return s + " cowbell"; } } // namespace Quiche diff --git a/source/extensions/quic_listeners/quiche/dummy.h b/source/extensions/quic_listeners/quiche/dummy.h index 620b898c18fb4..c57b89486de3f 100644 --- a/source/extensions/quic_listeners/quiche/dummy.h +++ b/source/extensions/quic_listeners/quiche/dummy.h @@ -7,6 +7,8 @@ namespace Extensions { namespace QuicListeners { namespace Quiche { +// Placeholder use of a QUICHE platform type. +// TODO(mpwarres): remove once real uses of QUICHE platform added. http2::Http2String moreCowbell(const http2::Http2String& s); } // namespace Quiche diff --git a/source/extensions/quic_listeners/quiche/platform/BUILD b/source/extensions/quic_listeners/quiche/platform/BUILD index 6d158e366fa3c..94d318665c140 100644 --- a/source/extensions/quic_listeners/quiche/platform/BUILD +++ b/source/extensions/quic_listeners/quiche/platform/BUILD @@ -8,6 +8,9 @@ load( envoy_package() +# TODO: add build targets for quic_platform_impl_lib and spdy_platform_impl_lib, +# as _impl.* files for those are added. + envoy_cc_library( name = "http2_platform_impl_lib", hdrs = [ @@ -28,5 +31,10 @@ envoy_cc_library( "http2_string_utils_impl.h", "http2_test_helpers_impl.h", ], + external_deps = [ + "abseil_base", + "abseil_optional", + ], visibility = ["//visibility:public"], + deps = ["//source/common/common:assert_lib"], ) diff --git a/source/extensions/quic_listeners/quiche/platform/http2_arraysize_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_arraysize_impl.h index 102df895fc920..b2e8d417240e5 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_arraysize_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_arraysize_impl.h @@ -1,5 +1,7 @@ #pragma once +#include "absl/base/macros.h" + // NOLINT(namespace-envoy) -#define HTTP2_ARRAYSIZE_IMPL(x) 0 +#define HTTP2_ARRAYSIZE_IMPL(x) ABSL_ARRAYSIZE(x) diff --git a/source/extensions/quic_listeners/quiche/platform/http2_bug_tracker_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_bug_tracker_impl.h index 7e6117d27880b..06facd7a97d45 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_bug_tracker_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_bug_tracker_impl.h @@ -2,6 +2,8 @@ // NOLINT(namespace-envoy) +// TODO: implement + #define HTTP2_BUG_IMPL 0 #define HTTP2_BUG_IF_IMPL 0 #define FLAGS_http2_always_log_bugs_for_tests_IMPL 0 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_containers_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_containers_impl.h index 0934886f43127..3e813e0acf3c6 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_containers_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_containers_impl.h @@ -1,9 +1,11 @@ #pragma once +#include + // NOLINT(namespace-envoy) namespace http2 { -template class Http2DequeImpl {}; +template using Http2DequeImpl = std::deque; } // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_flag_utils_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_flag_utils_impl.h index 68966aa175e47..e1ce754d211ea 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_flag_utils_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_flag_utils_impl.h @@ -2,4 +2,6 @@ // NOLINT(namespace-envoy) -#define HTTP2_RELOADABLE_FLAG_COUNT_IMPL(flag) 0 +#define HTTP2_RELOADABLE_FLAG_COUNT_IMPL(flag) \ + do { \ + } while (0) diff --git a/source/extensions/quic_listeners/quiche/platform/http2_flags_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_flags_impl.h index 2adb6b4d5bf0a..fbfe139b1e774 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_flags_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_flags_impl.h @@ -2,5 +2,7 @@ // NOLINT(namespace-envoy) +// TODO: implement + #define GetHttp2ReloadableFlagImpl(flag) 0 #define SetHttp2ReloadableFlagImpl(flag, value) 0 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h index 8908255a85f48..e35039931a7ba 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h @@ -1,7 +1,11 @@ #pragma once +#include "common/common/assert.h" + +#include "absl/base/macros.h" + // NOLINT(namespace-envoy) -#define HTTP2_FALLTHROUGH_IMPL 0 -#define HTTP2_UNREACHABLE_IMPL() 0 -#define HTTP2_DIE_IF_NULL_IMPL(ptr) 0 +#define HTTP2_FALLTHROUGH_IMPL ABSL_FALLTHROUGH_INTENDED +#define HTTP2_UNREACHABLE_IMPL() NOT_REACHED_GCOVR_EXCL_LINE +#define HTTP2_DIE_IF_NULL_IMPL(ptr) ABSL_DIE_IF_NULL(ptr) diff --git a/source/extensions/quic_listeners/quiche/platform/http2_mock_log_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_mock_log_impl.h index b8808888dbc23..e686d2f0d5464 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_mock_log_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_mock_log_impl.h @@ -2,6 +2,8 @@ // NOLINT(namespace-envoy) +// TODO: implement + #define CREATE_HTTP2_MOCK_LOG_IMPL(log) 0 #define EXPECT_HTTP2_LOG_CALL_IMPL(log) 0 #define EXPECT_HTTP2_LOG_CALL_CONTAINS_IMPL(log, level, content) 0 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_optional_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_optional_impl.h index bbf8aa56d626d..aacaae176fa76 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_optional_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_optional_impl.h @@ -1,9 +1,11 @@ #pragma once +#include "absl/types/optional.h" + // NOLINT(namespace-envoy) namespace http2 { -template class Http2OptionalImpl {}; +template using Http2OptionalImpl = absl::optional; } // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_ptr_util_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_ptr_util_impl.h index e9bba4254cb34..6bc4edcde5b80 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_ptr_util_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_ptr_util_impl.h @@ -1,13 +1,14 @@ #pragma once #include +#include // NOLINT(namespace-envoy) namespace http2 { -template std::unique_ptr Http2MakeUniqueImpl(Args&&... /*args*/) { - return nullptr; +template std::unique_ptr Http2MakeUniqueImpl(Args&&... args) { + return std::make_unique(std::forward(args)...); } } // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_reconstruct_object_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_reconstruct_object_impl.h index 12cfa8d75f480..a159472aa3483 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_reconstruct_object_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_reconstruct_object_impl.h @@ -4,6 +4,8 @@ // NOLINT(namespace-envoy) +// TODO: implement + namespace http2 { namespace test { diff --git a/source/extensions/quic_listeners/quiche/platform/http2_string_piece_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_string_piece_impl.h index bb7fd2e1c0eba..1500e8099ae0b 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_string_piece_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_string_piece_impl.h @@ -1,9 +1,11 @@ #pragma once +#include "absl/strings/string_view.h" + // NOLINT(namespace-envoy) namespace http2 { -class Http2StringPieceImpl {}; +class Http2StringPieceImpl = absl::string_view; } // namespace http2 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_string_utils_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_string_utils_impl.h index f450e02ecec87..ff0a250ae6b23 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_string_utils_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_string_utils_impl.h @@ -14,6 +14,8 @@ // NOLINT(namespace-envoy) +// TODO: implement + namespace http2 { template inline Http2StringImpl Http2StrCatImpl(const Args&... /*args*/) { diff --git a/source/extensions/quic_listeners/quiche/platform/http2_test_helpers_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_test_helpers_impl.h index 9e8d0338597bd..c155210a796d6 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_test_helpers_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_test_helpers_impl.h @@ -1,3 +1,20 @@ #pragma once // NOLINT(namespace-envoy) + +// TODO: implement + +#define VERIFY_AND_RETURN_SUCCESS(expression) 0 +#define VERIFY_TRUE(condition) 0 +#define VERIFY_FALSE(condition) 0 +#define VERIFY_THAT(value, matcher) 0 +#define VERIFY_EQ(val1, val2) 0 +#define VERIFY_NE(val1, val2) 0 +#define VERIFY_GT(val1, val2) 0 +#define VERIFY_LT(val1, val2) 0 +#define VERIFY_GE(val1, val2) 0 +#define VERIFY_LE(val1, val2) 0 +#define VERIFY_DOUBLE_EQ(val1, val2) 0 +#define VERIFY_OK(statement) 0 +#define VERIFY_OK_AND_ASSIGN(var, expression) 0 +#define VERIFY_SUCCESS(expr) 0 From d011bcb6886eb41d7e3bd431673511601dbd62e2 Mon Sep 17 00:00:00 2001 From: Michael Warres Date: Tue, 15 Jan 2019 11:04:26 -0500 Subject: [PATCH 08/11] Resolve ODR violations by removing dependency on Envoy assert_lib. Signed-off-by: Michael Warres --- source/extensions/quic_listeners/quiche/platform/BUILD | 1 - .../quic_listeners/quiche/platform/http2_macros_impl.h | 6 +++--- .../quiche/platform/http2_string_piece_impl.h | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/source/extensions/quic_listeners/quiche/platform/BUILD b/source/extensions/quic_listeners/quiche/platform/BUILD index 94d318665c140..8c8cbc4f35b0a 100644 --- a/source/extensions/quic_listeners/quiche/platform/BUILD +++ b/source/extensions/quic_listeners/quiche/platform/BUILD @@ -36,5 +36,4 @@ envoy_cc_library( "abseil_optional", ], visibility = ["//visibility:public"], - deps = ["//source/common/common:assert_lib"], ) diff --git a/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h index e35039931a7ba..2d3f25de024ad 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h @@ -1,11 +1,11 @@ #pragma once -#include "common/common/assert.h" - #include "absl/base/macros.h" // NOLINT(namespace-envoy) #define HTTP2_FALLTHROUGH_IMPL ABSL_FALLTHROUGH_INTENDED -#define HTTP2_UNREACHABLE_IMPL() NOT_REACHED_GCOVR_EXCL_LINE #define HTTP2_DIE_IF_NULL_IMPL(ptr) ABSL_DIE_IF_NULL(ptr) + +// TODO: implement +#define HTTP2_UNREACHABLE_IMPL() NOT_REACHED_GCOVR_EXCL_LINE diff --git a/source/extensions/quic_listeners/quiche/platform/http2_string_piece_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_string_piece_impl.h index 1500e8099ae0b..7746dcd101447 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_string_piece_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_string_piece_impl.h @@ -6,6 +6,6 @@ namespace http2 { -class Http2StringPieceImpl = absl::string_view; +using Http2StringPieceImpl = absl::string_view; } // namespace http2 From ef361ef999beecef75ff15572f4dbfdce5f1a059 Mon Sep 17 00:00:00 2001 From: Michael Warres Date: Tue, 15 Jan 2019 16:14:50 -0500 Subject: [PATCH 09/11] Tweak quiche.BUILD deps clause to allow QUICHE dependency on Envoy build targets. Signed-off-by: Michael Warres --- bazel/external/quiche.BUILD | 9 ++++++++- source/extensions/quic_listeners/quiche/platform/BUILD | 1 + .../quic_listeners/quiche/platform/http2_macros_impl.h | 6 +++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/bazel/external/quiche.BUILD b/bazel/external/quiche.BUILD index 04a3870226063..8e50f4b19d007 100644 --- a/bazel/external/quiche.BUILD +++ b/bazel/external/quiche.BUILD @@ -51,6 +51,13 @@ genrule( visibility = ["//visibility:private"], ) +# Note: in dependencies below that reference Envoy build targets in the main +# repository (particularly for QUICHE platform libs), use '@' instead of +# '@envoy' as the repository identifier. Otherwise, Bazel generates duplicate +# object files for the same build target (one under +# bazel-out/.../bin/external/, and one under bazel-out/.../bin/), eventually +# resulting in link-time errors. + cc_library( name = "http2_platform", hdrs = [ @@ -73,6 +80,6 @@ cc_library( ], visibility = ["//visibility:public"], deps = [ - "@envoy//source/extensions/quic_listeners/quiche/platform:http2_platform_impl_lib", + "@//source/extensions/quic_listeners/quiche/platform:http2_platform_impl_lib", ], ) diff --git a/source/extensions/quic_listeners/quiche/platform/BUILD b/source/extensions/quic_listeners/quiche/platform/BUILD index 8c8cbc4f35b0a..94d318665c140 100644 --- a/source/extensions/quic_listeners/quiche/platform/BUILD +++ b/source/extensions/quic_listeners/quiche/platform/BUILD @@ -36,4 +36,5 @@ envoy_cc_library( "abseil_optional", ], visibility = ["//visibility:public"], + deps = ["//source/common/common:assert_lib"], ) diff --git a/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h index 2d3f25de024ad..e35039931a7ba 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h @@ -1,11 +1,11 @@ #pragma once +#include "common/common/assert.h" + #include "absl/base/macros.h" // NOLINT(namespace-envoy) #define HTTP2_FALLTHROUGH_IMPL ABSL_FALLTHROUGH_INTENDED -#define HTTP2_DIE_IF_NULL_IMPL(ptr) ABSL_DIE_IF_NULL(ptr) - -// TODO: implement #define HTTP2_UNREACHABLE_IMPL() NOT_REACHED_GCOVR_EXCL_LINE +#define HTTP2_DIE_IF_NULL_IMPL(ptr) ABSL_DIE_IF_NULL(ptr) From b27d83ab350f62f763ae754603ea6b33d8a6e96d Mon Sep 17 00:00:00 2001 From: Michael Warres Date: Thu, 17 Jan 2019 09:13:01 -0500 Subject: [PATCH 10/11] Remove QUICHE dependency on Envoy build target until Bazel fix is released. Signed-off-by: Michael Warres --- bazel/external/quiche.BUILD | 2 +- source/extensions/quic_listeners/quiche/platform/BUILD | 1 - .../quic_listeners/quiche/platform/http2_macros_impl.h | 6 +++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bazel/external/quiche.BUILD b/bazel/external/quiche.BUILD index 8e50f4b19d007..d2c138a742a3e 100644 --- a/bazel/external/quiche.BUILD +++ b/bazel/external/quiche.BUILD @@ -80,6 +80,6 @@ cc_library( ], visibility = ["//visibility:public"], deps = [ - "@//source/extensions/quic_listeners/quiche/platform:http2_platform_impl_lib", + "@envoy//source/extensions/quic_listeners/quiche/platform:http2_platform_impl_lib", ], ) diff --git a/source/extensions/quic_listeners/quiche/platform/BUILD b/source/extensions/quic_listeners/quiche/platform/BUILD index 94d318665c140..8c8cbc4f35b0a 100644 --- a/source/extensions/quic_listeners/quiche/platform/BUILD +++ b/source/extensions/quic_listeners/quiche/platform/BUILD @@ -36,5 +36,4 @@ envoy_cc_library( "abseil_optional", ], visibility = ["//visibility:public"], - deps = ["//source/common/common:assert_lib"], ) diff --git a/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h index e35039931a7ba..1e6c61ccf6b4e 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h @@ -1,11 +1,11 @@ #pragma once -#include "common/common/assert.h" - #include "absl/base/macros.h" // NOLINT(namespace-envoy) #define HTTP2_FALLTHROUGH_IMPL ABSL_FALLTHROUGH_INTENDED -#define HTTP2_UNREACHABLE_IMPL() NOT_REACHED_GCOVR_EXCL_LINE #define HTTP2_DIE_IF_NULL_IMPL(ptr) ABSL_DIE_IF_NULL(ptr) + +// TODO: implement +#define HTTP2_UNREACHABLE_IMPL() 0 From 713eb9fee5540a59578e1ca969fba347142db9ec Mon Sep 17 00:00:00 2001 From: Michael Warres Date: Thu, 17 Jan 2019 10:54:19 -0500 Subject: [PATCH 11/11] Add comments that QUICHE platform files should not be used directly by Envoy code. Signed-off-by: Michael Warres --- source/extensions/quic_listeners/quiche/platform/BUILD | 6 ++++++ .../quic_listeners/quiche/platform/http2_arraysize_impl.h | 4 ++++ .../quic_listeners/quiche/platform/http2_bug_tracker_impl.h | 4 ++++ .../quic_listeners/quiche/platform/http2_containers_impl.h | 4 ++++ .../quiche/platform/http2_estimate_memory_usage_impl.h | 4 ++++ .../quic_listeners/quiche/platform/http2_export_impl.h | 4 ++++ .../quic_listeners/quiche/platform/http2_flag_utils_impl.h | 4 ++++ .../quic_listeners/quiche/platform/http2_flags_impl.h | 4 ++++ .../quic_listeners/quiche/platform/http2_macros_impl.h | 4 ++++ .../quic_listeners/quiche/platform/http2_mock_log_impl.h | 4 ++++ .../quic_listeners/quiche/platform/http2_optional_impl.h | 4 ++++ .../quic_listeners/quiche/platform/http2_ptr_util_impl.h | 4 ++++ .../quiche/platform/http2_reconstruct_object_impl.h | 4 ++++ .../quic_listeners/quiche/platform/http2_string_impl.h | 4 ++++ .../quiche/platform/http2_string_piece_impl.h | 4 ++++ .../quiche/platform/http2_string_utils_impl.h | 4 ++++ .../quiche/platform/http2_test_helpers_impl.h | 4 ++++ 17 files changed, 70 insertions(+) diff --git a/source/extensions/quic_listeners/quiche/platform/BUILD b/source/extensions/quic_listeners/quiche/platform/BUILD index 8c8cbc4f35b0a..693bbeae24433 100644 --- a/source/extensions/quic_listeners/quiche/platform/BUILD +++ b/source/extensions/quic_listeners/quiche/platform/BUILD @@ -8,6 +8,12 @@ load( envoy_package() +# Build targets in this package are part of the QUICHE platform implementation, +# are are not to be consumed or referenced directly by other Envoy code. The +# only consumers should be build rules under @com_googlesource_quiche//..., and +# tests. In a monorepo, this would be enforced via visibility attribute, but +# Bazel does not support limiting visibility to specific external dependencies. + # TODO: add build targets for quic_platform_impl_lib and spdy_platform_impl_lib, # as _impl.* files for those are added. diff --git a/source/extensions/quic_listeners/quiche/platform/http2_arraysize_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_arraysize_impl.h index b2e8d417240e5..edeaf02f108dd 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_arraysize_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_arraysize_impl.h @@ -4,4 +4,8 @@ // NOLINT(namespace-envoy) +// This file is part of the QUICHE platform implementation, and is not to be +// consumed or referenced directly by other Envoy code. It serves purely as a +// porting layer for QUICHE. + #define HTTP2_ARRAYSIZE_IMPL(x) ABSL_ARRAYSIZE(x) diff --git a/source/extensions/quic_listeners/quiche/platform/http2_bug_tracker_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_bug_tracker_impl.h index 06facd7a97d45..e346ce2b7f266 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_bug_tracker_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_bug_tracker_impl.h @@ -2,6 +2,10 @@ // NOLINT(namespace-envoy) +// This file is part of the QUICHE platform implementation, and is not to be +// consumed or referenced directly by other Envoy code. It serves purely as a +// porting layer for QUICHE. + // TODO: implement #define HTTP2_BUG_IMPL 0 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_containers_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_containers_impl.h index 3e813e0acf3c6..e43ec40bfc13a 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_containers_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_containers_impl.h @@ -4,6 +4,10 @@ // NOLINT(namespace-envoy) +// This file is part of the QUICHE platform implementation, and is not to be +// consumed or referenced directly by other Envoy code. It serves purely as a +// porting layer for QUICHE. + namespace http2 { template using Http2DequeImpl = std::deque; diff --git a/source/extensions/quic_listeners/quiche/platform/http2_estimate_memory_usage_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_estimate_memory_usage_impl.h index 37ca31999caff..7f7617f53b290 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_estimate_memory_usage_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_estimate_memory_usage_impl.h @@ -4,6 +4,10 @@ // NOLINT(namespace-envoy) +// This file is part of the QUICHE platform implementation, and is not to be +// consumed or referenced directly by other Envoy code. It serves purely as a +// porting layer for QUICHE. + namespace http2 { template size_t Http2EstimateMemoryUsageImpl(const T& /*object*/) { return 0; } diff --git a/source/extensions/quic_listeners/quiche/platform/http2_export_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_export_impl.h index cf916a1a652b7..802f6fb591fd1 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_export_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_export_impl.h @@ -2,5 +2,9 @@ // NOLINT(namespace-envoy) +// This file is part of the QUICHE platform implementation, and is not to be +// consumed or referenced directly by other Envoy code. It serves purely as a +// porting layer for QUICHE. + #define HTTP2_EXPORT #define HTTP2_EXPORT_PRIVATE diff --git a/source/extensions/quic_listeners/quiche/platform/http2_flag_utils_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_flag_utils_impl.h index e1ce754d211ea..550b91951484e 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_flag_utils_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_flag_utils_impl.h @@ -2,6 +2,10 @@ // NOLINT(namespace-envoy) +// This file is part of the QUICHE platform implementation, and is not to be +// consumed or referenced directly by other Envoy code. It serves purely as a +// porting layer for QUICHE. + #define HTTP2_RELOADABLE_FLAG_COUNT_IMPL(flag) \ do { \ } while (0) diff --git a/source/extensions/quic_listeners/quiche/platform/http2_flags_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_flags_impl.h index fbfe139b1e774..d7c503ed95953 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_flags_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_flags_impl.h @@ -2,6 +2,10 @@ // NOLINT(namespace-envoy) +// This file is part of the QUICHE platform implementation, and is not to be +// consumed or referenced directly by other Envoy code. It serves purely as a +// porting layer for QUICHE. + // TODO: implement #define GetHttp2ReloadableFlagImpl(flag) 0 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h index 1e6c61ccf6b4e..3d7df5563e9f1 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_macros_impl.h @@ -4,6 +4,10 @@ // NOLINT(namespace-envoy) +// This file is part of the QUICHE platform implementation, and is not to be +// consumed or referenced directly by other Envoy code. It serves purely as a +// porting layer for QUICHE. + #define HTTP2_FALLTHROUGH_IMPL ABSL_FALLTHROUGH_INTENDED #define HTTP2_DIE_IF_NULL_IMPL(ptr) ABSL_DIE_IF_NULL(ptr) diff --git a/source/extensions/quic_listeners/quiche/platform/http2_mock_log_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_mock_log_impl.h index e686d2f0d5464..1a5518165e586 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_mock_log_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_mock_log_impl.h @@ -2,6 +2,10 @@ // NOLINT(namespace-envoy) +// This file is part of the QUICHE platform implementation, and is not to be +// consumed or referenced directly by other Envoy code. It serves purely as a +// porting layer for QUICHE. + // TODO: implement #define CREATE_HTTP2_MOCK_LOG_IMPL(log) 0 diff --git a/source/extensions/quic_listeners/quiche/platform/http2_optional_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_optional_impl.h index aacaae176fa76..5f1cd8b30b952 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_optional_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_optional_impl.h @@ -4,6 +4,10 @@ // NOLINT(namespace-envoy) +// This file is part of the QUICHE platform implementation, and is not to be +// consumed or referenced directly by other Envoy code. It serves purely as a +// porting layer for QUICHE. + namespace http2 { template using Http2OptionalImpl = absl::optional; diff --git a/source/extensions/quic_listeners/quiche/platform/http2_ptr_util_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_ptr_util_impl.h index 6bc4edcde5b80..7ef0bd5828ae0 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_ptr_util_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_ptr_util_impl.h @@ -5,6 +5,10 @@ // NOLINT(namespace-envoy) +// This file is part of the QUICHE platform implementation, and is not to be +// consumed or referenced directly by other Envoy code. It serves purely as a +// porting layer for QUICHE. + namespace http2 { template std::unique_ptr Http2MakeUniqueImpl(Args&&... args) { diff --git a/source/extensions/quic_listeners/quiche/platform/http2_reconstruct_object_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_reconstruct_object_impl.h index a159472aa3483..2ee229d3874e5 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_reconstruct_object_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_reconstruct_object_impl.h @@ -4,6 +4,10 @@ // NOLINT(namespace-envoy) +// This file is part of the QUICHE platform implementation, and is not to be +// consumed or referenced directly by other Envoy code. It serves purely as a +// porting layer for QUICHE. + // TODO: implement namespace http2 { diff --git a/source/extensions/quic_listeners/quiche/platform/http2_string_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_string_impl.h index b11bba0c13c25..fc54f8938f5c8 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_string_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_string_impl.h @@ -4,6 +4,10 @@ // NOLINT(namespace-envoy) +// This file is part of the QUICHE platform implementation, and is not to be +// consumed or referenced directly by other Envoy code. It serves purely as a +// porting layer for QUICHE. + namespace http2 { using Http2StringImpl = std::string; diff --git a/source/extensions/quic_listeners/quiche/platform/http2_string_piece_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_string_piece_impl.h index 7746dcd101447..711372c021dd2 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_string_piece_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_string_piece_impl.h @@ -4,6 +4,10 @@ // NOLINT(namespace-envoy) +// This file is part of the QUICHE platform implementation, and is not to be +// consumed or referenced directly by other Envoy code. It serves purely as a +// porting layer for QUICHE. + namespace http2 { using Http2StringPieceImpl = absl::string_view; diff --git a/source/extensions/quic_listeners/quiche/platform/http2_string_utils_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_string_utils_impl.h index ff0a250ae6b23..4465d50e109b2 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_string_utils_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_string_utils_impl.h @@ -14,6 +14,10 @@ // NOLINT(namespace-envoy) +// This file is part of the QUICHE platform implementation, and is not to be +// consumed or referenced directly by other Envoy code. It serves purely as a +// porting layer for QUICHE. + // TODO: implement namespace http2 { diff --git a/source/extensions/quic_listeners/quiche/platform/http2_test_helpers_impl.h b/source/extensions/quic_listeners/quiche/platform/http2_test_helpers_impl.h index c155210a796d6..85d72e33ce0b6 100644 --- a/source/extensions/quic_listeners/quiche/platform/http2_test_helpers_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/http2_test_helpers_impl.h @@ -2,6 +2,10 @@ // NOLINT(namespace-envoy) +// This file is part of the QUICHE platform implementation, and is not to be +// consumed or referenced directly by other Envoy code. It serves purely as a +// porting layer for QUICHE. + // TODO: implement #define VERIFY_AND_RETURN_SUCCESS(expression) 0