Fetch the network portion of the IP address
eg 192.168.2.24/24 ==> 192.168.2.0
Change-Id: I5e46ce7b371360c90ef74fac175c8379c6f31d4c
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
diff --git a/util.hpp b/util.hpp
index c305724..fb511fe 100644
--- a/util.hpp
+++ b/util.hpp
@@ -27,6 +27,15 @@
*/
bool isLinkLocal(const std::string& address);
+/* @brief gets the network section of the ip adress.
+ * @param[in] addressFamily - IP address family(AF_INET/AF_INET6).
+ * @param[in] ipaddress - IP address.
+ * @param[in] prefix - prefix length.
+ * @returns network section of the ipaddress.
+ */
+std::string getNetworkID(int addressFamily, const std::string& ipaddress,
+ uint8_t prefix);
+
} //namespace network
class Descriptor
@@ -40,7 +49,7 @@
Descriptor(const Descriptor&) = delete;
Descriptor& operator=(const Descriptor&) = delete;
Descriptor(Descriptor&&) = delete;
- Descriptor& operator=(Descriptor&&) = delete;
+ Descriptor& operator=(Descriptor &&) = delete;
Descriptor(int fd) : fd(fd) {}