OSDN Git Service

Implement the fallthrough rule to support split tunnel VPNs.
[android-x86/system-netd.git] / server / PhysicalNetwork.h
index 215c8b0..2ef10df 100644 (file)
 
 class PhysicalNetwork : public Network {
 public:
-    explicit PhysicalNetwork(unsigned netId);
+    class Delegate {
+    public:
+        virtual ~Delegate();
+
+        virtual int addFallthrough(const std::string& physicalInterface,
+                                   Permission permission) WARN_UNUSED_RESULT = 0;
+        virtual int removeFallthrough(const std::string& physicalInterface,
+                                      Permission permission) WARN_UNUSED_RESULT = 0;
+    };
+
+    PhysicalNetwork(unsigned netId, Delegate* delegate);
     virtual ~PhysicalNetwork();
 
     // These refer to permissions that apps must have in order to use this network.
@@ -33,9 +43,11 @@ public:
     int removeAsDefault() WARN_UNUSED_RESULT;
 
 private:
+    Type getType() const override;
     int addInterface(const std::string& interface) override WARN_UNUSED_RESULT;
     int removeInterface(const std::string& interface) override WARN_UNUSED_RESULT;
 
+    Delegate* const mDelegate;
     Permission mPermission;
     bool mIsDefault;
 };