blob: c4d3ad7a7bbb98a656901bdd7bbd4e735c23c0fc [file] [log] [blame]
Prabhu Kaliamoorthi77e76832015-02-13 15:20:23 +01001// 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
15namespace DBus {
16class Connection;
17} // namespace DBus
18
19namespace shill {
20
21class PermissionBrokerProxyInterface {
22 public:
23 PermissionBrokerProxyInterface();
24 virtual ~PermissionBrokerProxyInterface();
Paul Stewart1a212a62015-06-16 13:13:10 -070025 virtual bool RequestVpnSetup(const std::vector<std::string>& user_names,
26 const std::string& interface) = 0;
Prabhu Kaliamoorthi77e76832015-02-13 15:20:23 +010027 virtual bool RemoveVpnSetup() = 0;
28};
29
30class PermissionBrokerProxy : public PermissionBrokerProxyInterface {
31 public:
32 explicit PermissionBrokerProxy(DBus::Connection* connection);
33 ~PermissionBrokerProxy() override;
34
Paul Stewart1a212a62015-06-16 13:13:10 -070035 bool RequestVpnSetup(const std::vector<std::string>& user_names,
36 const std::string& interface) override;
Prabhu Kaliamoorthi77e76832015-02-13 15:20:23 +010037
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_