Move quic::QuicEndian to quiche::QuicheEndian

This change will enable us to reuse the endian library in new third_party repos without introducing a dependency on //third_party/quic.

gfe-relnote: Refactor of QUIC Endian library
PiperOrigin-RevId: 281406510
Change-Id: If1b72425a799bad7469281f32a12d6630fe787c4
diff --git a/common/platform/api/quiche_endian.h b/common/platform/api/quiche_endian.h
new file mode 100644
index 0000000..f8a9ee6
--- /dev/null
+++ b/common/platform/api/quiche_endian.h
@@ -0,0 +1,55 @@
+// 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_ENDIAN_H_
+#define QUICHE_COMMON_PLATFORM_API_QUICHE_ENDIAN_H_
+
+#include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
+#include "net/quiche/common/platform/impl/quiche_endian_impl.h"
+
+namespace quiche {
+
+enum Endianness {
+  NETWORK_BYTE_ORDER,  // big endian
+  HOST_BYTE_ORDER      // little endian
+};
+
+// Provide utility functions that convert from/to network order (big endian)
+// to/from host order (can be either little or big endian depending on the
+// platform).
+class QUICHE_EXPORT_PRIVATE QuicheEndian {
+ public:
+  // Convert |x| from host order (can be either little or big endian depending
+  // on the platform) to network order (big endian).
+  static uint16_t HostToNet16(uint16_t x) {
+    return QuicheEndianImpl::HostToNet16(x);
+  }
+  static uint32_t HostToNet32(uint32_t x) {
+    return QuicheEndianImpl::HostToNet32(x);
+  }
+  static uint64_t HostToNet64(uint64_t x) {
+    return QuicheEndianImpl::HostToNet64(x);
+  }
+
+  // Convert |x| from network order (big endian) to host order (can be either
+  // little or big endian depending on the platform).
+  static uint16_t NetToHost16(uint16_t x) {
+    return QuicheEndianImpl::NetToHost16(x);
+  }
+  static uint32_t NetToHost32(uint32_t x) {
+    return QuicheEndianImpl::NetToHost32(x);
+  }
+  static uint64_t NetToHost64(uint64_t x) {
+    return QuicheEndianImpl::NetToHost64(x);
+  }
+
+  // Returns true if current host order is little endian.
+  static bool HostIsLittleEndian() {
+    return QuicheEndianImpl::HostIsLittleEndian();
+  }
+};
+
+}  // namespace quiche
+
+#endif  // QUICHE_COMMON_PLATFORM_API_QUICHE_ENDIAN_H_