Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qnetworkinterface_unix.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// Copyright (C) 2016 Intel Corporation.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#include "qbytearray.h"
6#include "qset.h"
7#include "qnetworkinterface.h"
10#include "qalgorithms.h"
11
12#include <QtCore/private/qduplicatetracker_p.h>
13
14#ifndef QT_NO_NETWORKINTERFACE
15
16#if defined(QT_NO_CLOCK_MONOTONIC)
17# include "qdatetime.h"
18#endif
19
20#if QT_CONFIG(getifaddrs)
21# include <ifaddrs.h>
22#endif
23
24#ifdef QT_LINUXBASE
25# include <arpa/inet.h>
26# ifndef SIOCGIFBRDADDR
27# define SIOCGIFBRDADDR 0x8919
28# endif
29#endif // QT_LINUXBASE
30
31#include <qplatformdefs.h>
32
34
35static QHostAddress addressFromSockaddr(sockaddr *sa, int ifindex = 0, const QString &ifname = QString())
36{
38 if (!sa)
39 return address;
40
41 if (sa->sa_family == AF_INET)
42 address.setAddress(htonl(((sockaddr_in *)sa)->sin_addr.s_addr));
43 else if (sa->sa_family == AF_INET6) {
44 address.setAddress(((sockaddr_in6 *)sa)->sin6_addr.s6_addr);
45 int scope = ((sockaddr_in6 *)sa)->sin6_scope_id;
46 if (scope && scope == ifindex) {
47 // this is the most likely scenario:
48 // a scope ID in a socket is that of the interface this address came from
49 address.setScopeId(ifname);
50 } else if (scope) {
52 }
53 }
54 return address;
55}
56
57template <typename Req> [[maybe_unused]]
58static auto &ifreq_index(Req &req, std::enable_if_t<sizeof(std::declval<Req>().ifr_index) != 0, int> = 0)
59{
60 return req.ifr_index;
61}
62
63template <typename Req> [[maybe_unused]]
64static auto &ifreq_index(Req &req, std::enable_if_t<sizeof(std::declval<Req>().ifr_ifindex) != 0, int> = 0)
65{
66 return req.ifr_ifindex;
67}
68
70{
71#if QT_CONFIG(ipv6ifname)
72 return ::if_nametoindex(name.toLatin1().constData());
73#elif defined(SIOCGIFINDEX)
74 struct ifreq req;
75 int socket = qt_safe_socket(AF_INET, SOCK_STREAM, 0);
76 if (socket < 0)
77 return 0;
78
79 const QByteArray name8bit = name.toLatin1();
80 memset(&req, 0, sizeof(ifreq));
81 if (!name8bit.isNull())
82 memcpy(req.ifr_name, name8bit.data(), qMin(size_t(name8bit.length()) + 1, sizeof(req.ifr_name) - 1));
83
84 uint id = 0;
85 if (qt_safe_ioctl(socket, SIOCGIFINDEX, &req) >= 0)
86 id = ifreq_index(req);
88 return id;
89#else
91 return 0;
92#endif
93}
94
96{
97#if QT_CONFIG(ipv6ifname)
98 char buf[IF_NAMESIZE];
99 if (::if_indextoname(index, buf))
100 return QString::fromLatin1(buf);
101#elif defined(SIOCGIFNAME)
102 struct ifreq req;
103 int socket = qt_safe_socket(AF_INET, SOCK_STREAM, 0);
104 if (socket >= 0) {
105 memset(&req, 0, sizeof(ifreq));
106 ifreq_index(req) = index;
107 if (qt_safe_ioctl(socket, SIOCGIFNAME, &req) >= 0) {
109 return QString::fromLatin1(req.ifr_name);
110 }
112 }
113#endif
114 return QString::number(uint(index));
115}
116
117static int getMtu(int socket, struct ifreq *req)
118{
119#ifdef SIOCGIFMTU
120 if (qt_safe_ioctl(socket, SIOCGIFMTU, req) == 0)
121 return req->ifr_mtu;
122#endif
123 return 0;
124}
125
126#if !QT_CONFIG(getifaddrs)
127// getifaddrs not available
128
129static QSet<QByteArray> interfaceNames(int socket)
130{
131 QSet<QByteArray> result;
132#if !QT_CONFIG(ipv6ifname)
133 QByteArray storageBuffer;
134 struct ifconf interfaceList;
135 static const int STORAGEBUFFER_GROWTH = 256;
136
137 forever {
138 // grow the storage buffer
139 storageBuffer.resize(storageBuffer.size() + STORAGEBUFFER_GROWTH);
140 interfaceList.ifc_buf = storageBuffer.data();
141 interfaceList.ifc_len = storageBuffer.size();
142
143 // get the interface list
144 if (qt_safe_ioctl(socket, SIOCGIFCONF, &interfaceList) >= 0) {
145 if (int(interfaceList.ifc_len + sizeof(ifreq) + 64) < storageBuffer.size()) {
146 // if the buffer was big enough, break
147 storageBuffer.resize(interfaceList.ifc_len);
148 break;
149 }
150 } else {
151 // internal error
152 return result;
153 }
154 if (storageBuffer.size() > 100000) {
155 // out of space
156 return result;
157 }
158 }
159
160 int interfaceCount = interfaceList.ifc_len / sizeof(ifreq);
161 for (int i = 0; i < interfaceCount; ++i) {
162 QByteArray name = QByteArray(interfaceList.ifc_req[i].ifr_name);
163 if (!name.isEmpty())
164 result << name;
165 }
166
167 return result;
168#else
170
171 // use if_nameindex
172 struct if_nameindex *interfaceList = ::if_nameindex();
173 for (struct if_nameindex *ptr = interfaceList; ptr && ptr->if_name; ++ptr)
174 result << ptr->if_name;
175
176 if_freenameindex(interfaceList);
177 return result;
178#endif
179}
180
181static QNetworkInterfacePrivate *findInterface(int socket, QList<QNetworkInterfacePrivate *> &interfaces,
182 struct ifreq &req)
183{
184 QNetworkInterfacePrivate *iface = nullptr;
185 int ifindex = 0;
186
187#if QT_CONFIG(ipv6ifname) || defined(SIOCGIFINDEX)
188 // Get the interface index
189# ifdef SIOCGIFINDEX
190 if (qt_safe_ioctl(socket, SIOCGIFINDEX, &req) >= 0)
191 ifindex = ifreq_index(req);
192# else
193 ifindex = if_nametoindex(req.ifr_name);
194# endif
195
196 // find the interface data
197 QList<QNetworkInterfacePrivate *>::Iterator if_it = interfaces.begin();
198 for ( ; if_it != interfaces.end(); ++if_it)
199 if ((*if_it)->index == ifindex) {
200 // existing interface
201 iface = *if_it;
202 break;
203 }
204#else
206 // Search by name
207 QList<QNetworkInterfacePrivate *>::Iterator if_it = interfaces.begin();
208 for ( ; if_it != interfaces.end(); ++if_it)
209 if ((*if_it)->name == QLatin1StringView(req.ifr_name)) {
210 // existing interface
211 iface = *if_it;
212 break;
213 }
214#endif
215
216 if (!iface) {
217 // new interface, create data:
218 iface = new QNetworkInterfacePrivate;
219 iface->index = ifindex;
220 interfaces << iface;
221 }
222
223 return iface;
224}
225
226static QList<QNetworkInterfacePrivate *> interfaceListing()
227{
228 QList<QNetworkInterfacePrivate *> interfaces;
229
230 int socket;
231 if ((socket = qt_safe_socket(AF_INET, SOCK_STREAM, IPPROTO_IP)) == -1)
232 return interfaces; // error
233
234 QSet<QByteArray> names = interfaceNames(socket);
236 for ( ; it != names.constEnd(); ++it) {
237 ifreq req;
238 memset(&req, 0, sizeof(ifreq));
239 if (!it->isNull())
240 memcpy(req.ifr_name, it->constData(), qMin(size_t(it->length()) + 1, sizeof(req.ifr_name) - 1));
241
242 QNetworkInterfacePrivate *iface = findInterface(socket, interfaces, req);
243
244#ifdef SIOCGIFNAME
245 // Get the canonical name
246 QByteArray oldName = req.ifr_name;
247 if (qt_safe_ioctl(socket, SIOCGIFNAME, &req) >= 0) {
248 iface->name = QString::fromLatin1(req.ifr_name);
249
250 // reset the name:
251 if (!oldName.isNull())
252 memcpy(req.ifr_name, oldName.constData(), qMin(size_t(oldName.length()) + 1, sizeof(req.ifr_name) - 1));
253 } else
254#endif
255 {
256 // use this name anyways
257 iface->name = QString::fromLatin1(req.ifr_name);
258 }
259
260 // Get interface flags
261 if (qt_safe_ioctl(socket, SIOCGIFFLAGS, &req) >= 0) {
262 iface->flags = convertFlags(req.ifr_flags);
263 }
264 iface->mtu = getMtu(socket, &req);
265
266#ifdef SIOCGIFHWADDR
267 // Get the HW address
268 if (qt_safe_ioctl(socket, SIOCGIFHWADDR, &req) >= 0) {
269 uchar *addr = (uchar *)req.ifr_addr.sa_data;
270 iface->hardwareAddress = iface->makeHwAddress(6, addr);
271 }
272#endif
273
274 // Get the address of the interface
276 if (qt_safe_ioctl(socket, SIOCGIFADDR, &req) >= 0) {
277 sockaddr *sa = &req.ifr_addr;
278 entry.setIp(addressFromSockaddr(sa));
279
280 // Get the interface broadcast address
281 if (iface->flags & QNetworkInterface::CanBroadcast) {
282 if (qt_safe_ioctl(socket, SIOCGIFBRDADDR, &req) >= 0) {
283 sockaddr *sa = &req.ifr_addr;
284 if (sa->sa_family == AF_INET)
285 entry.setBroadcast(addressFromSockaddr(sa));
286 }
287 }
288
289 // Get the interface netmask
290 if (qt_safe_ioctl(socket, SIOCGIFNETMASK, &req) >= 0) {
291 sockaddr *sa = &req.ifr_addr;
292 entry.setNetmask(addressFromSockaddr(sa));
293 }
294
295 iface->addressEntries << entry;
296 }
297 }
298
299 ::close(socket);
300 return interfaces;
301}
302
303#else
304// use getifaddrs
305
306// platform-specific defs:
307# ifdef Q_OS_LINUX
309# include <features.h>
311# endif
312
313# if defined(Q_OS_LINUX) && __GLIBC__ - 0 >= 2 && __GLIBC_MINOR__ - 0 >= 1 && !defined(QT_LINUXBASE)
314# include <netpacket/packet.h>
315
316static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList)
317{
319 QList<QNetworkInterfacePrivate *> interfaces;
320 QDuplicateTracker<QString> seenInterfaces;
321 QDuplicateTracker<int> seenIndexes;
322
323 // On Linux, glibc, uClibc and MUSL obtain the address listing via two
324 // netlink calls: first an RTM_GETLINK to obtain the interface listing,
325 // then one RTM_GETADDR to get all the addresses (uClibc implementation is
326 // copied from glibc; Bionic currently doesn't support getifaddrs). They
327 // synthesize AF_PACKET addresses from the RTM_GETLINK responses, which
328 // means by construction they currently show up first in the interface
329 // listing.
330 for (ifaddrs *ptr = rawList; ptr; ptr = ptr->ifa_next) {
331 if (ptr->ifa_addr && ptr->ifa_addr->sa_family == AF_PACKET) {
332 sockaddr_ll *sll = (sockaddr_ll *)ptr->ifa_addr;
334 interfaces << iface;
335 iface->index = sll->sll_ifindex;
336 iface->name = QString::fromLatin1(ptr->ifa_name);
337 iface->flags = convertFlags(ptr->ifa_flags);
338 iface->hardwareAddress = iface->makeHwAddress(sll->sll_halen, (uchar*)sll->sll_addr);
339
340 const bool sawIfaceIndex = seenIndexes.hasSeen(iface->index);
341 Q_ASSERT(!sawIfaceIndex);
342 (void)seenInterfaces.hasSeen(iface->name);
343 }
344 }
345
346 // see if we missed anything:
347 // - virtual interfaces with no HW address have no AF_PACKET
348 // - interface labels have no AF_PACKET, but shouldn't be shown as a new interface
349 for (ifaddrs *ptr = rawList; ptr; ptr = ptr->ifa_next) {
350 if (!ptr->ifa_addr || ptr->ifa_addr->sa_family != AF_PACKET) {
351 QString name = QString::fromLatin1(ptr->ifa_name);
352 if (seenInterfaces.hasSeen(name))
353 continue;
354
355 int ifindex = if_nametoindex(ptr->ifa_name);
356 if (seenIndexes.hasSeen(ifindex))
357 continue;
358
360 interfaces << iface;
361 iface->name = name;
362 iface->flags = convertFlags(ptr->ifa_flags);
363 iface->index = ifindex;
364 }
365 }
366
367 return interfaces;
368}
369
370static void getAddressExtraInfo(QNetworkAddressEntry *entry, struct sockaddr *sa, const char *ifname)
371{
373 Q_UNUSED(sa);
374 Q_UNUSED(ifname);
375}
376
377# elif defined(Q_OS_BSD4)
379# include <net/if_dl.h>
380#if defined(QT_PLATFORM_UIKIT)
382# include <net/if_types.h>
383#else
384# include <net/if_media.h>
385# include <net/if_types.h>
386# include <netinet/in_var.h>
387#endif // QT_PLATFORM_UIKIT
389
390static int openSocket(int &socket)
391{
392 if (socket == -1)
393 socket = qt_safe_socket(AF_INET, SOCK_DGRAM, 0);
394 return socket;
395}
396
397static QNetworkInterface::InterfaceType probeIfType(int socket, int iftype, struct ifmediareq *req)
398{
399 // Determine the interface type.
400
401 // On Darwin, these are #defines, but on FreeBSD they're just an
402 // enum, so we can't #ifdef them. Use the authoritative list from
403 // https://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#smi-numbers-5
404 switch (iftype) {
405 case IFT_PPP:
407
408 case IFT_LOOP:
410
411 case IFT_SLIP:
413
414 case 0x47: // IFT_IEEE80211
416
417 case IFT_IEEE1394:
419
420 case IFT_GIF:
421 case IFT_STF:
423 }
424
425 // For the remainder (including Ethernet), let's try SIOGIFMEDIA
426 req->ifm_count = 0;
427 if (qt_safe_ioctl(socket, SIOCGIFMEDIA, req) == 0) {
428 // see https://man.openbsd.org/ifmedia.4
429
430 switch (IFM_TYPE(req->ifm_current)) {
431 case IFM_ETHER:
433
434#ifdef IFM_FDDI
435 case IFM_FDDI:
437#endif
438
439 case IFM_IEEE80211:
441 }
442 }
443
445}
446
447static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList)
448{
449 QList<QNetworkInterfacePrivate *> interfaces;
450 union {
451 struct ifmediareq mediareq;
452 struct ifreq req;
453 };
454 int socket = -1;
455 memset(&mediareq, 0, sizeof(mediareq));
456
457 // ensure both structs start with the name field, of size IFNAMESIZ
458 static_assert(sizeof(mediareq.ifm_name) == sizeof(req.ifr_name));
459 static_assert(offsetof(struct ifmediareq, ifm_name) == 0);
460 static_assert(offsetof(struct ifreq, ifr_name) == 0);
461
462 // on NetBSD we use AF_LINK and sockaddr_dl
463 // scan the list for that family
464 for (ifaddrs *ptr = rawList; ptr; ptr = ptr->ifa_next)
465 if (ptr->ifa_addr && ptr->ifa_addr->sa_family == AF_LINK) {
467 interfaces << iface;
468
469 sockaddr_dl *sdl = (sockaddr_dl *)ptr->ifa_addr;
470 iface->index = sdl->sdl_index;
471 iface->name = QString::fromLatin1(ptr->ifa_name);
472 iface->flags = convertFlags(ptr->ifa_flags);
473 iface->hardwareAddress = iface->makeHwAddress(sdl->sdl_alen, (uchar*)LLADDR(sdl));
474
475 qstrncpy(mediareq.ifm_name, ptr->ifa_name, sizeof(mediareq.ifm_name));
476 iface->type = probeIfType(openSocket(socket), sdl->sdl_type, &mediareq);
477 iface->mtu = getMtu(socket, &req);
478 }
479
480 if (socket != -1)
482 return interfaces;
483}
484
485static void getAddressExtraInfo(QNetworkAddressEntry *entry, struct sockaddr *sa, const char *ifname)
486{
487 // get IPv6 address lifetimes
488 if (sa->sa_family != AF_INET6)
489 return;
490
491 struct in6_ifreq ifr;
492
493 int s6 = qt_safe_socket(AF_INET6, SOCK_DGRAM, 0);
494 if (Q_UNLIKELY(s6 < 0)) {
495 qErrnoWarning("QNetworkInterface: could not create IPv6 socket");
496 return;
497 }
498
499 qstrncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
500
501 // get flags
502 ifr.ifr_addr = *reinterpret_cast<struct sockaddr_in6 *>(sa);
503 if (qt_safe_ioctl(s6, SIOCGIFAFLAG_IN6, &ifr) < 0) {
505 return;
506 }
507 int flags = ifr.ifr_ifru.ifru_flags6;
511
512 // get lifetimes
513 ifr.ifr_addr = *reinterpret_cast<struct sockaddr_in6 *>(sa);
514 if (qt_safe_ioctl(s6, SIOCGIFALIFETIME_IN6, &ifr) < 0) {
516 return;
517 }
519
520 auto toDeadline = [](time_t when) {
522 if (when) {
523#if defined(QT_NO_CLOCK_MONOTONIC)
524 // no monotonic clock
526#else
528#endif
529 }
530 return deadline;
531 };
532 entry->setAddressLifetime(toDeadline(ifr.ifr_ifru.ifru_lifetime.ia6t_preferred),
533 toDeadline(ifr.ifr_ifru.ifru_lifetime.ia6t_expire));
534}
535
536# else // Generic version
537
538static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList)
539{
541 QList<QNetworkInterfacePrivate *> interfaces;
542
543 // make sure there's one entry for each interface
544 for (ifaddrs *ptr = rawList; ptr; ptr = ptr->ifa_next) {
545 // Get the interface index
546 int ifindex = if_nametoindex(ptr->ifa_name);
547
548 QList<QNetworkInterfacePrivate *>::Iterator if_it = interfaces.begin();
549 for ( ; if_it != interfaces.end(); ++if_it)
550 if ((*if_it)->index == ifindex)
551 // this one has been added already
552 break;
553
554 if (if_it == interfaces.end()) {
555 // none found, create
557 interfaces << iface;
558
559 iface->index = ifindex;
560 iface->name = QString::fromLatin1(ptr->ifa_name);
561 iface->flags = convertFlags(ptr->ifa_flags);
562 }
563 }
564
565 return interfaces;
566}
567
568static void getAddressExtraInfo(QNetworkAddressEntry *entry, struct sockaddr *sa, const char *ifname)
569{
571 Q_UNUSED(sa);
572 Q_UNUSED(ifname);
573}
574# endif
575
576static QList<QNetworkInterfacePrivate *> interfaceListing()
577{
578 QList<QNetworkInterfacePrivate *> interfaces;
579
580 ifaddrs *interfaceListing;
581 if (getifaddrs(&interfaceListing) == -1) {
582 // error
583 return interfaces;
584 }
585
586 interfaces = createInterfaces(interfaceListing);
587 for (ifaddrs *ptr = interfaceListing; ptr; ptr = ptr->ifa_next) {
588 // Find the interface
589 QLatin1StringView name(ptr->ifa_name);
591 QList<QNetworkInterfacePrivate *>::Iterator if_it = interfaces.begin();
592 for ( ; if_it != interfaces.end(); ++if_it)
593 if ((*if_it)->name == name) {
594 // found this interface already
595 iface = *if_it;
596 break;
597 }
598
599 if (!iface) {
600 // it may be an interface label, search by interface index
601 int ifindex = if_nametoindex(ptr->ifa_name);
602 for (if_it = interfaces.begin(); if_it != interfaces.end(); ++if_it)
603 if ((*if_it)->index == ifindex) {
604 // found this interface already
605 iface = *if_it;
606 break;
607 }
608 }
609
610 if (!iface) {
611 // skip all non-IP interfaces
612 continue;
613 }
614
616 entry.setIp(addressFromSockaddr(ptr->ifa_addr, iface->index, iface->name));
617 if (entry.ip().isNull())
618 // could not parse the address
619 continue;
620
621 entry.setNetmask(addressFromSockaddr(ptr->ifa_netmask, iface->index, iface->name));
623 entry.setBroadcast(addressFromSockaddr(ptr->ifa_broadaddr, iface->index, iface->name));
624 getAddressExtraInfo(&entry, ptr->ifa_addr, name.latin1());
625
626 iface->addressEntries << entry;
627 }
628
629 freeifaddrs(interfaceListing);
630 return interfaces;
631}
632#endif
633
634QList<QNetworkInterfacePrivate *> QNetworkInterfaceManager::scan()
635{
636 return interfaceListing();
637}
638
640
641#endif // QT_NO_NETWORKINTERFACE
\inmodule QtCore
Definition qbytearray.h:57
static qint64 currentSecsSinceEpoch() noexcept
\inmodule QtCore
void setPreciseRemainingTime(qint64 secs, qint64 nsecs=0, Qt::TimerType type=Qt::CoarseTimer) noexcept
Sets the remaining time for this QDeadlineTimer object to secs seconds plus nsecs nanoseconds from no...
static constexpr ForeverConstant Forever
void setPreciseDeadline(qint64 secs, qint64 nsecs=0, Qt::TimerType type=Qt::CoarseTimer) noexcept
Sets the deadline for this QDeadlineTimer object to be secs seconds and nsecs nanoseconds since the r...
The QHostAddress class provides an IP address.
void setAddress(quint32 ip4Addr)
Set the IPv4 address specified by ip4Addr.
The QNetworkAddressEntry class stores one IP address supported by a network interface,...
void setIp(const QHostAddress &newIp)
Sets the IP address the QNetworkAddressEntry object contains to newIp.
static uint interfaceIndexFromName(const QString &name)
static QString interfaceNameFromIndex(uint index)
static void calculateDnsEligibility(QNetworkAddressEntry *entry, bool isTemporary, bool isDeprecated)
InterfaceType
Specifies the type of hardware (PHY layer, OSI level 1) this interface is, if it could be determined.
const_iterator constBegin() const noexcept
Definition qset.h:139
const_iterator constEnd() const noexcept
Definition qset.h:143
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5871
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:8084
QSet< QString >::iterator it
void qErrnoWarning(const char *msg,...)
Combined button and popup list for selecting options.
constexpr QBindableInterface iface
Definition qproperty.h:666
Q_CORE_EXPORT char * qstrncpy(char *dst, const char *src, size_t len)
#define Q_UNLIKELY(x)
static int qt_safe_close(int fd)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
#define forever
Definition qforeach.h:78
static ControlElement< T > * ptr(QWidget *widget)
constexpr const T & qMin(const T &a, const T &b)
Definition qminmax.h:40
#define AF_INET6
static int qt_safe_ioctl(int sockfd, unsigned long request, T arg)
static int qt_safe_socket(int domain, int type, int protocol, int flags=0)
Definition qnet_unix_p.h:45
static QNetworkInterface::InterfaceType probeIfType(int socket, struct ifreq *req, short arptype)
#define IN6_IFF_DEPRECATED
#define IFM_FDDI
#define SIOCGIFAFLAG_IN6
#define IN6_IFF_TEMPORARY
#define SIOCGIFALIFETIME_IN6
#define IFM_TYPE(x)
#define IFM_ETHER
#define IFM_IEEE80211
static QList< QNetworkInterfacePrivate * > interfaceListing()
static QNetworkInterfacePrivate * findInterface(int socket, QList< QNetworkInterfacePrivate * > &interfaces, struct ifreq &req)
static QT_BEGIN_NAMESPACE QHostAddress addressFromSockaddr(sockaddr *sa, int ifindex=0, const QString &ifname=QString())
static int getMtu(int socket, struct ifreq *req)
static QSet< QByteArray > interfaceNames(int socket)
static auto & ifreq_index(Req &req, std::enable_if_t< sizeof(std::declval< Req >().ifr_index) !=0, int >=0)
static QT_BEGIN_NAMESPACE QNetworkInterface::InterfaceFlags convertFlags(uint rawFlags)
GLuint index
[2]
GLenum GLuint id
[7]
GLenum GLuint GLenum GLsizei const GLchar * buf
GLbitfield flags
GLuint name
GLuint GLuint * names
GLuint entry
GLenum const void * addr
GLuint GLuint64EXT address
GLuint64EXT * result
[6]
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define s6
#define QT_BEGIN_INCLUDE_NAMESPACE
#define QT_END_INCLUDE_NAMESPACE
#define Q_UNUSED(x)
unsigned char uchar
Definition qtypes.h:32
unsigned int uint
Definition qtypes.h:34
QDeadlineTimer deadline(30s)
QTcpSocket * socket
[1]