~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/qnetworkinterface.html

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-11-02 18:30:08 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (15.2.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 88.
  • Revision ID: james.westby@ubuntu.com-20091102183008-b6a4gcs128mvfb3m
Tags: upstream-4.6.0~beta1
ImportĀ upstreamĀ versionĀ 4.6.0~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
<!DOCTYPE html
3
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
 
<!-- /fasttmp/mkdist-qt-4.5.2-1245473805/qt-x11-opensource-src-4.5.2/src/network/kernel/qnetworkinterface.cpp -->
 
5
<!-- qnetworkinterface.cpp -->
6
6
<head>
7
 
  <title>Qt 4.5: QNetworkInterface Class Reference</title>
 
7
  <title>Qt 4.6: QNetworkInterface Class Reference</title>
8
8
  <link href="classic.css" rel="stylesheet" type="text/css" />
9
9
</head>
10
10
<body>
 
11
<a name="//apple_ref/cpp/cl//QNetworkInterface" />
11
12
<table border="0" cellpadding="0" cellspacing="0" width="100%">
12
13
<tr>
13
 
<td align="left" valign="top" width="32"><a href="http://qtsoftware.com/products/qt"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
14
 
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="namespaces.html"><font color="#004faf">All&nbsp;Namespaces</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
15
 
<td align="right" valign="top" width="230"></td></tr></table><h1 class="title">QNetworkInterface Class Reference<br /><span class="small-subtitle">[<a href="qtnetwork.html">QtNetwork</a> module]</span>
 
14
<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
 
15
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">All&nbsp;Functions</font></a>&nbsp;&middot; <a href="overviews.html"><font color="#004faf">Overviews</font></a></td><td class="searchBar" align="right" valign="center"><form action="http://www.google.com/cse" id="cse-search-box"><div><input type="hidden" name="cx" value="000136343326384750312:dhbxnqlakyu" /><input type="hidden" name="ie" value="UTF-8" /><input type="text" name="q" size="31" /><input type="submit" name="sa" value="Search" /></div></form></td>
 
16
</tr></table><h1 class="title">QNetworkInterface Class Reference<br /><span class="small-subtitle">[<a href="qtnetwork.html">QtNetwork</a> module]</span>
16
17
</h1>
17
18
<p>The QNetworkInterface class provides a listing of the host's IP addresses and network interfaces. <a href="#details">More...</a></p>
18
 
<pre> #include &lt;QNetworkInterface&gt;</pre><p><b>Note:</b> All the functions in this class are <a href="threads.html#reentrant">reentrant</a>.</p>
 
19
<pre> #include &lt;QNetworkInterface&gt;</pre><p><b>This class is not part of the Qt GUI Framework Edition.</b></p>
 
20
<p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>.</p>
19
21
<p>This class was introduced in Qt 4.2.</p>
20
22
<ul>
21
23
<li><a href="qnetworkinterface-members.html">List of all members, including inherited members</a></li>
22
24
</ul>
 
25
<hr />
23
26
<a name="public-types"></a>
24
 
<h3>Public Types</h3>
25
 
<ul>
26
 
<li><div class="fn"></div>enum <b><a href="qnetworkinterface.html#InterfaceFlag-enum">InterfaceFlag</a></b> { IsUp, IsRunning, CanBroadcast, IsLoopBack, IsPointToPoint, CanMulticast }</li>
27
 
<li><div class="fn"></div>flags <b><a href="qnetworkinterface.html#InterfaceFlag-enum">InterfaceFlags</a></b></li>
28
 
</ul>
 
27
<h2>Public Types</h2>
 
28
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
 
29
<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qnetworkinterface.html#InterfaceFlag-enum">InterfaceFlag</a></b> { IsUp, IsRunning, CanBroadcast, IsLoopBack, IsPointToPoint, CanMulticast }</td></tr>
 
30
<tr><td class="memItemLeft" align="right" valign="top">flags </td><td class="memItemRight" valign="bottom"><b><a href="qnetworkinterface.html#InterfaceFlag-enum">InterfaceFlags</a></b></td></tr>
 
31
</table>
 
32
<hr />
29
33
<a name="public-functions"></a>
30
 
<h3>Public Functions</h3>
31
 
<ul>
32
 
<li><div class="fn"></div><b><a href="qnetworkinterface.html#QNetworkInterface">QNetworkInterface</a></b> ()</li>
33
 
<li><div class="fn"></div><b><a href="qnetworkinterface.html#QNetworkInterface-2">QNetworkInterface</a></b> ( const QNetworkInterface &amp; <i>other</i> )</li>
34
 
<li><div class="fn"></div><b><a href="qnetworkinterface.html#dtor.QNetworkInterface">~QNetworkInterface</a></b> ()</li>
35
 
<li><div class="fn"></div>QList&lt;QNetworkAddressEntry&gt; <b><a href="qnetworkinterface.html#addressEntries">addressEntries</a></b> () const</li>
36
 
<li><div class="fn"></div>InterfaceFlags <b><a href="qnetworkinterface.html#flags">flags</a></b> () const</li>
37
 
<li><div class="fn"></div>QString <b><a href="qnetworkinterface.html#hardwareAddress">hardwareAddress</a></b> () const</li>
38
 
<li><div class="fn"></div>QString <b><a href="qnetworkinterface.html#humanReadableName">humanReadableName</a></b> () const</li>
39
 
<li><div class="fn"></div>int <b><a href="qnetworkinterface.html#index">index</a></b> () const</li>
40
 
<li><div class="fn"></div>bool <b><a href="qnetworkinterface.html#isValid">isValid</a></b> () const</li>
41
 
<li><div class="fn"></div>QString <b><a href="qnetworkinterface.html#name">name</a></b> () const</li>
42
 
<li><div class="fn"></div>QNetworkInterface &amp; <b><a href="qnetworkinterface.html#operator-eq">operator=</a></b> ( const QNetworkInterface &amp; <i>other</i> )</li>
43
 
</ul>
 
34
<h2>Public Functions</h2>
 
35
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
 
36
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qnetworkinterface.html#QNetworkInterface">QNetworkInterface</a></b> ()</td></tr>
 
37
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qnetworkinterface.html#QNetworkInterface-2">QNetworkInterface</a></b> ( const QNetworkInterface &amp; <i>other</i> )</td></tr>
 
38
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qnetworkinterface.html#dtor.QNetworkInterface">~QNetworkInterface</a></b> ()</td></tr>
 
39
<tr><td class="memItemLeft" align="right" valign="top">QList&lt;QNetworkAddressEntry&gt; </td><td class="memItemRight" valign="bottom"><b><a href="qnetworkinterface.html#addressEntries">addressEntries</a></b> () const</td></tr>
 
40
<tr><td class="memItemLeft" align="right" valign="top">InterfaceFlags </td><td class="memItemRight" valign="bottom"><b><a href="qnetworkinterface.html#flags">flags</a></b> () const</td></tr>
 
41
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qnetworkinterface.html#hardwareAddress">hardwareAddress</a></b> () const</td></tr>
 
42
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qnetworkinterface.html#humanReadableName">humanReadableName</a></b> () const</td></tr>
 
43
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qnetworkinterface.html#index">index</a></b> () const</td></tr>
 
44
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qnetworkinterface.html#isValid">isValid</a></b> () const</td></tr>
 
45
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qnetworkinterface.html#name">name</a></b> () const</td></tr>
 
46
<tr><td class="memItemLeft" align="right" valign="top">QNetworkInterface &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qnetworkinterface.html#operator-eq">operator=</a></b> ( const QNetworkInterface &amp; <i>other</i> )</td></tr>
 
47
</table>
 
48
<hr />
44
49
<a name="static-public-members"></a>
45
 
<h3>Static Public Members</h3>
46
 
<ul>
47
 
<li><div class="fn"></div>QList&lt;QHostAddress&gt; <b><a href="qnetworkinterface.html#allAddresses">allAddresses</a></b> ()</li>
48
 
<li><div class="fn"></div>QList&lt;QNetworkInterface&gt; <b><a href="qnetworkinterface.html#allInterfaces">allInterfaces</a></b> ()</li>
49
 
<li><div class="fn"></div>QNetworkInterface <b><a href="qnetworkinterface.html#interfaceFromIndex">interfaceFromIndex</a></b> ( int <i>index</i> )</li>
50
 
<li><div class="fn"></div>QNetworkInterface <b><a href="qnetworkinterface.html#interfaceFromName">interfaceFromName</a></b> ( const QString &amp; <i>name</i> )</li>
51
 
</ul>
 
50
<h2>Static Public Members</h2>
 
51
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
 
52
<tr><td class="memItemLeft" align="right" valign="top">QList&lt;QHostAddress&gt; </td><td class="memItemRight" valign="bottom"><b><a href="qnetworkinterface.html#allAddresses">allAddresses</a></b> ()</td></tr>
 
53
<tr><td class="memItemLeft" align="right" valign="top">QList&lt;QNetworkInterface&gt; </td><td class="memItemRight" valign="bottom"><b><a href="qnetworkinterface.html#allInterfaces">allInterfaces</a></b> ()</td></tr>
 
54
<tr><td class="memItemLeft" align="right" valign="top">QNetworkInterface </td><td class="memItemRight" valign="bottom"><b><a href="qnetworkinterface.html#interfaceFromIndex">interfaceFromIndex</a></b> ( int <i>index</i> )</td></tr>
 
55
<tr><td class="memItemLeft" align="right" valign="top">QNetworkInterface </td><td class="memItemRight" valign="bottom"><b><a href="qnetworkinterface.html#interfaceFromName">interfaceFromName</a></b> ( const QString &amp; <i>name</i> )</td></tr>
 
56
</table>
52
57
<a name="details"></a>
53
58
<hr />
54
59
<h2>Detailed Description</h2>
59
64
<p>See also <a href="qnetworkaddressentry.html">QNetworkAddressEntry</a>.</p>
60
65
<hr />
61
66
<h2>Member Type Documentation</h2>
 
67
<a name="//apple_ref/cpp/tag/QNetworkInterface/InterfaceFlag" />
 
68
<a name="//apple_ref/cpp/econst/QNetworkInterface/IsUp" />
 
69
<a name="//apple_ref/cpp/econst/QNetworkInterface/IsRunning" />
 
70
<a name="//apple_ref/cpp/econst/QNetworkInterface/CanBroadcast" />
 
71
<a name="//apple_ref/cpp/econst/QNetworkInterface/IsLoopBack" />
 
72
<a name="//apple_ref/cpp/econst/QNetworkInterface/IsPointToPoint" />
 
73
<a name="//apple_ref/cpp/econst/QNetworkInterface/CanMulticast" />
 
74
<a name="//apple_ref/cpp/tdef/QNetworkInterface/InterfaceFlags" />
62
75
<h3 class="flags"><a name="InterfaceFlag-enum"></a>enum QNetworkInterface::InterfaceFlag<br />flags QNetworkInterface::InterfaceFlags</h3>
63
76
<p>Specifies the flags associated with this network interface. The possible values are:</p>
64
 
<p><table border="1" cellpadding="2" cellspacing="1" width="100%">
 
77
<p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%">
65
78
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
66
79
<tr><td valign="top"><tt>QNetworkInterface::IsUp</tt></td><td align="center" valign="top"><tt>0x1</tt></td><td valign="top">the network interface is active</td></tr>
67
80
<tr><td valign="top"><tt>QNetworkInterface::IsRunning</tt></td><td align="center" valign="top"><tt>0x2</tt></td><td valign="top">the network interface has resources allocated</td></tr>
74
87
<p>The InterfaceFlags type is a typedef for <a href="qflags.html">QFlags</a>&lt;InterfaceFlag&gt;. It stores an OR combination of InterfaceFlag values.</p>
75
88
<hr />
76
89
<h2>Member Function Documentation</h2>
 
90
<a name="//apple_ref/cpp/instm/QNetworkInterface/QNetworkInterface" />
77
91
<h3 class="fn"><a name="QNetworkInterface"></a>QNetworkInterface::QNetworkInterface ()</h3>
78
92
<p>Constructs an empty network interface object.</p>
79
93
<h3 class="fn"><a name="QNetworkInterface-2"></a>QNetworkInterface::QNetworkInterface ( const QNetworkInterface &amp; <i>other</i> )</h3>
80
94
<p>Creates a copy of the <a href="qnetworkinterface.html">QNetworkInterface</a> object contained in <i>other</i>.</p>
 
95
<a name="//apple_ref/cpp/instm/QNetworkInterface/~QNetworkInterface" />
81
96
<h3 class="fn"><a name="dtor.QNetworkInterface"></a>QNetworkInterface::~QNetworkInterface ()</h3>
82
97
<p>Frees the resources associated with the <a href="qnetworkinterface.html">QNetworkInterface</a> object.</p>
 
98
<a name="//apple_ref/cpp/instm/QNetworkInterface/addressEntries" />
83
99
<h3 class="fn"><a name="addressEntries"></a><a href="qlist.html">QList</a>&lt;<a href="qnetworkaddressentry.html">QNetworkAddressEntry</a>&gt; QNetworkInterface::addressEntries () const</h3>
84
100
<p>Returns the list of IP addresses that this interface possesses along with their associated netmasks and broadcast addresses.</p>
85
101
<p>If the netmask or broadcast address information is not necessary, you can call the <a href="qnetworkinterface.html#allAddresses">allAddresses</a>() function to obtain just the IP addresses.</p>
 
102
<a name="//apple_ref/cpp/clm/QNetworkInterface/allAddresses" />
86
103
<h3 class="fn"><a name="allAddresses"></a><a href="qlist.html">QList</a>&lt;<a href="qhostaddress.html">QHostAddress</a>&gt; QNetworkInterface::allAddresses ()&nbsp;&nbsp;<tt> [static]</tt></h3>
87
104
<p>This convenience function returns all IP addresses found on the host machine. It is equivalent to calling <a href="qnetworkinterface.html#addressEntries">addressEntries</a>() on all the objects returned by <a href="qnetworkinterface.html#allInterfaces">allInterfaces</a>() to obtain lists of <a href="qhostaddress.html">QHostAddress</a> objects then calling QHostAddress::ip() on each of these.</p>
 
105
<a name="//apple_ref/cpp/clm/QNetworkInterface/allInterfaces" />
88
106
<h3 class="fn"><a name="allInterfaces"></a><a href="qlist.html">QList</a>&lt;QNetworkInterface&gt; QNetworkInterface::allInterfaces ()&nbsp;&nbsp;<tt> [static]</tt></h3>
89
107
<p>Returns a listing of all the network interfaces found on the host machine.</p>
 
108
<a name="//apple_ref/cpp/instm/QNetworkInterface/flags" />
90
109
<h3 class="fn"><a name="flags"></a><a href="qnetworkinterface.html#InterfaceFlag-enum">InterfaceFlags</a> QNetworkInterface::flags () const</h3>
91
110
<p>Returns the flags associated with this network interface.</p>
 
111
<a name="//apple_ref/cpp/instm/QNetworkInterface/hardwareAddress" />
92
112
<h3 class="fn"><a name="hardwareAddress"></a><a href="qstring.html">QString</a> QNetworkInterface::hardwareAddress () const</h3>
93
113
<p>Returns the low-level hardware address for this interface. On Ethernet interfaces, this will be a MAC address in string representation, separated by colons.</p>
94
114
<p>Other interface types may have other types of hardware addresses. Implementations should not depend on this function returning a valid MAC address.</p>
 
115
<a name="//apple_ref/cpp/instm/QNetworkInterface/humanReadableName" />
95
116
<h3 class="fn"><a name="humanReadableName"></a><a href="qstring.html">QString</a> QNetworkInterface::humanReadableName () const</h3>
96
117
<p>Returns the human-readable name of this network interface on Windows, such as &quot;Local Area Connection&quot;, if the name could be determined. If it couldn't, this function returns the same as <a href="qnetworkinterface.html#name">name</a>(). The human-readable name is a name that the user can modify in the Windows Control Panel, so it may change during the execution of the program.</p>
97
118
<p>On Unix, this function currently always returns the same as <a href="qnetworkinterface.html#name">name</a>(), since Unix systems don't store a configuration for human-readable names.</p>
98
119
<p>This function was introduced in Qt 4.5.</p>
 
120
<a name="//apple_ref/cpp/instm/QNetworkInterface/index" />
99
121
<h3 class="fn"><a name="index"></a>int QNetworkInterface::index () const</h3>
100
122
<p>Returns the interface system index, if known. This is an integer assigned by the operating system to identify this interface and it generally doesn't change. It matches the scope ID field in IPv6 addresses.</p>
101
123
<p>If the index isn't known, this function returns 0.</p>
102
124
<p>This function was introduced in Qt 4.5.</p>
 
125
<a name="//apple_ref/cpp/clm/QNetworkInterface/interfaceFromIndex" />
103
126
<h3 class="fn"><a name="interfaceFromIndex"></a>QNetworkInterface QNetworkInterface::interfaceFromIndex ( int <i>index</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
104
127
<p>Returns a <a href="qnetworkinterface.html">QNetworkInterface</a> object for the interface whose internal ID is <i>index</i>. Network interfaces have a unique identifier called the &quot;interface index&quot; to distinguish it from other interfaces on the system. Often, this value is assigned progressively and interfaces being removed and then added again get a different value every time.</p>
105
128
<p>This index is also found in the IPv6 address' scope ID field.</p>
 
129
<a name="//apple_ref/cpp/clm/QNetworkInterface/interfaceFromName" />
106
130
<h3 class="fn"><a name="interfaceFromName"></a>QNetworkInterface QNetworkInterface::interfaceFromName ( const <a href="qstring.html">QString</a> &amp; <i>name</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
107
131
<p>Returns a <a href="qnetworkinterface.html">QNetworkInterface</a> object for the interface named <i>name</i>. If no such interface exists, this function returns an invalid <a href="qnetworkinterface.html">QNetworkInterface</a> object.</p>
108
132
<p>See also <a href="qnetworkinterface.html#name">name</a>() and <a href="qnetworkinterface.html#isValid">isValid</a>().</p>
 
133
<a name="//apple_ref/cpp/instm/QNetworkInterface/isValid" />
109
134
<h3 class="fn"><a name="isValid"></a>bool QNetworkInterface::isValid () const</h3>
110
135
<p>Returns true if this <a href="qnetworkinterface.html">QNetworkInterface</a> object contains valid information about a network interface.</p>
 
136
<a name="//apple_ref/cpp/instm/QNetworkInterface/name" />
111
137
<h3 class="fn"><a name="name"></a><a href="qstring.html">QString</a> QNetworkInterface::name () const</h3>
112
138
<p>Returns the name of this network interface. On Unix systems, this is a string containing the type of the interface and optionally a sequence number, such as &quot;eth0&quot;, &quot;lo&quot; or &quot;pcn0&quot;. On Windows, it's an internal ID that cannot be changed by the user.</p>
 
139
<a name="//apple_ref/cpp/instm/QNetworkInterface/operator=" />
113
140
<h3 class="fn"><a name="operator-eq"></a>QNetworkInterface &amp; QNetworkInterface::operator= ( const QNetworkInterface &amp; <i>other</i> )</h3>
114
141
<p>Copies the contents of the <a href="qnetworkinterface.html">QNetworkInterface</a> object contained in <i>other</i> into this one.</p>
115
142
<p /><address><hr /><div align="center">
116
143
<table width="100%" cellspacing="0" border="0"><tr class="address">
117
 
<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
118
 
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
119
 
<td width="30%" align="right"><div align="right">Qt 4.5.2</div></td>
120
 
</tr></table></div></address></body>
 
144
<td width="40%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
 
145
<td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
146
<td width="40%" align="right"><div align="right">Qt 4.6.0</div></td>
 
147
<script type="text/javascript" src="http://www.google.com/jsapi"></script><script type="text/javascript">google.load("elements", "1", {packages: "transliteration"});</script><script type="text/javascript" src="http://www.google.com/coop/cse/t13n?form=cse-search-box&t13n_langs=en"></script><script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script></tr></table></div></address></body>
121
148
</html>