mukesh agrawal | 8abd2f6 | 2012-01-30 14:56:14 -0800 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 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_IPCONFIG_DBUS_ADAPTOR_H_ |
| 6 | #define SHILL_IPCONFIG_DBUS_ADAPTOR_H_ |
| 7 | |
| 8 | #include <map> |
| 9 | #include <string> |
| 10 | |
| 11 | #include <base/basictypes.h> |
| 12 | #include <dbus-c++/dbus.h> |
| 13 | |
| 14 | #include "shill/adaptor_interfaces.h" |
| 15 | #include "shill/dbus_adaptor.h" |
Darin Petkov | 4a09b6b | 2011-07-19 12:52:06 -0700 | [diff] [blame] | 16 | #include "shill/dbus_bindings/flimflam-ipconfig.h" |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 17 | |
| 18 | namespace shill { |
| 19 | |
| 20 | class IPConfig; |
| 21 | |
| 22 | // Subclass of DBusAdaptor for IPConfig objects |
| 23 | // There is a 1:1 mapping between IPConfig and IPConfigDBusAdaptor |
| 24 | // instances. Furthermore, the IPConfig owns the IPConfigDBusAdaptor |
| 25 | // and manages its lifetime, so we're OK with IPConfigDBusAdaptor |
| 26 | // having a bare pointer to its owner ipconfig. |
| 27 | class IPConfigDBusAdaptor : public org::chromium::flimflam::IPConfig_adaptor, |
| 28 | public DBusAdaptor, |
| 29 | public IPConfigAdaptorInterface { |
| 30 | public: |
| 31 | static const char kInterfaceName[]; |
| 32 | static const char kPath[]; |
| 33 | |
| 34 | IPConfigDBusAdaptor(DBus::Connection *conn, IPConfig *ipconfig); |
| 35 | virtual ~IPConfigDBusAdaptor(); |
| 36 | |
| 37 | // Implementation of IPConfigAdaptorInterface. |
| 38 | virtual const std::string &GetRpcIdentifier() { return path(); } |
| 39 | virtual void EmitBoolChanged(const std::string &name, bool value); |
| 40 | virtual void EmitUintChanged(const std::string &name, uint32 value); |
| 41 | virtual void EmitIntChanged(const std::string &name, int value); |
| 42 | virtual void EmitStringChanged(const std::string &name, |
| 43 | const std::string &value); |
| 44 | |
| 45 | // Implementation of IPConfig_adaptor |
| 46 | virtual std::map<std::string, ::DBus::Variant> GetProperties( |
| 47 | ::DBus::Error &error); |
| 48 | virtual void SetProperty(const std::string &name, |
| 49 | const ::DBus::Variant &value, |
| 50 | ::DBus::Error &error); |
mukesh agrawal | 8abd2f6 | 2012-01-30 14:56:14 -0800 | [diff] [blame] | 51 | virtual void ClearProperty(const std::string &name, ::DBus::Error &error); |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 52 | // TODO(cmasone): implement these stubs. |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 53 | virtual void Remove(::DBus::Error &error); |
| 54 | virtual void MoveBefore(const ::DBus::Path& , ::DBus::Error &error); |
| 55 | virtual void MoveAfter(const ::DBus::Path& , ::DBus::Error &error); |
| 56 | |
| 57 | private: |
| 58 | IPConfig *ipconfig_; |
| 59 | DISALLOW_COPY_AND_ASSIGN(IPConfigDBusAdaptor); |
| 60 | }; |
| 61 | |
| 62 | } // namespace shill |
| 63 | #endif // SHILL_IPCONFIG_DBUS_ADAPTOR_H_ |