blob: 6e5facbf7bdaab8280b9f7ca9483ab21c5878316 [file] [log] [blame]
Garrick Evans6e4eb3b2020-03-09 07:18:31 +09001// Copyright 2020 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Garrick Evans3388a032020-03-24 11:25:55 +09005#ifndef PATCHPANEL_TRAFFIC_FORWARDER_H_
6#define PATCHPANEL_TRAFFIC_FORWARDER_H_
Garrick Evans6e4eb3b2020-03-09 07:18:31 +09007
8#include <string>
9
Garrick Evans3388a032020-03-24 11:25:55 +090010namespace patchpanel {
Garrick Evans6e4eb3b2020-03-09 07:18:31 +090011
12// Interface to encapsulate traffic forwarding behaviors so individual services
13// are not exposed to dependents.
14class TrafficForwarder {
15 public:
16 virtual ~TrafficForwarder() = default;
17
Taoyu Li7dca19a2020-03-16 16:27:07 +090018 // Start forwarding between a pair of physical and virtual (guest-facing)
19 // interfaces.
Garrick Evans6e4eb3b2020-03-09 07:18:31 +090020 virtual void StartForwarding(const std::string& ifname_physical,
21 const std::string& ifname_virtual,
Garrick Evans6e4eb3b2020-03-09 07:18:31 +090022 bool ipv6,
23 bool multicast) = 0;
24
Taoyu Li7dca19a2020-03-16 16:27:07 +090025 // Stop forwarding between a interface pair. If |ifname_virtual| is empty,
26 // stop all forwarding from/to |ifname_physical| instead.
Garrick Evans6e4eb3b2020-03-09 07:18:31 +090027 virtual void StopForwarding(const std::string& ifname_physical,
28 const std::string& ifname_virtual,
29 bool ipv6,
30 bool multicast) = 0;
31
32 protected:
33 TrafficForwarder() = default;
34};
35
Garrick Evans3388a032020-03-24 11:25:55 +090036} // namespace patchpanel
Garrick Evans6e4eb3b2020-03-09 07:18:31 +090037
Garrick Evans3388a032020-03-24 11:25:55 +090038#endif // PATCHPANEL_TRAFFIC_FORWARDER_H_