#include <SocketAddress.hpp>
Public Types | |
enum | AddressType { UNSET, INET, UDS } |
Public Member Functions | |
AddressType | getType () const |
UInt16 | getPort () const |
Get the port associated with the address. | |
~SocketAddress () | |
const String | getName () const |
Returns the hostname (FQDN) of the address. | |
const String | getAddress () const |
Returns the IP address of the host. | |
const SocketAddress_t * | getNativeForm () const |
size_t | getNativeFormSize () const |
const InetSocketAddress_t * | getInetAddress () const |
Get a pointer to the InetSocketAddress_t precondition: getType() == INET. | |
const UnixSocketAddress_t * | getUnixAddress () const |
Get a pointer to the UnixSocketAddress_t precondition: getType() == UDS. | |
void | assignFromNativeForm (const UnixSocketAddress_t *address, size_t len) |
const String | toString () const |
Returns the IP address and the port with a colon in between. | |
void | assignFromNativeForm (const InetSocketAddress_t *address, size_t len) |
SocketAddress () | |
Static Public Member Functions | |
static SocketAddress | getByName (const String &host, unsigned short port=0) |
Do a DNS lookup on a hostname and return an SocketAddress for that host. | |
static SocketAddress | getAnyLocalHost (UInt16 port=0) |
Get an SocketAddress appropriate for referring to the local host. | |
static SocketAddress | allocEmptyAddress (AddressType type) |
Allocate an empty SocketAddress. | |
static SocketAddress | getUDS (const String &filename) |
Static Public Attributes | |
static const char *const | ALL_LOCAL_ADDRESSES = "0.0.0.0" |
Private Member Functions | |
SocketAddress (const InetSocketAddress_t &nativeForm) | |
SocketAddress (const UnixSocketAddress_t &nativeForm) | |
Static Private Member Functions | |
static SocketAddress | getFromNativeForm (const InetAddress_t &nativeForm, UInt16 nativePort, const String &hostname) |
static SocketAddress | getFromNativeForm (const InetSocketAddress_t &nativeForm) |
static SocketAddress | getFromNativeForm (const UnixSocketAddress_t &nativeForm) |
Private Attributes | |
String | m_name |
String | m_address |
size_t | m_nativeSize |
InetSocketAddress_t | m_inetNativeAddress |
UnixSocketAddress_t | m_UDSNativeAddress |
AddressType | m_type |
Definition at line 54 of file SocketAddress.hpp.
|
Definition at line 59 of file SocketAddress.hpp. |
|
Definition at line 102 of file SocketAddress.hpp. |
|
Definition at line 108 of file SocketAddress.cpp. Referenced by allocEmptyAddress(), and getFromNativeForm(). |
|
Definition at line 325 of file SocketAddress.cpp. References assignFromNativeForm(). |
|
Definition at line 317 of file SocketAddress.cpp. References assignFromNativeForm(). |
|
Allocate an empty SocketAddress.
Definition at line 346 of file SocketAddress.cpp. References BLOCXX_THROW, getFromNativeForm(), INET, SocketAddress(), and UDS. Referenced by BLOCXX_NAMESPACE::ServerSocketImpl::doListen(). |
|
Definition at line 286 of file SocketAddress.cpp. References INET, m_address, m_inetNativeAddress, m_nativeSize, and m_type. |
|
Definition at line 297 of file SocketAddress.cpp. References m_address, m_name, m_nativeSize, m_type, m_UDSNativeAddress, and UDS. Referenced by BLOCXX_NAMESPACE::ServerSocketImpl::fillAddrParms(), BLOCXX_NAMESPACE::SocketBaseImpl::fillInetAddrParms(), BLOCXX_NAMESPACE::SocketBaseImpl::fillUnixAddrParms(), and SocketAddress(). |
|
Returns the IP address of the host.
Definition at line 336 of file SocketAddress.cpp. References m_address. Referenced by toString(). |
|
Get an SocketAddress appropriate for referring to the local host.
Definition at line 234 of file SocketAddress.cpp. References BLOCXX_GETHOSTBYNAME_R_ARGUMENTS, BLOCXX_HAVE_GETHOSTBYNAME_R, getFromNativeForm(), BLOCXX_NAMESPACE::hton32(), BLOCXX_NAMESPACE::String::indexOf(), and BLOCXX_NAMESPACE::String::npos. |
|
Do a DNS lookup on a hostname and return an SocketAddress for that host.
Definition at line 120 of file SocketAddress.cpp. References BLOCXX_NAMESPACE::String::c_str(). Referenced by BLOCXX_NAMESPACE::ServerSocketImpl::doListen(). |
|
Definition at line 176 of file SocketAddress.cpp. References SocketAddress(). |
|
Definition at line 167 of file SocketAddress.cpp. References SocketAddress(). |
|
Definition at line 185 of file SocketAddress.cpp. References BLOCXX_NAMESPACE::hton16(), INET, m_name, m_type, and SocketAddress(). Referenced by allocEmptyAddress(), and getAnyLocalHost(). |
|
Get a pointer to the InetSocketAddress_t precondition: getType() == INET.
Definition at line 217 of file SocketAddress.cpp. References m_inetNativeAddress. Referenced by BLOCXX_NAMESPACE::ServerSocketImpl::doListen(). |
|
Returns the hostname (FQDN) of the address.
Definition at line 331 of file SocketAddress.cpp. References m_name. |
|
Definition at line 199 of file SocketAddress.cpp. References INET, m_inetNativeAddress, m_type, m_UDSNativeAddress, and UDS. |
|
Definition at line 341 of file SocketAddress.cpp. References m_nativeSize. |
|
Get the port associated with the address.
Definition at line 309 of file SocketAddress.cpp. References BLOCXX_ASSERT, INET, m_inetNativeAddress, m_type, and BLOCXX_NAMESPACE::ntoh16(). Referenced by toString(). |
|
Definition at line 65 of file SocketAddress.hpp. Referenced by BLOCXX_NAMESPACE::ServerSocketImpl::accept(), BLOCXX_NAMESPACE::ServerSocketImpl::close(), BLOCXX_NAMESPACE::SocketBaseImpl::connect(), and BLOCXX_NAMESPACE::ServerSocketImpl::fillAddrParms(). |
|
Definition at line 72 of file SocketAddress.cpp. References BLOCXX_NAMESPACE::String::c_str(), BLOCXX_NAMESPACE::String::length(), m_address, m_name, m_nativeSize, m_type, m_UDSNativeAddress, and UDS. Referenced by BLOCXX_NAMESPACE::ServerSocketImpl::doListen(). |
|
Get a pointer to the UnixSocketAddress_t precondition: getType() == UDS.
Definition at line 226 of file SocketAddress.cpp. References m_UDSNativeAddress. |
|
Returns the IP address and the port with a colon in between.
Definition at line 369 of file SocketAddress.cpp. References BLOCXX_ASSERT, getAddress(), getPort(), INET, m_name, m_type, and UNSET. Referenced by BLOCXX_NAMESPACE::ServerSocketImpl::close(). |
|
Definition at line 57 of file SocketAddress.hpp. Referenced by BLOCXX_NAMESPACE::ServerSocketImpl::doListen(). |
|
Definition at line 155 of file SocketAddress.hpp. Referenced by assignFromNativeForm(), getAddress(), and getUDS(). |
|
Definition at line 158 of file SocketAddress.hpp. Referenced by assignFromNativeForm(), getInetAddress(), getNativeForm(), and getPort(). |
|
Definition at line 154 of file SocketAddress.hpp. Referenced by assignFromNativeForm(), getFromNativeForm(), getName(), getUDS(), and toString(). |
|
Definition at line 156 of file SocketAddress.hpp. Referenced by assignFromNativeForm(), getNativeFormSize(), and getUDS(). |
|
Definition at line 164 of file SocketAddress.hpp. Referenced by assignFromNativeForm(), getFromNativeForm(), getNativeForm(), getPort(), getUDS(), and toString(). |
|
Definition at line 161 of file SocketAddress.hpp. Referenced by assignFromNativeForm(), getNativeForm(), getUDS(), and getUnixAddress(). |