From dad3eaa2da71e3433afbd4e4a28f74e5de5663d4 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 17 Jan 2023 02:46:53 +0000 Subject: Add a helper method for determining if a sockaddrs is an IP endpoint. --- include/socket.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/socket.h') 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; -- cgit v1.3.1-10-gc9f91