Move (almost) all of quic/platform/impl to net/quic/platform_overrides.

PiperOrigin-RevId: 435388221
diff --git a/common/platform/api/quiche_containers.h b/common/platform/api/quiche_containers.h
new file mode 100644
index 0000000..b3b929a
--- /dev/null
+++ b/common/platform/api/quiche_containers.h
@@ -0,0 +1,22 @@
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_CONTAINERS_H_
+#define QUICHE_COMMON_PLATFORM_API_QUICHE_CONTAINERS_H_
+
+#include "quiche_platform_impl/quiche_containers_impl.h"
+
+namespace quiche {
+
+// An ordered container optimized for small sets.
+// An implementation with O(n) mutations might be chosen
+// in case it has better memory usage and/or faster access.
+//
+// DOES NOT GUARANTEE POINTER OR ITERATOR STABILITY!
+template <typename Key, typename Compare = std::less<Key>>
+using QuicheSmallOrderedSet = QuicheSmallOrderedSetImpl<Key, Compare>;
+
+}  // namespace quiche
+
+#endif  // QUICHE_COMMON_PLATFORM_API_QUICHE_CONTAINERS_H_
diff --git a/common/platform/api/quiche_default_proof_providers.h b/common/platform/api/quiche_default_proof_providers.h
new file mode 100644
index 0000000..54eabab
--- /dev/null
+++ b/common/platform/api/quiche_default_proof_providers.h
@@ -0,0 +1,32 @@
+// Copyright (c) 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_DEFAULT_PROOF_PROVIDERS_H_
+#define QUICHE_COMMON_PLATFORM_API_QUICHE_DEFAULT_PROOF_PROVIDERS_H_
+
+#include <memory>
+
+#include "quiche_platform_impl/quiche_default_proof_providers_impl.h"
+#include "quic/core/crypto/proof_source.h"
+#include "quic/core/crypto/proof_verifier.h"
+
+namespace quiche {
+
+// Provides a default proof verifier that can verify a cert chain for |host|.
+// The verifier has to do a good faith attempt at verifying the certificate
+// against a reasonable root store, and not just always return success.
+inline std::unique_ptr<quic::ProofVerifier> CreateDefaultProofVerifier(
+    const std::string& host) {
+  return CreateDefaultProofVerifierImpl(host);
+}
+
+// Provides a default proof source for CLI-based tools.  The actual certificates
+// used in the proof source should be confifgurable via command-line flags.
+inline std::unique_ptr<quic::ProofSource> CreateDefaultProofSource() {
+  return CreateDefaultProofSourceImpl();
+}
+
+}  // namespace quiche
+
+#endif  // QUICHE_COMMON_PLATFORM_API_QUICHE_DEFAULT_PROOF_PROVIDERS_H_
diff --git a/common/platform/api/quiche_epoll.h b/common/platform/api/quiche_epoll.h
new file mode 100644
index 0000000..5fd470c
--- /dev/null
+++ b/common/platform/api/quiche_epoll.h
@@ -0,0 +1,19 @@
+// Copyright (c) 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_EPOLL_H_
+#define QUICHE_COMMON_PLATFORM_API_QUICHE_EPOLL_H_
+
+#include "quiche_platform_impl/quiche_epoll_impl.h"
+
+namespace quiche {
+
+using QuicheEpollServer = QuicheEpollServerImpl;
+using QuicheEpollEvent = QuicheEpollEventImpl;
+using QuicheEpollAlarmBase = QuicheEpollAlarmBaseImpl;
+using QuicheEpollCallbackInterface = QuicheEpollCallbackInterfaceImpl;
+
+}  // namespace quiche
+
+#endif  // QUICHE_COMMON_PLATFORM_API_QUICHE_EPOLL_H_
diff --git a/common/platform/api/quiche_error_code_wrappers.h b/common/platform/api/quiche_error_code_wrappers.h
new file mode 100644
index 0000000..ef08dce
--- /dev/null
+++ b/common/platform/api/quiche_error_code_wrappers.h
@@ -0,0 +1,14 @@
+// Copyright (c) 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_ERROR_CODE_WRAPPERS_H_
+#define QUICHE_COMMON_PLATFORM_API_QUICHE_ERROR_CODE_WRAPPERS_H_
+
+#include "quiche_platform_impl/quiche_error_code_wrappers_impl.h"
+
+// TODO(vasilvv): ensure WRITE_STATUS_MSG_TOO_BIG works everywhere and remove
+// this.
+#define QUICHE_EMSGSIZE QUICHE_EMSGSIZE_IMPL
+
+#endif  // QUICHE_COMMON_PLATFORM_API_QUICHE_ERROR_CODE_WRAPPERS_H_
diff --git a/common/platform/api/quiche_expect_bug.h b/common/platform/api/quiche_expect_bug.h
new file mode 100644
index 0000000..02ba8d1
--- /dev/null
+++ b/common/platform/api/quiche_expect_bug.h
@@ -0,0 +1,14 @@
+// Copyright (c) 2018 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_EXPECT_BUG_H_
+#define QUICHE_COMMON_PLATFORM_API_QUICHE_EXPECT_BUG_H_
+
+#include "quiche_platform_impl/quiche_expect_bug_impl.h"
+
+#define EXPECT_QUICHE_BUG EXPECT_QUICHE_BUG_IMPL
+#define EXPECT_QUICHE_PEER_BUG(statement, regex) \
+  EXPECT_QUICHE_PEER_BUG_IMPL(statement, regex)
+
+#endif  // QUICHE_COMMON_PLATFORM_API_QUICHE_EXPECT_BUG_H_
diff --git a/common/platform/api/quiche_hostname_utils.cc b/common/platform/api/quiche_hostname_utils.cc
new file mode 100644
index 0000000..57fa53c
--- /dev/null
+++ b/common/platform/api/quiche_hostname_utils.cc
@@ -0,0 +1,21 @@
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "common/platform/api/quiche_hostname_utils.h"
+
+#include "absl/strings/string_view.h"
+
+namespace quiche {
+
+// static
+bool QuicheHostnameUtils::IsValidSNI(absl::string_view sni) {
+  return QuicheHostnameUtilsImpl::IsValidSNI(sni);
+}
+
+// static
+std::string QuicheHostnameUtils::NormalizeHostname(absl::string_view hostname) {
+  return QuicheHostnameUtilsImpl::NormalizeHostname(hostname);
+}
+
+}  // namespace quiche
diff --git a/common/platform/api/quiche_hostname_utils.h b/common/platform/api/quiche_hostname_utils.h
new file mode 100644
index 0000000..a8a4acf
--- /dev/null
+++ b/common/platform/api/quiche_hostname_utils.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_HOSTNAME_UTILS_H_
+#define QUICHE_COMMON_PLATFORM_API_QUICHE_HOSTNAME_UTILS_H_
+
+#include <string>
+
+#include "quiche_platform_impl/quiche_hostname_utils_impl.h"
+#include "absl/strings/string_view.h"
+#include "common/platform/api/quiche_export.h"
+
+namespace quiche {
+
+class QUICHE_EXPORT_PRIVATE QuicheHostnameUtils {
+ public:
+  QuicheHostnameUtils() = delete;
+
+  // Returns true if the sni is valid, false otherwise.
+  //  (1) disallow IP addresses;
+  //  (2) check that the hostname contains valid characters only; and
+  //  (3) contains at least one dot.
+  static bool IsValidSNI(absl::string_view sni);
+
+  // Canonicalizes the specified hostname.  This involves a wide variety of
+  // transformations, including lowercasing, removing trailing dots and IDNA
+  // conversion.
+  static std::string NormalizeHostname(absl::string_view hostname);
+};
+
+}  // namespace quiche
+
+#endif  // QUICHE_COMMON_PLATFORM_API_QUICHE_HOSTNAME_UTILS_H_
diff --git a/quic/platform/api/quic_hostname_utils_test.cc b/common/platform/api/quiche_hostname_utils_test.cc
similarity index 67%
rename from quic/platform/api/quic_hostname_utils_test.cc
rename to common/platform/api/quiche_hostname_utils_test.cc
index 398f44a..3a48b9b 100644
--- a/quic/platform/api/quic_hostname_utils_test.cc
+++ b/common/platform/api/quiche_hostname_utils_test.cc
@@ -2,35 +2,35 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "quic/platform/api/quic_hostname_utils.h"
+#include "common/platform/api/quiche_hostname_utils.h"
 
 #include <string>
 
 #include "absl/base/macros.h"
