My Project 3.2.0
C++ Distributed Hash Table
|
#include <sockaddr.h>
Classes | |
struct | ipCmp |
Public Member Functions | |
SockAddr (const SockAddr &o) | |
SockAddr (SockAddr &&o) noexcept | |
SockAddr (const sockaddr *sa, socklen_t length) | |
SockAddr (const sockaddr *sa) | |
SockAddr (const sockaddr_storage &ss, socklen_t len) | |
bool | operator< (const SockAddr &o) const |
bool | equals (const SockAddr &o) const |
SockAddr & | operator= (const SockAddr &o) |
SockAddr & | operator= (SockAddr &&o) |
std::string | toString () const |
sa_family_t | getFamily () const |
void | setFamily (sa_family_t af) |
void | setAny () |
in_port_t | getPort () const |
void | setPort (in_port_t p) |
void | setAddress (const char *address) |
socklen_t | getLength () const |
operator bool () const noexcept | |
const sockaddr * | get () const |
sockaddr * | get () |
const sockaddr_in & | getIPv4 () const |
const sockaddr_in6 & | getIPv6 () const |
sockaddr_in & | getIPv4 () |
sockaddr_in6 & | getIPv6 () |
sockaddr * | release () |
bool | isLoopback () const |
bool | isPrivate () const |
bool | isUnspecified () const |
bool | isMappedIPv4 () const |
SockAddr | getMappedIPv4 () |
SockAddr | getMappedIPv6 () |
Static Public Member Functions | |
static std::vector< SockAddr > | resolve (const std::string &host, const std::string &service={}) |
Friends | |
OPENDHT_PUBLIC friend std::ostream & | operator<< (std::ostream &s, const SockAddr &h) |
A Socket Address (sockaddr*), with abstraction for IPv4, IPv6 address families.
Definition at line 62 of file sockaddr.h.
|
inline |
Definition at line 64 of file sockaddr.h.
|
inline |
Definition at line 65 of file sockaddr.h.
|
inlinenoexcept |
Definition at line 68 of file sockaddr.h.
|
inline |
Build from existing address.
Definition at line 75 of file sockaddr.h.
|
inline |
Definition at line 80 of file sockaddr.h.
|
inline |
Build from an existing sockaddr_storage structure.
Definition at line 96 of file sockaddr.h.
|
inline |
Definition at line 106 of file sockaddr.h.
|
inline |
Returns the address to the managed sockaddr structure. The accessible length is returned by getLength().
Definition at line 229 of file sockaddr.h.
|
inline |
Returns the address to the managed sockaddr structure. The accessible length is returned by getLength().
Definition at line 223 of file sockaddr.h.
|
inline |
Returns the address family or AF_UNSPEC if the address is not set.
Definition at line 128 of file sockaddr.h.
|
inline |
Definition at line 237 of file sockaddr.h.
|
inline |
Definition at line 231 of file sockaddr.h.
|
inline |
Definition at line 240 of file sockaddr.h.
|
inline |
Definition at line 234 of file sockaddr.h.
|
inline |
Returns the accessible byte length at the pointer returned by get(). If zero, get() returns null.
Definition at line 210 of file sockaddr.h.
|
inline |
Retreive the port (in host byte order) or 0 if the address is not of a supported family.
Definition at line 175 of file sockaddr.h.
bool dht::SockAddr::isLoopback | ( | ) | const |
Return true if address is a loopback IP address.
bool dht::SockAddr::isPrivate | ( | ) | const |
Return true if address is not a public IP address.
|
inlineexplicitnoexcept |
An address is defined to be true if its length is not zero.
Definition at line 215 of file sockaddr.h.
|
inline |
Definition at line 100 of file sockaddr.h.
Definition at line 110 of file sockaddr.h.
Definition at line 114 of file sockaddr.h.
|
inline |
Releases the ownership of the managed object, if any. The caller is responsible for deleting the object with free().
Definition at line 248 of file sockaddr.h.
void dht::SockAddr::setAddress | ( | const char * | address | ) |
Set the address part of the socket address from a numeric IP address (string representation). Family must be already set. Throws in case of parse failue.
|
inline |
Set Network Interface to any
Definition at line 159 of file sockaddr.h.
|
inline |
Resize the managed structure to the appropriate size (if needed), in which case the sockaddr structure is cleared to zero, and set the address family field (sa_family).
Definition at line 135 of file sockaddr.h.
|
inline |
Set the port. The address must be of a supported family.
p | The port in host byte order. |
Definition at line 189 of file sockaddr.h.
|
inline |
Definition at line 121 of file sockaddr.h.
|
friend |
Definition at line 297 of file sockaddr.h.