1 // Copyright 2015 The Android Open Source Project 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef WEBSERVER_WEBSERVD_FIREWALL_INTERFACE_H_ 16 #define WEBSERVER_WEBSERVD_FIREWALL_INTERFACE_H_ 17 18 #include <inttypes.h> 19 20 #include <string> 21 22 #include <base/callback.h> 23 #include <base/macros.h> 24 #include <brillo/dbus/dbus_object.h> 25 26 namespace webservd { 27 28 class FirewallInterface { 29 public: 30 virtual ~FirewallInterface() = default; 31 32 // Wait for the firewall DBus service to be up. 33 virtual void WaitForServiceAsync(dbus::Bus* bus, 34 const base::Closure& callback) = 0; 35 36 // Methods for managing firewall ports. 37 virtual void PunchTcpHoleAsync( 38 uint16_t port, 39 const std::string& interface_name, 40 const base::Callback<void(bool)>& success_cb, 41 const base::Callback<void(brillo::Error*)>& failure_cb) = 0; 42 43 protected: 44 FirewallInterface() = default; 45 46 private: 47 DISALLOW_COPY_AND_ASSIGN(FirewallInterface); 48 }; 49 50 } // namespace webservd 51 52 #endif // WEBSERVER_WEBSERVD_FIREWALL_INTERFACE_H_ 53