-#include "quic/platform/api/quic_test.h"
+#include "common/platform/api/quiche_test.h"
 
-namespace quic {
+namespace quiche {
 namespace test {
 namespace {
 
-class QuicHostnameUtilsTest : public QuicTest {};
+class QuicheHostnameUtilsTest : public QuicheTest {};
 
-TEST_F(QuicHostnameUtilsTest, IsValidSNI) {
+TEST_F(QuicheHostnameUtilsTest, IsValidSNI) {
   // IP as SNI.
-  EXPECT_FALSE(QuicHostnameUtils::IsValidSNI("192.168.0.1"));
+  EXPECT_FALSE(QuicheHostnameUtils::IsValidSNI("192.168.0.1"));
   // SNI without any dot.
-  EXPECT_TRUE(QuicHostnameUtils::IsValidSNI("somedomain"));
+  EXPECT_TRUE(QuicheHostnameUtils::IsValidSNI("somedomain"));
   // Invalid by RFC2396 but unfortunately domains of this form exist.
-  EXPECT_TRUE(QuicHostnameUtils::IsValidSNI("some_domain.com"));
+  EXPECT_TRUE(QuicheHostnameUtils::IsValidSNI("some_domain.com"));
   // An empty string must be invalid otherwise the QUIC client will try sending
   // it.
-  EXPECT_FALSE(QuicHostnameUtils::IsValidSNI(""));
+  EXPECT_FALSE(QuicheHostnameUtils::IsValidSNI(""));
 
   // Valid SNI
-  EXPECT_TRUE(QuicHostnameUtils::IsValidSNI("test.google.com"));
+  EXPECT_TRUE(QuicheHostnameUtils::IsValidSNI("test.google.com"));
 }
 
-TEST_F(QuicHostnameUtilsTest, NormalizeHostname) {
+TEST_F(QuicheHostnameUtilsTest, NormalizeHostname) {
   // clang-format off
   struct {
     const char *input, *expected;
@@ -80,10 +80,10 @@
 
   for (size_t i = 0; i < ABSL_ARRAYSIZE(tests); ++i) {
     EXPECT_EQ(std::string(tests[i].expected),
-              QuicHostnameUtils::NormalizeHostname(tests[i].input));
+              QuicheHostnameUtils::NormalizeHostname(tests[i].input));
   }
 }
 
 }  // namespace
 }  // namespace test
-}  // namespace quic
+}  // namespace quiche
diff --git a/common/platform/api/quiche_mock_log.h b/common/platform/api/quiche_mock_log.h
new file mode 100644
index 0000000..37f25de
--- /dev/null
+++ b/common/platform/api/quiche_mock_log.h
@@ -0,0 +1,18 @@
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_MOCK_LOG_H_
+#define QUICHE_COMMON_PLATFORM_API_QUICHE_MOCK_LOG_H_
+
+#include "quiche_platform_impl/quiche_mock_log_impl.h"
+
+using QuicheMockLog = QuicheMockLogImpl;
+#define CREATE_QUICHE_MOCK_LOG(log) CREATE_QUICHE_MOCK_LOG_IMPL(log)
+
+#define EXPECT_QUICHE_LOG_CALL(log) EXPECT_QUICHE_LOG_CALL_IMPL(log)
+
+#define EXPECT_QUICHE_LOG_CALL_CONTAINS(log, level, content) \
+  EXPECT_QUICHE_LOG_CALL_CONTAINS_IMPL(log, level, content)
+
+#endif  // QUICHE_COMMON_PLATFORM_API_QUICHE_MOCK_LOG_H_
diff --git a/common/platform/api/quiche_server_stats.h b/common/platform/api/quiche_server_stats.h
new file mode 100644
index 0000000..e8ad499
--- /dev/null
+++ b/common/platform/api/quiche_server_stats.h
@@ -0,0 +1,82 @@
+// Copyright 2018 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_SERVER_STATS_H_
+#define QUICHE_COMMON_PLATFORM_API_QUICHE_SERVER_STATS_H_
+
+#include "quiche_platform_impl/quiche_server_stats_impl.h"
+
+namespace quiche {
+
+//------------------------------------------------------------------------------
+// Enumeration histograms.
+//
+// Sample usage:
+//   // In Chrome, these values are persisted to logs. Entries should not be
+//   // renumbered and numeric values should never be reused.
+//   enum class MyEnum {
+//     FIRST_VALUE = 0,
+//     SECOND_VALUE = 1,
+//     ...
+//     FINAL_VALUE = N,
+//     COUNT
+//   };
+//   QUICHE_SERVER_HISTOGRAM_ENUM("My.Enumeration", MyEnum::SOME_VALUE,
+//   MyEnum::COUNT, "Number of time $foo equals to some enum value");
+//
+// Note: The value in |sample| must be strictly less than |enum_size|.
+
+#define QUICHE_SERVER_HISTOGRAM_ENUM(name, sample, enum_size, docstring) \
+  QUICHE_SERVER_HISTOGRAM_ENUM_IMPL(name, sample, enum_size, docstring)
+
+//------------------------------------------------------------------------------
+// Histogram for boolean values.
+
+// Sample usage:
+//   QUICHE_SERVER_HISTOGRAM_BOOL("My.Boolean", bool,
+//   "Number of times $foo is true or false");
+#define QUICHE_SERVER_HISTOGRAM_BOOL(name, sample, docstring) \
+  QUICHE_SERVER_HISTOGRAM_BOOL_IMPL(name, sample, docstring)
+
+//------------------------------------------------------------------------------
+// Timing histograms. These are used for collecting timing data (generally
+// latencies).
+
+// These macros create exponentially sized histograms (lengths of the bucket
+// ranges exponentially increase as the sample range increases). The units for
+// sample and max are unspecified, but they must be the same for one histogram.
+
+// Sample usage:
+//   QUICHE_SERVER_HISTOGRAM_TIMES("Very.Long.Timing.Histogram", time_delta,
+//       QuicTime::Delta::FromSeconds(1), QuicTime::Delta::FromSecond(3600 *
+//       24), 100, "Time spent in doing operation.");
+#define QUICHE_SERVER_HISTOGRAM_TIMES(name, sample, min, max, bucket_count, \
+                                      docstring)                            \
+  QUICHE_SERVER_HISTOGRAM_TIMES_IMPL(name, sample, min, max, bucket_count,  \
+                                     docstring)
+
+//------------------------------------------------------------------------------
+// Count histograms. These are used for collecting numeric data.
+
+// These macros default to exponential histograms - i.e. the lengths of the
+// bucket ranges exponentially increase as the sample range increases.
+
+// All of these macros must be called with |name| as a runtime constant.
+
+// Any data outside the range here will be put in underflow and overflow
+// buckets. Min values should be >=1 as emitted 0s will still go into the
+// underflow bucket.
+
+// Sample usage:
+//   QUICHE_SERVER_SERVER_HISTOGRAM_CUSTOM_COUNTS("My.Histogram", 1, 100000000,
+//   100, "Counters of hitting certian code.");
+
+#define QUICHE_SERVER_HISTOGRAM_COUNTS(name, sample, min, max, bucket_count, \
+                                       docstring)                            \
+  QUICHE_SERVER_HISTOGRAM_COUNTS_IMPL(name, sample, min, max, bucket_count,  \
+                                      docstring)
+
+}  // namespace quiche
+
+#endif  // QUICHE_COMMON_PLATFORM_API_QUICHE_SERVER_STATS_H_
diff --git a/common/platform/api/quiche_stack_trace.h b/common/platform/api/quiche_stack_trace.h
new file mode 100644
index 0000000..876cc98
--- /dev/null
+++ b/common/platform/api/quiche_stack_trace.h
@@ -0,0 +1,18 @@
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_STACK_TRACE_H_
+#define QUICHE_COMMON_PLATFORM_API_QUICHE_STACK_TRACE_H_
+
+#include <string>
+
+#include "quiche_platform_impl/quiche_stack_trace_impl.h"
+
+namespace quiche {
+
+inline std::string QuicheStackTrace() { return QuicheStackTraceImpl(); }
+
+}  // namespace quiche
+
+#endif  // QUICHE_COMMON_PLATFORM_API_QUICHE_STACK_TRACE_H_
diff --git a/common/platform/api/quiche_stream_buffer_allocator.h b/common/platform/api/quiche_stream_buffer_allocator.h
new file mode 100644
index 0000000..16e5e7c
--- /dev/null
+++ b/common/platform/api/quiche_stream_buffer_allocator.h
@@ -0,0 +1,16 @@
+// Copyright (c) 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_STREAM_BUFFER_ALLOCATOR_H_
+#define QUICHE_COMMON_PLATFORM_API_QUICHE_STREAM_BUFFER_ALLOCATOR_H_
+
+#include "quiche_platform_impl/quiche_stream_buffer_allocator_impl.h"
+
+namespace quiche {
+
+using QuicheStreamBufferAllocator = QuicheStreamBufferAllocatorImpl;
+
+}
+
+#endif  // QUICHE_COMMON_PLATFORM_API_QUICHE_STREAM_BUFFER_ALLOCATOR_H_
diff --git a/common/platform/api/quiche_test_loopback.cc b/common/platform/api/quiche_test_loopback.cc
new file mode 100644
index 0000000..a2f6908
--- /dev/null
+++ b/common/platform/api/quiche_test_loopback.cc
@@ -0,0 +1,21 @@
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "common/platform/api/quiche_test_loopback.h"
+
+namespace quiche {
+
+quic::IpAddressFamily AddressFamilyUnderTest() {
+  return AddressFamilyUnderTestImpl();
+}
+
+quic::QuicIpAddress TestLoopback4() { return TestLoopback4Impl(); }
+
+quic::QuicIpAddress TestLoopback6() { return TestLoopback6Impl(); }
+
+quic::QuicIpAddress TestLoopback() { return TestLoopbackImpl(); }
+
+quic::QuicIpAddress TestLoopback(int index) { return TestLoopbackImpl(index); }
+
+}  // namespace quiche
diff --git a/common/platform/api/quiche_test_loopback.h b/common/platform/api/quiche_test_loopback.h
new file mode 100644
index 0000000..9d36b09
--- /dev/null
+++ b/common/platform/api/quiche_test_loopback.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_TEST_LOOPBACK_H_
+#define QUICHE_COMMON_PLATFORM_API_QUICHE_TEST_LOOPBACK_H_
+
+#include "quiche_platform_impl/quiche_test_loopback_impl.h"
+#include "quic/platform/api/quic_ip_address.h"
+#include "quic/platform/api/quic_ip_address_family.h"
+
+namespace quiche {
+
+// Returns the address family (IPv4 or IPv6) used to run test under.
+quic::IpAddressFamily AddressFamilyUnderTest();
+
+// Returns an IPv4 loopback address.
+quic::QuicIpAddress TestLoopback4();
+
+// Returns the only IPv6 loopback address.
+quic::QuicIpAddress TestLoopback6();
+
+// Returns an appropriate IPv4/Ipv6 loopback address based upon whether the
+// test's environment.
+quic::QuicIpAddress TestLoopback();
+
+// If address family under test is IPv4, returns an indexed IPv4 loopback
+// address. If address family under test is IPv6, the address returned is
+// platform-dependent.
+quic::QuicIpAddress TestLoopback(int index);
+
+}  // namespace quiche
+
+#endif  // QUICHE_COMMON_PLATFORM_API_QUICHE_TEST_LOOPBACK_H_
diff --git a/common/platform/api/quiche_test_output.h b/common/platform/api/quiche_test_output.h
new file mode 100644
index 0000000..b28a8a7
--- /dev/null
+++ b/common/platform/api/quiche_test_output.h
@@ -0,0 +1,40 @@
+// Copyright (c) 2018 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_TEST_OUTPUT_H_
+#define QUICHE_COMMON_PLATFORM_API_QUICHE_TEST_OUTPUT_H_
+
+#include "quiche_platform_impl/quiche_test_output_impl.h"
+#include "absl/strings/string_view.h"
+
+namespace quiche {
+
+// Save |data| into ${QUICHE_TEST_OUTPUT_DIR}/filename. If a file with the same
+// path already exists, overwrite it.
+inline void QuicheSaveTestOutput(absl::string_view filename,
+                                 absl::string_view data) {
+  QuicheSaveTestOutputImpl(filename, data);
+}
+
+// Load the content of ${QUICHE_TEST_OUTPUT_DIR}/filename into |*data|.
+// Return whether it is successfully loaded.
+inline bool QuicheLoadTestOutput(absl::string_view filename,
+                                 std::string* data) {
+  return QuicheLoadTestOutputImpl(filename, data);
+}
+
+// Records a QUIC trace file(.qtr) into a directory specified by the
+// QUICHE_TEST_OUTPUT_DIR environment variable.  Assumes that it's called from a
+// unit test.
+//
+// The |identifier| is a human-readable identifier that will be combined with
+// the name of the unit test and a timestamp.  |data| is the serialized
+// quic_trace.Trace protobuf that is being recorded into the file.
+inline void QuicheRecordTrace(absl::string_view identifier,
+                              absl::string_view data) {
+  QuicheRecordTraceImpl(identifier, data);
+}
+
+}  // namespace quiche
+#endif  // QUICHE_COMMON_PLATFORM_API_QUICHE_TEST_OUTPUT_H_
diff --git a/common/platform/api/quiche_thread.h b/common/platform/api/quiche_thread.h
new file mode 100644
index 0000000..919ccdc
--- /dev/null
+++ b/common/platform/api/quiche_thread.h
@@ -0,0 +1,28 @@
+// Copyright (c) 2018 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_THREAD_H_
+#define QUICHE_COMMON_PLATFORM_API_QUICHE_THREAD_H_
+
+#include <string>
+
+#include "quiche_platform_impl/quiche_thread_impl.h"
+#include "common/platform/api/quiche_export.h"
+
+namespace quiche {
+
+// A class representing a thread of execution in QUIC.
+class QUICHE_EXPORT_PRIVATE QuicheThread : public QuicheThreadImpl {
+ public:
+  QuicheThread(const std::string& string) : QuicheThreadImpl(string) {}
+  QuicheThread(const QuicheThread&) = delete;
+  QuicheThread& operator=(const QuicheThread&) = delete;
+
+  // Impl defines a virtual void Run() method which subclasses
+  // must implement.
+};
+
+}  // namespace quiche
+
+#endif  // QUICHE_COMMON_PLATFORM_API_QUICHE_THREAD_H_
diff --git a/common/platform/api/quiche_udp_socket_platform_api.h b/common/platform/api/quiche_udp_socket_platform_api.h
new file mode 100644
index 0000000..474e89d
--- /dev/null
+++ b/common/platform/api/quiche_udp_socket_platform_api.h
@@ -0,0 +1,29 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_UDP_SOCKET_PLATFORM_API_H_
+#define QUICHE_COMMON_PLATFORM_API_QUICHE_UDP_SOCKET_PLATFORM_API_H_
+
+#include "quiche_platform_impl/quiche_udp_socket_platform_impl.h"
+
+namespace quiche {
+
+const size_t kCmsgSpaceForGooglePacketHeader =
+    kCmsgSpaceForGooglePacketHeaderImpl;
+
+inline bool GetGooglePacketHeadersFromControlMessage(
+    struct ::cmsghdr* cmsg,
+    char** packet_headers,
+    size_t* packet_headers_len) {
+  return GetGooglePacketHeadersFromControlMessageImpl(cmsg, packet_headers,
+                                                      packet_headers_len);
+}
+
+inline void SetGoogleSocketOptions(int fd) {
+  SetGoogleSocketOptionsImpl(fd);
+}
+
+}  // namespace quiche
+
+#endif  // QUICHE_COMMON_PLATFORM_API_QUICHE_UDP_SOCKET_PLATFORM_API_H_
diff --git a/quic/platform/api/quic_containers.h b/quic/platform/api/quic_containers.h
index 19795e7..06f2251 100644
--- a/quic/platform/api/quic_containers.h
+++ b/quic/platform/api/quic_containers.h
@@ -5,7 +5,7 @@
 #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_CONTAINERS_H_
 #define QUICHE_QUIC_PLATFORM_API_QUIC_CONTAINERS_H_
 
