39#include "blocxx/BLOCXX_config.h"
50#if !defined(BLOCXX_WIN32)
52#include <netinet/in.h>
55#include <sys/utsname.h>
74 memset(&in, 0,
sizeof(in));
83 memset(&in, 0,
sizeof(in));
98#if !defined(BLOCXX_WIN32)
106 rval.m_name = filename;
107 rval.m_address =
"localhost";
108 memset(&
rval.m_UDSNativeAddress, 0,
sizeof(
rval.m_UDSNativeAddress));
111 sizeof(
rval.m_UDSNativeAddress.sun_path) - 1);
119#elif defined BLOCXX_OPENUNIX
120 rval.m_UDSNativeAddress.sun_len =
sizeof(
rval.m_UDSNativeAddress);
123#elif defined BLOCXX_AIX || defined BLOCXX_DARWIN
125 rval.m_UDSNativeAddress.sun_len = filename.
length() + 1;
128#elif defined BLOCXX_FREEBSD
130 +
sizeof(
rval.m_UDSNativeAddress.sun_len)
131 +
sizeof(
rval.m_UDSNativeAddress.sun_family);
133 rval.m_nativeSize =
sizeof(
rval.m_UDSNativeAddress.sun_family) +
143 : m_nativeSize(0) , m_type(UNSET)
147#ifndef BLOCXX_HAVE_GETHOSTBYNAME_R
156#ifdef BLOCXX_HAVE_IPV6
170#if defined(BLOCXX_HAVE_GETHOSTBYNAME_R) && defined(BLOCXX_GETHOSTBYNAME_R_ARGUMENTS)
173#if (BLOCXX_GETHOSTBYNAME_R_ARGUMENTS == 6)
181#elif (BLOCXX_GETHOSTBYNAME_R_ARGUMENTS == 5)
188#elif (BLOCXX_GETHOSTBYNAME_R_ARGUMENTS == 3)
196#error Not yet supported: gethostbyname_r() with other argument counts.
200#if defined(BLOCXX_NCR)
224#if !defined(BLOCXX_WIN32)
258#if !defined(BLOCXX_WIN32)
274#if !defined(BLOCXX_WIN32)
296#if defined(BLOCXX_HAVE_GETHOSTBYNAME_R) && defined(BLOCXX_GETHOSTBYNAME_R_ARGUMENTS)
299#if (BLOCXX_GETHOSTBYNAME_R_ARGUMENTS == 6)
307#elif (BLOCXX_GETHOSTBYNAME_R_ARGUMENTS == 5)
314#elif (BLOCXX_GETHOSTBYNAME_R_ARGUMENTS == 3)
322#error Not yet supported: gethostbyname_r() with other argument counts.
343#ifdef BLOCXX_HAVE_IPV6
359#if !defined(BLOCXX_WIN32)
377#ifdef BLOCXX_HAVE_IPV6
391#if !defined(BLOCXX_WIN32)
394 : m_nativeSize(0), m_type(UDS)
402 : m_nativeSize(0), m_type(INET)
432#if !defined(BLOCXX_WIN32)
433 else if (type ==
UDS)
#define BLOCXX_ASSERT(CON)
BLOCXX_ASSERT works similar to the assert() macro, but instead of calling abort(),...
#define BLOCXX_DEFINE_EXCEPTION_WITH_ID(NAME)
Define a new exception class named <NAME>Exception that derives from Exception.
#define BLOCXX_THROW(exType, msg)
Throw an exception using FILE and LINE.
void assignFromNativeForm(const UnixSocketAddress_t *address, size_t len)
size_t getNativeFormSize() const
UInt16 getPort() const
Get the port associated with the address.
InetSocketAddress_t m_inetNativeAddress
const String getAddress() const
Returns the IP address of the host.
const SocketAddress_t * getNativeForm() 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.
static SocketAddress allocEmptyAddress(AddressType type)
Allocate an empty SocketAddress.
const String getName() const
Returns the hostname (FQDN) of the address.
static const char *const ALL_LOCAL_ADDRESSES
static SocketAddress getFromNativeForm(const InetAddress_t &nativeForm, UInt16 nativePort, const String &hostname)
UnixSocketAddress_t m_UDSNativeAddress
static SocketAddress getAnyLocalHost(UInt16 port=0)
Do a DNS lookup on a hostname and return a list of all addresses that map to that hostname.
static SocketAddress getByName(const String &host, unsigned short port=0)
Do a DNS lookup on a hostname and return an SocketAddress for that host.
const String toString() const
Returns the IP address and the port with a colon in between.
static SocketAddress getUDS(const String &filename)
This String class is an abstract data type that represents as NULL terminated string of characters.
const char * c_str() const
sockaddr_in InetSocketAddress_t
bool operator==(const Array< T > &x, const Array< T > &y)
sockaddr_un UnixSocketAddress_t