Qt 4.8
Macros | Typedefs | Functions | Variables
qhostinfo_unix.cpp File Reference
#include "qplatformdefs.h"
#include "qhostinfo_p.h"
#include "private/qnativesocketengine_p.h"
#include "qiodevice.h"
#include <qbytearray.h>
#include <qlibrary.h>
#include <qurl.h>
#include <qfile.h>
#include <private/qmutexpool_p.h>
#include <private/qnet_unix_p.h>
#include <sys/types.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <resolv.h>

Go to the source code of this file.

Macros

#define QT_SOCKOPTLEN_T   QT_SOCKLEN_T
 

Typedefs

typedef int(* res_init_proto) (void)
 
typedef void(* res_nclose_proto) (res_state_ptr)
 
typedef int(* res_ninit_proto) (res_state_ptr)
 
typedef struct __res_state * res_state_ptr
 

Functions

static void resolveLibrary ()
 

Variables

static res_state_ptr local_res = 0
 
static res_init_proto local_res_init = 0
 
static res_nclose_proto local_res_nclose = 0
 
static res_ninit_proto local_res_ninit = 0
 

Macro Definition Documentation

◆ QT_SOCKOPTLEN_T

#define QT_SOCKOPTLEN_T   QT_SOCKLEN_T

Typedef Documentation

◆ res_init_proto

typedef int(* res_init_proto) (void)

Definition at line 87 of file qhostinfo_unix.cpp.

◆ res_nclose_proto

typedef void(* res_nclose_proto) (res_state_ptr)

Definition at line 91 of file qhostinfo_unix.cpp.

◆ res_ninit_proto

typedef int(* res_ninit_proto) (res_state_ptr)

Definition at line 89 of file qhostinfo_unix.cpp.

◆ res_state_ptr

typedef struct __res_state* res_state_ptr

Definition at line 85 of file qhostinfo_unix.cpp.

Function Documentation

◆ resolveLibrary()

static void resolveLibrary ( )
static

Definition at line 95 of file qhostinfo_unix.cpp.

Referenced by QHostInfoAgent::fromName(), and QHostInfo::localDomainName().

96 {
97 #if !defined(QT_NO_LIBRARY) && !defined(Q_OS_QNX)
98  QLibrary lib(QLatin1String("resolv"));
99  lib.setLoadHints(QLibrary::ImprovedSearchHeuristics);
100  if (!lib.load())
101  return;
102 
103  local_res_init = res_init_proto(lib.resolve("__res_init"));
104  if (!local_res_init)
105  local_res_init = res_init_proto(lib.resolve("res_init"));
106 
107  local_res_ninit = res_ninit_proto(lib.resolve("__res_ninit"));
108  if (!local_res_ninit)
109  local_res_ninit = res_ninit_proto(lib.resolve("res_ninit"));
110 
111  if (!local_res_ninit) {
112  // if we can't get a thread-safe context, we have to use the global _res state
113  local_res = res_state_ptr(lib.resolve("_res"));
114  } else {
115  local_res_nclose = res_nclose_proto(lib.resolve("res_nclose"));
116  if (!local_res_nclose)
117  local_res_nclose = res_nclose_proto(lib.resolve("__res_nclose"));
118  if (!local_res_nclose)
119  local_res_ninit = 0;
120  }
121 #endif
122 }
void(* res_nclose_proto)(res_state_ptr)
static res_state_ptr local_res
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
struct __res_state * res_state_ptr
int(* res_init_proto)(void)
int(* res_ninit_proto)(res_state_ptr)
static res_init_proto local_res_init
static res_nclose_proto local_res_nclose
static res_ninit_proto local_res_ninit
The QLibrary class loads shared libraries at runtime.
Definition: qlibrary.h:62

Variable Documentation

◆ local_res

res_state_ptr local_res = 0
static

Definition at line 93 of file qhostinfo_unix.cpp.

Referenced by QHostInfo::localDomainName(), and resolveLibrary().

◆ local_res_init

res_init_proto local_res_init = 0
static

◆ local_res_nclose

res_nclose_proto local_res_nclose = 0
static

Definition at line 92 of file qhostinfo_unix.cpp.

Referenced by QHostInfo::localDomainName(), and resolveLibrary().

◆ local_res_ninit

res_ninit_proto local_res_ninit = 0
static

Definition at line 90 of file qhostinfo_unix.cpp.

Referenced by QHostInfo::localDomainName(), and resolveLibrary().