45 #ifndef QT_NO_NETWORKINTERFACE 51 #include <private/qsystemlibrary_p.h> 65 static bool done =
false;
68 if (iphlpapi.
load()) {
83 if (sa->sa_family == AF_INET)
84 address.
setAddress(htonl(((sockaddr_in *)sa)->sin_addr.s_addr));
85 else if (sa->sa_family ==
AF_INET6) {
91 qWarning(
"Got unknown socket family %d", sa->sa_family);
101 ULONG bufSize =
sizeof staticBuf;
105 if (retval == ERROR_BUFFER_OVERFLOW) {
115 }
else if (retval != ERROR_SUCCESS) {
125 ipv4netmasks[address] = mask;
128 if (pAdapter != staticBuf)
140 ULONG bufSize =
sizeof staticBuf;
147 if (retval == ERROR_BUFFER_OVERFLOW) {
157 }
else if (retval != ERROR_SUCCESS) {
169 iface->index =
ptr->Ipv6IfIndex;
170 else if (
ptr->IfIndex != 0)
171 iface->index =
ptr->IfIndex;
181 if (
ptr->PhysicalAddressLength)
182 iface->hardwareAddress = iface->makeHwAddress(
ptr->PhysicalAddressLength,
183 ptr->PhysicalAddress);
196 pprefix =
ptr->FirstPrefix;
208 pprefix = pprefix->
Next ? pprefix->
Next : pprefix;
210 iface->addressEntries << entry;
214 if (pAdapter != staticBuf)
225 ULONG bufSize =
sizeof staticBuf;
228 if (retval == ERROR_BUFFER_OVERFLOW) {
238 }
else if (retval != ERROR_SUCCESS) {
264 iface->addressEntries << entry;
268 if (pAdapter != staticBuf)
298 ULONG bufSize =
sizeof info;
321 #endif // QT_NO_NETWORKINTERFACE
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setScopeId(const QString &id)
Sets the IPv6 scope ID of the address to id.
static QString fromWCharArray(const wchar_t *, int size=-1)
Returns a copy of the string, where the encoding of string depends on the size of wchar...
static PtrGetAdaptersInfo ptrGetAdaptersInfo
static QHash< QHostAddress, QHostAddress > ipv4Netmasks()
static QString fromLocal8Bit(const char *, int size=-1)
Returns a QString initialized with the first size characters of the 8-bit string str.
#define IP_ADAPTER_NO_MULTICAST
static mach_timebase_info_data_t info
#define QT_END_NAMESPACE
This macro expands to.
QHostAddress ip() const
This function returns one IPv4 or IPv6 address found, that was found in a network interface...
DWORD(WINAPI * PtrGetNetworkParams)(PFIXED_INFO, PULONG)
Q_CORE_EXPORT void qFree(void *ptr)
void setPrefixLength(int length)
Sets the prefix length of this IP address to length.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
Q_CORE_EXPORT void * qMalloc(size_t size)
The QString class provides a Unicode character string.
The QHash class is a template class that provides a hash-table-based dictionary.
bool load(bool onlySystemDirectory=true)
DWORD(WINAPI * PtrGetAdaptersInfo)(PIP_ADAPTER_INFO, PULONG)
static QList< QNetworkInterfacePrivate * > interfaceListing()
ULONG(WINAPI * PtrGetAdaptersAddresses)(ULONG, ULONG, PVOID, PIP_ADAPTER_ADDRESSES, PULONG)
static void resolveLibs()
#define QT_BEGIN_NAMESPACE
This macro expands to.
char DomainName[MAX_DOMAIN_NAME_LEN+4]
static QString makeHwAddress(int len, uchar *data)
static QHostAddress addressFromSockaddr(sockaddr *sa)
QList< QNetworkInterfacePrivate * > scan()
static QList< QNetworkInterfacePrivate * > interfaceListingWinXP()
Q_CORE_EXPORT void qWarning(const char *,...)
struct FIXED_INFO * PFIXED_INFO
const T * ptr(const T &t)
#define GAA_FLAG_SKIP_MULTICAST
static QString fromAce(const QByteArray &)
Returns the Unicode form of the given domain name domain, which is encoded in the ASCII Compatible En...
struct _IP_ADAPTER_ADDRESSES * PIP_ADAPTER_ADDRESSES
void * resolve(const char *symbol)
QAbstractSocket::NetworkLayerProtocol protocol() const
Returns the network layer protocol of the host address.
struct _IP_ADAPTER_PREFIX * Next
void setAddress(quint32 ip4Addr)
Set the IPv4 address specified by ip4Addr.
void setIp(const QHostAddress &newIp)
Sets the IP address the QNetworkAddressEntry object contains to newIp.
#define GAA_FLAG_INCLUDE_PREFIX
static PtrGetAdaptersAddresses ptrGetAdaptersAddresses
void setNetmask(const QHostAddress &newNetmask)
Sets the netmask that this QNetworkAddressEntry object contains to newNetmask.
static QList< QNetworkInterfacePrivate * > interfaceListingWin2k()
The QHostAddress class provides an IP address.
#define GAA_FLAG_SKIP_DNS_SERVER
The QNetworkAddressEntry class stores one IP address supported by a network interface, along with its associated netmask and broadcast address.
static PtrGetNetworkParams ptrGetNetworkParams
static QString localDomainName()
Returns the DNS domain of this machine.
The QList class is a template class that provides lists.
struct _IP_ADAPTER_INFO * PIP_ADAPTER_INFO