LLFIO
v2.00
|
Inspired by ASIO's ip
namespace.
More...
Classes | |
class | address |
A version independent IP address. More... | |
class | resolver |
Returned by resolve() as a handle to the asynchronous name resolution operation. More... | |
class | address_v4 |
A v4 IP address. More... | |
class | address_v6 |
Make an address_v6 . v6 addresses need to have the form [::]:port . More... | |
Typedefs | |
using | resolver_ptr = std::unique_ptr< resolver, detail::resolver_deleter > |
A pointer to a resolver. | |
Enumerations | |
enum class | family { unknown , v4 , v6 , any } |
The family of IP. More... | |
enum | bitfield__resolve_flag : unsigned { none = 0 , passive = (1U << 0U) , blocking = (1U << 1U) } |
Flags for resolve() More... | |
Functions | |
std::ostream & | operator<< (std::ostream &s, const address &v) |
Write address to stream. | |
result< resolver_ptr > | resolve (string_view name, string_view service, family _family=family::any, deadline d={}, resolve_flag flags=resolve_flag::none) noexcept |
Retrieve a list of potential address for a given name and service e.g. "www.google.com" and "https" optionally within a bounded deadline. More... | |
result< size_t > | resolve_trim_cache (size_t maxitems=64) noexcept |
resolve() may utilise a process-wide cache, if so this function will trim that cache. | |
result< address_v4 > | make_address_v4 (string_view str) noexcept |
Make an address_v4 | |
result< address_v4 > | make_address_v4 (const address_v4::bytes_type &bytes, uint16_t port=0) noexcept |
Make an address_v4 | |
result< address_v4 > | make_address_v4 (const address_v4::uint_type &bytes, uint16_t port=0) noexcept |
Make an address_v4 | |
result< address_v6 > | make_address_v6 (string_view str) noexcept |
Make an address_v6 | |
result< address_v6 > | make_address_v6 (const address_v6::bytes_type &bytes, uint16_t port=0, uint32_t scope_id=0) noexcept |
Make an address_v6 | |
result< address > | make_address (string_view str) noexcept |
Make a v4 or v6 address . v6 addresses need to have the form [::]:port . | |
Inspired by ASIO's ip
namespace.
enum llfio_v2_xxx::ip::bitfield__resolve_flag : unsigned |
Flags for resolve()
Enumerator | |
---|---|
none | No flags. |
passive | Return addresses for binding to this machine. |
blocking | Execute address resolution synchronously. |
|
strong |
|
inlinenoexcept |
Retrieve a list of potential address
for a given name and service e.g. "www.google.com" and "https" optionally within a bounded deadline.
The object returned by this function can take many seconds to become ready as multiple network requests may need to be made. The deadline can be used to bound execution times – like in a few other places in LLFIO, this deadline does not cause timed out errors, rather it aborts any remaining name resolution after the deadline expires and returns whatever addresses have been resolved by the deadline.
This function has a future-like API as several major platforms provide native asynchronous name resolution (currently: Linux, Windows). On other platforms, std::async
with getaddrinfo()
is used as an emulation, and therefore deadline expiry means no partial list of addresses are returned.
If you become no longer interested in the results, simply reset or delete the pointer and the resolution will be aborted asynchronously.