Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qnetworkinterface_p.h
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
#
ifndef
QNETWORKINTERFACEPRIVATE_H
5
#
define
QNETWORKINTERFACEPRIVATE_H
6
7
//
8
// W A R N I N G
9
// -------------
10
//
11
// This file is not part of the Qt API. It exists purely as an
12
// implementation detail. This header file may change from version to
13
// version without notice, or even be removed.
14
//
15
// We mean it.
16
//
17
18
#
include
<
QtNetwork
/
private
/
qtnetworkglobal_p
.
h
>
19
#
include
<
QtNetwork
/
qnetworkinterface
.
h
>
20
#
include
<
QtCore
/
qatomic
.
h
>
21
#
include
<
QtCore
/
qdeadlinetimer
.
h
>
22
#
include
<
QtCore
/
qlist
.
h
>
23
#
include
<
QtCore
/
qstring
.
h
>
24
#
include
<
QtNetwork
/
qhostaddress
.
h
>
25
#
include
<
QtNetwork
/
qabstractsocket
.
h
>
26
#
include
<
private
/
qhostaddress_p
.
h
>
27
28
#
ifndef
QT_NO_NETWORKINTERFACE
29
30
QT_BEGIN_NAMESPACE
31
32
class
QNetworkAddressEntryPrivate
33
{
34
public
:
35
QHostAddress address;
36
QHostAddress broadcast;
37
QDeadlineTimer preferredLifetime = QDeadlineTimer::Forever;
38
QDeadlineTimer validityLifetime = QDeadlineTimer::Forever;
39
40
QNetmask netmask;
41
bool
lifetimeKnown =
false
;
42
QNetworkAddressEntry::DnsEligibilityStatus dnsEligibility = QNetworkAddressEntry::DnsEligibilityUnknown;
43
};
44
45
class
QNetworkInterfacePrivate
:
public
QSharedData
46
{
47
public
:
48
QNetworkInterfacePrivate
() :
index
(0)
49
{ }
50
~
QNetworkInterfacePrivate
()
51
{ }
52
53
int
index
;
// interface index, if know
54
int
mtu
= 0;
55
QNetworkInterface
::
InterfaceFlags
flags
;
56
QNetworkInterface
::
InterfaceType
type
=
QNetworkInterface
::
Unknown
;
57
58
QString
name
;
59
QString
friendlyName
;
60
QString
hardwareAddress
;
61
62
QList
<
QNetworkAddressEntry
>
addressEntries
;
63
64
static
QString
makeHwAddress
(
int
len, uchar *data);
65
static
void
calculateDnsEligibility
(QNetworkAddressEntry *entry,
bool
isTemporary,
66
bool
isDeprecated)
67
{
68
// this implements an algorithm that yields the same results as Windows
69
// produces, for the same input (as far as I can test)
70
if
(isTemporary || isDeprecated) {
71
entry->setDnsEligibility(QNetworkAddressEntry::DnsIneligible);
72
}
else
{
73
AddressClassification cl = QHostAddressPrivate::classify(entry->ip());
74
if
(cl == LoopbackAddress || cl == LinkLocalAddress)
75
entry->setDnsEligibility(QNetworkAddressEntry::DnsIneligible);
76
else
77
entry->setDnsEligibility(QNetworkAddressEntry::DnsEligible);
78
}
79
}
80
81
private
:
82
// disallow copying -- avoid detaching
83
QNetworkInterfacePrivate
&operator=(
const
QNetworkInterfacePrivate
&other);
84
QNetworkInterfacePrivate(
const
QNetworkInterfacePrivate
&other);
85
};
86
87
class
QNetworkInterfaceManager
88
{
89
public
:
90
QNetworkInterfaceManager
();
91
~
QNetworkInterfaceManager
();
92
93
QSharedDataPointer
<
QNetworkInterfacePrivate
>
interfaceFromName
(
const
QString &name);
94
QSharedDataPointer
<
QNetworkInterfacePrivate
>
interfaceFromIndex
(
int
index);
95
QList
<
QSharedDataPointer
<
QNetworkInterfacePrivate
> >
allInterfaces
();
96
97
static
uint
interfaceIndexFromName
(
const
QString &name);
98
static
QString
interfaceNameFromIndex
(uint index);
99
100
// convenience:
101
QSharedDataPointer
<
QNetworkInterfacePrivate
>
empty
;
102
103
private
:
104
QList<QNetworkInterfacePrivate *> scan();
105
};
106
107
108
QT_END_NAMESPACE
109
110
#
endif
// QT_NO_NETWORKINTERFACE
111
112
#
endif
QNetworkAddressEntry
The QNetworkAddressEntry class stores one IP address supported by a network interface,...
Definition
qnetworkinterface.h:22
QNetworkInterfaceManager
Definition
qnetworkinterface_p.h:88
QNetworkInterfaceManager::~QNetworkInterfaceManager
~QNetworkInterfaceManager()
Definition
qnetworkinterface.cpp:54
QNetworkInterfaceManager::interfaceFromName
QSharedDataPointer< QNetworkInterfacePrivate > interfaceFromName(const QString &name)
Definition
qnetworkinterface.cpp:58
QNetworkInterfaceManager::interfaceIndexFromName
static uint interfaceIndexFromName(const QString &name)
Definition
qnetworkinterface_linux.cpp:168
QNetworkInterfaceManager::QNetworkInterfaceManager
QNetworkInterfaceManager()
Definition
qnetworkinterface.cpp:50
QNetworkInterfaceManager::allInterfaces
QList< QSharedDataPointer< QNetworkInterfacePrivate > > allInterfaces()
Definition
qnetworkinterface.cpp:86
QNetworkInterfaceManager::empty
QSharedDataPointer< QNetworkInterfacePrivate > empty
Definition
qnetworkinterface_p.h:101
QNetworkInterfaceManager::interfaceNameFromIndex
static QString interfaceNameFromIndex(uint index)
Definition
qnetworkinterface_linux.cpp:187
QNetworkInterfaceManager::interfaceFromIndex
QSharedDataPointer< QNetworkInterfacePrivate > interfaceFromIndex(int index)
Definition
qnetworkinterface.cpp:75
QNetworkInterfacePrivate
Definition
qnetworkinterface_p.h:46
QNetworkInterfacePrivate::makeHwAddress
static QString makeHwAddress(int len, uchar *data)
Definition
qnetworkinterface.cpp:105
QNetworkInterfacePrivate::friendlyName
QString friendlyName
Definition
qnetworkinterface_p.h:59
QNetworkInterfacePrivate::mtu
int mtu
Definition
qnetworkinterface_p.h:54
QNetworkInterfacePrivate::hardwareAddress
QString hardwareAddress
Definition
qnetworkinterface_p.h:60
QNetworkInterfacePrivate::name
QString name
Definition
qnetworkinterface_p.h:58
QNetworkInterfacePrivate::index
int index
Definition
qnetworkinterface_p.h:53
QNetworkInterfacePrivate::calculateDnsEligibility
static void calculateDnsEligibility(QNetworkAddressEntry *entry, bool isTemporary, bool isDeprecated)
Definition
qnetworkinterface_p.h:65
QNetworkInterfacePrivate::QNetworkInterfacePrivate
QNetworkInterfacePrivate()
Definition
qnetworkinterface_p.h:48
QNetworkInterfacePrivate::addressEntries
QList< QNetworkAddressEntry > addressEntries
Definition
qnetworkinterface_p.h:62
QNetworkInterfacePrivate::~QNetworkInterfacePrivate
~QNetworkInterfacePrivate()
Definition
qnetworkinterface_p.h:50
QNetworkInterface
The QNetworkInterface class provides a listing of the host's IP addresses and network interfaces.
Definition
qnetworkinterface.h:73
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qstandardpaths_haiku.cpp:21
operator<<
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition
qdir.cpp:2464
operator<<
QDebug operator<<(QDebug dbg, const QFileInfo &fi)
Definition
qfileinfo.cpp:1753
flagsDebug
static QDebug flagsDebug(QDebug debug, QNetworkInterface::InterfaceFlags flags)
Definition
qnetworkinterface.cpp:884
postProcess
static QList< QNetworkInterfacePrivate * > postProcess(QList< QNetworkInterfacePrivate * > list)
Definition
qnetworkinterface.cpp:22
qtbase
src
network
kernel
qnetworkinterface_p.h
Generated on Sat Sep 28 2024 00:41:02 for Qt by
1.12.0