-#include "quiche_platform_impl/quiche_containers_impl.h"
+#include "common/platform/api/quiche_containers.h"
 
 namespace quic {
 
@@ -15,7 +15,7 @@
 //
 // DOES NOT GUARANTEE POINTER OR ITERATOR STABILITY!
 template <typename Key, typename Compare = std::less<Key>>
-using QuicSmallOrderedSet = ::quiche::QuicheSmallOrderedSetImpl<Key, Compare>;
+using QuicSmallOrderedSet = ::quiche::QuicheSmallOrderedSet<Key, Compare>;
 
 }  // namespace quic
 
diff --git a/quic/platform/api/quic_default_proof_providers.h b/quic/platform/api/quic_default_proof_providers.h
index c6ace41..fd4a5cd 100644
--- a/quic/platform/api/quic_default_proof_providers.h
+++ b/quic/platform/api/quic_default_proof_providers.h
@@ -6,10 +6,11 @@
 #define QUICHE_QUIC_PLATFORM_API_QUIC_DEFAULT_PROOF_PROVIDERS_H_
 
 #include <memory>
+#include <string>
 
 #include "quic/core/crypto/proof_source.h"
 #include "quic/core/crypto/proof_verifier.h"
-#include "net/quic/platform/impl/quic_default_proof_providers_impl.h"
+#include "common/platform/api/quiche_default_proof_providers.h"
 
 namespace quic {
 
@@ -18,13 +19,13 @@
 // against a reasonable root store, and not just always return success.
 inline std::unique_ptr<ProofVerifier> CreateDefaultProofVerifier(
     const std::string& host) {
-  return CreateDefaultProofVerifierImpl(host);
+  return quiche::CreateDefaultProofVerifier(host);
 }
 
 // Provides a default proof source for CLI-based tools.  The actual certificates
 // used in the proof source should be confifgurable via command-line flags.
 inline std::unique_ptr<ProofSource> CreateDefaultProofSource() {
-  return CreateDefaultProofSourceImpl();
+  return quiche::CreateDefaultProofSource();
 }
 
 }  // namespace quic
