30 #ifndef SOCKET_ADDRESS_HXX
31 #define SOCKET_ADDRESS_HXX
40 #include <sys/socket.h>
55 const struct sockaddr *address;
65 :address(_address), size(_size) {}
72 return address ==
nullptr;
84 return address->sa_family;
99 return !(*
this == other);
constexpr int GetFamily() const
constexpr bool IsNull() const
static constexpr SocketAddress Null()
An OO wrapper for struct sockaddr.
const struct sockaddr * GetAddress() const
constexpr SocketAddress(const struct sockaddr *_address, size_type _size)
constexpr size_type GetSize() const
constexpr SocketAddress(std::nullptr_t)
bool operator!=(const SocketAddress other) const noexcept
gcc_pure bool operator==(const SocketAddress other) const noexcept
bool IsDefined() const
Does the object have a well-defined address? Check !IsNull() before calling this method.