luci/documentation/jsapi/LuCI.Network.Protocol.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

4767 lines
No EOL
50 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Protocol</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: Protocol</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>Protocol</h2>
<div class="class-description"><p>The <code>Network.Protocol</code> class serves as base for protocol specific
subclasses which describe logical UCI networks defined by <code>config interface</code> sections in <code>/etc/config/network</code>.</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#line1794">line 1794</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="addDevice"><span class="type-signature"></span>addDevice<span class="signature">(device)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
<p>Add the given network device to the logical interface.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>device</code></td>
<td class="type">
<span class="param-type"><a href="LuCI.Network.Protocol.html">LuCI.Network.Protocol</a></span>
|
<span class="param-type"><a href="LuCI.Network.Device.html">LuCI.Network.Device</a></span>
|
<span class="param-type"><a href="LuCI.Network.WifiDevice.html">LuCI.Network.WifiDevice</a></span>
|
<span class="param-type"><a href="LuCI.Network.WifiNetwork.html">LuCI.Network.WifiNetwork</a></span>
|
<span class="param-type">string</span>
</td>
<td class="description last"><p>The object or device name to add to the logical interface. In case the
given argument is not a string, it is resolved though the
<a href="LuCI.Network.html#getIfnameOf"><code>Network.getIfnameOf()</code></a> function.</p></td>
</tr>
</tbody>
</table>
<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#line2383">line 2383</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns <code>true</code> if the device name has been added or <code>false</code> if any
argument was invalid, if the device was already part of the logical
interface or if the logical interface is virtual.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="containsDevice"><span class="type-signature"></span>containsDevice<span class="signature">(device)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
<p>Checks whether this logical interface contains the given device
object.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>device</code></td>
<td class="type">
<span class="param-type"><a href="LuCI.Network.Protocol.html">LuCI.Network.Protocol</a></span>
|
<span class="param-type"><a href="LuCI.Network.Device.html">LuCI.Network.Device</a></span>
|
<span class="param-type"><a href="LuCI.Network.WifiDevice.html">LuCI.Network.WifiDevice</a></span>
|
<span class="param-type"><a href="LuCI.Network.WifiNetwork.html">LuCI.Network.WifiNetwork</a></span>
|
<span class="param-type">string</span>
</td>
<td class="description last"><p>The object or device name to check. In case the given argument is not
a string, it is resolved though the
<a href="LuCI.Network.html#getIfnameOf"><code>Network.getIfnameOf()</code></a> function.</p></td>
</tr>
</tbody>
</table>
<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#line2552">line 2552</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns <code>true</code> when this logical interface contains the given network
device or <code>false</code> if not.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="deleteDevice"><span class="type-signature"></span>deleteDevice<span class="signature">(device)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
<p>Remove the given network device from the logical interface.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>device</code></td>
<td class="type">
<span class="param-type"><a href="LuCI.Network.Protocol.html">LuCI.Network.Protocol</a></span>
|
<span class="param-type"><a href="LuCI.Network.Device.html">LuCI.Network.Device</a></span>
|
<span class="param-type"><a href="LuCI.Network.WifiDevice.html">LuCI.Network.WifiDevice</a></span>
|
<span class="param-type"><a href="LuCI.Network.WifiNetwork.html">LuCI.Network.WifiNetwork</a></span>
|
<span class="param-type">string</span>
</td>
<td class="description last"><p>The object or device name to remove from the logical interface. In case
the given argument is not a string, it is resolved though the
<a href="LuCI.Network.html#getIfnameOf"><code>Network.getIfnameOf()</code></a> function.</p></td>
</tr>
</tbody>
</table>
<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#line2410">line 2410</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns <code>true</code> if the device name has been added or <code>false</code> if any
argument was invalid, if the device was already part of the logical
interface or if the logical interface is virtual.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="get"><span class="type-signature"></span>get<span class="signature">(opt)</span><span class="type-signature"> &rarr; {null|string|Array.&lt;string>}</span></h4>
<div class="description">
<p>Read the given UCI option value of this network.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>opt</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The UCI option name to read.</p></td>
</tr>
</tbody>
</table>
<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#line1827">line 1827</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the UCI option value or <code>null</code> if the requested option is
not found.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">null</span>
|
<span class="param-type">string</span>
|
<span class="param-type">Array.&lt;string></span>
</dd>
</dl>
<h4 class="name" id="getDevice"><span class="type-signature"></span>getDevice<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="LuCI.Network.Device.html">LuCI.Network.Device</a>}</span></h4>
<div class="description">
<p>Returns the Linux network device associated with this logical
interface.</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#line2437">line 2437</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns a <code>Network.Device</code> class instance representing the
expected Linux network device according to the configuration.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="LuCI.Network.Device.html">LuCI.Network.Device</a></span>
</dd>
</dl>
<h4 class="name" id="getDevices"><span class="type-signature"></span>getDevices<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>Returns a list of network sub-devices associated with this logical
interface.</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#line2498">line 2498</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns an array of of <code>Network.Device</code> class instances representing
the sub-devices attached to this logical interface or <code>null</code> if the
logical interface does not support sub-devices, e.g. because it is
virtual and not a 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="getDNS6Addrs"><span class="type-signature"></span>getDNS6Addrs<span class="signature">()</span><span class="type-signature"> &rarr; {Array.&lt;string>}</span></h4>
<div class="description">
<p>Query the IPv6 DNS servers associated with the logical interface.</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#line2152">line 2152</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns an array of IPv6 DNS servers registered by the remote
protocol backend.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;string></span>
</dd>
</dl>
<h4 class="name" id="getDNSAddrs"><span class="type-signature"></span>getDNSAddrs<span class="signature">()</span><span class="type-signature"> &rarr; {Array.&lt;string>}</span></h4>
<div class="description">
<p>Query the IPv4 DNS servers associated with the logical interface.</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#line2064">line 2064</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns an array of IPv4 DNS servers registered by the remote
protocol backend.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;string></span>
</dd>
</dl>
<h4 class="name" id="getErrors"><span class="type-signature"></span>getErrors<span class="signature">()</span><span class="type-signature"> &rarr; {Array.&lt;string>}</span></h4>
<div class="description">
<p>Query interface error messages published in <code>ubus</code> runtime state.</p>
<p>Interface errors are emitted by remote protocol handlers if the setup
of the underlying logical interface failed, e.g. due to bad
configuration or network connectivity issues.</p>
<p>This function will translate the found error codes to human readable
messages using the descriptions registered by
<a href="LuCI.Network.html#registerErrorCode"><code>Network.registerErrorCode()</code></a>
and fall back to <code>&quot;Unknown error (%s)&quot;</code> where <code>%s</code> is replaced by the
error code in case no translation can be found.</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#line2196">line 2196</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns an array of translated interface error messages.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;string></span>
</dd>
</dl>
<h4 class="name" id="getExpiry"><span class="type-signature"></span>getExpiry<span class="signature">()</span><span class="type-signature"> &rarr; {number}</span></h4>
<div class="description">
<p>Get the logical interface expiry time in seconds.</p>
<p>For protocols that have a concept of a lease, such as DHCP or
DHCPv6, this function returns the remaining time in seconds
until the lease expires.</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#line1947">line 1947</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the amount of seconds until the lease expires or <code>-1</code>
if it isn't applicable to the associated protocol.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
<h4 class="name" id="getGateway6Addr"><span class="type-signature"></span>getGateway6Addr<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4>
<div class="description">
<p>Query the gateway (nexthop) of the IPv6 default route associated with
this logical interface.</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#line2132">line 2132</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns a string containing the IPv6 nexthop address of the associated
default route or <code>null</code> if no default route was found.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="getGatewayAddr"><span class="type-signature"></span>getGatewayAddr<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4>
<div class="description">
<p>Query the gateway (nexthop) of the default route associated with
this logical interface.</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#line2044">line 2044</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns a string containing the IPv4 nexthop address of the associated
default route or <code>null</code> if no default route was found.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="getI18n"><span class="type-signature">(abstract) </span>getI18n<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4>
<div class="description">
<p>Return a human readable description for the protcol, such as
<code>Static address</code> or <code>DHCP client</code>.</p>
<p>This function should be overwritten by subclasses.</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#line1892">line 1892</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the description string.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="getIfname"><span class="type-signature"></span>getIfname<span class="signature">()</span><span class="type-signature"> &rarr; {null|string}</span></h4>
<div class="description">
<p>Get the associared Linux network device of this network.</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#line1852">line 1852</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the name of the associated network device or <code>null</code> if
it could not be determined.</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="getIP6Addr"><span class="type-signature"></span>getIP6Addr<span class="signature">()</span><span class="type-signature"> &rarr; {null|string}</span></h4>
<div class="description">
<p>Query the first (primary) IPv6 address of the logical interface.</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#line2083">line 2083</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the primary IPv6 address registered by the protocol handler
in CIDR notation or <code>null</code> if no IPv6 addresses were set.</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="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>Query all IPv6 addresses of the logical interface.</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#line2105">line 2105</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns an array of IPv6 addresses in CIDR notation which have been
registered by the protocol handler. The order of the resulting array
follows the order of the addresses in <code>ubus</code> runtime information.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;string></span>
</dd>
</dl>
<h4 class="name" id="getIP6Prefix"><span class="type-signature"></span>getIP6Prefix<span class="signature">()</span><span class="type-signature"> &rarr; {null|string}</span></h4>
<div class="description">
<p>Query the routed IPv6 prefix associated with the logical interface.</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#line2171">line 2171</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the routed IPv6 prefix registered by the remote protocol
handler or <code>null</code> if no prefix is present.</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="getIPAddr"><span class="type-signature"></span>getIPAddr<span class="signature">()</span><span class="type-signature"> &rarr; {null|string}</span></h4>
<div class="description">
<p>Query the first (primary) IPv4 address of the logical interface.</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#line1999">line 1999</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the primary IPv4 address registered by the protocol handler
or <code>null</code> if no IPv4 addresses were set.</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="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>Query all IPv4 addresses of the logical interface.</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#line2012">line 2012</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns an array of IPv4 addresses in CIDR notation which have been
registered by the protocol handler. The order of the resulting array
follows the order of the addresses in <code>ubus</code> runtime information.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;string></span>
</dd>
</dl>
<h4 class="name" id="getL2Device"><span class="type-signature"></span>getL2Device<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="LuCI.Network.Device.html">LuCI.Network.Device</a>}</span></h4>
<div class="description">
<p>Returns the layer 2 linux network device currently associated
with this logical interface.</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#line2470">line 2470</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns a <code>Network.Device</code> class instance representing the Linux
network device currently associated with the logical interface.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="LuCI.Network.Device.html">LuCI.Network.Device</a></span>
</dd>
</dl>
<h4 class="name" id="getL3Device"><span class="type-signature"></span>getL3Device<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="LuCI.Network.Device.html">LuCI.Network.Device</a>}</span></h4>
<div class="description">
<p>Returns the layer 3 linux network device currently associated
with this logical interface.</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#line2483">line 2483</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns a <code>Network.Device</code> class instance representing the Linux
network device currently associated with the logical interface.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="LuCI.Network.Device.html">LuCI.Network.Device</a></span>
</dd>
</dl>
<h4 class="name" id="getMetric"><span class="type-signature"></span>getMetric<span class="signature">()</span><span class="type-signature"> &rarr; {number}</span></h4>
<div class="description">
<p>Get the metric value of the logical interface.</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#line1967">line 1967</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the current metric value used for device and network
routes spawned by the associated logical interface.</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 associated logical interface.</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#line1922">line 1922</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the logical interface name, such as <code>lan</code> or <code>wan</code>.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="getNetmask"><span class="type-signature"></span>getNetmask<span class="signature">()</span><span class="type-signature"> &rarr; {null|string}</span></h4>
<div class="description">
<p>Query the first (primary) IPv4 netmask of the logical interface.</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#line2030">line 2030</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the netmask of the primary IPv4 address registered by the
protocol handler or <code>null</code> if no IPv4 addresses were set.</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="getOpkgPackage"><span class="type-signature">(abstract) </span>getOpkgPackage<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4>
<div class="description">
<p>Get the name of the opkg package providing the protocol functionality.</p>
<p>This function should be overwritten by protocol specific subclasses.</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#line2236">line 2236</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the name of the opkg package required for the protocol to
function, e.g. <code>odhcp6c</code> for the <code>dhcpv6</code> prototocol.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="getProtocol"><span class="type-signature">(abstract) </span>getProtocol<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4>
<div class="description">
<p>Get the name of this network protocol class.</p>
<p>This function will be overwritten by subclasses created by
<a href="LuCI.Network.html#registerProtocol"><code>Network.registerProtocol()</code></a>.</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#line1878">line 1878</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the name of the network protocol implementation, e.g.
<code>static</code> or <code>dhcp</code>.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="getType"><span class="type-signature"></span>getType<span class="signature">()</span><span class="type-signature"> &rarr; {null|string}</span></h4>
<div class="description">
<p>Get the type of the underlying interface.</p>
<p>This function actually is a convenience wrapper around
<code>proto.get(&quot;type&quot;)</code> and is mainly used by other <code>LuCI.Network</code> code
to check whether the interface is declared as bridge in UCI.</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#line1912">line 1912</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the value of the <code>type</code> option of the associated logical
interface or <code>null</code> if no <code>type</code> option is set.</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="getUptime"><span class="type-signature"></span>getUptime<span class="signature">()</span><span class="type-signature"> &rarr; {number}</span></h4>
<div class="description">
<p>Get the uptime of the logical interface.</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#line1932">line 1932</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the uptime of the associated interface in seconds.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
<h4 class="name" id="getZoneName"><span class="type-signature"></span>getZoneName<span class="signature">()</span><span class="type-signature"> &rarr; {null|string}</span></h4>
<div class="description">
<p>Get the requested firewall zone name of the logical interface.</p>
<p>Some protocol implementations request a specific firewall zone
to trigger inclusion of their resulting network devices into the
firewall rule set.</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#line1983">line 1983</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the requested firewall zone name as published in the
<code>ubus</code> runtime information or <code>null</code> if the remote protocol
handler didn't request a zone.</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="isAlias"><span class="type-signature"></span>isAlias<span class="signature">()</span><span class="type-signature"> &rarr; {null|string}</span></h4>
<div class="description">
<p>Checks whether this interface is an alias interface.</p>
<p>Alias interfaces are interfaces layering on top of another interface
and are denoted by a special <code>@interfacename</code> notation in the
underlying <code>ifname</code> option.</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#line2324">line 2324</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the name of the parent interface if this logical interface
is an alias or <code>null</code> if it is not an alias interface.</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="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 the underlying logical interface is declared as 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#line2221">line 2221</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns <code>true</code> when the interface is declared with <code>option type bridge</code>
and when the associated protocol implementation is not marked virtual
or <code>false</code> when the logical interface is no bridge.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="isDynamic"><span class="type-signature"></span>isDynamic<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
<p>Checks whether this logical interface is dynamic.</p>
<p>A dynamic interface is an interface which has been created at runtime,
e.g. as sub-interface of another interface, but which is not backed by
any user configuration. Such dynamic interfaces cannot be edited but
only brought down or restarted.</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#line2309">line 2309</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns a boolean indicating whether this interface is dynamic (<code>true</code>)
or not (<code>false</code>).</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="isEmpty"><span class="type-signature"></span>isEmpty<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
<p>Checks whether this logical interface is &quot;empty&quot;, meaning that ut
has no network devices attached.</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#line2344">line 2344</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns <code>true</code> if this logical interface is empty, else <code>false</code>.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="isFloating"><span class="type-signature"></span>isFloating<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
<p>Checks whether this protocol is &quot;floating&quot;.</p>
<p>A &quot;floating&quot; protocol is a protocol which spawns its own interfaces
on demand, like a virtual one but which relies on an existinf lower
level interface to initiate the connection.</p>
<p>An example for such a protocol is &quot;pppoe&quot;.</p>
<p>This function exists for backwards compatibility with older code
but should not be used anymore.</p>
</div>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd>
<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#line2293">line 2293</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns a boolean indicating whether this protocol is floating (<code>true</code>)
or not (<code>false</code>).</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="isInstalled"><span class="type-signature">(abstract) </span>isInstalled<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
<p>Checks whether the protocol functionality is installed.</p>
<p>This function exists for compatibility with old code, it always
returns <code>true</code>.</p>
</div>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd>
<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#line2252">line 2252</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns <code>true</code> if the protocol support is installed, 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 logical interface is configured and running.</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#line2366">line 2366</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns <code>true</code> when the interface is active or <code>false</code> when it is not.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="isVirtual"><span class="type-signature"></span>isVirtual<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
<p>Checks whether this protocol is &quot;virtual&quot;.</p>
<p>A &quot;virtual&quot; protocol is a protocol which spawns its own interfaces
on demand instead of using existing physical interfaces.</p>
<p>Examples for virtual protocols are <code>6in4</code> which <code>gre</code> spawn tunnel
network device on startup, examples for non-virtual protcols are
<code>dhcp</code> or <code>static</code> which apply IP configuration to existing interfaces.</p>
<p>This function should be overwritten by subclasses.</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#line2272">line 2272</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns a boolean indicating whether the underlying protocol spawns
dynamic interfaces (<code>true</code>) or not (<code>false</code>).</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="set"><span class="type-signature"></span>set<span class="signature">(opt, val)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Set the given UCI option of this network to the given value.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>opt</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The name of the UCI option to set.</p></td>
</tr>
<tr>
<td class="name"><code>val</code></td>
<td class="type">
<span class="param-type">null</span>
|
<span class="param-type">string</span>
|
<span class="param-type">Array.&lt;string></span>
</td>
<td class="description last"><p>The value to set or <code>null</code> to remove the given option from the
configuration.</p></td>
</tr>
</tbody>
</table>
<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#line1841">line 1841</a>
</li></ul></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>