diff --git a/quic/platform/api/quic_epoll.h b/quic/platform/api/quic_epoll.h
index e429ef8..eb6c98a 100644
--- a/quic/platform/api/quic_epoll.h
+++ b/quic/platform/api/quic_epoll.h
@@ -5,14 +5,14 @@
 #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_EPOLL_H_
 #define QUICHE_QUIC_PLATFORM_API_QUIC_EPOLL_H_
 
-#include "net/quic/platform/impl/quic_epoll_impl.h"
+#include "common/platform/api/quiche_epoll.h"
 
 namespace quic {
 
-using QuicEpollServer = QuicEpollServerImpl;
-using QuicEpollEvent = QuicEpollEventImpl;
-using QuicEpollAlarmBase = QuicEpollAlarmBaseImpl;
-using QuicEpollCallbackInterface = QuicEpollCallbackInterfaceImpl;
+using QuicEpollServer = quiche::QuicheEpollServer;
+using QuicEpollEvent = quiche::QuicheEpollEvent;
+using QuicEpollAlarmBase = quiche::QuicheEpollAlarmBase;
+using QuicEpollCallbackInterface = quiche::QuicheEpollCallbackInterface;
 
 }  // namespace quic
 
diff --git a/quic/platform/api/quic_error_code_wrappers.h b/quic/platform/api/quic_error_code_wrappers.h
index 733572e..173c240 100644
--- a/quic/platform/api/quic_error_code_wrappers.h
+++ b/quic/platform/api/quic_error_code_wrappers.h
@@ -5,10 +5,10 @@
 #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_ERROR_CODE_WRAPPERS_H_
 #define QUICHE_QUIC_PLATFORM_API_QUIC_ERROR_CODE_WRAPPERS_H_
 
