documentation: update Lua API docs

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 2ae6e3c6b3c3b65cd955bb10fb9065beebc5ffd2)
This commit is contained in:
Jo-Philipp Wich 2019-11-05 09:31:27 +01:00
parent 3942789dc6
commit d80dd2291f
17 changed files with 261 additions and 1035 deletions

View file

@ -334,13 +334,6 @@ Dispatch an HTTP request.</td>
Lookup node in dispatching tree.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#modifier">modifier</a>&nbsp;(func, order)</td>
<td class="summary">
Register a tree modifier.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a>&nbsp;(...)</td>
<td class="summary">
@ -352,7 +345,7 @@ Fetch or create a new dispatching node.</td>
<td class="name" nowrap><a href="#node_childs">node_childs</a>&nbsp;(node)</td>
<td class="summary">
Return a sorted table of visible childs within a given node
Return a sorted table of visible children within a given node
</td>
</tr>
@ -943,39 +936,6 @@ Node object, canonical url or nil if the path was not found.
</dd>
<dt><a name="modifier"></a><strong>modifier</strong>&nbsp;(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>
@ -1017,7 +977,7 @@ Dispatching tree node
<dd>
Return a sorted table of visible childs within a given node
Return a sorted table of visible children within a given node

View file

@ -42,18 +42,14 @@
<a href="../modules/luci.http.html">luci.http</a>
</li>
<li>
<a href="../modules/luci.http.protocol.html">luci.http.protocol</a>
</li>
<li><strong>luci.http.protocol.conditionals</strong></li>
<li><strong>luci.http.conditionals</strong></li>
<li>
<a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a>
<a href="../modules/luci.http.mime.html">luci.http.mime</a>
</li>
<li>
@ -196,7 +192,7 @@
<div id="content">
<h1>Class <code>luci.http.protocol.conditionals</code></h1>
<h1>Class <code>luci.http.conditionals</code></h1>
<p></p>

View file

@ -43,17 +43,13 @@
</li>
<li>
<a href="../modules/luci.http.protocol.html">luci.http.protocol</a>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</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><strong>luci.http.date</strong></li>
<li>
<a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a>
<a href="../modules/luci.http.mime.html">luci.http.mime</a>
</li>
<li>
@ -196,7 +192,7 @@
<div id="content">
<h1>Class <code>luci.http.protocol.date</code></h1>
<h1>Class <code>luci.http.date</code></h1>
<p></p>

View file

@ -644,13 +644,13 @@ Stores all extracted data associated with its parameter name
in the params table within 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
If an optional file callback function is given then it is fed 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)
o Boolean which indicates whether the current chunk is the last one (eof)

View file

@ -43,18 +43,14 @@
</li>
<li>
<a href="../modules/luci.http.protocol.html">luci.http.protocol</a>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a>
<a href="../modules/luci.http.date.html">luci.http.date</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><strong>luci.http.mime</strong></li>
<li>
<a href="../modules/luci.i18n.html">luci.i18n</a>
@ -196,7 +192,7 @@
<div id="content">
<h1>Class <code>luci.http.protocol.mime</code></h1>
<h1>Class <code>luci.http.mime</code></h1>
<p></p>

View file

@ -1,753 +0,0 @@
<!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.html">luci.http</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.json.html">luci.json</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.model.ipkg.html">luci.model.ipkg</a>
</li>
<li>
<a href="../modules/luci.model.uci.html">luci.model.uci</a>
</li>
<li>
<a href="../modules/luci.rpcc.html">luci.rpcc</a>
</li>
<li>
<a href="../modules/luci.rpcc.ruci.html">luci.rpcc.ruci</a>
</li>
<li>
<a href="../modules/luci.sys.html">luci.sys</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/luci.util.html">luci.util</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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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 within 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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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 within 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>&nbsp;(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>&nbsp;(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>&nbsp;(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>

View file

