summaryrefslogtreecommitdiffstats
path: root/ethernet_interface.hpp
diff options
context:
space:
mode:
authorRatan Gupta <ratagupt@in.ibm.com>2017-05-23 13:20:44 +0530
committerPatrick Williams <patrick@stwcx.xyz>2017-05-23 11:58:44 +0000
commit65e5abefd6b73c8f383a335291c32111ae787be0 (patch)
treee9ffc8d1c840f22d7e8a7b3783f23fb7e24b189e /ethernet_interface.hpp
parent738a67fe79e3460541592cc64b139f0d2f5bd4d4 (diff)
downloadphosphor-networkd-65e5abefd6b73c8f383a335291c32111ae787be0.tar.gz
phosphor-networkd-65e5abefd6b73c8f383a335291c32111ae787be0.zip
Generate the ip address object path with the use of hash
ipaddress object path have the id for unique identification of ipaddres and the id would be hash of ipaddress,prefix and gateway. This was needed to make sure that there is no duplication of address object path. Change-Id: If6830d6e186e3271467ce0084c1dbf3c4995f1dd Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
Diffstat (limited to 'ethernet_interface.hpp')
-rw-r--r--ethernet_interface.hpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/ethernet_interface.hpp b/ethernet_interface.hpp
index ab69a78..f9bd895 100644
--- a/ethernet_interface.hpp
+++ b/ethernet_interface.hpp
@@ -90,18 +90,29 @@ class EthernetInterface : public Ifaces
/** @brief construct the ip address dbus object path.
* @param[in] addressType - Type of ip address.
+ * @param[in] ipaddress - IP address.
+ * @param[in] prefixLength - Length of prefix.
+ * @param[in] gateway - Gateway addess.
+
* @return path of the address object.
*/
- std::string getAddressObjectPath(IP::Protocol addressType) const;
+ std::string generateObjectPath(IP::Protocol addressType,
+ const std::string& ipaddress,
+ uint8_t prefixLength,
+ const std::string& gateway) const;
- /** @brief get the ipadress count for a specific type on this interface.
- * @param[in] addressType - Type of ip address.
- * @return count of ipaddreses for the incoming type.
+ /** @brief generates the id by doing hash of ipaddress,
+ * prefixlength and the gateway.
+ * @param[in] ipaddress - IP address.
+ * @param[in] prefixLength - Length of prefix.
+ * @param[in] gateway - Gateway addess.
+ * @return hash string.
*/
- size_t getAddressCount(IP::Protocol addressType) const;
-
+ static std::string generateId(const std::string& ipaddress,
+ uint8_t prefixLength,
+ const std::string& gateway);
/** @brief Persistent sdbusplus DBus bus connection. */
sdbusplus::bus::bus& bus;
OpenPOWER on IntegriCloud