Prabhu Kaliamoorthi | 77e7683 | 2015-02-13 15:20:23 +0100 | [diff] [blame] | 1 | // Copyright 2015 The Chromium OS 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 SHILL_PERMISSION_BROKER_PROXY_H_ |
| 6 | #define SHILL_PERMISSION_BROKER_PROXY_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | #include <vector> |
| 10 | |
| 11 | #include <base/macros.h> |
| 12 | |
| 13 | #include "shill/dbus_proxies/org.chromium.PermissionBroker.h" |
| 14 | |
| 15 | namespace DBus { |
| 16 | class Connection; |
| 17 | } // namespace DBus |
| 18 | |
| 19 | namespace shill { |
| 20 | |
| 21 | class PermissionBrokerProxyInterface { |
| 22 | public: |
| 23 | PermissionBrokerProxyInterface(); |
| 24 | virtual ~PermissionBrokerProxyInterface(); |
Paul Stewart | 1a212a6 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 25 | virtual bool RequestVpnSetup(const std::vector<std::string>& user_names, |
| 26 | const std::string& interface) = 0; |
Prabhu Kaliamoorthi | 77e7683 | 2015-02-13 15:20:23 +0100 | [diff] [blame] | 27 | virtual bool RemoveVpnSetup() = 0; |
| 28 | }; |
| 29 | |
| 30 | class PermissionBrokerProxy : public PermissionBrokerProxyInterface { |
| 31 | public: |
| 32 | explicit PermissionBrokerProxy(DBus::Connection* connection); |
| 33 | ~PermissionBrokerProxy() override; |
| 34 | |
Paul Stewart | 1a212a6 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 35 | bool RequestVpnSetup(const std::vector<std::string>& user_names, |
| 36 | const std::string& interface) override; |
Prabhu Kaliamoorthi | 77e7683 | 2015-02-13 15:20:23 +0100 | [diff] [blame] | 37 | |
| 38 | bool RemoveVpnSetup() override; |
| 39 | |
| 40 | private: |
| 41 | static const int kInvalidHandle; |
| 42 | |
| 43 | class Proxy : public org::chromium::PermissionBroker_proxy, |
| 44 | public DBus::ObjectProxy { |
| 45 | public: |
| 46 | explicit Proxy(DBus::Connection* connection); |
| 47 | ~Proxy() override; |
| 48 | |
| 49 | private: |
| 50 | DISALLOW_COPY_AND_ASSIGN(Proxy); |
| 51 | }; |
| 52 | |
| 53 | Proxy proxy_; |
| 54 | int lifeline_read_fd_; |
| 55 | int lifeline_write_fd_; |
| 56 | |
| 57 | DISALLOW_COPY_AND_ASSIGN(PermissionBrokerProxy); |
| 58 | }; |
| 59 | |
| 60 | } // namespace shill |
| 61 | |
| 62 | #endif // SHILL_PERMISSION_BROKER_PROXY_H_ |