OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROMEOS_DBUS_PERMISSION_BROKER_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_PERMISSION_BROKER_CLIENT_H_ |
6 #define CHROMEOS_DBUS_PERMISSION_BROKER_CLIENT_H_ | 6 #define CHROMEOS_DBUS_PERMISSION_BROKER_CLIENT_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "base/basictypes.h" | |
11 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/macros.h" |
12 #include "chromeos/chromeos_export.h" | 14 #include "chromeos/chromeos_export.h" |
13 #include "chromeos/dbus/dbus_client.h" | 15 #include "chromeos/dbus/dbus_client.h" |
14 #include "dbus/file_descriptor.h" | 16 #include "dbus/file_descriptor.h" |
15 | 17 |
16 namespace chromeos { | 18 namespace chromeos { |
17 | 19 |
18 // PermissionBrokerClient is used to communicate with the permission broker, a | 20 // PermissionBrokerClient is used to communicate with the permission broker, a |
19 // process that allows requesting permission to access specific device nodes. | 21 // process that allows requesting permission to access specific device nodes. |
20 // For example, one place that this client is used is within the USB extension | 22 // For example, one place that this client is used is within the USB extension |
21 // API code, where it is used to request explicit access to USB peripherals | 23 // API code, where it is used to request explicit access to USB peripherals |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 57 |
56 // OpenPath requests that the permission broker open the device node | 58 // OpenPath requests that the permission broker open the device node |
57 // identified by |path| and return the resulting file descriptor. | 59 // identified by |path| and return the resulting file descriptor. |
58 virtual void OpenPath(const std::string& path, | 60 virtual void OpenPath(const std::string& path, |
59 const OpenPathCallback& callback) = 0; | 61 const OpenPathCallback& callback) = 0; |
60 | 62 |
61 // Requests the |port| be opened on the firewall for incoming TCP/IP | 63 // Requests the |port| be opened on the firewall for incoming TCP/IP |
62 // connections received on |interface| (an empty string indicates all | 64 // connections received on |interface| (an empty string indicates all |
63 // interfaces). An open pipe must be passed as |lifeline_fd| so that the | 65 // interfaces). An open pipe must be passed as |lifeline_fd| so that the |
64 // permission broker can monitor the lifetime of the calling process. | 66 // permission broker can monitor the lifetime of the calling process. |
65 virtual void RequestTcpPortAccess(uint16 port, | 67 virtual void RequestTcpPortAccess(uint16_t port, |
66 const std::string& interface, | 68 const std::string& interface, |
67 const dbus::FileDescriptor& lifeline_fd, | 69 const dbus::FileDescriptor& lifeline_fd, |
68 const ResultCallback& callback) = 0; | 70 const ResultCallback& callback) = 0; |
69 | 71 |
70 // Requests the |port| be opened on the firewall for incoming UDP packets | 72 // Requests the |port| be opened on the firewall for incoming UDP packets |
71 // received on |interface| (an empty string indicates all interfaces). An open | 73 // received on |interface| (an empty string indicates all interfaces). An open |
72 // pipe must be passed as |lifeline_fd| so that the permission broker can | 74 // pipe must be passed as |lifeline_fd| so that the permission broker can |
73 // monitor the lifetime of the calling process. | 75 // monitor the lifetime of the calling process. |
74 virtual void RequestUdpPortAccess(uint16 port, | 76 virtual void RequestUdpPortAccess(uint16_t port, |
75 const std::string& interface, | 77 const std::string& interface, |
76 const dbus::FileDescriptor& lifeline_fd, | 78 const dbus::FileDescriptor& lifeline_fd, |
77 const ResultCallback& callback) = 0; | 79 const ResultCallback& callback) = 0; |
78 | 80 |
79 // Releases a request for an open firewall port for TCP/IP connections. The | 81 // Releases a request for an open firewall port for TCP/IP connections. The |
80 // |port| and |interface| parameters must be the same as a previous call to | 82 // |port| and |interface| parameters must be the same as a previous call to |
81 // RequestTcpPortAccess. | 83 // RequestTcpPortAccess. |
82 virtual void ReleaseTcpPort(uint16 port, | 84 virtual void ReleaseTcpPort(uint16_t port, |
83 const std::string& interface, | 85 const std::string& interface, |
84 const ResultCallback& callback) = 0; | 86 const ResultCallback& callback) = 0; |
85 | 87 |
86 // Releases a request for an open firewall port for UDP packets. The |port| | 88 // Releases a request for an open firewall port for UDP packets. The |port| |
87 // and |interface| parameters must be the same as a previous call to | 89 // and |interface| parameters must be the same as a previous call to |
88 // RequestUdpPortAccess. | 90 // RequestUdpPortAccess. |
89 virtual void ReleaseUdpPort(uint16 port, | 91 virtual void ReleaseUdpPort(uint16_t port, |
90 const std::string& interface, | 92 const std::string& interface, |
91 const ResultCallback& callback) = 0; | 93 const ResultCallback& callback) = 0; |
92 | 94 |
93 protected: | 95 protected: |
94 PermissionBrokerClient(); | 96 PermissionBrokerClient(); |
95 | 97 |
96 private: | 98 private: |
97 DISALLOW_COPY_AND_ASSIGN(PermissionBrokerClient); | 99 DISALLOW_COPY_AND_ASSIGN(PermissionBrokerClient); |
98 }; | 100 }; |
99 | 101 |
100 } // namespace chromeos | 102 } // namespace chromeos |
101 | 103 |
102 #endif // CHROMEOS_DBUS_PERMISSION_BROKER_CLIENT_H_ | 104 #endif // CHROMEOS_DBUS_PERMISSION_BROKER_CLIENT_H_ |
OLD | NEW |