Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: chromeos/network/firewall_hole.h

Issue 965613002: Open a firewall hole when a TCP server or UDP socket is bound. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Actually use the thread_checker_ in FirewallHole. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium 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
5 #ifndef CHROMEOS_NETWORK_FIREWALL_HOLE_H_
6 #define CHROMEOS_NETWORK_FIREWALL_HOLE_H_
7
8 #include <string>
9
10 #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.
11 #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.
12 #include "base/threading/thread_checker.h"
13 #include "chromeos/chromeos_export.h"
14
15 namespace dbus {
16 class FileDescriptor;
17 }
18
19 namespace chromeos {
20
21 // This class works with the Chrome OS permission broker to open a port in the
22 // system firewall. It is closed on destruction.
23 class CHROMEOS_EXPORT FirewallHole {
24 public:
25 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.
26 UDP,
27 TCP,
28 };
29
30 typedef base::Callback<void(scoped_ptr<FirewallHole>)> OpenCallback;
31
32 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
33 uint16 port,
34 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.
35 const OpenCallback& callback);
36
37 ~FirewallHole();
38
39 private:
40 FirewallHole(PortType type,
41 uint16 port,
42 const std::string& interface,
43 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
44
45 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
46 const OpenCallback& callback);
47 void OnPortAccessGranted(const FirewallHole::OpenCallback& callback,
48 bool success);
49
50 const PortType type_;
51 const uint16 port_;
52 const std::string interface_;
53
54 // Has the permission broker granted this firewall exception?
55 bool opened_;
56
57 // An file descriptor used by firewalld to track the lifetime of this process.
58 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
59
60 base::ThreadChecker thread_checker_;
61 };
62
63 } // namespace chromeos
64
65 #endif // CHROMEOS_NETWORK_FIREWALL_HOLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698