From 068d311ecc7b52f1adaa894864afa54ef49a3e6e Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Thu, 9 Apr 2015 20:54:00 -0700 Subject: TRACE compile fixes, other fixes, and it basically works! It says HELLO. --- node/InetAddress.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'node/InetAddress.hpp') diff --git a/node/InetAddress.hpp b/node/InetAddress.hpp index 43fcc333..5e4dbfd8 100644 --- a/node/InetAddress.hpp +++ b/node/InetAddress.hpp @@ -353,6 +353,19 @@ struct InetAddress : public sockaddr_storage } } + /** + * @param a InetAddress to compare again + * @return True if only IP portions are equal (false for non-IP or null addresses) + */ + inline bool ipsEqual(const InetAddress &a) const + { + switch(ss_family) { + case AF_INET: return (reinterpret_cast(this)->sin_addr.s_addr == reinterpret_cast(&a)->sin_addr.s_addr); + case AF_INET6: return (memcmp(reinterpret_cast(this)->sin6_addr.s6_addr,reinterpret_cast(&a)->sin6_addr.s6_addr,16) == 0); + } + return false; + } + /** * Set to null/zero */ -- cgit v1.2.3