Qt 6.x
The Qt SDK
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 defined(QT_LINUXBASE)
21# define QT_NO_GETIFADDRS
22#endif
23
24#ifndef QT_NO_GETIFADDRS
25# include <ifaddrs.h>
26#endif
27
28#ifdef QT_LINUXBASE
29# include <arpa/inet.h>
30# ifndef SIOCGIFBRDADDR
31# define SIOCGIFBRDADDR 0x8919
32# endif
33#endif // QT_LINUXBASE
34
35#include <qplatformdefs.h>
36
38
39static QHostAddress addressFromSockaddr(sockaddr *sa, int ifindex = 0, const QString &ifname = QString())
40{
42 if (!sa)
43 return address;
44
45 if (sa->sa_family == AF_INET)
46 address.setAddress(htonl(((sockaddr_in *)sa)->sin_addr.s_addr));
47 else if (sa->sa_family == AF_INET6) {
48 address.setAddress(((sockaddr_in6 *)sa)->sin6_addr.s6_addr);
49 int scope = ((sockaddr_in6 *)sa)->sin6_scope_id;
50 if (scope && scope == ifindex) {
51 // this is the most likely scenario:
52 // a scope ID in a socket is that of the interface this address came from
53 address.setScopeId(ifname);
54 } else if (scope) {
56 }
57 }
58 return address;
59
60}
61
63{
64#ifndef QT_NO_IPV6IFNAME
65 return ::if_nametoindex(name.toLatin1());
66#elif defined(SIOCGIFINDEX)
67 struct ifreq req;
68 int socket = qt_safe_socket(AF_INET, SOCK_STREAM, 0);
69 if (socket < 0)
70 return 0;
71
72 QByteArray name8bit = name.toLatin1();
73 memset(&req, 0, sizeof(ifreq));
74 memcpy(req.ifr_name, name8bit, qMin<int>(name8bit.length() + 1, sizeof(req.ifr_name) - 1));
75
76 uint id = 0;
77 if (qt_safe_ioctl(socket, SIOCGIFINDEX, &req) >= 0)
78# if QT_CONFIG(ifr_index)
79 id = req.ifr_index;
80# else
81 id = req.ifr_ifindex;
82# endif
84 return id;
85#else
87 return 0;
88#endif
89}
90
92{
93#ifndef QT_NO_IPV6IFNAME
94 char buf[IF_NAMESIZE];
95 if (::if_indextoname(index, buf))
97#elif defined(SIOCGIFNAME)
98 struct ifreq req;
99 int socket = qt_safe_socket(AF_INET, SOCK_STREAM, 0);
100 if (socket >= 0) {
101 memset(&req, 0, sizeof(ifreq));
102# if QT_CONFIG(ifr_index)
103 req.ifr_index = index;
104# else
105 req.ifr_ifindex = index;
106# endif
107
108 if (qt_safe_ioctl(socket, SIOCGIFNAME, &req) >= 0) {
110 return QString::fromLatin1(req.ifr_name);
111 }
113 }
114#endif
115 return QString::number(uint(index));
116}
117
118static int getMtu(int socket, struct ifreq *req)
119{
120#ifdef SIOCGIFMTU
121 if (qt_safe_ioctl(socket, SIOCGIFMTU, req) == 0)
122 return req->ifr_mtu;
123#endif
124 return 0;
125}
126
127#ifdef QT_NO_GETIFADDRS
128// getifaddrs not available
129
130static QSet<QByteArray> interfaceNames(int socket)
131{
133#ifdef QT_NO_IPV6IFNAME
134 QByteArray storageBuffer;
135 struct ifconf interfaceList;
136 static const int STORAGEBUFFER_GROWTH = 256;
137
138 forever {
139 // grow the storage buffer
140 storageBuffer.resize(storageBuffer.size() + STORAGEBUFFER_GROWTH);
141 interfaceList.ifc_buf = storageBuffer.data();
142 interfaceList.ifc_len = storageBuffer.size();
143
144 // get the interface list
145 if (qt_safe_ioctl(socket, SIOCGIFCONF, &interfaceList) >= 0) {
146 if (int(interfaceList.ifc_len + sizeof(ifreq) + 64) < storageBuffer.size()) {
147 // if the buffer was big enough, break
148 storageBuffer.resize(interfaceList.ifc_len);
149 break;
150 }
151 } else {
152 // internal error
153 return result;
154 }
155 if (storageBuffer.size() > 100000) {
156 // out of space
157 return result;
158 }
159 }
160
161 int interfaceCount = interfaceList.ifc_len / sizeof(ifreq);
162 for (int i = 0; i < interfaceCount; ++i) {
163 QByteArray name = QByteArray(interfaceList.ifc_req[i].ifr_name);
164 if (!name.isEmpty())
165 result << name;
166 }
167
168 return result;
169#else
171
172 // use if_nameindex
173 struct if_nameindex *interfaceList = ::if_nameindex();
174 for (struct if_nameindex *ptr = interfaceList; ptr && ptr->if_name; ++ptr)
175 result << ptr->if_name;
176
177 if_freenameindex(interfaceList);
178 return result;
179#endif
180}
181
182static QNetworkInterfacePrivate *findInterface(int socket, QList<QNetworkInterfacePrivate *> &interfaces,
183 struct ifreq &req)
184{
186 int ifindex = 0;
187
188#if !defined(QT_NO_IPV6IFNAME) || defined(SIOCGIFINDEX)
189 // Get the interface index
190# ifdef SIOCGIFINDEX
191 if (qt_safe_ioctl(socket, SIOCGIFINDEX, &req) >= 0)
192# if QT_CONFIG(ifr_index)
193 ifindex = req.ifr_index;
194# else
195 ifindex = req.ifr_ifindex;
196# endif
197# else
198 ifindex = if_nametoindex(req.ifr_name);
199# endif
200
201 // find the interface data
203 for ( ; if_it != interfaces.end(); ++if_it)
204 if ((*if_it)->index == ifindex) {
205 // existing interface
206 iface = *if_it;
207 break;
208 }
209#else
211 // Search by name
213 for ( ; if_it != interfaces.end(); ++if_it)
214 if ((*if_it)->name == QLatin1StringView(req.ifr_name)) {
215 // existing interface
216 iface = *if_it;
217 break;
218 }
219#endif
220
221 if (!iface) {
222 // new interface, create data:
224 iface->index = ifindex;
225 interfaces << iface;
226 }
227
228 return iface;
229}
230
232{
234
235 int socket;
236 if ((socket = qt_safe_socket(AF_INET, SOCK_STREAM, IPPROTO_IP)) == -1)
237 return interfaces; // error
238
239 QSet<QByteArray> names = interfaceNames(socket);
241 for ( ; it != names.constEnd(); ++it) {
242 ifreq req;
243 memset(&req, 0, sizeof(ifreq));
244 memcpy(req.ifr_name, *it, qMin<int>(it->length() + 1, sizeof(req.ifr_name) - 1));
245
246 QNetworkInterfacePrivate *iface = findInterface(socket, interfaces, req);
247
248#ifdef SIOCGIFNAME
249 // Get the canonical name
250 QByteArray oldName = req.ifr_name;
251 if (qt_safe_ioctl(socket, SIOCGIFNAME, &req) >= 0) {
252 iface->name = QString::fromLatin1(req.ifr_name);
253
254 // reset the name:
255 memcpy(req.ifr_name, oldName, qMin<int>(oldName.length() + 1, sizeof(req.ifr_name) - 1));
256 } else
257#endif
258 {
259 // use this name anyways
260 iface->name = QString::fromLatin1(req.ifr_name);
261 }
262
263 // Get interface flags
264 if (qt_safe_ioctl(socket, SIOCGIFFLAGS, &req) >= 0) {
265 iface->flags = convertFlags(req.ifr_flags);
266 }
267 iface->mtu = getMtu(socket, &req);
268
269#ifdef SIOCGIFHWADDR
270 // Get the HW address
271 if (qt_safe_ioctl(socket, SIOCGIFHWADDR, &req) >= 0) {
272 uchar *addr = (uchar *)req.ifr_addr.sa_data;
273 iface->hardwareAddress = iface->makeHwAddress(6, addr);
274 }
275#endif
276
277 // Get the address of the interface
279 if (qt_safe_ioctl(socket, SIOCGIFADDR, &req) >= 0) {
280 sockaddr *sa = &req.ifr_addr;
281 entry.setIp(addressFromSockaddr(sa));
282
283 // Get the interface broadcast address
285 if (qt_safe_ioctl(socket, SIOCGIFBRDADDR, &req) >= 0) {
286 sockaddr *sa = &req.ifr_addr;
287 if (sa->sa_family == AF_INET)
288 entry.setBroadcast(addressFromSockaddr(sa));
289 }
290 }
291
292 // Get the interface netmask
293 if (qt_safe_ioctl(socket, SIOCGIFNETMASK, &req) >= 0) {
294 sockaddr *sa = &req.ifr_addr;
295 entry.setNetmask(addressFromSockaddr(sa));
296 }
297
298 iface->addressEntries << entry;
299 }
300 }
301
302 ::close(socket);
303 return interfaces;
304}
305
306#else
307// use getifaddrs
308
309// platform-specific defs:
310# ifdef Q_OS_LINUX
312# include <features.h>
314# endif
315
316# if defined(Q_OS_LINUX) && __GLIBC__ - 0 >= 2 && __GLIBC_MINOR__ - 0 >= 1 && !defined(QT_LINUXBASE)
317# include <netpacket/packet.h>
318
320{
323 QDuplicateTracker<QString> seenInterfaces;
324 QDuplicateTracker<int> seenIndexes;
325
326 // On Linux, glibc, uClibc and MUSL obtain the address listing via two
327 // netlink calls: first an RTM_GETLINK to obtain the interface listing,
328 // then one RTM_GETADDR to get all the addresses (uClibc implementation is
329 // copied from glibc; Bionic currently doesn't support getifaddrs). They
330 // synthesize AF_PACKET addresses from the RTM_GETLINK responses, which
331 // means by construction they currently show up first in the interface
332 // listing.
333 for (ifaddrs *ptr = rawList; ptr; ptr = ptr->ifa_next) {
334 if (ptr->ifa_addr && ptr->ifa_addr->sa_family == AF_PACKET) {
335 sockaddr_ll *sll = (sockaddr_ll *)ptr->ifa_addr;
337 interfaces << iface;
338 iface->index = sll->sll_ifindex;
339 iface->name = QString::fromLatin1(ptr->ifa_name);
340 iface->flags = convertFlags(ptr->ifa_flags);
341 iface->hardwareAddress = iface->makeHwAddress(sll->sll_halen, (uchar*)sll->sll_addr);
342
343 const bool sawIfaceIndex = seenIndexes.hasSeen(iface->index);
344 Q_ASSERT(!sawIfaceIndex);
345 (void)seenInterfaces.hasSeen(iface->name);
346 }
347 }
348
349 // see if we missed anything:
350 // - virtual interfaces with no HW address have no AF_PACKET
351 // - interface labels have no AF_PACKET, but shouldn't be shown as a new interface
352 for (ifaddrs *ptr = rawList; ptr; ptr = ptr->ifa_next) {
353 if (!ptr->ifa_addr || ptr->ifa_addr->sa_family != AF_PACKET) {
354 QString name = QString::fromLatin1(ptr->ifa_name);
355 if (seenInterfaces.hasSeen(name))
356 continue;
357
358 int ifindex = if_nametoindex(ptr->ifa_name);
359 if (seenIndexes.hasSeen(ifindex))
360 continue;
361
363 interfaces << iface;
364 iface->name = name;
365 iface->flags = convertFlags(ptr->ifa_flags);
366 iface->index = ifindex;
367 }
368 }
369
370 return interfaces;
371}
372
373static void getAddressExtraInfo(QNetworkAddressEntry *entry, struct sockaddr *sa, const char *ifname)
374{
376 Q_UNUSED(sa);
377 Q_UNUSED(ifname);
378}
379
380# elif defined(Q_OS_BSD4)
382# include <net/if_dl.h>
383#if defined(QT_PLATFORM_UIKIT)
385# include <net/if_types.h>
386#else
387# include <net/if_media.h>
388# include <net/if_types.h>
389# include <netinet/in_var.h>
390#endif // QT_PLATFORM_UIKIT
392
393static int openSocket(int &socket)
394{
395 if (socket == -1)
396 socket = qt_safe_socket(AF_INET, SOCK_DGRAM, 0);
397 return socket;
398}
399
400static QNetworkInterface::InterfaceType probeIfType(int socket, int iftype, struct ifmediareq *req)
401{
402 // Determine the interface type.
403
404 // On Darwin, these are #defines, but on FreeBSD they're just an
405 // enum, so we can't #ifdef them. Use the authoritative list from
406 // https://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#smi-numbers-5
407 switch (iftype) {
408 case IFT_PPP:
410
411 case IFT_LOOP:
413
414 case IFT_SLIP:
416
417 case 0x47: // IFT_IEEE80211
419
420 case IFT_IEEE1394:
422
423 case IFT_GIF:
424 case IFT_STF:
426 }
427
428 // For the remainder (including Ethernet), let's try SIOGIFMEDIA
429 req->ifm_count = 0;
430 if (qt_safe_ioctl(socket, SIOCGIFMEDIA, req) == 0) {
431 // see https://man.openbsd.org/ifmedia.4
432
433 switch (IFM_TYPE(req->ifm_current)) {
434 case IFM_ETHER:
436
437#ifdef IFM_FDDI
438 case IFM_FDDI:
440#endif
441
442 case IFM_IEEE80211:
444 }
445 }
446
448}
449
451{
453 union {
454 struct ifmediareq mediareq;
455 struct ifreq req;
456 };
457 int socket = -1;
458 memset(&mediareq, 0, sizeof(mediareq));
459
460 // ensure both structs start with the name field, of size IFNAMESIZ
461 static_assert(sizeof(mediareq.ifm_name) == sizeof(req.ifr_name));
462 static_assert(offsetof(struct ifmediareq, ifm_name) == 0);
463 static_assert(offsetof(struct ifreq, ifr_name) == 0);
464
465 // on NetBSD we use AF_LINK and sockaddr_dl
466 // scan the list for that family
467 for (ifaddrs *ptr = rawList; ptr; ptr = ptr->ifa_next)
468 if (ptr->ifa_addr && ptr->ifa_addr->sa_family == AF_LINK) {
470 interfaces << iface;
471
472 sockaddr_dl *sdl = (sockaddr_dl *)ptr->ifa_addr;
473 iface->index = sdl->sdl_index;
474 iface->name = QString::fromLatin1(ptr->ifa_name);
475 iface->flags = convertFlags(ptr->ifa_flags);
476 iface->hardwareAddress = iface->makeHwAddress(sdl->sdl_alen, (uchar*)LLADDR(sdl));
477
478 qstrncpy(mediareq.ifm_name, ptr->ifa_name, sizeof(mediareq.ifm_name));
479 iface->type = probeIfType(openSocket(socket), sdl->sdl_type, &mediareq);
480 iface->mtu = getMtu(socket, &req);
481 }
482
483 if (socket != -1)
485 return interfaces;
486}
487
488static void getAddressExtraInfo(QNetworkAddressEntry *entry, struct sockaddr *sa, const char *ifname)
489{
490 // get IPv6 address lifetimes
491 if (sa->sa_family != AF_INET6)
492 return;
493
494 struct in6_ifreq ifr;
495
496 int s6 = qt_safe_socket(AF_INET6, SOCK_DGRAM, 0);
497 if (Q_UNLIKELY(s6 < 0)) {
498 qErrnoWarning("QNetworkInterface: could not create IPv6 socket");
499 return;
500 }
501
502 qstrncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
503
504 // get flags
505 ifr.ifr_addr = *reinterpret_cast<struct sockaddr_in6 *>(sa);
506 if (qt_safe_ioctl(s6, SIOCGIFAFLAG_IN6, &ifr) < 0) {
508 return;
509 }
510 int flags = ifr.ifr_ifru.ifru_flags6;
514
515 // get lifetimes
516 ifr.ifr_addr = *reinterpret_cast<struct sockaddr_in6 *>(sa);
517 if (qt_safe_ioctl(s6, SIOCGIFALIFETIME_IN6, &ifr) < 0) {
519 return;
520 }
522
523 auto toDeadline = [](time_t when) {
525 if (when) {
526#if defined(QT_NO_CLOCK_MONOTONIC)
527 // no monotonic clock
529#else
531#endif
532 }
533 return deadline;
534 };
535 entry->setAddressLifetime(toDeadline(ifr.ifr_ifru.ifru_lifetime.ia6t_preferred),
536 toDeadline(ifr.ifr_ifru.ifru_lifetime.ia6t_expire));
537}
538
539# else // Generic version
540
542{
545
546 // make sure there's one entry for each interface
547 for (ifaddrs *ptr = rawList; ptr; ptr = ptr->ifa_next) {
548 // Get the interface index
549 int ifindex = if_nametoindex(ptr->ifa_name);
550
552 for ( ; if_it != interfaces.end(); ++if_it)
553 if ((*if_it)->index == ifindex)
554 // this one has been added already
555 break;
556
557 if (if_it == interfaces.end()) {
558 // none found, create
560 interfaces << iface;
561
562 iface->index = ifindex;
563 iface->name = QString::fromLatin1(ptr->ifa_name);
564 iface->flags = convertFlags(ptr->ifa_flags);
565 }
566 }
567
568 return interfaces;
569}
570
571static void getAddressExtraInfo(QNetworkAddressEntry *entry, struct sockaddr *sa, const char *ifname)
572{
574 Q_UNUSED(sa);
575 Q_UNUSED(ifname);
576}
577# endif
578
580{
582
583 ifaddrs *interfaceListing;
584 if (getifaddrs(&interfaceListing) == -1) {
585 // error
586 return interfaces;
587 }
588
590 for (ifaddrs *ptr = interfaceListing; ptr; ptr = ptr->ifa_next) {
591 // Find the interface
592 QLatin1StringView name(ptr->ifa_name);
593 QNetworkInterfacePrivate *iface = nullptr;
595 for ( ; if_it != interfaces.end(); ++if_it)
596 if ((*if_it)->name == name) {
597 // found this interface already
598 iface = *if_it;
599 break;
600 }
601
602 if (!iface) {
603 // it may be an interface label, search by interface index
604 int ifindex = if_nametoindex(ptr->ifa_name);
605 for (if_it = interfaces.begin(); if_it != interfaces.end(); ++if_it)
606 if ((*if_it)->index == ifindex) {
607 // found this interface already
608 iface = *if_it;
609 break;
610 }
611 }
612
613 if (!iface) {
614 // skip all non-IP interfaces
615 continue;
616 }
617
619 entry.setIp(addressFromSockaddr(ptr->ifa_addr, iface->index, iface->name));
620 if (entry.ip().isNull())
621 // could not parse the address
622 continue;
623
624 entry.setNetmask(addressFromSockaddr(ptr->ifa_netmask, iface->index, iface->name));
625 if (iface->flags & QNetworkInterface::CanBroadcast)
626 entry.setBroadcast(addressFromSockaddr(ptr->ifa_broadaddr, iface->index, iface->name));
627 getAddressExtraInfo(&entry, ptr->ifa_addr, name.latin1());
628
629 iface->addressEntries << entry;
630 }
631
632 freeifaddrs(interfaceListing);
633 return interfaces;
634}
635#endif
636
637QList<QNetworkInterfacePrivate *> QNetworkInterfaceManager::scan()
638{
639 return interfaceListing();
640}
641
643
644#endif // QT_NO_NETWORKINTERFACE
\inmodule QtCore
Definition qbytearray.h:57
char * data()
\macro QT_NO_CAST_FROM_BYTEARRAY
Definition qbytearray.h:534
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
Definition qbytearray.h:474
qsizetype length() const noexcept
Same as size().
Definition qbytearray.h:479
void resize(qsizetype size)
Sets the size of the byte array to size bytes.
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...
bool hasSeen(const T &s)
The QHostAddress class provides an IP address.
Definition qlist.h:74
iterator end()
Definition qlist.h:609
iterator begin()
Definition qlist.h:608
The QNetworkAddressEntry class stores one IP address supported by a network interface,...
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.
Definition qset.h:18
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:127
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5710
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:7822
QSet< QString >::iterator it
void qErrnoWarning(const char *msg,...)
Combined button and popup list for selecting options.
constexpr QBindableInterface iface
Definition qproperty.h:664
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
#define forever
Definition qforeach.h:78
static ControlElement< T > * ptr(QWidget *widget)
#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 void getAddressExtraInfo(QNetworkAddressEntry *entry, struct sockaddr *sa, const char *ifname)
static QList< QNetworkInterfacePrivate * > interfaceListing()
static QT_BEGIN_NAMESPACE QHostAddress addressFromSockaddr(sockaddr *sa, int ifindex=0, const QString &ifname=QString())
static int getMtu(int socket, struct ifreq *req)
static QList< QNetworkInterfacePrivate * > createInterfaces(ifaddrs *rawList)
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:27
unsigned int uint
Definition qtypes.h:29
QDeadlineTimer deadline(30s)
QTcpSocket * socket
[1]