struct axl::io::SockAddr
#include <axl_io_SockAddr.h>
struct SockAddr
{
// fields
union
{
sockaddr m_addr;
sockaddr_in m_addr_ip4;
sockaddr_in6 m_addr_ip6;
};
// construction
SockAddr();
SockAddr(const sockaddr* addr);
SockAddr(
const in_addr* addr,
uint_t port = 0
);
SockAddr(
uint_t ip,
uint_t port = 0
);
SockAddr(
const in6_addr* addr,
uint_t port = 0,
uint_t scope = 0
);
SockAddr(
const uint16_t* ip,
uint_t port = 0,
uint_t scope = 0
);
SockAddr(const sl::StringRef& string);
// methods
operator const sockaddr *() const;
operator const sockaddr_in *() const;
operator const sockaddr_in6 *() const;
void
clear();
bool
isEqual(const sockaddr* addr) const;
bool
isMatch(const sockaddr* addr) const;
uint_t
getPort();
void
setPort(uint_t port);
void
setup(const sockaddr* addr);
void
setup(
uint_t family,
const void* addr,
size_t size
);
void
setup_ip4(
const in_addr* addr,
uint_t port = 0
);
void
setup_ip4(
uint_t ip,
uint_t port = 0
);
void
setup_ip6(
const in6_addr* addr,
uint_t port = 0,
uint_t scope = 0
);
void
setup_ip6(
const uint16_t* ip,
uint_t port = 0,
uint_t scope = 0
);
size_t
getNetMaskBitCount();
size_t
getNetMaskBitCount_ip4();
size_t
getNetMaskBitCount_ip6();
void
createNetMask(
uint_t family,
size_t bitCount
);
void
createNetMask_ip4(size_t bitCount);
void
createNetMask_ip6(size_t bitCount);
bool
parse(const sl::StringRef& string);
bool
parse_ip4(const sl::StringRef& string);
bool
parse_ip6(const sl::StringRef& string);
size_t
getString(sl::String* string) const;
sl::String
getString() const;
size_t
getString_ip4(sl::String* string) const;
sl::String
getString_ip4() const;
size_t
getString_ip6(sl::String* string) const;
sl::String
getString_ip6(const sockaddr_in6* addr) const;
};