diff options
| author | 2023-01-17 02:46:53 +0000 | |
|---|---|---|
| committer | 2023-01-17 02:46:53 +0000 | |
| commit | dad3eaa2da71e3433afbd4e4a28f74e5de5663d4 (patch) | |
| tree | 4f44f6404fdaec3da77490664ae7ebd45e78300d /include/socket.h | |
| parent | Allow creating a FailedPort without a bindspec. (diff) | |
| download | inspircd++-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.h | 3 |
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; |
