Expand description
FFI bindings to OpenWRT UCI
This crate provides an unsafe interface to OpenWRT’s Unified Configuration Interface C-Library.
§Building
Both UCI libraries and headers are required to build this crate. There are multiple options available to locate UCI.
§Inside OpenWRT SDK
If building inside the OpenWRT SDK with OpenWRT’s UCI package set the environment variable
UCI_DIR=$(STAGING_DIR)/usr
using the corresponding Makefile.
rust-uci will automatically use the headers and libraries for the target system.
§Vendored
If no UCI_DIR
variable is set, rust-uci will compile against the distributed libuci source files licensed under GPLv2.
Structs§
- uci_
backend - uci_
context - uci_
delta - uci_
element - uci_
list - uci_
option - uci_
package - uci_
parse_ context - uci_
parse_ option - uci_ptr
- uci_
section
Constants§
- UCI_OK
- uci_
option_ type_ UCI_ TYPE_ STRING - uci_
ptr_ UCI_ LOOKUP_ COMPLETE - uci_
type_ UCI_ TYPE_ OPTION - uci_
type_ UCI_ TYPE_ SECTION
Functions§
- uci_
add_ ⚠delta_ path - uci_add_delta_path: add a directory to the search path for change delta files @ctx: uci context @dir: directory name
- uci_
add_ ⚠list - uci_add_list: Append a string to an element list @ctx: uci context @ptr: uci pointer (with value)
- uci_
add_ ⚠section - uci_add_section: Add an unnamed section @ctx: uci context @p: package to add the section to @type: section type @res: pointer to store a reference to the new section in
- uci_
alloc_ ⚠context - uci_alloc_context: Allocate a new uci context
- uci_
commit ⚠ - uci_commit: commit changes to a package @ctx: uci context @p: uci_package struct pointer @overwrite: overwrite existing config data and flush delta
- uci_
del_ ⚠list - uci_del_list: Remove a string from an element list @ctx: uci context @ptr: uci pointer (with value)
- uci_
delete ⚠ - uci_delete: Delete a section or option @ctx: uci context @ptr: uci pointer
- uci_
export ⚠ - uci_export: Export one or all uci config packages @ctx: uci context @stream: output stream @package: (optional) uci config package to export @header: include the package header
- uci_
free_ ⚠context - uci_free_context: Free the uci context including all of its data
- uci_
get_ ⚠errorstr - uci_geterror: Get an error string for the last uci error @ctx: uci context @dest: target pointer for the string @str: prefix for the error message
- uci_
hash_ ⚠options - uci_hash_options: build a hash over a list of options @tb: list of option pointers @n_opts: number of options
- uci_
import ⚠ - uci_import: Import uci config data from a stream @ctx: uci context @stream: file stream to import from @name: (optional) assume the config has the given name @package: (optional) store the last parsed config package in this variable @single: ignore the ‘package’ keyword and parse everything into a single package
- uci_
list_ ⚠configs - uci_list_configs: List available uci config files @ctx: uci context
- uci_
load ⚠ - uci_load: Parse an uci config file and store it in the uci context
- uci_
lookup_ ⚠next - uci_lookup_next: lookup a child element @ctx: uci context @e: target element pointer @list: list of elements @name: name of the child element
- uci_
lookup_ ⚠ptr - uci_lookup_ptr: Split an uci tuple string and look up an element tree @ctx: uci context @ptr: lookup result struct @str: uci tuple string to look up @extended: allow extended syntax lookup
- uci_
parse_ ⚠argument - uci_parse_argument: parse a shell-style argument, with an arbitrary quoting style @ctx: uci context @stream: input stream @str: pointer to the current line (use NULL for parsing the next line) @result: pointer for the result
- uci_
parse_ ⚠ptr - uci_parse_ptr: parse a uci string into a uci_ptr @ctx: uci context @ptr: target data structure @str: string to parse
- uci_
parse_ ⚠section - uci_parse_section: look up a set of options @s: uci section @opts: list of options to look up @n_opts: number of options to look up @tb: array of pointers to found options
- uci_
perror ⚠ - uci_perror: Print the last uci error that occured @ctx: uci context @str: string to print before the error message
- uci_
rename ⚠ - uci_rename: Rename an element @ctx: uci context @ptr: uci pointer (with value)
- uci_
reorder_ ⚠section - uci_reorder: Reposition a section @ctx: uci context @s: uci section to reposition @pos: new position in the section list
- uci_
revert ⚠ - uci_revert: revert all changes to a config item @ctx: uci context @ptr: uci pointer
- uci_
save ⚠ - uci_save: save change delta for a package @ctx: uci context @p: uci_package struct
- uci_set⚠
- uci_set: Set an element’s value; create the element if necessary @ctx: uci context @ptr: uci pointer
- uci_
set_ ⚠backend - uci_set_backend: change the default backend @ctx: uci context @name: name of the backend
- uci_
set_ ⚠confdir - uci_set_savedir: override the default config storage directory @ctx: uci context @dir: directory name
- uci_
set_ ⚠savedir - uci_set_savedir: override the default delta save directory @ctx: uci context @dir: directory name
- uci_
unload ⚠ - uci_unload: Unload a config file from the uci context
- uci_
validate_ ⚠text - uci_validate_text: validate a value string for uci options @str: value