-#include "net/quic/platform/impl/quic_error_code_wrappers_impl.h"
+#include "common/platform/api/quiche_error_code_wrappers.h"
 
 // TODO(vasilvv): ensure WRITE_STATUS_MSG_TOO_BIG works everywhere and remove
 // this.
-#define QUIC_EMSGSIZE QUIC_EMSGSIZE_IMPL
+#define QUIC_EMSGSIZE QUICHE_EMSGSIZE
 
 #endif  // QUICHE_QUIC_PLATFORM_API_QUIC_ERROR_CODE_WRAPPERS_H_
diff --git a/quic/platform/api/quic_expect_bug.h b/quic/platform/api/quic_expect_bug.h
index 936b11f..2b8ac16 100644
--- a/quic/platform/api/quic_expect_bug.h
+++ b/quic/platform/api/quic_expect_bug.h
@@ -5,10 +5,10 @@
 #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_EXPECT_BUG_H_
 #define QUICHE_QUIC_PLATFORM_API_QUIC_EXPECT_BUG_H_
 
-#include "net/quic/platform/impl/quic_expect_bug_impl.h"
+#include "common/platform/api/quiche_expect_bug.h"
 
-#define EXPECT_QUIC_BUG EXPECT_QUIC_BUG_IMPL
+#define EXPECT_QUIC_BUG EXPECT_QUICHE_BUG
 #define EXPECT_QUIC_PEER_BUG(statement, regex) \
