Move the QboneTunnelInterface to third_party. It has no dependencies
outside of third_party, so is a reasonable starting point for pulling
qbone client code out of gfe.

PiperOrigin-RevId: 343875262
Change-Id: Ib9d0931f7516e4a5da6513a595e877c7773b94bb
diff --git a/quic/qbone/bonnet/mock_qbone_tunnel.h b/quic/qbone/bonnet/mock_qbone_tunnel.h
new file mode 100644
index 0000000..ab27c9d
--- /dev/null
+++ b/quic/qbone/bonnet/mock_qbone_tunnel.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2020 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_QUIC_QBONE_BONNET_MOCK_QBONE_TUNNEL_H_
+#define QUICHE_QUIC_QBONE_BONNET_MOCK_QBONE_TUNNEL_H_
+
+#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
+#include "net/third_party/quiche/src/quic/qbone/bonnet/qbone_tunnel_interface.h"
+
+namespace quic {
+
+class MockQboneTunnel : public QboneTunnelInterface {
+ public:
+  MockQboneTunnel() = default;
+
+  MOCK_METHOD(bool, WaitForEvents, (), (override));
+
+  MOCK_METHOD(void, Wake, (), (override));
+
+  MOCK_METHOD(void, ResetTunnel, (), (override));
+
+  MOCK_METHOD(State, Disconnect, (), (override));
+
+  MOCK_METHOD(void, OnControlRequest, (const quic::QboneClientRequest&),
+              (override));
+
+  MOCK_METHOD(void, OnControlError, (), (override));
+
+  MOCK_METHOD(bool, AwaitConnection, ());
+
+  MOCK_METHOD(std::string, StateToString, (State), (override));
+
+  MOCK_METHOD(quic::QboneClient*, client, (), (override));
+
+  MOCK_METHOD(State, state, ());
+
+  MOCK_METHOD(std::string, HealthString, ());
+};
+
+}  // namespace quic
+
+#endif  // QUICHE_QUIC_QBONE_BONNET_MOCK_QBONE_TUNNEL_H_
diff --git a/quic/qbone/bonnet/qbone_tunnel_interface.h b/quic/qbone/bonnet/qbone_tunnel_interface.h
new file mode 100644
index 0000000..f5a17fd
--- /dev/null
+++ b/quic/qbone/bonnet/qbone_tunnel_interface.h
@@ -0,0 +1,68 @@
+// Copyright (c) 2020 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_QUIC_QBONE_BONNET_QBONE_TUNNEL_INTERFACE_H_
+#define QUICHE_QUIC_QBONE_BONNET_QBONE_TUNNEL_INTERFACE_H_
+
+#include "net/third_party/quiche/src/quic/qbone/qbone_client.h"
+
+namespace quic {
+
+// Interface for establishing bidirectional communication between a network
+// device and a QboneClient.
+class QboneTunnelInterface : public quic::QboneClientControlStream::Handler {
+ public:
+  QboneTunnelInterface() = default;
+
+  QboneTunnelInterface(const QboneTunnelInterface&) = delete;
+  QboneTunnelInterface& operator=(const QboneTunnelInterface&) = delete;
+
+  QboneTunnelInterface(QboneTunnelInterface&&) = delete;
+  QboneTunnelInterface& operator=(QboneTunnelInterface&&) = delete;
+
+  enum State {
+    UNINITIALIZED,
+    IP_RANGE_REQUESTED,
+    START_REQUESTED,
+    STARTED,
+    LAME_DUCK_REQUESTED,
+    END_REQUESTED,
+    ENDED,
+    FAILED,
+  };
+
+  // Wait and handle any events which occur.
+  // Returns true if there are any outstanding requests.
+  virtual bool WaitForEvents() = 0;
+
+  // Wakes the tunnel if it is currently in WaitForEvents.
+  virtual void Wake() = 0;
+
+  // Disconnect the tunnel, resetting it to an uninitialized state. This will
+  // force ConnectIfNeeded to reconnect on the next epoll cycle.
+  virtual void ResetTunnel() = 0;
+
+  // Disconnect from the QBONE server.
+  virtual State Disconnect() = 0;
+
+  // Callback handling responses from the QBONE server.
+  void OnControlRequest(const QboneClientRequest& request) override = 0;
+
+  // Callback handling bad responses from the QBONE server. Currently, this is
+  // only called when the response is unparsable.
+  void OnControlError() override = 0;
+
+  // Returns a string value of the given state.
+  virtual std::string StateToString(State state) = 0;
+
+  virtual QboneClient* client() = 0;
+
+  virtual State state() = 0;
+
+  virtual std::string HealthString() = 0;
+};
+
+}  // namespace quic
+
+#endif  // QUICHE_QUIC_QBONE_BONNET_QBONE_TUNNEL_INTERFACE_H_