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/patchpanel/multicast_proxy.h b/patchpanel/multicast_proxy.h
new file mode 100644
index 0000000..ef7a294
--- /dev/null
+++ b/patchpanel/multicast_proxy.h
@@ -0,0 +1,47 @@
+// Copyright 2020 The Chromium OS 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 PATCHPANEL_MULTICAST_PROXY_H_
+#define PATCHPANEL_MULTICAST_PROXY_H_
+
+#include <map>
+#include <memory>
+#include <string>
+
+#include <brillo/daemons/daemon.h>
+
+#include "patchpanel/broadcast_forwarder.h"
+#include "patchpanel/message_dispatcher.h"
+#include "patchpanel/multicast_forwarder.h"
+
+namespace patchpanel {
+
+// MulticastProxy manages multiple MulticastForwarder instances to forward
+// multicast for multiple physical interfaces.
+class MulticastProxy : public brillo::Daemon {
+ public:
+ explicit MulticastProxy(base::ScopedFD control_fd);
+ virtual ~MulticastProxy() = default;
+
+ protected:
+ int OnInit() override;
+
+ void OnParentProcessExit();
+ void OnDeviceMessage(const DeviceMessage& msg);
+
+ private:
+ void Reset();
+
+ MessageDispatcher msg_dispatcher_;
+ std::map<std::string, std::unique_ptr<MulticastForwarder>> mdns_fwds_;
+ std::map<std::string, std::unique_ptr<MulticastForwarder>> ssdp_fwds_;
+ std::map<std::string, std::unique_ptr<BroadcastForwarder>> bcast_fwds_;
+
+ base::WeakPtrFactory<MulticastProxy> weak_factory_{this};
+ DISALLOW_COPY_AND_ASSIGN(MulticastProxy);
+};
+
+} // namespace patchpanel
+
+#endif // PATCHPANEL_MULTICAST_PROXY_H_