-  EXPECT_QUIC_PEER_BUG_IMPL(statement, regex)
+  EXPECT_QUICHE_PEER_BUG(statement, regex)
 
 #endif  // QUICHE_QUIC_PLATFORM_API_QUIC_EXPECT_BUG_H_
diff --git a/quic/platform/api/quic_hostname_utils.cc b/quic/platform/api/quic_hostname_utils.cc
deleted file mode 100644
index d8d63fa..0000000
--- a/quic/platform/api/quic_hostname_utils.cc
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "quic/platform/api/quic_hostname_utils.h"
-#include "absl/strings/string_view.h"
-
-namespace quic {
-
-// static
-bool QuicHostnameUtils::IsValidSNI(absl::string_view sni) {
-  return QuicHostnameUtilsImpl::IsValidSNI(sni);
-}
-
-// static
-std::string QuicHostnameUtils::NormalizeHostname(absl::string_view hostname) {
-  return QuicHostnameUtilsImpl::NormalizeHostname(hostname);
-}
-
-}  // namespace quic
diff --git a/quic/platform/api/quic_hostname_utils.h b/quic/platform/api/quic_hostname_utils.h
index 79158b9..1c83d31 100644
--- a/quic/platform/api/quic_hostname_utils.h
+++ b/quic/platform/api/quic_hostname_utils.h
@@ -5,29 +5,11 @@
 #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_HOSTNAME_UTILS_H_
 #define QUICHE_QUIC_PLATFORM_API_QUIC_HOSTNAME_UTILS_H_
 
-#include <string>
-
-#include "absl/strings/string_view.h"
-#include "quic/platform/api/quic_export.h"
-#include "net/quic/platform/impl/quic_hostname_utils_impl.h"
+#include "common/platform/api/quiche_hostname_utils.h"
 
 namespace quic {
 
-class QUIC_EXPORT_PRIVATE QuicHostnameUtils {
- public:
-  QuicHostnameUtils() = delete;
-
-  // Returns true if the sni is valid, false otherwise.
-  //  (1) disallow IP addresses;
-  //  (2) check that the hostname contains valid characters only; and
-  //  (3) contains at least one dot.
-  static bool IsValidSNI(absl::string_view sni);
-
-  // Canonicalizes the specified hostname.  This involves a wide variety of
-  // transformations, including lowercasing, removing trailing dots and IDNA
-  // conversion.
-  static std::string NormalizeHostname(absl::string_view hostname);
-};
+using QuicHostnameUtils = quiche::QuicheHostnameUtils;
 
 }  // namespace quic
 
diff --git a/quic/platform/api/quic_mock_log.h b/quic/platform/api/quic_mock_log.h
index d1c2693..3a59aaf 100644
--- a/quic/platform/api/quic_mock_log.h
+++ b/quic/platform/api/quic_mock_log.h
@@ -5,14 +5,15 @@
 #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_MOCK_LOG_H_
 #define QUICHE_QUIC_PLATFORM_API_QUIC_MOCK_LOG_H_
 
-#include "net/quic/platform/impl/quic_mock_log_impl.h"
+#include "common/platform/api/quiche_mock_log.h"
 
-using QuicMockLog = QuicMockLogImpl;
-#define CREATE_QUIC_MOCK_LOG(log) CREATE_QUIC_MOCK_LOG_IMPL(log)
+using QuicMockLog = QuicheMockLogImpl;
 
-#define EXPECT_QUIC_LOG_CALL(log) EXPECT_QUIC_LOG_CALL_IMPL(log)
+#define CREATE_QUIC_MOCK_LOG(log) CREATE_QUICHE_MOCK_LOG(log)
+
+#define EXPECT_QUIC_LOG_CALL(log) EXPECT_QUICHE_LOG_CALL(log)
 
 #define EXPECT_QUIC_LOG_CALL_CONTAINS(log, level, content) \
-  EXPECT_QUIC_LOG_CALL_CONTAINS_IMPL(log, level, content)
+  EXPECT_QUICHE_LOG_CALL_CONTAINS(log, level, content)
 
 #endif  // QUICHE_QUIC_PLATFORM_API_QUIC_MOCK_LOG_H_
diff --git a/quic/platform/api/quic_server_stats.h b/quic/platform/api/quic_server_stats.h
index 3c4223e..0c5525f 100644
--- a/quic/platform/api/quic_server_stats.h
+++ b/quic/platform/api/quic_server_stats.h
@@ -5,78 +5,21 @@
 #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_SERVER_STATS_H_
 #define QUICHE_QUIC_PLATFORM_API_QUIC_SERVER_STATS_H_
 
