summaryrefslogtreecommitdiff
path: root/uci.h
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2008-08-18 16:54:57 +0200
committerFelix Fietkau <nbd@openwrt.org>2008-08-18 16:54:57 +0200
commit3bff697cca125a6a4147e3bd1c469b36504e8237 (patch)
treeefe3b96d0e101d1cd8d53f842b45824c582d47eb /uci.h
parentcac9b1d765338466c1c77719c4119c565689b4c4 (diff)
downloaduci-3bff697cca125a6a4147e3bd1c469b36504e8237.tar.gz
add list support
Diffstat (limited to 'uci.h')
-rw-r--r--uci.h29
1 files changed, 27 insertions, 2 deletions
diff --git a/uci.h b/uci.h
index d7fd1e2..198ae2a 100644
--- a/uci.h
+++ b/uci.h
@@ -187,6 +187,14 @@ extern int uci_add_section(struct uci_context *ctx, struct uci_package *p, const
extern int uci_set_element_value(struct uci_context *ctx, struct uci_element **element, const char *value);
/**
+ * uci_add_element_list: Append a string to a list option
+ * @ctx: uci context
+ * @option: pointer to the uci option element
+ * @value: string to append
+ */
+extern int uci_add_element_list(struct uci_context *ctx, struct uci_option *o, const char *value);
+
+/**
* uci_set: Set an element's value; create the element if necessary
* @ctx: uci context
* @package: package name
@@ -198,6 +206,20 @@ extern int uci_set_element_value(struct uci_context *ctx, struct uci_element **e
extern int uci_set(struct uci_context *ctx, struct uci_package *p, const char *section, const char *option, const char *value, struct uci_element **result);
/**
+ * uci_add_list: Append a string to an element list
+ * @ctx: uci context
+ * @package: package name
+ * @section: section name
+ * @option: option name
+ * @value: string value
+ * @result: store the updated element in this variable (optional)
+ *
+ * Note: if the given option already contains a string, convert it to an 1-element-list
+ * before appending the next element
+ */
+extern int uci_add_list(struct uci_context *ctx, struct uci_package *p, const char *section, const char *option, const char *value, struct uci_option **result);
+
+/**
* uci_rename: Rename an element
* @ctx: uci context
* @package: package name
@@ -317,10 +339,12 @@ enum uci_type {
UCI_TYPE_OPTION = 3,
UCI_TYPE_PATH = 4,
UCI_TYPE_BACKEND = 5,
+ UCI_TYPE_ITEM = 6,
};
enum uci_option_type {
UCI_TYPE_STRING = 0,
+ UCI_TYPE_LIST = 1,
};
enum uci_flags {
@@ -410,7 +434,7 @@ struct uci_option
struct uci_section *section;
enum uci_option_type type;
union {
- struct uci_element *list;
+ struct uci_list list;
char *string;
} v;
};
@@ -419,7 +443,8 @@ enum uci_command {
UCI_CMD_ADD,
UCI_CMD_REMOVE,
UCI_CMD_CHANGE,
- UCI_CMD_RENAME
+ UCI_CMD_RENAME,
+ UCI_CMD_LIST_ADD,
};
struct uci_history