docs: rename documentation folder to docs

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich
2019-11-05 10:27:59 +01:00
parent 355a48866d
commit baa727de93
99 changed files with 2 additions and 2 deletions

246
docs/CBI.md Normal file
View File

@@ -0,0 +1,246 @@
# CBI models
are Lua files describing the structure of an UCI config file and the resulting HTML form to be evaluated by the CBI parser.<br />
All CBI model files must return an object of type **luci.cbi.Map**.<br />
For a commented example of a CBI model, see the [Writing Modules tutorial](ModulesHowTo.md#cbimodels).
The scope of a CBI model file is automatically extended by the contents of the module **luci.cbi** and the _translate_ function from **luci.i18n**
This Reference covers **the basics** of the CBI system.
## class Map (_config, title, description_)
This is the root object of the model.
* **config:** configuration filename to be mapped, see [UCI documentation](https://openwrt.org/docs/guide-user/base-system/uci) and the files in /etc/config
* **title:** title shown in the UI
* **description:** description shown in the UI
#### function :section (_sectionclass_, ...)
Creates a new section
* **sectionclass**: a class object of the section
* _additional parameters passed to the constructor of the section class_
----
## class NamedSection (_name, type, title, description_)
An object describing an UCI section selected by the name.<br />
To instantiate use: `Map:section(NamedSection, "name", "type", "title", "description")`
* **name:** UCI section name
* **type:** UCI section type
* **title:** The title shown in the UI
* **description:** description shown in the UI
#### function :option(_optionclass_, ...)
Creates a new option
* **optionclass:** a class object of the section
* _additional parameters passed to the constructor of the option class_
#### property .addremove = false
Allows the user to remove and recreate the configuration section.
#### property .dynamic = false
Marks this section as dynamic. Dynamic sections can contain an undefinded number of completely userdefined options.
#### property .optional = true
Parse optional options
----
## class TypedSection (_type, title, description_)
An object describing a group of UCI sections selected by their type.<br />
To instantiate use: `Map:section(TypedSection, "type", "title", "description")`
* **type:** UCI section type
* **title:** The title shown in the UI
* **description:** description shown in the UI
#### function :option(_optionclass_, ...)
Creates a new option
**optionclass:** a class object of the section
_additional parameters passed to the constructor of the option class_
#### function :depends(_key, value_)
Only select those sections where _key == value_ <br />
If you call this function several times the dependencies will be linked with **"or"**
#### function .filter(_self, section_) -abstract-
You can override this function to filter certain sections that will not be parsed.
The filter function will be called for every section that should be parsed and returns **nil** for sections that should be filtered. For all other sections it should return the section name as given in the second parameter.
#### property .addremove = false
Allows the user to remove and recreate the configuration section
#### property .dynamic = false
Marks this section as dynamic. Dynamic sections can contain an undefinded number of completely userdefined options.
#### property .optional = true
Parse optional options
#### property .anonymous = false
Do not show UCI section names
----
## class Value (_option, title, description_)
An object describing an option in a section of a UCI File. Creates a standard text field in the formular.<br />
To instantiate use: `NamedSection:option(Value, "option", "title", "description")`<br />
or `TypedSection:option(Value, "option", "title", "description")`
* **option:** UCI option name
* **title:** The title shown in the UI
* **description:** description shown in the UI
#### function :depends(key, value)
Only show this option field if another option _key_ is set to _value_ in the same section.<br />
If you call this function several times the dependencies will be linked with **"or"**
#### function :value(key, value)
Convert this text field into a combobox if possible and add a selection option.
#### property .default = nil
The default value
#### property .maxlength = nil
The maximum inputlength (of chars) of the value
#### property .optional = false
Marks this option as optional, implies .rmempty = true
#### property .rmempty = true
Removes this option from the configuration file when the user enters an empty value
#### property .size = nil
The maximum number of chars displayed by form field
----
## class ListValue (_option, title, description_)
An object describing an option in a section of a UCI File.<br />
Creates a list box or list of radio (for selecting one of many choices) in the formular.<br />
To instantiate use: `NamedSection:option(ListValue, "option", "title", "description")`<br />
or `TypedSection:option(ListValue, "option", "title", "description")`
* **option:** UCI option name
* **title:** The title shown in the UI
* **description:** description shown in the UI
#### function :depends(key, value)
Only show this option field if another option _key_ is set to _value_ in the same section.<br />
If you call this function several times the dependencies will be linked with **"or"**
#### function :value(_key, value_)
Adds an entry to the selection list
#### property .widget = "select"
**"select"** shows a selection list, **"radio"** shows a list of radio buttons inside form
#### property .default = nil
The default value
#### property .optional = false
Marks this option as optional, implies .rmempty = true
#### property .rmempty = true
Removes this option from the configuration file when the user enters an empty value
#### property .size = nil
The size of the form field
----
## class Flag (_option, title, description_)
An object describing an option with two possible values in a section of a UCI File.<br />
Creates a checkbox field in the formular.<br />
To instantiate use: `NamedSection:option(Flag, "option", ""title", "description")`<br />
or `TypedSection:option(Flag, "option", "title", "description")`
* **option:** UCI option name
* **title:** The title shown in the UI
* **description:** description shown in the UI
#### function :depends (_key, value_)
Only show this option field if another option _key_ is set to _value_ in the same section.<br />
If you call this function several times the dependencies will be linked with **"or"**
#### property .default = nil
The default value
#### property .disabled = 0
the value that should be set if the checkbox is unchecked
#### property .enabled = 1
the value that should be set if the checkbox is checked
#### property .optional = false
Marks this option as optional, implies .rmempty = true
#### property .rmempty = true
Removes this option from the configuration file when the user enters an empty value
----
## class MultiValue (_option'', ''title'', ''description_)
An object describing an option in a section of a UCI File.<br />
Creates a list of checkboxed or a multiselectable list as form fields.<br />
To instantiate use: `NamedSection:option(MultiValue, "option", ""title", "description")`<br />
or `TypedSection:option(MultiValue, "option", "title", "description")`
* **option:** UCI option name
* **title:** The title shown in the UI
* **description:** description shown in the UI
#### function :depends (_key, value_)
Only show this option field if another option _key_ is set to _value_ in the same section.<br />
If you call this function several times the dependencies will be linked with **"or"**
#### function :value(_key, value_)
Adds an entry to the list
#### property .widget = "checkbox"
**"select"** shows a selection list, **"checkbox"** shows a list of checkboxes inside form
#### property .delimiter = " "
The string which will be used to delimit the values inside stored option
#### property .default = nil
The default value
#### property .optional = false
Marks this option as optional, implies .rmempty = true
#### property .rmempty = true
Removes this option from the configuration file when the user enters an empty value
#### property .size = nil
The size of the form field (only used if property _.widget = "select"_)
----
## class StaticList (_option, title, description_)
Similar to the MultiValue, but stores selected Values into a UCI list instead of a character-separated option.
----
## class DynamicList (_option, title, description_)
A extensible list of user-defined values. Stores Values into a UCI list
----
## class DummyValue (_option, title, description_)
Creates a readonly text in the form. !It writes no data to UCI!<br />
To instantiate use: `NamedSection:option(DummyValue, "option", ""title", "description")`<br />
or `TypedSection:option(DummyValue, "option", "title", "description")`
* **option:** UCI option name
* **title:** The title shown in the UI
* **description:** description shown in the UI
#### property :depends (_key, value_)
Only show this option field if another option _key_ is set to _value_ in the same section.<br />
If you call this function several times the dependencies will be linked with **"or"**
----
## class TextValue (_option, title, description_)
An object describing a multi-line textbox in a section in a non-UCI form.
----
## class Button (_option, title, description_)
An object describing a Button in a section in a non-UCI form.

66
docs/JsonRpcHowTo.md Normal file
View File

@@ -0,0 +1,66 @@
LuCI provides some of its libraries to external applications through a JSON-RPC API.
This Howto shows how to use it and provides information about available functions.
# Basics
LuCI comes with an efficient JSON De-/Encoder together with a JSON-RPC-Server which implements the *JSON-RPC 1.0_' and 2.0 (partly) specifications. The LuCI JSON-RPC server offers several independent APIs. Therefore you have to use '_different URLs for every exported library*.
Assuming your LuCI-Installation can be reached through */cgi-bin/luci_' any exported library can be reached via '''/cgi-bin/luci/rpc/''LIBRARY_*.
# Authentication
Most exported libraries will require a valid authentication to be called with. If you get an *HTTP 403 Forbidden_' status code you are probably missing a valid authentication token. To get such a token you have to call the function '''login''' of the RPC-Library '''auth'''. Following our example from above this login function would be provided at '_/cgi-bin/luci/rpc/auth*. The function accepts 2 parameters: username and password (of a valid user account on the host system) and returns an authentication token.
If you want to call any exported library which requires an authentication token you have to *append it as an URL parameter _auth''''' to the RPC-Server URL. So instead of calling '''/cgi-bin/luci/rpc/''LIBRARY''''' you have to call '''/cgi-bin/luci/rpc/''LIBRARY''?auth=''TOKEN_*.
If your JSON-RPC client is Cookie-aware (like most browsers are) you will receive the authentication token also with a session cookie and probably don't have to append it to the RPC-Server URL.
# Exported Libraries
## uci
The UCI-Library */rpc/uci* offers functionality to interact with the Universal Configuration Interface.
*Exported Functions:*
* [(string) add(config, type)](http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.add)
* [(integer) apply(config)](http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.apply)
* [http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.changes (object) changes([config])]
* [(boolean) commit(config)](http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.commit)
* [http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.delete (boolean) delete(config, section[, option])]
* [http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.delete_all (boolean) delete_all(config[, type])]
* [http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.foreach (array) foreach(config[, type])]
* [http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.get (mixed) get(config, section[, option])]
* [http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.get_all (object) get_all(config[, section])]
* [http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.get (mixed) get_state(config, section[, option])]
* [(boolean) revert(config)](http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.revert)
* [(name) section(config, type, name, values)](http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.section)
* [(boolean) set(config, section, option, value)](http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.set)
* [(boolean) tset(config, section, values)](http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.tset)
## uvl
The UVL-Library */rpc/uvl* offers functionality to validate UCI files and get schemes describing UCI files.
*Exported Functions:*
* [(array) get_scheme(scheme)](http://luci.subsignal.org/api/luci/modules/luci.uvl.html#UVL.get_scheme)
* [(array) validate(config, section, option)](http://luci.subsignal.org/api/luci/modules/luci.uvl.html#UVL.validate)
* [(array) validate_config(config)](http://luci.subsignal.org/api/luci/modules/luci.uvl.html#UVL.validate_config)
* [(array) validate_section(config, section)](http://luci.subsignal.org/api/luci/modules/luci.uvl.html#UVL.validate_section)
* [(array) validate(config, section, option)](http://luci.subsignal.org/api/luci/modules/luci.uvl.html#UVL.validate_option)
## fs
The Filesystem library */rpc/fs* offers functionality to interact with the filesystem on the host machine.
*Exported Functions:*
* [Complete luci.fs library](http://luci.subsignal.org/api/luci/modules/luci.fs.html)
*Note:* All functions are exported as they are except for _readfile'' which encodes its return value in base64 and ''writefile'' which only accepts base64 encoded data as second argument. Note that both functions will only be available when the ''luasocket_ packet is installed on the hostsystem.
## sys
The System library */rpc/sys* offers functionality to interact with the operating system on the host machine.
*Exported Functions:*
* [Complete luci.sys library](http://luci.subsignal.org/api/luci/modules/luci.sys.html)
* [Complete luci.sys.group library](http://luci.subsignal.org/api/luci/modules/luci.sys.group.html) with prefix *group.*
* [Complete luci.sys.net library](http://luci.subsignal.org/api/luci/modules/luci.sys.net.html) with prefix *net.*
* [Complete luci.sys.process library](http://luci.subsignal.org/api/luci/modules/luci.sys.process.html) with prefix *process.*
* [Complete luci.sys.user library](http://luci.subsignal.org/api/luci/modules/luci.sys.user.html) with prefix *user.*
* [Complete luci.sys.wifi library](http://luci.subsignal.org/api/luci/modules/luci.sys.wifi.html) with prefix *wifi.*
## ipkg
The IPKG library */rpc/ipkg* offers functionality to interact with the package manager (IPKG or OPKG) on the host machine.
*Exported Functions:*
* [Complete luci.model.ipkg library](http://luci.subsignal.org/api/luci/modules/luci.model.ipkg.html)

87
docs/LAR.md Normal file
View File

@@ -0,0 +1,87 @@
LAR is a simple archive format to pack multiple lua source files and arbitrary other resources into a single file.
# Format Specification
A LAR archive file is divided into two parts: the payload and the index lookup table.
All segments of the archive are 4 Byte aligned to ease reading and processing of the format.
All integers are stored in network byte order, so an implementation has to use htonl() and htons() to properly read them.
Schema:
<payload:
<member:
<N*4 bytes: path of file #1>
<N*4 bytes: data of file #1>
>
<member:
<N*4 bytes: path of file #2>
<N*4 bytes: data of file #2>
>
...
<member:
<N*4 bytes: path of file #N>
<N*4 bytes: data of file #N>
>
>
<index table:
<entry:
<uint32: offset for path of file #1> <uint32: length for path of file #1>
<uint32: offset for data of file #1> <uint32: length for data of file #1>
<uint16: type of file #1> <uint16: flags of file #1>
>
<entry:
<uint32: offset for path of file #2> <uint32: length for path of file #2>
<uint32: offset for data of file #2> <uint32: length for data of file #2>
<uint16: type of file #2> <uint16: flags of file #2>
>
...
<entry:
<uint32: offset for path of file #N> <uint32: length for path of file #N>
<uint32: offset for data of file #N> <uint32: length for data of file #N>
<uint16: type of file #N> <uint16: flags of file #N>
>
>
<uint32: offset for begin of index table>
# Processing
In order to process an LAR archive, an implementation would have to do the following steps:
## Read Index
1. Locate and open the archive file
1. Seek to end of file - 4 bytes
1. Read 32bit index offset and swap from network to native byte order
1. Seek to index offset, calculate index length: filesize - index offset - 4
1. Initialize a linked list for index table entries
1. Read each index entry until the index length is reached, read and byteswap 4 * 32bit int and 2 * 16bit int
1. Seek to begin of file
## Read Member
1. Read the archive index
1. Iterate through the linked index list, perform the following steps for each entry
1. Seek to the specified file path offset
1. Read as much bytes as specified in the file path length into a buffer
1. Compare the contents of the buffer against the path of the searched member
1. If buffer and searched path are equal, seek to the specified file data offset
1. Read data until the file data length is reached, return
1. Select the next index table entry and repeat from step 3, if there is no next entry then return
# Reference implementation
A reference implementation can be found here:
http://luci.subsignal.org/trac/browser/luci/trunk/contrib/lar
The lar.pl script is a simple packer for LAR archives and cli.c provides a utility to list and dump packed LAR archives.

144
docs/LMO.md Normal file
View File

@@ -0,0 +1,144 @@
LMO is a simple binary format to pack language strings into a more efficient form. Although it's suitable to store any kind of key-value table, it's only used for the LuCI *.po based translation system at the moment. The abbreviation "LMO" stands for "Lua Machine Objects" in the style of the GNU gettext *.mo format.
# Format Specification
A LMO file is divided into two parts: the payload and the index lookup table.
All segments of the file are 4 Byte aligned to ease reading and processing of the format.
Only unsigned 32bit integers are used and stored in network byte order, so an implementation has to use htonl() to properly read them.
Schema:
<file:
<payload:
<entry #1: 4 byte aligned data>
<entry #2: 4 byte aligned data>
...
<entry #N: 4 byte aligned data>
>
<index table:
<entry #1:
<uint32_t: hash of the first key>
<uint32_t: hash of the first value>
<uint32_t: file offset of the first value>
<uint32_t: length of the first value>
>
<entry #2:
<uint32_t: hash of the second key>
<uint32_t: hash of the second value>
<uint32_t: file offset of the second value>
<uint32_t: length of the second value>
>
...
<entry #N:
<uint32_t: hash of the Nth key>
<uint32_t: hash of the Nth value>
<uint32_t: file offset of the Nth value>
<uint32_t: length of the Nth value>
>
>
<uint32_t: offset of the begin of index table>
>
# Processing
In order to process a LMO file, an implementation would have to do the following steps:
## Read Index
1. Locate and open the archive file
1. Seek to end of file - 4 bytes (sizeof(uint32_t))
1. Read 32bit index offset and swap from network to native byte order
1. Seek to index offset, calculate index length: filesize - index offset - 4
1. Initialize a linked list for index table entries
1. Read each index entry until the index length is reached, read and byteswap 4 * uint32_t for each step
1. Seek to begin of file
## Read Entry
1. Calculate the unsigned 32bit hash of the entries key value (see "Hash Function" section below)
1. Obtain the archive index
1. Iterate through the linked index list, perform the following steps for each entry:
1. Compare the entry hash value with the calculated hash from step 1
2. If the hash values are equal proceed with step 4
3. Select the next entry and repeat from step 3.1
1. Seek to the file offset specified in the selected entry
1. Read as much bytes as specified in the entry length into a buffer
1. Return the buffer value
# Hash Function
The current LuCI-LMO implementation uses the "Super Fast Hash" function which was kindly put in the public domain by it's original author. See http://www.azillionmonkeys.com/qed/hash.html for details. Below is the C-Implementation of this function:
#if (defined(__GNUC__) && defined(__i386__))
#define sfh_get16(d) (*((const uint16_t *) (d)))
#else
#define sfh_get16(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8)\
+(uint32_t)(((const uint8_t *)(d))[0]) )
#endif
uint32_t sfh_hash(const char * data, int len)
{
uint32_t hash = len, tmp;
int rem;
if (len <= NULL) return 0;
rem = len & 3;
len >>= 2;
/* Main loop */
for (;len > 0; len--) {
hash += sfh_get16(data);
tmp = (sfh_get16(data+2) << 11) ^ hash;
hash = (hash << 16) ^ tmp;
data += 2*sizeof(uint16_t);
hash += hash >> 11;
}
/* Handle end cases */
switch (rem) {
case 3: hash += sfh_get16(data);
hash ^= hash << 16;
hash ^= data[sizeof(uint16_t)] << 18;
hash += hash >> 11;
break;
case 2: hash += sfh_get16(data);
hash ^= hash << 11;
hash += hash >> 17;
break;
case 1: hash += *data;
hash ^= hash << 10;
hash += hash >> 1;
}
/* Force "avalanching" of final 127 bits */
hash ^= hash << 3;
hash += hash >> 5;
hash ^= hash << 4;
hash += hash >> 17;
hash ^= hash << 25;
hash += hash >> 6;
return hash;
}
# Reference Implementation
A reference implementation can be found here:
http://luci.subsignal.org/trac/browser/luci/trunk/libs/lmo/src
The lmo_po2lmo.c executable implements a *.po to *.lmo conversation utility and lmo_lookup.c is a simple *.lmo test utility.
Lua bindings for lmo are defined in lmo_lualib.c and associated headers.

202
docs/LuCI-0.10.md Normal file
View File

@@ -0,0 +1,202 @@
[[PageOutline(2-5, Table of Contents, floated)]]
This document describes new features and incompatibilities to LuCI 0.9.x.
It is targeted at module authors developing external addons to LuCI.
# I18N Changes
## API
The call conventions for the i18n api changed, there is no dedicated translation
key anymore and the english text is used for lookup instead. This was done to
ease the maintenance of language files.
Code that uses _translate()'' or ''i18n()_ must be changed as follows:
-- old style:
translate("some_text", "Some Text")
translatef("some_format_text", "Some formatted Text: %d", 123)
-- new style:
translate("Some Text")
translatef("Some formatted Text: %d", 123)
Likewise for templates:
<!-- old style: -->
<%:some_text Some Text%>
<!-- new style: -->
<%:Some Text%>
If code must support both LuCI 0.9.x and 0.10.x versions, it is suggested to write the calls as follows:
translate("Some Text", "Some Text")
An alternative is wrapping translate() calls into a helper function:
function tr(key, alt)
return translate(key) or translate(alt) or alt
end
... which is used as follows:
tr("some_key", "Some Text")
## Translation File Format
Translation catalogs are now maintained in *.po format files. During build those get translated
into [*.lmo archives](http://luci.subsignal.org/trac/wiki/Documentation/LMO).
LuCI ships a [utility script](http://luci.subsignal.org/trac/browser/luci/branches/luci-0.10/build/i18n-lua2po.pl)
in the build/ directory to convert old Lua translation files to the *.po format. The generated *.po files should
be placed in the appropriate subdirectories within the top po/ file in the LuCI source tree.
### Components built within the LuCI tree
If components using translations are built along with the LuCI tree, the newly added *.po file are automatically
compiled into *.lmo archives during the build process. In order to bundle the appropriate *.lmo files into the
corresponding *.ipk packages, component Makefiles must include a "PO" variable specifying the files to include.
Given a module _applications/example/'' which uses ''po/en/example.po'' and ''po/en/example-extra.po_,
the _applications/example/Makefile_ must be changed as follows:
PO = example example-extra
include ../../build/config.mk
include ../../build/module.mk
### Standalone components
Authors who externally package LuCI components must prepare required *.lmo archives themselves.
To convert existing Lua based message catalogs to the *.po format, the build/i18n-lua2po.pl helper script can be used.
In order to convert *.po files into *.lmo files, the standalone "po2lmo" utility must be compiled as follows:
$ svn co http://svn.luci.subsignal.org/luci/branches/luci-0.10/libs/lmo
$ cd lmo/
$ make
$ ./src/po2lmo translations.po translations.lmo
Note that at the time of writing, the utility program needs Lua headers installed on the system in order to compile properly.
# CBI
## Datatypes
The server side UVL validation has been dropped to reduce space requirements on the target.
Instead it is possible to define datatypes for CBI widgets now:
opt = section:option(Value, "optname", "Title Text")
opt.datatype = "ip4addr"
User provided data is validated once on the frontend via JavaScript and on the server side prior to saving it.
A list of possible datatypes can be found in the [luci.cbi.datatypes](http://luci.subsignal.org/trac/browser/luci/branches/luci-0.10/libs/web/luasrc/cbi/datatypes.lua#L26) class.
## Validation
Server-sided validator function can now return custom error messages to provide better feedback on invalid input.
opt = section:option(Value, "optname", "Title Text")
function opt.validate(self, value, section)
if input_is_valid(value) then
return value
else
return nil, "The value is invalid because ..."
end
end
## Tabs
It is now possible to break up CBI sections into multiple tabs to better organize longer forms.
The TypedSection and NamedSection classes gained two new functions to define tabs, _tab()'' and ''taboption()_.
sct = map:section(TypedSection, "name", "type", "Title Text")
sct:tab("general", "General Tab Title", "General Tab Description")
sct:tab("advanced", "Advanced Tab Title", "Advanced Tab Description")
opt = sct:taboption("general", Value, "optname", "Title Text")
...
The _tab()_ function is declares a new tab and takes up to three arguments:
* Internal name of the tab, must be unique within the section
* Title text of the tab
* Optional description text for the tab
The _taboption()'' function wraps ''option()_ and assigns the option object to the given tab.
It takes up to five arguments:
* Name of the tab to assign the option to
* Option type, e.g. Value or DynamicList
* Option name
* Title text of the option
* Optional description text of the option
If tabs are used within a particular section, the _option()_ function must not be used,
doing so results in undefined behaviour.
## Hooks
The CBI gained support for _hooks_ which can be used to trigger additional actions during the
life-cycle of a map:
map = Map("config", "Title Text")
function map.on_commit(self)
-- do something if the UCI configuration got committed
end
The following hooks are defined:
|| on_cancel || The user pressed cancel within a multi-step Delegator or a SimpleForm instance ||
|| on_init || The CBI is about to render the Map object ||
|| on_parse || The CBI is about to read received HTTP form values ||
|| on_save, on_before_save || The CBI is about to save modified UCI configuration files ||
|| on_after_save || Modified UCI configuration files just got saved
|| on_before_commit || The CBI is about to commit the changes ||
|| on_commit, on_after_commit, on_before_apply || Modified configurations got committed and the CBI is about to restart associated services ||
|| on_apply, on_after_apply || All changes where completely applied (only works on Map instances with the apply_on_parse attribute set) ||
## Sortable Tables
TypedSection instances which use the "cbi/tblsection" template may now use a new attribute _sortable_ to allow the user to reorder table rows.
sct = map:section(TypedSection, "name", "type", "Title Text")
sct.template = "cbi/tblsection"
sct.sortable = true
...
# JavaScript
The LuCI 0.10 branch introduced a new JavaScript file _xhr.js_ which provides support routines for XMLHttpRequest operations.
Each theme must include this file in the <head> area of the document for forms to work correctly.
It should be included like this:
<script type="text/javascript" src="<%=resource%>/xhr.js"></script>

94
docs/Modules.md Normal file
View File

@@ -0,0 +1,94 @@
# Categories
The LuCI modules are divided into several category directories, namely:
* applications (Single applications or plugins for other modules or applications)
* i18n (Translation files)
* libs (Independent libraries)
* modules (Collections of applications)
* themes (Frontend themes)
Each module goes into a subdirectory of any of this category-directories.
# Module directory
The contents of a module directory are as follows:
## Makefile
This is the module's makefile. If the module just contains Lua sourcecode or resources then the following Makefile should suffice.
include ../../build/config.mk
include ../../build/module.mk
If you have C(++) code in your module your Makefile should at least contain the following things.
include ../../build/config.mk
include ../../build/gccconfig.mk
include ../../build/module.mk
compile:
# Commands to compile and link your C-code
# and to install them under the dist/ hierarchy
clean: luaclean
# Commands to clean your compiled objects
## src
The *src* directory is reserved for C sourcecode.
## luasrc
*luasrc* contains all Lua sourcecode files. These will automatically be stripped or compiled depending on the Make target and are installed in the LuCI installation directory.
## lua
*lua* is equivalent to _luasrc_ but containing Lua files will be installed in the Lua document root.
## htdocs
All files under *htdocs* will be copied to the document root of the target webserver.
## root
All directories and files under *root* will be copied to the installation target as they are.
## dist
*dist* is reserved for the builder to create a working installation tree that will represent the filesystem on the target machine.
*DO NOT* put any files there as they will get deleted.
## ipkg
*ipkg* contains IPKG package control files, like _preinst'', ''posinst'', ''prerm'', ''postrm''. ''conffiles_.
See IPKG documentation for details.
# OpenWRT feed integration
If you want to add your module to the LuCI OpenWRT feed you have to add several sections to the contrib/package/luci/Makefile.
For a Web UI applications this is:
A package description:
define Package/luci-app-YOURMODULE
$(call Package/luci/webtemplate)
DEPENDS+=+some-package +some-other-package
TITLE:=SHORT DESCRIPTION OF YOURMODULE
endef
A package installation target:
define Package/luci-app-YOURMODULE/install
$(call Package/luci/install/template,$(1),applications/YOURMODULE)
endef
A module build instruction:
ifneq ($(CONFIG_PACKAGE_luci-app-YOURMODULE),)
PKG_SELECTED_MODULES+=applications/YOURMODULE
endif
A build package call:
$(eval $(call BuildPackage,luci-app-YOURMODULE))

153
docs/ModulesHowTo.md Normal file
View File

@@ -0,0 +1,153 @@
*Note:* If you plan to integrate your module into LuCI, you should read the [wiki:Documentation/Modules Module Reference] before.
This tutorial describes how to write your own modules for the LuCI WebUI.
For this tutorial we refer to your LuCI installation directory as *lucidir_' (/usr/lib/lua/luci if you are working with an installed version) and assume your LuCI installation is reachable through your webserver via '_/cgi-bin/luci*.
If you are working with the development environment replace *lucidir_' with '''''/path/to/your/luci/checkout''/applications/myapplication/luasrc''' (this is a default empty module you can use for your experiments) and your LuCI installation can probably be reached via http://localhost:8080/luci/ after you ran '_make runhttpd*.
# Show me the way (The dispatching process)
To write a module you need to understand the basics of the dispatching process in LuCI.
LuCI uses a dispatching tree that will be built by executing the index-Function of every available controller.
The CGI-environment variable *PATH_INFO* will be used as the path in this dispatching tree, e.g.: /cgi-bin/luci/foo/bar/baz
will be resolved to foo.bar.baz
To register a function in the dispatching tree, you can use the *entry*-function of _luci.dispatcher_. entry takes 4 arguments (2 are optional):
entry(path, target, title=nil, order=nil)
* *path* is a table that describes the position in the dispatching tree: For example a path of {"foo", "bar", "baz"} would insert your node in foo.bar.baz.
* *target* describes the action that will be taken when a user requests the node. There are several predefined ones of which the 3 most important (call, template, cbi) are described later on on this page
* *title* defines the title that will be visible to the user in the menu (optional)
* *order* is a number with which nodes on the same level will be sorted in the menu (optional)
You can assign more attributes by manipulating the node table returned by the entry-function. A few example attributes:
* *i18n* defines which translation file should be automatically loaded when the page gets requested
* *dependent* protects plugins to be called out of their context if a parent node is missing
* *leaf* stops parsing the request at this node and goes no further in the dispatching tree
* *sysauth* requires the user to authenticate with a given system user account
# It's all about names (Naming and the module file)
Now that you know the basics about dispatching, we can start writing modules. But before you have to choose the category and name of your new digital child.
We assume you want to create a new application "myapp" with a module "mymodule".
So you have to create a new subdirectory *_lucidir''/controller/myapp''' with a file '_mymodule.lua* with the following content:
module("luci.controller.myapp.mymodule", package.seeall)
function index()
end
The first line is required for Lua to correctly identify the module and create its scope.
The index-Function will be used to register actions in the dispatching tree.
# Teaching your new child (Actions)
So it is there and has a name but it has no actions.
We assume you want to reuse your module myapp.mymodule that you begun in the last step.
## Actions
Reopen *_lucidir_/controller/myapp/mymodule.lua* and just add a function to it so that its content looks like this example:
module("luci.controller.myapp.mymodule", package.seeall)
function index()
entry({"click", "here", "now"}, call("action_tryme"), "Click here", 10).dependent=false
end
function action_tryme()
luci.http.prepare_content("text/plain")
luci.http.write("Haha, rebooting now...")
luci.sys.reboot()
end
And now type */cgi-bin/luci/click/here/now_' ('_[http://localhost:8080/luci/click/here/now]* if you are using the development environment) in your browser.
You see these action functions simple have to be added to a dispatching entry.
As you might or might not know: CGI specification requires you to send a Content-Type header before you can send your content. You will find several shortcuts (like the one used above) as well as redirecting functions in the module *luci.http*
## Views
If you only want to show the user a text or some interesting familiy photos it may be enough to use a HTML-template. These templates can also include some Lua code but be aware that writing whole office suites by only using these templates might be called "dirty" by other developers.
Now let's create a little template *_lucidir_/view/myapp-mymodule/helloworld.htm* with the content:
<%+header%>
<h1><%:Hello World%></h1>
<%+footer%>
and add the following line to the index-Function of your module file.
entry({"my", "new", "template"}, template("myapp-mymodule/helloworld"), "Hello world", 20).dependent=false
Now type */cgi-bin/luci/my/new/template_' ('_[http://localhost:8080/luci/my/new/template]* if you are using the development environment) in your browser.
You may notice those fancy <% %>-Tags, these are [wiki:Documentation/Templates|template markups] used by the LuCI template processor.
It is always good to include header and footer at the beginning and end of a template as those create the default design and menu.
## <a name=cbimodels></a> CBI models
The CBI is one of the uber coolest features of LuCI. It creates a formular based user interface and saves its contents to a specific UCI config file. You only have to describe the structure of the configuration file in a CBI model file and Luci does the rest of the work. This includes generating, parsing and validating a XHTML form and reading and writing the UCI file.
So let's be serious at least for this paragraph and create a real pratical example *_lucidir_/model/cbi/myapp-mymodule/netifaces.lua* with the following contents:
m = Map("network", "Network") -- We want to edit the uci config file /etc/config/network
s = m:section(TypedSection, "interface", "Interfaces") -- Especially the "interface"-sections
s.addremove = true -- Allow the user to create and remove the interfaces
function s:filter(value)
return value ~= "loopback" and value -- Don't touch loopback
end
s:depends("proto", "static") -- Only show those with "static"
s:depends("proto", "dhcp") -- or "dhcp" as protocol and leave PPPoE and PPTP alone
p = s:option(ListValue, "proto", "Protocol") -- Creates an element list (select box)
p:value("static", "static") -- Key and value pairs
p:value("dhcp", "DHCP")
p.default = "static"
s:option(Value, "ifname", "interface", "the physical interface to be used") -- This will give a simple textbox
s:option(Value, "ipaddr", translate("ip", "IP Address")) -- Ja, das ist eine i18n-Funktion ;-)
s:option(Value, "netmask", "Netmask"):depends("proto", "static") -- You may remember this "depends" function from above
mtu = s:option(Value, "mtu", "MTU")
mtu.optional = true -- This one is very optional
dns = s:option(Value, "dns", "DNS-Server")
dns:depends("proto", "static")
dns.optional = true
function dns:validate(value) -- Now, that's nifty, eh?
return value:match("[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") -- Returns nil if it doesn't match otherwise returns match
end
gw = s:option(Value, "gateway", "Gateway")
gw:depends("proto", "static")
gw.rmempty = true -- Remove entry if it is empty
return m -- Returns the map
and of course don't forget to add something like this to your module's index-Function.
entry({"admin", "network", "interfaces"}, cbi("myapp-mymodule/netifaces"), "Network interfaces", 30).dependent=false
There are many more features, see [wiki:Documentation/CBI the CBI reference] and the modules shipped with LuCI.

65
docs/Templates.md Normal file
View File

@@ -0,0 +1,65 @@
LuCI has a simple regex based template processor which parses HTML-files to Lua functions and allows to store precompiled template files.
The simplest form of a template is just an ordinary HTML-file. It will be printed out to the user as is.
In LuCI every template is an object with an own scope. It can therefore be instantiated and each instance can has a different scope. As every template processor. LuCI supports several special markups. Those are enclosed in `<% %>`-Tags.
By adding `-` (dash) right after the opening `<%` every whitespace before the markup will be stripped. Adding a `-` right before the closing `%>` will equivalently strip every whitespace behind the markup.
# Builtin functions and markups
## Including Lua code
*Markup:*
<% code %>
## Writing variables and function values
*Syntax:*
<% write (value) %>
*Short-Markup:*
<%=value%>
## Including templates
*Syntax:*
<% include (templatename) %>
*Short-Markup:*
<%+templatename%>
## Translating
*Syntax:*
<%= translate("Text to translate") %>
*Short-Markup:*
<%:Text to translate%>
## Commenting
*Markup:*
<%# comment %>
# Builtin constants
| Name | Value |
---------|---------
|`REQUEST_URI`|The current URL (without server part)|
|`controller`|Path to the Luci main dispatcher|
|`resource`|Path to the resource directory|
|`media`|Path to the active theme directory|

76
docs/ThemesHowTo.md Normal file
View File

@@ -0,0 +1,76 @@
# HowTo: Create Themes
*Note:* You should read the [Module Reference](Modules.md) and the [Template Reference](Templates.md) before.
We assume you want to call your new theme _mytheme_. Make sure you replace this by your module name every time this is mentionend in this Howto.
# Creating the structure
At first create a new theme directory *themes/_mytheme_*.
Create a _Makefile_ inside your theme directory with the following content:
include ../../build/config.mk
include ../../build/module.mk
Create the following directory structure inside your theme directory.
* ipkg
* htdocs
* luci-static
* _mytheme_
* luasrc
* view
* themes
* _mytheme_
* root
* etc
* uci-defaults
# Designing
Create two LuCI HTML-Templates named _header.htm'' and ''footer.htm'' under *luasrc/view/themes/''mytheme_*.
The _header.htm'' will be included at the beginning of each rendered page and the ''footer.htm_ at the end.
So your _header.htm'' will probably contain a DOCTYPE description, headers, the menu and layout of the page and the ''footer.htm_ will close all remaining open tags and may add a footer bar but hey that's your choice you are the designer ;-).
Just make sure your _header.htm_ *begins* with the following lines:
<%
require("luci.http").prepare_content("text/html")
-%>
This makes sure your content will be sent to the client with the right content type. Of course you can adapt _text/html_ to your needs.
Put any stylesheets, Javascripts, images, ... into *htdocs/luci-static/_mytheme_*.
You should refer to this directory in your header and footer templates as: _<%=media%>''. That means for a stylesheet *htdocs/luci-static/''mytheme_/cascade.css* you would write:
<link rel="stylesheet" type="text/css" href="<%=media%>/cascade.css" />
# Making the theme selectable
If you are done with your work there are two last steps to do.
To make your theme OpenWRT-capable and selectable on the settings page you should now create a file *root/etc/uci-defaults/luci-theme-_mytheme_* with the following contents:
#!/bin/sh
uci batch <<-EOF
set luci.themes.MyTheme=/luci-static/mytheme
commit luci
EOF
and another file *ipkg/postinst* with the following content:
#!/bin/sh
[ -n "${IPKG_INSTROOT}" ] || {
( . /etc/uci-defaults/luci-theme-mytheme ) && rm -f /etc/uci-defaults/luci-theme-mytheme
}
This is some OpenWRT magic to correctly register the template with LuCI when it gets installed.
That's all. Now send your theme to the LuCI developers to get it into the development repository - if you like.

426
docs/api/index.html Normal file
View File

@@ -0,0 +1,426 @@
<!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><strong>Index</strong></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>
<a href="modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="modules/luci.http.mime.html">luci.http.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">
<h2>Modules</h2>
<table class="module_list">
<!--<tr><td colspan="2">Modules</td></tr>-->
<tr>
<td class="name"><a href="modules/luci.dispatcher.html">luci.dispatcher</a></td>
<td class="summary"></td>
</tr>
<tr>
<td class="name"><a href="modules/luci.http.html">luci.http</a></td>
<td class="summary"></td>
</tr>
<tr>
<td class="name"><a href="modules/luci.http.conditionals.html">luci.http.conditionals</a></td>
<td class="summary"></td>
</tr>
<tr>
<td class="name"><a href="modules/luci.http.date.html">luci.http.date</a></td>
<td class="summary"></td>
</tr>
<tr>
<td class="name"><a href="modules/luci.http.mime.html">luci.http.mime</a></td>
<td class="summary"></td>
</tr>
<tr>
<td class="name"><a href="modules/luci.i18n.html">luci.i18n</a></td>
<td class="summary"></td>
</tr>
<tr>
<td class="name"><a href="modules/luci.ip.html">luci.ip</a></td>
<td class="summary">
LuCI IP calculation and netlink access library.</td>
</tr>
<tr>
<td class="name"><a href="modules/luci.ip.cidr.html">luci.ip.cidr</a></td>
<td class="summary">
IP CIDR Object.</td>
</tr>
<tr>
<td class="name"><a href="modules/luci.json.html">luci.json</a></td>
<td class="summary"></td>
</tr>
<tr>
<td class="name"><a href="modules/luci.jsonc.html">luci.jsonc</a></td>
<td class="summary">
LuCI JSON parsing and serialization library.</td>
</tr>
<tr>
<td class="name"><a href="modules/luci.jsonc.parser.html">luci.jsonc.parser</a></td>
<td class="summary">
LuCI JSON parser instance.</td>
</tr>
<tr>
<td class="name"><a href="modules/luci.model.ipkg.html">luci.model.ipkg</a></td>
<td class="summary"></td>
</tr>
<tr>
<td class="name"><a href="modules/luci.model.uci.html">luci.model.uci</a></td>
<td class="summary"></td>
</tr>
<tr>
<td class="name"><a href="modules/luci.rpcc.html">luci.rpcc</a></td>
<td class="summary"></td>
</tr>
<tr>
<td class="name"><a href="modules/luci.rpcc.ruci.html">luci.rpcc.ruci</a></td>
<td class="summary"></td>
</tr>
<tr>
<td class="name"><a href="modules/luci.sys.html">luci.sys</a></td>
<td class="summary"></td>
</tr>
<tr>
<td class="name"><a href="modules/luci.sys.init.html">luci.sys.init</a></td>
<td class="summary">
LuCI system utilities / init related functions.</td>
</tr>
<tr>
<td class="name"><a href="modules/luci.sys.iptparser.html">luci.sys.iptparser</a></td>
<td class="summary"></td>
</tr>
<tr>
<td class="name"><a href="modules/luci.sys.net.html">luci.sys.net</a></td>
<td class="summary">
LuCI system utilities / network related functions.</td>
</tr>
<tr>
<td class="name"><a href="modules/luci.sys.process.html">luci.sys.process</a></td>
<td class="summary">
LuCI system utilities / process related functions.</td>
</tr>
<tr>
<td class="name"><a href="modules/luci.sys.user.html">luci.sys.user</a></td>
<td class="summary">
LuCI system utilities / user related functions.</td>
</tr>
<tr>
<td class="name"><a href="modules/luci.sys.wifi.html">luci.sys.wifi</a></td>
<td class="summary">
LuCI system utilities / wifi related functions.</td>
</tr>
<tr>
<td class="name"><a href="modules/luci.util.html">luci.util</a></td>
<td class="summary"></td>
</tr>
<tr>
<td class="name"><a href="modules/nixio.html">nixio</a></td>
<td class="summary">
General POSIX IO library.</td>
</tr>
<tr>
<td class="name"><a href="modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a></td>
<td class="summary">
Changes and improvements.</td>
</tr>
<tr>
<td class="name"><a href="modules/nixio.CryptoHash.html">nixio.CryptoHash</a></td>
<td class="summary">
Cryptographical Hash and HMAC object.</td>
</tr>
<tr>
<td class="name"><a href="modules/nixio.File.html">nixio.File</a></td>
<td class="summary">
Large File Object.</td>
</tr>
<tr>
<td class="name"><a href="modules/nixio.README.html">nixio.README</a></td>
<td class="summary">
General Information.</td>
</tr>
<tr>
<td class="name"><a href="modules/nixio.Socket.html">nixio.Socket</a></td>
<td class="summary">
Socket Object.</td>
</tr>
<tr>
<td class="name"><a href="modules/nixio.TLSContext.html">nixio.TLSContext</a></td>
<td class="summary">
Transport Layer Security Context Object.</td>
</tr>
<tr>
<td class="name"><a href="modules/nixio.TLSSocket.html">nixio.TLSSocket</a></td>
<td class="summary">
TLS Socket Object.</td>
</tr>
<tr>
<td class="name"><a href="modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a></td>
<td class="summary">
Unified high-level I/O utility API for Files, Sockets and TLS-Sockets.</td>
</tr>
<tr>
<td class="name"><a href="modules/nixio.bin.html">nixio.bin</a></td>
<td class="summary">
Binary operations and conversion.</td>
</tr>
<tr>
<td class="name"><a href="modules/nixio.bit.html">nixio.bit</a></td>
<td class="summary">
Bitfield operators and mainpulation functions.</td>
</tr>
<tr>
<td class="name"><a href="modules/nixio.crypto.html">nixio.crypto</a></td>
<td class="summary">
Cryptographical library.</td>
</tr>
<tr>
<td class="name"><a href="modules/nixio.fs.html">nixio.fs</a></td>
<td class="summary">
Low-level and high-level filesystem manipulation library.</td>
</tr>
</table>
</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>

285
docs/api/luadoc.css Normal file
View File

@@ -0,0 +1,285 @@
body {
margin-left: 1em;
margin-right: 1em;
font-family: arial, helvetica, geneva, sans-serif;
background-color:#ffffff; margin:0px;
}
code {
font-family: "Andale Mono", monospace;
}
tt {
font-family: "Andale Mono", monospace;
}
body, td, th { font-size: 11pt; }
h1, h2, h3, h4 { margin-left: 0em; }
textarea, pre, tt { font-size:10pt; }
body, td, th { color:#000000; }
small { font-size:0.85em; }
h1 { font-size:1.5em; }
h2 { font-size:1.25em; }
h3 { font-size:1.15em; }
h4 { font-size:1.06em; }
a:link { font-weight:bold; color: #004080; text-decoration: none; }
a:visited { font-weight:bold; color: #006699; text-decoration: none; }
a:link:hover { text-decoration:underline; }
hr { color:#cccccc }
img { border-width: 0px; }
h3 { padding: 1em 0 0.5em; }
p { margin-left: 1em; }
p.name {
font-family: "Andale Mono", monospace;
padding-top: 1em;
margin-left: 0em;
}
blockquote { margin-left: 3em; }
pre.example {
background-color: rgb(245, 245, 245);
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: silver;
border-right-color: silver;
border-bottom-color: silver;
border-left-color: silver;
padding: 1em;
margin-left: 1em;
margin-right: 1em;
font-family: "Andale Mono", monospace;
font-size: smaller;
}
hr {
margin-left: 0em;
background: #00007f;
border: 0px;
height: 1px;
}
ul { list-style-type: disc; }
table.index { border: 1px #00007f; }
table.index td { text-align: left; vertical-align: top; }
table.index ul { padding-top: 0em; margin-top: 0em; }
table {
border: 1px solid black;
border-collapse: collapse;
margin: 1em auto;
}
th {
border: 1px solid black;
padding: 0.5em;
}
td {
border: 1px solid black;
padding: 0.5em;
}
div.header, div.footer { margin-left: 0em; }
#container
{
margin-left: 1em;
margin-right: 1em;
background-color: #f0f0f0;
}
#product
{
text-align: center;
border-bottom: 1px solid #cccccc;
background-color: #ffffff;
}
#product big {
font-size: 2em;
}
#product_logo
{
}
#product_name
{
}
#product_description
{
}
#main
{
background-color: #f0f0f0;
border-left: 2px solid #cccccc;
}
#navigation
{
float: left;
width: 18em;
margin: 0;
vertical-align: top;
background-color: #f0f0f0;
overflow:visible;
}
#navigation h1 {
background-color:#e7e7e7;
font-size:1.1em;
color:#000000;
text-align:left;
margin:0px;
padding:0.2em;
border-top:1px solid #dddddd;
border-bottom:1px solid #dddddd;
}
#navigation ul
{
font-size:1em;
list-style-type: none;
padding: 0;
margin: 1px;
}
#navigation li
{
text-indent: -1em;
margin: 0em 0em 0em 0.5em;
display: block;
padding: 3px 0px 0px 12px;
}
#navigation li li a
{
padding: 0px 3px 0px -1em;
}
#content
{
margin-left: 18em;
padding: 1em;
border-left: 2px solid #cccccc;
border-right: 2px solid #cccccc;
background-color: #ffffff;
}
#about
{
clear: both;
margin: 0;
padding: 5px;
border-top: 2px solid #cccccc;
background-color: #ffffff;
}
@media print {
body {
font: 12pt "Times New Roman", "TimeNR", Times, serif;
}
a { font-weight:bold; color: #004080; text-decoration: underline; }
#main
{
background-color: #ffffff;
border-left: 0px;
}
#container
{
margin-left: 2%;
margin-right: 2%;
background-color: #ffffff;
}
#content
{
margin-left: 0px;
padding: 1em;
border-left: 0px;
border-right: 0px;
background-color: #ffffff;
}
#navigation
{
display: none;
}
pre.example {
font-family: "Andale Mono", monospace;
font-size: 10pt;
page-break-inside: avoid;
}
}
table.module_list td
{
border-width: 1px;
padding: 3px;
border-style: solid;
border-color: #cccccc;
}
table.module_list td.name { background-color: #f0f0f0; }
table.module_list td.summary { width: 100%; }
table.file_list
{
border-width: 1px;
border-style: solid;
border-color: #cccccc;
border-collapse: collapse;
}
table.file_list td
{
border-width: 1px;
padding: 3px;
border-style: solid;
border-color: #cccccc;
}
table.file_list td.name { background-color: #f0f0f0; }
table.file_list td.summary { width: 100%; }
table.function_list
{
border-width: 1px;
border-style: solid;
border-color: #cccccc;
border-collapse: collapse;
}
table.function_list td
{
border-width: 1px;
padding: 3px;
border-style: solid;
border-color: #cccccc;
}
table.function_list td.name { background-color: #f0f0f0; }
table.function_list td.summary { width: 100%; }
table.table_list
{
border-width: 1px;
border-style: solid;
border-color: #cccccc;
border-collapse: collapse;
}
table.table_list td

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,552 @@
<!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.conditionals</strong></li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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.conditionals</code></h1>
<p></p>
<h2>Functions</h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#if_match">if_match</a>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>

View File

@@ -0,0 +1,406 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li><strong>luci.http.date</strong></li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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.date</code></h1>
<p></p>
<h2>Functions</h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#compare">compare</a>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,322 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li><strong>luci.http.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.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.mime</code></h1>
<p></p>
<h2>Functions</h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#to_ext">to_ext</a>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>

View File

@@ -0,0 +1,391 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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.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.i18n</code></h1>
<p></p>
<h2>Functions</h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#dump">dump</a>&nbsp;()</td>
<td class="summary">
Return all currently loaded translation strings as a key-value table.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#setlanguage">setlanguage</a>&nbsp;(lang)</td>
<td class="summary">
Set the context default translation language.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#translate">translate</a>&nbsp;(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>&nbsp;(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="dump"></a><strong>dump</strong>&nbsp;()</dt>
<dd>
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.
<h3>Return value:</h3>
Key-value translation string table.
</dd>
<dt><a name="setlanguage"></a><strong>setlanguage</strong>&nbsp;(lang)</dt>
<dd>
Set the context default translation language.
<h3>Parameters</h3>
<ul>
<li>
lang: An IETF/BCP 47 language tag or ISO3166 country code, e.g. "en-US" or "de"
</li>
</ul>
<h3>Return value:</h3>
The effective loaded language, e.g. "en" for "en-US" - or nil on failure
</dd>
<dt><a name="translate"></a><strong>translate</strong>&nbsp;(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>&nbsp;(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>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,594 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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.json</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.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>Object Instance <code>luci.json</code></h1>
<p></p>
<h2>Functions</h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#ActiveDecoder">ActiveDecoder</a>&nbsp;(customnull)</td>
<td class="summary">
Create a new Active JSON-Decoder.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#ActiveDecoder.get">ActiveDecoder:get</a>&nbsp;()</td>
<td class="summary">
Fetches one JSON-object from given source
</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Decoder">Decoder</a>&nbsp;(customnull)</td>
<td class="summary">
Create a new JSON-Decoder.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Decoder.get">Decoder:get</a>&nbsp;()</td>
<td class="summary">
Get the decoded data packets after the rawdata has been sent to the sink.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Decoder.sink">Decoder:sink</a>&nbsp;()</td>
<td class="summary">
Create an LTN12 sink from the decoder object which accepts the JSON-Data.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Encoder">Encoder</a>&nbsp;(data, buffersize, fastescape)</td>
<td class="summary">
Create a new JSON-Encoder.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Encoder.source">Encoder:source</a>&nbsp;()</td>
<td class="summary">
Create an LTN12 source providing the encoded JSON-Data.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#decode">decode</a>&nbsp;(json)</td>
<td class="summary">
Directly decode a JSON string
</td>
</tr>
<tr>
<td class="name" nowrap><a href="#encode">encode</a>&nbsp;(obj)</td>
<td class="summary">
Direcly encode a Lua object into a JSON string.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#null">null</a>&nbsp;()</td>
<td class="summary">
Null replacement function
</td>
</tr>
</table>
<br/>
<br/>
<h2><a name="functions"></a>Functions</h2>
<dl class="function">
<dt><a name="ActiveDecoder"></a><strong>ActiveDecoder</strong>&nbsp;(customnull)</dt>
<dd>
Create a new Active JSON-Decoder.
<h3>Parameters</h3>
<ul>
<li>
customnull: Use luci.json.null instead of nil for decoding null
</li>
</ul>
<h3>Return value:</h3>
Active JSON-Decoder
</dd>
<dt><a name="ActiveDecoder.get"></a><strong>ActiveDecoder:get</strong>&nbsp;()</dt>
<dd>
Fetches one JSON-object from given source
<h3>Return value:</h3>
Decoded object
</dd>
<dt><a name="Decoder"></a><strong>Decoder</strong>&nbsp;(customnull)</dt>
<dd>
Create a new JSON-Decoder.
<h3>Parameters</h3>
<ul>
<li>
customnull: Use luci.json.null instead of nil for decoding null
</li>
</ul>
<h3>Return value:</h3>
JSON-Decoder
</dd>
<dt><a name="Decoder.get"></a><strong>Decoder:get</strong>&nbsp;()</dt>
<dd>
Get the decoded data packets after the rawdata has been sent to the sink.
<h3>Return value:</h3>
Decoded data
</dd>
<dt><a name="Decoder.sink"></a><strong>Decoder:sink</strong>&nbsp;()</dt>
<dd>
Create an LTN12 sink from the decoder object which accepts the JSON-Data.
<h3>Return value:</h3>
LTN12 sink
</dd>
<dt><a name="Encoder"></a><strong>Encoder</strong>&nbsp;(data, buffersize, fastescape)</dt>
<dd>
Create a new JSON-Encoder.
<h3>Parameters</h3>
<ul>
<li>
data: Lua-Object to be encoded.
</li>
<li>
buffersize: Blocksize of returned data source.
</li>
<li>
fastescape: Use non-standard escaping (don't escape control chars)
</li>
</ul>
<h3>Return value:</h3>
JSON-Encoder
</dd>
<dt><a name="Encoder.source"></a><strong>Encoder:source</strong>&nbsp;()</dt>
<dd>
Create an LTN12 source providing the encoded JSON-Data.
<h3>Return value:</h3>
LTN12 source
</dd>
<dt><a name="decode"></a><strong>decode</strong>&nbsp;(json)</dt>
<dd>
Directly decode a JSON string
<h3>Parameters</h3>
<ul>
<li>
json: JSON-String
</li>
</ul>
<h3>Return value:</h3>
Lua object
</dd>
<dt><a name="encode"></a><strong>encode</strong>&nbsp;(obj)</dt>
<dd>
Direcly encode a Lua object into a JSON string.
<h3>Parameters</h3>
<ul>
<li>
obj: Lua Object
</li>
</ul>
<h3>Return value:</h3>
JSON string
</dd>
<dt><a name="null"></a><strong>null</strong>&nbsp;()</dt>
<dd>
Null replacement function
<h3>Return value:</h3>
null
</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

@@ -0,0 +1,393 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><strong>luci.jsonc</strong></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.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>&nbsp;()</td>
<td class="summary">
Construct a new luci.jsonc.parser instance.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#parse">parse</a>&nbsp;(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>&nbsp;(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>&nbsp;()</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>&nbsp;(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>&nbsp;(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>

View File

@@ -0,0 +1,491 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><strong>luci.jsonc.parser</strong></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>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>&nbsp;(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>&nbsp;()</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>&nbsp;(data)</td>
<td class="summary">
Put Lua data into the parser.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#parser.sink">parser:sink</a>&nbsp;()</td>
<td class="summary">
Generate an ltn12-compatible sink.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#parser.stringify">parser:stringify</a>&nbsp;(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>&nbsp;(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>&nbsp;()</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>&nbsp;(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.sink"></a><strong>parser:sink</strong>&nbsp;()</dt>
<dd>
Generate an ltn12-compatible sink.
<h3>Usage:</h3>
<pre>parser = luci.jsonc.new()
ltn12.pump.all(ltn12.source.file(io.input()), parser:sink())
print(parser:get())</pre>
<h3>Return value:</h3>
Returns a function that can be used as an ltn12 sink.
</dd>
<dt><a name="parser.stringify"></a><strong>parser:stringify</strong>&nbsp;(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>

View File

@@ -0,0 +1,730 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><strong>luci.model.ipkg</strong></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.model.ipkg</code></h1>
<p></p>
<h2>Functions</h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#compare_versions">compare_versions</a>&nbsp;(ver1, ver2, comp)</td>
<td class="summary">
lua version of opkg compare-versions
</td>
</tr>
<tr>
<td class="name" nowrap><a href="#find">find</a>&nbsp;(pat, cb)</td>
<td class="summary">
Find packages that match the given pattern.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#info">info</a>&nbsp;(pkg)</td>
<td class="summary">
Return information about installed and available packages.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#install">install</a>&nbsp;(...)</td>
<td class="summary">
Install one or more packages.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#installed">installed</a>&nbsp;(pkg)</td>
<td class="summary">
Determine whether a given package is installed.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#list_all">list_all</a>&nbsp;(pat, cb)</td>
<td class="summary">
List all packages known to opkg.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#list_installed">list_installed</a>&nbsp;(pat, cb)</td>
<td class="summary">
List installed packages.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#overlay_root">overlay_root</a>&nbsp;()</td>
<td class="summary">
Determines the overlay root used by opkg.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#remove">remove</a>&nbsp;(...)</td>
<td class="summary">
Remove one or more packages.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#status">status</a>&nbsp;(pkg)</td>
<td class="summary">
Return the package status of one or more packages.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#update">update</a>&nbsp;()</td>
<td class="summary">
Update package lists.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#upgrade">upgrade</a>&nbsp;()</td>
<td class="summary">
Upgrades all installed packages.</td>
</tr>
</table>
<br/>
<br/>
<h2><a name="functions"></a>Functions</h2>
<dl class="function">
<dt><a name="compare_versions"></a><strong>compare_versions</strong>&nbsp;(ver1, ver2, comp)</dt>
<dd>
lua version of opkg compare-versions
<h3>Parameters</h3>
<ul>
<li>
ver1: string version 1
</li>
<li>
ver2: string version 2
</li>
<li>
comp: string compare versions using
"<=" or "<" lower-equal
">" or ">=" greater-equal
"=" equal
"<<" lower
">>" greater
"~=" not equal
</li>
</ul>
<h3>Return value:</h3>
Boolean indicating the status of the compare
</dd>
<dt><a name="find"></a><strong>find</strong>&nbsp;(pat, cb)</dt>
<dd>
Find packages that match the given pattern.
<h3>Parameters</h3>
<ul>
<li>
pat: Find packages whose names or descriptions match this pattern, nil results in zero results
</li>
<li>
cb: Callback function invoked for each patckage, receives name, version and description as arguments
</li>
</ul>
<h3>Return value:</h3>
nothing
</dd>
<dt><a name="info"></a><strong>info</strong>&nbsp;(pkg)</dt>
<dd>
Return information about installed and available packages.
<h3>Parameters</h3>
<ul>
<li>
pkg: Limit output to a (set of) packages
</li>
</ul>
<h3>Return value:</h3>
Table containing package information
</dd>
<dt><a name="install"></a><strong>install</strong>&nbsp;(...)</dt>
<dd>
Install one or more packages.
<h3>Parameters</h3>
<ul>
<li>
...: List of packages to install
</li>
</ul>
<h3>Return values:</h3>
<ol>
<li>Boolean indicating the status of the action
<li>OPKG return code, STDOUT and STDERR
</ol>
</dd>
<dt><a name="installed"></a><strong>installed</strong>&nbsp;(pkg)</dt>
<dd>
Determine whether a given package is installed.
<h3>Parameters</h3>
<ul>
<li>
pkg: Package
</li>
</ul>
<h3>Return value:</h3>
Boolean
</dd>
<dt><a name="list_all"></a><strong>list_all</strong>&nbsp;(pat, cb)</dt>
<dd>
List all packages known to opkg.
<h3>Parameters</h3>
<ul>
<li>
pat: Only find packages matching this pattern, nil lists all packages
</li>
<li>
cb: Callback function invoked for each package, receives name, version and description as arguments
</li>
</ul>
<h3>Return value:</h3>
nothing
</dd>
<dt><a name="list_installed"></a><strong>list_installed</strong>&nbsp;(pat, cb)</dt>
<dd>
List installed packages.
<h3>Parameters</h3>
<ul>
<li>
pat: Only find packages matching this pattern, nil lists all packages
</li>
<li>
cb: Callback function invoked for each package, receives name, version and description as arguments
</li>
</ul>
<h3>Return value:</h3>
nothing
</dd>
<dt><a name="overlay_root"></a><strong>overlay_root</strong>&nbsp;()</dt>
<dd>
Determines the overlay root used by opkg.
<h3>Return value:</h3>
String containing the directory path of the overlay root.
</dd>
<dt><a name="remove"></a><strong>remove</strong>&nbsp;(...)</dt>
<dd>
Remove one or more packages.
<h3>Parameters</h3>
<ul>
<li>
...: List of packages to install
</li>
</ul>
<h3>Return values:</h3>
<ol>
<li>Boolean indicating the status of the action
<li>OPKG return code, STDOUT and STDERR
</ol>
</dd>
<dt><a name="status"></a><strong>status</strong>&nbsp;(pkg)</dt>
<dd>
Return the package status of one or more packages.
<h3>Parameters</h3>
<ul>
<li>
pkg: Limit output to a (set of) packages
</li>
</ul>
<h3>Return value:</h3>
Table containing package status information
</dd>
<dt><a name="update"></a><strong>update</strong>&nbsp;()</dt>
<dd>
Update package lists.
<h3>Return values:</h3>
<ol>
<li>Boolean indicating the status of the action
<li>OPKG return code, STDOUT and STDERR
</ol>
</dd>
<dt><a name="upgrade"></a><strong>upgrade</strong>&nbsp;()</dt>
<dd>
Upgrades all installed packages.
<h3>Return values:</h3>
<ol>
<li>Boolean indicating the status of the action
<li>OPKG return code, STDOUT and STDERR
</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>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,324 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><strong>luci.rpcc</strong></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>Object Instance <code>luci.rpcc</code></h1>
<p></p>
<h2>Functions</h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#Client.proxy">Client:proxy</a>&nbsp;(prefix)</td>
<td class="summary">
Create a transparent RPC proxy.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client.request">Client:request</a>&nbsp;(method, params, notification)</td>
<td class="summary">
Request an RP call and get the response.</td>
</tr>
</table>
<br/>
<br/>
<h2><a name="functions"></a>Functions</h2>
<dl class="function">
<dt><a name="Client.proxy"></a><strong>Client:proxy</strong>&nbsp;(prefix)</dt>
<dd>
Create a transparent RPC proxy.
<h3>Parameters</h3>
<ul>
<li>
prefix: Method prefix
</li>
</ul>
<h3>Return value:</h3>
RPC Proxy object
</dd>
<dt><a name="Client.request"></a><strong>Client:request</strong>&nbsp;(method, params, notification)</dt>
<dd>
Request an RP call and get the response.
<h3>Parameters</h3>
<ul>
<li>
method: Remote method
</li>
<li>
params: Parameters
</li>
<li>
notification: Notification only?
</li>
</ul>
<h3>Return value:</h3>
response
</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

@@ -0,0 +1,277 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><strong>luci.rpcc.ruci</strong></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>Object Instance <code>luci.rpcc.ruci</code></h1>
<p></p>
<h2>Functions</h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#factory">factory</a>&nbsp;(rpccl)</td>
<td class="summary">
Create a new UCI over RPC proxy.</td>
</tr>
</table>
<br/>
<br/>
<h2><a name="functions"></a>Functions</h2>
<dl class="function">
<dt><a name="factory"></a><strong>factory</strong>&nbsp;(rpccl)</dt>
<dd>
Create a new UCI over RPC proxy.
<h3>Parameters</h3>
<ul>
<li>
rpccl: RPC client
</li>
</ul>
<h3>Return value:</h3>
Network transparent UCI module
</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

@@ -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.html">luci.http</a>
</li>
<li>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><strong>luci.sys</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/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.sys</code></h1>
<p></p>
<h2>Functions</h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#call">call</a>&nbsp;(...)</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>&nbsp;()</td>
<td class="summary">
Retrieves the output of the "dmesg" command.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#exec">exec</a>&nbsp;(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>&nbsp;(var)</td>
<td class="summary">
Retrieve environment variables.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#hostname">hostname</a>&nbsp;(String)</td>
<td class="summary">
Get or set the current hostname.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#httpget">httpget</a>&nbsp;(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>&nbsp;()</td>
<td class="summary">
Retrieve information about currently mounted file systems.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#reboot">reboot</a>&nbsp;()</td>
<td class="summary">
Initiate a system reboot.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#syslog">syslog</a>&nbsp;()</td>
<td class="summary">
Retrieves the output of the "logread" command.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#uniqueid">uniqueid</a>&nbsp;(bytes)</td>
<td class="summary">
Generates a random id with specified length.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#uptime">uptime</a>&nbsp;()</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>&nbsp;(...)</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>&nbsp;()</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>&nbsp;(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 containing the return the output of the command
</dd>
<dt><a name="getenv"></a><strong>getenv</strong>&nbsp;(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 containing 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>&nbsp;(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>&nbsp;(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>&nbsp;()</dt>
<dd>
Retrieve information about currently mounted file systems.
<h3>Return value:</h3>
Table containing mount information
</dd>
<dt><a name="reboot"></a><strong>reboot</strong>&nbsp;()</dt>
<dd>
Initiate a system reboot.
<h3>Return value:</h3>
Return value of os.execute()
</dd>
<dt><a name="syslog"></a><strong>syslog</strong>&nbsp;()</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>&nbsp;(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>&nbsp;()</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>

View File

@@ -0,0 +1,512 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><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/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.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>&nbsp;(name)</td>
<td class="summary">
Disable the given init script
</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init.enable">enable</a>&nbsp;(name)</td>
<td class="summary">
Enable the given init script
</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init.enabled">enabled</a>&nbsp;(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>&nbsp;(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>&nbsp;()</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>&nbsp;(name)</td>
<td class="summary">
Start the given init script
</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init.stop">stop</a>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;()</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>&nbsp;(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>&nbsp;(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>

View File

@@ -0,0 +1,462 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><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/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>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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;()</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>&nbsp;()</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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;()</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>&nbsp;()</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>

View File

@@ -0,0 +1,597 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><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/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.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="#net.arptable">arptable</a>&nbsp;()</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>&nbsp;()</td>
<td class="summary">
Returns conntrack information
</td>
</tr>
<tr>
<td class="name" nowrap><a href="#net.deviceinfo">deviceinfo</a>&nbsp;()</td>
<td class="summary">
Return information about available network interfaces.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#net.devices">devices</a>&nbsp;()</td>
<td class="summary">
Determine the names of available network interfaces.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#net.host_hints">host_hints</a>&nbsp;()</td>
<td class="summary">
Returns a two-dimensional table of host hints.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#net.ipv4_hints">ipv4_hints</a>&nbsp;()</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>&nbsp;()</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>&nbsp;()</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>&nbsp;(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>&nbsp;()</td>
<td class="summary">
Returns the current kernel routing table entries.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#net.routes6">routes6</a>&nbsp;()</td>
<td class="summary">
Returns the current ipv6 kernel routing table entries.</td>
</tr>
</table>
<br/>
<br/>
<h2><a name="functions"></a>Functions</h2>
<dl class="function">
<dt><a name="net.arptable"></a><strong>arptable</strong>&nbsp;()</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>&nbsp;()</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>&nbsp;()</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>&nbsp;()</dt>
<dd>
Determine the names of available network interfaces.
<h3>Return value:</h3>
Table containing all current interface names
</dd>
<dt><a name="net.host_hints"></a><strong>host_hints</strong>&nbsp;()</dt>
<dd>
Returns a two-dimensional table of host hints.
<h3>Return value:</h3>
Table of table containing known hosts from various sources,
indexed by mac address. Each subtable contains at least one
of the fields "name", "ipv4" or "ipv6".
</dd>
<dt><a name="net.ipv4_hints"></a><strong>ipv4_hints</strong>&nbsp;()</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>&nbsp;()</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>&nbsp;()</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>&nbsp;(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>&nbsp;()</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>&nbsp;()</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>
</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

@@ -0,0 +1,519 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><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/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.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.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">
Get the current process id.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#process.list">list</a>&nbsp;()</td>
<td class="summary">
Retrieve information about currently running processes.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#process.setgroup">setgroup</a>&nbsp;(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>&nbsp;(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>&nbsp;(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.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>
Get the current process id.
<h3>Return value:</h3>
Number containing the current pid
</dd>
<dt><a name="process.list"></a><strong>list</strong>&nbsp;()</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>&nbsp;(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>&nbsp;(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>&nbsp;(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>

View File

@@ -0,0 +1,412 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><strong>luci.sys.user</strong></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.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>&nbsp;(uid)</td>
<td class="summary">
Retrieve user information for given uid.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#user.checkpasswd">checkpasswd</a>&nbsp;(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>&nbsp;(username)</td>
<td class="summary">
Retrieve the current user password hash.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#user.setpasswd">setpasswd</a>&nbsp;(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>&nbsp;(uid)</dt>
<dd>
Retrieve user information 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>&nbsp;(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 whether the passwords are equal
</dd>
<dt><a name="user.getpasswd"></a><strong>getpasswd</strong>&nbsp;(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>&nbsp;(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>

View File

@@ -0,0 +1,280 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><strong>luci.sys.wifi</strong></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.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>&nbsp;(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>&nbsp;(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>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,286 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><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 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>
<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>

View File

@@ -0,0 +1,312 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><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>&nbsp;()</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>&nbsp;(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>&nbsp;()</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>&nbsp;(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>

View File

@@ -0,0 +1,669 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><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>&nbsp;()</td>
<td class="summary">
Close the file descriptor.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#File.fileno">File:fileno</a>&nbsp;()</td>
<td class="summary">
Get the number of the filedescriptor.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#File.lock">File:lock</a>&nbsp;(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>&nbsp;(length)</td>
<td class="summary">
Read from a file descriptor.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#File.seek">File:seek</a>&nbsp;(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>&nbsp;(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>&nbsp;(field)</td>
<td class="summary">
Get file status and attributes.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#File.sync">File:sync</a>&nbsp;(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>&nbsp;()</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>&nbsp;(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>&nbsp;()</dt>
<dd>
Close the file descriptor.
<h3>Return value:</h3>
true
</dd>
<dt><a name="File.fileno"></a><strong>File:fileno</strong>&nbsp;()</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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;()</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>&nbsp;(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>

View File

@@ -0,0 +1,370 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><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 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.
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 omitting
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 omitted for practical 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 omitting 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>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,475 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>

View File

@@ -0,0 +1,571 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><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>&nbsp;()</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>&nbsp;()</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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;()</td>
<td class="summary">
Shut down the TLS connection.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#TLSSocket.write">TLSSocket:write</a>&nbsp;(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>&nbsp;()</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>&nbsp;()</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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;()</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>&nbsp;(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>

View File

@@ -0,0 +1,763 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><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>&nbsp;(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>&nbsp;()</td>
<td class="summary">
Close the descriptor.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#UnifiedIO.copy">UnifiedIO:copy</a>&nbsp;(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>&nbsp;(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>&nbsp;()</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>&nbsp;()</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>&nbsp;()</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>&nbsp;(limit)</td>
<td class="summary">
Create a line-based iterator.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#UnifiedIO.readall">UnifiedIO:readall</a>&nbsp;(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>&nbsp;(close_when_done)</td>
<td class="summary">
Create a sink.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#UnifiedIO.writeall">UnifiedIO:writeall</a>&nbsp;(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>&nbsp;(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 omitted, 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>&nbsp;()</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>&nbsp;(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 omitted, 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 occurred
<li>- reserved for error code -
<li>- reserved for error message -
<li>bytes that were successfully written even if an error occurred
</ol>
</dd>
<dt><a name="UnifiedIO.copyz"></a><strong>UnifiedIO:copyz</strong>&nbsp;(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 omitted, 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 occurred
<li>- reserved for error code -
<li>- reserved for error message -
<li>bytes that were successfully written even if an error occurred
</ol>
</dd>
<dt><a name="UnifiedIO.is_file"></a><strong>UnifiedIO:is_file</strong>&nbsp;()</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>&nbsp;()</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>&nbsp;()</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>&nbsp;(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 omitted, 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>&nbsp;(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 omitted, 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 occurred
<li>- reserved for error code -
<li>- reserved for error message -
<li>data that was successfully read even if an error occurred
</ol>
</dd>
<dt><a name="UnifiedIO.sink"></a><strong>UnifiedIO:sink</strong>&nbsp;(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>&nbsp;(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 occurred
<li>- reserved for error code -
<li>- reserved for error message -
<li>bytes that were successfully written even if an error occurred
</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>

View File

@@ -0,0 +1,423 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><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>&nbsp;(buffer)</td>
<td class="summary">
Base64 decode a given buffer.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#b64encode">b64encode</a>&nbsp;(buffer)</td>
<td class="summary">
Base64 encode a given buffer.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#crc32">crc32</a>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>

View File

@@ -0,0 +1,740 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><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>&nbsp;(oper, shift)</td>
<td class="summary">
Arithmetically right shift a number.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#band">band</a>&nbsp;(oper1, oper2, ...)</td>
<td class="summary">
Bitwise AND several numbers.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#bnot">bnot</a>&nbsp;(oper)</td>
<td class="summary">
Invert given number.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#bor">bor</a>&nbsp;(oper1, oper2, ...)</td>
<td class="summary">
Bitwise OR several numbers.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#bxor">bxor</a>&nbsp;(oper1, oper2, ...)</td>
<td class="summary">
Bitwise XOR several numbers.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#cast">cast</a>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(oper, shift)</td>
<td class="summary">
Left shift a number.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#rshift">rshift</a>&nbsp;(oper, shift)</td>
<td class="summary">
Right shift a number.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set">set</a>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>&nbsp;(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>

View File

@@ -0,0 +1,315 @@
<!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>
<a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
</li>
<li>
<a href="../modules/luci.http.date.html">luci.http.date</a>
</li>
<li>
<a href="../modules/luci.http.mime.html">luci.http.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><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>&nbsp;(algo)</td>
<td class="summary">
Create a hash object.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#nixio.crypto.hmac">hmac</a>&nbsp;(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>&nbsp;(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>&nbsp;(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>

File diff suppressed because it is too large Load Diff

2401
docs/api/modules/nixio.html Normal file

File diff suppressed because it is too large Load Diff

19
docs/i18n.md Normal file
View File

@@ -0,0 +1,19 @@
# General
Translations are saved in the folder po/ for each module and application. You find the reference in po/templates/<package>.pot. The actual translation files can be found at po/[lang]/[package].po .
In order to use the commands below you need to have the _gettext'' utilities (''msgcat'', ''msgfmt'', ''msgmerge_) installed on your system.
# Rebuild po files
If you want to rebuild the translations after you made changes to a package this is an easy way:
./build/i18n-scan.pl applications/[application] > applications/[application]/po/templates/[application_basename].pot
./build/i18n-update.pl applications/[application]/po
Example:
./build/i18n-scan.pl applications/luci-app-firewall > applications/luci-app-firewall/po/templates/firewall.pot
./build/i18n-update.pl applications/luci-app-firewall/po
(note that the directory argument can be omitted for i18n-update.pl to update all apps)
*Note:* Some packages share translation files, in this case you need to scan through all their folders. The first command from above should then be:
./build/i18n-scan.pl applications/[package-1] applications/[package-2] applications/[package-n] > [location of shared template]/[application].pot

2322
docs/jsapi/LuCI.Class.html Normal file

File diff suppressed because it is too large Load Diff

1495
docs/jsapi/LuCI.Headers.html Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

7032
docs/jsapi/LuCI.Network.html Normal file

File diff suppressed because it is too large Load Diff

1878
docs/jsapi/LuCI.Poll.html Normal file

File diff suppressed because it is too large Load Diff

2774
docs/jsapi/LuCI.Request.html Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

2047
docs/jsapi/LuCI.XHR.html Normal file

File diff suppressed because it is too large Load Diff

3878
docs/jsapi/LuCI.dom.html Normal file

File diff suppressed because it is too large Load Diff

2987
docs/jsapi/LuCI.fs.html Normal file

File diff suppressed because it is too large Load Diff

5023
docs/jsapi/LuCI.html Normal file

File diff suppressed because it is too large Load Diff

3225
docs/jsapi/LuCI.rpc.html Normal file

File diff suppressed because it is too large Load Diff

4773
docs/jsapi/LuCI.uci.html Normal file

File diff suppressed because it is too large Load Diff

2083
docs/jsapi/LuCI.view.html Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

350
docs/jsapi/fs.js.html Normal file
View File

@@ -0,0 +1,350 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: fs.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: fs.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>'use strict';
'require rpc';
/**
* @typedef {Object} FileStatEntry
* @memberof LuCI.fs
* @property {string} name - Name of the directory entry
* @property {string} type - Type of the entry, one of `block`, `char`, `directory`, `fifo`, `symlink`, `file`, `socket` or `unknown`
* @property {number} size - Size in bytes
* @property {number} mode - Access permissions
* @property {number} atime - Last access time in seconds since epoch
* @property {number} mtime - Last modification time in seconds since epoch
* @property {number} ctime - Last change time in seconds since epoch
* @property {number} inode - Inode number
* @property {number} uid - Numeric owner id
* @property {number} gid - Numeric group id
*/
/**
* @typedef {Object} FileExecResult
* @memberof LuCI.fs
*
* @property {number} code - The exit code of the invoked command
* @property {string} [stdout] - The stdout produced by the command, if any
* @property {string} [stderr] - The stderr produced by the command, if any
*/
var callFileList, callFileStat, callFileRead, callFileWrite, callFileRemove,
callFileExec, callFileMD5;
callFileList = rpc.declare({
object: 'file',
method: 'list',
params: [ 'path' ]
});
callFileStat = rpc.declare({
object: 'file',
method: 'stat',
params: [ 'path' ]
});
callFileRead = rpc.declare({
object: 'file',
method: 'read',
params: [ 'path' ]
});
callFileWrite = rpc.declare({
object: 'file',
method: 'write',
params: [ 'path', 'data', 'mode' ]
});
callFileRemove = rpc.declare({
object: 'file',
method: 'remove',
params: [ 'path' ]
});
callFileExec = rpc.declare({
object: 'file',
method: 'exec',
params: [ 'command', 'params', 'env' ]
});
callFileMD5 = rpc.declare({
object: 'file',
method: 'md5',
params: [ 'path' ]
});
var rpcErrors = [
null,
'InvalidCommandError',
'InvalidArgumentError',
'MethodNotFoundError',
'NotFoundError',
'NoDataError',
'PermissionError',
'TimeoutError',
'UnsupportedError'
];
function handleRpcReply(expect, rc) {
if (typeof(rc) == 'number' &amp;&amp; rc != 0) {
var e = new Error(rpc.getStatusText(rc)); e.name = rpcErrors[rc] || 'Error';
throw e;
}
if (expect) {
var type = Object.prototype.toString;
for (var key in expect) {
if (rc != null &amp;&amp; key != '')
rc = rc[key];
if (rc == null || type.call(rc) != type.call(expect[key])) {
var e = new Error(_('Unexpected reply data format')); e.name = 'TypeError';
throw e;
}
break;
}
}
return rc;
}
/**
* @class fs
* @memberof LuCI
* @hideconstructor
* @classdesc
*
* Provides high level utilities to wrap file system related RPC calls.
* To import the class in views, use `'require fs'`, to import it in
* external JavaScript, use `L.require("fs").then(...)`.
*/
var FileSystem = L.Class.extend(/** @lends LuCI.fs.prototype */ {
/**
* Obtains a listing of the specified directory.
*
* @param {string} path
* The directory path to list.
*
* @returns {Promise&lt;LuCI.fs.FileStatEntry[]>}
* Returns a promise resolving to an array of stat detail objects or
* rejecting with an error stating the failure reason.
*/
list: function(path) {
return callFileList(path).then(handleRpcReply.bind(this, { entries: [] }));
},
/**
* Return file stat information on the specified path.
*
* @param {string} path
* The filesystem path to stat.
*
* @returns {Promise&lt;LuCI.fs.FileStatEntry>}
* Returns a promise resolving to a stat detail object or
* rejecting with an error stating the failure reason.
*/
stat: function(path) {
return callFileStat(path).then(handleRpcReply.bind(this, { '': {} }));
},
/**
* Read the contents of the given file and return them.
* Note: this function is unsuitable for obtaining binary data.
*
* @param {string} path
* The file path to read.
*
* @returns {Promise&lt;string>}
* Returns a promise resolving to a string containing the file contents or
* rejecting with an error stating the failure reason.
*/
read: function(path) {
return callFileRead(path).then(handleRpcReply.bind(this, { data: '' }));
},
/**
* Write the given data to the specified file path.
* If the specified file path does not exist, it will be created, given
* sufficient permissions.
*
* Note: `data` will be converted to a string using `String(data)` or to
* `''` when it is `null`.
*
* @param {string} path
* The file path to write to.
*
* @param {*} [data]
* The file data to write. If it is null, it will be set to an empty
* string.
*
* @param {number} [mode]
* The permissions to use on file creation. Default is 420 (0644).
*
* @returns {Promise&lt;number>}
* Returns a promise resolving to `0` or rejecting with an error stating
* the failure reason.
*/
write: function(path, data, mode) {
data = (data != null) ? String(data) : '';
mode = (mode != null) ? mode : 420; // 0644
return callFileWrite(path, data, mode).then(handleRpcReply.bind(this, { '': 0 }));
},
/**
* Unlink the given file.
*
* @param {string}
* The file path to remove.
*
* @returns {Promise&lt;number>}
* Returns a promise resolving to `0` or rejecting with an error stating
* the failure reason.
*/
remove: function(path) {
return callFileRemove(path).then(handleRpcReply.bind(this, { '': 0 }));
},
/**
* Execute the specified command, optionally passing params and
* environment variables.
*
* Note: The `command` must be either the path to an executable,
* or a basename without arguments in which case it will be searched
* in $PATH. If specified, the values given in `params` will be passed
* as arguments to the command.
*
* The key/value pairs in the optional `env` table are translated to
* `setenv()` calls prior to running the command.
*
* @param {string} command
* The command to invoke.
*
* @param {string[]} [params]
* The arguments to pass to the command.
*
* @param {Object.&lt;string, string>} [env]
* Environment variables to set.
*
* @returns {Promise&lt;LuCI.fs.FileExecResult>}
* Returns a promise resolving to an object describing the execution
* results or rejecting with an error stating the failure reason.
*/
exec: function(command, params, env) {
if (!Array.isArray(params))
params = null;
if (!L.isObject(env))
env = null;
return callFileExec(command, params, env).then(handleRpcReply.bind(this, { '': {} }));
},
/**
* Read the contents of the given file, trim leading and trailing white
* space and return the trimmed result. In case of errors, return an empty
* string instead.
*
* Note: this function is useful to read single-value files in `/sys`
* or `/proc`.
*
* This function is guaranteed to not reject its promises, on failure,
* an empty string will be returned.
*
* @param {string} path
* The file path to read.
*
* @returns {Promise&lt;string>}
* Returns a promise resolving to the file contents or the empty string
* on failure.
*/
trimmed: function(path) {
return L.resolveDefault(this.read(path), '').then(function(s) {
return s.trim();
});
},
/**
* Read the contents of the given file, split it into lines, trim
* leading and trailing white space of each line and return the
* resulting array.
*
* This function is guaranteed to not reject its promises, on failure,
* an empty array will be returned.
*
* @param {string} path
* The file path to read.
*
* @returns {Promise&lt;string[]>}
* Returns a promise resolving to an array containing the stripped lines
* of the given file or `[]` on failure.
*/
lines: function(path) {
return L.resolveDefault(this.read(path), '').then(function(s) {
var lines = [];
s = s.trim();
if (s != '') {
var l = s.split(/\n/);
for (var i = 0; i &lt; l.length; i++)
lines.push(l[i].trim());
}
return lines;
});
}
});
return FileSystem;
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="LuCI.html">LuCI</a></li><li><a href="LuCI.Class.html">Class</a></li><li><a href="LuCI.dom.html">dom</a></li><li><a href="LuCI.fs.html">fs</a></li><li><a href="LuCI.Headers.html">Headers</a></li><li><a href="LuCI.Network.html">Network</a></li><li><a href="LuCI.Network.Device.html">Device</a></li><li><a href="LuCI.Network.Hosts.html">Hosts</a></li><li><a href="LuCI.Network.Protocol.html">Protocol</a></li><li><a href="LuCI.Network.WifiDevice.html">WifiDevice</a></li><li><a href="LuCI.Network.WifiNetwork.html">WifiNetwork</a></li><li><a href="LuCI.Poll.html">Poll</a></li><li><a href="LuCI.Request.html">Request</a></li><li><a href="LuCI.Request.poll.html">poll</a></li><li><a href="LuCI.Response.html">Response</a></li><li><a href="LuCI.rpc.html">rpc</a></li><li><a href="LuCI.uci.html">uci</a></li><li><a href="LuCI.view.html">view</a></li><li><a href="LuCI.XHR.html">XHR</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Tue Nov 05 2019 09:33:05 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

1131
docs/jsapi/index.html Normal file

File diff suppressed because it is too large Load Diff

3125
docs/jsapi/luci.js.html Normal file

File diff suppressed because it is too large Load Diff

4038
docs/jsapi/network.js.html Normal file

File diff suppressed because it is too large Load Diff

528
docs/jsapi/rpc.js.html Normal file
View File

@@ -0,0 +1,528 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: rpc.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: rpc.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>'use strict';
var rpcRequestID = 1,
rpcSessionID = L.env.sessionid || '00000000000000000000000000000000',
rpcBaseURL = L.url('admin/ubus'),
rpcInterceptorFns = [];
/**
* @class rpc
* @memberof LuCI
* @hideconstructor
* @classdesc
*
* The `LuCI.rpc` class provides high level ubus JSON-RPC abstractions
* and means for listing and invoking remove RPC methods.
*/
return L.Class.extend(/** @lends LuCI.rpc.prototype */ {
/* privates */
call: function(req, cb, nobatch) {
var q = '';
if (Array.isArray(req)) {
if (req.length == 0)
return Promise.resolve([]);
for (var i = 0; i &lt; req.length; i++)
if (req[i].params)
q += '%s%s.%s'.format(
q ? ';' : '/',
req[i].params[1],
req[i].params[2]
);
}
else if (req.params) {
q += '/%s.%s'.format(req.params[1], req.params[2]);
}
return L.Request.post(rpcBaseURL + q, req, {
timeout: (L.env.rpctimeout || 20) * 1000,
nobatch: nobatch,
credentials: true
}).then(cb, cb);
},
parseCallReply: function(req, res) {
var msg = null;
if (res instanceof Error)
return req.reject(res);
try {
if (!res.ok)
L.raise('RPCError', 'RPC call to %s/%s failed with HTTP error %d: %s',
req.object, req.method, res.status, res.statusText || '?');
msg = res.json();
}
catch (e) {
return req.reject(e);
}
/*
* The interceptor args are intentionally swapped.
* Response is passed as first arg to align with Request class interceptors
*/
Promise.all(rpcInterceptorFns.map(function(fn) { return fn(msg, req) }))
.then(this.handleCallReply.bind(this, req, msg))
.catch(req.reject);
},
handleCallReply: function(req, msg) {
var type = Object.prototype.toString,
ret = null;
try {
/* verify message frame */
if (!L.isObject(msg) || msg.jsonrpc != '2.0')
L.raise('RPCError', 'RPC call to %s/%s returned invalid message frame',
req.object, req.method);
/* check error condition */
if (L.isObject(msg.error) &amp;&amp; msg.error.code &amp;&amp; msg.error.message)
L.raise('RPCError', 'RPC call to %s/%s failed with error %d: %s',
req.object, req.method, msg.error.code, msg.error.message || '?');
}
catch (e) {
return req.reject(e);
}
if (!req.object &amp;&amp; !req.method) {
ret = msg.result;
}
else if (Array.isArray(msg.result)) {
ret = (msg.result.length > 1) ? msg.result[1] : msg.result[0];
}
if (req.expect) {
for (var key in req.expect) {
if (ret != null &amp;&amp; key != '')
ret = ret[key];
if (ret == null || type.call(ret) != type.call(req.expect[key]))
ret = req.expect[key];
break;
}
}
/* apply filter */
if (typeof(req.filter) == 'function') {
req.priv[0] = ret;
req.priv[1] = req.params;
ret = req.filter.apply(this, req.priv);
}
req.resolve(ret);
},
/**
* Lists available remote ubus objects or the method signatures of
* specific objects.
*
* This function has two signatures and is sensitive to the number of
* arguments passed to it:
* - `list()` -
* Returns an array containing the names of all remote `ubus` objects
* - `list("objname", ...)`
* Returns method signatures for each given `ubus` object name.
*
* @param {...string} [objectNames]
* If any object names are given, this function will return the method
* signatures of each given object.
*
* @returns {Promise&lt;Array&lt;string>|Object&lt;string, Object&lt;string, Object&lt;string, string>>>>}
* When invoked without arguments, this function will return a promise
* resolving to an array of `ubus` object names. When invoked with one or
* more arguments, a promise resolving to an object describing the method
* signatures of each requested `ubus` object name will be returned.
*/
list: function() {
var msg = {
jsonrpc: '2.0',
id: rpcRequestID++,
method: 'list',
params: arguments.length ? this.varargs(arguments) : undefined
};
return new Promise(L.bind(function(resolveFn, rejectFn) {
/* store request info */
var req = {
resolve: resolveFn,
reject: rejectFn
};
/* call rpc */
this.call(msg, this.parseCallReply.bind(this, req));
}, this));
},
/**
* @typedef {Object} DeclareOptions
* @memberof LuCI.rpc
*
* @property {string} object
* The name of the remote `ubus` object to invoke.
*
* @property {string} method
* The name of the remote `ubus` method to invoke.
*
* @property {string[]} [params]
* Lists the named parameters expected by the remote `ubus` RPC method.
* The arguments passed to the resulting generated method call function
* will be mapped to named parameters in the order they appear in this
* array.
*
* Extraneous parameters passed to the generated function will not be
* sent to the remote procedure but are passed to the
* {@link LuCI.rpc~filterFn filter function} if one is specified.
*
* Examples:
* - `params: [ "foo", "bar" ]` -
* When the resulting call function is invoked with `fn(true, false)`,
* the corresponding args object sent to the remote procedure will be
* `{ foo: true, bar: false }`.
* - `params: [ "test" ], filter: function(reply, args, extra) { ... }` -
* When the resultung generated function is invoked with
* `fn("foo", "bar", "baz")` then `{ "test": "foo" }` will be sent as
* argument to the remote procedure and the filter function will be
* invoked with `filterFn(reply, [ "foo" ], "bar", "baz")`
*
* @property {Object&lt;string,*>} [expect]
* Describes the expected return data structure. The given object is
* supposed to contain a single key selecting the value to use from
* the returned `ubus` reply object. The value of the sole key within
* the `expect` object is used to infer the expected type of the received
* `ubus` reply data.
*
* If the received data does not contain `expect`'s key, or if the
* type of the data differs from the type of the value in the expect
* object, the expect object's value is returned as default instead.
*
* The key in the `expect` object may be an empty string (`''`) in which
* case the entire reply object is selected instead of one of its subkeys.
*
* If the `expect` option is omitted, the received reply will be returned
* as-is, regardless of its format or type.
*
* Examples:
* - `expect: { '': { error: 'Invalid response' } }` -
* This requires the entire `ubus` reply to be a plain JavaScript
* object. If the reply isn't an object but e.g. an array or a numeric
* error code instead, it will get replaced with
* `{ error: 'Invalid response' }` instead.
* - `expect: { results: [] }` -
* This requires the received `ubus` reply to be an object containing
* a key `results` with an array as value. If the received reply does
* not contain such a key, or if `reply.results` points to a non-array
* value, the empty array (`[]`) will be used instead.
* - `expect: { success: false }` -
* This requires the received `ubus` reply to be an object containing
* a key `success` with a boolean value. If the reply does not contain
* `success` or if `reply.success` is not a boolean value, `false` will
* be returned as default instead.
*
* @property {LuCI.rpc~filterFn} [filter]
* Specfies an optional filter function which is invoked to transform the
* received reply data before it is returned to the caller.
*
*/
/**
* The filter function is invoked to transform a received `ubus` RPC call
* reply before returning it to the caller.
*
* @callback LuCI.rpc~filterFn
*
* @param {*} data
* The received `ubus` reply data or a subset of it as described in the
* `expect` option of the RPC call declaration. In case of remote call
* errors, `data` is numeric `ubus` error code instead.
*
* @param {Array&lt;*>} args
* The arguments the RPC method has been invoked with.
*
* @param {...*} extraArgs
* All extraneous arguments passed to the RPC method exceeding the number
* of arguments describes in the RPC call declaration.
*
* @return {*}
* The return value of the filter function will be returned to the caller
* of the RPC method as-is.
*/
/**
* The generated invocation function is returned by
* {@link LuCI.rpc#declare rpc.declare()} and encapsulates a single
* RPC method call.
*
* Calling this function will execute a remote `ubus` HTTP call request
* using the arguments passed to it as arguments and return a promise
* resolving to the received reply values.
*
* @callback LuCI.rpc~invokeFn
*
* @param {...*} params
* The parameters to pass to the remote procedure call. The given
* positional arguments will be named to named RPC parameters according
* to the names specified in the `params` array of the method declaration.
*
* Any additional parameters exceeding the amount of arguments in the
* `params` declaration are passed as private extra arguments to the
* declared filter function.
*
* @return {Promise&lt;*>}
* Returns a promise resolving to the result data of the remote `ubus`
* RPC method invocation, optionally substituted and filtered according
* to the `expect` and `filter` declarations.
*/
/**
* Describes a remote RPC call procedure and returns a function
* implementing it.
*
* @param {LuCI.rpc.DeclareOptions} options
* If any object names are given, this function will return the method
* signatures of each given object.
*
* @returns {LuCI.rpc~invokeFn}
* Returns a new function implementing the method call described in
* `options`.
*/
declare: function(options) {
return Function.prototype.bind.call(function(rpc, options) {
var args = this.varargs(arguments, 2);
return new Promise(function(resolveFn, rejectFn) {
/* build parameter object */
var p_off = 0;
var params = { };
if (Array.isArray(options.params))
for (p_off = 0; p_off &lt; options.params.length; p_off++)
params[options.params[p_off]] = args[p_off];
/* all remaining arguments are private args */
var priv = [ undefined, undefined ];
for (; p_off &lt; args.length; p_off++)
priv.push(args[p_off]);
/* store request info */
var req = {
expect: options.expect,
filter: options.filter,
resolve: resolveFn,
reject: rejectFn,
params: params,
priv: priv,
object: options.object,
method: options.method
};
/* build message object */
var msg = {
jsonrpc: '2.0',
id: rpcRequestID++,
method: 'call',
params: [
rpcSessionID,
options.object,
options.method,
params
]
};
/* call rpc */
rpc.call(msg, rpc.parseCallReply.bind(rpc, req), options.nobatch);
});
}, this, this, options);
},
/**
* Returns the current RPC session id.
*
* @returns {string}
* Returns the 32 byte session ID string used for authenticating remote
* requests.
*/
getSessionID: function() {
return rpcSessionID;
},
/**
* Set the RPC session id to use.
*
* @param {string} sid
* Sets the 32 byte session ID string used for authenticating remote
* requests.
*/
setSessionID: function(sid) {
rpcSessionID = sid;
},
/**
* Returns the current RPC base URL.
*
* @returns {string}
* Returns the RPC URL endpoint to issue requests against.
*/
getBaseURL: function() {
return rpcBaseURL;
},
/**
* Set the RPC base URL to use.
*
* @param {string} sid
* Sets the RPC URL endpoint to issue requests against.
*/
setBaseURL: function(url) {
rpcBaseURL = url;
},
/**
* Translates a numeric `ubus` error code into a human readable
* description.
*
* @param {number} statusCode
* The numeric status code.
*
* @returns {string}
* Returns the textual description of the code.
*/
getStatusText: function(statusCode) {
switch (statusCode) {
case 0: return _('Command OK');
case 1: return _('Invalid command');
case 2: return _('Invalid argument');
case 3: return _('Method not found');
case 4: return _('Resource not found');
case 5: return _('No data received');
case 6: return _('Permission denied');
case 7: return _('Request timeout');
case 8: return _('Not supported');
case 9: return _('Unspecified error');
case 10: return _('Connection lost');
default: return _('Unknown error code');
}
},
/**
* Registered interceptor functions are invoked before the standard reply
* parsing and handling logic.
*
* By returning rejected promises, interceptor functions can cause the
* invocation function to fail, regardless of the received reply.
*
* Interceptors may also modify their message argument in-place to
* rewrite received replies before they're processed by the standard
* response handling code.
*
* A common use case for such functions is to detect failing RPC replies
* due to expired authentication in order to trigger a new login.
*
* @callback LuCI.rpc~interceptorFn
*
* @param {*} msg
* The unprocessed, JSON decoded remote RPC method call reply.
*
* Since interceptors run before the standard parsing logic, the reply
* data is not verified for correctness or filtered according to
* `expect` and `filter` specifications in the declarations.
*
* @param {Object} req
* The related request object which is an extended variant of the
* declaration object, allowing access to internals of the invocation
* function such as `filter`, `expect` or `params` values.
*
* @return {Promise&lt;*>|*}
* Interceptor functions may return a promise to defer response
* processing until some delayed work completed. Any values the returned
* promise resolves to are ignored.
*
* When the returned promise rejects with an error, the invocation
* function will fail too, forwarding the error to the caller.
*/
/**
* Registers a new interceptor function.
*
* @param {LuCI.rpc~interceptorFn} interceptorFn
* The inteceptor function to register.
*
* @returns {LuCI.rpc~interceptorFn}
* Returns the given function value.
*/
addInterceptor: function(interceptorFn) {
if (typeof(interceptorFn) == 'function')
rpcInterceptorFns.push(interceptorFn);
return interceptorFn;
},
/**
* Removes a registered interceptor function.
*
* @param {LuCI.rpc~interceptorFn} interceptorFn
* The inteceptor function to remove.
*
* @returns {boolean}
* Returns `true` if the given function has been removed or `false`
* if it has not been found.
*/
removeInterceptor: function(interceptorFn) {
var oldlen = rpcInterceptorFns.length, i = oldlen;
while (i--)
if (rpcInterceptorFns[i] === interceptorFn)
rpcInterceptorFns.splice(i, 1);
return (rpcInterceptorFns.length &lt; oldlen);
}
});
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="LuCI.html">LuCI</a></li><li><a href="LuCI.Class.html">Class</a></li><li><a href="LuCI.dom.html">dom</a></li><li><a href="LuCI.fs.html">fs</a></li><li><a href="LuCI.Headers.html">Headers</a></li><li><a href="LuCI.Network.html">Network</a></li><li><a href="LuCI.Network.Device.html">Device</a></li><li><a href="LuCI.Network.Hosts.html">Hosts</a></li><li><a href="LuCI.Network.Protocol.html">Protocol</a></li><li><a href="LuCI.Network.WifiDevice.html">WifiDevice</a></li><li><a href="LuCI.Network.WifiNetwork.html">WifiNetwork</a></li><li><a href="LuCI.Poll.html">Poll</a></li><li><a href="LuCI.Request.html">Request</a></li><li><a href="LuCI.Request.poll.html">poll</a></li><li><a href="LuCI.Response.html">Response</a></li><li><a href="LuCI.rpc.html">rpc</a></li><li><a href="LuCI.uci.html">uci</a></li><li><a href="LuCI.view.html">view</a></li><li><a href="LuCI.XHR.html">XHR</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Tue Nov 05 2019 09:33:05 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -0,0 +1,25 @@
/*global document */
(() => {
const source = document.getElementsByClassName('prettyprint source linenums');
let i = 0;
let lineNumber = 0;
let lineId;
let lines;
let totalLines;
let anchorHash;
if (source && source[0]) {
anchorHash = document.location.hash.substring(1);
lines = source[0].getElementsByTagName('li');
totalLines = lines.length;
for (; i < totalLines; i++) {
lineNumber++;
lineId = `line${lineNumber}`;
lines[i].id = lineId;
if (lineId === anchorHash) {
lines[i].className += ' selected';
}
}
}
})();

View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,2 @@
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com",
/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]);

View File

@@ -0,0 +1,28 @@
var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a=
[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c<i;++c){var j=f[c];if(/\\[bdsw]/i.test(j))a.push(j);else{var j=m(j),d;c+2<i&&"-"===f[c+1]?(d=m(f[c+2]),c+=2):d=j;b.push([j,d]);d<65||j>122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;c<b.length;++c)i=b[c],i[0]<=j[1]+1?j[1]=Math.max(j[1],i[1]):f.push(j=i);b=["["];o&&b.push("^");b.push.apply(b,a);for(c=0;c<
f.length;++c)i=f[c],b.push(e(i[0])),i[1]>i[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c<b;++c){var j=f[c];j==="("?++i:"\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(d[j]=-1)}for(c=1;c<d.length;++c)-1===d[c]&&(d[c]=++t);for(i=c=0;c<b;++c)j=f[c],j==="("?(++i,d[i]===void 0&&(f[c]="(?:")):"\\"===j.charAt(0)&&
(j=+j.substring(1))&&j<=i&&(f[c]="\\"+d[i]);for(i=c=0;c<b;++c)"^"===f[c]&&"^"!==f[c+1]&&(f[c]="");if(a.ignoreCase&&s)for(c=0;c<b;++c)j=f[c],a=j.charAt(0),j.length>=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p<d;++p){var g=a[p];if(g.ignoreCase)l=!0;else if(/[a-z]/i.test(g.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){s=!0;l=!1;break}}for(var r=
{b:8,t:9,n:10,v:11,f:12,r:13},n=[],p=0,d=a.length;p<d;++p){g=a[p];if(g.global||g.multiline)throw Error(""+g);n.push("(?:"+y(g)+")")}return RegExp(n.join("|"),l?"gi":"g")}function M(a){function m(a){switch(a.nodeType){case 1:if(e.test(a.className))break;for(var g=a.firstChild;g;g=g.nextSibling)m(g);g=a.nodeName;if("BR"===g||"LI"===g)h[s]="\n",t[s<<1]=y++,t[s++<<1|1]=a;break;case 3:case 4:g=a.nodeValue,g.length&&(g=p?g.replace(/\r\n?/g,"\n"):g.replace(/[\t\n\r ]+/g," "),h[s]=g,t[s<<1]=y,y+=g.length,
t[s++<<1|1]=a)}}var e=/(?:^|\s)nocode(?:\s|$)/,h=[],y=0,t=[],s=0,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=document.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);m(a);return{a:h.join("").replace(/\n$/,""),c:t}}function B(a,m,e,h){m&&(a={a:m,d:a},e(a),h.push.apply(h,a.e))}function x(a,m){function e(a){for(var l=a.d,p=[l,"pln"],d=0,g=a.a.match(y)||[],r={},n=0,z=g.length;n<z;++n){var f=g[n],b=r[f],o=void 0,c;if(typeof b===
"string")c=!1;else{var i=h[f.charAt(0)];if(i)o=f.match(i[1]),b=i[0];else{for(c=0;c<t;++c)if(i=m[c],o=f.match(i[1])){b=i[0];break}o||(b="pln")}if((c=b.length>=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),
l=[],p={},d=0,g=e.length;d<g;++d){var r=e[d],n=r[3];if(n)for(var k=n.length;--k>=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/,
q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g,
"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a),
a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}
for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g<d.length;++g)e(d[g]);m===(m|0)&&d[0].setAttribute("value",
m);var r=s.createElement("OL");r.className="linenums";for(var n=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className="L"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode("\xa0")),r.appendChild(l);a.appendChild(r)}function k(a,m){for(var e=m.length;--e>=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*</.test(m)?"default-markup":"default-code";return A[a]}function E(a){var m=
a.g;try{var e=M(a.h),h=e.a;a.a=h;a.c=e.c;a.d=0;C(m,h)(a);var k=/\bMSIE\b/.test(navigator.userAgent),m=/\n/g,t=a.a,s=t.length,e=0,l=a.c,p=l.length,h=0,d=a.e,g=d.length,a=0;d[g]=s;var r,n;for(n=r=0;n<g;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;g=r;for(n=r=0;n<g;){for(var z=d[n],f=d[n+1],b=n+2;b+2<=g&&d[b+1]===f;)b+=2;d[r++]=z;d[r++]=f;n=b}for(d.length=r;h<p;){var o=l[h+2]||s,c=d[a+2]||s,b=Math.min(o,c),i=l[h+1],j;if(i.nodeType!==1&&(j=t.substring(e,b))){k&&(j=j.replace(m,"\r"));i.nodeValue=
j;var u=i.ownerDocument,v=u.createElement("SPAN");v.className=d[a+1];var x=i.parentNode;x.replaceChild(v,i);v.appendChild(i);e<o&&(l[h+1]=i=u.createTextNode(t.substring(b,o)),x.insertBefore(i,v.nextSibling))}e=b;e>=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],
H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+
I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),
["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",
/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),
["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",
hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p<h.length&&l.now()<e;p++){var n=h[p],k=n.className;if(k.indexOf("prettyprint")>=0){var k=k.match(g),f,b;if(b=
!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p<h.length?setTimeout(m,
250):a&&a()}for(var e=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],h=[],k=0;k<e.length;++k)for(var t=0,s=e[k].length;t<s;++t)h.push(e[k][t]);var e=q,l=Date;l.now||(l={now:function(){return+new Date}});var p=0,d,g=/\blang(?:uage)?-([\w.]+)(?!\S)/;m()};window.PR={createSimpleLexer:x,registerLangHandler:k,sourceDecorator:u,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",
PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}})();

View File

@@ -0,0 +1,358 @@
@font-face {
font-family: 'Open Sans';
font-weight: normal;
font-style: normal;
src: url('../fonts/OpenSans-Regular-webfont.eot');
src:
local('Open Sans'),
local('OpenSans'),
url('../fonts/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/OpenSans-Regular-webfont.woff') format('woff'),
url('../fonts/OpenSans-Regular-webfont.svg#open_sansregular') format('svg');
}
@font-face {
font-family: 'Open Sans Light';
font-weight: normal;
font-style: normal;
src: url('../fonts/OpenSans-Light-webfont.eot');
src:
local('Open Sans Light'),
local('OpenSans Light'),
url('../fonts/OpenSans-Light-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/OpenSans-Light-webfont.woff') format('woff'),
url('../fonts/OpenSans-Light-webfont.svg#open_sanslight') format('svg');
}
html
{
overflow: auto;
background-color: #fff;
font-size: 14px;
}
body
{
font-family: 'Open Sans', sans-serif;
line-height: 1.5;
color: #4d4e53;
background-color: white;
}
a, a:visited, a:active {
color: #0095dd;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
header
{
display: block;
padding: 0px 4px;
}
tt, code, kbd, samp {
font-family: Consolas, Monaco, 'Andale Mono', monospace;
}
.class-description {
font-size: 130%;
line-height: 140%;
margin-bottom: 1em;
margin-top: 1em;
}
.class-description:empty {
margin: 0;
}
#main {
float: left;
width: 70%;
}
article dl {
margin-bottom: 40px;
}
article img {
max-width: 100%;
}
section
{
display: block;
background-color: #fff;
padding: 12px 24px;
border-bottom: 1px solid #ccc;
margin-right: 30px;
}
.variation {
display: none;
}
.signature-attributes {
font-size: 60%;
color: #aaa;
font-style: italic;
font-weight: lighter;
}
nav
{
display: block;
float: right;
margin-top: 28px;
width: 30%;
box-sizing: border-box;
border-left: 1px solid #ccc;
padding-left: 16px;
}
nav ul {
font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif;
font-size: 100%;
line-height: 17px;
padding: 0;
margin: 0;
list-style-type: none;
}
nav ul a, nav ul a:visited, nav ul a:active {
font-family: Consolas, Monaco, 'Andale Mono', monospace;
line-height: 18px;
color: #4D4E53;
}
nav h3 {
margin-top: 12px;
}
nav li {
margin-top: 6px;
}
footer {
display: block;
padding: 6px;
margin-top: 12px;
font-style: italic;
font-size: 90%;
}
h1, h2, h3, h4 {
font-weight: 200;
margin: 0;
}
h1
{
font-family: 'Open Sans Light', sans-serif;
font-size: 48px;
letter-spacing: -2px;
margin: 12px 24px 20px;
}
h2, h3.subsection-title
{
font-size: 30px;
font-weight: 700;
letter-spacing: -1px;
margin-bottom: 12px;
}
h3
{
font-size: 24px;
letter-spacing: -0.5px;
margin-bottom: 12px;
}
h4
{
font-size: 18px;
letter-spacing: -0.33px;
margin-bottom: 12px;
color: #4d4e53;
}
h5, .container-overview .subsection-title
{
font-size: 120%;
font-weight: bold;
letter-spacing: -0.01em;
margin: 8px 0 3px 0;
}
h6
{
font-size: 100%;
letter-spacing: -0.01em;
margin: 6px 0 3px 0;
font-style: italic;
}
table
{
border-spacing: 0;
border: 0;
border-collapse: collapse;
}
td, th
{
border: 1px solid #ddd;
margin: 0px;
text-align: left;
vertical-align: top;
padding: 4px 6px;
display: table-cell;
}
thead tr
{
background-color: #ddd;
font-weight: bold;
}
th { border-right: 1px solid #aaa; }
tr > th:last-child { border-right: 1px solid #ddd; }
.ancestors, .attribs { color: #999; }
.ancestors a, .attribs a
{
color: #999 !important;
text-decoration: none;
}
.clear
{
clear: both;
}
.important
{
font-weight: bold;
color: #950B02;
}
.yes-def {
text-indent: -1000px;
}
.type-signature {
color: #aaa;
}
.name, .signature {
font-family: Consolas, Monaco, 'Andale Mono', monospace;
}
.details { margin-top: 14px; border-left: 2px solid #DDD; }
.details dt { width: 120px; float: left; padding-left: 10px; padding-top: 6px; }
.details dd { margin-left: 70px; }
.details ul { margin: 0; }
.details ul { list-style-type: none; }
.details li { margin-left: 30px; padding-top: 6px; }
.details pre.prettyprint { margin: 0 }
.details .object-value { padding-top: 0; }
.description {
margin-bottom: 1em;
margin-top: 1em;
}
.code-caption
{
font-style: italic;
font-size: 107%;
margin: 0;
}
.source
{
border: 1px solid #ddd;
width: 80%;
overflow: auto;
}
.prettyprint.source {
width: inherit;
}
.source code
{
font-size: 100%;
line-height: 18px;
display: block;
padding: 4px 12px;
margin: 0;
background-color: #fff;
color: #4D4E53;
}
.prettyprint code span.line
{
display: inline-block;
}
.prettyprint.linenums
{
padding-left: 70px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.prettyprint.linenums ol
{
padding-left: 0;
}
.prettyprint.linenums li
{
border-left: 3px #ddd solid;
}
.prettyprint.linenums li.selected,
.prettyprint.linenums li.selected *
{
background-color: lightyellow;
}
.prettyprint.linenums li *
{
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
}
.params .name, .props .name, .name code {
color: #4D4E53;
font-family: Consolas, Monaco, 'Andale Mono', monospace;
font-size: 100%;
}
.params td.description > p:first-child,
.props td.description > p:first-child
{
margin-top: 0;
padding-top: 0;
}
.params td.description > p:last-child,
.props td.description > p:last-child
{
margin-bottom: 0;
padding-bottom: 0;
}
.disabled {
color: #454545;
}

View File

@@ -0,0 +1,111 @@
/* JSDoc prettify.js theme */
/* plain text */
.pln {
color: #000000;
font-weight: normal;
font-style: normal;
}
/* string content */
.str {
color: #006400;
font-weight: normal;
font-style: normal;
}
/* a keyword */
.kwd {
color: #000000;
font-weight: bold;
font-style: normal;
}
/* a comment */
.com {
font-weight: normal;
font-style: italic;
}
/* a type name */
.typ {
color: #000000;
font-weight: normal;
font-style: normal;
}
/* a literal value */
.lit {
color: #006400;
font-weight: normal;
font-style: normal;
}
/* punctuation */
.pun {
color: #000000;
font-weight: bold;
font-style: normal;
}
/* lisp open bracket */
.opn {
color: #000000;
font-weight: bold;
font-style: normal;
}
/* lisp close bracket */
.clo {
color: #000000;
font-weight: bold;
font-style: normal;
}
/* a markup tag name */
.tag {
color: #006400;
font-weight: normal;
font-style: normal;
}
/* a markup attribute name */
.atn {
color: #006400;
font-weight: normal;
font-style: normal;
}
/* a markup attribute value */
.atv {
color: #006400;
font-weight: normal;
font-style: normal;
}
/* a declaration */
.dec {
color: #000000;
font-weight: bold;
font-style: normal;
}
/* a variable name */
.var {
color: #000000;
font-weight: normal;
font-style: normal;
}
/* a function name */
.fun {
color: #000000;
font-weight: bold;
font-style: normal;
}
/* Specify class=linenums on a pre to get line numbering */
ol.linenums {
margin-top: 0;
margin-bottom: 0;
}

View File

@@ -0,0 +1,132 @@
/* Tomorrow Theme */
/* Original theme - https://github.com/chriskempson/tomorrow-theme */
/* Pretty printing styles. Used with prettify.js. */
/* SPAN elements with the classes below are added by prettyprint. */
/* plain text */
.pln {
color: #4d4d4c; }
@media screen {
/* string content */
.str {
color: #718c00; }
/* a keyword */
.kwd {
color: #8959a8; }
/* a comment */
.com {
color: #8e908c; }
/* a type name */
.typ {
color: #4271ae; }
/* a literal value */
.lit {
color: #f5871f; }
/* punctuation */
.pun {
color: #4d4d4c; }
/* lisp open bracket */
.opn {
color: #4d4d4c; }
/* lisp close bracket */
.clo {
color: #4d4d4c; }
/* a markup tag name */
.tag {
color: #c82829; }
/* a markup attribute name */
.atn {
color: #f5871f; }
/* a markup attribute value */
.atv {
color: #3e999f; }
/* a declaration */
.dec {
color: #f5871f; }
/* a variable name */
.var {
color: #c82829; }
/* a function name */
.fun {
color: #4271ae; } }
/* Use higher contrast and text-weight for printable form. */
@media print, projection {
.str {
color: #060; }
.kwd {
color: #006;
font-weight: bold; }
.com {
color: #600;
font-style: italic; }
.typ {
color: #404;
font-weight: bold; }
.lit {
color: #044; }
.pun, .opn, .clo {
color: #440; }
.tag {
color: #006;
font-weight: bold; }
.atn {
color: #404; }
.atv {
color: #060; } }
/* Style */
/*
pre.prettyprint {
background: white;
font-family: Menlo, Monaco, Consolas, monospace;
font-size: 12px;
line-height: 1.5;
border: 1px solid #ccc;
padding: 10px; }
*/
/* Specify class=linenums on a pre to get line numbering */
ol.linenums {
margin-top: 0;
margin-bottom: 0; }
/* IE indents via margin-left */
li.L0,
li.L1,
li.L2,
li.L3,
li.L4,
li.L5,
li.L6,
li.L7,
li.L8,
li.L9 {
/* */ }
/* Alternate shading for lines */
li.L1,
li.L3,
li.L5,
li.L7,
li.L9 {
/* */ }

994
docs/jsapi/uci.js.html Normal file
View File

@@ -0,0 +1,994 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: uci.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: uci.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>'use strict';
'require rpc';
/**
* @class uci
* @memberof LuCI
* @hideconstructor
* @classdesc
*
* The `LuCI.uci` class utilizes {@link LuCI.rpc} to declare low level
* remote UCI `ubus` procedures and implements a local caching and data
* manipulation layer on top to allow for synchroneous operations on
* UCI configuration data.
*/
return L.Class.extend(/** @lends LuCI.uci.prototype */ {
__init__: function() {
this.state = {
newidx: 0,
values: { },
creates: { },
changes: { },
deletes: { },
reorder: { }
};
this.loaded = {};
},
callLoad: rpc.declare({
object: 'uci',
method: 'get',
params: [ 'config' ],
expect: { values: { } }
}),
callOrder: rpc.declare({
object: 'uci',
method: 'order',
params: [ 'config', 'sections' ]
}),
callAdd: rpc.declare({
object: 'uci',
method: 'add',
params: [ 'config', 'type', 'name', 'values' ],
expect: { section: '' }
}),
callSet: rpc.declare({
object: 'uci',
method: 'set',
params: [ 'config', 'section', 'values' ]
}),
callDelete: rpc.declare({
object: 'uci',
method: 'delete',
params: [ 'config', 'section', 'options' ]
}),
callApply: rpc.declare({
object: 'uci',
method: 'apply',
params: [ 'timeout', 'rollback' ]
}),
callConfirm: rpc.declare({
object: 'uci',
method: 'confirm'
}),
/**
* Generates a new, unique section ID for the given configuration.
*
* Note that the generated ID is temporary, it will get replaced by an
* identifier in the form `cfgXXXXXX` once the configuration is saved
* by the remote `ubus` UCI api.
*
* @param {string} config
* The configuration to generate the new section ID for.
*
* @returns {string}
* A newly generated, unique section ID in the form `newXXXXXX`
* where `X` denotes a hexadecimal digit.
*/
createSID: function(conf) {
var v = this.state.values,
n = this.state.creates,
sid;
do {
sid = "new%06x".format(Math.random() * 0xFFFFFF);
} while ((n[conf] &amp;&amp; n[conf][sid]) || (v[conf] &amp;&amp; v[conf][sid]));
return sid;
},
/**
* Resolves a given section ID in extended notation to the internal
* section ID value.
*
* @param {string} config
* The configuration to resolve the section ID for.
*
* @param {string} sid
* The section ID to resolve. If the ID is in the form `@typename[#]`,
* it will get resolved to an internal anonymous ID in the forms
* `cfgXXXXXX`/`newXXXXXX` or to the name of a section in case it points
* to a named section. When the given ID is not in extended notation,
* it will be returned as-is.
*
* @returns {string|null}
* Returns the resolved section ID or the original given ID if it was
* not in extended notation. Returns `null` when an extended ID could
* not be resolved to existing section ID.
*/
resolveSID: function(conf, sid) {
if (typeof(sid) != 'string')
return sid;
var m = /^@([a-zA-Z0-9_-]+)\[(-?[0-9]+)\]$/.exec(sid);
if (m) {
var type = m[1],
pos = +m[2],
sections = this.sections(conf, type),
section = sections[pos >= 0 ? pos : sections.length + pos];
return section ? section['.name'] : null;
}
return sid;
},
/* private */
reorderSections: function() {
var v = this.state.values,
n = this.state.creates,
r = this.state.reorder,
tasks = [];
if (Object.keys(r).length === 0)
return Promise.resolve();
/*
gather all created and existing sections, sort them according
to their index value and issue an uci order call
*/
for (var c in r) {
var o = [ ];
if (n[c])
for (var s in n[c])
o.push(n[c][s]);
for (var s in v[c])
o.push(v[c][s]);
if (o.length > 0) {
o.sort(function(a, b) {
return (a['.index'] - b['.index']);
});
var sids = [ ];
for (var i = 0; i &lt; o.length; i++)
sids.push(o[i]['.name']);
tasks.push(this.callOrder(c, sids));
}
}
this.state.reorder = { };
return Promise.all(tasks);
},
/* private */
loadPackage: function(packageName) {
if (this.loaded[packageName] == null)
return (this.loaded[packageName] = this.callLoad(packageName));
return Promise.resolve(this.loaded[packageName]);
},
/**
* Loads the given UCI configurations from the remote `ubus` api.
*
* Loaded configurations are cached and only loaded once. Subsequent
* load operations of the same configurations will return the cached
* data.
*
* To force reloading a configuration, it has to be unloaded with
* {@link LuCI.uci#unload uci.unload()} first.
*
* @param {string|string[]} config
* The name of the configuration or an array of configuration
* names to load.
*
* @returns {Promise&lt;string[]>}
* Returns a promise resolving to the names of the configurations
* that have been successfully loaded.
*/
load: function(packages) {
var self = this,
pkgs = [ ],
tasks = [];
if (!Array.isArray(packages))
packages = [ packages ];
for (var i = 0; i &lt; packages.length; i++)
if (!self.state.values[packages[i]]) {
pkgs.push(packages[i]);
tasks.push(self.loadPackage(packages[i]));
}
return Promise.all(tasks).then(function(responses) {
for (var i = 0; i &lt; responses.length; i++)
self.state.values[pkgs[i]] = responses[i];
if (responses.length)
document.dispatchEvent(new CustomEvent('uci-loaded'));
return pkgs;
});
},
/**
* Unloads the given UCI configurations from the local cache.
*
* @param {string|string[]} config
* The name of the configuration or an array of configuration
* names to unload.
*/
unload: function(packages) {
if (!Array.isArray(packages))
packages = [ packages ];
for (var i = 0; i &lt; packages.length; i++) {
delete this.state.values[packages[i]];
delete this.state.creates[packages[i]];
delete this.state.changes[packages[i]];
delete this.state.deletes[packages[i]];
delete this.loaded[packages[i]];
}
},
/**
* Adds a new section of the given type to the given configuration,
* optionally named according to the given name.
*
* @param {string} config
* The name of the configuration to add the section to.
*
* @param {string} type
* The type of the section to add.
*
* @param {string} [name]
* The name of the section to add. If the name is omitted, an anonymous
* section will be added instead.
*
* @returns {string}
* Returns the section ID of the newly added section which is equivalent
* to the given name for non-anonymous sections.
*/
add: function(conf, type, name) {
var n = this.state.creates,
sid = name || this.createSID(conf);
if (!n[conf])
n[conf] = { };
n[conf][sid] = {
'.type': type,
'.name': sid,
'.create': name,
'.anonymous': !name,
'.index': 1000 + this.state.newidx++
};
return sid;
},
/**
* Removes the section with the given ID from the given configuration.
*
* @param {string} config
* The name of the configuration to remove the section from.
*
* @param {string} sid
* The ID of the section to remove.
*/
remove: function(conf, sid) {
var n = this.state.creates,
c = this.state.changes,
d = this.state.deletes;
/* requested deletion of a just created section */
if (n[conf] &amp;&amp; n[conf][sid]) {
delete n[conf][sid];
}
else {
if (c[conf])
delete c[conf][sid];
if (!d[conf])
d[conf] = { };
d[conf][sid] = true;
}
},
/**
* A section object represents the options and their corresponding values
* enclosed within a configuration section, as well as some additional
* meta data such as sort indexes and internal ID.
*
* Any internal metadata fields are prefixed with a dot which is isn't
* an allowed character for normal option names.
*
* @typedef {Object&lt;string, boolean|number|string|string[]>} SectionObject
* @memberof LuCI.uci
*
* @property {boolean} .anonymous
* The `.anonymous` property specifies whether the configuration is
* anonymous (`true`) or named (`false`).
*
* @property {number} .index
* The `.index` property specifes the sort order of the section.
*
* @property {string} .name
* The `.name` property holds the name of the section object. It may be
* either an anonymous ID in the form `cfgXXXXXX` or `newXXXXXX` with `X`
* being a hexadecimal digit or a string holding the name of the section.
*
* @property {string} .type
* The `.type` property contains the type of the corresponding uci
* section.
*
* @property {string|string[]} *
* A section object may contain an arbitrary number of further properties
* representing the uci option enclosed in the section.
*
* All option property names will be in the form `[A-Za-z0-9_]+` and
* either contain a string value or an array of strings, in case the
* underlying option is an UCI list.
*/
/**
* The sections callback is invoked for each section found within
* the given configuration and receives the section object and its
* associated name as arguments.
*
* @callback LuCI.uci~sectionsFn
*
* @param {LuCI.uci.SectionObject} section
* The section object.
*
* @param {string} sid
* The name or ID of the section.
*/
/**
* Enumerates the sections of the given configuration, optionally
* filtered by type.
*
* @param {string} config
* The name of the configuration to enumerate the sections for.
*
* @param {string} [type]
* Enumerate only sections of the given type. If omitted, enumerate
* all sections.
*
* @param {LuCI.uci~sectionsFn} [cb]
* An optional callback to invoke for each enumerated section.
*
* @returns {Array&lt;LuCI.uci.SectionObject>}
* Returns a sorted array of the section objects within the given
* configuration, filtered by type of a type has been specified.
*/
sections: function(conf, type, cb) {
var sa = [ ],
v = this.state.values[conf],
n = this.state.creates[conf],
c = this.state.changes[conf],
d = this.state.deletes[conf];
if (!v)
return sa;
for (var s in v)
if (!d || d[s] !== true)
if (!type || v[s]['.type'] == type)
sa.push(Object.assign({ }, v[s], c ? c[s] : undefined));
if (n)
for (var s in n)
if (!type || n[s]['.type'] == type)
sa.push(Object.assign({ }, n[s]));
sa.sort(function(a, b) {
return a['.index'] - b['.index'];
});
for (var i = 0; i &lt; sa.length; i++)
sa[i]['.index'] = i;
if (typeof(cb) == 'function')
for (var i = 0; i &lt; sa.length; i++)
cb.call(this, sa[i], sa[i]['.name']);
return sa;
},
/**
* Gets the value of the given option within the specified section
* of the given configuration or the entire section object if the
* option name is omitted.
*
* @param {string} config
* The name of the configuration to read the value from.
*
* @param {string} sid
* The name or ID of the section to read.
*
* @param {string} [option]
* The option name to read the value from. If the option name is
* omitted or `null`, the entire section is returned instead.
*
* @returns {null|string|string[]|LuCI.uci.SectionObject}
* - Returns a string containing the option value in case of a
* plain UCI option.
* - Returns an array of strings containing the option values in
* case of `option` pointing to an UCI list.
* - Returns a {@link LuCI.uci.SectionObject section object} if
* the `option` argument has been omitted or is `null`.
* - Returns `null` if the config, section or option has not been
* found or if the corresponding configuration is not loaded.
*/
get: function(conf, sid, opt) {
var v = this.state.values,
n = this.state.creates,
c = this.state.changes,
d = this.state.deletes;
sid = this.resolveSID(conf, sid);
if (sid == null)
return null;
/* requested option in a just created section */
if (n[conf] &amp;&amp; n[conf][sid]) {
if (!n[conf])
return undefined;
if (opt == null)
return n[conf][sid];
return n[conf][sid][opt];
}
/* requested an option value */
if (opt != null) {
/* check whether option was deleted */
if (d[conf] &amp;&amp; d[conf][sid]) {
if (d[conf][sid] === true)
return undefined;
for (var i = 0; i &lt; d[conf][sid].length; i++)
if (d[conf][sid][i] == opt)
return undefined;
}
/* check whether option was changed */
if (c[conf] &amp;&amp; c[conf][sid] &amp;&amp; c[conf][sid][opt] != null)
return c[conf][sid][opt];
/* return base value */
if (v[conf] &amp;&amp; v[conf][sid])
return v[conf][sid][opt];
return undefined;
}
/* requested an entire section */
if (v[conf])
return v[conf][sid];
return undefined;
},
/**
* Sets the value of the given option within the specified section
* of the given configuration.
*
* If either config, section or option is null, or if `option` begins
* with a dot, the function will do nothing.
*
* @param {string} config
* The name of the configuration to set the option value in.
*
* @param {string} sid
* The name or ID of the section to set the option value in.
*
* @param {string} option
* The option name to set the value for.
*
* @param {null|string|string[]} value
* The option value to set. If the value is `null` or an empty string,
* the option will be removed, otherwise it will be set or overwritten
* with the given value.
*/
set: function(conf, sid, opt, val) {
var v = this.state.values,
n = this.state.creates,
c = this.state.changes,
d = this.state.deletes;
sid = this.resolveSID(conf, sid);
if (sid == null || opt == null || opt.charAt(0) == '.')
return;
if (n[conf] &amp;&amp; n[conf][sid]) {
if (val != null)
n[conf][sid][opt] = val;
else
delete n[conf][sid][opt];
}
else if (val != null &amp;&amp; val !== '') {
/* do not set within deleted section */
if (d[conf] &amp;&amp; d[conf][sid] === true)
return;
/* only set in existing sections */
if (!v[conf] || !v[conf][sid])
return;
if (!c[conf])
c[conf] = {};
if (!c[conf][sid])
c[conf][sid] = {};
/* undelete option */
if (d[conf] &amp;&amp; d[conf][sid])
d[conf][sid] = d[conf][sid].filter(function(o) { return o !== opt });
c[conf][sid][opt] = val;
}
else {
/* only delete in existing sections */
if (!(v[conf] &amp;&amp; v[conf][sid] &amp;&amp; v[conf][sid].hasOwnProperty(opt)) &amp;&amp;
!(c[conf] &amp;&amp; c[conf][sid] &amp;&amp; c[conf][sid].hasOwnProperty(opt)))
return;
if (!d[conf])
d[conf] = { };
if (!d[conf][sid])
d[conf][sid] = [ ];
if (d[conf][sid] !== true)
d[conf][sid].push(opt);
}
},
/**
* Remove the given option within the specified section of the given
* configuration.
*
* This function is a convenience wrapper around
* `uci.set(config, section, option, null)`.
*
* @param {string} config
* The name of the configuration to remove the option from.
*
* @param {string} sid
* The name or ID of the section to remove the option from.
*
* @param {string} option
* The name of the option to remove.
*/
unset: function(conf, sid, opt) {
return this.set(conf, sid, opt, null);
},
/**
* Gets the value of the given option or the entire section object of
* the first found section of the specified type or the first found
* section of the entire configuration if no type is specfied.
*
* @param {string} config
* The name of the configuration to read the value from.
*
* @param {string} [type]
* The type of the first section to find. If it is `null`, the first
* section of the entire config is read, otherwise the first section
* matching the given type.
*
* @param {string} [option]
* The option name to read the value from. If the option name is
* omitted or `null`, the entire section is returned instead.
*
* @returns {null|string|string[]|LuCI.uci.SectionObject}
* - Returns a string containing the option value in case of a
* plain UCI option.
* - Returns an array of strings containing the option values in
* case of `option` pointing to an UCI list.
* - Returns a {@link LuCI.uci.SectionObject section object} if
* the `option` argument has been omitted or is `null`.
* - Returns `null` if the config, section or option has not been
* found or if the corresponding configuration is not loaded.
*/
get_first: function(conf, type, opt) {
var sid = null;
this.sections(conf, type, function(s) {
if (sid == null)
sid = s['.name'];
});
return this.get(conf, sid, opt);
},
/**
* Sets the value of the given option within the first found section
* of the given configuration matching the specified type or within
* the first section of the entire config when no type has is specified.
*
* If either config, type or option is null, or if `option` begins
* with a dot, the function will do nothing.
*
* @param {string} config
* The name of the configuration to set the option value in.
*
* @param {string} [type]
* The type of the first section to find. If it is `null`, the first
* section of the entire config is written to, otherwise the first
* section matching the given type is used.
*
* @param {string} option
* The option name to set the value for.
*
* @param {null|string|string[]} value
* The option value to set. If the value is `null` or an empty string,
* the option will be removed, otherwise it will be set or overwritten
* with the given value.
*/
set_first: function(conf, type, opt, val) {
var sid = null;
this.sections(conf, type, function(s) {
if (sid == null)
sid = s['.name'];
});
return this.set(conf, sid, opt, val);
},
/**
* Removes the given option within the first found section of the given
* configuration matching the specified type or within the first section
* of the entire config when no type has is specified.
*
* This function is a convenience wrapper around
* `uci.set_first(config, type, option, null)`.
*
* @param {string} config
* The name of the configuration to set the option value in.
*
* @param {string} [type]
* The type of the first section to find. If it is `null`, the first
* section of the entire config is written to, otherwise the first
* section matching the given type is used.
*
* @param {string} option
* The option name to set the value for.
*/
unset_first: function(conf, type, opt) {
return this.set_first(conf, type, opt, null);
},
/**
* Move the first specified section within the given configuration
* before or after the second specified section.
*
* @param {string} config
* The configuration to move the section within.
*
* @param {string} sid1
* The ID of the section to move within the configuration.
*
* @param {string} [sid2]
* The ID of the target section for the move operation. If the
* `after` argument is `false` or not specified, the section named by
* `sid1` will be moved before this target section, if the `after`
* argument is `true`, the `sid1` section will be moved after this
* section.
*
* When the `sid2` argument is `null`, the section specified by `sid1`
* is moved to the end of the configuration.
*
* @param {boolean} [after=false]
* When `true`, the section `sid1` is moved after the section `sid2`,
* when `false`, the section `sid1` is moved before `sid2`.
*
* If `sid2` is null, then this parameter has no effect and the section
* `sid1` is moved to the end of the configuration instead.
*
* @returns {boolean}
* Returns `true` when the section was successfully moved, or `false`
* when either the section specified by `sid1` or by `sid2` is not found.
*/
move: function(conf, sid1, sid2, after) {
var sa = this.sections(conf),
s1 = null, s2 = null;
sid1 = this.resolveSID(conf, sid1);
sid2 = this.resolveSID(conf, sid2);
for (var i = 0; i &lt; sa.length; i++) {
if (sa[i]['.name'] != sid1)
continue;
s1 = sa[i];
sa.splice(i, 1);
break;
}
if (s1 == null)
return false;
if (sid2 == null) {
sa.push(s1);
}
else {
for (var i = 0; i &lt; sa.length; i++) {
if (sa[i]['.name'] != sid2)
continue;
s2 = sa[i];
sa.splice(i + !!after, 0, s1);
break;
}
if (s2 == null)
return false;
}
for (var i = 0; i &lt; sa.length; i++)
this.get(conf, sa[i]['.name'])['.index'] = i;
this.state.reorder[conf] = true;
return true;
},
/**
* Submits all local configuration changes to the remove `ubus` api,
* adds, removes and reorders remote sections as needed and reloads
* all loaded configurations to resynchronize the local state with
* the remote configuration values.
*
* @returns {string[]}
* Returns a promise resolving to an array of configuration names which
* have been reloaded by the save operation.
*/
save: function() {
var v = this.state.values,
n = this.state.creates,
c = this.state.changes,
d = this.state.deletes,
r = this.state.reorder,
self = this,
snew = [ ],
pkgs = { },
tasks = [];
if (n)
for (var conf in n) {
for (var sid in n[conf]) {
var r = {
config: conf,
values: { }
};
for (var k in n[conf][sid]) {
if (k == '.type')
r.type = n[conf][sid][k];
else if (k == '.create')
r.name = n[conf][sid][k];
else if (k.charAt(0) != '.')
r.values[k] = n[conf][sid][k];
}
snew.push(n[conf][sid]);
tasks.push(self.callAdd(r.config, r.type, r.name, r.values));
}
pkgs[conf] = true;
}
if (c)
for (var conf in c) {
for (var sid in c[conf])
tasks.push(self.callSet(conf, sid, c[conf][sid]));
pkgs[conf] = true;
}
if (d)
for (var conf in d) {
for (var sid in d[conf]) {
var o = d[conf][sid];
tasks.push(self.callDelete(conf, sid, (o === true) ? null : o));
}
pkgs[conf] = true;
}
if (r)
for (var conf in r)
pkgs[conf] = true;
return Promise.all(tasks).then(function(responses) {
/*
array "snew" holds references to the created uci sections,
use it to assign the returned names of the new sections
*/
for (var i = 0; i &lt; snew.length; i++)
snew[i]['.name'] = responses[i];
return self.reorderSections();
}).then(function() {
pkgs = Object.keys(pkgs);
self.unload(pkgs);
return self.load(pkgs);
});
},
/**
* Instructs the remote `ubus` UCI api to commit all saved changes with
* rollback protection and attempts to confirm the pending commit
* operation to cancel the rollback timer.
*
* @param {number} [timeout=10]
* Override the confirmation timeout after which a rollback is triggered.
*
* @returns {Promise&lt;number>}
* Returns a promise resolving/rejecting with the `ubus` RPC status code.
*/
apply: function(timeout) {
var self = this,
date = new Date();
if (typeof(timeout) != 'number' || timeout &lt; 1)
timeout = 10;
return self.callApply(timeout, true).then(function(rv) {
if (rv != 0)
return Promise.reject(rv);
var try_deadline = date.getTime() + 1000 * timeout;
var try_confirm = function() {
return self.callConfirm().then(function(rv) {
if (rv != 0) {
if (date.getTime() &lt; try_deadline)
window.setTimeout(try_confirm, 250);
else
return Promise.reject(rv);
}
return rv;
});
};
window.setTimeout(try_confirm, 1000);
});
},
/**
* An UCI change record is a plain array containing the change operation
* name as first element, the affected section ID as second argument
* and an optional third and fourth argument whose meanings depend on
* the operation.
*
* @typedef {string[]} ChangeRecord
* @memberof LuCI.uci
*
* @property {string} 0
* The operation name - may be one of `add`, `set`, `remove`, `order`,
* `list-add`, `list-del` or `rename`.
*
* @property {string} 1
* The section ID targeted by the operation.
*
* @property {string} 2
* The meaning of the third element depends on the operation.
* - For `add` it is type of the section that has been added
* - For `set` it either is the option name if a fourth element exists,
* or the type of a named section which has been added when the change
* entry only contains three elements.
* - For `remove` it contains the name of the option that has been
* removed.
* - For `order` it specifies the new sort index of the section.
* - For `list-add` it contains the name of the list option a new value
* has been added to.
* - For `list-del` it contains the name of the list option a value has
* been removed from.
* - For `rename` it contains the name of the option that has been
* renamed if a fourth element exists, else it contains the new name
* a section has been renamed to if the change entry only contains
* three elements.
*
* @property {string} 4
* The meaning of the fourth element depends on the operation.
* - For `set` it is the value an option has been set to.
* - For `list-add` it is the new value that has been added to a
* list option.
* - For `rename` it is the new name of an option that has been
* renamed.
*/
/**
* Fetches uncommitted UCI changes from the remote `ubus` RPC api.
*
* @method
* @returns {Promise&lt;Object&lt;string, Array&lt;LuCI.uci.ChangeRecord>>>}
* Returns a promise resolving to an object containing the configuration
* names as keys and arrays of related change records as values.
*/
changes: rpc.declare({
object: 'uci',
method: 'changes',
expect: { changes: { } }
})
});
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="LuCI.html">LuCI</a></li><li><a href="LuCI.Class.html">Class</a></li><li><a href="LuCI.dom.html">dom</a></li><li><a href="LuCI.fs.html">fs</a></li><li><a href="LuCI.Headers.html">Headers</a></li><li><a href="LuCI.Network.html">Network</a></li><li><a href="LuCI.Network.Device.html">Device</a></li><li><a href="LuCI.Network.Hosts.html">Hosts</a></li><li><a href="LuCI.Network.Protocol.html">Protocol</a></li><li><a href="LuCI.Network.WifiDevice.html">WifiDevice</a></li><li><a href="LuCI.Network.WifiNetwork.html">WifiNetwork</a></li><li><a href="LuCI.Poll.html">Poll</a></li><li><a href="LuCI.Request.html">Request</a></li><li><a href="LuCI.Request.poll.html">poll</a></li><li><a href="LuCI.Response.html">Response</a></li><li><a href="LuCI.rpc.html">rpc</a></li><li><a href="LuCI.uci.html">uci</a></li><li><a href="LuCI.view.html">view</a></li><li><a href="LuCI.XHR.html">XHR</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Tue Nov 05 2019 09:33:05 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>