Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdnslookup_unix.cpp File Reference

(c272119847220dcf239ca8a9908867376d6dca30)

#include "qdnslookup_p.h"
#include <qendian.h>
#include <qrandom.h>
#include <qspan.h>
#include <qurl.h>
#include <qvarlengtharray.h>
#include <private/qnativesocketengine_p.h>
#include <private/qtnetwork-config_p.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <errno.h>
#include <resolv.h>
#include <array>
Include dependency graph for qdnslookup_unix.cpp:

Go to the source code of this file.

Macros

#define T_OPT   ns_t_opt

Typedefs

using ReplyBuffer = QDnsLookupRunnable::ReplyBuffer
using QueryBuffer = std::array<unsigned char, (QueryBufferSize + 15) / 16 * 16>
using Cache = QList<QDnsCachedName>

Functions

 Q_DECLARE_TYPEINFO (QDnsCachedName, Q_RELOCATABLE_TYPE)
static int prepareQueryBuffer (QueryBuffer &buffer, const char *label, ns_type type)
static int local_res_nsend (net_handle_t network, const uint8_t *msg, size_t msglen, uint32_t flags) __attribute__((weakref("android_res_nsend")))
static int local_res_nresult (int fd, int *rcode, uint8_t *answer, size_t anslen) __attribute__((weakref("android_res_nresult")))
bool qt_androidDnsResolverAvailable ()
static int sendStandardDns (QDnsLookupReply *reply, QSpan< unsigned char > qbuffer, ReplyBuffer &buffer, const QHostAddress &nameserver)

Variables

static constexpr unsigned char Edns0Record []
static constexpr qsizetype QueryBufferSize

Macro Definition Documentation

◆ T_OPT

#define T_OPT   ns_t_opt

Definition at line 39 of file qdnslookup_unix.cpp.

Typedef Documentation

◆ Cache

typedef QList< QDnsCachedName > Cache = QList<QDnsCachedName>

Definition at line 72 of file qdnslookup_unix.cpp.

◆ QueryBuffer

typedef std::array< unsigned char,(QueryBufferSize+15)/16 *16 > QueryBuffer = std::array<unsigned char, (QueryBufferSize + 15) / 16 * 16>

Definition at line 61 of file qdnslookup_unix.cpp.

◆ ReplyBuffer

Function Documentation

◆ local_res_nresult()

int local_res_nresult ( int fd,
int * rcode,
uint8_t * answer,
size_t anslen )
static

◆ local_res_nsend()

int local_res_nsend ( net_handle_t network,
const uint8_t * msg,
size_t msglen,
uint32_t flags )
static

◆ prepareQueryBuffer()

int prepareQueryBuffer ( QueryBuffer & buffer,
const char * label,
ns_type type )
static

Definition at line 287 of file qdnslookup_unix.cpp.

References Edns0Record.

◆ Q_DECLARE_TYPEINFO()

Q_DECLARE_TYPEINFO ( QDnsCachedName ,
Q_RELOCATABLE_TYPE  )

◆ qt_androidDnsResolverAvailable()

bool qt_androidDnsResolverAvailable ( )

Definition at line 324 of file qdnslookup_unix.cpp.

Referenced by sendStandardDns().

Here is the caller graph for this function:

◆ sendStandardDns()

int sendStandardDns ( QDnsLookupReply * reply,
QSpan< unsigned char > qbuffer,
ReplyBuffer & buffer,
const QHostAddress & nameserver )
static

Definition at line 329 of file qdnslookup_unix.cpp.

References QDnsLookupReply::makeResolverSystemError(), QDnsLookupReply::makeTimeoutError(), and qt_androidDnsResolverAvailable().

Here is the call graph for this function:

Variable Documentation

◆ Edns0Record

constexpr unsigned char Edns0Record
staticconstexpr
Initial value:
= {
0x00,
T_OPT >> 8, T_OPT & 0xff,
NOERROR,
0,
0x00, 0x00,
0x00, 0x00,
}
#define T_OPT

Definition at line 48 of file qdnslookup_unix.cpp.

Referenced by prepareQueryBuffer().

◆ QueryBufferSize

constexpr qsizetype QueryBufferSize
staticconstexpr
Initial value:
=
HFIXEDSZ + QFIXEDSZ + MAXCDNAME + 1 + sizeof(Edns0Record)
static constexpr unsigned char Edns0Record[]

Definition at line 59 of file qdnslookup_unix.cpp.