Perform device discovery and registration in device_info

Also, do device classification, and create the beginnings of
Device subclasses for WiFi and Ethernet.

BUG=chromium-os:12933
TEST=Added unit tests.  Also manual on a testbed machine to confirm WiFi
device detection.

Change-Id: I48b8fa2b3b966b22acf80f693d9522bff0221884
Reviewed-on: http://gerrit.chromium.org/gerrit/1084
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/device.h b/device.h
index 81eb781..44ebd0f 100644
--- a/device.h
+++ b/device.h
@@ -8,6 +8,7 @@
 #include <vector>
 
 #include <base/memory/ref_counted.h>
+#include <base/memory/scoped_ptr.h>
 
 #include "shill/service.h"
 #include "shill/shill_event.h"
@@ -26,29 +27,55 @@
     kEthernet,
     kWifi,
     kCellular,
+    kBlackListed,
+    kUnknown,
     kNumTechnologies
   };
 
   // A constructor for the Device object
   Device(ControlInterface *control_interface,
-         EventDispatcher *dispatcher);
+         EventDispatcher *dispatcher,
+         const string &link_name,
+         int interface_index);
   virtual ~Device();
 
   virtual void Start();
   virtual void Stop();
 
-  virtual bool TechnologyIs(Technology type) = 0;
+  virtual bool TechnologyIs(const Technology type) = 0;
 
  protected:
   std::vector<scoped_refptr<Service> > services_;
+  string link_name_;
+  int interface_index_;
+  bool running_;
 
  private:
-  DeviceAdaptorInterface *adaptor_;
-  bool running_;
+  scoped_ptr<DeviceAdaptorInterface> adaptor_;
+  friend class base::RefCounted<Device>;
   friend class DeviceAdaptorInterface;
   DISALLOW_COPY_AND_ASSIGN(Device);
 };
 
+// Non-functional Device subclass used for non-operable or blacklisted devices
+class StubDevice : public Device {
+ public:
+  StubDevice(ControlInterface *control_interface,
+             EventDispatcher *dispatcher,
+             const string link_name,
+             int interface_index,
+             Technology technology)
+    : Device(control_interface, dispatcher, link_name, interface_index),
+    technology_(technology) {}
+  void Start() {}
+  void Stop() {}
+  bool TechnologyIs(const Technology type) { return type == technology_; }
+
+ private:
+  Technology technology_;
+  DISALLOW_COPY_AND_ASSIGN(StubDevice);
+};
+
 }  // namespace shill
 
 #endif  // SHILL_DEVICE_