<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: Hosts</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: Hosts</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>Hosts</h2> <div class="class-description"><p>The <code>LuCI.Network.Hosts</code> class encapsulates host information aggregated from multiple sources and provides convenience functions to access the host information by different criteria.</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#line1628">line 1628</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="getHostnameByIP6Addr"><span class="type-signature"></span>getHostnameByIP6Addr<span class="signature">(ipaddr)</span><span class="type-signature"> → {null|string}</span></h4> <div class="description"> <p>Lookup the hostname associated with the given IPv6 address.</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>ipaddr</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The IPv6 address to lookup.</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#line1725">line 1725</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns the hostname associated with the given IPv6 or <code>null</code> if no matching host could be found or if no hostname is known for the corresponding host.</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="getHostnameByIPAddr"><span class="type-signature"></span>getHostnameByIPAddr<span class="signature">(ipaddr)</span><span class="type-signature"> → {null|string}</span></h4> <div class="description"> <p>Lookup the hostname associated with the given IPv4 address.</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>ipaddr</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The IPv4 address to lookup.</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#line1689">line 1689</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns the hostname associated with the given IPv4 or <code>null</code> if no matching host could be found or if no hostname is known for the corresponding host.</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="getHostnameByMACAddr"><span class="type-signature"></span>getHostnameByMACAddr<span class="signature">(mac)</span><span class="type-signature"> → {null|string}</span></h4> <div class="description"> <p>Lookup the hostname associated with the given MAC address.</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>mac</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The MAC address to lookup.</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#line1644">line 1644</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns the hostname associated with the given MAC or <code>null</code> if no matching host could be found or if no hostname is known for the corresponding host.</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="getIP6AddrByMACAddr"><span class="type-signature"></span>getIP6AddrByMACAddr<span class="signature">(mac)</span><span class="type-signature"> → {null|string}</span></h4> <div class="description"> <p>Lookup the IPv6 address associated with the given MAC address.</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>mac</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The MAC address to lookup.</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#line1674">line 1674</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns the IPv6 address associated with the given MAC or <code>null</code> if no matching host could be found or if no IPv6 address is known for the corresponding host.</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="getIPAddrByMACAddr"><span class="type-signature"></span>getIPAddrByMACAddr<span class="signature">(mac)</span><span class="type-signature"> → {null|string}</span></h4> <div class="description"> <p>Lookup the IPv4 address associated with the given MAC address.</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>mac</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The MAC address to lookup.</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#line1659">line 1659</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns the IPv4 address associated with the given MAC or <code>null</code> if no matching host could be found or if no IPv4 address is known for the corresponding host.</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="getMACAddrByIP6Addr"><span class="type-signature"></span>getMACAddrByIP6Addr<span class="signature">(ipaddr)</span><span class="type-signature"> → {null|string}</span></h4> <div class="description"> <p>Lookup the MAC address associated with the given IPv6 address.</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>ipaddr</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The IPv6 address to lookup.</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#line1743">line 1743</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns the MAC address associated with the given IPv6 or <code>null</code> if no matching host could be found or if no MAC address is known for the corresponding host.</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="getMACAddrByIPAddr"><span class="type-signature"></span>getMACAddrByIPAddr<span class="signature">(ipaddr)</span><span class="type-signature"> → {null|string}</span></h4> <div class="description"> <p>Lookup the MAC address associated with the given IPv4 address.</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>ipaddr</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The IPv4 address to lookup.</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#line1707">line 1707</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns the MAC address associated with the given IPv4 or <code>null</code> if no matching host could be found or if no MAC address is known for the corresponding host.</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="getMACHints"><span class="type-signature"></span>getMACHints<span class="signature">(preferIp6<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Array.<Array.<string>>}</span></h4> <div class="description"> <p>Return an array of (MAC address, name hint) tuples sorted by MAC address.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>preferIp6</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> false </td> <td class="description last"><p>Whether to prefer IPv6 addresses (<code>true</code>) or IPv4 addresses (<code>false</code>) as name hint when no hostname is known for a specific MAC address.</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#line1771">line 1771</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns an array of arrays containing a name hint for each found MAC address on the system. The array is sorted ascending by MAC.</p> <p>Each item of the resulting array is a two element array with the MAC being the first element and the name hint being the second element. The name hint is either the hostname, an IPv4 or an IPv6 address related to the MAC address.</p> <p>If no hostname but both IPv4 and IPv6 addresses are known, the <code>preferIP6</code> flag specifies whether the IPv6 or the IPv4 address is used as hint.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array.<Array.<string>></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>