Index: chromeos/network/firewall_hole.h |
diff --git a/chromeos/network/firewall_hole.h b/chromeos/network/firewall_hole.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..42215a9930b4ae5d6d24b7b26fb6695fd88cd957 |
--- /dev/null |
+++ b/chromeos/network/firewall_hole.h |
@@ -0,0 +1,65 @@ |
+// Copyright 2015 The Chromium 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 CHROMEOS_NETWORK_FIREWALL_HOLE_H_ |
+#define CHROMEOS_NETWORK_FIREWALL_HOLE_H_ |
+ |
+#include <string> |
+ |
+#include "base/basictypes.h" |
pneubeck (no reviews)
2015/03/03 22:24:51
what for? please see the comment in that header re
Reilly Grant (use Gerrit)
2015/03/07 02:36:03
Done.
|
+#include "base/callback.h" |
pneubeck (no reviews)
2015/03/03 22:24:51
is callback_forward.h sufficient?
Reilly Grant (use Gerrit)
2015/03/07 02:36:03
Done.
|
+#include "base/threading/thread_checker.h" |
+#include "chromeos/chromeos_export.h" |
+ |
+namespace dbus { |
+class FileDescriptor; |
+} |
+ |
+namespace chromeos { |
+ |
+// This class works with the Chrome OS permission broker to open a port in the |
+// system firewall. It is closed on destruction. |
+class CHROMEOS_EXPORT FirewallHole { |
+ public: |
+ enum PortType { |
pneubeck (no reviews)
2015/03/03 22:24:52
I think 'enum class' is now the preferred kind as
Reilly Grant (use Gerrit)
2015/03/07 02:36:03
Done.
|
+ UDP, |
+ TCP, |
+ }; |
+ |
+ typedef base::Callback<void(scoped_ptr<FirewallHole>)> OpenCallback; |
+ |
+ static void Open(PortType type, |
pneubeck (no reviews)
2015/03/03 22:24:51
This interface implies that the newly created obje
Reilly Grant (use Gerrit)
2015/03/07 02:36:03
I don't understand your objection. There are no we
pneubeck (no reviews)
2015/03/08 03:35:01
Don't get me wrong. I just want to make sure we're
|
+ uint16 port, |
+ const std::string& interface, |
pneubeck (no reviews)
2015/03/03 22:24:51
needs a comment what |interface| is / what format
Reilly Grant (use Gerrit)
2015/03/07 02:36:03
Done.
|
+ const OpenCallback& callback); |
+ |
+ ~FirewallHole(); |
+ |
+ private: |
+ FirewallHole(PortType type, |
+ uint16 port, |
+ const std::string& interface, |
+ dbus::FileDescriptor* lifeline_fd); |
pneubeck (no reviews)
2015/03/03 22:24:51
this takes ownership of lifeline_fd, which should
Reilly Grant (use Gerrit)
2015/03/07 02:36:03
I believe this is addressed in the latest patchset
|
+ |
+ void OnLifelineCreated(dbus::FileDescriptor* lifeline_remote, |
pneubeck (no reviews)
2015/03/03 22:24:51
what's lifeline? that's unclear by looking only at
Reilly Grant (use Gerrit)
2015/03/07 02:36:03
I believe this is addressed in the latest patchset
|
+ const OpenCallback& callback); |
+ void OnPortAccessGranted(const FirewallHole::OpenCallback& callback, |
+ bool success); |
+ |
+ const PortType type_; |
+ const uint16 port_; |
+ const std::string interface_; |
+ |
+ // Has the permission broker granted this firewall exception? |
+ bool opened_; |
+ |
+ // An file descriptor used by firewalld to track the lifetime of this process. |
+ dbus::FileDescriptor* lifeline_fd_; |
pneubeck (no reviews)
2015/03/03 22:24:51
should document that this is owning the filedescri
Reilly Grant (use Gerrit)
2015/03/07 02:36:03
I believe this is addressed in the latest patchset
|
+ |
+ base::ThreadChecker thread_checker_; |
+}; |
+ |
+} // namespace chromeos |
+ |
+#endif // CHROMEOS_NETWORK_FIREWALL_HOLE_H_ |