libcppwrap
A collection of C++ wrappers for native APIs
Loading...
Searching...
No Matches
Functions
wx::ipv6 Namespace Reference

Functions

bool is_link_local (const in6_addr &address) noexcept
 Tests if an IPv6 address has link-local scope. More...
 
struct sockaddr_in6 get_link_local_address (const char *interface_name)
 Gets the first link-local address for the specified network interface. More...
 
std::string to_string (const in6_addr &address)
 Produces a string representation of an IPv6 address. More...
 

Function Documentation

◆ get_link_local_address()

struct sockaddr_in6 wx::ipv6::get_link_local_address ( const char *  interface_name)

Gets the first link-local address for the specified network interface.

Note that it is possible for an interface to have more than one link-local address. In this case, one is selected at random (and subsequent calls may not return the same address). It is also possible for an interface to have no link-local address (for example, if IPv6 is disabled).

Parameters
interface_nameThe name of the network interface.
Returns
The IPv6 link-local address.
Exceptions
std::system_errorAn error occurred.
std::runtime_errorThe specified interface doesn't exist or has no link-local address.

◆ is_link_local()

bool wx::ipv6::is_link_local ( const in6_addr &  address)
noexcept

Tests if an IPv6 address has link-local scope.

An address has link-local scope if and only if it is in the range [fe80::, fe81::).

Parameters
addressThe IPv6 address to test.
Returns
true if address has link-local scope.

◆ to_string()

std::string wx::ipv6::to_string ( const in6_addr &  address)

Produces a string representation of an IPv6 address.

Parameters
addressThe IPv6 address to convert.
Returns
A string representation of address, using :: shorthand notation where possible.