Enhance DHCP beyond just OFF and IPv4/IPv6 enabled.

DHCP is not a binary option.  The network interface can have DHCP
disabled, IPv4 only, IPv6 only, and IPv4/IPv6.

Tested:
Using dbus-send or busctl:
Disabled DHCP, and confirmed only link local addresses were present.

Assigned only static addresses.  Both with/and without the gateway set
to 0.0.0.0

Deleted static IPv4 addresses.
Reassigned static addresses.

Enabled DHCP for ipv4 only, and witnessed a DHCP server assign a valid
address.

Assigned static IPv4 address.
Assigned static IPv6 address.
Confirmed both IPv4 and IPv6 static addresses are active.

Enabled DHCP for ipv6 only, and confirmed the static v4 address
remains. The ipv6 address is removed, waiting for a DHCP6 server.

Enabled DHCP for both ipv4 and ipv6. IPv4 address was assigned. IPv6
address is assumed to succeed, as systemd config file enables IPv6
DHCP.

Change-Id: I2e0ff80ac3a5e88bcff28adac419bf21e37be162
Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com>
diff --git a/ethernet_interface.hpp b/ethernet_interface.hpp
index 7192e26..abaf43e 100644
--- a/ethernet_interface.hpp
+++ b/ethernet_interface.hpp
@@ -85,7 +85,7 @@
      *                          send.
      */
     EthernetInterface(sdbusplus::bus::bus& bus, const std::string& objPath,
-                      bool dhcpEnabled, Manager& parent,
+                      DHCPConf dhcpEnabled, Manager& parent,
                       bool emitSignal = true);
 
     /** @brief Function used to load the nameservers.
@@ -155,7 +155,13 @@
     }
 
     /** Set value of DHCPEnabled */
-    bool dHCPEnabled(bool value) override;
+    DHCPConf dHCPEnabled(DHCPConf value) override;
+
+    /** @brief Selectively disables DHCP
+     *  @param[in] protocol - The IPv4 or IPv6 protocol to return to static
+     *                        addressing mode
+     */
+    void disableDHCP(IP::Protocol protocol);
 
     /** Retrieve Link State */
     bool linkUp() const override;
@@ -316,6 +322,28 @@
     std::string objPath;
 
     friend class TestEthernetInterface;
+
+  private:
+    /** @brief Determines if DHCP is active for the IP::Protocol supplied.
+     *  @param[in] protocol - Either IPv4 or IPv6
+     *  @param[in] ignoreProtocol - Allows IPv4 and IPv6 to be checked using a
+     *                              single call.
+     *  @returns true/false value if DHCP is active for the input protocol
+     */
+    bool dhcpIsEnabled(IP::Protocol protocol, bool ignoreProtocol = false);
+
+    /** @brief Determines if DHCP will be active following next reconfig
+     *  @param[in] protocol - Either IPv4 or IPv6
+     *  @param[in] nextDHCPState - The new DHCP mode to take affect
+     *  @returns true/false value if DHCP is active for the input protocol
+     */
+    bool dhcpToBeEnabled(IP::Protocol family, const std::string& nextDHCPState);
+
+    /** @brief Determines if the address is manually assigned
+     *  @param[in] origin - The origin entry of the IP::Address
+     *  @returns true/false value if the address is static
+     */
+    bool originIsManuallyAssigned(IP::AddressOrigin origin);
 };
 
 } // namespace network