-#include "net/quic/platform/impl/quic_server_stats_impl.h"
-
-namespace quic {
-
-//------------------------------------------------------------------------------
-// Enumeration histograms.
-//
-// Sample usage:
-//   // In Chrome, these values are persisted to logs. Entries should not be
-//   // renumbered and numeric values should never be reused.
-//   enum class MyEnum {
-//     FIRST_VALUE = 0,
-//     SECOND_VALUE = 1,
-//     ...
-//     FINAL_VALUE = N,
-//     COUNT
-//   };
-//   QUIC_SERVER_HISTOGRAM_ENUM("My.Enumeration", MyEnum::SOME_VALUE,
-//   MyEnum::COUNT, "Number of time $foo equals to some enum value");
-//
-// Note: The value in |sample| must be strictly less than |enum_size|.
+#include "common/platform/api/quiche_server_stats.h"
 
 #define QUIC_SERVER_HISTOGRAM_ENUM(name, sample, enum_size, docstring) \
-  QUIC_SERVER_HISTOGRAM_ENUM_IMPL(name, sample, enum_size, docstring)
+  QUICHE_SERVER_HISTOGRAM_ENUM(name, sample, enum_size, docstring)
 
-//------------------------------------------------------------------------------
-// Histogram for boolean values.
-
-// Sample usage:
-//   QUIC_SERVER_HISTOGRAM_BOOL("My.Boolean", bool,
-//   "Number of times $foo is true or false");
 #define QUIC_SERVER_HISTOGRAM_BOOL(name, sample, docstring) \
-  QUIC_SERVER_HISTOGRAM_BOOL_IMPL(name, sample, docstring)
+  QUICHE_SERVER_HISTOGRAM_BOOL(name, sample, docstring)
 
-//------------------------------------------------------------------------------
-// Timing histograms. These are used for collecting timing data (generally
-// latencies).
-
-// These macros create exponentially sized histograms (lengths of the bucket
-// ranges exponentially increase as the sample range increases). The units for
-// sample and max are unspecified, but they must be the same for one histogram.
-
-// Sample usage:
-//   QUIC_SERVER_HISTOGRAM_TIMES("Very.Long.Timing.Histogram", time_delta,
-//       QuicTime::Delta::FromSeconds(1), QuicTime::Delta::FromSecond(3600 *
-//       24), 100, "Time spent in doing operation.");
 #define QUIC_SERVER_HISTOGRAM_TIMES(name, sample, min, max, bucket_count, \
                                     docstring)                            \
-  QUIC_SERVER_HISTOGRAM_TIMES_IMPL(name, sample, min, max, bucket_count,  \
-                                   docstring)
-
-//------------------------------------------------------------------------------
-// Count histograms. These are used for collecting numeric data.
-
-// These macros default to exponential histograms - i.e. the lengths of the
-// bucket ranges exponentially increase as the sample range increases.
-
-// All of these macros must be called with |name| as a runtime constant.
-
-// Any data outside the range here will be put in underflow and overflow
-// buckets. Min values should be >=1 as emitted 0s will still go into the
-// underflow bucket.
-
-// Sample usage:
-//   QUIC_SERVER_SERVER_HISTOGRAM_CUSTOM_COUNTS("My.Histogram", 1, 100000000,
-//   100, "Counters of hitting certian code.");
+  QUICHE_SERVER_HISTOGRAM_TIMES(name, sample, min, max, bucket_count, docstring)
 
 #define QUIC_SERVER_HISTOGRAM_COUNTS(name, sample, min, max, bucket_count, \
                                      docstring)                            \
-  QUIC_SERVER_HISTOGRAM_COUNTS_IMPL(name, sample, min, max, bucket_count,  \
-                                    docstring)
-
-}  // namespace quic
+  QUICHE_SERVER_HISTOGRAM_COUNTS(name, sample, min, max, bucket_count,     \
+                                 docstring)
 
 #endif  // QUICHE_QUIC_PLATFORM_API_QUIC_SERVER_STATS_H_
diff --git a/quic/platform/api/quic_stack_trace.h b/quic/platform/api/quic_stack_trace.h
index ff6c887..c1dd297 100644
--- a/quic/platform/api/quic_stack_trace.h
+++ b/quic/platform/api/quic_stack_trace.h
@@ -7,13 +7,11 @@
 
 #include <string>
 
-#include "net/quic/platform/impl/quic_stack_trace_impl.h"
+#include "common/platform/api/quiche_stack_trace.h"
 
 namespace quic {
 
-inline std::string QuicStackTrace() {
-  return QuicStackTraceImpl();
-}
+inline std::string QuicStackTrace() { return quiche::QuicheStackTrace(); }
 
 }  // namespace quic
 
diff --git a/quic/platform/api/quic_stream_buffer_allocator.h b/quic/platform/api/quic_stream_buffer_allocator.h
index ea1cc9f..fb91327 100644
--- a/quic/platform/api/quic_stream_buffer_allocator.h
+++ b/quic/platform/api/quic_stream_buffer_allocator.h
@@ -5,12 +5,11 @@
 #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_STREAM_BUFFER_ALLOCATOR_H_
 #define QUICHE_QUIC_PLATFORM_API_QUIC_STREAM_BUFFER_ALLOCATOR_H_
 
-#include "net/quic/platform/impl/quic_stream_buffer_allocator_impl.h"
+#include "common/platform/api/quiche_stream_buffer_allocator.h"
 
 namespace quic {
 
-using QuicStreamBufferAllocator = QuicStreamBufferAllocatorImpl;
-
+using QuicStreamBufferAllocator = quiche::QuicheStreamBufferAllocator;
 }
 
 #endif  // QUICHE_QUIC_PLATFORM_API_QUIC_STREAM_BUFFER_ALLOCATOR_H_
diff --git a/quic/platform/api/quic_test_loopback.cc b/quic/platform/api/quic_test_loopback.cc
deleted file mode 100644
index 070a68f..0000000
--- a/quic/platform/api/quic_test_loopback.cc
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "quic/platform/api/quic_test_loopback.h"
-
-namespace quic {
-
-IpAddressFamily AddressFamilyUnderTest() {
-  return AddressFamilyUnderTestImpl();
-}
-
-QuicIpAddress TestLoopback4() {
-  return TestLoopback4Impl();
-}
-
-QuicIpAddress TestLoopback6() {
-  return TestLoopback6Impl();
-}
-
-QuicIpAddress TestLoopback() {
-  return TestLoopbackImpl();
-}
-
-QuicIpAddress TestLoopback(int index) {
-  return TestLoopbackImpl(index);
-}
-
-}  // namespace quic
diff --git a/quic/platform/api/quic_test_loopback.h b/quic/platform/api/quic_test_loopback.h
index 708e766..0e579cb 100644
--- a/quic/platform/api/quic_test_loopback.h
+++ b/quic/platform/api/quic_test_loopback.h
@@ -5,27 +5,33 @@
 #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_TEST_LOOPBACK_H_
 #define QUICHE_QUIC_PLATFORM_API_QUIC_TEST_LOOPBACK_H_
 
