blob: 35285cc10e1c25c99033ef8c795f8307950fe925 [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
35 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.
39 virtual const std::string &GetRpcIdentifier() { return path(); }
40 virtual void EmitBoolChanged(const std::string &name, bool value);
Ben Chan7fab8972014-08-10 17:14:46 -070041 virtual void EmitUintChanged(const std::string &name, uint32_t value);
Chris Masonec6c6c132011-06-30 11:29:52 -070042 virtual void EmitIntChanged(const std::string &name, int value);
43 virtual void EmitStringChanged(const std::string &name,
44 const std::string &value);
mukesh agrawal7aed61c2013-04-22 16:01:24 -070045 virtual void EmitStringsChanged(const std::string &name,
46 const std::vector<std::string> &value);
Chris Masonec6c6c132011-06-30 11:29:52 -070047
48 // Implementation of IPConfig_adaptor
Ben Chan3f4d4ee2014-09-09 07:41:33 -070049 virtual std::map<std::string, DBus::Variant> GetProperties(
50 DBus::Error &error); // NOLINT
Chris Masonec6c6c132011-06-30 11:29:52 -070051 virtual void SetProperty(const std::string &name,
Ben Chan3f4d4ee2014-09-09 07:41:33 -070052 const DBus::Variant &value,
53 DBus::Error &error); // NOLINT
54 virtual void ClearProperty(const std::string &name,
55 DBus::Error &error); // NOLINT
56 virtual void Remove(DBus::Error &error); // NOLINT
57 virtual void Refresh(DBus::Error &error); // NOLINT
Chris Masonec6c6c132011-06-30 11:29:52 -070058
59 private:
60 IPConfig *ipconfig_;
61 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_