apmanager: DHCP server support

Start a DHCP server for an AP service when it is configured in server
mode. The server address is configure as "192.168.x.254" where
x is the least significant byte of the service identifier. The DHCP
range is from 192.168.x.1 to 192.168.x.128.

BUG=chromium:438836
TEST=unittests and manual test
Manual test:
Start an AP service using apmanager and verify a DUT can connect
to it with an IP address
CQ-DEPEND=CL:233032,CL:233493

Change-Id: I16a0d03c8eac7f02722c8c8f5185ca75a1edebcb
Reviewed-on: https://chromium-review.googlesource.com/233047
Reviewed-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
diff --git a/config.h b/config.h
index 6db0568..ecc95f2 100644
--- a/config.h
+++ b/config.h
@@ -25,6 +25,11 @@
   Config(Manager* manager, const std::string& service_path);
   virtual ~Config();
 
+  // Implementation of ConfigInterface.
+  // Handles calls to org.chromium.apmanager.Config.SsidSet().
+  virtual bool SsidSet(chromeos::ErrorPtr* error,
+                       const std::string& ssid);
+
   // Calculate the frequency based on the given |channel|. Return true and set
   // the output |frequency| if is valid channel, false otherwise.
   static bool GetFrequencyFromChannel(uint16_t channel, uint32_t* freq);
@@ -49,6 +54,8 @@
     control_interface_ = control_interface;
   }
 
+  const std::string& selected_interface() const { return selected_interface_; }
+
   const dbus::ObjectPath& dbus_path() const { return dbus_path_; }
 
  private:
@@ -115,6 +122,8 @@
   Manager* manager_;
   dbus::ObjectPath dbus_path_;
   std::string control_interface_;
+  // Interface selected for hostapd.
+  std::string selected_interface_;
   std::unique_ptr<chromeos::dbus_utils::DBusObject> dbus_object_;
   scoped_refptr<Device> device_;