10#include "private/qtools_p.h"
12#ifndef QT_NO_NETWORKINTERFACE
65 for (
const auto &
interface : interfaceList) {
78 for (
const auto &
interface : interfaceList) {
95 for (
auto &
addr :
ptr->addressEntries)
99 result << QSharedDataPointer<QNetworkInterfacePrivate>(
ptr);
107 const int outLen =
qMax(
len * 2 + (
len - 1) * 1, 0);
110 for (
int i = 0;
i <
len; ++
i) {
186 *d.get() = *
other.d.get();
211 if (d ==
other.d)
return true;
212 if (!d || !
other.d)
return false;
213 return d->address ==
other.d->address &&
214 d->netmask ==
other.d->netmask &&
215 d->broadcast ==
other.d->broadcast;
236 return d->dnsEligibility;
248 d->dnsEligibility = status;
291 return d->netmask.address(d->address.protocol());
303 if (newNetmask.
protocol() !=
ip().protocol()) {
308 d->netmask.setAddress(newNetmask);
326 return d->netmask.prefixLength();
343 d->netmask.setPrefixLength(d->address.protocol(),
length);
370 d->broadcast = newBroadcast;
384 return d->lifetimeKnown;
403 return d->preferredLifetime;
423 return d->validityLifetime;
438 d->preferredLifetime = preferred;
439 d->validityLifetime = validity;
440 d->lifetimeKnown =
true;
455 d->lifetimeKnown =
false;
476 return d->validityLifetime.isForever();
660 return d ? d->
index : 0;
683 return d ? d->
mtu : 0;
721 return d ? d->
flags : InterfaceFlags{};
851 for (
const auto &
p : privs) {
871 for (
const auto &
p : privs) {
883#ifndef QT_NO_DEBUG_STREAM
889 debug <<
"IsRunning ";
891 debug <<
"CanBroadcast ";
893 debug <<
"IsLoopBack ";
895 debug <<
"IsPointToPoint ";
897 debug <<
"CanMulticast ";
912 debug.resetFormat().nospace();
914 if (!
entry.netmask().isNull())
916 if (!
entry.broadcast().isNull())
917 debug <<
", broadcast = " <<
entry.broadcast();
930 debug.resetFormat().nospace();
931 debug <<
"QNetworkInterface(name = " << networkInterface.
name()
943#include "moc_qnetworkinterface.cpp"
static constexpr auto IPv4Protocol
static constexpr ForeverConstant Forever
The QHostAddress class provides an IP address.
quint32 toIPv4Address(bool *ok=nullptr) const
Returns the IPv4 address as a number.
NetworkLayerProtocol protocol() const
Returns the network layer protocol of the host address.
qsizetype size() const noexcept
The QNetworkAddressEntry class stores one IP address supported by a network interface,...
void setAddressLifetime(QDeadlineTimer preferred, QDeadlineTimer validity)
bool isLifetimeKnown() const
QDeadlineTimer validityLifetime() const
void setPrefixLength(int length)
QHostAddress broadcast() const
Returns the broadcast address associated with the IPv4 address and netmask.
QHostAddress netmask() const
Returns the netmask associated with the IP address.
QDeadlineTimer preferredLifetime() const
QDebug operator<<(QDebug debug, const QNetworkAddressEntry &entry)
~QNetworkAddressEntry()
Destroys this QNetworkAddressEntry object.
void setNetmask(const QHostAddress &newNetmask)
Sets the netmask that this QNetworkAddressEntry object contains to newNetmask.
void clearAddressLifetime()
bool operator==(const QNetworkAddressEntry &other) const
Returns true if this network address entry is the same as other.
QHostAddress ip() const
This function returns one IPv4 or IPv6 address found, that was found in a network interface.
void setIp(const QHostAddress &newIp)
Sets the IP address the QNetworkAddressEntry object contains to newIp.
void setBroadcast(const QHostAddress &newBroadcast)
Sets the broadcast IP address of this QNetworkAddressEntry object to newBroadcast.
void setDnsEligibility(DnsEligibilityStatus status)
DnsEligibilityStatus dnsEligibility() const
QNetworkAddressEntry()
Constructs an empty QNetworkAddressEntry object.
QNetworkAddressEntry & operator=(QNetworkAddressEntry &&other) noexcept
~QNetworkInterfaceManager()
QSharedDataPointer< QNetworkInterfacePrivate > interfaceFromName(const QString &name)
static uint interfaceIndexFromName(const QString &name)
QList< QSharedDataPointer< QNetworkInterfacePrivate > > allInterfaces()
QSharedDataPointer< QNetworkInterfacePrivate > empty
static QString interfaceNameFromIndex(uint index)
QSharedDataPointer< QNetworkInterfacePrivate > interfaceFromIndex(int index)
static QString makeHwAddress(int len, uchar *data)
QNetworkInterface::InterfaceFlags flags
QNetworkInterface::InterfaceType type
QList< QNetworkAddressEntry > addressEntries
The QNetworkInterface class provides a listing of the host's IP addresses and network interfaces.
~QNetworkInterface()
Frees the resources associated with the QNetworkInterface object.
static QNetworkInterface interfaceFromIndex(int index)
Returns a QNetworkInterface object for the interface whose internal ID is index.
QNetworkInterface()
Constructs an empty network interface object.
QDebug operator<<(QDebug debug, const QNetworkInterface &networkInterface)
Writes the QNetworkInterface networkInterface to the stream and returns a reference to the debug stre...
QNetworkInterface & operator=(QNetworkInterface &&other) noexcept
static QList< QHostAddress > allAddresses()
This convenience function returns all IP addresses found on the host machine.
int maximumTransmissionUnit() const
QString name() const
Returns the name of this network interface.
static int interfaceIndexFromName(const QString &name)
InterfaceFlags flags() const
Returns the flags associated with this network interface.
InterfaceType type() const
InterfaceType
Specifies the type of hardware (PHY layer, OSI level 1) this interface is, if it could be determined.
static QString interfaceNameFromIndex(int index)
QString hardwareAddress() const
Returns the low-level hardware address for this interface.
static QNetworkInterface interfaceFromName(const QString &name)
Returns a QNetworkInterface object for the interface named name.
QList< QNetworkAddressEntry > addressEntries() const
Returns the list of IP addresses that this interface possesses along with their associated netmasks a...
static QList< QNetworkInterface > allInterfaces()
Returns a listing of all the network interfaces found on the host machine.
bool isValid() const
Returns true if this QNetworkInterface object contains valid information about a network interface.
QString humanReadableName() const
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Combined button and popup list for selecting options.
constexpr char toHexUpper(char32_t value) noexcept
constexpr Initialization Uninitialized
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 * interface
static QDBusError::ErrorType get(const char *name)
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
static ControlElement< T > * ptr(QWidget *widget)
constexpr const T & qMax(const T &a, const T &b)
static QDebug flagsDebug(QDebug debug, QNetworkInterface::InterfaceFlags flags)
static QList< QNetworkInterfacePrivate * > postProcess(QList< QNetworkInterfacePrivate * > list)
GLenum GLuint GLenum GLsizei length
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLuint GLuint64EXT address
#define QT_VERSION_CHECK(major, minor, patch)
QTextStream out(stdout)
[7]
QNetworkAccessManager manager
\inmodule QtCore \reentrant