blob: e579ce37e9413d4974517a38c08f90005e9dc6f0 [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);
mukesh agrawal7aed61c2013-04-22 16:01:24 -070044 virtual void EmitStringsChanged(const std::string &name,
45 const std::vector<std::string> &value);
Chris Masonec6c6c132011-06-30 11:29:52 -070046
47 // Implementation of IPConfig_adaptor
48 virtual std::map<std::string, ::DBus::Variant> GetProperties(
49 ::DBus::Error &error);
50 virtual void SetProperty(const std::string &name,
51 const ::DBus::Variant &value,
52 ::DBus::Error &error);
mukesh agrawal8abd2f62012-01-30 14:56:14 -080053 virtual void ClearProperty(const std::string &name, ::DBus::Error &error);
Chris Masonec6c6c132011-06-30 11:29:52 -070054 virtual void Remove(::DBus::Error &error);
Paul Stewart4558bda2012-08-03 10:44:10 -070055 virtual void Refresh(::DBus::Error &error);
Chris Masonec6c6c132011-06-30 11:29:52 -070056
57 private:
58 IPConfig *ipconfig_;
59 DISALLOW_COPY_AND_ASSIGN(IPConfigDBusAdaptor);
60};
61
62} // namespace shill
63#endif // SHILL_IPCONFIG_DBUS_ADAPTOR_H_