diff options
Diffstat (limited to 'doc/modules')
29 files changed, 18958 insertions, 0 deletions
diff --git a/doc/modules/luci.dispatcher.html b/doc/modules/luci.dispatcher.html new file mode 100644 index 000000000..63abb9735 --- /dev/null +++ b/doc/modules/luci.dispatcher.html @@ -0,0 +1,1119 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li><strong>luci.dispatcher</strong></li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Class <code>luci.dispatcher</code></h1> + +<p></p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#_">_</a> ()</td> + <td class="summary"> + +No-op function used to mark translation entries for menu labels.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#alias">alias</a> (...)</td> + <td class="summary"> + +Create a redirect to another dispatching node.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#arcombine">arcombine</a> (trg1, trg2)</td> + <td class="summary"> + +Create a combined dispatching target for non argv and argv requests.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#assign">assign</a> (path, clone, title, order)</td> + <td class="summary"> + +Clone a node of the dispatching tree to another position.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#build_url">build_url</a> (...)</td> + <td class="summary"> + +Build the URL relative to the server webroot from given virtual path.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#call">call</a> (name, ...)</td> + <td class="summary"> + +Create a function-call dispatching target.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cbi">cbi</a> (model)</td> + <td class="summary"> + +Create a CBI model dispatching target.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#createindex">createindex</a> ()</td> + <td class="summary"> + +Generate the dispatching index using the native file-cache based strategy.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#createtree">createtree</a> ()</td> + <td class="summary"> + +Create the dispatching tree from the index.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#dispatch">dispatch</a> (request)</td> + <td class="summary"> + +Dispatches a LuCI virtual path.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#entry">entry</a> (path, target, title, order)</td> + <td class="summary"> + +Create a new dispatching node and define common parameters.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#error404">error404</a> (message)</td> + <td class="summary"> + +Send a 404 error code and render the "error404" template if available.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#error500">error500</a> (message)</td> + <td class="summary"> + +Send a 500 error code and render the "error500" template if available.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#firstchild">firstchild</a> ()</td> + <td class="summary"> + +Alias the first (lowest order) page automatically + + </td> + </tr> + + <tr> + <td class="name" nowrap><a href="#form">form</a> (model)</td> + <td class="summary"> + +Create a CBI form model dispatching target.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#get">get</a> (...)</td> + <td class="summary"> + +Fetch or create a dispatching node without setting the target module or + +enabling the node.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#httpdispatch">httpdispatch</a> (request)</td> + <td class="summary"> + +Dispatch an HTTP request.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#modifier">modifier</a> (func, order)</td> + <td class="summary"> + +Register a tree modifier.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#node">node</a> (...)</td> + <td class="summary"> + +Fetch or create a new dispatching node.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#node_childs">node_childs</a> (node)</td> + <td class="summary"> + +Return a sorted table of visible childs within a given node + </td> + </tr> + + <tr> + <td class="name" nowrap><a href="#node_visible">node_visible</a> (node)</td> + <td class="summary"> + +Check whether a dispatch node shall be visible + </td> + </tr> + + <tr> + <td class="name" nowrap><a href="#rewrite">rewrite</a> (n, ...)</td> + <td class="summary"> + +Rewrite the first x path values of the request.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#template">template</a> (name)</td> + <td class="summary"> + +Create a template render dispatching target.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#translate">translate</a> (text)</td> + <td class="summary"> + +Access the luci.i18n translate() api.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="_"></a><strong>_</strong> ()</dt> +<dd> + + +No-op function used to mark translation entries for menu labels. + +This function does not actually translate the given argument but +is used by build/i18n-scan.pl to find translatable entries. + + + + + + + + + + +</dd> + + + + +<dt><a name="alias"></a><strong>alias</strong> (...)</dt> +<dd> + + +Create a redirect to another dispatching node. + + + +<h3>Parameters</h3> +<ul> + + <li> + ...: Virtual path destination + </li> + +</ul> + + + + + + + + +</dd> + + + + +<dt><a name="arcombine"></a><strong>arcombine</strong> (trg1, trg2)</dt> +<dd> + + +Create a combined dispatching target for non argv and argv requests. + + + +<h3>Parameters</h3> +<ul> + + <li> + trg1: Overview Target + </li> + + <li> + trg2: Detail Target + </li> + +</ul> + + + + + + + + +</dd> + + + + +<dt><a name="assign"></a><strong>assign</strong> (path, clone, title, order)</dt> +<dd> + + +Clone a node of the dispatching tree to another position. + + + +<h3>Parameters</h3> +<ul> + + <li> + path: Virtual path destination + </li> + + <li> + clone: Virtual path source + </li> + + <li> + title: Destination node title (optional) + </li> + + <li> + order: Destination node order value (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Dispatching tree node + + + +</dd> + + + + +<dt><a name="build_url"></a><strong>build_url</strong> (...)</dt> +<dd> + + +Build the URL relative to the server webroot from given virtual path. + + + +<h3>Parameters</h3> +<ul> + + <li> + ...: Virtual path + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Relative URL + + + +</dd> + + + + +<dt><a name="call"></a><strong>call</strong> (name, ...)</dt> +<dd> + + +Create a function-call dispatching target. + + + +<h3>Parameters</h3> +<ul> + + <li> + name: Target function of local controller + </li> + + <li> + ...: Additional parameters passed to the function + </li> + +</ul> + + + + + + + + +</dd> + + + + +<dt><a name="cbi"></a><strong>cbi</strong> (model)</dt> +<dd> + + +Create a CBI model dispatching target. + + + +<h3>Parameters</h3> +<ul> + + <li> + model: CBI model to be rendered + </li> + +</ul> + + + + + + + + +</dd> + + + + +<dt><a name="createindex"></a><strong>createindex</strong> ()</dt> +<dd> + + +Generate the dispatching index using the native file-cache based strategy. + + + + + + + + + + + +</dd> + + + + +<dt><a name="createtree"></a><strong>createtree</strong> ()</dt> +<dd> + + +Create the dispatching tree from the index. + +Build the index before if it does not exist yet. + + + + + + + + + + +</dd> + + + + +<dt><a name="dispatch"></a><strong>dispatch</strong> (request)</dt> +<dd> + + +Dispatches a LuCI virtual path. + + + +<h3>Parameters</h3> +<ul> + + <li> + request: Virtual path + </li> + +</ul> + + + + + + + + +</dd> + + + + +<dt><a name="entry"></a><strong>entry</strong> (path, target, title, order)</dt> +<dd> + + +Create a new dispatching node and define common parameters. + + + +<h3>Parameters</h3> +<ul> + + <li> + path: Virtual path + </li> + + <li> + target: Target function to call when dispatched. + </li> + + <li> + title: Destination node title + </li> + + <li> + order: Destination node order value (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Dispatching tree node + + + +</dd> + + + + +<dt><a name="error404"></a><strong>error404</strong> (message)</dt> +<dd> + + +Send a 404 error code and render the "error404" template if available. + + + +<h3>Parameters</h3> +<ul> + + <li> + message: Custom error message (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +false + + + +</dd> + + + + +<dt><a name="error500"></a><strong>error500</strong> (message)</dt> +<dd> + + +Send a 500 error code and render the "error500" template if available. + + + +<h3>Parameters</h3> +<ul> + + <li> + message: Custom error message (optional)# + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +false + + + +</dd> + + + + +<dt><a name="firstchild"></a><strong>firstchild</strong> ()</dt> +<dd> + + +Alias the first (lowest order) page automatically + + + + + + + + + + + +</dd> + + + + +<dt><a name="form"></a><strong>form</strong> (model)</dt> +<dd> + + +Create a CBI form model dispatching target. + + + +<h3>Parameters</h3> +<ul> + + <li> + model: CBI form model tpo be rendered + </li> + +</ul> + + + + + + + + +</dd> + + + + +<dt><a name="get"></a><strong>get</strong> (...)</dt> +<dd> + + +Fetch or create a dispatching node without setting the target module or + +enabling the node. + + +<h3>Parameters</h3> +<ul> + + <li> + ...: Virtual path + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Dispatching tree node + + + +</dd> + + + + +<dt><a name="httpdispatch"></a><strong>httpdispatch</strong> (request)</dt> +<dd> + + +Dispatch an HTTP request. + + + +<h3>Parameters</h3> +<ul> + + <li> + request: LuCI HTTP Request object + </li> + +</ul> + + + + + + + + +</dd> + + + + +<dt><a name="modifier"></a><strong>modifier</strong> (func, order)</dt> +<dd> + + +Register a tree modifier. + + + +<h3>Parameters</h3> +<ul> + + <li> + func: Modifier function + </li> + + <li> + order: Modifier order value (optional) + </li> + +</ul> + + + + + + + + +</dd> + + + + +<dt><a name="node"></a><strong>node</strong> (...)</dt> +<dd> + + +Fetch or create a new dispatching node. + + + +<h3>Parameters</h3> +<ul> + + <li> + ...: Virtual path + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Dispatching tree node + + + +</dd> + + + + +<dt><a name="node_childs"></a><strong>node_childs</strong> (node)</dt> +<dd> + + +Return a sorted table of visible childs within a given node + + + +<h3>Parameters</h3> +<ul> + + <li> + node: Dispatch node + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Ordered table of child node names + + + +</dd> + + + + +<dt><a name="node_visible"></a><strong>node_visible</strong> (node)</dt> +<dd> + + +Check whether a dispatch node shall be visible + + + +<h3>Parameters</h3> +<ul> + + <li> + node: Dispatch node + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Boolean indicating whether the node should be visible + + + +</dd> + + + + +<dt><a name="rewrite"></a><strong>rewrite</strong> (n, ...)</dt> +<dd> + + +Rewrite the first x path values of the request. + + + +<h3>Parameters</h3> +<ul> + + <li> + n: Number of path values to replace + </li> + + <li> + ...: Virtual path to replace removed path values with + </li> + +</ul> + + + + + + + + +</dd> + + + + +<dt><a name="template"></a><strong>template</strong> (name)</dt> +<dd> + + +Create a template render dispatching target. + + + +<h3>Parameters</h3> +<ul> + + <li> + name: Template to be rendered + </li> + +</ul> + + + + + + + + +</dd> + + + + +<dt><a name="translate"></a><strong>translate</strong> (text)</dt> +<dd> + + +Access the luci.i18n translate() api. + + + +<h3>Parameters</h3> +<ul> + + <li> + text: Text to translate + </li> + +</ul> + + + + + + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/luci.http.protocol.conditionals.html b/doc/modules/luci.http.protocol.conditionals.html new file mode 100644 index 000000000..e216a47df --- /dev/null +++ b/doc/modules/luci.http.protocol.conditionals.html @@ -0,0 +1,524 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li><strong>luci.http.protocol.conditionals</strong></li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Class <code>luci.http.protocol.conditionals</code></h1> + +<p></p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#if_match">if_match</a> (req, stat)</td> + <td class="summary"> + +14.24 / If-Match + +Test whether the given message object contains an "If-Match" header and +compare it against the given stat object.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#if_modified_since">if_modified_since</a> (req, stat)</td> + <td class="summary"> + +14.25 / If-Modified-Since + +Test whether the given message object contains an "If-Modified-Since" header +and compare it against the given stat object.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#if_none_match">if_none_match</a> (req, stat)</td> + <td class="summary"> + +14.26 / If-None-Match + +Test whether the given message object contains an "If-None-Match" header and +compare it against the given stat object.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#if_range">if_range</a> (req, stat)</td> + <td class="summary"> + +14.27 / If-Range + +The If-Range header is currently not implemented due to the lack of general +byte range stuff in luci.http.protocol .</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#if_unmodified_since">if_unmodified_since</a> (req, stat)</td> + <td class="summary"> + +14.28 / If-Unmodified-Since + +Test whether the given message object contains an "If-Unmodified-Since" +header and compare it against the given stat object.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#mk_etag">mk_etag</a> (stat)</td> + <td class="summary"> + +Implement 14.19 / ETag.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="if_match"></a><strong>if_match</strong> (req, stat)</dt> +<dd> + + +14.24 / If-Match + +Test whether the given message object contains an "If-Match" header and +compare it against the given stat object. + + +<h3>Parameters</h3> +<ul> + + <li> + req: HTTP request message object + </li> + + <li> + stat: A file.stat object + </li> + +</ul> + + + + + + +<h3>Return values:</h3> +<ol> + + <li>Boolean indicating whether the precondition is ok + + <li>Alternative status code if the precondition failed + +</ol> + + + +</dd> + + + + +<dt><a name="if_modified_since"></a><strong>if_modified_since</strong> (req, stat)</dt> +<dd> + + +14.25 / If-Modified-Since + +Test whether the given message object contains an "If-Modified-Since" header +and compare it against the given stat object. + + +<h3>Parameters</h3> +<ul> + + <li> + req: HTTP request message object + </li> + + <li> + stat: A file.stat object + </li> + +</ul> + + + + + + +<h3>Return values:</h3> +<ol> + + <li>Boolean indicating whether the precondition is ok + + <li>Alternative status code if the precondition failed + + <li>Table containing extra HTTP headers if the precondition failed + +</ol> + + + +</dd> + + + + +<dt><a name="if_none_match"></a><strong>if_none_match</strong> (req, stat)</dt> +<dd> + + +14.26 / If-None-Match + +Test whether the given message object contains an "If-None-Match" header and +compare it against the given stat object. + + +<h3>Parameters</h3> +<ul> + + <li> + req: HTTP request message object + </li> + + <li> + stat: A file.stat object + </li> + +</ul> + + + + + + +<h3>Return values:</h3> +<ol> + + <li>Boolean indicating whether the precondition is ok + + <li>Alternative status code if the precondition failed + + <li>Table containing extra HTTP headers if the precondition failed + +</ol> + + + +</dd> + + + + +<dt><a name="if_range"></a><strong>if_range</strong> (req, stat)</dt> +<dd> + + +14.27 / If-Range + +The If-Range header is currently not implemented due to the lack of general +byte range stuff in luci.http.protocol . This function will always return +false, 412 to indicate a failed precondition. + + +<h3>Parameters</h3> +<ul> + + <li> + req: HTTP request message object + </li> + + <li> + stat: A file.stat object + </li> + +</ul> + + + + + + +<h3>Return values:</h3> +<ol> + + <li>Boolean indicating whether the precondition is ok + + <li>Alternative status code if the precondition failed + +</ol> + + + +</dd> + + + + +<dt><a name="if_unmodified_since"></a><strong>if_unmodified_since</strong> (req, stat)</dt> +<dd> + + +14.28 / If-Unmodified-Since + +Test whether the given message object contains an "If-Unmodified-Since" +header and compare it against the given stat object. + + +<h3>Parameters</h3> +<ul> + + <li> + req: HTTP request message object + </li> + + <li> + stat: A file.stat object + </li> + +</ul> + + + + + + +<h3>Return values:</h3> +<ol> + + <li>Boolean indicating whether the precondition is ok + + <li>Alternative status code if the precondition failed + +</ol> + + + +</dd> + + + + +<dt><a name="mk_etag"></a><strong>mk_etag</strong> (stat)</dt> +<dd> + + +Implement 14.19 / ETag. + + + +<h3>Parameters</h3> +<ul> + + <li> + stat: A file.stat structure + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +String containing the generated tag suitable for ETag headers + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/luci.http.protocol.date.html b/doc/modules/luci.http.protocol.date.html new file mode 100644 index 000000000..57c7eede5 --- /dev/null +++ b/doc/modules/luci.http.protocol.date.html @@ -0,0 +1,378 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li><strong>luci.http.protocol.date</strong></li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Class <code>luci.http.protocol.date</code></h1> + +<p></p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#compare">compare</a> (d1, d2)</td> + <td class="summary"> + +Compare two dates which can either be unix epoch times or HTTP date strings.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#to_http">to_http</a> (time)</td> + <td class="summary"> + +Convert the given unix epoch time to valid HTTP date string.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#to_unix">to_unix</a> (data)</td> + <td class="summary"> + +Parse given HTTP date string and convert it to unix epoch time.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#tz_offset">tz_offset</a> (tz)</td> + <td class="summary"> + +Return the time offset in seconds between the UTC and given time zone.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="compare"></a><strong>compare</strong> (d1, d2)</dt> +<dd> + + +Compare two dates which can either be unix epoch times or HTTP date strings. + + + +<h3>Parameters</h3> +<ul> + + <li> + d1: The first date or epoch time to compare + </li> + + <li> + d2: The first date or epoch time to compare + </li> + +</ul> + + + + + + +<h3>Return values:</h3> +<ol> + + <li>-1 - if d1 is lower then d2 + + <li>0 - if both dates are equal + + <li>1 - if d1 is higher then d2 + +</ol> + + + +</dd> + + + + +<dt><a name="to_http"></a><strong>to_http</strong> (time)</dt> +<dd> + + +Convert the given unix epoch time to valid HTTP date string. + + + +<h3>Parameters</h3> +<ul> + + <li> + time: Unix epoch time + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +String containing the formatted date + + + +</dd> + + + + +<dt><a name="to_unix"></a><strong>to_unix</strong> (data)</dt> +<dd> + + +Parse given HTTP date string and convert it to unix epoch time. + + + +<h3>Parameters</h3> +<ul> + + <li> + data: String containing the date + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Unix epoch time + + + +</dd> + + + + +<dt><a name="tz_offset"></a><strong>tz_offset</strong> (tz)</dt> +<dd> + + +Return the time offset in seconds between the UTC and given time zone. + + + +<h3>Parameters</h3> +<ul> + + <li> + tz: Symbolic or numeric timezone specifier + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Time offset to UTC in seconds + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/luci.http.protocol.html b/doc/modules/luci.http.protocol.html new file mode 100644 index 000000000..b443ef58b --- /dev/null +++ b/doc/modules/luci.http.protocol.html @@ -0,0 +1,721 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li><strong>luci.http.protocol</strong></li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Class <code>luci.http.protocol</code></h1> + +<p></p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#header_source">header_source</a> (sock)</td> + <td class="summary"> + +Creates a ltn12 source from the given socket.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#mimedecode_message_body">mimedecode_message_body</a> (src, msg, filecb)</td> + <td class="summary"> + +Decode a mime encoded http message body with multipart/form-data + +Content-Type.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#parse_message_body">parse_message_body</a> (src, msg, filecb)</td> + <td class="summary"> + +Try to extract and decode a http message body from the given ltn12 source.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#parse_message_header">parse_message_header</a> (src)</td> + <td class="summary"> + +Try to extract an http message header including information like protocol + +version, message headers and resulting CGI environment variables from the +given ltn12 source.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#urldecode">urldecode</a> (str, no_plus)</td> + <td class="summary"> + +Decode an urlencoded string - optionally without decoding + +the "+" sign to " " - and return the decoded string.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#urldecode_message_body">urldecode_message_body</a> (src, msg)</td> + <td class="summary"> + +Decode an urlencoded http message body with application/x-www-urlencoded + +Content-Type.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#urldecode_params">urldecode_params</a> (url, tbl)</td> + <td class="summary"> + +Extract and split urlencoded data pairs, separated bei either "&" or ";" + +from given url or string.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#urlencode">urlencode</a> (str)</td> + <td class="summary"> + +Encode given string to x-www-urlencoded format.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#urlencode_params">urlencode_params</a> (tbl)</td> + <td class="summary"> + +Encode each key-value-pair in given table to x-www-urlencoded format, + +separated by "&".</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="header_source"></a><strong>header_source</strong> (sock)</dt> +<dd> + + +Creates a ltn12 source from the given socket. The source will return it's + +data line by line with the trailing \r\n stripped of. + + +<h3>Parameters</h3> +<ul> + + <li> + sock: Readable network socket + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Ltn12 source function + + + +</dd> + + + + +<dt><a name="mimedecode_message_body"></a><strong>mimedecode_message_body</strong> (src, msg, filecb)</dt> +<dd> + + +Decode a mime encoded http message body with multipart/form-data + +Content-Type. Stores all extracted data associated with its parameter name +in the params table withing the given message object. Multiple parameter +values are stored as tables, ordinary ones as strings. +If an optional file callback function is given then it is feeded with the +file contents chunk by chunk and only the extracted file name is stored +within the params table. The callback function will be called subsequently +with three arguments: + o Table containing decoded (name, file) and raw (headers) mime header data + o String value containing a chunk of the file data + o Boolean which indicates wheather the current chunk is the last one (eof) + + +<h3>Parameters</h3> +<ul> + + <li> + src: Ltn12 source function + </li> + + <li> + msg: HTTP message object + </li> + + <li> + filecb: File callback function (optional) + </li> + +</ul> + + + + + + +<h3>Return values:</h3> +<ol> + + <li>Value indicating successful operation (not nil means "ok") + + <li>String containing the error if unsuccessful + +</ol> + + + +<h3>See also:</h3> +<ul> + + <li><a href="#parse_message_header"> + parse_message_header + </a> + +</ul> + +</dd> + + + + +<dt><a name="parse_message_body"></a><strong>parse_message_body</strong> (src, msg, filecb)</dt> +<dd> + + +Try to extract and decode a http message body from the given ltn12 source. + +This function will examine the Content-Type within the given message object +to select the appropriate content decoder. +Currently the application/x-www-urlencoded and application/form-data +mime types are supported. If the encountered content encoding can't be +handled then the whole message body will be stored unaltered as "content" +property within the given message object. + + +<h3>Parameters</h3> +<ul> + + <li> + src: Ltn12 source function + </li> + + <li> + msg: HTTP message object + </li> + + <li> + filecb: File data callback (optional, see mimedecode_message_body()) + </li> + +</ul> + + + + + + +<h3>Return values:</h3> +<ol> + + <li>Value indicating successful operation (not nil means "ok") + + <li>String containing the error if unsuccessful + +</ol> + + + +<h3>See also:</h3> +<ul> + + <li><a href="#parse_message_header"> + parse_message_header + </a> + +</ul> + +</dd> + + + + +<dt><a name="parse_message_header"></a><strong>parse_message_header</strong> (src)</dt> +<dd> + + +Try to extract an http message header including information like protocol + +version, message headers and resulting CGI environment variables from the +given ltn12 source. + + +<h3>Parameters</h3> +<ul> + + <li> + src: Ltn12 source function + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +HTTP message object + + + +<h3>See also:</h3> +<ul> + + <li><a href="#parse_message_body"> + parse_message_body + </a> + +</ul> + +</dd> + + + + +<dt><a name="urldecode"></a><strong>urldecode</strong> (str, no_plus)</dt> +<dd> + + +Decode an urlencoded string - optionally without decoding + +the "+" sign to " " - and return the decoded string. + + +<h3>Parameters</h3> +<ul> + + <li> + str: Input string in x-www-urlencoded format + </li> + + <li> + no_plus: Don't decode "+" signs to spaces + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +The decoded string + + + +<h3>See also:</h3> +<ul> + + <li><a href="#urlencode"> + urlencode + </a> + +</ul> + +</dd> + + + + +<dt><a name="urldecode_message_body"></a><strong>urldecode_message_body</strong> (src, msg)</dt> +<dd> + + +Decode an urlencoded http message body with application/x-www-urlencoded + +Content-Type. Stores all extracted data associated with its parameter name +in the params table withing the given message object. Multiple parameter +values are stored as tables, ordinary ones as strings. + + +<h3>Parameters</h3> +<ul> + + <li> + src: Ltn12 source function + </li> + + <li> + msg: HTTP message object + </li> + +</ul> + + + + + + +<h3>Return values:</h3> +<ol> + + <li>Value indicating successful operation (not nil means "ok") + + <li>String containing the error if unsuccessful + +</ol> + + + +<h3>See also:</h3> +<ul> + + <li><a href="#parse_message_header"> + parse_message_header + </a> + +</ul> + +</dd> + + + + +<dt><a name="urldecode_params"></a><strong>urldecode_params</strong> (url, tbl)</dt> +<dd> + + +Extract and split urlencoded data pairs, separated bei either "&" or ";" + +from given url or string. Returns a table with urldecoded values. +Simple parameters are stored as string values associated with the parameter +name within the table. Parameters with multiple values are stored as array +containing the corresponding values. + + +<h3>Parameters</h3> +<ul> + + <li> + url: The url or string which contains x-www-urlencoded form data + </li> + + <li> + tbl: Use the given table for storing values (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Table containing the urldecoded parameters + + + +<h3>See also:</h3> +<ul> + + <li><a href="#urlencode_params"> + urlencode_params + </a> + +</ul> + +</dd> + + + + +<dt><a name="urlencode"></a><strong>urlencode</strong> (str)</dt> +<dd> + + +Encode given string to x-www-urlencoded format. + + + +<h3>Parameters</h3> +<ul> + + <li> + str: String to encode + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +String containing the encoded data + + + +<h3>See also:</h3> +<ul> + + <li><a href="#urldecode"> + urldecode + </a> + +</ul> + +</dd> + + + + +<dt><a name="urlencode_params"></a><strong>urlencode_params</strong> (tbl)</dt> +<dd> + + +Encode each key-value-pair in given table to x-www-urlencoded format, + +separated by "&". Tables are encoded as parameters with multiple values by +repeating the parameter name with each value. + + +<h3>Parameters</h3> +<ul> + + <li> + tbl: Table with the values + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +String containing encoded values + + + +<h3>See also:</h3> +<ul> + + <li><a href="#urldecode_params"> + urldecode_params + </a> + +</ul> + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/luci.http.protocol.mime.html b/doc/modules/luci.http.protocol.mime.html new file mode 100644 index 000000000..96b594d2d --- /dev/null +++ b/doc/modules/luci.http.protocol.mime.html @@ -0,0 +1,294 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li><strong>luci.http.protocol.mime</strong></li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Class <code>luci.http.protocol.mime</code></h1> + +<p></p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#to_ext">to_ext</a> (mimetype)</td> + <td class="summary"> + +Return corresponding extension for a given mime type or nil if the + +given mime-type is unknown.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#to_mime">to_mime</a> (filename)</td> + <td class="summary"> + +Extract extension from a filename and return corresponding mime-type or + +"application/octet-stream" if the extension is unknown.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="to_ext"></a><strong>to_ext</strong> (mimetype)</dt> +<dd> + + +Return corresponding extension for a given mime type or nil if the + +given mime-type is unknown. + + +<h3>Parameters</h3> +<ul> + + <li> + mimetype: The mimetype to retrieve the extension from + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +String with the extension or nil for unknown type + + + +</dd> + + + + +<dt><a name="to_mime"></a><strong>to_mime</strong> (filename)</dt> +<dd> + + +Extract extension from a filename and return corresponding mime-type or + +"application/octet-stream" if the extension is unknown. + + +<h3>Parameters</h3> +<ul> + + <li> + filename: The filename for which the mime type is guessed + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +String containign the determined mime type + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/luci.i18n.html b/doc/modules/luci.i18n.html new file mode 100644 index 000000000..2db6e168f --- /dev/null +++ b/doc/modules/luci.i18n.html @@ -0,0 +1,532 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li><strong>luci.i18n</strong></li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Class <code>luci.i18n</code></h1> + +<p></p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#clear">clear</a> ()</td> + <td class="summary"> + +Clear the translation table.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#load">load</a> (file, lang, force)</td> + <td class="summary"> + +Load a translation and copy its data into the translation table.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#loadc">loadc</a> (file, force)</td> + <td class="summary"> + +Load a translation file using the default translation language.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#setlanguage">setlanguage</a> (lang)</td> + <td class="summary"> + +Set the context default translation language.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#string">string</a> (key)</td> + <td class="summary"> + +Return the translated value for a specific translation key + +and ensure that the returned value is a Lua string value.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#stringf">stringf</a> (key, ...)</td> + <td class="summary"> + +Return the translated value for a specific translation key and use it as sprintf pattern.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#translate">translate</a> (key)</td> + <td class="summary"> + +Return the translated value for a specific translation key.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#translatef">translatef</a> (key, ...)</td> + <td class="summary"> + +Return the translated value for a specific translation key and use it as sprintf pattern.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="clear"></a><strong>clear</strong> ()</dt> +<dd> + + +Clear the translation table. + + + + + + + + + + + +</dd> + + + + +<dt><a name="load"></a><strong>load</strong> (file, lang, force)</dt> +<dd> + + +Load a translation and copy its data into the translation table. + + + +<h3>Parameters</h3> +<ul> + + <li> + file: Language file + </li> + + <li> + lang: Two-letter language code + </li> + + <li> + force: Force reload even if already loaded (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Success status + + + +</dd> + + + + +<dt><a name="loadc"></a><strong>loadc</strong> (file, force)</dt> +<dd> + + +Load a translation file using the default translation language. + +Alternatively load the translation of the fallback language. + + +<h3>Parameters</h3> +<ul> + + <li> + file: Language file + </li> + + <li> + force: Force reload even if already loaded (optional) + </li> + +</ul> + + + + + + + + +</dd> + + + + +<dt><a name="setlanguage"></a><strong>setlanguage</strong> (lang)</dt> +<dd> + + +Set the context default translation language. + + + +<h3>Parameters</h3> +<ul> + + <li> + lang: Two-letter language code + </li> + +</ul> + + + + + + + + +</dd> + + + + +<dt><a name="string"></a><strong>string</strong> (key)</dt> +<dd> + + +Return the translated value for a specific translation key + +and ensure that the returned value is a Lua string value. +This is the same as calling <code>tostring(translate(...))</code> + + +<h3>Parameters</h3> +<ul> + + <li> + key: Default translation text + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Translated string + + + +</dd> + + + + +<dt><a name="stringf"></a><strong>stringf</strong> (key, ...)</dt> +<dd> + + +Return the translated value for a specific translation key and use it as sprintf pattern. + +Ensure that the returned value is a Lua string value. +This is the same as calling <code>tostring(translatef(...))</code> + + +<h3>Parameters</h3> +<ul> + + <li> + key: Default translation text + </li> + + <li> + ...: Format parameters + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Translated and formatted string + + + +</dd> + + + + +<dt><a name="translate"></a><strong>translate</strong> (key)</dt> +<dd> + + +Return the translated value for a specific translation key. + + + +<h3>Parameters</h3> +<ul> + + <li> + key: Default translation text + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Translated string + + + +</dd> + + + + +<dt><a name="translatef"></a><strong>translatef</strong> (key, ...)</dt> +<dd> + + +Return the translated value for a specific translation key and use it as sprintf pattern. + + + +<h3>Parameters</h3> +<ul> + + <li> + key: Default translation text + </li> + + <li> + ...: Format parameters + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Translated and formatted string + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/luci.ip.cidr.html b/doc/modules/luci.ip.cidr.html new file mode 100644 index 000000000..2bd3400b5 --- /dev/null +++ b/doc/modules/luci.ip.cidr.html @@ -0,0 +1,1237 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li><strong>luci.ip.cidr</strong></li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Object Instance <code>luci.ip.cidr</code></h1> + +<p> + IP CIDR Object. + Represents an IPv4 or IPv6 address range.</p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#cidr.is4">cidr:is4</a> ()</td> + <td class="summary"> + +Checks whether the CIDR instance is an IPv4 address range + </td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cidr.is4rfc1918">cidr:is4rfc1918</a> ()</td> + <td class="summary"> + +Checks whether the CIDR instance is within the private RFC1918 address space + </td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cidr.is4linklocal">cidr:is4linklocal</a> ()</td> + <td class="summary"> + +Checks whether the CIDR instance is an IPv4 link local (Zeroconf) address + </td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cidr.is6">cidr:is6</a> ()</td> + <td class="summary"> + +Checks whether the CIDR instance is an IPv6 address range + </td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cidr.is6linklocal">cidr:is6linklocal</a> ()</td> + <td class="summary"> + +Checks whether the CIDR instance is an IPv6 link local address + </td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cidr.is6mapped4">cidr:is6mapped4</a> ()</td> + <td class="summary"> + +Checks whether the CIDR instance is an IPv6 mapped IPv4 address + </td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cidr.lower">cidr:lower</a> (addr)</td> + <td class="summary"> + +Checks whether this CIDR instance is lower than the given argument.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cidr.higher">cidr:higher</a> (addr)</td> + <td class="summary"> + +Checks whether this CIDR instance is higher than the given argument.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cidr.equal">cidr:equal</a> (addr)</td> + <td class="summary"> + +Checks whether this CIDR instance is equal to the given argument.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cidr.prefix">cidr:prefix</a> (mask)</td> + <td class="summary"> + +Get or set prefix size of CIDR instance.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cidr.network">cidr:network</a> (mask)</td> + <td class="summary"> + +Derive network address of CIDR instance.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cidr.host">cidr:host</a> ()</td> + <td class="summary"> + +Derive host address of CIDR instance.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cidr.mask">cidr:mask</a> (mask)</td> + <td class="summary"> + +Derive netmask of CIDR instance.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cidr.broadcast">cidr:broadcast</a> (mask)</td> + <td class="summary"> + +Derive broadcast address of CIDR instance.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cidr.mapped4">cidr:mapped4</a> ()</td> + <td class="summary"> + +Derive mapped IPv4 address of CIDR instance.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cidr.contains">cidr:contains</a> (addr)</td> + <td class="summary"> + +Test whether CIDR contains given range.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cidr.add">cidr:add</a> (amount, inplace)</td> + <td class="summary"> + +Add given amount to CIDR instance.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cidr.sub">cidr:sub</a> (amount, inplace)</td> + <td class="summary"> + +Substract given amount from CIDR instance.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cidr.minhost">cidr:minhost</a> ()</td> + <td class="summary"> + +Calculate the lowest possible host address within this CIDR instance.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cidr.maxhost">cidr:maxhost</a> ()</td> + <td class="summary"> + +Calculate the highest possible host address within this CIDR instance.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cidr.string">cidr:string</a> ()</td> + <td class="summary"> + +Convert CIDR instance into string representation.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="cidr.is4"></a><strong>cidr:is4</strong> ()</dt> +<dd> + + +Checks whether the CIDR instance is an IPv4 address range + + + + + + + + +<h3>Return value:</h3> +<code>true</code> if the CIDR is an IPv4 range, else <code>false</code> + + + +<h3>See also:</h3> +<ul> + + <li><a href="#cidr.is6"> + cidr:is6 + </a> + +</ul> + +</dd> + + + + +<dt><a name="cidr.is4rfc1918"></a><strong>cidr:is4rfc1918</strong> ()</dt> +<dd> + + +Checks whether the CIDR instance is within the private RFC1918 address space + + + + + + +<h3>Usage:</h3> +<pre>local addr = luci.ip.new("192.168.45.2/24") +if addr:is4rfc1918() then + print("Is a private address") +end</pre> + + + +<h3>Return value:</h3> +<code>true</code> if the entire range of this CIDR lies within one of + the ranges <code>10.0.0.0-10.255.255.255</code>, + <code>172.16.0.0-172.31.0.0</code> or + <code>192.168.0.0-192.168.255.255</code>, else <code>false</code>. + + + +</dd> + + + + +<dt><a name="cidr.is4linklocal"></a><strong>cidr:is4linklocal</strong> ()</dt> +<dd> + + +Checks whether the CIDR instance is an IPv4 link local (Zeroconf) address + + + + + + +<h3>Usage:</h3> +<pre>local addr = luci.ip.new("169.254.34.125") +if addr:is4linklocal() then + print("Is a zeroconf address") +end</pre> + + + +<h3>Return value:</h3> +<code>true</code> if the entire range of this CIDR lies within the range + the range <code>169.254.0.0-169.254.255.255</code>, else <code>false</code>. + + + +</dd> + + + + +<dt><a name="cidr.is6"></a><strong>cidr:is6</strong> ()</dt> +<dd> + + +Checks whether the CIDR instance is an IPv6 address range + + + + + + + + +<h3>Return value:</h3> +<code>true</code> if the CIDR is an IPv6 range, else <code>false</code> + + + +<h3>See also:</h3> +<ul> + + <li><a href="#cidr.is4"> + cidr:is4 + </a> + +</ul> + +</dd> + + + + +<dt><a name="cidr.is6linklocal"></a><strong>cidr:is6linklocal</strong> ()</dt> +<dd> + + +Checks whether the CIDR instance is an IPv6 link local address + + + + + + +<h3>Usage:</h3> +<pre>local addr = luci.ip.new("fe92:53a:3216:af01:221:63ff:fe75:aa17/64") +if addr:is6linklocal() then + print("Is a linklocal address") +end</pre> + + + +<h3>Return value:</h3> +<code>true</code> if the entire range of this CIDR lies within the range + the <code>fe80::/10</code> range, else <code>false</code>. + + + +</dd> + + + + +<dt><a name="cidr.is6mapped4"></a><strong>cidr:is6mapped4</strong> ()</dt> +<dd> + + +Checks whether the CIDR instance is an IPv6 mapped IPv4 address + + + + + + +<h3>Usage:</h3> +<pre>local addr = luci.ip.new("::ffff:192.168.1.1") +if addr:is6mapped4() then + print("Is a mapped IPv4 address") +end</pre> + + + +<h3>Return value:</h3> +<code>true</code> if the address is an IPv6 mapped IPv4 address in the + form <code>::ffff:1.2.3.4</code>. + + + +</dd> + + + + +<dt><a name="cidr.lower"></a><strong>cidr:lower</strong> (addr)</dt> +<dd> + + +Checks whether this CIDR instance is lower than the given argument. +The comparisation follows these rules: +<ul><li>An IPv4 address is always lower than an IPv6 address</li> +<li>Prefix sizes are ignored</li></ul> + + + +<h3>Parameters</h3> +<ul> + + <li> + addr: A <code>luci.ip.cidr</code> instance or a string convertable by + <code>luci.ip.new()</code> to compare against. + </li> + +</ul> + + + + +<h3>Usage:</h3> +<pre>local addr = luci.ip.new("192.168.1.1") +print(addr:lower(addr)) -- false +print(addr:lower("10.10.10.10/24")) -- false +print(addr:lower(luci.ip.new("::1"))) -- true +print(addr:lower(luci.ip.new("192.168.200.1"))) -- true</pre> + + + +<h3>Return value:</h3> +<code>true</code> if this CIDR is lower than the given address, + else <code>false</code>. + + + +<h3>See also:</h3> +<ul> + + <li><a href="#cidr.higher"> + cidr:higher + </a> + + <li><a href="#cidr.equal"> + cidr:equal + </a> + +</ul> + +</dd> + + + + +<dt><a name="cidr.higher"></a><strong>cidr:higher</strong> (addr)</dt> +<dd> + + +Checks whether this CIDR instance is higher than the given argument. +The comparisation follows these rules: +<ul><li>An IPv4 address is always lower than an IPv6 address</li> +<li>Prefix sizes are ignored</li></ul> + + + +<h3>Parameters</h3> +<ul> + + <li> + addr: A <code>luci.ip.cidr</code> instance or a string convertable by + <code>luci.ip.new()</code> to compare against. + </li> + +</ul> + + + + +<h3>Usage:</h3> +<pre>local addr = luci.ip.new("192.168.1.1") +print(addr:higher(addr)) -- false +print(addr:higher("10.10.10.10/24")) -- true +print(addr:higher(luci.ip.new("::1"))) -- false +print(addr:higher(luci.ip.new("192.168.200.1"))) -- false</pre> + + + +<h3>Return value:</h3> +<code>true</code> if this CIDR is higher than the given address, + else <code>false</code>. + + + +<h3>See also:</h3> +<ul> + + <li><a href="#cidr.lower"> + cidr:lower + </a> + + <li><a href="#cidr.equal"> + cidr:equal + </a> + +</ul> + +</dd> + + + + +<dt><a name="cidr.equal"></a><strong>cidr:equal</strong> (addr)</dt> +<dd> + + +Checks whether this CIDR instance is equal to the given argument. + + + +<h3>Parameters</h3> +<ul> + + <li> + addr: A <code>luci.ip.cidr</code> instance or a string convertable by + <code>luci.ip.new()</code> to compare against. + </li> + +</ul> + + + + +<h3>Usage:</h3> +<pre>local addr = luci.ip.new("192.168.1.1") +print(addr:equal(addr)) -- true +print(addr:equal("192.168.1.1")) -- true +print(addr:equal(luci.ip.new("::1"))) -- false + +local addr6 = luci.ip.new("::1") +print(addr6:equal("0:0:0:0:0:0:0:1/64")) -- true +print(addr6:equal(luci.ip.new("fe80::221:63ff:fe75:aa17"))) -- false</pre> + + + +<h3>Return value:</h3> +<code>true</code> if this CIDR is equal to the given address, + else <code>false</code>. + + + +<h3>See also:</h3> +<ul> + + <li><a href="#cidr.lower"> + cidr:lower + </a> + + <li><a href="#cidr.higher"> + cidr:higher + </a> + +</ul> + +</dd> + + + + +<dt><a name="cidr.prefix"></a><strong>cidr:prefix</strong> (mask)</dt> +<dd> + + +Get or set prefix size of CIDR instance. +If the optional mask parameter is given, the prefix size of this CIDR is altered +else the current prefix size is returned. + + + +<h3>Parameters</h3> +<ul> + + <li> + mask: Either a number containing the number of bits (<code>0..32</code> + for IPv4, <code>0..128</code> for IPv6) or a string containing a valid + netmask (optional) + </li> + +</ul> + + + + +<h3>Usage:</h3> +<pre>local range = luci.ip.new("192.168.1.1/255.255.255.0") +print(range:prefix()) -- 24 + +range:prefix(16) +print(range:prefix()) -- 16 + +range:prefix("255.255.255.255") +print(range:prefix()) -- 32</pre> + + + +<h3>Return value:</h3> +Bit count of the current prefix size + + + +</dd> + + + + +<dt><a name="cidr.network"></a><strong>cidr:network</strong> (mask)</dt> +<dd> + + +Derive network address of CIDR instance. + +Returns a new CIDR instance representing the network address of this instance +with all host parts masked out. The used prefix size can be overridden by the +optional mask parameter. + + + +<h3>Parameters</h3> +<ul> + + <li> + mask: Either a number containing the number of bits (<code>0..32</code> + for IPv4, <code>0..128</code> for IPv6) or a string containing a valid + netmask (optional) + </li> + +</ul> + + + + +<h3>Usage:</h3> +<pre>local range = luci.ip.new("192.168.62.243/255.255.0.0") +print(range:network()) -- "192.168.0.0" +print(range:network(24)) -- "192.168.62.0" +print(range:network("255.255.255.0")) -- "192.168.62.0" + +local range6 = luci.ip.new("fd9b:62b3:9cc5:0:221:63ff:fe75:aa17/64") +print(range6:network()) -- "fd9b:62b3:9cc5::"</pre> + + + +<h3>Return value:</h3> +CIDR instance representing the network address + + + +</dd> + + + + +<dt><a name="cidr.host"></a><strong>cidr:host</strong> ()</dt> +<dd> + + +Derive host address of CIDR instance. + +This function essentially constructs a copy of this CIDR with the prefix size +set to <code>32</code> for IPv4 and <code>128</code> for IPv6. + + + + + + +<h3>Usage:</h3> +<pre>local range = luci.ip.new("172.19.37.45/16") +print(range) -- "172.19.37.45/16" +print(range:host()) -- "172.19.37.45"</pre> + + + +<h3>Return value:</h3> +CIDR instance representing the host address + + + +</dd> + + + + +<dt><a name="cidr.mask"></a><strong>cidr:mask</strong> (mask)</dt> +<dd> + + +Derive netmask of CIDR instance. + +Constructs a CIDR instance representing the netmask of this instance. The used +prefix size can be overridden by the optional mask parameter. + + + +<h3>Parameters</h3> +<ul> + + <li> + mask: Either a number containing the number of bits (<code>0..32</code> + for IPv4, <code>0..128</code> for IPv6) or a string containing a valid + netmask (optional) + </li> + +</ul> + + + + +<h3>Usage:</h3> +<pre>local range = luci.ip.new("172.19.37.45/16") +print(range:mask()) -- "255.255.0.0" +print(range:mask(24)) -- "255.255.255.0" +print(range:mask("255.0.0.0")) -- "255.0.0.0"</pre> + + + +<h3>Return value:</h3> +CIDR instance representing the netmask + + + +</dd> + + + + +<dt><a name="cidr.broadcast"></a><strong>cidr:broadcast</strong> (mask)</dt> +<dd> + + +Derive broadcast address of CIDR instance. + +Constructs a CIDR instance representing the broadcast address of this instance. +The used prefix size can be overridden by the optional mask parameter. + +This function has no effect on IPv6 instances, it will return nothing in this +case. + + + +<h3>Parameters</h3> +<ul> + + <li> + mask: Either a number containing the number of bits (<code>0..32</code> + for IPv4, <code>0..128</code> for IPv6) or a string containing a valid + netmask (optional) + </li> + +</ul> + + + + +<h3>Usage:</h3> +<pre>local range = luci.ip.new("172.19.37.45/16") +print(range:broadcast()) -- "172.19.255.255" +print(range:broadcast(24)) -- "172.19.37.255" +print(range:broadcast("255.0.0.0")) -- "172.255.255.255"</pre> + + + +<h3>Return value:</h3> +Return a new CIDR instance representing the broadcast address if this + instance is an IPv4 range, else return nothing. + + + +</dd> + + + + +<dt><a name="cidr.mapped4"></a><strong>cidr:mapped4</strong> ()</dt> +<dd> + + +Derive mapped IPv4 address of CIDR instance. + +Constructs a CIDR instance representing the IPv4 address of the IPv6 mapped +IPv4 address in this instance. + +This function has no effect on IPv4 instances or IPv6 instances which are not a +mapped address, it will return nothing in this case. + + + + + + +<h3>Usage:</h3> +<pre>local addr = luci.ip.new("::ffff:172.16.19.1") +print(addr:mapped4()) -- "172.16.19.1"</pre> + + + +<h3>Return value:</h3> +Return a new CIDR instance representing the IPv4 address if this + instance is an IPv6 mapped IPv4 address, else return nothing. + + + +</dd> + + + + +<dt><a name="cidr.contains"></a><strong>cidr:contains</strong> (addr)</dt> +<dd> + + +Test whether CIDR contains given range. + + + +<h3>Parameters</h3> +<ul> + + <li> + addr: A <code>luci.ip.cidr</code> instance or a string convertable by + <code>luci.ip.new()</code> to test. + </li> + +</ul> + + + + +<h3>Usage:</h3> +<pre>local range = luci.ip.new("10.24.0.0/255.255.0.0") +print(range:contains("10.24.5.1")) -- true +print(range:contains("::1")) -- false +print(range:contains("10.0.0.0/8")) -- false + +local range6 = luci.ip.new("fe80::/10") +print(range6:contains("fe80::221:63f:fe75:aa17/64")) -- true +print(range6:contains("fd9b:6b3:c5:0:221:63f:fe75:aa17/64")) -- false</pre> + + + +<h3>Return value:</h3> +<code>true</code> if this instance fully contains the given address else + <code>false</code>. + + + +</dd> + + + + +<dt><a name="cidr.add"></a><strong>cidr:add</strong> (amount, inplace)</dt> +<dd> + + +Add given amount to CIDR instance. If the result would overflow the maximum +address space, the result is set to the highest possible address. + + + +<h3>Parameters</h3> +<ul> + + <li> + amount: A numeric value between 0 and 0xFFFFFFFF, a + <code>luci.ip.cidr</code> instance or a string convertable by + <code>luci.ip.new()</code>. + </li> + + <li> + inplace: If <code>true</code>, modify this instance instead of returning + a new derived CIDR instance. + </li> + +</ul> + + + + +<h3>Usage:</h3> +<pre>local addr = luci.ip.new("192.168.1.1/24") +print(addr:add(250)) -- "192.168.1.251/24" +print(addr:add("0.0.99.0")) -- "192.168.100.1/24" + +addr:add(256, true) -- true +print(addr) -- "192.168.2.1/24 + +addr:add("255.0.0.0", true) -- false (overflow) +print(addr) -- "255.255.255.255/24 + +local addr6 = luci.ip.new("fe80::221:63f:fe75:aa17/64") +print(addr6:add(256)) -- "fe80::221:63f:fe75:ab17/64" +print(addr6:add("::ffff:0")) -- "fe80::221:640:fe74:aa17/64" + +addr:add(256, true) -- true +print(addr) -- "fe80::221:63f:fe75:ab17/64 + +addr:add("ffff::", true) -- false (overflow) +print(addr) -- "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/64"</pre> + + + +<h3>Return value:</h3> +<ul> + <li>When adding inplace: Return <code>true</code> if the addition succeded + or <code>false</code> when the addition overflowed.</li> + <li>When deriving new CIDR: Return new instance representing the value of + this instance plus the added amount or the highest possible address if + the addition overflowed the available address space.</li></ul> + + + +</dd> + + + + +<dt><a name="cidr.sub"></a><strong>cidr:sub</strong> (amount, inplace)</dt> +<dd> + + +Substract given amount from CIDR instance. If the result would under, the lowest +possible address is returned. + + + +<h3>Parameters</h3> +<ul> + + <li> + amount: A numeric value between 0 and 0xFFFFFFFF, a + <code>luci.ip.cidr</code> instance or a string convertable by + <code>luci.ip.new()</code>. + </li> + + <li> + inplace: If <code>true</code>, modify this instance instead of returning + a new derived CIDR instance. + </li> + +</ul> + + + + +<h3>Usage:</h3> +<pre>local addr = luci.ip.new("192.168.1.1/24") +print(addr:sub(256)) -- "192.168.0.1/24" +print(addr:sub("0.168.0.0")) -- "192.0.1.1/24" + +addr:sub(256, true) -- true +print(addr) -- "192.168.0.1/24 + +addr:sub("255.0.0.0", true) -- false (underflow) +print(addr) -- "0.0.0.0/24 + +local addr6 = luci.ip.new("fe80::221:63f:fe75:aa17/64") +print(addr6:sub(256)) -- "fe80::221:63f:fe75:a917/64" +print(addr6:sub("::ffff:0")) -- "fe80::221:63e:fe76:aa17/64" + +addr:sub(256, true) -- true +print(addr) -- "fe80::221:63f:fe75:a917/64" + +addr:sub("ffff::", true) -- false (underflow) +print(addr) -- "::/64"</pre> + + + +<h3>Return value:</h3> +<ul> + <li>When substracting inplace: Return <code>true</code> if the substraction + succeded or <code>false</code> when the substraction underflowed.</li> + <li>When deriving new CIDR: Return new instance representing the value of + this instance minus the substracted amount or the lowest address if + the substraction underflowed.</li></ul> + + + +</dd> + + + + +<dt><a name="cidr.minhost"></a><strong>cidr:minhost</strong> ()</dt> +<dd> + + +Calculate the lowest possible host address within this CIDR instance. + + + + + + +<h3>Usage:</h3> +<pre>local addr = luci.ip.new("192.168.123.56/24") +print(addr:minhost()) -- "192.168.123.1" + +local addr6 = luci.ip.new("fd9b:62b3:9cc5:0:221:63ff:fe75:aa17/64") +print(addr6:minhost()) -- "fd9b:62b3:9cc5::1"</pre> + + + +<h3>Return value:</h3> +Returns a new CIDR instance representing the lowest host address + within this range. + + + +</dd> + + + + +<dt><a name="cidr.maxhost"></a><strong>cidr:maxhost</strong> ()</dt> +<dd> + + +Calculate the highest possible host address within this CIDR instance. + + + + + + +<h3>Usage:</h3> +<pre>local addr = luci.ip.new("192.168.123.56/24") +print(addr:maxhost()) -- "192.168.123.254" (.255 is broadcast) + +local addr6 = luci.ip.new("fd9b:62b3:9cc5:0:221:63ff:fe75:aa17/64") +print(addr6:maxhost()) -- "fd9b:62b3:9cc5:0:ffff:ffff:ffff:ffff"</pre> + + + +<h3>Return value:</h3> +Returns a new CIDR instance representing the highest host address + within this range. + + + +</dd> + + + + +<dt><a name="cidr.string"></a><strong>cidr:string</strong> ()</dt> +<dd> + + +Convert CIDR instance into string representation. + +If the prefix size of instance is less than 32 for IPv4 or 128 for IPv6, the +address is returned in the form "address/prefix" otherwise just "address". + +It is usually not required to call this function directly as CIDR objects +define it as __tostring function in the associated metatable. + + + + + + + + +<h3>Return value:</h3> +Returns a string representing the range or address of this CIDR instance + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/luci.ip.html b/doc/modules/luci.ip.html new file mode 100644 index 000000000..8a78da204 --- /dev/null +++ b/doc/modules/luci.ip.html @@ -0,0 +1,902 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li><strong>luci.ip</strong></li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Class <code>luci.ip</code></h1> + +<p> + LuCI IP calculation and netlink access library.</p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#new">new</a> (address, netmask)</td> + <td class="summary"> + +Construct a new luci.ip.cidr instance and autodetect the address family.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#IPv4">IPv4</a> (address, netmask)</td> + <td class="summary"> + +Construct a new IPv4 luci.ip.cidr instance.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#IPv6">IPv6</a> (address, netmask)</td> + <td class="summary"> + +Construct a new IPv6 luci.ip.cidr instance.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#route">route</a> (address)</td> + <td class="summary"> + +Determine the route leading to the given destination.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#routes">routes</a> (filter, callback)</td> + <td class="summary"> + +Fetch all routes, optionally matching the given criteria.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#neighbors">neighbors</a> (filter, callback)</td> + <td class="summary"> + +Fetches entries from the IPv4 ARP and IPv6 neighbour kernel table </td> + </tr> + + <tr> + <td class="name" nowrap><a href="#link">link</a> (device)</td> + <td class="summary"> + +Fetch basic device information </td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="new"></a><strong>new</strong> (address, netmask)</dt> +<dd> + + +Construct a new luci.ip.cidr instance and autodetect the address family. +Throws an error if the given strings do not represent a valid address or +if the given optional netmask is of a different family. + + +<h3>Parameters</h3> +<ul> + + <li> + address: String containing a valid IPv4 or IPv6 address, optionally +with prefix size (CIDR notation) or netmask separated by slash. + </li> + + <li> + netmask: String containing a valid IPv4 or IPv6 netmask or number +containing a prefix size in bits (<code>0..32</code> for IPv4, +<code>0..128</code> for IPv6). Overrides mask embedded in the first argument +if specified. (optional) + </li> + +</ul> + + + + +<h3>Usage:</h3> +<pre>addr = luci.ip.new("10.24.0.1/24") +addr = luci.ip.new("10.24.0.1/255.255.255.0") +addr = luci.ip.new("10.24.0.1", "255.255.255.0") -- separate netmask +addr = luci.ip.new("10.24.0.1/24", 16) -- override netmask + +addr6 = luci.ip.new("fe80::221:63ff:fe75:aa17/64") +addr6 = luci.ip.new("fe80::221:63ff:fe75:aa17/ffff:ffff:ffff:ffff::") +addr6 = luci.ip.new("fe80::221:63ff:fe75:aa17", "ffff:ffff:ffff:ffff::") +addr6 = luci.ip.new("fe80::221:63ff:fe75:aa17/64", 128) -- override netmask</pre> + + + +<h3>Return value:</h3> +A <code>luci.ip.cidr</code> object representing the given +address/mask range. + + + +<h3>See also:</h3> +<ul> + + <li><a href="#IPv4"> + IPv4 + </a> + + <li><a href="#IPv6"> + IPv6 + </a> + +</ul> + +</dd> + + + + +<dt><a name="IPv4"></a><strong>IPv4</strong> (address, netmask)</dt> +<dd> + + +Construct a new IPv4 luci.ip.cidr instance. +Throws an error if the given string does not represent a valid IPv4 address or +if the given optional netmask is of a different family. + + +<h3>Parameters</h3> +<ul> + + <li> + address: String containing a valid IPv4, optionally with prefix size +(CIDR notation) or netmask separated by slash. + </li> + + <li> + netmask: String containing a valid IPv4 netmask or number +containing a prefix size between <code>0</code> and <code>32</code> bit. +Overrides mask embedded in the first argument if specified. (optional) + </li> + +</ul> + + + + +<h3>Usage:</h3> +<pre>addr = luci.ip.new("10.24.0.1/24") +addr = luci.ip.new("10.24.0.1/255.255.255.0") +addr = luci.ip.new("10.24.0.1", "255.255.255.0") -- separate netmask +addr = luci.ip.new("10.24.0.1/24", 16) -- override netmask</pre> + + + +<h3>Return value:</h3> +A <code>luci.ip.cidr</code> object representing the given IPv4 range. + + + +<h3>See also:</h3> +<ul> + + <li><a href="#IPv6"> + IPv6 + </a> + +</ul> + +</dd> + + + + +<dt><a name="IPv6"></a><strong>IPv6</strong> (address, netmask)</dt> +<dd> + + +Construct a new IPv6 luci.ip.cidr instance. +Throws an error if the given string does not represent a valid IPv6 address or +if the given optional netmask is of a different family. + + +<h3>Parameters</h3> +<ul> + + <li> + address: String containing a valid IPv6, optionally with prefix size +(CIDR notation) or netmask separated by slash. + </li> + + <li> + netmask: String containing a valid IPv4 netmask or number +containing a prefix size between <code>0</code> and <code>128</code> bit. +Overrides mask embedded in the first argument if specified. (optional) + </li> + +</ul> + + + + +<h3>Usage:</h3> +<pre>addr6 = luci.ip.new("fe80::221:63ff:fe75:aa17/64") +addr6 = luci.ip.new("fe80::221:63ff:fe75:aa17/ffff:ffff:ffff:ffff::") +addr6 = luci.ip.new("fe80::221:63ff:fe75:aa17", "ffff:ffff:ffff:ffff::") +addr6 = luci.ip.new("fe80::221:63ff:fe75:aa17/64", 128) -- override netmask</pre> + + + +<h3>Return value:</h3> +A <code>luci.ip.cidr</code> object representing the given IPv6 range. + + + +<h3>See also:</h3> +<ul> + + <li><a href="#IPv4"> + IPv4 + </a> + +</ul> + +</dd> + + + + +<dt><a name="route"></a><strong>route</strong> (address)</dt> +<dd> + + +Determine the route leading to the given destination. + + +<h3>Parameters</h3> +<ul> + + <li> + address: A <code>luci.ip.cidr</code> instance or a string containing +a valid IPv4 or IPv6 range as specified by <code>luci.ip.new()</code>. + </li> + +</ul> + + + + +<h3>Usage:</h3> +<ul> +<li>Find default gateway by getting route to Google's public NS server +<pre>rt = luci.ip.route("8.8.8.8") +if rt ~= nil then + print("gateway is", rt.gw) +end</pre></li> +<li>Determine IPv6 upstream interface <pre>rt = luci.ip.route("2001::/7") +if rt ~= nil then + print("ipv6 upstream device is", rt.dev) +end</pre></li> +</ul> + + + +<h3>Return value:</h3> +<p>Table containing the fields described below.</p> +<table id="routetable"> +<tr><th>Field</th><th>Description</th></tr> +<tr><td><code>type</code><td> + <p>Route type with one of the following numeric values:</p> + <table> + <tr> + <td><code>1</code></td> + <td><code>RTN_UNICAST</code> - Gateway or direct route</td> + </tr> + <tr> + <td><code>2</code></td> + <td><code>RTN_LOCAL</code> - Accept locally</td> + </tr> + <tr> + <td><code>3</code></td> + <td><code>RTN_BROADCAST</code> - + Accept locally as broadcast send as broadcast</td> + </tr> + <tr> + <td><code>4</code></td> + <td><code>RTN_ANYCAST</code> - + Accept locally as broadcast but send as unicast</td> + </tr> + <tr> + <td><code>5</code></td> + <td><code>RTN_MULTICAST</code> - Multicast route</td> + </tr> + </table> +</td></tr> +<tr> + <td><code>family</code></td> + <td>Number containing the route family, <code>4</code> for IPv4 or + <code>6</code> for IPv6</td> +</tr> +<tr> + <td><code>dest</code></td> + <td>Destination <code>luci.ip.cidr</code> instance</td> +</tr> +<tr> + <td><code>gw</code></td> + <td>Gateway <code>luci.ip.cidr</code> instance (optional)</td> +</tr> +<tr> + <td><code>from</code></td> + <td>Source address <code>luci.ip.cidr</code> instance (optional)</td> +</tr> +<tr> + <td><code>src</code></td> + <td>Preferred source <code>luci.ip.cidr</code> instance (optional)</td> +</tr> +<tr> + <td><code>dev</code></td> + <td>String containing the name of the outgoing interface</td> +</tr> +<tr> + <td><code>iif</code></td> + <td>String containing the name of the incoming interface (optional)</td> +</tr> +<tr> + <td><code>table</code></td> + <td>Number of the associated routing table (<code>0..65535</code>)</td> +</tr> +<tr> + <td><code>proto</code></td> + <td>Number of the associated routing protocol</td> +</tr> +<tr> + <td><code>scope</code></td> + <td>Number describing the scope of the route, most commonly + <code>0</code> for global or <code>253</code> for on-link</td> +</tr> +<tr> + <td><code>metric</code></td> + <td>Number describing the route metric (optional)</td> +</tr> +<tr> + <td><code>expires</code></td> + <td>Number of seconds the prefix is valid (IPv6 only, optional)</td> +</tr> +<tr> + <td><code>error</code></td> + <td>Route destination error code (optional)</td> +</tr> +</table> + + + +<h3>See also:</h3> +<ul> + + <li><a href="#routes"> + routes + </a> + +</ul> + +</dd> + + + + +<dt><a name="routes"></a><strong>routes</strong> (filter, callback)</dt> +<dd> + + +Fetch all routes, optionally matching the given criteria. + + +<h3>Parameters</h3> +<ul> + + <li> + filter: <p>Table containing one or more of the possible filter +critera described below (optional)</p><table> +<tr><th>Field</th><th>Description</th></tr> +<tr><td><code>family</code></td><td> + Number describing the address family to return - <code>4</code> selects + IPv4 routes, <code>6</code> IPv6 ones. Any other value selects both. +</td></tr> +<tr><td><code>iif</code></td><td> + String containing the incoming route interface to match. +</td></tr> +<tr><td><code>oif</code></td><td> + String containing the outgoing route interface to match. +</td></tr> +<tr><td><code>type</code></td><td> + Numeric type to match, e.g. <code>1</code> for unicast. +</td></tr> +<tr><td><code>scope</code></td><td> + Numeric scope to match, e.g. <code>253</code> for onlink. +</td></tr> +<tr><td><code>proto</code></td><td> + Numeric protocol to match, e.g. <code>2</code> for boot. +</td></tr> +<tr><td><code>table</code></td><td> + Numeric routing table to match (<code>0..65535</code>). +</td></tr> +<tr><td><code>gw</code></td><td> + String containing the gateway address to match. Can be in any notation + specified by <code>luci.ip.new()</code>. Prefix matching is performed when + comparing the routes, e.g. "192.168.1.0/24" would select routes with gateway + addresses <code>192.168.1.1 .. 192.168.1.255</code>. +</td></tr> +<tr><td><code>dest</code></td><td> + String containing the destination to match. Prefix matching is performed. +</td></tr> +<tr><td><code>from</code></td><td> + String containing the source address to match. Prefix matching is performed. +</td></tr> +<tr><td><code>src</code></td><td> + String containing the preferred source address to match. + Prefix matching is performed. +</td></tr> +<tr><td><code>dest_exact</code></td><td> + String containing the destination to match. Exact matching is performed, + e.g. <code>dest = "0.0.0.0/0"</code> would match <em>any</em> IPv4 route + while <code>dest_exact = "0.0.0.0/0"</code> will <em>only</em> match the + default route. +</td></tr> +<tr><td><code>from_exact</code></td><td> + String containing the source address to match. Exact matching is performed. +</td></tr> +</table> + </li> + + <li> + callback: <p>Callback function to invoke for each found route +instead of returning one table of route objects (optional)</p> + </li> + +</ul> + + + + +<h3>Usage:</h3> +<ul> +<li>Find all IPv4 default routes: +<pre>luci.ip.routes({ dest_exact = "0.0.0.0/0" }, function(rt) + print(rt.type, rt.gw, rt.dev) +end)</pre></li> +<li>Find all global IPv6 prefixes on the current system: +<pre>luci.ip.routes({ from = "2001::/7" }, function(rt) + print(rt.from) +end)</pre></li> +<li>Fetch all IPv4 routes: +<pre>routes = luci.ip.routes({ family = 4 }) +for _, rt in ipairs(routes) do + print(rt.dest, rt.gw, rt.dev) +end</pre></li> +</ul> + + + +<h3>Return value:</h3> +If no callback function is provided, a table of routes +<a href="#routetable">as specified by <code>luci.ip.route()</code></a> +is returned. If a callback function is given, it is invoked for each route +and nothing is returned. + + + +<h3>See also:</h3> +<ul> + + <li><a href="#route"> + route + </a> + +</ul> + +</dd> + + + + +<dt><a name="neighbors"></a><strong>neighbors</strong> (filter, callback)</dt> +<dd> + + +Fetches entries from the IPv4 ARP and IPv6 neighbour kernel table + + +<h3>Parameters</h3> +<ul> + + <li> + filter: <p>Table containing one or more of the possible filter +critera described below (optional)</p><table> +<tr><th>Field</th><th>Description</th></tr> +<tr><td><code>family</code></td><td> + Number describing the address family to return - <code>4</code> selects + IPv4 ARP, <code>6</code> select IPv6 neighbour entries. Any other value + selects both. +</td></tr> +<tr><td><code>dev</code></td><td> + String containing the associated interface to match. +</td></tr> +<tr><td><code>dest</code></td><td> + String containing the associated address to match. Can be in any notation + specified by <code>luci.ip.new()</code>. Prefix matching is performed when + comparing the addresses, e.g. "192.168.1.0/24" would select ARP entries + for <code>192.168.1.1 .. 192.168.1.255</code>. +</td></tr> +<tr><td><code>mac</code></td><td> + String containing MAC address to match. +</td></tr> +</table> + </li> + + <li> + callback: <p>Callback function to invoke for each found neighbour +entry instead of returning one table of neighbour entries (optional)</p> + </li> + +</ul> + + + + +<h3>Usage:</h3> +<ul> +<li>Find all ARP neighbours in the LAN: +<pre>luci.ip.neighbors({ dest = "192.168.0.0/16" }, function(n) + print(n.dest, n.mac) +end)</pre></li> +<li>Find all active IPv6 addresses of host with given MAC: +<pre>luci.ip.neighbors({ family = 6, mac = "00:21:63:75:aa:17" }, + function(n) + print(n.dest) + end)</pre></li> +</ul> + + + +<h3>Return value:</h3> +If no callback function is provided, a table of neighbour entries +is returned. If a callback function is given, it is invoked for each entry +and nothing is returned. + +A neighbour entry is a table containing the following fields: + +<table> +<tr><th>Field</th><th>Description</th></tr> +<tr> + <td><code>family</code></td> + <td>Number containing the neighbour entry family, <code>4</code> for IPv4 + ARP or <code>6</code> for IPv6 NDP</td> +</tr> +<tr> + <td><code>dev</code></td> + <td>String containing the associated device of the neighbour entry</td> +</tr> +<tr> + <td><code>dest</code></td> + <td>IP address <code>luci.ip.cidr</code> instance</td> +</tr> +<tr> + <td><code>mac</code></td> + <td>String containing the associated MAC address</td> +</tr> +<tr> + <td><code>router</code></td> + <td>Boolean "true" if the neighbour entry is a router (IPv6, optional)</td> +</tr> +<tr> + <td><code>proxy</code></td> + <td>Boolean "true" if this is a proxy entry (optional)</td> +</tr> +<tr> + <td><code>incomplete</code></td> + <td>Boolean "true" if the entry is in incomplete state (optional)</td> +</tr> +<tr> + <td><code>reachable</code></td> + <td>Boolean "true" if the entry is in reachable state (optional)</td> +</tr> +<tr> + <td><code>stale</code></td> + <td>Boolean "true" if the entry is stale (optional)</td> +</tr> +<tr> + <td><code>delay</code></td> + <td>Boolean "true" if the entry is delayed (optional)</td> +</tr> +<tr> + <td><code>probe</code></td> + <td>Boolean "true" if the entry is in probe state (optional)</td> +</tr> +<tr> + <td><code>failed</code></td> + <td>Boolean "true" if the entry is in failed state (optional)</td> +</tr> +<tr> + <td><code>noarp</code></td> + <td>Boolean "true" if the entry is not caused by NDP or + ARP (optional)</td> +</tr> +<tr> + <td><code>permanent</code></td> + <td>Boolean "true" if the entry was statically configured from + userspace (optional)</td> +</tr> +</table> + + + +</dd> + + + + +<dt><a name="link"></a><strong>link</strong> (device)</dt> +<dd> + + +Fetch basic device information + + +<h3>Parameters</h3> +<ul> + + <li> + device: String containing the network device to query + </li> + +</ul> + + + + +<h3>Usage:</h3> +<ul> +<li>Test whether device br-lan exists: +<pre>print(luci.ip.link("br-lan").name ~= nil) +</pre></li> +<li>Query MAC address of eth0: +<pre>print(luci.ip.link("eth0").mac) +</pre></li> +</ul> + + + +<h3>Return value:</h3> +If the given interface is found, a table containing the fields +described below is returned, else an empty table. + +<table> +<tr><th>Field</th><th>Description</th></tr> +<tr> + <td><code>up</code></td> + <td>Boolean indicating whether the device is in IFF_RUNNING state</td> +</tr> +<tr> + <td><code>type</code></td> + <td>Numeric value indicating the type of the device, e.g. <code>1</code> + for ethernet.</td> +</tr> +<tr> + <td><code>name</code></td> + <td>String containing the name of the device</td> +</tr> +<tr> + <td><code>master</code></td> + <td>If queried device is a bridge port, string containing the name of + parent bridge device (optional)</td> +</tr> +<tr> + <td><code>mtu</code></td> + <td>Number containing the current MTU of the device</td> +</tr> +<tr> + <td><code>qlen</code></td> + <td>Number containing the TX queue length of the device</td> +</tr> +<tr> + <td><code>mac</code></td> + <td>String containing the link local address of the device in + dotted hex notation</td> +</tr> +</table> + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/luci.jsonc.html b/doc/modules/luci.jsonc.html new file mode 100644 index 000000000..3d0a9ad2b --- /dev/null +++ b/doc/modules/luci.jsonc.html @@ -0,0 +1,365 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li><strong>luci.jsonc</strong></li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Class <code>luci.jsonc</code></h1> + +<p> + LuCI JSON parsing and serialization library. + The luci.jsonc class is a high level Lua binding to the JSON-C library to + allow reading and writing JSON data with minimal overhead.</p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#new">new</a> ()</td> + <td class="summary"> + +Construct a new luci.jsonc.parser instance.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#parse">parse</a> (json)</td> + <td class="summary"> + +Parse a complete JSON string and convert it into a Lua data structure.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#stringify">stringify</a> (data, pretty)</td> + <td class="summary"> + +Convert given Lua data into a JSON string.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="new"></a><strong>new</strong> ()</dt> +<dd> + + +Construct a new luci.jsonc.parser instance. + + + + + +<h3>Usage:</h3> +<code>parser = luci.jsonc.new()</code> + + + +<h3>Return value:</h3> +A <code>luci.jsonc.parser</code> object representing a JSON-C tokener. + + + +</dd> + + + + +<dt><a name="parse"></a><strong>parse</strong> (json)</dt> +<dd> + + +Parse a complete JSON string and convert it into a Lua data structure. + + +<h3>Parameters</h3> +<ul> + + <li> + json: A string containing the JSON data to parse, must be either a + JSON array or a JSON object. + </li> + +</ul> + + + + +<h3>Usage:</h3> +<pre>data = luci.jsonc.parse('{ "name": "John", "age": 34 }') +print(data.name) -- "John"</pre> + + + +<h3>Return value:</h3> +On success, a table containing the parsed JSON data is returned, on + failure the function returns <code>nil</code> and a string containing the reason of + the parse error. + + + +<h3>See also:</h3> +<ul> + + <li><a href="#stringify"> + stringify + </a> + +</ul> + +</dd> + + + + +<dt><a name="stringify"></a><strong>stringify</strong> (data, pretty)</dt> +<dd> + + +Convert given Lua data into a JSON string. + +This function recursively converts the given Lua data into a JSON string, +ignoring any unsupported data. Lua tables are converted into JSON arrays if they +only contain integer keys, mixed tables are turned into JSON objects with any +existing numeric keys converted into strings. + +Lua functions, coroutines and userdata objects are ignored and Lua numbers are +converted to integers if they do not contain fractional values. + + + +<h3>Parameters</h3> +<ul> + + <li> + data: The Lua data to convert, can be a table, string, boolean or number. + </li> + + <li> + pretty: A boolean value indicating whether the resulting JSON should be + pretty printed. + </li> + +</ul> + + + + +<h3>Usage:</h3> +<pre>json = luci.jsonc.stringify({ item = true, values = { 1, 2, 3 } }) +print(json) -- '{"item":true,"values":[1,2,3]}'</pre> + + + +<h3>Return value:</h3> +Returns a string containing the JSON representation of the given Lua + data. + + + +<h3>See also:</h3> +<ul> + + <li><a href="#parse"> + parse + </a> + +</ul> + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/luci.jsonc.parser.html b/doc/modules/luci.jsonc.parser.html new file mode 100644 index 000000000..4c93a0f79 --- /dev/null +++ b/doc/modules/luci.jsonc.parser.html @@ -0,0 +1,428 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li><strong>luci.jsonc.parser</strong></li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Object Instance <code>luci.jsonc.parser</code></h1> + +<p> + LuCI JSON parser instance. + A JSON parser instance is useful to parse JSON data chunk by chunk, without + the need to assemble all data in advance.</p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#parser.parse">parser:parse</a> (json)</td> + <td class="summary"> + +Parses one chunk of JSON data.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#parser.get">parser:get</a> ()</td> + <td class="summary"> + +Convert parsed JSON data into Lua table.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#parser.set">parser:set</a> (data)</td> + <td class="summary"> + +Put Lua data into the parser.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#parser.stringify">parser:stringify</a> (pretty)</td> + <td class="summary"> + +Serialize current parser state as JSON.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="parser.parse"></a><strong>parser:parse</strong> (json)</dt> +<dd> + + +Parses one chunk of JSON data. + + + +<h3>Parameters</h3> +<ul> + + <li> + json: String containing the JSON fragment to parse + </li> + +</ul> + + + + +<h3>Usage:</h3> +<pre>parser = luci.jsonc.new() + +while true do + chunk = ... -- fetch a cunk of data, e.g. from a socket + finish, errmsg = <b>parser.parse(chunk)</b> + + if finish == nil then + error("Cannot parse JSON: " .. errmsg) + end + + if finish == true then + break + end +end</pre> + + + +<h3>Return value:</h3> +<ul> + <li><code>true</code> if a complete JSON object has been parsed and no further input is + expected.</li> + <li><code>false</code> if further input is required</li> + <li><code>nil</code> if an error was encountered while parsing the current chunk. + In this case a string describing the parse error is returned as second + value.</li></ul> + + + +<h3>See also:</h3> +<ul> + + <li><a href="#parser.get"> + parser:get + </a> + +</ul> + +</dd> + + + + +<dt><a name="parser.get"></a><strong>parser:get</strong> ()</dt> +<dd> + + +Convert parsed JSON data into Lua table. + + + + + + +<h3>Usage:</h3> +<pre>parser = luci.jsonc.new() +parser:parse('{ "example": "test" }') + +data = parser:get() +print(data.example) -- "test"</pre> + + + +<h3>Return value:</h3> +Parsed JSON object converted into a Lua table or <code>nil</code> if the parser + didn't finish or encountered an error. + + + +<h3>See also:</h3> +<ul> + + <li><a href="#parser.parse"> + parser:parse + </a> + +</ul> + +</dd> + + + + +<dt><a name="parser.set"></a><strong>parser:set</strong> (data)</dt> +<dd> + + +Put Lua data into the parser. + + + +<h3>Parameters</h3> +<ul> + + <li> + data: Lua data to put into the parser object. The data is converted to an + internal JSON representation that can be dumped with <code>stringify()</code>. + The conversion follows the rules described in <code>luci.jsonc.stringify</code>. + </li> + +</ul> + + + + +<h3>Usage:</h3> +<pre>parser = luci.jsonc.new() +parser:set({ "some", "data" })</pre> + + + +<h3>Return value:</h3> +Nothing is returned. + + + +<h3>See also:</h3> +<ul> + + <li><a href="#parser.stringify"> + parser:stringify + </a> + +</ul> + +</dd> + + + + +<dt><a name="parser.stringify"></a><strong>parser:stringify</strong> (pretty)</dt> +<dd> + + +Serialize current parser state as JSON. + + + +<h3>Parameters</h3> +<ul> + + <li> + pretty: A boolean value indicating whether the resulting JSON should be pretty printed. + </li> + +</ul> + + + + +<h3>Usage:</h3> +<pre>parser = luci.jsonc.new() +parser:parse('{ "example": "test" }') +print(parser:serialize()) -- '{"example":"test"}'</pre> + + + +<h3>Return value:</h3> +Returns the serialized JSON data of this parser instance. + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/luci.sys.init.html b/doc/modules/luci.sys.init.html new file mode 100644 index 000000000..3e311ed8e --- /dev/null +++ b/doc/modules/luci.sys.init.html @@ -0,0 +1,484 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li><strong>luci.sys.init</strong></li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Class <code>luci.sys.init</code></h1> + +<p> + +LuCI system utilities / init related functions. +</p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#init.disable">disable</a> (name)</td> + <td class="summary"> + +Disable the given init script + </td> + </tr> + + <tr> + <td class="name" nowrap><a href="#init.enable">enable</a> (name)</td> + <td class="summary"> + +Enable the given init script + </td> + </tr> + + <tr> + <td class="name" nowrap><a href="#init.enabled">enabled</a> (name)</td> + <td class="summary"> + +Test whether the given init script is enabled + </td> + </tr> + + <tr> + <td class="name" nowrap><a href="#init.index">index</a> (name)</td> + <td class="summary"> + +Get the index of he given init script + </td> + </tr> + + <tr> + <td class="name" nowrap><a href="#init.names">names</a> ()</td> + <td class="summary"> + +Get the names of all installed init scripts + </td> + </tr> + + <tr> + <td class="name" nowrap><a href="#init.start">start</a> (name)</td> + <td class="summary"> + +Start the given init script + </td> + </tr> + + <tr> + <td class="name" nowrap><a href="#init.stop">stop</a> (name)</td> + <td class="summary"> + +Stop the given init script + </td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="init.disable"></a><strong>disable</strong> (name)</dt> +<dd> + + +Disable the given init script + + + +<h3>Parameters</h3> +<ul> + + <li> + name: Name of the init script + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Boolean indicating success + + + +</dd> + + + + +<dt><a name="init.enable"></a><strong>enable</strong> (name)</dt> +<dd> + + +Enable the given init script + + + +<h3>Parameters</h3> +<ul> + + <li> + name: Name of the init script + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Boolean indicating success + + + +</dd> + + + + +<dt><a name="init.enabled"></a><strong>enabled</strong> (name)</dt> +<dd> + + +Test whether the given init script is enabled + + + +<h3>Parameters</h3> +<ul> + + <li> + name: Name of the init script + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Boolean indicating whether init is enabled + + + +</dd> + + + + +<dt><a name="init.index"></a><strong>index</strong> (name)</dt> +<dd> + + +Get the index of he given init script + + + +<h3>Parameters</h3> +<ul> + + <li> + name: Name of the init script + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Numeric index value + + + +</dd> + + + + +<dt><a name="init.names"></a><strong>names</strong> ()</dt> +<dd> + + +Get the names of all installed init scripts + + + + + + + + +<h3>Return value:</h3> +Table containing the names of all inistalled init scripts + + + +</dd> + + + + +<dt><a name="init.start"></a><strong>start</strong> (name)</dt> +<dd> + + +Start the given init script + + + +<h3>Parameters</h3> +<ul> + + <li> + name: Name of the init script + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Boolean indicating success + + + +</dd> + + + + +<dt><a name="init.stop"></a><strong>stop</strong> (name)</dt> +<dd> + + +Stop the given init script + + + +<h3>Parameters</h3> +<ul> + + <li> + name: Name of the init script + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Boolean indicating success + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/luci.sys.iptparser.html b/doc/modules/luci.sys.iptparser.html new file mode 100644 index 000000000..8055d4652 --- /dev/null +++ b/doc/modules/luci.sys.iptparser.html @@ -0,0 +1,434 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li><strong>luci.sys.iptparser</strong></li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Object Instance <code>luci.sys.iptparser</code></h1> + +<p></p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#IptParser">IptParser</a> (family)</td> + <td class="summary"> + +Create a new iptables parser object.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#IptParser.chain">IptParser:chain</a> (table, chain)</td> + <td class="summary"> + +Return the given firewall chain within the given table name.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#IptParser.chains">IptParser:chains</a> (table)</td> + <td class="summary"> + +Find the names of all chains within the given table name.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#IptParser.is_custom_target">IptParser:is_custom_target</a> (target)</td> + <td class="summary"> + +Test whether the given target points to a custom chain.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#IptParser.resync">IptParser:resync</a> ()</td> + <td class="summary"> + +Rebuild the internal lookup table, for example when rules have changed + +through external commands.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#IptParser.tables">IptParser:tables</a> ()</td> + <td class="summary"> + +Find the names of all tables.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="IptParser"></a><strong>IptParser</strong> (family)</dt> +<dd> + + +Create a new iptables parser object. + + + +<h3>Parameters</h3> +<ul> + + <li> + family: Number specifying the address family. 4 for IPv4, 6 for IPv6 + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +IptParser instance + + + +</dd> + + + + +<dt><a name="IptParser.chain"></a><strong>IptParser:chain</strong> (table, chain)</dt> +<dd> + + +Return the given firewall chain within the given table name. + + + +<h3>Parameters</h3> +<ul> + + <li> + table: String containing the table name + </li> + + <li> + chain: String containing the chain name + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Table containing the fields "policy", "packets", "bytes" + and "rules". The "rules" field is a table of rule tables. + + + +</dd> + + + + +<dt><a name="IptParser.chains"></a><strong>IptParser:chains</strong> (table)</dt> +<dd> + + +Find the names of all chains within the given table name. + + + +<h3>Parameters</h3> +<ul> + + <li> + table: String containing the table name + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Table of chain names in the order they occur. + + + +</dd> + + + + +<dt><a name="IptParser.is_custom_target"></a><strong>IptParser:is_custom_target</strong> (target)</dt> +<dd> + + +Test whether the given target points to a custom chain. + + + +<h3>Parameters</h3> +<ul> + + <li> + target: String containing the target action + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Boolean indicating whether target is a custom chain. + + + +</dd> + + + + +<dt><a name="IptParser.resync"></a><strong>IptParser:resync</strong> ()</dt> +<dd> + + +Rebuild the internal lookup table, for example when rules have changed + +through external commands. + + + + + + + +<h3>Return value:</h3> +nothing + + + +</dd> + + + + +<dt><a name="IptParser.tables"></a><strong>IptParser:tables</strong> ()</dt> +<dd> + + +Find the names of all tables. + + + + + + + + +<h3>Return value:</h3> +Table of table names. + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/luci.sys.net.html b/doc/modules/luci.sys.net.html new file mode 100644 index 000000000..82fcea474 --- /dev/null +++ b/doc/modules/luci.sys.net.html @@ -0,0 +1,940 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li><strong>luci.sys.net</strong></li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Class <code>luci.sys.net</code></h1> + +<p> + +LuCI system utilities / network related functions. +</p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#call">call</a> (...)</td> + <td class="summary"> + +Execute a given shell command and return the error code + </td> + </tr> + + <tr> + <td class="name" nowrap><a href="#dmesg">dmesg</a> ()</td> + <td class="summary"> + +Retrieves the output of the "dmesg" command.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#exec">exec</a> (command)</td> + <td class="summary"> + +Execute a given shell command and capture its standard output + </td> + </tr> + + <tr> + <td class="name" nowrap><a href="#getenv">getenv</a> (var)</td> + <td class="summary"> + +Retrieve environment variables.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#hostname">hostname</a> (String)</td> + <td class="summary"> + +Get or set the current hostname.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#httpget">httpget</a> (url, stream, target)</td> + <td class="summary"> + +Returns the contents of a documented referred by an URL.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#mounts">mounts</a> ()</td> + <td class="summary"> + +Retrieve information about currently mounted file systems.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#net.arptable">arptable</a> ()</td> + <td class="summary"> + +Returns the current arp-table entries as two-dimensional table.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#net.conntrack">conntrack</a> ()</td> + <td class="summary"> + +Returns conntrack information + </td> + </tr> + + <tr> + <td class="name" nowrap><a href="#net.deviceinfo">deviceinfo</a> ()</td> + <td class="summary"> + +Return information about available network interfaces.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#net.devices">devices</a> ()</td> + <td class="summary"> + +Determine the names of available network interfaces.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#net.ipv4_hints">ipv4_hints</a> ()</td> + <td class="summary"> + +Returns a two-dimensional table of IPv4 address hints.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#net.ipv6_hints">ipv6_hints</a> ()</td> + <td class="summary"> + +Returns a two-dimensional table of IPv6 address hints.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#net.mac_hints">mac_hints</a> ()</td> + <td class="summary"> + +Returns a two-dimensional table of mac address hints.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#net.pingtest">pingtest</a> (host)</td> + <td class="summary"> + +Tests whether the given host responds to ping probes.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#net.routes">routes</a> ()</td> + <td class="summary"> + +Returns the current kernel routing table entries.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#net.routes6">routes6</a> ()</td> + <td class="summary"> + +Returns the current ipv6 kernel routing table entries.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#reboot">reboot</a> ()</td> + <td class="summary"> + +Initiate a system reboot.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#syslog">syslog</a> ()</td> + <td class="summary"> + +Retrieves the output of the "logread" command.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#uniqueid">uniqueid</a> (bytes)</td> + <td class="summary"> + +Generates a random id with specified length.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#uptime">uptime</a> ()</td> + <td class="summary"> + +Returns the current system uptime stats.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="call"></a><strong>call</strong> (...)</dt> +<dd> + + +Execute a given shell command and return the error code + + + +<h3>Parameters</h3> +<ul> + + <li> + ...: Command to call + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Error code of the command + + + +</dd> + + + + +<dt><a name="dmesg"></a><strong>dmesg</strong> ()</dt> +<dd> + + +Retrieves the output of the "dmesg" command. + + + + + + + + +<h3>Return value:</h3> +String containing the current log buffer + + + +</dd> + + + + +<dt><a name="exec"></a><strong>exec</strong> (command)</dt> +<dd> + + +Execute a given shell command and capture its standard output + + + +<h3>Parameters</h3> +<ul> + + <li> + command: Command to call + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +String containg the return the output of the command + + + +</dd> + + + + +<dt><a name="getenv"></a><strong>getenv</strong> (var)</dt> +<dd> + + +Retrieve environment variables. If no variable is given then a table + +containing the whole environment is returned otherwise this function returns +the corresponding string value for the given name or nil if no such variable +exists. + + +<h3>Parameters</h3> +<ul> + + <li> + var: Name of the environment variable to retrieve (optional) + </li> + +</ul> + + + + + + +<h3>Return values:</h3> +<ol> + + <li>String containg the value of the specified variable + + <li>Table containing all variables if no variable name is given + +</ol> + + + +</dd> + + + + +<dt><a name="hostname"></a><strong>hostname</strong> (String)</dt> +<dd> + + +Get or set the current hostname. + + + +<h3>Parameters</h3> +<ul> + + <li> + String: containing a new hostname to set (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +String containing the system hostname + + + +</dd> + + + + +<dt><a name="httpget"></a><strong>httpget</strong> (url, stream, target)</dt> +<dd> + + +Returns the contents of a documented referred by an URL. + + + +<h3>Parameters</h3> +<ul> + + <li> + url: The URL to retrieve + </li> + + <li> + stream: Return a stream instead of a buffer + </li> + + <li> + target: Directly write to target file name + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +String containing the contents of given the URL + + + +</dd> + + + + +<dt><a name="mounts"></a><strong>mounts</strong> ()</dt> +<dd> + + +Retrieve information about currently mounted file systems. + + + + + + + + +<h3>Return value:</h3> +Table containing mount information + + + +</dd> + + + + +<dt><a name="net.arptable"></a><strong>arptable</strong> ()</dt> +<dd> + + +Returns the current arp-table entries as two-dimensional table. + + + + + + + + +<h3>Return value:</h3> +Table of table containing the current arp entries. + The following fields are defined for arp entry objects: + { "IP address", "HW address", "HW type", "Flags", "Mask", "Device" } + + + +</dd> + + + + +<dt><a name="net.conntrack"></a><strong>conntrack</strong> ()</dt> +<dd> + + +Returns conntrack information + + + + + + + + +<h3>Return value:</h3> +Table with the currently tracked IP connections + + + +</dd> + + + + +<dt><a name="net.deviceinfo"></a><strong>deviceinfo</strong> ()</dt> +<dd> + + +Return information about available network interfaces. + + + + + + + + +<h3>Return value:</h3> +Table containing all current interface names and their information + + + +</dd> + + + + +<dt><a name="net.devices"></a><strong>devices</strong> ()</dt> +<dd> + + +Determine the names of available network interfaces. + + + + + + + + +<h3>Return value:</h3> +Table containing all current interface names + + + +</dd> + + + + +<dt><a name="net.ipv4_hints"></a><strong>ipv4_hints</strong> ()</dt> +<dd> + + +Returns a two-dimensional table of IPv4 address hints. + + + + + + + + +<h3>Return value:</h3> +Table of table containing known hosts from various sources. + Each entry contains the values in the following order: + [ "ip", "name" ] + + + +</dd> + + + + +<dt><a name="net.ipv6_hints"></a><strong>ipv6_hints</strong> ()</dt> +<dd> + + +Returns a two-dimensional table of IPv6 address hints. + + + + + + + + +<h3>Return value:</h3> +Table of table containing known hosts from various sources. + Each entry contains the values in the following order: + [ "ip", "name" ] + + + +</dd> + + + + +<dt><a name="net.mac_hints"></a><strong>mac_hints</strong> ()</dt> +<dd> + + +Returns a two-dimensional table of mac address hints. + + + + + + + + +<h3>Return value:</h3> +Table of table containing known hosts from various sources. + Each entry contains the values in the following order: + [ "mac", "name" ] + + + +</dd> + + + + +<dt><a name="net.pingtest"></a><strong>pingtest</strong> (host)</dt> +<dd> + + +Tests whether the given host responds to ping probes. + + + +<h3>Parameters</h3> +<ul> + + <li> + host: String containing a hostname or IPv4 address + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Number containing 0 on success and >= 1 on error + + + +</dd> + + + + +<dt><a name="net.routes"></a><strong>routes</strong> ()</dt> +<dd> + + +Returns the current kernel routing table entries. + + + + + + + + +<h3>Return value:</h3> +Table of tables with properties of the corresponding routes. + The following fields are defined for route entry tables: + { "dest", "gateway", "metric", "refcount", "usecount", "irtt", + "flags", "device" } + + + +</dd> + + + + +<dt><a name="net.routes6"></a><strong>routes6</strong> ()</dt> +<dd> + + +Returns the current ipv6 kernel routing table entries. + + + + + + + + +<h3>Return value:</h3> +Table of tables with properties of the corresponding routes. + The following fields are defined for route entry tables: + { "source", "dest", "nexthop", "metric", "refcount", "usecount", + "flags", "device" } + + + +</dd> + + + + +<dt><a name="reboot"></a><strong>reboot</strong> ()</dt> +<dd> + + +Initiate a system reboot. + + + + + + + + +<h3>Return value:</h3> +Return value of os.execute() + + + +</dd> + + + + +<dt><a name="syslog"></a><strong>syslog</strong> ()</dt> +<dd> + + +Retrieves the output of the "logread" command. + + + + + + + + +<h3>Return value:</h3> +String containing the current log buffer + + + +</dd> + + + + +<dt><a name="uniqueid"></a><strong>uniqueid</strong> (bytes)</dt> +<dd> + + +Generates a random id with specified length. + + + +<h3>Parameters</h3> +<ul> + + <li> + bytes: Number of bytes for the unique id + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +String containing hex encoded id + + + +</dd> + + + + +<dt><a name="uptime"></a><strong>uptime</strong> ()</dt> +<dd> + + +Returns the current system uptime stats. + + + + + + + + +<h3>Return value:</h3> +String containing total uptime in seconds + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/luci.sys.process.html b/doc/modules/luci.sys.process.html new file mode 100644 index 000000000..d664bca1d --- /dev/null +++ b/doc/modules/luci.sys.process.html @@ -0,0 +1,416 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li><strong>luci.sys.process</strong></li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Class <code>luci.sys.process</code></h1> + +<p> + +LuCI system utilities / process related functions. +</p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#process.info">info</a> ()</td> + <td class="summary"> + +Get the current process id.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#process.list">list</a> ()</td> + <td class="summary"> + +Retrieve information about currently running processes.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#process.setgroup">setgroup</a> (gid)</td> + <td class="summary"> + +Set the gid of a process identified by given pid.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#process.setuser">setuser</a> (uid)</td> + <td class="summary"> + +Set the uid of a process identified by given pid.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#process.signal">signal</a> (pid, sig)</td> + <td class="summary"> + +Send a signal to a process identified by given pid.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="process.info"></a><strong>info</strong> ()</dt> +<dd> + + +Get the current process id. + + + + + + + + +<h3>Return value:</h3> +Number containing the current pid + + + +</dd> + + + + +<dt><a name="process.list"></a><strong>list</strong> ()</dt> +<dd> + + +Retrieve information about currently running processes. + + + + + + + + +<h3>Return value:</h3> +Table containing process information + + + +</dd> + + + + +<dt><a name="process.setgroup"></a><strong>setgroup</strong> (gid)</dt> +<dd> + + +Set the gid of a process identified by given pid. + + + +<h3>Parameters</h3> +<ul> + + <li> + gid: Number containing the Unix group id + </li> + +</ul> + + + + + + +<h3>Return values:</h3> +<ol> + + <li>Boolean indicating successful operation + + <li>String containing the error message if failed + + <li>Number containing the error code if failed + +</ol> + + + +</dd> + + + + +<dt><a name="process.setuser"></a><strong>setuser</strong> (uid)</dt> +<dd> + + +Set the uid of a process identified by given pid. + + + +<h3>Parameters</h3> +<ul> + + <li> + uid: Number containing the Unix user id + </li> + +</ul> + + + + + + +<h3>Return values:</h3> +<ol> + + <li>Boolean indicating successful operation + + <li>String containing the error message if failed + + <li>Number containing the error code if failed + +</ol> + + + +</dd> + + + + +<dt><a name="process.signal"></a><strong>signal</strong> (pid, sig)</dt> +<dd> + + +Send a signal to a process identified by given pid. + + + +<h3>Parameters</h3> +<ul> + + <li> + pid: Number containing the process id + </li> + + <li> + sig: Signal to send (default: 15 [SIGTERM]) + </li> + +</ul> + + + + + + +<h3>Return values:</h3> +<ol> + + <li>Boolean indicating successful operation + + <li>Number containing the error code if failed + +</ol> + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/luci.sys.user.html b/doc/modules/luci.sys.user.html new file mode 100644 index 000000000..976dac612 --- /dev/null +++ b/doc/modules/luci.sys.user.html @@ -0,0 +1,384 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li><strong>luci.sys.user</strong></li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Class <code>luci.sys.user</code></h1> + +<p> + +LuCI system utilities / user related functions. +</p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#getuser">getuser</a> (uid)</td> + <td class="summary"> + +Retrieve user informations for given uid.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#user.checkpasswd">checkpasswd</a> (username, pass)</td> + <td class="summary"> + +Test whether given string matches the password of a given system user.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#user.getpasswd">getpasswd</a> (username)</td> + <td class="summary"> + +Retrieve the current user password hash.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#user.setpasswd">setpasswd</a> (username, password)</td> + <td class="summary"> + +Change the password of given user.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="getuser"></a><strong>getuser</strong> (uid)</dt> +<dd> + + +Retrieve user informations for given uid. + + + +<h3>Parameters</h3> +<ul> + + <li> + uid: Number containing the Unix user id + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Table containing the following fields: + { "uid", "gid", "name", "passwd", "dir", "shell", "gecos" } + + + +</dd> + + + + +<dt><a name="user.checkpasswd"></a><strong>checkpasswd</strong> (username, pass)</dt> +<dd> + + +Test whether given string matches the password of a given system user. + + + +<h3>Parameters</h3> +<ul> + + <li> + username: String containing the Unix user name + </li> + + <li> + pass: String containing the password to compare + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Boolean indicating wheather the passwords are equal + + + +</dd> + + + + +<dt><a name="user.getpasswd"></a><strong>getpasswd</strong> (username)</dt> +<dd> + + +Retrieve the current user password hash. + + + +<h3>Parameters</h3> +<ul> + + <li> + username: String containing the username to retrieve the password for + </li> + +</ul> + + + + + + +<h3>Return values:</h3> +<ol> + + <li>String containing the hash or nil if no password is set. + + <li>Password database entry + +</ol> + + + +</dd> + + + + +<dt><a name="user.setpasswd"></a><strong>setpasswd</strong> (username, password)</dt> +<dd> + + +Change the password of given user. + + + +<h3>Parameters</h3> +<ul> + + <li> + username: String containing the Unix user name + </li> + + <li> + password: String containing the password to compare + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Number containing 0 on success and >= 1 on error + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/luci.sys.wifi.html b/doc/modules/luci.sys.wifi.html new file mode 100644 index 000000000..1a3a997a3 --- /dev/null +++ b/doc/modules/luci.sys.wifi.html @@ -0,0 +1,252 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li><strong>luci.sys.wifi</strong></li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Class <code>luci.sys.wifi</code></h1> + +<p> + +LuCI system utilities / wifi related functions. +</p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#wifi.getiwinfo">getiwinfo</a> (ifname)</td> + <td class="summary"> + +Get wireless information for given interface.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="wifi.getiwinfo"></a><strong>getiwinfo</strong> (ifname)</dt> +<dd> + + +Get wireless information for given interface. + + + +<h3>Parameters</h3> +<ul> + + <li> + ifname: String containing the interface name + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +A wrapped iwinfo object instance + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/nixio.CHANGELOG.html b/doc/modules/nixio.CHANGELOG.html new file mode 100644 index 000000000..a9e0dcc07 --- /dev/null +++ b/doc/modules/nixio.CHANGELOG.html @@ -0,0 +1,258 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li><strong>nixio.CHANGELOG</strong></li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Class <code>nixio.CHANGELOG</code></h1> + +<p> + Changes and improvements.</p> + + + + + + + + + + +<h2>Tables</h2> +<table class="table_list"> + + <tr> + <td class="name" nowrap><a href="#0.2">0.2</a></td> + <td class="summary"> + Initial Release.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#0.3">0.3</a></td> + <td class="summary"> + Service Release.</td> + </tr> + +</table> + + + +<br/> +<br/> + + + + +<h2><a name="tables"></a>Tables</h2> +<dl class="table"> + +<dt><a name="0.2"></a><strong>0.2</strong></dt> +<dd> + Initial Release. + <ul> + <li>Initial Release</li> + </ul> + + + +</dd> + + +<dt><a name="0.3"></a><strong>0.3</strong></dt> +<dd> + Service Release. + <ul> + <li>Added getifaddrs() function.</li> + <li>Added getsockopt(), setsockopt(), getsockname() and getpeername() + directly to TLS-socket objects unifying the socket interface.</li> + <li>Added support for CyaSSL as cryptographical backend.</li> + <li>Added support for x509 certificates in DER format.</li> + <li>Added support for splice() in UnifiedIO.copyz().</li> + <li>Added interface to inject chunks into UnifiedIO.linesource() buffer.</li> + <li>Changed TLS behaviour to explicitely separate servers and clients.</li> + <li>Fixed usage of signed datatype breaking Base64 decoding.</li> + <li>Fixed namespace clashes for nixio.fs.</li> + <li>Fixed splice() support for some exotic C libraries.</li> + <li>Reconfigure axTLS cryptographical provider and mark it as obsolete.</li> + </ul> + + + +</dd> + + +</dl> + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/nixio.CryptoHash.html b/doc/modules/nixio.CryptoHash.html new file mode 100644 index 000000000..e7f28bb5d --- /dev/null +++ b/doc/modules/nixio.CryptoHash.html @@ -0,0 +1,284 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li><strong>nixio.CryptoHash</strong></li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Object Instance <code>nixio.CryptoHash</code></h1> + +<p> + Cryptographical Hash and HMAC object.</p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#CryptoHash.final">CryptoHash:final</a> ()</td> + <td class="summary"> + Finalize the hash and return the digest.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#CryptoHash.update">CryptoHash:update</a> (chunk)</td> + <td class="summary"> + Add another chunk of data to be hashed.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="CryptoHash.final"></a><strong>CryptoHash:final</strong> ()</dt> +<dd> + + Finalize the hash and return the digest. + + + + + +<h3>Usage:</h3> +You cannot call update on a hash object that was already finalized + you can however call final multiple times to get the digest. + + + +<h3>Return values:</h3> +<ol> + + <li>hexdigest + + <li>buffer containing binary digest + +</ol> + + + +</dd> + + + + +<dt><a name="CryptoHash.update"></a><strong>CryptoHash:update</strong> (chunk)</dt> +<dd> + + Add another chunk of data to be hashed. + + +<h3>Parameters</h3> +<ul> + + <li> + chunk: Chunk of data + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +CryptoHash object (self) + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/nixio.File.html b/doc/modules/nixio.File.html new file mode 100644 index 000000000..c4f9ab866 --- /dev/null +++ b/doc/modules/nixio.File.html @@ -0,0 +1,641 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li><strong>nixio.File</strong></li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Object Instance <code>nixio.File</code></h1> + +<p> + Large File Object. + Large file operations are supported up to 52 bits if the Lua number type is + double (default).</p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#File.close">File:close</a> ()</td> + <td class="summary"> + Close the file descriptor.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#File.fileno">File:fileno</a> ()</td> + <td class="summary"> + Get the number of the filedescriptor.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#File.lock">File:lock</a> (command, length)</td> + <td class="summary"> + Apply or test a lock on the file.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#File.read">File:read</a> (length)</td> + <td class="summary"> + Read from a file descriptor.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#File.seek">File:seek</a> (offset, whence)</td> + <td class="summary"> + Reposition read / write offset of the file descriptor.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#File.setblocking">File:setblocking</a> (blocking)</td> + <td class="summary"> + (POSIX) Set the blocking mode of the file descriptor.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#File.stat">File:stat</a> (field)</td> + <td class="summary"> + Get file status and attributes.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#File.sync">File:sync</a> (data_only)</td> + <td class="summary"> + Synchronizes the file with the storage device.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#File.tell">File:tell</a> ()</td> + <td class="summary"> + Return the current read / write offset of the file descriptor.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#File.write">File:write</a> (buffer, offset, length)</td> + <td class="summary"> + Write to the file descriptor.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="File.close"></a><strong>File:close</strong> ()</dt> +<dd> + + Close the file descriptor. + + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="File.fileno"></a><strong>File:fileno</strong> ()</dt> +<dd> + + Get the number of the filedescriptor. + + + + + + + +<h3>Return value:</h3> +file descriptor number + + + +</dd> + + + + +<dt><a name="File.lock"></a><strong>File:lock</strong> (command, length)</dt> +<dd> + + Apply or test a lock on the file. + + +<h3>Parameters</h3> +<ul> + + <li> + command: Locking Command ["lock", "tlock", "ulock", "test"] + </li> + + <li> + length: Amount of Bytes to lock from current offset (optional) + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li>This function calls lockf() on POSIX and _locking() on Windows. + + <li>The "lock" command is blocking, "tlock" is non-blocking, + "ulock" unlocks and "test" only tests for the lock. + + <li>The "test" command is not available on Windows. + + <li>Locks are by default advisory on POSIX, but mandatory on Windows. + +</ul> + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="File.read"></a><strong>File:read</strong> (length)</dt> +<dd> + + Read from a file descriptor. + + +<h3>Parameters</h3> +<ul> + + <li> + length: Amount of data to read (in Bytes). + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li><strong>Warning:</strong> It is not guaranteed that all requested data + is read at once especially when dealing with pipes. + You have to check the return value - the length of the buffer actually read - + or use the safe IO functions in the high-level IO utility module. + + <li>The length of the return buffer is limited by the (compile time) + nixio buffersize which is <em>nixio.const.buffersize</em> (8192 by default). + Any read request greater than that will be safely truncated to this value. + +</ul> + + + +<h3>Return value:</h3> +buffer containing data successfully read + + + +</dd> + + + + +<dt><a name="File.seek"></a><strong>File:seek</strong> (offset, whence)</dt> +<dd> + + Reposition read / write offset of the file descriptor. + The seek will be done either from the beginning of the file or relative + to the current position or relative to the end. + + +<h3>Parameters</h3> +<ul> + + <li> + offset: File Offset + </li> + + <li> + whence: Starting point [<strong>"set"</strong>, "cur", "end"] + </li> + +</ul> + + + + +<h3>Usage:</h3> +This function calls lseek(). + + + +<h3>Return value:</h3> +new (absolute) offset position + + + +</dd> + + + + +<dt><a name="File.setblocking"></a><strong>File:setblocking</strong> (blocking)</dt> +<dd> + + (POSIX) Set the blocking mode of the file descriptor. + + +<h3>Parameters</h3> +<ul> + + <li> + blocking: (boolean) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="File.stat"></a><strong>File:stat</strong> (field)</dt> +<dd> + + Get file status and attributes. + + +<h3>Parameters</h3> +<ul> + + <li> + field: Only return a specific field, not the whole table (optional) + </li> + +</ul> + + + + +<h3>Usage:</h3> +This function calls fstat(). + + + +<h3>Return value:</h3> +Table containing: <ul> + <li>atime = Last access timestamp</li> + <li>blksize = Blocksize (POSIX only)</li> + <li>blocks = Blocks used (POSIX only)</li> + <li>ctime = Creation timestamp</li> + <li>dev = Device ID</li> + <li>gid = Group ID</li> + <li>ino = Inode</li> + <li>modedec = Mode converted into a decimal number</li> + <li>modestr = Mode as string as returned by <code>ls -l</code></li> + <li>mtime = Last modification timestamp</li> + <li>nlink = Number of links</li> + <li>rdev = Device ID (if special file)</li> + <li>size = Size in bytes</li> + <li>type = ["reg", "dir", "chr", "blk", "fifo", "lnk", "sock"]</li> + <li>uid = User ID</li> + </ul> + + + +</dd> + + + + +<dt><a name="File.sync"></a><strong>File:sync</strong> (data_only)</dt> +<dd> + + Synchronizes the file with the storage device. + Returns when the file is successfully written to the disk. + + +<h3>Parameters</h3> +<ul> + + <li> + data_only: Do not synchronize the metadata. (optional, boolean) + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li>This function calls fsync() when data_only equals false + otherwise fdatasync(), on Windows _commit() is used instead. + + <li>fdatasync() is only supported by Linux and Solaris. For other systems + the <em>data_only</em> parameter is ignored and fsync() is always called. + +</ul> + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="File.tell"></a><strong>File:tell</strong> ()</dt> +<dd> + + Return the current read / write offset of the file descriptor. + + + + + +<h3>Usage:</h3> +This function calls lseek() with offset 0 from the current position. + + + +<h3>Return value:</h3> +offset position + + + +</dd> + + + + +<dt><a name="File.write"></a><strong>File:write</strong> (buffer, offset, length)</dt> +<dd> + + Write to the file descriptor. + + +<h3>Parameters</h3> +<ul> + + <li> + buffer: Buffer holding the data to be written. + </li> + + <li> + offset: Offset to start reading the buffer from. (optional) + </li> + + <li> + length: Length of chunk to read from the buffer. (optional) + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li><strong>Warning:</strong> It is not guaranteed that all data + in the buffer is written at once especially when dealing with pipes. + You have to check the return value - the number of bytes actually written - + or use the safe IO functions in the high-level IO utility module. + + <li>Unlike standard Lua indexing the lowest offset and default is 0. + +</ul> + + + +<h3>Return value:</h3> +number of bytes written + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/nixio.README.html b/doc/modules/nixio.README.html new file mode 100644 index 000000000..94182a0ee --- /dev/null +++ b/doc/modules/nixio.README.html @@ -0,0 +1,342 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li><strong>nixio.README</strong></li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Class <code>nixio.README</code></h1> + +<p> + General Information.</p> + + + + + + + + + + +<h2>Tables</h2> +<table class="table_list"> + + <tr> + <td class="name" nowrap><a href="#Errorhandling">Errorhandling</a></td> + <td class="summary"> + General error handling information.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#Functions">Functions</a></td> + <td class="summary"> + Function conventions.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#Platforms">Platforms</a></td> + <td class="summary"> + Platform information.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#TLS-Crypto">TLS-Crypto</a></td> + <td class="summary"> + Cryptography and TLS libraries.</td> + </tr> + +</table> + + + +<br/> +<br/> + + + + +<h2><a name="tables"></a>Tables</h2> +<dl class="table"> + +<dt><a name="Errorhandling"></a><strong>Errorhandling</strong></dt> +<dd> + General error handling information. + <ul> + <li> Most of the functions available in this library may fail. If any error + occurs the function returns <strong>nil or false</strong>, an error code + (usually errno) and an additional error message text (if avaialable).</li> + <li>At the moment false is only returned when a non-blocking I/O function + fails with EAGAIN, EWOULDBLOCK or WSAEWOULDBLOCK for any others nil is + returned as first parameter. Therefore you can use false to write portable + non-blocking I/O applications.</li> + <li>Note that the function documentation does only mention the return values + in case of a successful operation.</li> + <li>You can find a table of common error numbers and other useful constants + like signal numbers in <strong>nixio.const</strong> e.g. nixio.const.EINVAL, + nixio.const.SIGTERM, etc. For portability there is a second error constant + table <strong>nixio.const_sock</strong> for socket error codes. This might + be important if you are dealing with Windows applications, on POSIX however + const_sock is just an alias for const.</li> + <li>With some exceptions - which are explicitely stated in the function + documentation - all blocking functions are signal-protected and will not fail + with EINTR.</li> + <li>On POSIX the SIGPIPE signal will be set to ignore upon initialization. + You should restore the default behaviour or set a custom signal handler + in your program after loading nixio if you need this behaviour.</li> + </ul> + + + +</dd> + + +<dt><a name="Functions"></a><strong>Functions</strong></dt> +<dd> + Function conventions. + <br />In general all functions are namend and behave like their POSIX API + counterparts - where applicable - applying the following rules: + <ul> + <li>Functions should be named like the underlying POSIX API function ommiting + prefixes or suffixes - especially when placed in an object-context ( + lockf -> File:lock, fsync -> File:sync, dup2 -> dup, ...)</li> + <li>If you are unclear about the behaviour of a function you should consult + your OS API documentation (e.g. the manpages).</li> + <li>If the name is significantly different from the POSIX-function, the + underlying function(s) are stated in the documentation.</li> + <li>Parameters should reflect those of the C-API, buffer length arguments and + by-reference parameters should be ommitted for pratical purposes.</li> + <li>If a C function accepts a bitfield as parameter, it should be translated + into lower case string flags representing the flags if the bitfield is the + last parameter and also ommiting prefixes or suffixes. (e.g. waitpid + (pid, &s, WNOHANG | WUNTRACED) -> waitpid(pid, "nohang", "untraced"), + getsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) -> + Socket:getopt("socket", "reuseaddr"), etc.) </li> + <li>If it is not applicable to provide a string representation of the + bitfield a bitfield generator helper is provided. It is named FUNCTION_flags. + (open("/tmp/test", O_RDONLY | O_NONBLOCK) -> open("/tmp/test", open_flags( + "rdonly", "nonblock")))</li> + </ul> + + + +</dd> + + +<dt><a name="Platforms"></a><strong>Platforms</strong></dt> +<dd> + Platform information. + <ul> + <li>The minimum platform requirements are a decent POSIX 2001 support. + Builds are more or less tested on Linux, Solaris and FreeBSD. Builds for + Windows XP SP1 and later can be compiled with MinGW either from Windows + itself or using the MinGW cross-compiler. Earlier versions of Windows are not + supported.</li> + <li>In general all functions which don't have any remarks + in their documentation are available on all platforms.</li> + <li>Functions with a (POSIX), (Linux) or similar prefix are only available + on these specific platforms. Same appplies to parameters of functions + with a similar suffix.</li> + <li>Some functions might have limitations on some platforms. This should + be stated in the documentation. Please also consult your OS API + documentation.</li> + </ul> + + + +</dd> + + +<dt><a name="TLS-Crypto"></a><strong>TLS-Crypto</strong></dt> +<dd> + Cryptography and TLS libraries. + <ul> + <li>Currently 3 underlying cryptography libraries are supported: openssl, + cyassl and axTLS. The name of the library in use is written to + <strong>nixio.tls_provider</strong></li> + <li>You should whenever possible use openssl or cyassl as axTLS has only + limited support. It does not provide support for non-blocking sockets and + is probably less audited than the other ones.</li> + <li>As the supported Windows versions are not suitable for embedded devices + axTLS is at the moment not supported on Windows.</li> + </ul> + + + +</dd> + + +</dl> + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/nixio.Socket.html b/doc/modules/nixio.Socket.html new file mode 100644 index 000000000..ccb10250a --- /dev/null +++ b/doc/modules/nixio.Socket.html @@ -0,0 +1,1001 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li><strong>nixio.Socket</strong></li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Object Instance <code>nixio.Socket</code></h1> + +<p> + Socket Object. + Supports IPv4, IPv6 and UNIX (POSIX only) families.</p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#Socket.accept">Socket:accept</a> ()</td> + <td class="summary"> + Accept a connection on the socket.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#Socket.bind">Socket:bind</a> (host, port)</td> + <td class="summary"> + Bind the socket to a network address.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#Socket.close">Socket:close</a> ()</td> + <td class="summary"> + Close the socket.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#Socket.connect">Socket:connect</a> (host, port)</td> + <td class="summary"> + Connect the socket to a network address.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#Socket.fileno">Socket:fileno</a> ()</td> + <td class="summary"> + Get the number of the filedescriptor.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#Socket.getopt">Socket:getopt</a> (level, option)</td> + <td class="summary"> + Get a socket option.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#Socket.getpeername">Socket:getpeername</a> ()</td> + <td class="summary"> + Get the peer address of a socket.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#Socket.getsockname">Socket:getsockname</a> ()</td> + <td class="summary"> + Get the local address of a socket.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#Socket.listen">Socket:listen</a> (backlog)</td> + <td class="summary"> + Listen for connections on the socket.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#Socket.read ">Socket:read </a> (length)</td> + <td class="summary"> + Receive a message on the socket (This is an alias for recv).</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#Socket.recv ">Socket:recv </a> (length)</td> + <td class="summary"> + Receive a message on the socket.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#Socket.recvfrom">Socket:recvfrom</a> (length)</td> + <td class="summary"> + Receive a message on the socket including the senders source address.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#Socket.send">Socket:send</a> (buffer, offset, length)</td> + <td class="summary"> + Send a message on the socket.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#Socket.sendto">Socket:sendto</a> (buffer, host, port, offset, length)</td> + <td class="summary"> + Send a message on the socket specifying the destination.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#Socket.setblocking">Socket:setblocking</a> (blocking)</td> + <td class="summary"> + Set the blocking mode of the socket.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#Socket.setopt">Socket:setopt</a> (level, option, value)</td> + <td class="summary"> + Set a socket option.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#Socket.shutdown">Socket:shutdown</a> (how)</td> + <td class="summary"> + Shut down part of a full-duplex connection.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#Socket.write">Socket:write</a> (buffer, offset, length)</td> + <td class="summary"> + Send a message on the socket (This is an alias for send).</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="Socket.accept"></a><strong>Socket:accept</strong> ()</dt> +<dd> + + Accept a connection on the socket. + + + + + + + +<h3>Return values:</h3> +<ol> + + <li>Socket Object + + <li>Peer IP-Address + + <li>Peer Port + +</ol> + + + +</dd> + + + + +<dt><a name="Socket.bind"></a><strong>Socket:bind</strong> (host, port)</dt> +<dd> + + Bind the socket to a network address. + + +<h3>Parameters</h3> +<ul> + + <li> + host: Host (optional, default: all addresses) + </li> + + <li> + port: Port or service description + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li>This function calls getaddrinfo() and bind() but NOT listen(). + + <li>If <em>host</em> is a domain name it will be looked up and bind() + tries the IP-Addresses in the order returned by the DNS resolver + until the bind succeeds. + + <li>UNIX sockets ignore the <em>port</em>, + and interpret <em>host</em> as a socket path. + +</ul> + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="Socket.close"></a><strong>Socket:close</strong> ()</dt> +<dd> + + Close the socket. + + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="Socket.connect"></a><strong>Socket:connect</strong> (host, port)</dt> +<dd> + + Connect the socket to a network address. + + +<h3>Parameters</h3> +<ul> + + <li> + host: Hostname or IP-Address (optional, default: localhost) + </li> + + <li> + port: Port or service description + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li>This function calls getaddrinfo() and connect(). + + <li>If <em>host</em> is a domain name it will be looked up and connect() + tries the IP-Addresses in the order returned by the DNS resolver + until the connect succeeds. + + <li>UNIX sockets ignore the <em>port</em>, + and interpret <em>host</em> as a socket path. + +</ul> + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="Socket.fileno"></a><strong>Socket:fileno</strong> ()</dt> +<dd> + + Get the number of the filedescriptor. + + + + + + + +<h3>Return value:</h3> +file descriptor number + + + +</dd> + + + + +<dt><a name="Socket.getopt"></a><strong>Socket:getopt</strong> (level, option)</dt> +<dd> + + Get a socket option. + + +<h3>Parameters</h3> +<ul> + + <li> + level: Level ["socket", "tcp", "ip", "ipv6"] + </li> + + <li> + option: Option ["keepalive", "reuseaddr", "sndbuf", "rcvbuf", + "priority", "broadcast", "linger", "sndtimeo", "rcvtimeo", "dontroute", + "bindtodevice", "error", "oobinline", "cork" (TCP), "nodelay" (TCP), + "mtu" (IP, IPv6), "hdrincl" (IP), "multicast_ttl" (IP), "multicast_loop" + (IP, IPv6), "multicast_if" (IP, IPv6), "v6only" (IPv6), "multicast_hops" + (IPv6), "add_membership" (IP, IPv6), "drop_membership" (IP, IPv6)] + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Value + + + +</dd> + + + + +<dt><a name="Socket.getpeername"></a><strong>Socket:getpeername</strong> ()</dt> +<dd> + + Get the peer address of a socket. + + + + + + + +<h3>Return values:</h3> +<ol> + + <li>IP-Address + + <li>Port + +</ol> + + + +</dd> + + + + +<dt><a name="Socket.getsockname"></a><strong>Socket:getsockname</strong> ()</dt> +<dd> + + Get the local address of a socket. + + + + + + + +<h3>Return values:</h3> +<ol> + + <li>IP-Address + + <li>Port + +</ol> + + + +</dd> + + + + +<dt><a name="Socket.listen"></a><strong>Socket:listen</strong> (backlog)</dt> +<dd> + + Listen for connections on the socket. + + +<h3>Parameters</h3> +<ul> + + <li> + backlog: Length of queue for pending connections + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="Socket.read "></a><strong>Socket:read </strong> (length)</dt> +<dd> + + Receive a message on the socket (This is an alias for recv). + See the recvfrom description for more details. + + +<h3>Parameters</h3> +<ul> + + <li> + length: Amount of data to read (in Bytes). + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +buffer containing data successfully read + + + +<h3>See also:</h3> +<ul> + + <li><a href="#Socket.recvfrom"> + Socket:recvfrom + </a> + +</ul> + +</dd> + + + + +<dt><a name="Socket.recv "></a><strong>Socket:recv </strong> (length)</dt> +<dd> + + Receive a message on the socket. + This function is identical to recvfrom except that it does not return + the sender's source address. See the recvfrom description for more details. + + +<h3>Parameters</h3> +<ul> + + <li> + length: Amount of data to read (in Bytes). + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +buffer containing data successfully read + + + +<h3>See also:</h3> +<ul> + + <li><a href="#Socket.recvfrom"> + Socket:recvfrom + </a> + +</ul> + +</dd> + + + + +<dt><a name="Socket.recvfrom"></a><strong>Socket:recvfrom</strong> (length)</dt> +<dd> + + Receive a message on the socket including the senders source address. + + +<h3>Parameters</h3> +<ul> + + <li> + length: Amount of data to read (in Bytes). + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li><strong>Warning:</strong> It is not guaranteed that all requested data + is read at once. + You have to check the return value - the length of the buffer actually read - + or use the safe IO functions in the high-level IO utility module. + + <li>The length of the return buffer is limited by the (compile time) + nixio buffersize which is <em>nixio.const.buffersize</em> (8192 by default). + Any read request greater than that will be safely truncated to this value. + +</ul> + + + +<h3>Return values:</h3> +<ol> + + <li>buffer containing data successfully read + + <li>host IP-Address of the sender + + <li>port Port of the sender + +</ol> + + + +</dd> + + + + +<dt><a name="Socket.send"></a><strong>Socket:send</strong> (buffer, offset, length)</dt> +<dd> + + Send a message on the socket. + This function is identical to sendto except for the missing destination + paramters. See the sendto description for a detailed description. + + +<h3>Parameters</h3> +<ul> + + <li> + buffer: Buffer holding the data to be written. + </li> + + <li> + offset: Offset to start reading the buffer from. (optional) + </li> + + <li> + length: Length of chunk to read from the buffer. (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +number of bytes written + + + +<h3>See also:</h3> +<ul> + + <li><a href="#Socket.sendto"> + Socket:sendto + </a> + +</ul> + +</dd> + + + + +<dt><a name="Socket.sendto"></a><strong>Socket:sendto</strong> (buffer, host, port, offset, length)</dt> +<dd> + + Send a message on the socket specifying the destination. + + +<h3>Parameters</h3> +<ul> + + <li> + buffer: Buffer holding the data to be written. + </li> + + <li> + host: Target IP-Address + </li> + + <li> + port: Target Port + </li> + + <li> + offset: Offset to start reading the buffer from. (optional) + </li> + + <li> + length: Length of chunk to read from the buffer. (optional) + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li><strong>Warning:</strong> It is not guaranteed that all data + in the buffer is written at once. + You have to check the return value - the number of bytes actually written - + or use the safe IO functions in the high-level IO utility module. + + <li>Unlike standard Lua indexing the lowest offset and default is 0. + +</ul> + + + +<h3>Return value:</h3> +number of bytes written + + + +</dd> + + + + +<dt><a name="Socket.setblocking"></a><strong>Socket:setblocking</strong> (blocking)</dt> +<dd> + + Set the blocking mode of the socket. + + +<h3>Parameters</h3> +<ul> + + <li> + blocking: (boolean) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="Socket.setopt"></a><strong>Socket:setopt</strong> (level, option, value)</dt> +<dd> + + Set a socket option. + + +<h3>Parameters</h3> +<ul> + + <li> + level: Level ["socket", "tcp", "ip", "ipv6"] + </li> + + <li> + option: Option ["keepalive", "reuseaddr", "sndbuf", "rcvbuf", + "priority", "broadcast", "linger", "sndtimeo", "rcvtimeo", "dontroute", + "bindtodevice", "error", "oobinline", "cork" (TCP), "nodelay" (TCP), + "mtu" (IP, IPv6), "hdrincl" (IP), "multicast_ttl" (IP), "multicast_loop" + (IP, IPv6), "multicast_if" (IP, IPv6), "v6only" (IPv6), "multicast_hops" + (IPv6), "add_membership" (IP, IPv6), "drop_membership" (IP, IPv6)] + </li> + + <li> + value: Value + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="Socket.shutdown"></a><strong>Socket:shutdown</strong> (how)</dt> +<dd> + + Shut down part of a full-duplex connection. + + +<h3>Parameters</h3> +<ul> + + <li> + how: (optional, default: rdwr) ["rdwr", "rd", "wr"] + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="Socket.write"></a><strong>Socket:write</strong> (buffer, offset, length)</dt> +<dd> + + Send a message on the socket (This is an alias for send). + See the sendto description for a detailed description. + + +<h3>Parameters</h3> +<ul> + + <li> + buffer: Buffer holding the data to be written. + </li> + + <li> + offset: Offset to start reading the buffer from. (optional) + </li> + + <li> + length: Length of chunk to read from the buffer. (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +number of bytes written + + + +<h3>See also:</h3> +<ul> + + <li><a href="#Socket.sendto"> + Socket:sendto + </a> + +</ul> + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/nixio.TLSContext.html b/doc/modules/nixio.TLSContext.html new file mode 100644 index 000000000..a0f630974 --- /dev/null +++ b/doc/modules/nixio.TLSContext.html @@ -0,0 +1,447 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li><strong>nixio.TLSContext</strong></li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Object Instance <code>nixio.TLSContext</code></h1> + +<p> + Transport Layer Security Context Object.</p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#TLSContext.create">TLSContext:create</a> (socket)</td> + <td class="summary"> + Create a TLS Socket from a socket descriptor.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#TLSContext.set_cert">TLSContext:set_cert</a> (path)</td> + <td class="summary"> + Assign a PEM certificate to this context.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#TLSContext.set_ciphers">TLSContext:set_ciphers</a> (cipherlist)</td> + <td class="summary"> + Set the available ciphers for this context.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#TLSContext.set_key">TLSContext:set_key</a> (path)</td> + <td class="summary"> + Assign a PEM private key to this context.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#TLSContext.set_verify">TLSContext:set_verify</a> (flag1, ...)</td> + <td class="summary"> + Set the verification flags of this context.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#TLSContext.set_verify_depth">TLSContext:set_verify_depth</a> (depth)</td> + <td class="summary"> + Set the verification depth of this context.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="TLSContext.create"></a><strong>TLSContext:create</strong> (socket)</dt> +<dd> + + Create a TLS Socket from a socket descriptor. + + +<h3>Parameters</h3> +<ul> + + <li> + socket: Socket Object + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +TLSSocket Object + + + +</dd> + + + + +<dt><a name="TLSContext.set_cert"></a><strong>TLSContext:set_cert</strong> (path)</dt> +<dd> + + Assign a PEM certificate to this context. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Certificate File path + </li> + +</ul> + + + + +<h3>Usage:</h3> +This function calls SSL_CTX_use_certificate_chain_file(). + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="TLSContext.set_ciphers"></a><strong>TLSContext:set_ciphers</strong> (cipherlist)</dt> +<dd> + + Set the available ciphers for this context. + + +<h3>Parameters</h3> +<ul> + + <li> + cipherlist: String containing a list of ciphers + </li> + +</ul> + + + + +<h3>Usage:</h3> +This function calls SSL_CTX_set_cipher_list(). + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="TLSContext.set_key"></a><strong>TLSContext:set_key</strong> (path)</dt> +<dd> + + Assign a PEM private key to this context. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Private Key File path + </li> + +</ul> + + + + +<h3>Usage:</h3> +This function calls SSL_CTX_use_PrivateKey_file(). + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="TLSContext.set_verify"></a><strong>TLSContext:set_verify</strong> (flag1, ...)</dt> +<dd> + + Set the verification flags of this context. + + +<h3>Parameters</h3> +<ul> + + <li> + flag1: First Flag ["none", "peer", "verify_fail_if_no_peer_cert", + "client_once"] + </li> + + <li> + ...: More Flags [-"-] + </li> + +</ul> + + + + +<h3>Usage:</h3> +This function calls SSL_CTX_set_verify(). + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="TLSContext.set_verify_depth"></a><strong>TLSContext:set_verify_depth</strong> (depth)</dt> +<dd> + + Set the verification depth of this context. + + +<h3>Parameters</h3> +<ul> + + <li> + depth: Depth + </li> + +</ul> + + + + +<h3>Usage:</h3> +This function calls SSL_CTX_set_verify_depth(). + + + +<h3>Return value:</h3> +true + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/nixio.TLSSocket.html b/doc/modules/nixio.TLSSocket.html new file mode 100644 index 000000000..36b31f344 --- /dev/null +++ b/doc/modules/nixio.TLSSocket.html @@ -0,0 +1,543 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li><strong>nixio.TLSSocket</strong></li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Object Instance <code>nixio.TLSSocket</code></h1> + +<p> + TLS Socket Object. + TLS Sockets contain the underlying socket and context in the fields + "socket" and "context".</p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#TLSSocket.accept">TLSSocket:accept</a> ()</td> + <td class="summary"> + Wait for a TLS handshake from a client.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#TLSSocket.connect">TLSSocket:connect</a> ()</td> + <td class="summary"> + Initiate the TLS handshake as client with the server.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#TLSSocket.read ">TLSSocket:read </a> (length)</td> + <td class="summary"> + Receive a message on the socket (This is an alias for recv).</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#TLSSocket.recv">TLSSocket:recv</a> (length)</td> + <td class="summary"> + Receive a message on the socket.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#TLSSocket.send">TLSSocket:send</a> (buffer, offset, length)</td> + <td class="summary"> + Send a message to the socket.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#TLSSocket.shutdown">TLSSocket:shutdown</a> ()</td> + <td class="summary"> + Shut down the TLS connection.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#TLSSocket.write">TLSSocket:write</a> (buffer, offset, length)</td> + <td class="summary"> + Send a message on the socket (This is an alias for send).</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="TLSSocket.accept"></a><strong>TLSSocket:accept</strong> ()</dt> +<dd> + + Wait for a TLS handshake from a client. + + + + + +<h3>Usage</h3> +<ul> + + <li>This function calls SSL_accept(). + + <li>You have to call either connect or accept before transmitting data. + +</ul> + + + +<h3>Return value:</h3> +true + + + +<h3>See also:</h3> +<ul> + + <li><a href="#TLSSocket.connect"> + TLSSocket:connect + </a> + +</ul> + +</dd> + + + + +<dt><a name="TLSSocket.connect"></a><strong>TLSSocket:connect</strong> ()</dt> +<dd> + + Initiate the TLS handshake as client with the server. + + + + + +<h3>Usage</h3> +<ul> + + <li>This function calls SSL_connect(). + + <li>You have to call either connect or accept before transmitting data. + +</ul> + + + +<h3>Return value:</h3> +true + + + +<h3>See also:</h3> +<ul> + + <li><a href="#TLSSocket.accept"> + TLSSocket:accept + </a> + +</ul> + +</dd> + + + + +<dt><a name="TLSSocket.read "></a><strong>TLSSocket:read </strong> (length)</dt> +<dd> + + Receive a message on the socket (This is an alias for recv). + See the recv description for more details. + + +<h3>Parameters</h3> +<ul> + + <li> + length: Amount of data to read (in Bytes). + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +buffer containing data successfully read + + + +<h3>See also:</h3> +<ul> + + <li><a href="#TLSSocket.recv"> + TLSSocket:recv + </a> + +</ul> + +</dd> + + + + +<dt><a name="TLSSocket.recv"></a><strong>TLSSocket:recv</strong> (length)</dt> +<dd> + + Receive a message on the socket. + + +<h3>Parameters</h3> +<ul> + + <li> + length: Amount of data to read (in Bytes). + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li>This function calls SSL_read(). + + <li><strong>Warning:</strong> It is not guaranteed that all requested data + is read at once. + You have to check the return value - the length of the buffer actually read - + or use the safe IO functions in the high-level IO utility module. + + <li>The length of the return buffer is limited by the (compile time) + nixio buffersize which is <em>nixio.const.buffersize</em> (8192 by default). + Any read request greater than that will be safely truncated to this value. + +</ul> + + + +<h3>Return value:</h3> +buffer containing data successfully read + + + +</dd> + + + + +<dt><a name="TLSSocket.send"></a><strong>TLSSocket:send</strong> (buffer, offset, length)</dt> +<dd> + + Send a message to the socket. + + +<h3>Parameters</h3> +<ul> + + <li> + buffer: Buffer holding the data to be written. + </li> + + <li> + offset: Offset to start reading the buffer from. (optional) + </li> + + <li> + length: Length of chunk to read from the buffer. (optional) + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li>This function calls SSL_write(). + + <li><strong>Warning:</strong> It is not guaranteed that all data + in the buffer is written at once. + You have to check the return value - the number of bytes actually written - + or use the safe IO functions in the high-level IO utility module. + + <li>Unlike standard Lua indexing the lowest offset and default is 0. + +</ul> + + + +<h3>Return value:</h3> +number of bytes written + + + +</dd> + + + + +<dt><a name="TLSSocket.shutdown"></a><strong>TLSSocket:shutdown</strong> ()</dt> +<dd> + + Shut down the TLS connection. + + + + + +<h3>Usage:</h3> +This function calls SSL_shutdown(). + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="TLSSocket.write"></a><strong>TLSSocket:write</strong> (buffer, offset, length)</dt> +<dd> + + Send a message on the socket (This is an alias for send). + See the send description for a detailed description. + + +<h3>Parameters</h3> +<ul> + + <li> + buffer: Buffer holding the data to be written. + </li> + + <li> + offset: Offset to start reading the buffer from. (optional) + </li> + + <li> + length: Length of chunk to read from the buffer. (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +number of bytes written + + + +<h3>See also:</h3> +<ul> + + <li><a href="#TLSSocket.send"> + TLSSocket:send + </a> + +</ul> + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/nixio.UnifiedIO.html b/doc/modules/nixio.UnifiedIO.html new file mode 100644 index 000000000..576c23fed --- /dev/null +++ b/doc/modules/nixio.UnifiedIO.html @@ -0,0 +1,735 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li><strong>nixio.UnifiedIO</strong></li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Object Instance <code>nixio.UnifiedIO</code></h1> + +<p> + Unified high-level I/O utility API for Files, Sockets and TLS-Sockets. + These functions are added to the object function tables by doing <strong> + require "nixio.util"</strong>, can be used on all nixio IO Descriptors and + are based on the shared low-level read() and write() functions.</p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#UnifiedIO.blocksource">UnifiedIO:blocksource</a> (blocksize, limit)</td> + <td class="summary"> + Create a block-based iterator.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#UnifiedIO.close">UnifiedIO:close</a> ()</td> + <td class="summary"> + Close the descriptor.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#UnifiedIO.copy">UnifiedIO:copy</a> (fdout, size)</td> + <td class="summary"> + Copy data from the current descriptor to another one.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#UnifiedIO.copyz">UnifiedIO:copyz</a> (fdout, size)</td> + <td class="summary"> + Copy data from the current descriptor to another one using kernel-space + copying if possible.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#UnifiedIO.is_file">UnifiedIO:is_file</a> ()</td> + <td class="summary"> + Test whether the I/O-Descriptor is a file.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#UnifiedIO.is_socket">UnifiedIO:is_socket</a> ()</td> + <td class="summary"> + Test whether the I/O-Descriptor is a socket.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#UnifiedIO.is_tls_socket">UnifiedIO:is_tls_socket</a> ()</td> + <td class="summary"> + Test whether the I/O-Descriptor is a TLS socket.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#UnifiedIO.linesource">UnifiedIO:linesource</a> (limit)</td> + <td class="summary"> + Create a line-based iterator.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#UnifiedIO.readall">UnifiedIO:readall</a> (length)</td> + <td class="summary"> + Read a block of data and wait until all data is available.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#UnifiedIO.sink">UnifiedIO:sink</a> (close_when_done)</td> + <td class="summary"> + Create a sink.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#UnifiedIO.writeall">UnifiedIO:writeall</a> (block)</td> + <td class="summary"> + Write a block of data and wait until all data is written.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="UnifiedIO.blocksource"></a><strong>UnifiedIO:blocksource</strong> (blocksize, limit)</dt> +<dd> + + Create a block-based iterator. + + +<h3>Parameters</h3> +<ul> + + <li> + blocksize: Advisory blocksize (optional) + </li> + + <li> + limit: Amount of data to consume (optional) + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li>This function uses the low-level read function of the descriptor. + + <li>The blocksize given is only advisory and to be seen as an upper limit, + if an underlying read returns less bytes the chunk is nevertheless returned. + + <li>If the limit parameter is ommited, the iterator returns data + until an end-of-file, end-of-stream, connection shutdown or similar happens. + + <li>The iterator will not buffer so it is safe to mix with calls to read. + + <li>If the descriptor is non-blocking the iterator may fail with EAGAIN. + + <li>The iterator can be used as an LTN12 source. + +</ul> + + + +<h3>Return value:</h3> +Block-based Iterator + + + +</dd> + + + + +<dt><a name="UnifiedIO.close"></a><strong>UnifiedIO:close</strong> ()</dt> +<dd> + + Close the descriptor. + + + + + +<h3>Usage:</h3> +If the descriptor is a TLS-socket the underlying descriptor is + closed without touching the TLS connection. + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="UnifiedIO.copy"></a><strong>UnifiedIO:copy</strong> (fdout, size)</dt> +<dd> + + Copy data from the current descriptor to another one. + + +<h3>Parameters</h3> +<ul> + + <li> + fdout: Target Descriptor + </li> + + <li> + size: Bytes to copy (optional) + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li>This function uses the blocksource function of the source descriptor + and the sink function of the target descriptor. + + <li>If the limit parameter is ommited, data is copied + until an end-of-file, end-of-stream, connection shutdown or similar happens. + + <li>If the descriptor is non-blocking the function may fail with EAGAIN. + +</ul> + + + +<h3>Return values:</h3> +<ol> + + <li>bytes that were successfully written if no error occured + + <li>- reserved for error code - + + <li>- reserved for error message - + + <li>bytes that were successfully written even if an error occured + +</ol> + + + +</dd> + + + + +<dt><a name="UnifiedIO.copyz"></a><strong>UnifiedIO:copyz</strong> (fdout, size)</dt> +<dd> + + Copy data from the current descriptor to another one using kernel-space + copying if possible. + + +<h3>Parameters</h3> +<ul> + + <li> + fdout: Target Descriptor + </li> + + <li> + size: Bytes to copy (optional) + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li>This function uses the sendfile() syscall to copy the data or the + blocksource function of the source descriptor and the sink function + of the target descriptor as a fallback mechanism. + + <li>If the limit parameter is ommited, data is copied + until an end-of-file, end-of-stream, connection shutdown or similar happens. + + <li>If the descriptor is non-blocking the function may fail with EAGAIN. + +</ul> + + + +<h3>Return values:</h3> +<ol> + + <li>bytes that were successfully written if no error occured + + <li>- reserved for error code - + + <li>- reserved for error message - + + <li>bytes that were successfully written even if an error occured + +</ol> + + + +</dd> + + + + +<dt><a name="UnifiedIO.is_file"></a><strong>UnifiedIO:is_file</strong> ()</dt> +<dd> + + Test whether the I/O-Descriptor is a file. + + + + + + + +<h3>Return value:</h3> +boolean + + + +</dd> + + + + +<dt><a name="UnifiedIO.is_socket"></a><strong>UnifiedIO:is_socket</strong> ()</dt> +<dd> + + Test whether the I/O-Descriptor is a socket. + + + + + + + +<h3>Return value:</h3> +boolean + + + +</dd> + + + + +<dt><a name="UnifiedIO.is_tls_socket"></a><strong>UnifiedIO:is_tls_socket</strong> ()</dt> +<dd> + + Test whether the I/O-Descriptor is a TLS socket. + + + + + + + +<h3>Return value:</h3> +boolean + + + +</dd> + + + + +<dt><a name="UnifiedIO.linesource"></a><strong>UnifiedIO:linesource</strong> (limit)</dt> +<dd> + + Create a line-based iterator. + Lines may end with either \n or \r\n, these control chars are not included + in the return value. + + +<h3>Parameters</h3> +<ul> + + <li> + limit: Line limit + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li>This function uses the low-level read function of the descriptor. + + <li><strong>Note:</strong> This function uses an internal buffer to read + ahead. Do NOT mix calls to read(all) and the returned iterator. If you want + to stop reading line-based and want to use the read(all) functions instead + you can pass "true" to the iterator which will flush the buffer + and return the bufferd data. + + <li>If the limit parameter is ommited, this function uses the nixio + buffersize (8192B by default). + + <li>If the descriptor is non-blocking the iterator may fail with EAGAIN. + + <li>The iterator can be used as an LTN12 source. + +</ul> + + + +<h3>Return value:</h3> +Line-based Iterator + + + +</dd> + + + + +<dt><a name="UnifiedIO.readall"></a><strong>UnifiedIO:readall</strong> (length)</dt> +<dd> + + Read a block of data and wait until all data is available. + + +<h3>Parameters</h3> +<ul> + + <li> + length: Bytes to read (optional) + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li>This function uses the low-level read function of the descriptor. + + <li>If the length parameter is ommited, this function returns all data + that can be read before an end-of-file, end-of-stream, connection shutdown + or similar happens. + + <li>If the descriptor is non-blocking this function may fail with EAGAIN. + +</ul> + + + +<h3>Return values:</h3> +<ol> + + <li>data that was successfully read if no error occured + + <li>- reserved for error code - + + <li>- reserved for error message - + + <li>data that was successfully read even if an error occured + +</ol> + + + +</dd> + + + + +<dt><a name="UnifiedIO.sink"></a><strong>UnifiedIO:sink</strong> (close_when_done)</dt> +<dd> + + Create a sink. + This sink will simply write all data that it receives and optionally + close the descriptor afterwards. + + +<h3>Parameters</h3> +<ul> + + <li> + close_when_done: (optional, boolean) + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li>This function uses the writeall function of the descriptor. + + <li>If the descriptor is non-blocking the sink may fail with EAGAIN. + + <li>The iterator can be used as an LTN12 sink. + +</ul> + + + +<h3>Return value:</h3> +Sink + + + +</dd> + + + + +<dt><a name="UnifiedIO.writeall"></a><strong>UnifiedIO:writeall</strong> (block)</dt> +<dd> + + Write a block of data and wait until all data is written. + + +<h3>Parameters</h3> +<ul> + + <li> + block: Bytes to write + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li>This function uses the low-level write function of the descriptor. + + <li>If the descriptor is non-blocking this function may fail with EAGAIN. + +</ul> + + + +<h3>Return values:</h3> +<ol> + + <li>bytes that were successfully written if no error occured + + <li>- reserved for error code - + + <li>- reserved for error message - + + <li>bytes that were successfully written even if an error occured + +</ol> + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/nixio.bin.html b/doc/modules/nixio.bin.html new file mode 100644 index 000000000..33421b743 --- /dev/null +++ b/doc/modules/nixio.bin.html @@ -0,0 +1,395 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li><strong>nixio.bin</strong></li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Class <code>nixio.bin</code></h1> + +<p> + Binary operations and conversion.</p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#b64decode">b64decode</a> (buffer)</td> + <td class="summary"> + Base64 decode a given buffer.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#b64encode">b64encode</a> (buffer)</td> + <td class="summary"> + Base64 encode a given buffer.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#crc32">crc32</a> (buffer, initial)</td> + <td class="summary"> + Calculate the CRC32 value of a buffer.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#hexlify">hexlify</a> (buffer)</td> + <td class="summary"> + Return a hexadecimal ASCII represantation of the content of a buffer.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#unhexlify">unhexlify</a> (hexvalue)</td> + <td class="summary"> + Return a binary buffer from a hexadecimal ASCII representation.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="b64decode"></a><strong>b64decode</strong> (buffer)</dt> +<dd> + + Base64 decode a given buffer. + + +<h3>Parameters</h3> +<ul> + + <li> + buffer: Base 64 Encoded data + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +binary data + + + +</dd> + + + + +<dt><a name="b64encode"></a><strong>b64encode</strong> (buffer)</dt> +<dd> + + Base64 encode a given buffer. + + +<h3>Parameters</h3> +<ul> + + <li> + buffer: Buffer + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +base64 encoded buffer + + + +</dd> + + + + +<dt><a name="crc32"></a><strong>crc32</strong> (buffer, initial)</dt> +<dd> + + Calculate the CRC32 value of a buffer. + + +<h3>Parameters</h3> +<ul> + + <li> + buffer: Buffer + </li> + + <li> + initial: Initial CRC32 value (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +crc32 value + + + +</dd> + + + + +<dt><a name="hexlify"></a><strong>hexlify</strong> (buffer)</dt> +<dd> + + Return a hexadecimal ASCII represantation of the content of a buffer. + + +<h3>Parameters</h3> +<ul> + + <li> + buffer: Buffer + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +representation using characters [0-9a-f] + + + +</dd> + + + + +<dt><a name="unhexlify"></a><strong>unhexlify</strong> (hexvalue)</dt> +<dd> + + Return a binary buffer from a hexadecimal ASCII representation. + + +<h3>Parameters</h3> +<ul> + + <li> + hexvalue: representation using characters [0-9a-f] + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +binary data + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/nixio.bit.html b/doc/modules/nixio.bit.html new file mode 100644 index 000000000..80940afff --- /dev/null +++ b/doc/modules/nixio.bit.html @@ -0,0 +1,712 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li><strong>nixio.bit</strong></li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Class <code>nixio.bit</code></h1> + +<p> + Bitfield operators and mainpulation functions. + Can be used as a drop-in replacement for bitlib.</p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#arshift">arshift</a> (oper, shift)</td> + <td class="summary"> + Arithmetically right shift a number.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#band">band</a> (oper1, oper2, ...)</td> + <td class="summary"> + Bitwise AND several numbers.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#bnot">bnot</a> (oper)</td> + <td class="summary"> + Invert given number.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#bor">bor</a> (oper1, oper2, ...)</td> + <td class="summary"> + Bitwise OR several numbers.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#bxor">bxor</a> (oper1, oper2, ...)</td> + <td class="summary"> + Bitwise XOR several numbers.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#cast">cast</a> (oper)</td> + <td class="summary"> + Cast a number to the bit-operating range.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#check">check</a> (bitfield, flag1, ...)</td> + <td class="summary"> + Checks whether given flags are set in a bitfield.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#div">div</a> (oper1, oper2, ...)</td> + <td class="summary"> + Integer division of 2 or more numbers.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#lshift">lshift</a> (oper, shift)</td> + <td class="summary"> + Left shift a number.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#rshift">rshift</a> (oper, shift)</td> + <td class="summary"> + Right shift a number.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#set">set</a> (bitfield, flag1, ...)</td> + <td class="summary"> + Sets one or more flags of a bitfield.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#unset">unset</a> (bitfield, flag1, ...)</td> + <td class="summary"> + Unsets one or more flags of a bitfield.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="arshift"></a><strong>arshift</strong> (oper, shift)</dt> +<dd> + + Arithmetically right shift a number. + + +<h3>Parameters</h3> +<ul> + + <li> + oper: number + </li> + + <li> + shift: bits to shift + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +number + + + +</dd> + + + + +<dt><a name="band"></a><strong>band</strong> (oper1, oper2, ...)</dt> +<dd> + + Bitwise AND several numbers. + + +<h3>Parameters</h3> +<ul> + + <li> + oper1: First Operand + </li> + + <li> + oper2: Second Operand + </li> + + <li> + ...: More Operands + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +number + + + +</dd> + + + + +<dt><a name="bnot"></a><strong>bnot</strong> (oper)</dt> +<dd> + + Invert given number. + + +<h3>Parameters</h3> +<ul> + + <li> + oper: Operand + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +number + + + +</dd> + + + + +<dt><a name="bor"></a><strong>bor</strong> (oper1, oper2, ...)</dt> +<dd> + + Bitwise OR several numbers. + + +<h3>Parameters</h3> +<ul> + + <li> + oper1: First Operand + </li> + + <li> + oper2: Second Operand + </li> + + <li> + ...: More Operands + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +number + + + +</dd> + + + + +<dt><a name="bxor"></a><strong>bxor</strong> (oper1, oper2, ...)</dt> +<dd> + + Bitwise XOR several numbers. + + +<h3>Parameters</h3> +<ul> + + <li> + oper1: First Operand + </li> + + <li> + oper2: Second Operand + </li> + + <li> + ...: More Operands + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +number + + + +</dd> + + + + +<dt><a name="cast"></a><strong>cast</strong> (oper)</dt> +<dd> + + Cast a number to the bit-operating range. + + +<h3>Parameters</h3> +<ul> + + <li> + oper: number + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +number + + + +</dd> + + + + +<dt><a name="check"></a><strong>check</strong> (bitfield, flag1, ...)</dt> +<dd> + + Checks whether given flags are set in a bitfield. + + +<h3>Parameters</h3> +<ul> + + <li> + bitfield: Bitfield + </li> + + <li> + flag1: First Flag + </li> + + <li> + ...: More Flags + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true when all flags are set, otherwise false + + + +</dd> + + + + +<dt><a name="div"></a><strong>div</strong> (oper1, oper2, ...)</dt> +<dd> + + Integer division of 2 or more numbers. + + +<h3>Parameters</h3> +<ul> + + <li> + oper1: Operand 1 + </li> + + <li> + oper2: Operand 2 + </li> + + <li> + ...: More Operands + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +number + + + +</dd> + + + + +<dt><a name="lshift"></a><strong>lshift</strong> (oper, shift)</dt> +<dd> + + Left shift a number. + + +<h3>Parameters</h3> +<ul> + + <li> + oper: number + </li> + + <li> + shift: bits to shift + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +number + + + +</dd> + + + + +<dt><a name="rshift"></a><strong>rshift</strong> (oper, shift)</dt> +<dd> + + Right shift a number. + + +<h3>Parameters</h3> +<ul> + + <li> + oper: number + </li> + + <li> + shift: bits to shift + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +number + + + +</dd> + + + + +<dt><a name="set"></a><strong>set</strong> (bitfield, flag1, ...)</dt> +<dd> + + Sets one or more flags of a bitfield. + + +<h3>Parameters</h3> +<ul> + + <li> + bitfield: Bitfield + </li> + + <li> + flag1: First Flag + </li> + + <li> + ...: More Flags + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +altered bitfield + + + +</dd> + + + + +<dt><a name="unset"></a><strong>unset</strong> (bitfield, flag1, ...)</dt> +<dd> + + Unsets one or more flags of a bitfield. + + +<h3>Parameters</h3> +<ul> + + <li> + bitfield: Bitfield + </li> + + <li> + flag1: First Flag + </li> + + <li> + ...: More Flags + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +altered bitfield + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/nixio.crypto.html b/doc/modules/nixio.crypto.html new file mode 100644 index 000000000..d74cf5c8f --- /dev/null +++ b/doc/modules/nixio.crypto.html @@ -0,0 +1,287 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li><strong>nixio.crypto</strong></li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Class <code>nixio.crypto</code></h1> + +<p> + Cryptographical library.</p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#nixio.crypto.hash">hash</a> (algo)</td> + <td class="summary"> + Create a hash object.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.crypto.hmac">hmac</a> (algo, key)</td> + <td class="summary"> + Create a HMAC object.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="nixio.crypto.hash"></a><strong>hash</strong> (algo)</dt> +<dd> + + Create a hash object. + + +<h3>Parameters</h3> +<ul> + + <li> + algo: Algorithm ["sha1", "md5"] + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +CryptoHash Object + + + +</dd> + + + + +<dt><a name="nixio.crypto.hmac"></a><strong>hmac</strong> (algo, key)</dt> +<dd> + + Create a HMAC object. + + +<h3>Parameters</h3> +<ul> + + <li> + algo: Algorithm ["sha1", "md5"] + </li> + + <li> + key: HMAC-Key + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +CryptoHash Object + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/nixio.fs.html b/doc/modules/nixio.fs.html new file mode 100644 index 000000000..359f02395 --- /dev/null +++ b/doc/modules/nixio.fs.html @@ -0,0 +1,1530 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li> + <a href="../modules/nixio.html">nixio</a> + </li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li><strong>nixio.fs</strong></li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Class <code>nixio.fs</code></h1> + +<p> + Low-level and high-level filesystem manipulation library.</p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.access">access</a> (path, mode1, ...)</td> + <td class="summary"> + Check user's permission on a file.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.basename">basename</a> (path)</td> + <td class="summary"> + Strip the directory part from a path.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.chmod">chmod</a> (path, mode)</td> + <td class="summary"> + Change the file mode.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.chown">chown</a> (path, user, group)</td> + <td class="summary"> + (POSIX) Change owner and group of a file.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.copy">copy</a> (src, dest)</td> + <td class="summary"> + Copy a file, directory or symlink non-recursively preserving file mode, + timestamps, owner and group.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.copyr">copyr</a> (src, dest)</td> + <td class="summary"> + Copy a file, directory or symlink recursively preserving file mode, + timestamps, owner and group.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.datacopy">datacopy</a> (src, dest, limit)</td> + <td class="summary"> + Copy data between files.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.dir">dir</a> (path)</td> + <td class="summary"> + Iterate over the entries of a directory.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.dirname">dirname</a> (path)</td> + <td class="summary"> + Strip the base from a path.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.glob">glob</a> (pattern)</td> + <td class="summary"> + (POSIX) Find pathnames matching a pattern.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.lchown">lchown</a> (path, user, group)</td> + <td class="summary"> + (POSIX) Change owner and group of a file and do not resolve + if target is a symlink.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.link">link</a> (oldpath, newpath)</td> + <td class="summary"> + Create a hard link.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.lstat">lstat</a> (path, field)</td> + <td class="summary"> + Get file status and attributes and do not resolve if target is a symlink.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.mkdir">mkdir</a> (path, mode)</td> + <td class="summary"> + Create a new directory.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.mkdirr">mkdirr</a> (dest, mode)</td> + <td class="summary"> + Create a directory and all needed parent directories recursively.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.mkfifo">mkfifo</a> (path, mode)</td> + <td class="summary"> + (POSIX) Create a FIFO (named pipe).</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.move">move</a> (src, dest)</td> + <td class="summary"> + Rename a file, directory or symlink non-recursively across filesystems.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.mover">mover</a> (src, dest)</td> + <td class="summary"> + Rename a file, directory or symlink recursively across filesystems.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.readfile">readfile</a> (path, limit)</td> + <td class="summary"> + Read the contents of a file into a buffer.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.readlink">readlink</a> (path)</td> + <td class="summary"> + (POSIX) Read the target of a symbolic link.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.realpath">realpath</a> (path)</td> + <td class="summary"> + Return the cannonicalized absolute pathname.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.remove">remove</a> (path)</td> + <td class="summary"> + Remove a file or directory.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.rename">rename</a> (src, dest)</td> + <td class="summary"> + Renames a file or directory.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.rmdir">rmdir</a> (path)</td> + <td class="summary"> + Remove an empty directory.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.stat">stat</a> (path, field)</td> + <td class="summary"> + Get file status and attributes.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.statvfs">statvfs</a> (path)</td> + <td class="summary"> + (POSIX) Get filesystem statistics.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.symlink">symlink</a> (oldpath, newpath)</td> + <td class="summary"> + (POSIX) Create a symbolic link.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.unlink">unlink</a> (path)</td> + <td class="summary"> + Delete a name and - if no links are left - the associated file.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.utimes">utimes</a> (path, actime, mtime)</td> + <td class="summary"> + Change file last access and last modification time.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fs.writefile">writefile</a> (path, data)</td> + <td class="summary"> + Write a buffer into a file truncating the file first.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="nixio.fs.access"></a><strong>access</strong> (path, mode1, ...)</dt> +<dd> + + Check user's permission on a file. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Path + </li> + + <li> + mode1: First Mode to check ["f", "r", "w", "x"] + </li> + + <li> + ...: More Modes to check [-"-] + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.fs.basename"></a><strong>basename</strong> (path)</dt> +<dd> + + Strip the directory part from a path. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Path + </li> + +</ul> + + + + +<h3>Usage:</h3> +This function cannot fail and will never return nil. + + + +<h3>Return value:</h3> +basename + + + +</dd> + + + + +<dt><a name="nixio.fs.chmod"></a><strong>chmod</strong> (path, mode)</dt> +<dd> + + Change the file mode. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Path + </li> + + <li> + mode: File mode + [decimal mode number, "[-r][-w][-xsS][-r][-w][-xsS][-r][-w][-xtT]"] + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li>Windows only supports setting the write-protection through the + "Writable to others" bit. + + <li><strong>Notice:</strong> The mode-flag for the functions + open, mkdir, mkfifo are affected by the umask. + +</ul> + + + +<h3>Return value:</h3> +true + + + +<h3>See also:</h3> +<ul> + + <li><a href=""> + umask + </a> + +</ul> + +</dd> + + + + +<dt><a name="nixio.fs.chown"></a><strong>chown</strong> (path, user, group)</dt> +<dd> + + (POSIX) Change owner and group of a file. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Path + </li> + + <li> + user: User ID or Username (optional) + </li> + + <li> + group: Group ID or Groupname (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.fs.copy"></a><strong>copy</strong> (src, dest)</dt> +<dd> + + Copy a file, directory or symlink non-recursively preserving file mode, + timestamps, owner and group. + + +<h3>Parameters</h3> +<ul> + + <li> + src: Source path + </li> + + <li> + dest: Destination path + </li> + +</ul> + + + + +<h3>Usage:</h3> +The destination must always be a full destination path e.g. do not + omit the basename even if source and destination basename are equal. + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.fs.copyr"></a><strong>copyr</strong> (src, dest)</dt> +<dd> + + Copy a file, directory or symlink recursively preserving file mode, + timestamps, owner and group. + + +<h3>Parameters</h3> +<ul> + + <li> + src: Source path + </li> + + <li> + dest: Destination path + </li> + +</ul> + + + + +<h3>Usage:</h3> +The destination must always be a full destination path e.g. do not + omit the basename even if source and destination basename are equal. + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.fs.datacopy"></a><strong>datacopy</strong> (src, dest, limit)</dt> +<dd> + + Copy data between files. + + +<h3>Parameters</h3> +<ul> + + <li> + src: Source file path + </li> + + <li> + dest: Destination file path + </li> + + <li> + limit: Maximum bytes to copy (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.fs.dir"></a><strong>dir</strong> (path)</dt> +<dd> + + Iterate over the entries of a directory. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Path + </li> + +</ul> + + + + +<h3>Usage:</h3> +The special entries "." and ".." are omitted. + + + +<h3>Return value:</h3> +directory iterator returning one entry per call + + + +</dd> + + + + +<dt><a name="nixio.fs.dirname"></a><strong>dirname</strong> (path)</dt> +<dd> + + Strip the base from a path. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Path + </li> + +</ul> + + + + +<h3>Usage:</h3> +This function cannot fail and will never return nil. + + + +<h3>Return value:</h3> +dirname + + + +</dd> + + + + +<dt><a name="nixio.fs.glob"></a><strong>glob</strong> (pattern)</dt> +<dd> + + (POSIX) Find pathnames matching a pattern. + + +<h3>Parameters</h3> +<ul> + + <li> + pattern: Pattern + </li> + +</ul> + + + + + + +<h3>Return values:</h3> +<ol> + + <li>path iterator + + <li>number of matches + +</ol> + + + +</dd> + + + + +<dt><a name="nixio.fs.lchown"></a><strong>lchown</strong> (path, user, group)</dt> +<dd> + + (POSIX) Change owner and group of a file and do not resolve + if target is a symlink. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Path + </li> + + <li> + user: User ID or Username (optional) + </li> + + <li> + group: Group ID or Groupname (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.fs.link"></a><strong>link</strong> (oldpath, newpath)</dt> +<dd> + + Create a hard link. + + +<h3>Parameters</h3> +<ul> + + <li> + oldpath: Path + </li> + + <li> + newpath: Path + </li> + +</ul> + + + + +<h3>Usage:</h3> +This function calls link() on POSIX and CreateHardLink() on Windows. + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.fs.lstat"></a><strong>lstat</strong> (path, field)</dt> +<dd> + + Get file status and attributes and do not resolve if target is a symlink. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Path + </li> + + <li> + field: Only return a specific field, not the whole table (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Table containing attributes (see stat for a detailed description) + + + +<h3>See also:</h3> +<ul> + + <li><a href="#nixio.fs.stat"> + stat + </a> + +</ul> + +</dd> + + + + +<dt><a name="nixio.fs.mkdir"></a><strong>mkdir</strong> (path, mode)</dt> +<dd> + + Create a new directory. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Path + </li> + + <li> + mode: File mode (optional, see chmod and umask) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +<h3>See also:</h3> +<ul> + + <li><a href="#nixio.fs.chmod"> + chmod + </a> + + <li><a href=""> + umask + </a> + +</ul> + +</dd> + + + + +<dt><a name="nixio.fs.mkdirr"></a><strong>mkdirr</strong> (dest, mode)</dt> +<dd> + + Create a directory and all needed parent directories recursively. + + +<h3>Parameters</h3> +<ul> + + <li> + dest: Destination path + </li> + + <li> + mode: File mode (optional, see chmod and umask) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +<h3>See also:</h3> +<ul> + + <li><a href="#nixio.fs.chmod"> + chmod + </a> + + <li><a href=""> + umask + </a> + +</ul> + +</dd> + + + + +<dt><a name="nixio.fs.mkfifo"></a><strong>mkfifo</strong> (path, mode)</dt> +<dd> + + (POSIX) Create a FIFO (named pipe). + + +<h3>Parameters</h3> +<ul> + + <li> + path: Path + </li> + + <li> + mode: File mode (optional, see chmod and umask) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +<h3>See also:</h3> +<ul> + + <li><a href="#nixio.fs.chmod"> + chmod + </a> + + <li><a href=""> + umask + </a> + +</ul> + +</dd> + + + + +<dt><a name="nixio.fs.move"></a><strong>move</strong> (src, dest)</dt> +<dd> + + Rename a file, directory or symlink non-recursively across filesystems. + + +<h3>Parameters</h3> +<ul> + + <li> + src: Source path + </li> + + <li> + dest: Destination path + </li> + +</ul> + + + + +<h3>Usage:</h3> +The destination must always be a full destination path e.g. do not + omit the basename even if source and destination basename are equal. + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.fs.mover"></a><strong>mover</strong> (src, dest)</dt> +<dd> + + Rename a file, directory or symlink recursively across filesystems. + + +<h3>Parameters</h3> +<ul> + + <li> + src: Source path + </li> + + <li> + dest: Destination path + </li> + +</ul> + + + + +<h3>Usage:</h3> +The destination must always be a full destination path e.g. do not + omit the basename even if source and destination basename are equal. + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.fs.readfile"></a><strong>readfile</strong> (path, limit)</dt> +<dd> + + Read the contents of a file into a buffer. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Path + </li> + + <li> + limit: Maximum bytes to read (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +file contents + + + +</dd> + + + + +<dt><a name="nixio.fs.readlink"></a><strong>readlink</strong> (path)</dt> +<dd> + + (POSIX) Read the target of a symbolic link. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Path + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +target path + + + +</dd> + + + + +<dt><a name="nixio.fs.realpath"></a><strong>realpath</strong> (path)</dt> +<dd> + + Return the cannonicalized absolute pathname. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Path + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +absolute path + + + +</dd> + + + + +<dt><a name="nixio.fs.remove"></a><strong>remove</strong> (path)</dt> +<dd> + + Remove a file or directory. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Path + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.fs.rename"></a><strong>rename</strong> (src, dest)</dt> +<dd> + + Renames a file or directory. + + +<h3>Parameters</h3> +<ul> + + <li> + src: Source path + </li> + + <li> + dest: Destination path + </li> + +</ul> + + + + +<h3>Usage:</h3> +It is normally not possible to rename files accross fileystems. + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.fs.rmdir"></a><strong>rmdir</strong> (path)</dt> +<dd> + + Remove an empty directory. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Path + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.fs.stat"></a><strong>stat</strong> (path, field)</dt> +<dd> + + Get file status and attributes. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Path + </li> + + <li> + field: Only return a specific field, not the whole table (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Table containing: <ul> + <li>atime = Last access timestamp</li> + <li>blksize = Blocksize (POSIX only)</li> + <li>blocks = Blocks used (POSIX only)</li> + <li>ctime = Creation timestamp</li> + <li>dev = Device ID</li> + <li>gid = Group ID</li> + <li>ino = Inode</li> + <li>modedec = Mode converted into a decimal number</li> + <li>modestr = Mode as string as returned by <code>ls -l</code></li> + <li>mtime = Last modification timestamp</li> + <li>nlink = Number of links</li> + <li>rdev = Device ID (if special file)</li> + <li>size = Size in bytes</li> + <li>type = ["reg", "dir", "chr", "blk", "fifo", "lnk", "sock"]</li> + <li>uid = User ID</li> + </ul> + + + +</dd> + + + + +<dt><a name="nixio.fs.statvfs"></a><strong>statvfs</strong> (path)</dt> +<dd> + + (POSIX) Get filesystem statistics. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Path to any file within the filesystem. + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Table containing: <ul> + <li>bavail = available blocks</li> + <li>bfree = free blocks</li> + <li>blocks = number of fragments</li> + <li>frsize = fragment size</li> + <li>favail = available inodes</li> + <li>ffree = free inodes</li> + <li>files = inodes</li> + <li>flag = flags</li> + <li>fsid = filesystem ID</li> + <li>namemax = maximum filename length</li> + </ul> + + + +</dd> + + + + +<dt><a name="nixio.fs.symlink"></a><strong>symlink</strong> (oldpath, newpath)</dt> +<dd> + + (POSIX) Create a symbolic link. + + +<h3>Parameters</h3> +<ul> + + <li> + oldpath: Path + </li> + + <li> + newpath: Path + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.fs.unlink"></a><strong>unlink</strong> (path)</dt> +<dd> + + Delete a name and - if no links are left - the associated file. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Path + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.fs.utimes"></a><strong>utimes</strong> (path, actime, mtime)</dt> +<dd> + + Change file last access and last modification time. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Path + </li> + + <li> + actime: Last access timestamp (optional, default: current time) + </li> + + <li> + mtime: Last modification timestamp (optional, default: actime) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.fs.writefile"></a><strong>writefile</strong> (path, data)</dt> +<dd> + + Write a buffer into a file truncating the file first. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Path + </li> + + <li> + data: Data to write + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/nixio.html b/doc/modules/nixio.html new file mode 100644 index 000000000..8b0f84b1a --- /dev/null +++ b/doc/modules/nixio.html @@ -0,0 +1,2373 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../luadoc.css" type="text/css" /> + <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> +</head> + +<body> +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + +<div id="main"> + +<div id="navigation"> + + +<h1>LuaDoc</h1> +<ul> + + <li><a href="../index.html">Index</a></li> + +</ul> + + +<!-- Module list --> + +<h1>Modules</h1> +<ul> + + <li> + <a href="../modules/luci.dispatcher.html">luci.dispatcher</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a> + </li> + + <li> + <a href="../modules/luci.i18n.html">luci.i18n</a> + </li> + + <li> + <a href="../modules/luci.ip.html">luci.ip</a> + </li> + + <li> + <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a> + </li> + + <li> + <a href="../modules/luci.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a> + </li> + + <li> + <a href="../modules/luci.sys.init.html">luci.sys.init</a> + </li> + + <li> + <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a> + </li> + + <li> + <a href="../modules/luci.sys.net.html">luci.sys.net</a> + </li> + + <li> + <a href="../modules/luci.sys.process.html">luci.sys.process</a> + </li> + + <li> + <a href="../modules/luci.sys.user.html">luci.sys.user</a> + </li> + + <li> + <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a> + </li> + + <li><strong>nixio</strong></li> + + <li> + <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a> + </li> + + <li> + <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a> + </li> + + <li> + <a href="../modules/nixio.File.html">nixio.File</a> + </li> + + <li> + <a href="../modules/nixio.README.html">nixio.README</a> + </li> + + <li> + <a href="../modules/nixio.Socket.html">nixio.Socket</a> + </li> + + <li> + <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a> + </li> + + <li> + <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a> + </li> + + <li> + <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a> + </li> + + <li> + <a href="../modules/nixio.bin.html">nixio.bin</a> + </li> + + <li> + <a href="../modules/nixio.bit.html">nixio.bit</a> + </li> + + <li> + <a href="../modules/nixio.crypto.html">nixio.crypto</a> + </li> + + <li> + <a href="../modules/nixio.fs.html">nixio.fs</a> + </li> + +</ul> + + + +<!-- File list --> + + + + + + + +</div><!-- id="navigation" --> + +<div id="content"> + +<h1>Class <code>nixio</code></h1> + +<p> + General POSIX IO library.</p> + + + + + + + +<h2>Functions</h2> +<table class="function_list"> + + <tr> + <td class="name" nowrap><a href="#nixio.bind">bind</a> (host, port, family, socktype)</td> + <td class="summary"> + Create a new socket and bind it to a network address.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.chdir">chdir</a> (path)</td> + <td class="summary"> + Change the working directory.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.closelog">closelog</a> ()</td> + <td class="summary"> + (POSIX) Close the connection to the system logger.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.connect">connect</a> (host, port, family, socktype)</td> + <td class="summary"> + Create a new socket and connect to a network address.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.crypt">crypt</a> (key, salt)</td> + <td class="summary"> + (POSIX) Encrypt a user password.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.dup">dup</a> (oldfd, newfd)</td> + <td class="summary"> + Duplicate a file descriptor.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.errno">errno</a> ()</td> + <td class="summary"> + Get the last system error code.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.exec">exec</a> (executable, ...)</td> + <td class="summary"> + Execute a file to replace the current process.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.exece">exece</a> (executable, arguments, environment)</td> + <td class="summary"> + Execute a file with a custom environment to replace the current process.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.execp">execp</a> (executable, ...)</td> + <td class="summary"> + Invoke the shell and execute a file to replace the current process.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.fork">fork</a> ()</td> + <td class="summary"> + (POSIX) Clone the current process.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.getaddrinfo">getaddrinfo</a> (host, family, service)</td> + <td class="summary"> + Look up a hostname and service via DNS.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.getcwd">getcwd</a> ()</td> + <td class="summary"> + Get the current working directory.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.getenv">getenv</a> (variable)</td> + <td class="summary"> + Get the current environment table or a specific environment variable.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.getgid">getgid</a> ()</td> + <td class="summary"> + (POSIX) Get the group id of the current process.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.getgr">getgr</a> (group)</td> + <td class="summary"> + (POSIX) Get all or a specific user group.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.getifaddrs">getifaddrs</a> ()</td> + <td class="summary"> + (Linux, BSD) Get a list of available network interfaces and their addresses.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.getnameinfo">getnameinfo</a> (ipaddr)</td> + <td class="summary"> + Reverse look up an IP-Address via DNS.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.getpid">getpid</a> ()</td> + <td class="summary"> + Get the ID of the current process.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.getppid">getppid</a> ()</td> + <td class="summary"> + (POSIX) Get the parent process id of the current process.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.getproto">getproto</a> (proto)</td> + <td class="summary"> + Get all or a specifc proto entry.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.getprotobyname">getprotobyname</a> (name)</td> + <td class="summary"> + Get protocol entry by name.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.getprotobynumber">getprotobynumber</a> (proto)</td> + <td class="summary"> + Get protocol entry by number.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.getpw">getpw</a> (user)</td> + <td class="summary"> + (POSIX) Get all or a specific user account.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.getsp">getsp</a> (user)</td> + <td class="summary"> + (Linux, Solaris) Get all or a specific shadow password entry.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.getuid">getuid</a> ()</td> + <td class="summary"> + (POSIX) Get the user id of the current process.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.kill">kill</a> (target, signal)</td> + <td class="summary"> + (POSIX) Send a signal to one or more processes.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.nanosleep">nanosleep</a> (seconds, nanoseconds)</td> + <td class="summary"> + Sleep for a specified amount of time.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.nice">nice</a> (nice)</td> + <td class="summary"> + (POSIX) Change priority of current process.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.open">open</a> (path, flags, mode)</td> + <td class="summary"> + Open a file.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.open_flags">open_flags</a> (flag1, ...)</td> + <td class="summary"> + Generate flags for a call to open().</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.openlog">openlog</a> (ident, flag1, ...)</td> + <td class="summary"> + (POSIX) Open a connection to the system logger.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.pipe">pipe</a> ()</td> + <td class="summary"> + Create a pipe.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.poll">poll</a> (fds, timeout)</td> + <td class="summary"> + Wait for some event on a file descriptor.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.poll_flags">poll_flags</a> (mode1, ...)</td> + <td class="summary"> + Generate events-bitfield or parse revents-bitfield for poll.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.sendfile">sendfile</a> (socket, file, length)</td> + <td class="summary"> + (POSIX) Send data from a file to a socket in kernel-space.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.setenv">setenv</a> (variable, value)</td> + <td class="summary"> + Set or unset a environment variable.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.setgid">setgid</a> (gid)</td> + <td class="summary"> + (POSIX) Set the group id of the current process.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.setlogmask">setlogmask</a> (priority)</td> + <td class="summary"> + (POSIX) Set the logmask of the system logger for current process.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.setsid">setsid</a> ()</td> + <td class="summary"> + (POSIX) Create a new session and set the process group ID.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.setuid">setuid</a> (gid)</td> + <td class="summary"> + (POSIX) Set the user id of the current process.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.signal">signal</a> (signal, handler)</td> + <td class="summary"> + Ignore or use set the default handler for a signal.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.socket">socket</a> (domain, type)</td> + <td class="summary"> + Create a new socket.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.splice">splice</a> (fdin, fdout, length, flags)</td> + <td class="summary"> + (Linux) Send data from / to a pipe in kernel-space.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.splice_flags">splice_flags</a> (flag1, ...)</td> + <td class="summary"> + (Linux) Generate a flag bitfield for a call to splice.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.strerror">strerror</a> (errno)</td> + <td class="summary"> + Get the error message for the corresponding error code.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.sysinfo">sysinfo</a> ()</td> + <td class="summary"> + (Linux) Get overall system statistics.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.syslog">syslog</a> (priority)</td> + <td class="summary"> + (POSIX) Write a message to the system logger.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.times">times</a> ()</td> + <td class="summary"> + (POSIX) Get process times.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.tls">tls</a> (mode)</td> + <td class="summary"> + Create a new TLS context.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.umask">umask</a> (mask)</td> + <td class="summary"> + Sets the file mode creation mask.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.uname">uname</a> ()</td> + <td class="summary"> + (POSIX) Get information about current system and kernel.</td> + </tr> + + <tr> + <td class="name" nowrap><a href="#nixio.waitpid">waitpid</a> (pid, flag1, ...)</td> + <td class="summary"> + (POSIX) Wait for a process to change state.</td> + </tr> + +</table> + + + + + + +<br/> +<br/> + + +<h2><a name="functions"></a>Functions</h2> +<dl class="function"> + + + +<dt><a name="nixio.bind"></a><strong>bind</strong> (host, port, family, socktype)</dt> +<dd> + + Create a new socket and bind it to a network address. + This function is a shortcut for calling nixio.socket and then bind() + on the socket object. + + +<h3>Parameters</h3> +<ul> + + <li> + host: Hostname or IP-Address (optional, default: all addresses) + </li> + + <li> + port: Port or service description + </li> + + <li> + family: Address family [<strong>"any"</strong>, "inet", "inet6"] + </li> + + <li> + socktype: Socket Type [<strong>"stream"</strong>, "dgram"] + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li>This functions calls getaddrinfo(), socket(), + setsockopt() and bind() but NOT listen(). + + <li>The <em>reuseaddr</em>-option is automatically set before binding. + +</ul> + + + +<h3>Return value:</h3> +Socket Object + + + +</dd> + + + + +<dt><a name="nixio.chdir"></a><strong>chdir</strong> (path)</dt> +<dd> + + Change the working directory. + + +<h3>Parameters</h3> +<ul> + + <li> + path: New working directory + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.closelog"></a><strong>closelog</strong> ()</dt> +<dd> + + (POSIX) Close the connection to the system logger. + + + + + + + + + +</dd> + + + + +<dt><a name="nixio.connect"></a><strong>connect</strong> (host, port, family, socktype)</dt> +<dd> + + Create a new socket and connect to a network address. + This function is a shortcut for calling nixio.socket and then connect() + on the socket object. + + +<h3>Parameters</h3> +<ul> + + <li> + host: Hostname or IP-Address (optional, default: localhost) + </li> + + <li> + port: Port or service description + </li> + + <li> + family: Address family [<strong>"any"</strong>, "inet", "inet6"] + </li> + + <li> + socktype: Socket Type [<strong>"stream"</strong>, "dgram"] + </li> + +</ul> + + + + +<h3>Usage:</h3> +This functions calls getaddrinfo(), socket() and connect(). + + + +<h3>Return value:</h3> +Socket Object + + + +</dd> + + + + +<dt><a name="nixio.crypt"></a><strong>crypt</strong> (key, salt)</dt> +<dd> + + (POSIX) Encrypt a user password. + + +<h3>Parameters</h3> +<ul> + + <li> + key: Key + </li> + + <li> + salt: Salt + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +password hash + + + +</dd> + + + + +<dt><a name="nixio.dup"></a><strong>dup</strong> (oldfd, newfd)</dt> +<dd> + + Duplicate a file descriptor. + + +<h3>Parameters</h3> +<ul> + + <li> + oldfd: Old descriptor [File Object, Socket Object (POSIX only)] + </li> + + <li> + newfd: New descriptor to serve as copy (optional) + </li> + +</ul> + + + + +<h3>Usage:</h3> +This funcation calls dup2() if <em>newfd</em> is set, otherwise dup(). + + + +<h3>Return value:</h3> +File Object of new descriptor + + + +</dd> + + + + +<dt><a name="nixio.errno"></a><strong>errno</strong> ()</dt> +<dd> + + Get the last system error code. + + + + + + + +<h3>Return value:</h3> +Error code + + + +</dd> + + + + +<dt><a name="nixio.exec"></a><strong>exec</strong> (executable, ...)</dt> +<dd> + + Execute a file to replace the current process. + + +<h3>Parameters</h3> +<ul> + + <li> + executable: Executable + </li> + + <li> + ...: Parameters + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li>The name of the executable is automatically passed as argv[0] + + <li>This function does not return on success. + +</ul> + + + + + +</dd> + + + + +<dt><a name="nixio.exece"></a><strong>exece</strong> (executable, arguments, environment)</dt> +<dd> + + Execute a file with a custom environment to replace the current process. + + +<h3>Parameters</h3> +<ul> + + <li> + executable: Executable + </li> + + <li> + arguments: Argument Table + </li> + + <li> + environment: Environment Table (optional) + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li>The name of the executable is automatically passed as argv[0] + + <li>This function does not return on success. + +</ul> + + + + + +</dd> + + + + +<dt><a name="nixio.execp"></a><strong>execp</strong> (executable, ...)</dt> +<dd> + + Invoke the shell and execute a file to replace the current process. + + +<h3>Parameters</h3> +<ul> + + <li> + executable: Executable + </li> + + <li> + ...: Parameters + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li>The name of the executable is automatically passed as argv[0] + + <li>This function does not return on success. + +</ul> + + + + + +</dd> + + + + +<dt><a name="nixio.fork"></a><strong>fork</strong> ()</dt> +<dd> + + (POSIX) Clone the current process. + + + + + + + +<h3>Return value:</h3> +the child process id for the parent process, 0 for the child process + + + +</dd> + + + + +<dt><a name="nixio.getaddrinfo"></a><strong>getaddrinfo</strong> (host, family, service)</dt> +<dd> + + Look up a hostname and service via DNS. + + +<h3>Parameters</h3> +<ul> + + <li> + host: hostname to lookup (optional) + </li> + + <li> + family: address family [<strong>"any"</strong>, "inet", "inet6"] + </li> + + <li> + service: service name or port (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Table containing one or more tables containing: <ul> + <li>family = ["inet", "inet6"]</li> + <li>socktype = ["stream", "dgram", "raw"]</li> + <li>address = Resolved IP-Address</li> + <li>port = Resolved Port (if service was given)</li> + </ul> + + + +</dd> + + + + +<dt><a name="nixio.getcwd"></a><strong>getcwd</strong> ()</dt> +<dd> + + Get the current working directory. + + + + + + + +<h3>Return value:</h3> +workign directory + + + +</dd> + + + + +<dt><a name="nixio.getenv"></a><strong>getenv</strong> (variable)</dt> +<dd> + + Get the current environment table or a specific environment variable. + + +<h3>Parameters</h3> +<ul> + + <li> + variable: Variable (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +environment table or single environment variable + + + +</dd> + + + + +<dt><a name="nixio.getgid"></a><strong>getgid</strong> ()</dt> +<dd> + + (POSIX) Get the group id of the current process. + + + + + + + +<h3>Return value:</h3> +process group id + + + +</dd> + + + + +<dt><a name="nixio.getgr"></a><strong>getgr</strong> (group)</dt> +<dd> + + (POSIX) Get all or a specific user group. + + +<h3>Parameters</h3> +<ul> + + <li> + group: Group ID or groupname (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Table containing: <ul> + <li>name = Group Name</li> + <li>gid = Group ID</li> + <li>passwd = Password</li> + <li>mem = {Member #1, Member #2, ...}</li> + </ul> + + + +</dd> + + + + +<dt><a name="nixio.getifaddrs"></a><strong>getifaddrs</strong> ()</dt> +<dd> + + (Linux, BSD) Get a list of available network interfaces and their addresses. + + + + + + + +<h3>Return value:</h3> +Table containing one or more tables containing: <ul> + <li>name = Interface Name</li> + <li>family = ["inet", "inet6", "packet"]</li> + <li>addr = Interface Address (IPv4, IPv6, MAC, ...)</li> + <li>broadaddr = Broadcast Address</li> + <li>dstaddr = Destination Address (Point-to-Point)</li> + <li>netmask = Netmask (if available)</li> + <li>prefix = Prefix (if available)</li> + <li>flags = Table of interface flags (up, multicast, loopback, ...)</li> + <li>data = Statistics (Linux, "packet"-family)</li> + <li>hatype = Hardware Type Identifier (Linix, "packet"-family)</li> + <li>ifindex = Interface Index (Linux, "packet"-family)</li> + </ul> + + + +</dd> + + + + +<dt><a name="nixio.getnameinfo"></a><strong>getnameinfo</strong> (ipaddr)</dt> +<dd> + + Reverse look up an IP-Address via DNS. + + +<h3>Parameters</h3> +<ul> + + <li> + ipaddr: IPv4 or IPv6-Address + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +FQDN + + + +</dd> + + + + +<dt><a name="nixio.getpid"></a><strong>getpid</strong> ()</dt> +<dd> + + Get the ID of the current process. + + + + + + + +<h3>Return value:</h3> +process id + + + +</dd> + + + + +<dt><a name="nixio.getppid"></a><strong>getppid</strong> ()</dt> +<dd> + + (POSIX) Get the parent process id of the current process. + + + + + + + +<h3>Return value:</h3> +parent process id + + + +</dd> + + + + +<dt><a name="nixio.getproto"></a><strong>getproto</strong> (proto)</dt> +<dd> + + Get all or a specifc proto entry. + + +<h3>Parameters</h3> +<ul> + + <li> + proto: protocol number or name to lookup (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Table (or if no parameter is given, a table of tables) + containing the following fields: <ul> + <li>name = Protocol Name</li> + <li>proto = Protocol Number</li> + <li>aliases = Table of alias names</li> + </ul> + + + +</dd> + + + + +<dt><a name="nixio.getprotobyname"></a><strong>getprotobyname</strong> (name)</dt> +<dd> + + Get protocol entry by name. + + +<h3>Parameters</h3> +<ul> + + <li> + name: protocol name to lookup + </li> + +</ul> + + + + +<h3>Usage:</h3> +This function returns nil if the given protocol is unknown. + + + +<h3>Return value:</h3> +Table containing the following fields: <ul> + <li>name = Protocol Name</li> + <li>proto = Protocol Number</li> + <li>aliases = Table of alias names</li> + </ul> + + + +</dd> + + + + +<dt><a name="nixio.getprotobynumber"></a><strong>getprotobynumber</strong> (proto)</dt> +<dd> + + Get protocol entry by number. + + +<h3>Parameters</h3> +<ul> + + <li> + proto: protocol number to lookup + </li> + +</ul> + + + + +<h3>Usage:</h3> +This function returns nil if the given protocol is unknown. + + + +<h3>Return value:</h3> +Table containing the following fields: <ul> + <li>name = Protocol Name</li> + <li>proto = Protocol Number</li> + <li>aliases = Table of alias names</li> + </ul> + + + +</dd> + + + + +<dt><a name="nixio.getpw"></a><strong>getpw</strong> (user)</dt> +<dd> + + (POSIX) Get all or a specific user account. + + +<h3>Parameters</h3> +<ul> + + <li> + user: User ID or username (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Table containing: <ul> + <li>name = Name</li> + <li>uid = ID</li> + <li>gid = Group ID</li> + <li>passwd = Password</li> + <li>dir = Home directory</li> + <li>gecos = Information</li> + <li>shell = Shell</li> + </ul> + + + +</dd> + + + + +<dt><a name="nixio.getsp"></a><strong>getsp</strong> (user)</dt> +<dd> + + (Linux, Solaris) Get all or a specific shadow password entry. + + +<h3>Parameters</h3> +<ul> + + <li> + user: username (optional) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Table containing: <ul> + <li>namp = Name</li> + <li>expire = Expiration Date</li> + <li>flag = Flags</li> + <li>inact = Inactivity Date</li> + <li>lstchg = Last change</li> + <li>max = Maximum</li> + <li>min = Minimum</li> + <li>warn = Warning</li> + <li>pwdp = Password Hash</li> + </ul> + + + +</dd> + + + + +<dt><a name="nixio.getuid"></a><strong>getuid</strong> ()</dt> +<dd> + + (POSIX) Get the user id of the current process. + + + + + + + +<h3>Return value:</h3> +process user id + + + +</dd> + + + + +<dt><a name="nixio.kill"></a><strong>kill</strong> (target, signal)</dt> +<dd> + + (POSIX) Send a signal to one or more processes. + + +<h3>Parameters</h3> +<ul> + + <li> + target: Target process of process group. + </li> + + <li> + signal: Signal to send + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.nanosleep"></a><strong>nanosleep</strong> (seconds, nanoseconds)</dt> +<dd> + + Sleep for a specified amount of time. + + +<h3>Parameters</h3> +<ul> + + <li> + seconds: Seconds to wait (optional) + </li> + + <li> + nanoseconds: Nanoseconds to wait (optional) + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li>Not all systems support nanosecond precision but you can expect + to have at least maillisecond precision. + + <li>This function is not signal-protected and may fail with EINTR. + +</ul> + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.nice"></a><strong>nice</strong> (nice)</dt> +<dd> + + (POSIX) Change priority of current process. + + +<h3>Parameters</h3> +<ul> + + <li> + nice: Nice Value + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.open"></a><strong>open</strong> (path, flags, mode)</dt> +<dd> + + Open a file. + + +<h3>Parameters</h3> +<ul> + + <li> + path: Filesystem path to open + </li> + + <li> + flags: Flag string or number (see open_flags). + [<strong>"r"</strong>, "r+", "w", "w+", "a", "a+"] + </li> + + <li> + mode: File mode for newly created files (see chmod, umask). + </li> + +</ul> + + + + +<h3>Usage:</h3> +Although this function also supports the traditional fopen() + file flags it does not create a file stream but uses the open() syscall. + + + +<h3>Return value:</h3> +File Object + + + +<h3>See also:</h3> +<ul> + + <li><a href="#nixio.umask"> + umask + </a> + + <li><a href="#nixio.open_flags"> + open_flags + </a> + +</ul> + +</dd> + + + + +<dt><a name="nixio.open_flags"></a><strong>open_flags</strong> (flag1, ...)</dt> +<dd> + + Generate flags for a call to open(). + + +<h3>Parameters</h3> +<ul> + + <li> + flag1: First Flag ["append", "creat", "excl", "nonblock", "ndelay", + "sync", "trunc", "rdonly", "wronly", "rdwr"] + </li> + + <li> + ...: More Flags [-"-] + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li>This function cannot fail and will never return nil. + + <li>The "nonblock" and "ndelay" flags are aliases. + + <li>The "nonblock", "ndelay" and "sync" flags are no-ops on Windows. + +</ul> + + + +<h3>Return value:</h3> +flag to be used as second paramter to open + + + +</dd> + + + + +<dt><a name="nixio.openlog"></a><strong>openlog</strong> (ident, flag1, ...)</dt> +<dd> + + (POSIX) Open a connection to the system logger. + + +<h3>Parameters</h3> +<ul> + + <li> + ident: Identifier + </li> + + <li> + flag1: Flag 1 ["cons", "nowait", "pid", "perror", "ndelay", "odelay"] + </li> + + <li> + ...: More flags [-"-] + </li> + +</ul> + + + + + + + + +</dd> + + + + +<dt><a name="nixio.pipe"></a><strong>pipe</strong> ()</dt> +<dd> + + Create a pipe. + + + + + + + +<h3>Return values:</h3> +<ol> + + <li>File Object of the read end + + <li>File Object of the write end + +</ol> + + + +</dd> + + + + +<dt><a name="nixio.poll"></a><strong>poll</strong> (fds, timeout)</dt> +<dd> + + Wait for some event on a file descriptor. + poll() sets the revents-field of the tables provided by fds to a bitfield + indicating the events that occured. + + +<h3>Parameters</h3> +<ul> + + <li> + fds: Table containing one or more tables containing <ul> + <li> fd = I/O Descriptor [Socket Object, File Object (POSIX)]</li> + <li> events = events to wait for (bitfield generated with poll_flags)</li> + </ul> + </li> + + <li> + timeout: Timeout in milliseconds + </li> + +</ul> + + + + +<h3>Usage</h3> +<ul> + + <li>This function works in-place on the provided table and only + writes the revents field, you can use other fields on your demand. + + <li>All metamethods on the tables provided as fds are ignored. + + <li>The revents-fields are not reset when the call times out. + You have to check the first return value to be 0 to handle this case. + + <li>If you want to wait on a TLS-Socket you have to use the underlying + socket instead. + + <li>On Windows poll is emulated through select(), can only be used + on socket descriptors and cannot take more than 64 descriptors per call. + + <li>This function is not signal-protected and may fail with EINTR. + +</ul> + + + +<h3>Return values:</h3> +<ol> + + <li>number of ready IO descriptors + + <li>the fds-table with revents-fields set + +</ol> + + + +<h3>See also:</h3> +<ul> + + <li><a href="#nixio.poll_flags"> + poll_flags + </a> + +</ul> + +</dd> + + + + +<dt><a name="nixio.poll_flags"></a><strong>poll_flags</strong> (mode1, ...)</dt> +<dd> + + Generate events-bitfield or parse revents-bitfield for poll. + + +<h3>Parameters</h3> +<ul> + + <li> + mode1: revents-Flag bitfield returned from poll to parse OR + ["in", "out", "err", "pri" (POSIX), "hup" (POSIX), "nval" (POSIX)] + </li> + + <li> + ...: More mode strings for generating the flag [-"-] + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +table with boolean fields reflecting the mode parameter + <strong>OR</strong> bitfield to use for the events-Flag field + + + +<h3>See also:</h3> +<ul> + + <li><a href="#nixio.poll"> + poll + </a> + +</ul> + +</dd> + + + + +<dt><a name="nixio.sendfile"></a><strong>sendfile</strong> (socket, file, length)</dt> +<dd> + + (POSIX) Send data from a file to a socket in kernel-space. + + +<h3>Parameters</h3> +<ul> + + <li> + socket: Socket Object + </li> + + <li> + file: File Object + </li> + + <li> + length: Amount of data to send (in Bytes). + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +bytes sent + + + +</dd> + + + + +<dt><a name="nixio.setenv"></a><strong>setenv</strong> (variable, value)</dt> +<dd> + + Set or unset a environment variable. + + +<h3>Parameters</h3> +<ul> + + <li> + variable: Variable + </li> + + <li> + value: Value (optional) + </li> + +</ul> + + + + +<h3>Usage:</h3> +The environment variable will be unset if value is ommited. + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.setgid"></a><strong>setgid</strong> (gid)</dt> +<dd> + + (POSIX) Set the group id of the current process. + + +<h3>Parameters</h3> +<ul> + + <li> + gid: New Group ID + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.setlogmask"></a><strong>setlogmask</strong> (priority)</dt> +<dd> + + (POSIX) Set the logmask of the system logger for current process. + + +<h3>Parameters</h3> +<ul> + + <li> + priority: Priority ["emerg", "alert", "crit", "err", "warning", + "notice", "info", "debug"] + </li> + +</ul> + + + + + + + + +</dd> + + + + +<dt><a name="nixio.setsid"></a><strong>setsid</strong> ()</dt> +<dd> + + (POSIX) Create a new session and set the process group ID. + + + + + + + +<h3>Return value:</h3> +session id + + + +</dd> + + + + +<dt><a name="nixio.setuid"></a><strong>setuid</strong> (gid)</dt> +<dd> + + (POSIX) Set the user id of the current process. + + +<h3>Parameters</h3> +<ul> + + <li> + gid: New User ID + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.signal"></a><strong>signal</strong> (signal, handler)</dt> +<dd> + + Ignore or use set the default handler for a signal. + + +<h3>Parameters</h3> +<ul> + + <li> + signal: Signal + </li> + + <li> + handler: ["ign", "dfl"] + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +true + + + +</dd> + + + + +<dt><a name="nixio.socket"></a><strong>socket</strong> (domain, type)</dt> +<dd> + + Create a new socket. + + +<h3>Parameters</h3> +<ul> + + <li> + domain: Domain ["inet", "inet6", "unix"] + </li> + + <li> + type: Type ["stream", "dgram", "raw"] + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Socket Object + + + +</dd> + + + + +<dt><a name="nixio.splice"></a><strong>splice</strong> (fdin, fdout, length, flags)</dt> +<dd> + + (Linux) Send data from / to a pipe in kernel-space. + + +<h3>Parameters</h3> +<ul> + + <li> + fdin: Input I/O descriptor + </li> + + <li> + fdout: Output I/O descriptor + </li> + + <li> + length: Amount of data to send (in Bytes). + </li> + + <li> + flags: (optional, bitfield generated by splice_flags) + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +bytes sent + + + +<h3>See also:</h3> +<ul> + + <li><a href="#nixio.splice_flags"> + splice_flags + </a> + +</ul> + +</dd> + + + + +<dt><a name="nixio.splice_flags"></a><strong>splice_flags</strong> (flag1, ...)</dt> +<dd> + + (Linux) Generate a flag bitfield for a call to splice. + + +<h3>Parameters</h3> +<ul> + + <li> + flag1: First Flag ["move", "nonblock", "more"] + </li> + + <li> + ...: More flags [-"-] + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Flag bitfield + + + +<h3>See also:</h3> +<ul> + + <li><a href="#nixio.splice"> + splice + </a> + +</ul> + +</dd> + + + + +<dt><a name="nixio.strerror"></a><strong>strerror</strong> (errno)</dt> +<dd> + + Get the error message for the corresponding error code. + + +<h3>Parameters</h3> +<ul> + + <li> + errno: System error code + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +Error message + + + +</dd> + + + + +<dt><a name="nixio.sysinfo"></a><strong>sysinfo</strong> ()</dt> +<dd> + + (Linux) Get overall system statistics. + + + + + + + +<h3>Return value:</h3> +Table containing: <ul> + <li>uptime = system uptime in seconds</li> + <li>loads = {loadavg1, loadavg5, loadavg15}</li> + <li>totalram = total RAM</li> + <li>freeram = free RAM</li> + <li>sharedram = shared RAM</li> + <li>bufferram = buffered RAM</li> + <li>totalswap = total SWAP</li> + <li>freeswap = free SWAP</li> + <li>procs = number of running processes</li> + </ul> + + + +</dd> + + + + +<dt><a name="nixio.syslog"></a><strong>syslog</strong> (priority)</dt> +<dd> + + (POSIX) Write a message to the system logger. + + +<h3>Parameters</h3> +<ul> + + <li> + priority: Priority ["emerg", "alert", "crit", "err", "warning", + "notice", "info", "debug"] + </li> + +</ul> + + + + + + + + +</dd> + + + + +<dt><a name="nixio.times"></a><strong>times</strong> ()</dt> +<dd> + + (POSIX) Get process times. + + + + + + + +<h3>Return value:</h3> +Table containing: <ul> + <li>utime = user time</li> + <li>utime = system time</li> + <li>cutime = children user time</li> + <li>cstime = children system time</li> + </ul> + + + +</dd> + + + + +<dt><a name="nixio.tls"></a><strong>tls</strong> (mode)</dt> +<dd> + + Create a new TLS context. + + +<h3>Parameters</h3> +<ul> + + <li> + mode: TLS-Mode ["client", "server"] + </li> + +</ul> + + + + + + +<h3>Return value:</h3> +TLSContext Object + + + +</dd> + + + + +<dt><a name="nixio.umask"></a><strong>umask</strong> (mask)</dt> +<dd> + + Sets the file mode creation mask. + + +<h3>Parameters</h3> +<ul> + + <li> + mask: New creation mask (see chmod for format specifications) + </li> + +</ul> + + + + + + +<h3>Return values:</h3> +<ol> + + <li>the old umask as decimal mode number + + <li>the old umask as mode string + +</ol> + + + +</dd> + + + + +<dt><a name="nixio.uname"></a><strong>uname</strong> ()</dt> +<dd> + + (POSIX) Get information about current system and kernel. + + + + + + + +<h3>Return value:</h3> +Table containing: <ul> + <li>sysname = operating system</li> + <li>nodename = network name (usually hostname)</li> + <li>release = OS release</li> + <li>version = OS version</li> + <li>machine = hardware identifier</li> + </ul> + + + +</dd> + + + + +<dt><a name="nixio.waitpid"></a><strong>waitpid</strong> (pid, flag1, ...)</dt> +<dd> + + (POSIX) Wait for a process to change state. + + +<h3>Parameters</h3> +<ul> + + <li> + pid: Process ID (optional, default: any childprocess) + </li> + + <li> + flag1: Flag (optional) ["nohang", "untraced", "continued"] + </li> + + <li> + ...: More Flags [-"-] + </li> + +</ul> + + + + +<h3>Usage:</h3> +If the "nohang" is given this function becomes non-blocking. + + + +<h3>Return values:</h3> +<ol> + + <li>process id of child or 0 if no child has changed state + + <li>["exited", "signaled", "stopped"] + + <li>[exit code, terminate signal, stop signal] + +</ol> + + + +</dd> + + +</dl> + + + + + +</div> <!-- id="content" --> + +</div> <!-- id="main" --> + +<div id="about"> + <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> +</div> <!-- id="about" --> + +</div> <!-- id="container" --> +</body> +</html> |