diff options
| author | 2022-08-10 22:43:23 +0100 | |
|---|---|---|
| committer | 2022-08-10 22:43:23 +0100 | |
| commit | 19efaf163c0ff2cff82c11f79bac303ecb6e801e (patch) | |
| tree | 09d798ce18af68b6843c921fe4915ead66491fa2 /include/socket.h | |
| parent | Rename OnSetUserIP to OnChangeRemoteAddress. (diff) | |
Clean up the sockaddrs documentation comments.
Diffstat (limited to 'include/socket.h')
| -rw-r--r-- | include/socket.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/include/socket.h b/include/socket.h index ba8ef828a..a490ebcaf 100644 --- a/include/socket.h +++ b/include/socket.h @@ -48,22 +48,30 @@ namespace irc */ namespace sockets { + /** Represents a socket address. This can be an IP/port pair or a UNIX socket path. */ union CoreExport sockaddrs { struct sockaddr sa; struct sockaddr_in in4; struct sockaddr_in6 in6; struct sockaddr_un un; - /** Return the family of the socket (e.g. AF_INET). */ + + /** Returns the address segment of the socket address as a string. */ + std::string addr() const; + + /** Returns the family of the socket address (e.g. AF_INET). */ int family() const; - /** Return the size of the structure for syscall passing */ - socklen_t sa_size() const; - /** Return port number or -1 if invalid */ + + /** Returns the TCP port number of the socket address or 0 if not relevant to this family. */ int port() const; - /** Return IP only */ - std::string addr() const; - /** Return human-readable IP/port pair */ + + /** Returns the size of the structure for use in networking syscalls. */ + socklen_t sa_size() const; + + /** Returns the whole socket address as a string. */ std::string str() const; + + /** Determines if this socket address refers to the same endpoint as another socket address. */ bool operator==(const sockaddrs& other) const; inline bool operator!=(const sockaddrs& other) const { return !(*this == other); } }; |
