30 #ifndef ALLOCATED_SOCKET_ADDRESS_HPP
31 #define ALLOCATED_SOCKET_ADDRESS_HPP
48 struct sockaddr *address;
53 :address(_address), size(_size) {}
59 :address(nullptr), size(0) {
66 :address(src.address), size(src.size) {
67 src.address =
nullptr;
80 std::swap(address, src.address);
81 std::swap(size, src.size);
91 return !(*
this == other);
100 return address ==
nullptr;
115 operator const struct sockaddr *()
const {
120 return address->sa_family;
143 void SetLocal(
const char *path);
147 void SetSize(size_type new_size);
AllocatedSocketAddress & operator=(SocketAddress src)
bool IsDefined() const
Does the object have a well-defined address? Check !IsNull() before calling this method.
bool operator!=(SocketAddress &other) const
An OO wrapper for struct sockaddr.
~AllocatedSocketAddress()
SocketAddress::size_type size_type
size_type GetSize() const
AllocatedSocketAddress & operator=(AllocatedSocketAddress &&src)
AllocatedSocketAddress(SocketAddress src)
gcc_pure bool operator==(SocketAddress other) const
AllocatedSocketAddress(AllocatedSocketAddress &&src)
const struct sockaddr * GetAddress() const
static gcc_const AllocatedSocketAddress Null()