nexus: Refactor some of the create/remove network path and add code for
       retrieving network lists from supplicant
nexus: Rework properties
nexus: Implement wifi network enable/disable and add some error checking
nexus: Add some TODOs
nexus: Whitespace cleanup
nexus: Add bindings between controllers and network interfaces
nexus: Add properties for InterfaceConfig
nexus: Fix a few conversion bugs in InterfaceConfig

Signed-off-by: San Mehat <san@google.com>
diff --git a/nexus/NetworkManager.cpp b/nexus/NetworkManager.cpp
index 49b0210..f4ae88f 100644
--- a/nexus/NetworkManager.cpp
+++ b/nexus/NetworkManager.cpp
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 #include <stdio.h>
 #include <errno.h>
 
@@ -27,13 +28,17 @@
 
 NetworkManager *NetworkManager::Instance() {
     if (!sInstance)
-        sInstance = new NetworkManager();
+        sInstance = new NetworkManager(new PropertyManager());
     return sInstance;
 }
 
-NetworkManager::NetworkManager() {
+NetworkManager::NetworkManager(PropertyManager *propMngr) {
     mBroadcaster = NULL;
     mControllers = new ControllerCollection();
+    mPropMngr = propMngr;
+}
+
+NetworkManager::~NetworkManager() {
 }
 
 int NetworkManager::run() {
@@ -55,7 +60,7 @@
     for (i = mControllers->begin(); i != mControllers->end(); ++i) {
         int irc = (*i)->start();
         LOGD("Controller '%s' start rc = %d", (*i)->getName(), irc);
-        if (irc && !rc) 
+        if (irc && !rc)
             rc = irc;
     }
     return rc;
@@ -68,7 +73,7 @@
     for (i = mControllers->begin(); i != mControllers->end(); ++i) {
         int irc = (*i)->stop();
         LOGD("Controller '%s' stop rc = %d", (*i)->getName(), irc);
-        if (irc && !rc) 
+        if (irc && !rc)
             rc = irc;
     }
     return rc;
@@ -84,75 +89,8 @@
     return NULL;
 }
 
-int NetworkManager::setProperty(const char *name, char *value) {
-    char *tmp = strdup(name);
-    char *next = tmp;
-    char *prefix;
-    char *rest;
-    ControllerCollection::iterator it;
-
-    if (!(prefix = strsep(&next, ".")))
-        goto out_inval;
-
-    rest = next;
-
-    if (!strncasecmp(prefix, "netman", 6)) {
-        errno = ENOSYS;
-        return -1;
-    }
-
-    for (it = mControllers->begin(); it != mControllers->end(); ++it) {
-        if (!strcasecmp(prefix, (*it)->getPropertyPrefix())) {
-            return (*it)->setProperty(rest, value);
-        }
-    }
-
-    errno = ENOENT;
-    return -1;
-
-out_inval:
-    errno = EINVAL;
-    return -1;
-}
-
-const char *NetworkManager::getProperty(const char *name, char *buffer,
-                                                          size_t maxsize) {
-    char *tmp = strdup(name);
-    char *next = tmp;
-    char *prefix;
-    char *rest;
-    ControllerCollection::iterator it;
-
-    if (!(prefix = strsep(&next, ".")))
-        goto out_inval;
-
-    rest = next;
-
-    if (!strncasecmp(prefix, "netman", 6)) {
-        errno = ENOSYS;
-        return NULL;
-    }
-
-    for (it = mControllers->begin(); it != mControllers->end(); ++it) {
-        if (!strcasecmp(prefix, (*it)->getPropertyPrefix())) {
-            return (*it)->getProperty(rest, buffer, maxsize);
-        }
-    }
-
-    errno = ENOENT;
-    return NULL;
-
-out_inval:
-    errno = EINVAL;
-    return NULL;
-}
-
-const PropertyCollection &NetworkManager::getProperties() {
-    return *mProperties;
-}
-
 int NetworkManager::onInterfaceStart(Controller *c, const InterfaceConfig *cfg) {
-    LOGD("Interface %s started by controller %s", cfg->getName(), c->getName());
+    LOGD("Interface %s started by controller %s", c->getBoundInterface(), c->getName());
 
     // Look up the interface