summaryrefslogtreecommitdiff
path: root/include/socket.h
diff options
context:
space:
mode:
authorDaniel De Graaf <danieldg@inspircd.org>2010-04-26 19:08:39 -0500
committerDaniel De Graaf <danieldg@inspircd.org>2010-04-26 19:08:43 -0500
commitdc203f9f201e5a49677d3982f0b6c7d8610cc484 (patch)
treebd8b210c43ff5ac16167e56d76589425a5428cab /include/socket.h
parent1ac8c54574d2d68674ce0f3a5b15dce5d330049b (diff)
Define comparator for irc::sockets::sockaddrs
This only compares IP/port, which ignores IPv6 flow information and scope ID, which aren't important in testing for equality.
Diffstat (limited to 'include/socket.h')
-rw-r--r--include/socket.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/socket.h b/include/socket.h
index 91a10d1f9..b09581cd6 100644
--- a/include/socket.h
+++ b/include/socket.h
@@ -44,7 +44,8 @@ namespace irc
*/
namespace sockets
{
- union CoreExport sockaddrs {
+ union CoreExport sockaddrs
+ {
struct sockaddr sa;
struct sockaddr_in in4;
struct sockaddr_in6 in6;
@@ -56,9 +57,11 @@ namespace irc
std::string addr() const;
/** Return human-readable IP/port pair */
std::string str() const;
+ bool operator==(const sockaddrs& other) const;
+ inline bool operator!=(const sockaddrs& other) const { return !(*this == other); }
};
- struct cidr_mask
+ struct CoreExport cidr_mask
{
/** Type, AF_INET or AF_INET6 */
unsigned char type;