arc: Move platform2/arc/network/ to platform2/patchpanel

Next step in the arc-networkd -> patchpanel rename, this patch moves the
location of the code.

BUG=b:151879931
TEST=units,flashed image to atlas
TEST=tasts arc.PlayStore, crostini.LaunchTerminal.download

Change-Id: I1b5cf8d670e1631d46f6449b725395157bf88dde
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2115863
Tested-by: Garrick Evans <garrick@chromium.org>
Commit-Queue: Garrick Evans <garrick@chromium.org>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Hugo Benichi <hugobenichi@google.com>
diff --git a/system-proxy/curl_socket.cc b/system-proxy/curl_socket.cc
index 5144743..32673f9 100644
--- a/system-proxy/curl_socket.cc
+++ b/system-proxy/curl_socket.cc
@@ -10,7 +10,7 @@
 namespace system_proxy {
 
 CurlSocket::CurlSocket(base::ScopedFD fd, ScopedCurlEasyhandle curl_easyhandle)
-    : arc_networkd::Socket(std::move(fd)),
+    : patchpanel::Socket(std::move(fd)),
       curl_easyhandle_(std::move(curl_easyhandle)) {}
 
 CurlSocket::~CurlSocket() {
diff --git a/system-proxy/curl_socket.h b/system-proxy/curl_socket.h
index 948cc82..a09c902 100644
--- a/system-proxy/curl_socket.h
+++ b/system-proxy/curl_socket.h
@@ -21,9 +21,9 @@
 
 typedef std::unique_ptr<CURL, FreeCurlEasyhandle> ScopedCurlEasyhandle;
 
-// CurlSocket wraps a socket opened by curl in an arc_networkd::Socket object
+// CurlSocket wraps a socket opened by curl in an patchpanel::Socket object
 // with an owned CURL handle.
-class CurlSocket : public arc_networkd::Socket {
+class CurlSocket : public patchpanel::Socket {
  public:
   CurlSocket(base::ScopedFD fd, ScopedCurlEasyhandle curl_easyhandle);
   CurlSocket(const CurlSocket&) = delete;
diff --git a/system-proxy/proxy_connect_job.cc b/system-proxy/proxy_connect_job.cc
index 1c1ddc1..96135ec 100644
--- a/system-proxy/proxy_connect_job.cc
+++ b/system-proxy/proxy_connect_job.cc
@@ -31,7 +31,7 @@
 // By C++'s argument-dependent lookup rules, operators defined in a
 // different namespace are not visible. We need the using directive to make
 // the overload available this namespace.
-using arc_networkd::operator<<;
+using patchpanel::operator<<;
 
 namespace {
 // There's no RFC recomandation for the max size of http request headers but
@@ -92,7 +92,7 @@
 namespace system_proxy {
 
 ProxyConnectJob::ProxyConnectJob(
-    std::unique_ptr<arc_networkd::Socket> socket,
+    std::unique_ptr<patchpanel::Socket> socket,
     const std::string& credentials,
     ResolveProxyCallback resolve_proxy_callback,
     OnConnectionSetupFinishedCallback setup_finished_callback)
@@ -247,7 +247,7 @@
   client_socket_->SendTo(server_connect_reply.data(),
                          server_connect_reply.size());
 
-  auto fwd = std::make_unique<arc_networkd::SocketForwarder>(
+  auto fwd = std::make_unique<patchpanel::SocketForwarder>(
       base::StringPrintf("%d-%d", client_socket_->fd(), server_conn->fd()),
       std::move(client_socket_), std::move(server_conn));
   // Start forwarding data between sockets.
diff --git a/system-proxy/proxy_connect_job.h b/system-proxy/proxy_connect_job.h
index dbc0d21..3310cc9 100644
--- a/system-proxy/proxy_connect_job.h
+++ b/system-proxy/proxy_connect_job.h
@@ -14,10 +14,10 @@
 #include <base/files/file_descriptor_watcher_posix.h>
 #include <gtest/gtest_prod.h>  // for FRIEND_TEST
 
-namespace arc_networkd {
+namespace patchpanel {
 class SocketForwarder;
 class Socket;
-}  // namespace arc_networkd
+}  // namespace patchpanel
 
 namespace system_proxy {
 // ProxyConnectJob asynchronously sets up a connection to a remote target on
@@ -30,7 +30,7 @@
 class ProxyConnectJob {
  public:
   using OnConnectionSetupFinishedCallback = base::OnceCallback<void(
-      std::unique_ptr<arc_networkd::SocketForwarder>, ProxyConnectJob*)>;
+      std::unique_ptr<patchpanel::SocketForwarder>, ProxyConnectJob*)>;
 
   // Will be invoked by ProxyConnectJob to resolve the proxy for |target_url_|.
   // The passed |callback| is expected to be called with the list of proxy
@@ -39,7 +39,7 @@
       const std::string& url,
       base::OnceCallback<void(const std::list<std::string>&)> callback)>;
 
-  ProxyConnectJob(std::unique_ptr<arc_networkd::Socket> socket,
+  ProxyConnectJob(std::unique_ptr<patchpanel::Socket> socket,
                   const std::string& credentials,
                   ResolveProxyCallback resolve_proxy_callback,
                   OnConnectionSetupFinishedCallback setup_finished_callback);
@@ -83,7 +83,7 @@
   std::list<std::string> proxy_servers_;
   ResolveProxyCallback resolve_proxy_callback_;
   OnConnectionSetupFinishedCallback setup_finished_callback_;
-  std::unique_ptr<arc_networkd::Socket> client_socket_;
+  std::unique_ptr<patchpanel::Socket> client_socket_;
   std::unique_ptr<base::FileDescriptorWatcher::Controller> read_watcher_;
 };
 }  // namespace system_proxy
diff --git a/system-proxy/proxy_connect_job_test.cc b/system-proxy/proxy_connect_job_test.cc
index 7d45a52..217db01 100644
--- a/system-proxy/proxy_connect_job_test.cc
+++ b/system-proxy/proxy_connect_job_test.cc
@@ -46,10 +46,10 @@
               socketpair(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC,
                          0 /* protocol */, fds));
     cros_client_socket_ =
-        std::make_unique<arc_networkd::Socket>(base::ScopedFD(fds[1]));
+        std::make_unique<patchpanel::Socket>(base::ScopedFD(fds[1]));
 
     connect_job_ = std::make_unique<ProxyConnectJob>(
-        std::make_unique<arc_networkd::Socket>(base::ScopedFD(fds[0])), "",
+        std::make_unique<patchpanel::Socket>(base::ScopedFD(fds[0])), "",
         base::BindOnce(&ProxyConnectJobTest::ResolveProxy,
                        base::Unretained(this)),
         base::BindOnce(&ProxyConnectJobTest::OnConnectionSetupFinished,
@@ -65,7 +65,7 @@
   }
 
   void OnConnectionSetupFinished(
-      std::unique_ptr<arc_networkd::SocketForwarder> fwd,
+      std::unique_ptr<patchpanel::SocketForwarder> fwd,
       ProxyConnectJob* connect_job) {
     ASSERT_EQ(connect_job, connect_job_.get());
   }
@@ -73,7 +73,7 @@
   std::unique_ptr<ProxyConnectJob> connect_job_;
   base::MessageLoopForIO loop_;
   brillo::BaseMessageLoop brillo_loop_{&loop_};
-  std::unique_ptr<arc_networkd::Socket> cros_client_socket_;
+  std::unique_ptr<patchpanel::Socket> cros_client_socket_;
 };
 
 TEST_F(ProxyConnectJobTest, SuccessfulConnection) {
diff --git a/system-proxy/server_proxy.cc b/system-proxy/server_proxy.cc
index 2b720c8..a80f299 100644
--- a/system-proxy/server_proxy.cc
+++ b/system-proxy/server_proxy.cc
@@ -131,7 +131,7 @@
 }
 
 void ServerProxy::CreateListeningSocket() {
-  listening_fd_ = std::make_unique<arc_networkd::Socket>(
+  listening_fd_ = std::make_unique<patchpanel::Socket>(
       AF_INET, SOCK_STREAM | SOCK_NONBLOCK);
 
   struct sockaddr_in addr = {0};
@@ -185,7 +185,7 @@
 }
 
 void ServerProxy::OnConnectionSetupFinished(
-    std::unique_ptr<arc_networkd::SocketForwarder> fwd,
+    std::unique_ptr<patchpanel::SocketForwarder> fwd,
     ProxyConnectJob* connect_job) {
   if (fwd) {
     // The connection was set up successfully.
diff --git a/system-proxy/server_proxy.h b/system-proxy/server_proxy.h
index f5bc346..57da525 100644
--- a/system-proxy/server_proxy.h
+++ b/system-proxy/server_proxy.h
@@ -17,10 +17,10 @@
 #include <brillo/asynchronous_signal_handler.h>
 #include <gtest/gtest_prod.h>  // for FRIEND_TEST
 
-namespace arc_networkd {
+namespace patchpanel {
 class Socket;
 class SocketForwarder;
-}  // namespace arc_networkd
+}  // namespace patchpanel
 
 namespace system_proxy {
 
@@ -73,7 +73,7 @@
   // corresponds to the tunnel between the client and the server that has
   // started to forward data. In case of failure, |fwd| is empty.
   void OnConnectionSetupFinished(
-      std::unique_ptr<arc_networkd::SocketForwarder> fwd,
+      std::unique_ptr<patchpanel::SocketForwarder> fwd,
       ProxyConnectJob* connect_job);
 
   // Called when the proxy resolution result for |target_url| is received via
@@ -91,13 +91,13 @@
   // encoded and separated by colon.
   std::string credentials_;
 
-  std::unique_ptr<arc_networkd::Socket> listening_fd_;
+  std::unique_ptr<patchpanel::Socket> listening_fd_;
 
   // List of SocketForwarders that corresponds to the TCP tunnel between the
   // local client and the remote  proxy, forwarding data between the TCP
   // connection initiated by the local client to the local proxy and the TCP
   // connection initiated by the local proxy to the remote proxy.
-  std::list<std::unique_ptr<arc_networkd::SocketForwarder>> forwarders_;
+  std::list<std::unique_ptr<patchpanel::SocketForwarder>> forwarders_;
 
   std::map<ProxyConnectJob*, std::unique_ptr<ProxyConnectJob>>
       pending_connect_jobs_;
diff --git a/system-proxy/server_proxy_test.cc b/system-proxy/server_proxy_test.cc
index 34c8a5e..a8d4cf9 100644
--- a/system-proxy/server_proxy_test.cc
+++ b/system-proxy/server_proxy_test.cc
@@ -55,7 +55,7 @@
 
 class MockProxyConnectJob : public ProxyConnectJob {
  public:
-  MockProxyConnectJob(std::unique_ptr<arc_networkd::Socket> socket,
+  MockProxyConnectJob(std::unique_ptr<patchpanel::Socket> socket,
                       const std::string& credentials,
                       ResolveProxyCallback resolve_proxy_callback,
                       OnConnectionSetupFinishedCallback setup_finished_callback)
@@ -166,7 +166,7 @@
   ipv4addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
 
   auto client_socket =
-      std::make_unique<arc_networkd::Socket>(AF_INET, SOCK_STREAM);
+      std::make_unique<patchpanel::Socket>(AF_INET, SOCK_STREAM);
   EXPECT_TRUE(client_socket->Connect((const struct sockaddr*)&ipv4addr,
                                      sizeof(ipv4addr)));
   brillo_loop_.RunOnce(false);
@@ -220,7 +220,7 @@
   // Create |connection_count| connections.
   for (int i = 0; i < connection_count; ++i) {
     auto client_socket =
-        std::make_unique<arc_networkd::Socket>(AF_INET, SOCK_STREAM);
+        std::make_unique<patchpanel::Socket>(AF_INET, SOCK_STREAM);
     auto mock_connect_job = std::make_unique<MockProxyConnectJob>(
         std::move(client_socket), "" /* credentials */,
         base::BindOnce([](const std::string& target_url,
@@ -243,10 +243,10 @@
 
   // Resolve |success_count| successful connections.
   for (int i = 0; i < success_count; ++i) {
-    auto fwd = std::make_unique<arc_networkd::SocketForwarder>(
+    auto fwd = std::make_unique<patchpanel::SocketForwarder>(
         "" /* thread name */,
-        std::make_unique<arc_networkd::Socket>(AF_INET, SOCK_STREAM),
-        std::make_unique<arc_networkd::Socket>(AF_INET, SOCK_STREAM));
+        std::make_unique<patchpanel::Socket>(AF_INET, SOCK_STREAM),
+        std::make_unique<patchpanel::Socket>(AF_INET, SOCK_STREAM));
     fwd->Start();
     auto job_iter = server_proxy_->pending_connect_jobs_.begin();
     std::move(job_iter->second->setup_finished_callback_)