48 #ifndef QT_NO_NETWORKINTERFACE 64 for ( ; it !=
end; ++
it) {
67 for ( ; addr_it != addr_end; ++addr_it) {
71 if (!addr_it->netmask().isNull() && addr_it->broadcast().isNull()) {
74 addr_it->setBroadcast(bcast);
97 if ((*it)->name == name)
108 if ((*it)->index == index)
120 result << QSharedDataPointer<QNetworkInterfacePrivate>(
ptr);
128 for (
int i = 0; i < len; ++i) {
133 #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && defined(_MSC_VER) && _MSC_VER >= 1400 134 sprintf_s(buf, 3,
"%02hX",
ushort(data[i]));
136 sprintf(buf,
"%02hX",
ushort(data[i]));
202 if (
d == other.
d)
return true;
203 if (!
d || !other.
d)
return false;
499 return d ?
d->
flags : InterfaceFlags(0);
539 result.
d = manager()->interfaceFromName(name);
556 result.
d = manager()->interfaceFromIndex(index);
589 result += entry.
ip();
595 #ifndef QT_NO_DEBUG_STREAM 601 debug.
nospace() <<
"IsRunning ";
603 debug.
nospace() <<
"CanBroadcast ";
605 debug.
nospace() <<
"IsLoopBack ";
607 debug.
nospace() <<
"IsPointToPoint ";
609 debug.
nospace() <<
"CanMulticast ";
615 debug.
nospace() <<
"(address = " << entry.
ip();
621 return debug.
space();
626 debug.
nospace() <<
"QNetworkInterface(name = " << networkInterface.
name()
630 #if defined(Q_CC_RVCT) 637 return debug.
space();
643 #endif // QT_NO_NETWORKINTERFACE
static QDebug operator<<(QDebug debug, const QNetworkAddressEntry &entry)
The QDebug class provides an output stream for debugging information.
QSharedDataPointer< QNetworkInterfacePrivate > interfaceFromName(const QString &name)
static QNetworkInterface interfaceFromName(const QString &name)
Returns a QNetworkInterface object for the interface named name.
QNetworkInterface & operator=(const QNetworkInterface &other)
Copies the contents of the QNetworkInterface object contained in other into this one.
bool isNull() const
Returns true if this host address is null (INADDR_ANY or in6addr_any).
#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...
QString name() const
Returns the name of this network interface.
T * data() const
Returns the value of the pointer referenced by this object.
#define it(className, varName)
QDebug & nospace()
Clears the stream's internal flag that records whether the last character was a space and returns a r...
QNetworkAddressEntry & operator=(const QNetworkAddressEntry &other)
Makes a copy of the QNetworkAddressEntry object other.
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
void setPrefixLength(int length)
Sets the prefix length of this IP address to length.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
quint32 toIPv4Address() const
Returns the IPv4 address as a number.
The QString class provides a Unicode character string.
QHostAddress broadcast() const
Returns the broadcast address associated with the IPv4 address and netmask.
~QNetworkAddressEntry()
Destroys this QNetworkAddressEntry object.
QScopedPointer< QNetworkAddressEntryPrivate > d
QNetworkAddressEntry()
Constructs an empty QNetworkAddressEntry object.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QNetworkInterface()
Constructs an empty network interface object.
~QNetworkInterfaceManager()
static QString makeHwAddress(int len, uchar *data)
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
QList< QNetworkInterfacePrivate * > scan()
#define Q_GLOBAL_STATIC(TYPE, NAME)
Declares a global static variable with the given type and name.
bool isValid() const
Returns true if this QNetworkInterface object contains valid information about a network interface...
QSharedDataPointer< QNetworkInterfacePrivate > empty
static const char * data(const QByteArray &arr)
const T * ptr(const T &t)
The QList::iterator class provides an STL-style non-const iterator for QList and QQueue.
static QNetworkInterface interfaceFromIndex(int index)
Returns a QNetworkInterface object for the interface whose internal ID is index.
static QList< QNetworkInterfacePrivate * > postProcess(QList< QNetworkInterfacePrivate *> list)
~QNetworkInterface()
Frees the resources associated with the QNetworkInterface object.
QAbstractSocket::NetworkLayerProtocol protocol() const
Returns the network layer protocol of the host address.
void setIp(const QHostAddress &newIp)
Sets the IP address the QNetworkAddressEntry object contains to newIp.
bool operator==(const QNetworkAddressEntry &other) const
Returns true if this network address entry is the same as other.
static QList< QNetworkInterface > allInterfaces()
Returns a listing of all the network interfaces found on the host machine.
QList< QNetworkAddressEntry > addressEntries
QString humanReadableName() const
Returns the human-readable name of this network interface on Windows, such as "Local Area Connection"...
int index() const
Returns the interface system index, if known.
static QList< QHostAddress > allAddresses()
This convenience function returns all IP addresses found on the host machine.
InterfaceFlags flags() const
Returns the flags associated with this network interface.
QSharedDataPointer< QNetworkInterfacePrivate > d
void setNetmask(const QHostAddress &newNetmask)
Sets the netmask that this QNetworkAddressEntry object contains to newNetmask.
The QNetworkInterface class provides a listing of the host's IP addresses and network interfaces...
QSharedDataPointer< QNetworkInterfacePrivate > interfaceFromIndex(int index)
The QHostAddress class provides an IP address.
QList< QSharedDataPointer< QNetworkInterfacePrivate > > allInterfaces()
void setPrefixLength(QAbstractSocket::NetworkLayerProtocol proto, int len)
static const KeyPair *const end
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
QHostAddress netmask() const
Returns the netmask associated with the IP address.
QList< QNetworkAddressEntry > addressEntries() const
Returns the list of IP addresses that this interface possesses along with their associated netmasks a...
static QDebug flagsDebug(QDebug debug, QNetworkInterface::InterfaceFlags flags)
QNetworkInterface::InterfaceFlags flags
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
The QNetworkAddressEntry class stores one IP address supported by a network interface, along with its associated netmask and broadcast address.
QString hardwareAddress() const
Returns the low-level hardware address for this interface.
bool setAddress(const QString &address)
int prefixLength() const
Returns the prefix length of this IP address.
The QList class is a template class that provides lists.
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
void setBroadcast(const QHostAddress &newBroadcast)
Sets the broadcast IP address of this QNetworkAddressEntry object to newBroadcast.