Represent an IPV4 or IPV6 address.
More...
#include <netif.h>
|
enum | Family { Invalid = -1,
IPV4 = AF_INET,
IPV6 = AF_INET6
} |
| address family types. The values are identifal to the system's definitions
|
|
enum | Scope { Invalid = -1,
LINK,
SITE,
GLOBAL
} |
| IPV6 address scope type.
|
|
|
| IPAddr (const char *) |
| Build from textual representation (e.g. 192.168.4.4)
|
|
| IPAddr (const std::string &s) |
| Build from textual representation (e.g. 192.168.4.4)
|
|
| IPAddr (const struct sockaddr *sa, bool unmapv4=true) |
| Build from binary address in network byte order. More...
|
|
| IPAddr (const IPAddr &) |
|
IPAddr & | operator= (const IPAddr &) |
|
bool | ok () const |
| Check constructor success.
|
|
bool | setScopeIdx (const IPAddr &other) |
|
Family | family () const |
| Returns the address family.
|
|
Scope | scopetype () const |
| Returns the scope type of IPV6 address.
|
|
bool | copyToStorage (struct sockaddr_storage *dest) const |
| Copies out for use with a system interface Zeroes out up to sizeof(sockaddr_storage)
|
|
bool | copyToAddr (struct sockaddr *dest) const |
| Copies out for use with a system interface Copies exactly the needed size.
|
|
const struct sockaddr_storage & | getaddr () const |
| Get reference to the internal binary address.
|
|
std::string | straddr () const |
| Convert to textual representation.
|
|
std::string | straddr (bool setscope, bool forurl) const |
| Convert to textual representation. Possibly add scope id, possibly url-encode it.
|
|
Represent an IPV4 or IPV6 address.
◆ IPAddr()
NetIF::IPAddr::IPAddr |
( |
const struct sockaddr * |
sa, |
|
|
bool |
unmapv4 = true |
|
) |
| |
|
explicit |
Build from binary address in network byte order.
- Parameters
-
unmapv4 | if true we test for a v6 mapped v4 address and, if found, store it as v4 |
◆ setScopeIdx()
bool NetIF::IPAddr::setScopeIdx |
( |
const IPAddr & |
other | ) |
|
Set the scopeidx from other address. Only does anything for ipv6 link-local addresses
The documentation for this class was generated from the following file:
- /home/dockes/projets/mpdupnp/npupnp/src/inc/netif.h