blob: 19c668afc4598447b1e275311791137d777c114c [file] [log] [blame]
// Copyright 2015 The Chromium OS 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 SHILL_PERMISSION_BROKER_PROXY_H_
#define SHILL_PERMISSION_BROKER_PROXY_H_
#include <string>
#include <vector>
#include <base/macros.h>
#include "shill/dbus_proxies/org.chromium.PermissionBroker.h"
namespace DBus {
class Connection;
} // namespace DBus
namespace shill {
class PermissionBrokerProxyInterface {
public:
PermissionBrokerProxyInterface();
virtual ~PermissionBrokerProxyInterface();
virtual bool RequestVpnSetup(const std::vector<std::string> &user_names,
const std::string &interface) = 0;
virtual bool RemoveVpnSetup() = 0;
};
class PermissionBrokerProxy : public PermissionBrokerProxyInterface {
public:
explicit PermissionBrokerProxy(DBus::Connection* connection);
~PermissionBrokerProxy() override;
bool RequestVpnSetup(const std::vector<std::string> &user_names,
const std::string &interface) override;
bool RemoveVpnSetup() override;
private:
static const int kInvalidHandle;
class Proxy : public org::chromium::PermissionBroker_proxy,
public DBus::ObjectProxy {
public:
explicit Proxy(DBus::Connection* connection);
~Proxy() override;
private:
DISALLOW_COPY_AND_ASSIGN(Proxy);
};
Proxy proxy_;
int lifeline_read_fd_;
int lifeline_write_fd_;
DISALLOW_COPY_AND_ASSIGN(PermissionBrokerProxy);
};
} // namespace shill
#endif // SHILL_PERMISSION_BROKER_PROXY_H_