-#include "net/quic/platform/impl/quic_test_loopback_impl.h"
+#include "quic/platform/api/quic_ip_address.h"
+#include "quic/platform/api/quic_ip_address_family.h"
+#include "common/platform/api/quiche_test_loopback.h"
 
 namespace quic {
 
 // Returns the address family (IPv4 or IPv6) used to run test under.
-IpAddressFamily AddressFamilyUnderTest();
+inline IpAddressFamily AddressFamilyUnderTest() {
+  return quiche::AddressFamilyUnderTest();
+}
 
 // Returns an IPv4 loopback address.
-QuicIpAddress TestLoopback4();
+inline QuicIpAddress TestLoopback4() { return quiche::TestLoopback4(); }
 
 // Returns the only IPv6 loopback address.
-QuicIpAddress TestLoopback6();
+inline QuicIpAddress TestLoopback6() { return quiche::TestLoopback6(); }
 
 // Returns an appropriate IPv4/Ipv6 loopback address based upon whether the
 // test's environment.
-QuicIpAddress TestLoopback();
+inline QuicIpAddress TestLoopback() { return quiche::TestLoopback(); }
 
 // If address family under test is IPv4, returns an indexed IPv4 loopback
 // address. If address family under test is IPv6, the address returned is
 // platform-dependent.
-QuicIpAddress TestLoopback(int index);
+inline QuicIpAddress TestLoopback(int index) {
+  return quiche::TestLoopback(index);
+}
 
 }  // namespace quic
 
diff --git a/quic/platform/api/quic_test_output.h b/quic/platform/api/quic_test_output.h
index f925db6..2774018 100644
--- a/quic/platform/api/quic_test_output.h
+++ b/quic/platform/api/quic_test_output.h
@@ -6,33 +6,22 @@
 #define QUICHE_QUIC_PLATFORM_API_QUIC_TEST_OUTPUT_H_
 
 #include "absl/strings/string_view.h"
-#include "net/quic/platform/impl/quic_test_output_impl.h"
+#include "common/platform/api/quiche_test_output.h"
 
 namespace quic {
 
-// Save |data| into ${QUIC_TEST_OUTPUT_DIR}/filename. If a file with the same
-// path already exists, overwrite it.
 inline void QuicSaveTestOutput(absl::string_view filename,
                                absl::string_view data) {
-  QuicSaveTestOutputImpl(filename, data);
+  quiche::QuicheSaveTestOutput(filename, data);
 }
 
-// Load the content of ${QUIC_TEST_OUTPUT_DIR}/filename into |*data|.
-// Return whether it is successfully loaded.
 inline bool QuicLoadTestOutput(absl::string_view filename, std::string* data) {
-  return QuicLoadTestOutputImpl(filename, data);
+  return quiche::QuicheLoadTestOutput(filename, data);
 }
 
-// Records a QUIC trace file(.qtr) into a directory specified by the
-// QUIC_TEST_OUTPUT_DIR environment variable.  Assumes that it's called from a
-// unit test.
-//
-// The |identifier| is a human-readable identifier that will be combined with
-// the name of the unit test and a timestamp.  |data| is the serialized
-// quic_trace.Trace protobuf that is being recorded into the file.
 inline void QuicRecordTrace(absl::string_view identifier,
                             absl::string_view data) {
-  QuicRecordTraceImpl(identifier, data);
+  quiche::QuicheRecordTrace(identifier, data);
 }
 
 }  // namespace quic
diff --git a/quic/platform/api/quic_thread.h b/quic/platform/api/quic_thread.h
index e182632..9b7406d 100644
--- a/quic/platform/api/quic_thread.h
+++ b/quic/platform/api/quic_thread.h
@@ -5,23 +5,11 @@
 #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_THREAD_H_
 #define QUICHE_QUIC_PLATFORM_API_QUIC_THREAD_H_
 
-#include <string>
-
-#include "quic/platform/api/quic_export.h"
-#include "net/quic/platform/impl/quic_thread_impl.h"
+#include "common/platform/api/quiche_thread.h"
 
 namespace quic {
 
-// A class representing a thread of execution in QUIC.
-class QUIC_EXPORT_PRIVATE QuicThread : public QuicThreadImpl {
- public:
-  QuicThread(const std::string& string) : QuicThreadImpl(string) {}
-  QuicThread(const QuicThread&) = delete;
-  QuicThread& operator=(const QuicThread&) = delete;
-
-  // Impl defines a virtual void Run() method which subclasses
-  // must implement.
-};
+using QuicThread = quiche::QuicheThread;
 
 }  // namespace quic
 
diff --git a/quic/platform/api/quic_udp_socket_platform_api.h b/quic/platform/api/quic_udp_socket_platform_api.h
index 10307ef..5b55c1a 100644
--- a/quic/platform/api/quic_udp_socket_platform_api.h
+++ b/quic/platform/api/quic_udp_socket_platform_api.h
@@ -5,23 +5,23 @@
 #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_UDP_SOCKET_PLATFORM_API_H_
 #define QUICHE_QUIC_PLATFORM_API_QUIC_UDP_SOCKET_PLATFORM_API_H_
 
-#include "net/quic/platform/impl/quic_udp_socket_platform_impl.h"
+#include "common/platform/api/quiche_udp_socket_platform_api.h"
 
 namespace quic {
 
 const size_t kCmsgSpaceForGooglePacketHeader =
-    kCmsgSpaceForGooglePacketHeaderImpl;
+    quiche::kCmsgSpaceForGooglePacketHeader;
 
 inline bool GetGooglePacketHeadersFromControlMessage(
     struct ::cmsghdr* cmsg,
     char** packet_headers,
     size_t* packet_headers_len) {
-  return GetGooglePacketHeadersFromControlMessageImpl(cmsg, packet_headers,
-                                                      packet_headers_len);
+  return quiche::GetGooglePacketHeadersFromControlMessage(cmsg, packet_headers,
+                                                          packet_headers_len);
 }
 
 inline void SetGoogleSocketOptions(int fd) {
-  SetGoogleSocketOptionsImpl(fd);
+  quiche::SetGoogleSocketOptions(fd);
 }
 
 }  // namespace quic