aboutsummaryrefslogtreecommitdiffstats
path: root/include/socket.h
diff options
context:
space:
mode:
authorGravatar Sadie Powell2023-01-17 02:46:53 +0000
committerGravatar Sadie Powell2023-01-17 02:46:53 +0000
commitdad3eaa2da71e3433afbd4e4a28f74e5de5663d4 (patch)
tree4f44f6404fdaec3da77490664ae7ebd45e78300d /include/socket.h
parentAllow creating a FailedPort without a bindspec. (diff)
downloadinspircd++-dad3eaa2da71e3433afbd4e4a28f74e5de5663d4.tar.gz
inspircd++-dad3eaa2da71e3433afbd4e4a28f74e5de5663d4.tar.bz2
inspircd++-dad3eaa2da71e3433afbd4e4a28f74e5de5663d4.zip
Add a helper method for determining if a sockaddrs is an IP endpoint.
Diffstat (limited to 'include/socket.h')
-rw-r--r--include/socket.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/socket.h b/include/socket.h
index ab0bc0896..5e2c7d63a 100644
--- a/include/socket.h
+++ b/include/socket.h
@@ -95,6 +95,9 @@ namespace irc
/** Determines whether this socket address is a local endpoint. */
bool is_local() const;
+ /** Determines whether this socket address is an IPv4 or IPv6 address. */
+ inline bool is_ip() const { return family() == AF_INET || family() == AF_INET6; }
+
/** Returns the TCP port number of the socket address or 0 if not relevant to this family. */
in_port_t port() const;