@ -206,24 +206,10 @@
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#clear">clear</a>&nbsp;()</td>
<td class="name" nowrap><a href="#dump">dump</a>&nbsp;()</td>
<td class="summary">
Clear the translation table.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#load">load</a>&nbsp;(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>&nbsp;(file, force)</td>
<td class="summary">
Load a translation file using the default translation language.</td>
Return all currently loaded translation strings as a key-value table.</td>
</tr>
<tr>
@ -233,22 +219,6 @@ Load a translation file using the default translation language.</td>
Set the context default translation language.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#string">string</a>&nbsp;(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>&nbsp;(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>&nbsp;(key)</td>
<td class="summary">
@ -279,12 +249,13 @@ Return the translated value for a specific translation key and use it as sprintf
<dt><a name="clear"></a><strong>clear</strong>&nbsp;()</dt>
<dt><a name="dump"></a><strong>dump</strong>&nbsp;()</dt>
<dd>
Clear the translation table.
Return all currently loaded translation strings as a key-value table. The key is the
hexadecimal representation of the translation key while the value is the translated
text content.
@ -293,79 +264,8 @@ Clear the translation table.
</dd>
<dt><a name="load"></a><strong>load</strong>&nbsp;(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>&nbsp;(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>
Key-value translation string table.
@ -386,38 +286,7 @@ Set the context default translation language.
<ul>
<li>
lang: Two-letter language code
</li>
</ul>
</dd>
<dt><a name="string"></a><strong>string</strong>&nbsp;(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
lang: An IETF/BCP 47 language tag or ISO3166 country code, e.g. "en-US" or "de"
</li>
</ul>
@ -428,45 +297,7 @@ This is the same as calling <code>tostring(translate(...))</code>
<h3>Return value:</h3>
Translated string
</dd>
<dt><a name="stringf"></a><strong>stringf</strong>&nbsp;(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
The effective loaded language, e.g. "en" for "en-US" - or nil on failure

View file

@ -718,7 +718,7 @@ are considered lower than MAC addresses</li>
<ul>
<li>
addr: A <code>luci.ip.cidr</code> instance or a string convertable by
addr: A <code>luci.ip.cidr</code> instance or a string convertible by
<code>luci.ip.new()</code> to compare against.
</li>
@ -777,7 +777,7 @@ are considered lower than MAC addresses</li>
<ul>
<li>
addr: A <code>luci.ip.cidr</code> instance or a string convertable by
addr: A <code>luci.ip.cidr</code> instance or a string convertible by
<code>luci.ip.new()</code> to compare against.
</li>
@ -832,7 +832,7 @@ Checks whether this CIDR instance is equal to the given argument.
<ul>
<li>
addr: A <code>luci.ip.cidr</code> instance or a string convertable by
addr: A <code>luci.ip.cidr</code> instance or a string convertible by
<code>luci.ip.new()</code> to compare against.
</li>
@ -1208,7 +1208,7 @@ Test whether CIDR contains given range.
<ul>
<li>
addr: A <code>luci.ip.cidr</code> instance or a string convertable by
addr: A <code>luci.ip.cidr</code> instance or a string convertible by
<code>luci.ip.new()</code> to test.
</li>
@ -1258,7 +1258,7 @@ address space, the result is set to the highest possible address.
<li>
amount: A numeric value between 0 and 0xFFFFFFFF, a
<code>luci.ip.cidr</code> instance or a string convertable by
<code>luci.ip.cidr</code> instance or a string convertible by
<code>luci.ip.new()</code>.
</li>
@ -1307,7 +1307,7 @@ print(mac) -- "FF:FF:FF:FF:FF:FF"</pre>
<h3>Return value:</h3>
<ul>
<li>When adding inplace: Return <code>true</code> if the addition succeded
<li>When adding inplace: Return <code>true</code> if the addition succeeded
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
@ -1334,7 +1334,7 @@ possible address is returned.
<li>
amount: A numeric value between 0 and 0xFFFFFFFF, a
<code>luci.ip.cidr</code> instance or a string convertable by
<code>luci.ip.cidr</code> instance or a string convertible by
<code>luci.ip.new()</code>.
</li>

View file

@ -256,7 +256,7 @@ Verify an ethernet MAC address.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#route">route</a>&nbsp;(address)</td>
<td class="name" nowrap><a href="#route">route</a>&nbsp;(address, source)</td>
<td class="summary">
Determine the route leading to the given destination.</td>
@ -729,7 +729,7 @@ A string representing the given MAC address.
<dt><a name="route"></a><strong>route</strong>&nbsp;(address)</dt>
<dt><a name="route"></a><strong>route</strong>&nbsp;(address, source)</dt>
<dd>
@ -744,6 +744,11 @@ Determine the route leading to the given destination.
a valid IPv4 or IPv6 range as specified by <code>luci.ip.new()</code>.
</li>
<li>
source: A <code>luci.ip.cidr</code> instance or a string containing
the preferred source address for route selection (optional).
</li>
</ul>
@ -879,7 +884,7 @@ Fetch all routes, optionally matching the given criteria.
<li>
filter: <p>Table containing one or more of the possible filter
critera described below (optional)</p><table>
criteria 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
@ -994,7 +999,7 @@ Fetches entries from the IPv4 ARP and IPv6 neighbour kernel table
<li>
filter: <p>Table containing one or more of the possible filter
critera described below (optional)</p><table>
criteria 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

View file

@ -213,11 +213,10 @@ Add an anonymous section.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Cursor.apply">Cursor:apply</a>&nbsp;(configlist, command)</td>
<td class="name" nowrap><a href="#Cursor.apply">Cursor:apply</a>&nbsp;(rollback)</td>
<td class="summary">
Applies UCI configuration changes
</td>
Applies UCI configuration changes.</td>
</tr>
<tr>
@ -234,6 +233,13 @@ Get a table of saved but uncommitted changes.</td>
Commit saved changes.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Cursor.confirm">Cursor:confirm</a>&nbsp;()</td>
<td class="summary">
Confirms UCI apply process.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Cursor.delete">Cursor:delete</a>&nbsp;(config, section, option)</td>
<td class="summary">
@ -326,6 +332,20 @@ Manually load a config.</td>
Revert saved but uncommitted changes.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Cursor.rollback">Cursor:rollback</a>&nbsp;()</td>
<td class="summary">
Cancels UCI apply process.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Cursor.rollback_pending">Cursor:rollback_pending</a>&nbsp;()</td>
<td class="summary">
Checks whether a pending rollback is scheduled.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Cursor.save">Cursor:save</a>&nbsp;(config)</td>
<td class="summary">
@ -365,7 +385,7 @@ Set given values as list.</td>
<td class="name" nowrap><a href="#Cursor.set_savedir">Cursor:set_savedir</a>&nbsp;(directory)</td>
<td class="summary">
Set the directory for uncommited changes.</td>
Set the directory for uncommitted changes.</td>
</tr>
<tr>
@ -462,11 +482,18 @@ Name of created section
<dt><a name="Cursor.apply"></a><strong>Cursor:apply</strong>&nbsp;(configlist, command)</dt>
<dt><a name="Cursor.apply"></a><strong>Cursor:apply</strong>&nbsp;(rollback)</dt>
<dd>
Applies UCI configuration changes
Applies UCI configuration changes.
If the rollback parameter is set to true, the apply function will invoke the
rollback mechanism which causes the configuration to be automatically reverted
if no confirm() call occurs within a certain timeout.
The current default timeout is 30s and can be increased using the
"luci.apply.timeout" uci configuration key.
@ -474,11 +501,7 @@ Applies UCI configuration changes
<ul>
<li>
configlist: List of UCI configurations
</li>
<li>
command: Don't apply only return the command
rollback: Enable rollback mechanism
</li>
</ul>
@ -488,6 +511,9 @@ Applies UCI configuration changes
<h3>Return value:</h3>
Boolean whether operation succeeded
</dd>
@ -581,6 +607,35 @@ Boolean whether operation succeeded
<dt><a name="Cursor.confirm"></a><strong>Cursor:confirm</strong>&nbsp;()</dt>
<dd>
Confirms UCI apply process.
If a previous UCI apply with rollback has been invoked using apply(true),
this function confirms the process and cancels the pending rollback timer.
If no apply with rollback session is active, the function has no effect and
returns with a "No data" error.
<h3>Return value:</h3>
Boolean whether operation succeeded
</dd>
<dt><a name="Cursor.delete"></a><strong>Cursor:delete</strong>&nbsp;(config, section, option)</dt>
<dd>
@ -1059,6 +1114,71 @@ Boolean whether operation succeeded
<dt><a name="Cursor.rollback"></a><strong>Cursor:rollback</strong>&nbsp;()</dt>
<dd>
Cancels UCI apply process.
If a previous UCI apply with rollback has been invoked using apply(true),
this function cancels the process and rolls back the configuration to the
pre-apply state.
If no apply with rollback session is active, the function has no effect and
returns with a "No data" error.
<h3>Return value:</h3>
Boolean whether operation succeeded
</dd>
<dt><a name="Cursor.rollback_pending"></a><strong>Cursor:rollback_pending</strong>&nbsp;()</dt>
<dd>
Checks whether a pending rollback is scheduled.
If a previous UCI apply with rollback has been invoked using apply(true),
and has not been confirmed or rolled back yet, this function returns true
and the remaining time until rollback in seconds. If no rollback is pending,
the function returns false. On error, the function returns false and an
additional string describing the error.
<h3>Return values:</h3>
<ol>
<li>Boolean whether rollback is pending
<li>Remaining time in seconds
</ol>
</dd>
<dt><a name="Cursor.save"></a><strong>Cursor:save</strong>&nbsp;(config)</dt>
<dd>
@ -1280,7 +1400,7 @@ Boolean whether operation succeeded
<dd>
Set the directory for uncommited changes.
Set the directory for uncommitted changes.
@ -1346,7 +1466,7 @@ Boolean whether operation succeeded
Create a sub-state of this cursor.
The sub-state is tied to the parent curser, means it the parent unloads or
The sub-state is tied to the parent cursor, means it the parent unloads or
loads configs, the sub state will do so as well.

View file

@ -378,7 +378,7 @@ Execute a given shell command and capture its standard output
<h3>Return value:</h3>
String containg the return the output of the command
String containing the return the output of the command
@ -415,7 +415,7 @@ exists.
<h3>Return values:</h3>
<ol>
<li>String containg the value of the specified variable
<li>String containing the value of the specified variable
<li>Table containing all variables if no variable name is given

View file

@ -208,6 +208,13 @@ LuCI system utilities / process related functions.
<h2>Functions</h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#process.exec">exec</a>&nbsp;(commend, stdout, stderr, nowait)</td>
<td class="summary">
Execute a process, optionally capturing stdio.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#process.info">info</a>&nbsp;()</td>
<td class="summary">
@ -259,6 +266,74 @@ Send a signal to a process identified by given pid.</td>
<dt><a name="process.exec"></a><strong>exec</strong>&nbsp;(commend, stdout, stderr, nowait)</dt>
<dd>
Execute a process, optionally capturing stdio.
Executes the process specified by the given argv vector, e.g.
<code>{ "/bin/sh", "-c", "echo 1" }</code> and waits for it to terminate unless a true
value has been passed for the "nowait" parameter.
When a function value is passed for the stdout or stderr arguments, the passed
function is repeatedly called for each chunk read from the corresponding stdio
stream. The read data is passed as string containing at most 4096 bytes at a
time.
When a true, non-function value is passed for the stdout or stderr arguments,
the data of the corresponding stdio stream is read into an internal string
buffer and returned as "stdout" or "stderr" field respectively in the result
table.
When a true value is passed to the nowait parameter, the function does not
await process termination but returns as soon as all captured stdio streams
have been closed or - if no streams are captured - immediately after launching
the process.
<h3>Parameters</h3>
<ul>
<li>
commend: Table containing the argv vector to execute
</li>
<li>
stdout: Callback function or boolean to indicate capturing (optional)
</li>
<li>
stderr: Callback function or boolean to indicate capturing (optional)
</li>
<li>
nowait: Don't wait for process termination when true (optional)
</li>
</ul>
<h3>Return value:</h3>
Table containing at least the fields "code" which holds the exit
status of the invoked process or "-1" on error and "pid", which
contains the process id assigned to the spawned process. When
stdout and/or stderr capturing has been requested, it additionally
contains "stdout" and "stderr" fields respectively, holding the
captured stdio data as string.
</dd>
<dt><a name="process.info"></a><strong>info</strong>&nbsp;()</dt>
<dd>

View file

@ -212,7 +212,7 @@ LuCI system utilities / user related functions.
<td class="name" nowrap><a href="#getuser">getuser</a>&nbsp;(uid)</td>
<td class="summary">
Retrieve user informations for given uid.</td>
Retrieve user information for given uid.</td>
</tr>
<tr>
@ -256,7 +256,7 @@ Change the password of given user.</td>
<dd>
Retrieve user informations for given uid.
Retrieve user information for given uid.
@ -312,7 +312,7 @@ Test whether given string matches the password of a given system user.
<h3>Return value:</h3>
Boolean indicating wheather the passwords are equal
Boolean indicating whether the passwords are equal

View file

@ -405,7 +405,7 @@ containing the resulting substrings.</td>
<td class="name" nowrap><a href="#strip_bytecode">strip_bytecode</a>&nbsp;(code)</td>
<td class="summary">
Strips unnescessary lua bytecode from given string.</td>
Strips unnecessary lua bytecode from given string.</td>
</tr>
<tr>
@ -963,7 +963,7 @@ Return a matching iterator for the given value.
The iterator will return one token per invocation, the tokens are separated by
whitespace. If the input value is a table, it is transformed into a string first.
A nil value will result in a valid interator which aborts with the first invocation.
A nil value will result in a valid iterator which aborts with the first invocation.
@ -1493,7 +1493,7 @@ Table containing the resulting substrings
<dd>
Strips unnescessary lua bytecode from given string.
Strips unnecessary lua bytecode from given string.
Information like line numbers and debugging numbers will be discarded.
Original version by Peter Cawley (http://lua-users.org/lists/lua-l/2008-02/msg01158.html)

View file

@ -257,7 +257,7 @@
<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>Changed TLS behaviour to explicitly 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>

View file

@ -265,7 +265,7 @@
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
<li>With some exceptions - which are explicitly 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.

View file

@ -329,7 +329,7 @@
<tr>
<td class="name" nowrap><a href="#nixio.getproto">getproto</a>&nbsp;(proto)</td>
<td class="summary">
Get all or a specifc proto entry.</td>
Get all or a specific proto entry.</td>
</tr>
<tr>
@ -1184,7 +1184,7 @@ parent process id
<dt><a name="nixio.getproto"></a><strong>getproto</strong>&nbsp;(proto)</dt>
<dd>
Get all or a specifc proto entry.
Get all or a specific proto entry.
<h3>Parameters</h3>