A single name resolution result entry as found in AddressInfoList.
More...
#include <AddressInfo.hxx>
|
SocketFamily | family () const |
| Returns the family this address is for.
|
|
bool | isV4 () const |
| Returns whether this is a IPv4 address.
|
|
bool | isV6 () const |
| Returns whether this is a IPv6 address.
|
|
SocketType | type () const |
| Returns the SocketType this address is for.
|
|
SocketProtocol | protocol () const |
| Returns the protocol this address is for.
|
|
bool | hasCanonName () const |
| Returns whether a canonical name result is available via canonName().
|
|
SysString | canonName () const |
| Returns the canonical name, if available, or an empty string.
|
|
std::optional< IP4Address > | asIP4 () const |
| Returns the IPv4 address stored in this entry, if applicable.
|
|
std::optional< IP6Address > | asIP6 () const |
| Returns the IPv6 address stored in this entry, if applicable.
|
|
|
bool | hasNext () const |
| Returns whether another entry is available in the list.
|
|
const AddressInfo * | next () const |
| Returns the next entry in the list.
|
|
A single name resolution result entry as found in AddressInfoList.
Definition at line 16 of file AddressInfo.hxx.
◆ asIP4()
std::optional< IP4Address > cosmos::AddressInfo::asIP4 |
( |
| ) |
const |
|
inline |
Returns the IPv4 address stored in this entry, if applicable.
Definition at line 55 of file AddressInfo.hxx.
55 {
56 if (!ai_addr ||
family() != SocketFamily::INET)
57 return std::nullopt;
58
59 return IP4Address{*reinterpret_cast<sockaddr_in*>(ai_addr)};
60 }
SocketFamily family() const
Returns the family this address is for.
◆ asIP6()
std::optional< IP6Address > cosmos::AddressInfo::asIP6 |
( |
| ) |
const |
|
inline |
Returns the IPv6 address stored in this entry, if applicable.
Definition at line 63 of file AddressInfo.hxx.
63 {
64 if (!ai_addr ||
family() != SocketFamily::INET6)
65 return std::nullopt;
66
67 return IP6Address{*reinterpret_cast<sockaddr_in6*>(ai_addr)};
68 }
◆ canonName()
SysString cosmos::AddressInfo::canonName |
( |
| ) |
const |
|
inline |
Returns the canonical name, if available, or an empty string.
Definition at line 46 of file AddressInfo.hxx.
46 {
47 if (ai_canonname) {
48 return SysString{ai_canonname};
49 } else {
50 return {};
51 }
52 }
◆ family()
Returns the family this address is for.
Definition at line 21 of file AddressInfo.hxx.
21 {
23 }
SocketFamily
A socket's family setting.
◆ hasCanonName()
bool cosmos::AddressInfo::hasCanonName |
( |
| ) |
const |
|
inline |
Returns whether a canonical name result is available via canonName().
Definition at line 41 of file AddressInfo.hxx.
41 {
42 return ai_canonname != nullptr;
43 }
◆ hasNext()
bool cosmos::AddressInfo::hasNext |
( |
| ) |
const |
|
inlineprotected |
Returns whether another entry is available in the list.
Definition at line 75 of file AddressInfo.hxx.
75 {
76 return ai_next != nullptr;
77 }
◆ isV4()
bool cosmos::AddressInfo::isV4 |
( |
| ) |
const |
|
inline |
Returns whether this is a IPv4 address.
Definition at line 26 of file AddressInfo.hxx.
26{
return this->
family() == SocketFamily::INET; }
◆ isV6()
bool cosmos::AddressInfo::isV6 |
( |
| ) |
const |
|
inline |
Returns whether this is a IPv6 address.
Definition at line 28 of file AddressInfo.hxx.
28{
return this->
family() == SocketFamily::INET6; }
◆ next()
const AddressInfo * cosmos::AddressInfo::next |
( |
| ) |
const |
|
inlineprotected |
Returns the next entry in the list.
Definition at line 80 of file AddressInfo.hxx.
80 {
81 return reinterpret_cast<const AddressInfo*>(ai_next);
82 }
◆ protocol()
Returns the protocol this address is for.
Definition at line 36 of file AddressInfo.hxx.
36 {
38 }
SocketProtocol
Specific protocol to use on a socket.
◆ type()
Returns the SocketType this address is for.
Definition at line 31 of file AddressInfo.hxx.
31 {
33 }
SocketType
A socket's type setting.
◆ AddressInfoIterator
The documentation for this class was generated from the following file: