luci/documentation/jsapi/LuCI.Network.Device.html
Jo-Philipp Wich 3942789dc6 documentation: add JS api docs
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit d9452d1157aef6b8752fac0f4ed1e0b9221abb31)
2019-11-05 09:37:52 +01:00

2626 lines
No EOL
25 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Device</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: Device</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>
<span class="ancestors"><a href="LuCI.html">LuCI</a><a href="LuCI.Network.html">.Network</a>.</span>Device</h2>
<div class="class-description"><p>A <code>Network.Device</code> class instance represents an underlying Linux network
device and allows querying device details such as packet statistics or MTU.</p></div>
</header>
<article>
<div class="container-overview">
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2593">line 2593</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="getBridgeID"><span class="type-signature"></span>getBridgeID<span class="signature">()</span><span class="type-signature"> &rarr; {null|string}</span></h4>
<div class="description">
<p>Get the bridge ID</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2800">line 2800</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the ID of this network bridge or <code>null</code> if this network
device is not a Linux bridge.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">null</span>
|
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="getBridgeSTP"><span class="type-signature"></span>getBridgeSTP<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
<p>Get the bridge STP setting</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2812">line 2812</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns <code>true</code> when this device is a Linux bridge and has <code>stp</code>
enabled, else <code>false</code>.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="getI18n"><span class="type-signature"></span>getI18n<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4>
<div class="description">
<p>Get a long description string for the device.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2727">line 2727</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns a string containing the type description and device name
for non-wifi devices or operation mode and ssid for wifi ones.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="getIP6Addrs"><span class="type-signature"></span>getIP6Addrs<span class="signature">()</span><span class="type-signature"> &rarr; {Array.&lt;string>}</span></h4>
<div class="description">
<p>Get the IPv6 addresses configured on the device.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2671">line 2671</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns an array of IPv6 address strings.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;string></span>
</dd>
</dl>
<h4 class="name" id="getIPAddrs"><span class="type-signature"></span>getIPAddrs<span class="signature">()</span><span class="type-signature"> &rarr; {Array.&lt;string>}</span></h4>
<div class="description">
<p>Get the IPv4 addresses configured on the device.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2660">line 2660</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns an array of IPv4 address strings.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;string></span>
</dd>
</dl>
<h4 class="name" id="getMAC"><span class="type-signature"></span>getMAC<span class="signature">()</span><span class="type-signature"> &rarr; {null|string}</span></h4>
<div class="description">
<p>Get the MAC address of the device.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2639">line 2639</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the MAC address of the device or <code>null</code> if not applicable,
e.g. for non-ethernet tunnel devices.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">null</span>
|
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="getMTU"><span class="type-signature"></span>getMTU<span class="signature">()</span><span class="type-signature"> &rarr; {number}</span></h4>
<div class="description">
<p>Get the MTU of the device.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2650">line 2650</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the MTU of the device.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
<h4 class="name" id="getName"><span class="type-signature"></span>getName<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4>
<div class="description">
<p>Get the name of the network device.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2628">line 2628</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the name of the device, e.g. <code>eth0</code> or <code>wlan0</code>.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="getNetwork"><span class="type-signature"></span>getNetwork<span class="signature">()</span><span class="type-signature"> &rarr; {null|<a href="LuCI.Network.Protocol.html">LuCI.Network.Protocol</a>}</span></h4>
<div class="description">
<p>Get the primary logical interface this device is assigned to.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2907">line 2907</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns a <code>Network.Protocol</code> instance representing the logical
interface this device is attached to or <code>null</code> if it is not
assigned to any logical interface.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">null</span>
|
<span class="param-type"><a href="LuCI.Network.Protocol.html">LuCI.Network.Protocol</a></span>
</dd>
</dl>
<h4 class="name" id="getNetworks"><span class="type-signature"></span>getNetworks<span class="signature">()</span><span class="type-signature"> &rarr; {Array.&lt;<a href="LuCI.Network.Protocol.html">LuCI.Network.Protocol</a>>}</span></h4>
<div class="description">
<p>Get the logical interfaces this device is assigned to.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2918">line 2918</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns an array of <code>Network.Protocol</code> instances representing the
logical interfaces this device is assigned to.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;<a href="LuCI.Network.Protocol.html">LuCI.Network.Protocol</a>></span>
</dd>
</dl>
<h4 class="name" id="getPorts"><span class="type-signature"></span>getPorts<span class="signature">()</span><span class="type-signature"> &rarr; {null|Array.&lt;<a href="LuCI.Network.Device.html">LuCI.Network.Device</a>>}</span></h4>
<div class="description">
<p>Get the associated bridge ports of the device.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2778">line 2778</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns an array of <code>Network.Device</code> instances representing the ports
(slave interfaces) of the bridge or <code>null</code> when this device isn't
a Linux bridge.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">null</span>
|
<span class="param-type">Array.&lt;<a href="LuCI.Network.Device.html">LuCI.Network.Device</a>></span>
</dd>
</dl>
<h4 class="name" id="getRXBytes"><span class="type-signature"></span>getRXBytes<span class="signature">()</span><span class="type-signature"> &rarr; {number}</span></h4>
<div class="description">
<p>Get the amount of received bytes.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2872">line 2872</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the amount of bytes received by the network device.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
<h4 class="name" id="getRXPackets"><span class="type-signature"></span>getRXPackets<span class="signature">()</span><span class="type-signature"> &rarr; {number}</span></h4>
<div class="description">
<p>Get the amount of received packets.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2894">line 2894</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the amount of packets received by the network device.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
<h4 class="name" id="getShortName"><span class="type-signature"></span>getShortName<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4>
<div class="description">
<p>Get a short description string for the device.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2713">line 2713</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the device name for non-wifi devices or a string containing
the operation mode and SSID for wifi devices.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="getTXBytes"><span class="type-signature"></span>getTXBytes<span class="signature">()</span><span class="type-signature"> &rarr; {number}</span></h4>
<div class="description">
<p>Get the amount of transmitted bytes.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2861">line 2861</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the amount of bytes transmitted by the network device.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
<h4 class="name" id="getTXPackets"><span class="type-signature"></span>getTXPackets<span class="signature">()</span><span class="type-signature"> &rarr; {number}</span></h4>
<div class="description">
<p>Get the amount of transmitted packets.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2883">line 2883</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the amount of packets transmitted by the network device.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
<h4 class="name" id="getType"><span class="type-signature"></span>getType<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4>
<div class="description">
<p>Get the type of the device..</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2689">line 2689</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns a string describing the type of the network device:</p>
<ul>
<li><code>alias</code> if it is an abstract alias device (<code>@</code> notation)</li>
<li><code>wifi</code> if it is a wireless interface (e.g. <code>wlan0</code>)</li>
<li><code>bridge</code> if it is a bridge device (e.g. <code>br-lan</code>)</li>
<li><code>tunnel</code> if it is a tun or tap device (e.g. <code>tun0</code>)</li>
<li><code>vlan</code> if it is a vlan device (e.g. <code>eth0.1</code>)</li>
<li><code>switch</code> if it is a switch device (e.g.<code>eth1</code> connected to switch0)</li>
<li><code>ethernet</code> for all other device types</li>
</ul>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="getTypeI18n"><span class="type-signature"></span>getTypeI18n<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4>
<div class="description">
<p>Get a string describing the device type.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2745">line 2745</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns a string describing the type, e.g. &quot;Wireless Adapter&quot; or
&quot;Bridge&quot;.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="getWifiNetwork"><span class="type-signature"></span>getWifiNetwork<span class="signature">()</span><span class="type-signature"> &rarr; {null|<a href="LuCI.Network.WifiNetwork.html">LuCI.Network.WifiNetwork</a>}</span></h4>
<div class="description">
<p>Get the related wireless network this device is related to.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2942">line 2942</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns a <code>Network.WifiNetwork</code> instance representing the wireless
network corresponding to this network device or <code>null</code> if this device
is not a wireless device.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">null</span>
|
<span class="param-type"><a href="LuCI.Network.WifiNetwork.html">LuCI.Network.WifiNetwork</a></span>
</dd>
</dl>
<h4 class="name" id="isBridge"><span class="type-signature"></span>isBridge<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
<p>Checks whether this device is a Linux bridge.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2840">line 2840</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns <code>true</code> when the network device is present and a Linux bridge,
else <code>false</code>.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="isBridgePort"><span class="type-signature"></span>isBridgePort<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
<p>Checks whether this device is part of a Linux bridge.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2851">line 2851</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns <code>true</code> when this network device is part of a bridge,
else <code>false</code>.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="isUp"><span class="type-signature"></span>isUp<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
<p>Checks whether this device is up.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="network.js.html">network.js</a>, <a href="network.js.html#line2824">line 2824</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns <code>true</code> when the associated device is running pr <code>false</code>
when it is down or absent.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="LuCI.html">LuCI</a></li><li><a href="LuCI.Class.html">Class</a></li><li><a href="LuCI.dom.html">dom</a></li><li><a href="LuCI.fs.html">fs</a></li><li><a href="LuCI.Headers.html">Headers</a></li><li><a href="LuCI.Network.html">Network</a></li><li><a href="LuCI.Network.Device.html">Device</a></li><li><a href="LuCI.Network.Hosts.html">Hosts</a></li><li><a href="LuCI.Network.Protocol.html">Protocol</a></li><li><a href="LuCI.Network.WifiDevice.html">WifiDevice</a></li><li><a href="LuCI.Network.WifiNetwork.html">WifiNetwork</a></li><li><a href="LuCI.Poll.html">Poll</a></li><li><a href="LuCI.Request.html">Request</a></li><li><a href="LuCI.Request.poll.html">poll</a></li><li><a href="LuCI.Response.html">Response</a></li><li><a href="LuCI.rpc.html">rpc</a></li><li><a href="LuCI.uci.html">uci</a></li><li><a href="LuCI.view.html">view</a></li><li><a href="LuCI.XHR.html">XHR</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Tue Nov 05 2019 09:33:05 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>