blob: dcfbb28922b2c832d78467ca1affd8907ce31b57 [file] [log] [blame]
mukesh agrawal8abd2f62012-01-30 14:56:14 -08001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Chris Masonec6c6c132011-06-30 11:29:52 -07002// 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_IPCONFIG_DBUS_ADAPTOR_H_
6#define SHILL_IPCONFIG_DBUS_ADAPTOR_H_
7
8#include <map>
9#include <string>
Alex Vakulenko8a532292014-06-16 17:18:44 -070010#include <vector>
Chris Masonec6c6c132011-06-30 11:29:52 -070011
Ben Chancc67c522014-09-03 07:19:18 -070012#include <base/macros.h>
Chris Masonec6c6c132011-06-30 11:29:52 -070013#include <dbus-c++/dbus.h>
14
15#include "shill/adaptor_interfaces.h"
16#include "shill/dbus_adaptor.h"
Liam McLoughlinef342b42013-09-13 21:05:36 +010017#include "shill/dbus_adaptors/org.chromium.flimflam.IPConfig.h"
Chris Masonec6c6c132011-06-30 11:29:52 -070018
19namespace shill {
20
21class IPConfig;
22
23// Subclass of DBusAdaptor for IPConfig objects
24// There is a 1:1 mapping between IPConfig and IPConfigDBusAdaptor
25// instances. Furthermore, the IPConfig owns the IPConfigDBusAdaptor
26// and manages its lifetime, so we're OK with IPConfigDBusAdaptor
27// having a bare pointer to its owner ipconfig.
28class IPConfigDBusAdaptor : public org::chromium::flimflam::IPConfig_adaptor,
29 public DBusAdaptor,
30 public IPConfigAdaptorInterface {
31 public:
32 static const char kInterfaceName[];
33 static const char kPath[];
34
Paul Stewart8ae18742015-06-16 13:13:10 -070035 IPConfigDBusAdaptor(DBus::Connection* conn, IPConfig* ipconfig);
Ben Chan5ea763b2014-08-13 11:07:54 -070036 ~IPConfigDBusAdaptor() override;
Chris Masonec6c6c132011-06-30 11:29:52 -070037
38 // Implementation of IPConfigAdaptorInterface.
Paul Stewart8ae18742015-06-16 13:13:10 -070039 const std::string& GetRpcIdentifier() override { return path(); }
40 void EmitBoolChanged(const std::string& name, bool value) override;
41 void EmitUintChanged(const std::string& name, uint32_t value) override;
42 void EmitIntChanged(const std::string& name, int value) override;
43 void EmitStringChanged(const std::string& name,
44 const std::string& value) override;
45 void EmitStringsChanged(const std::string& name,
46 const std::vector<std::string>& value) override;
Chris Masonec6c6c132011-06-30 11:29:52 -070047
48 // Implementation of IPConfig_adaptor
Yunlian Jiang6acd9662015-01-30 08:36:10 -080049 std::map<std::string, DBus::Variant> GetProperties(
Paul Stewart8ae18742015-06-16 13:13:10 -070050 DBus::Error& error) override; // NOLINT
51 void SetProperty(const std::string& name,
52 const DBus::Variant& value,
53 DBus::Error& error) override; // NOLINT
54 void ClearProperty(const std::string& name,
55 DBus::Error& error) override; // NOLINT
56 void Remove(DBus::Error& error) override; // NOLINT
57 void Refresh(DBus::Error& error) override; // NOLINT
Chris Masonec6c6c132011-06-30 11:29:52 -070058
59 private:
Paul Stewart8ae18742015-06-16 13:13:10 -070060 IPConfig* ipconfig_;
Chris Masonec6c6c132011-06-30 11:29:52 -070061 DISALLOW_COPY_AND_ASSIGN(IPConfigDBusAdaptor);
62};
63
64} // namespace shill
Ben Chanc45688b2014-07-02 23:50:45 -070065
Chris Masonec6c6c132011-06-30 11:29:52 -070066#endif // SHILL_IPCONFIG_DBUS_ADAPTOR_H_