[shill] Wire shill to dbus

Refactor necessary classes into their own headers and such as well.

BUG=chromium-os:15578
TEST=unit tests, shill --foreground on device

Change-Id: Ib9c5a0e9dab779ecc44c1d0144035f5a09e1086e
Reviewed-on: http://gerrit.chromium.org/gerrit/1307
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
diff --git a/Makefile b/Makefile
index d6b5b6d..6c2991b 100644
--- a/Makefile
+++ b/Makefile
@@ -16,9 +16,9 @@
 BASE_LIB_DIRS =
 
 LIBS = $(BASE_LIBS)
-INCLUDE_DIRS = $(BASE_INCLUDE_DIRS) $(shell $(PKG_CONFIG) --cflags glib-2.0 \
-        gdk-2.0 gtk+-2.0)
-LIB_DIRS = $(BASE_LIB_DIRS) $(shell $(PKG_CONFIG) --libs glib-2.0 \
+INCLUDE_DIRS = $(BASE_INCLUDE_DIRS) $(shell $(PKG_CONFIG) --cflags dbus-c++-1 \
+	glib-2.0 gdk-2.0 gtk+-2.0)
+LIB_DIRS = $(BASE_LIB_DIRS) $(shell $(PKG_CONFIG) --libs dbus-c++-1 glib-2.0 \
         gdk-2.0 gtk+-2.0)
 
 TEST_LIBS = $(BASE_LIBS) -lgmock -lgtest
@@ -39,10 +39,13 @@
 SHILL_OBJS = \
 	dbus_control.o \
 	device.o \
+	device_dbus_adaptor.o \
 	device_info.o \
 	ethernet.o \
 	manager.o \
+	manager_dbus_adaptor.o \
 	service.o \
+	service_dbus_adaptor.o \
 	shill_config.o \
 	shill_daemon.o \
 	shill_event.o \
@@ -53,7 +56,7 @@
 
 TEST_BIN = shill_unittest
 TEST_OBJS = testrunner.o device_info_unittest.o manager_unittest.o \
-	shill_unittest.o
+	shill_unittest.o mock_control.o
 
 all: $(SHILL_BIN) $(TEST_BIN)
 
diff --git a/adaptor_interfaces.h b/adaptor_interfaces.h
new file mode 100644
index 0000000..f0c1666
--- /dev/null
+++ b/adaptor_interfaces.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SHILL_ADAPTOR_INTERFACES_
+#define SHILL_ADAPTOR_INTERFACES_
+
+#include <string>
+
+namespace shill {
+
+// These are the functions that a Manager adaptor must support
+class ManagerAdaptorInterface {
+ public:
+  virtual void UpdateRunning() = 0;
+  virtual ~ManagerAdaptorInterface() {}
+};
+
+// These are the functions that a Service adaptor must support
+class ServiceAdaptorInterface {
+ public:
+  virtual void UpdateConnected() = 0;
+  virtual ~ServiceAdaptorInterface() {}
+};
+
+// These are the functions that a Device adaptor must support
+class DeviceAdaptorInterface {
+ public:
+  virtual void UpdateEnabled() = 0;
+  virtual ~DeviceAdaptorInterface() {}
+};
+
+}  // namespace shill
+#endif  // SHILL_ADAPTOR_INTERFACES_
diff --git a/control_interface.h b/control_interface.h
index 99c230b..9e2bb27 100644
--- a/control_interface.h
+++ b/control_interface.h
@@ -5,46 +5,14 @@
 #ifndef SHILL_CONTROL_INTERFACE_
 #define SHILL_CONTROL_INTERFACE_
 
-#include <string>
-
 namespace shill {
 
 class Device;
+class DeviceAdaptorInterface;
 class Manager;
+class ManagerAdaptorInterface;
 class Service;
-
-using std::string;
-
-// This is the Interface for "partner" objects which are in charge of
-// handling incoming RPCs to the various core classes.
-class AdaptorInterface {
- public:
-  virtual void SetProperty(const string &key, const string &value) = 0;
-  virtual const string *GetProperty(const string &key) = 0;
-  virtual void ClearProperty(const string &key) = 0;
-  virtual ~AdaptorInterface() {}
-};
-
-// These are the functions that a Manager adaptor must support
-class ManagerAdaptorInterface {
- public:
-  virtual void UpdateRunning() = 0;
-  virtual ~ManagerAdaptorInterface() {}
-};
-
-// These are the functions that a Service adaptor must support
-class ServiceAdaptorInterface {
- public:
-  virtual void UpdateConnected() = 0;
-  virtual ~ServiceAdaptorInterface() {}
-};
-
-// These are the functions that a Device adaptor must support
-class DeviceAdaptorInterface {
- public:
-  virtual void UpdateEnabled() = 0;
-  virtual ~DeviceAdaptorInterface() {}
-};
+class ServiceAdaptorInterface;
 
 // This is the Interface for an object factory that creates adaptor objects
 class ControlInterface {
diff --git a/dbus_adaptor.h b/dbus_adaptor.h
new file mode 100644
index 0000000..34319d8
--- /dev/null
+++ b/dbus_adaptor.h
@@ -0,0 +1,29 @@
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SHILL_DBUS_ADAPTOR_H_
+#define SHILL_DBUS_ADAPTOR_H_
+
+#include <string>
+
+#include <dbus-c++/dbus.h>
+
+#include "shill/adaptor_interfaces.h"
+
+namespace shill {
+
+#define SHILL_INTERFACE "org.chromium.flimflam"
+#define SHILL_PATH "/org/chromium/flimflam"
+
+// Superclass for all DBus-backed Adaptor objects
+class DBusAdaptor : public DBus::ObjectAdaptor {
+ public:
+  DBusAdaptor(DBus::Connection& conn, const DBus::Path& object_path)
+      : DBus::ObjectAdaptor(conn, object_path) {
+  }
+  virtual ~DBusAdaptor() {}
+};
+
+}  // namespace shill
+#endif  // SHILL_DBUS_ADAPTOR_H_
diff --git a/dbus_control.cc b/dbus_control.cc
index 7f4ce62..c9fc76a 100644
--- a/dbus_control.cc
+++ b/dbus_control.cc
@@ -2,74 +2,50 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <stdio.h>
-#include <glib.h>
-
 #include <string>
 
-#include "shill/shill_event.h"
+#include <base/logging.h>
+#include <dbus-c++/glib-integration.h>
+#include <dbus-c++/util.h>
+
 #include "shill/dbus_control.h"
-#include "shill/dbus_control_int.h"
+#include "shill/device_dbus_adaptor.h"
+#include "shill/manager_dbus_adaptor.h"
+#include "shill/service_dbus_adaptor.h"
 
 namespace shill {
+DBusControl::DBusControl() {}
 
-#define SHILL_INTERFACE "org.chromium.shill."
-#define SHILL_PATH "/org/chromium/shill/"
-
-const char ManagerDBusAdaptor::kInterfaceName[] = SHILL_INTERFACE "Manager";
-const char ManagerDBusAdaptor::kPath[] = SHILL_PATH "Manager";
-const char ServiceDBusAdaptor::kInterfaceName[] = SHILL_INTERFACE "Service";
-const char ServiceDBusAdaptor::kPath[] = SHILL_PATH "Service";
-const char DeviceDBusAdaptor::kInterfaceName[] = SHILL_INTERFACE "Device";
-const char DeviceDBusAdaptor::kPath[] = SHILL_PATH "Device";
-
-void DBusAdaptor::SetProperty(const string& /* key */,
-                            const string& /* val */) {
-  // Update property hash table, and output DBus signals, if requested
-}
-
-const string *DBusAdaptor::GetProperty(const string & /* key */) {
-  // FIXME(pstew): Should be doing a hash table lookup
-  return new string("value");
-}
-
-void DBusAdaptor::ClearProperty(const string & /* key */) {
-  // Remove entry from hash table
-}
-
-
-ManagerDBusAdaptor::ManagerDBusAdaptor(Manager *manager)
-  : interface_(kInterfaceName),
-    path_(kPath),
-    manager_(manager) {}
-
-void ManagerDBusAdaptor::UpdateRunning() {}
-
-ServiceDBusAdaptor::ServiceDBusAdaptor(Service *service)
-  : interface_(kInterfaceName),
-    path_(kPath),
-    service_(service) {}
-
-void ServiceDBusAdaptor::UpdateConnected() {}
-
-DeviceDBusAdaptor::DeviceDBusAdaptor(Device *device)
-  : interface_(kInterfaceName),
-    path_(kPath),
-    device_(device) {}
-
-void DeviceDBusAdaptor::UpdateEnabled() {}
+DBusControl::~DBusControl() {}
 
 ManagerAdaptorInterface *DBusControl::CreateManagerAdaptor(Manager *manager) {
-  return new ManagerDBusAdaptor(manager);
+  EnsureDispatcher();
+  DBus::Connection conn = DBus::Connection::SystemBus();
+  conn.request_name(ManagerDBusAdaptor::kInterfaceName);
+  return new(std::nothrow) ManagerDBusAdaptor(conn, manager);
 }
 
 ServiceAdaptorInterface *DBusControl::CreateServiceAdaptor(Service *service) {
-  return new ServiceDBusAdaptor(service);
+  EnsureDispatcher();
+  DBus::Connection conn = DBus::Connection::SystemBus();
+  conn.request_name(ServiceDBusAdaptor::kInterfaceName);
+  return new(std::nothrow) ServiceDBusAdaptor(conn, service);
 }
 
 DeviceAdaptorInterface *DBusControl::CreateDeviceAdaptor(Device *device) {
-  return new DeviceDBusAdaptor(device);
+  EnsureDispatcher();
+  DBus::Connection conn = DBus::Connection::SystemBus();
+  conn.request_name(DeviceDBusAdaptor::kInterfaceName);
+  return new(std::nothrow) DeviceDBusAdaptor(conn, device);
 }
 
+void DBusControl::EnsureDispatcher() {
+  if (!dispatcher_.get()) {
+    dispatcher_.reset(new(std::nothrow) DBus::Glib::BusDispatcher());
+    CHECK(dispatcher_.get()) << "Failed to create a dbus-dispatcher";
+    DBus::default_dispatcher = dispatcher_.get();
+    dispatcher_->attach(NULL);
+  }
+}
 
 }  // namespace shill
diff --git a/dbus_control.h b/dbus_control.h
index 4f121fd..71754ba 100644
--- a/dbus_control.h
+++ b/dbus_control.h
@@ -5,17 +5,28 @@
 #ifndef SHILL_DBUS_CONTROL_
 #define SHILL_DBUS_CONTROL_
 
+#include <base/scoped_ptr.h>
+#include <dbus-c++/glib-integration.h>
+#include <dbus-c++/util.h>
+
 #include "shill/control_interface.h"
 
 namespace shill {
 // This is the Interface for the control channel for Shill.
 class DBusControl : public ControlInterface {
  public:
+  DBusControl();
+  virtual ~DBusControl();
+
   ManagerAdaptorInterface *CreateManagerAdaptor(Manager *manager);
   ServiceAdaptorInterface *CreateServiceAdaptor(Service *service);
   DeviceAdaptorInterface *CreateDeviceAdaptor(Device *device);
+
+ private:
+  void EnsureDispatcher();
+  scoped_ptr<DBus::Glib::BusDispatcher> dispatcher_;
 };
 
 }  // namespace shill
 
-#endif  // SHILL_MANAGER_
+#endif  // SHILL_DBUS_CONTROL_
diff --git a/dbus_control_int.h b/dbus_control_int.h
deleted file mode 100644
index 6e0c1c7..0000000
--- a/dbus_control_int.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef SHILL_DBUS_CONTROL_INT_H_
-#define SHILL_DBUS_CONTROL_INT_
-
-#include <string>
-
-namespace shill {
-
-// Superclass for all DBus-backed Adaptor objects
-class DBusAdaptor : public AdaptorInterface {
- public:
-  void SetProperty(const string &key, const string &value);
-  const string *GetProperty(const string &key);
-  void ClearProperty(const string &key);
-
- protected:
-  string interface_;
-  string path_;
-};
-
-class DBusControl;
-
-// Subclass of DBusAdaptor for Manager objects
-class ManagerDBusAdaptor : protected DBusAdaptor,
-                           public ManagerAdaptorInterface {
- public:
-  explicit ManagerDBusAdaptor(Manager *manager);
-  void UpdateRunning();
-
- private:
-  static const char kInterfaceName[];
-  static const char kPath[];
-  string interface_;
-  string path_;
-  Manager *manager_;
-};
-
-// Subclass of DBusAdaptor for Service objects
-class ServiceDBusAdaptor : protected DBusAdaptor,
-                           public ServiceAdaptorInterface {
- public:
-  explicit ServiceDBusAdaptor(Service *service);
-  void UpdateConnected();
-
- private:
-  static const char kInterfaceName[];
-  static const char kPath[];
-  string interface_;
-  string path_;
-  Service *service_;
-};
-
-// Subclass of DBusAdaptor for Device objects
-class DeviceDBusAdaptor : protected DBusAdaptor,
-                          public DeviceAdaptorInterface {
- public:
-  explicit DeviceDBusAdaptor(Device *device);
-  void UpdateEnabled();
-
- private:
-  static const char kInterfaceName[];
-  static const char kPath[];
-  string interface_;
-  string path_;
-  Device *device_;
-};
-
-}  // namespace shill
-#endif  // SHILL_DBUS_CONTROL_INT_
diff --git a/device.cc b/device.cc
index c037df6..a0e4d6d 100644
--- a/device.cc
+++ b/device.cc
@@ -12,6 +12,7 @@
 
 #include "shill/control_interface.h"
 #include "shill/device.h"
+#include "shill/device_dbus_adaptor.h"
 #include "shill/shill_event.h"
 
 using std::string;
diff --git a/device_dbus_adaptor.cc b/device_dbus_adaptor.cc
new file mode 100644
index 0000000..fe19eba
--- /dev/null
+++ b/device_dbus_adaptor.cc
@@ -0,0 +1,47 @@
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "shill/device_dbus_adaptor.h"
+
+#include <map>
+#include <string>
+
+using std::map;
+using std::string;
+
+namespace shill {
+
+// TODO(cmasone): Figure out if we should be trying to own sub-interfaces.
+// static
+const char DeviceDBusAdaptor::kInterfaceName[] = SHILL_INTERFACE;  // ".Device";
+// static
+const char DeviceDBusAdaptor::kPath[] = SHILL_PATH "/Device";
+
+DeviceDBusAdaptor::DeviceDBusAdaptor(DBus::Connection& conn, Device *device)
+    : DBusAdaptor(conn, kPath),
+      device_(device) {
+}
+DeviceDBusAdaptor::~DeviceDBusAdaptor() {}
+
+void DeviceDBusAdaptor::UpdateEnabled() {}
+
+map<string, ::DBus::Variant> DeviceDBusAdaptor::GetProperties(
+    ::DBus::Error &error) {
+  return map<string, ::DBus::Variant>();
+}
+
+void DeviceDBusAdaptor::SetProperty(const string& ,
+                                    const ::DBus::Variant& ,
+                                    ::DBus::Error &error) {
+}
+
+void DeviceDBusAdaptor::ProposeScan(::DBus::Error &error) {
+}
+
+::DBus::Path DeviceDBusAdaptor::AddIPConfig(const string& ,
+                                            ::DBus::Error &error) {
+  return ::DBus::Path();
+}
+
+}  // namespace shill
diff --git a/device_dbus_adaptor.h b/device_dbus_adaptor.h
new file mode 100644
index 0000000..f413ceb
--- /dev/null
+++ b/device_dbus_adaptor.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SHILL_DEVICE_DBUS_ADAPTOR_H_
+#define SHILL_DEVICE_DBUS_ADAPTOR_H_
+
+#include <map>
+#include <string>
+
+#include <base/basictypes.h>
+
+#include "shill/adaptor_interfaces.h"
+#include "shill/dbus_adaptor.h"
+#include "shill/flimflam-device.h"
+
+namespace shill {
+class Device;
+
+// Subclass of DBusAdaptor for Device objects
+class DeviceDBusAdaptor : public org::chromium::flimflam::Device_adaptor,
+                          public DBusAdaptor,
+                          public DeviceAdaptorInterface {
+ public:
+  static const char kInterfaceName[];
+  static const char kPath[];
+
+  DeviceDBusAdaptor(DBus::Connection& conn, Device *device);
+  virtual ~DeviceDBusAdaptor();
+  void UpdateEnabled();
+
+  // Implementation of Device_adaptor
+  std::map<std::string, ::DBus::Variant> GetProperties(::DBus::Error &error);
+  void SetProperty(const std::string& ,
+                   const ::DBus::Variant& ,
+                   ::DBus::Error &error);
+  void ProposeScan(::DBus::Error &error);
+  ::DBus::Path AddIPConfig(const std::string& , ::DBus::Error &error);
+
+ private:
+  Device *device_;
+  DISALLOW_COPY_AND_ASSIGN(DeviceDBusAdaptor);
+};
+
+}  // namespace shill
+#endif  // SHILL_DEVICE_DBUS_ADAPTOR_H_
diff --git a/manager.cc b/manager.cc
index 011c8fb..d83892c 100644
--- a/manager.cc
+++ b/manager.cc
@@ -14,6 +14,7 @@
 #include "shill/device.h"
 #include "shill/device_info.h"
 #include "shill/manager.h"
+#include "shill/dbus_adaptor.h"
 #include "shill/shill_event.h"
 #include "shill/service.h"
 
diff --git a/manager_dbus_adaptor.cc b/manager_dbus_adaptor.cc
new file mode 100644
index 0000000..ebb6108
--- /dev/null
+++ b/manager_dbus_adaptor.cc
@@ -0,0 +1,118 @@
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "shill/manager_dbus_adaptor.h"
+
+#include <map>
+#include <string>
+
+using std::map;
+using std::string;
+
+namespace shill {
+
+// TODO(cmasone): Figure out if we should be trying to own sub-interfaces.
+// static
+const char ManagerDBusAdaptor::kInterfaceName[] = SHILL_INTERFACE;
+// ".Manager";
+// static
+const char ManagerDBusAdaptor::kPath[] = SHILL_PATH "/Manager";
+
+ManagerDBusAdaptor::ManagerDBusAdaptor(DBus::Connection& conn, Manager *manager)
+    : DBusAdaptor(conn, kPath),
+      manager_(manager) {
+}
+ManagerDBusAdaptor::~ManagerDBusAdaptor() {}
+
+void ManagerDBusAdaptor::UpdateRunning() {}
+
+map<string, ::DBus::Variant> ManagerDBusAdaptor::GetProperties(
+    ::DBus::Error &error) {
+  return map<string, ::DBus::Variant>();
+}
+
+void ManagerDBusAdaptor::SetProperty(const string& name,
+                                     const ::DBus::Variant& value,
+                                     ::DBus::Error &error) {
+}
+
+string ManagerDBusAdaptor::GetState(::DBus::Error &error) {
+  return string();
+}
+
+::DBus::Path ManagerDBusAdaptor::CreateProfile(const string& name,
+                                               ::DBus::Error &error) {
+  return ::DBus::Path();
+}
+
+void ManagerDBusAdaptor::RemoveProfile(const ::DBus::Path& path,
+                                       ::DBus::Error &error) {
+}
+
+void ManagerDBusAdaptor::RequestScan(const string& ,
+                                     ::DBus::Error &error) {
+}
+
+void ManagerDBusAdaptor::EnableTechnology(const string& ,
+                                          ::DBus::Error &error) {
+}
+
+void ManagerDBusAdaptor::DisableTechnology(const string& ,
+                                           ::DBus::Error &error) {
+}
+
+::DBus::Path ManagerDBusAdaptor::GetService(
+    const map<string, ::DBus::Variant>& ,
+    ::DBus::Error &error) {
+  return ::DBus::Path();
+}
+
+::DBus::Path ManagerDBusAdaptor::GetWifiService(
+    const map<string, ::DBus::Variant>& ,
+    ::DBus::Error &error) {
+  return ::DBus::Path();
+}
+
+void ManagerDBusAdaptor::ConfigureWifiService(
+    const map<string, ::DBus::Variant>& ,
+    ::DBus::Error &error) {
+}
+
+void ManagerDBusAdaptor::RegisterAgent(const ::DBus::Path& ,
+                                       ::DBus::Error &error) {
+}
+
+void ManagerDBusAdaptor::UnregisterAgent(const ::DBus::Path& ,
+                                         ::DBus::Error &error) {
+}
+
+string ManagerDBusAdaptor::GetDebugTags(::DBus::Error &error) {
+  return string();
+}
+
+void ManagerDBusAdaptor::SetDebugTags(const string& ,
+                                      ::DBus::Error &error) {
+}
+
+string ManagerDBusAdaptor::ListDebugTags(::DBus::Error &error) {
+  return string();
+}
+
+uint32_t ManagerDBusAdaptor::GetDebugMask(::DBus::Error &error) {
+  return 0;
+}
+
+void ManagerDBusAdaptor::SetDebugMask(const uint32_t& ,
+                                      ::DBus::Error &error) {
+}
+
+string ManagerDBusAdaptor::GetServiceOrder(::DBus::Error &error) {
+  return string();
+}
+
+void ManagerDBusAdaptor::SetServiceOrder(const string& ,
+                                         ::DBus::Error &error) {
+}
+
+}  // namespace shill
diff --git a/manager_dbus_adaptor.h b/manager_dbus_adaptor.h
new file mode 100644
index 0000000..881facb
--- /dev/null
+++ b/manager_dbus_adaptor.h
@@ -0,0 +1,70 @@
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SHILL_MANAGER_DBUS_ADAPTOR_H_
+#define SHILL_MANAGER_DBUS_ADAPTOR_H_
+
+#include <map>
+#include <string>
+
+#include <base/basictypes.h>
+
+#include "shill/adaptor_interfaces.h"
+#include "shill/dbus_adaptor.h"
+#include "shill/flimflam-manager.h"
+
+namespace shill {
+class Manager;
+
+// Subclass of DBusAdaptor for Manager objects
+class ManagerDBusAdaptor : public org::chromium::flimflam::Manager_adaptor,
+                           public DBusAdaptor,
+                           public ManagerAdaptorInterface {
+ public:
+  static const char kInterfaceName[];
+  static const char kPath[];
+
+  ManagerDBusAdaptor(DBus::Connection& conn, Manager *manager);
+  virtual ~ManagerDBusAdaptor();
+  void UpdateRunning();
+
+  // Implementation of Manager_adaptor
+  std::map<std::string, ::DBus::Variant> GetProperties(::DBus::Error &error);
+  void SetProperty(const std::string& name,
+                   const ::DBus::Variant& value,
+                   ::DBus::Error &error);
+  std::string GetState(::DBus::Error &error);
+  ::DBus::Path CreateProfile(const std::string& name, ::DBus::Error &error);
+  void RemoveProfile(const ::DBus::Path& path, ::DBus::Error &error);
+  void RequestScan(const std::string& , ::DBus::Error &error);
+
+  void EnableTechnology(const std::string& , ::DBus::Error &error);
+  void DisableTechnology(const std::string& , ::DBus::Error &error);
+
+  ::DBus::Path GetService(const std::map<std::string, ::DBus::Variant>& ,
+                          ::DBus::Error &error);
+  ::DBus::Path GetWifiService(const std::map<std::string, ::DBus::Variant>& ,
+                              ::DBus::Error &error);
+  void ConfigureWifiService(const std::map<std::string, ::DBus::Variant>& ,
+                            ::DBus::Error &error);
+
+  void RegisterAgent(const ::DBus::Path& , ::DBus::Error &error);
+  void UnregisterAgent(const ::DBus::Path& , ::DBus::Error &error);
+
+  std::string GetDebugTags(::DBus::Error &error);
+  void SetDebugTags(const std::string& , ::DBus::Error &error);
+  std::string ListDebugTags(::DBus::Error &error);
+  uint32_t GetDebugMask(::DBus::Error &error);
+  void SetDebugMask(const uint32_t& , ::DBus::Error &error);
+
+  std::string GetServiceOrder(::DBus::Error &error);
+  void SetServiceOrder(const std::string& , ::DBus::Error &error);
+
+ private:
+  Manager *manager_;
+  DISALLOW_COPY_AND_ASSIGN(ManagerDBusAdaptor);
+};
+
+}  // namespace shill
+#endif  // SHILL_MANAGER_DBUS_ADAPTOR_H_
diff --git a/manager_unittest.cc b/manager_unittest.cc
index 7215944..818da17 100644
--- a/manager_unittest.cc
+++ b/manager_unittest.cc
@@ -10,7 +10,7 @@
 #include <gtest/gtest.h>
 #include <gmock/gmock.h>
 
-#include "shill/dbus_control.h"
+#include "shill/mock_control.h"
 #include "shill/manager.h"
 #include "shill/mock_device.h"
 #include "shill/mock_service.h"
@@ -36,7 +36,7 @@
   }
 
 protected:
-  DBusControl control_;
+  MockControl control_;
   Manager manager_;
   EventDispatcher dispatcher_;
   ScopedRunnableMethodFactory<ManagerTest> factory_;
diff --git a/mock_adaptors.h b/mock_adaptors.h
new file mode 100644
index 0000000..16b150a
--- /dev/null
+++ b/mock_adaptors.h
@@ -0,0 +1,42 @@
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SHILL_MOCK_ADAPTORS_
+#define SHILL_MOCK_ADAPTORS_
+
+#include <string>
+
+#include <gmock/gmock.h>
+
+#include "shill/adaptor_interfaces.h"
+
+namespace shill {
+
+// These are the functions that a Manager adaptor must support
+class ManagerMockAdaptor : public ManagerAdaptorInterface {
+ public:
+  ManagerMockAdaptor() {}
+  virtual ~ManagerMockAdaptor() {}
+  MOCK_METHOD0(UpdateRunning, void(void));
+};
+
+// These are the functions that a Service adaptor must support
+class ServiceMockAdaptor : public ServiceAdaptorInterface {
+ public:
+  ServiceMockAdaptor() {}
+  virtual ~ServiceMockAdaptor() {}
+  MOCK_METHOD0(UpdateConnected, void(void));
+
+};
+
+// These are the functions that a Device adaptor must support
+class DeviceMockAdaptor : public DeviceAdaptorInterface {
+ public:
+  DeviceMockAdaptor() {}
+  virtual ~DeviceMockAdaptor() {}
+  MOCK_METHOD0(UpdateEnabled, void(void));
+};
+
+}  // namespace shill
+#endif  // SHILL_MOCK_ADAPTORS_
diff --git a/mock_control.cc b/mock_control.cc
new file mode 100644
index 0000000..cd580f8
--- /dev/null
+++ b/mock_control.cc
@@ -0,0 +1,22 @@
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "shill/mock_adaptors.h"
+#include "shill/mock_control.h"
+
+namespace shill {
+
+ManagerAdaptorInterface *MockControl::CreateManagerAdaptor(Manager *manager) {
+  return new ManagerMockAdaptor();
+}
+
+ServiceAdaptorInterface *MockControl::CreateServiceAdaptor(Service *service) {
+  return new ServiceMockAdaptor();
+}
+
+DeviceAdaptorInterface *MockControl::CreateDeviceAdaptor(Device *device) {
+  return new DeviceMockAdaptor();
+}
+
+}  // namespace shill
diff --git a/mock_control.h b/mock_control.h
new file mode 100644
index 0000000..1965916
--- /dev/null
+++ b/mock_control.h
@@ -0,0 +1,21 @@
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SHILL_MOCK_CONTROL_
+#define SHILL_MOCK_CONTROL_
+
+#include "shill/control_interface.h"
+
+namespace shill {
+// This is the Interface for the control channel for Shill.
+class MockControl : public ControlInterface {
+ public:
+  ManagerAdaptorInterface *CreateManagerAdaptor(Manager *manager);
+  ServiceAdaptorInterface *CreateServiceAdaptor(Service *service);
+  DeviceAdaptorInterface *CreateDeviceAdaptor(Device *device);
+};
+
+}  // namespace shill
+
+#endif  // SHILL_MOCK_CONTROL_
diff --git a/service.cc b/service.cc
index 29366f7..07af8b4 100644
--- a/service.cc
+++ b/service.cc
@@ -11,6 +11,7 @@
 
 #include "shill/control_interface.h"
 #include "shill/service.h"
+#include "shill/service_dbus_adaptor.h"
 
 using std::string;
 
diff --git a/service_dbus_adaptor.cc b/service_dbus_adaptor.cc
new file mode 100644
index 0000000..cb7e27d
--- /dev/null
+++ b/service_dbus_adaptor.cc
@@ -0,0 +1,63 @@
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "shill/service_dbus_adaptor.h"
+
+#include <map>
+#include <string>
+
+using std::map;
+using std::string;
+
+namespace shill {
+
+// TODO(cmasone): Figure out if we should be trying to own sub-interfaces.
+// static
+const char ServiceDBusAdaptor::kInterfaceName[] = SHILL_INTERFACE;
+// ".Service";
+// static
+const char ServiceDBusAdaptor::kPath[] = SHILL_PATH "/Service";
+
+ServiceDBusAdaptor::ServiceDBusAdaptor(DBus::Connection& conn, Service *service)
+    : DBusAdaptor(conn, kPath),
+      service_(service) {}
+ServiceDBusAdaptor::~ServiceDBusAdaptor() {}
+
+void ServiceDBusAdaptor::UpdateConnected() {}
+
+map<string, ::DBus::Variant> ServiceDBusAdaptor::GetProperties(
+    ::DBus::Error &error) {
+  return map<string, ::DBus::Variant>();
+}
+
+void ServiceDBusAdaptor::SetProperty(const string& ,
+                                     const ::DBus::Variant& ,
+                                     ::DBus::Error &error) {
+}
+
+void ServiceDBusAdaptor::ClearProperty(const string& , ::DBus::Error &error) {
+}
+
+void ServiceDBusAdaptor::Connect(::DBus::Error &error) {
+}
+
+void ServiceDBusAdaptor::Disconnect(::DBus::Error &error) {
+}
+
+void ServiceDBusAdaptor::Remove(::DBus::Error &error) {
+}
+
+void ServiceDBusAdaptor::MoveBefore(const ::DBus::Path& ,
+                                    ::DBus::Error &error) {
+}
+
+void ServiceDBusAdaptor::MoveAfter(const ::DBus::Path& ,
+                                   ::DBus::Error &error) {
+}
+
+void ServiceDBusAdaptor::ActivateCellularModem(const string& ,
+                                               ::DBus::Error &error) {
+}
+
+}  // namespace shill
diff --git a/service_dbus_adaptor.h b/service_dbus_adaptor.h
new file mode 100644
index 0000000..2065d67
--- /dev/null
+++ b/service_dbus_adaptor.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SHILL_SERVICE_DBUS_ADAPTOR_H_
+#define SHILL_SERVICE_DBUS_ADAPTOR_H_
+
+#include <map>
+#include <string>
+
+#include <base/basictypes.h>
+
+#include "shill/adaptor_interfaces.h"
+#include "shill/dbus_adaptor.h"
+#include "shill/flimflam-service.h"
+
+namespace shill {
+class Service;
+
+// Subclass of DBusAdaptor for Service objects
+class ServiceDBusAdaptor : public org::chromium::flimflam::Service_adaptor,
+                           public DBusAdaptor,
+                           public ServiceAdaptorInterface {
+ public:
+  static const char kInterfaceName[];
+  static const char kPath[];
+
+  ServiceDBusAdaptor(DBus::Connection& conn, Service *service);
+  virtual ~ServiceDBusAdaptor();
+  void UpdateConnected();
+
+  // Implementation of Service_adaptor
+  std::map<std::string, ::DBus::Variant> GetProperties(::DBus::Error &error);
+  void SetProperty(const std::string& ,
+                   const ::DBus::Variant& ,
+                   ::DBus::Error &error);
+  void ClearProperty(const std::string& , ::DBus::Error &error);
+  void Connect(::DBus::Error &error);
+  void Disconnect(::DBus::Error &error);
+  void Remove(::DBus::Error &error);
+  void MoveBefore(const ::DBus::Path& , ::DBus::Error &error);
+  void MoveAfter(const ::DBus::Path& , ::DBus::Error &error);
+  void ActivateCellularModem(const std::string& , ::DBus::Error &error);
+
+ private:
+  Service *service_;
+  DISALLOW_COPY_AND_ASSIGN(ServiceDBusAdaptor);
+};
+
+}  // namespace shill
+#endif  // SHILL_SERVICE_DBUS_ADAPTOR_H_
diff --git a/shill_unittest.cc b/shill_unittest.cc
index 8d0a8a6..a3084d1 100644
--- a/shill_unittest.cc
+++ b/shill_unittest.cc
@@ -14,7 +14,7 @@
 #include <gmock/gmock.h>
 
 #include "shill/shill_daemon.h"
-#include "shill/dbus_control.h"
+#include "shill/mock_control.h"
 
 namespace shill {
 using ::testing::Test;
@@ -108,7 +108,7 @@
 class ShillDaemonTest : public Test {
  public:
   ShillDaemonTest()
-    : daemon_(&config_, new DBusControl()),
+    : daemon_(&config_, new MockControl()),
       dispatcher_(&daemon_.dispatcher_),
       dispatcher_test_(dispatcher_),
       device_info_(daemon_.control_, dispatcher_, &daemon_.manager_),