#include <sockaddr.h>
|
|
static std::vector< SockAddr > | resolve (const std::string &host, const std::string &service={}) |
|
| 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.
◆ SockAddr() [1/6]
| dht::SockAddr::SockAddr |
( |
| ) |
|
|
inline |
◆ SockAddr() [2/6]
| dht::SockAddr::SockAddr |
( |
const SockAddr & | o | ) |
|
|
inline |
◆ SockAddr() [3/6]
| dht::SockAddr::SockAddr |
( |
SockAddr && | o | ) |
|
|
inlinenoexcept |
◆ SockAddr() [4/6]
| dht::SockAddr::SockAddr |
( |
const sockaddr * | sa, |
|
|
socklen_t | length ) |
|
inline |
Build from existing address.
Definition at line 75 of file sockaddr.h.
◆ SockAddr() [5/6]
| dht::SockAddr::SockAddr |
( |
const sockaddr * | sa | ) |
|
|
inline |
◆ SockAddr() [6/6]
| dht::SockAddr::SockAddr |
( |
const sockaddr_storage & | ss, |
|
|
socklen_t | len ) |
|
inline |
Build from an existing sockaddr_storage structure.
Definition at line 96 of file sockaddr.h.
◆ equals()
| bool dht::SockAddr::equals |
( |
const SockAddr & | o | ) |
const |
|
inline |
◆ get() [1/2]
| sockaddr * dht::SockAddr::get |
( |
| ) |
|
|
inline |
Returns the address to the managed sockaddr structure. The accessible length is returned by getLength().
Definition at line 244 of file sockaddr.h.
◆ get() [2/2]
| const sockaddr * dht::SockAddr::get |
( |
| ) |
const |
|
inline |
Returns the address to the managed sockaddr structure. The accessible length is returned by getLength().
Definition at line 238 of file sockaddr.h.
◆ getFamily()
| sa_family_t dht::SockAddr::getFamily |
( |
| ) |
const |
|
inline |
Returns the address family or AF_UNSPEC if the address is not set.
Definition at line 128 of file sockaddr.h.
◆ getIPv4() [1/2]
| sockaddr_in & dht::SockAddr::getIPv4 |
( |
| ) |
|
|
inline |
◆ getIPv4() [2/2]
| const sockaddr_in & dht::SockAddr::getIPv4 |
( |
| ) |
const |
|
inline |
◆ getIPv6() [1/2]
| sockaddr_in6 & dht::SockAddr::getIPv6 |
( |
| ) |
|
|
inline |
◆ getIPv6() [2/2]
| const sockaddr_in6 & dht::SockAddr::getIPv6 |
( |
| ) |
const |
|
inline |
◆ getLength()
| socklen_t dht::SockAddr::getLength |
( |
| ) |
const |
|
inline |
Returns the accessible byte length at the pointer returned by get(). If zero, get() returns null.
Definition at line 225 of file sockaddr.h.
◆ getPort()
| in_port_t dht::SockAddr::getPort |
( |
| ) |
const |
|
inline |
Retreive the port (in host byte order) or 0 if the address is not of a supported family.
Definition at line 190 of file sockaddr.h.
◆ isLoopback()
| bool dht::SockAddr::isLoopback |
( |
| ) |
const |
Return true if address is a loopback IP address.
◆ isPrivate()
| bool dht::SockAddr::isPrivate |
( |
| ) |
const |
Return true if address is not a public IP address.
◆ operator bool()
| dht::SockAddr::operator bool |
( |
| ) |
const |
|
inlineexplicitnoexcept |
An address is defined to be true if its length is not zero.
Definition at line 230 of file sockaddr.h.
◆ operator<()
| bool dht::SockAddr::operator< |
( |
const SockAddr & | o | ) |
const |
|
inline |
◆ operator=() [1/2]
| SockAddr & dht::SockAddr::operator= |
( |
const SockAddr & | o | ) |
|
|
inline |
◆ operator=() [2/2]
| SockAddr & dht::SockAddr::operator= |
( |
SockAddr && | o | ) |
|
|
inline |
◆ release()
| sockaddr * dht::SockAddr::release |
( |
| ) |
|
|
inline |
Releases the ownership of the managed object, if any. The caller is responsible for deleting the object with free().
Definition at line 263 of file sockaddr.h.
◆ setAddress()
| 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.
◆ setAny()
| void dht::SockAddr::setAny |
( |
| ) |
|
|
inline |
◆ setFamily()
| void dht::SockAddr::setFamily |
( |
sa_family_t | af | ) |
|
|
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.
◆ setLoopback()
| void dht::SockAddr::setLoopback |
( |
| ) |
|
|
inline |
Set address to loopback.
Definition at line 174 of file sockaddr.h.
◆ setPort()
| void dht::SockAddr::setPort |
( |
in_port_t | p | ) |
|
|
inline |
Set the port. The address must be of a supported family.
- Parameters
-
| p | The port in host byte order. |
Definition at line 204 of file sockaddr.h.
◆ toString()
| std::string dht::SockAddr::toString |
( |
| ) |
const |
|
inline |
◆ operator<<
| std::ostream & operator<< |
( |
std::ostream & | s, |
|
|
const SockAddr & | h ) |
|
friend |
The documentation for this class was generated from the following file:
- /home/noptrix/ba/blackarch/packages/opendht-c/src/opendht/include/opendht/sockaddr.h