Data addr("5f1b:df00:ce3e:e200:20:800:2b37:6426");
cerr << "!! "<< addr << endl;
#define resip_assert(x)
This file needs to work for both C and C++ code.
#if !defined(RESIP_DNSUTIL_HXX)
#define RESIP_DNSUTIL_HXX
#include <list>
#ifndef WIN32
#include <netinet/in.h>
#else
#include <Ws2tcpip.h>
#endif
struct in_addr;
struct in6_addr;
{
class Tuple;
class DnsUtil
{
public:
class Exception final : public BaseException
{
public:
Exception(const Data& msg,
const Data& file,
const int line)
: BaseException(msg, file, line) {}
protected:
const char*
name() const noexcept
override {
return "DnsUtil::Exception"; }
};
static Data
inet_ntop(
const struct in_addr& addr);
static Data
inet_ntop(
const struct sockaddr& addr);
static int inet_pton(
const Data& printableIp,
struct in_addr& dst);
#ifdef IPPROTO_IPV6
static Data
inet_ntop(
const struct in6_addr& addr);
static int inet_pton(
const Data& printableIp,
struct in6_addr& dst);
#endif
static const char *
inet_ntop(
int af,
const void* src,
char* dst,
size_t size);
#ifdef __APPLE__
static const Data UInt8ToStr[256];
#endif
static int inet_pton(
int af,
const char * src,
void * dst);
private:
static Data lookupLocalHostName();
};
}
#endif
Handles cross-platform sockets compatibility.
static const Data Empty
Constant that represents a zero-length data.
const char * name() const noexcept override
static bool isIpV6Address(const Data &ipAddress)
static Data canonicalizeIpV6Address(const Data &ipV6Address)
Converts the printable form of an IPv6 address into consistent format so that string comparisons will...
static Data getLocalDomainName()
static std::list< std::pair< Data, Data > > getInterfaces(const Data &matchingInterface=Data::Empty)
static bool isIpAddress(const Data &ipAddress)
static const Data & getLocalHostName()
static int inet_pton(const Data &printableIp, struct in_addr &dst)
Convert from the presentation format of the IPv4 address to struct in_addr.
static Data inet_ntop(const struct in_addr &addr)
Converts from the network format to presentation format.
static bool isIpV4Address(const Data &ipAddress)
static std::list< Data > lookupARecords(const Data &host)
Used to synchronously query A records - only for test code usage.
static Data getLocalIpAddress(const Data &defaultInterface=Data::Empty)
Gets the IP address of "the" local interface.
dcm! – add UnusedChecking(_enum) below;