blob: f04578e9cf409303edf0ad0a5c1f02b3a294a916 [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>
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 Petkov4a09b6b2011-07-19 12:52:06 -070016#include "shill/dbus_bindings/flimflam-ipconfig.h"
Chris Masonec6c6c132011-06-30 11:29:52 -070017
18namespace shill {
19
20class 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.
27class 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 agrawal8abd2f62012-01-30 14:56:14 -080051 virtual void ClearProperty(const std::string &name, ::DBus::Error &error);
Chris Masonec6c6c132011-06-30 11:29:52 -070052 // TODO(cmasone): implement these stubs.
Chris Masonec6c6c132011-06-30 11:29:52 -070053 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_