import v0.1
[project/mountd.git] / include / ucix.h
1 /*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
15 *
16 * Copyright (C) 2008 John Crispin <blogic@openwrt.org>
17 */
18
19 #ifndef _UCI_H__
20 #define _UCI_H__
21 #include <uci.h>
22 #include "list.h"
23
24 struct ucilist {
25 struct list_head list;
26 char *val;
27 };
28
29 struct uci_context* ucix_init(const char *config_file);
30 struct uci_context* ucix_init_path(const char *path, const char *config_file);
31 void ucix_cleanup(struct uci_context *ctx);
32 int ucix_save(struct uci_context *ctx, const char *p);
33 int ucix_save_state(struct uci_context *ctx, const char *p);
34 char* ucix_get_option(struct uci_context *ctx,
35 const char *p, const char *s, const char *o);
36 int ucix_get_option_list(struct uci_context *ctx, const char *p,
37 const char *s, const char *o, struct list_head *l);
38 int ucix_get_option_int(struct uci_context *ctx,
39 const char *p, const char *s, const char *o, int def);
40 void ucix_add_section(struct uci_context *ctx,
41 const char *p, const char *s, const char *t);
42 void ucix_add_option(struct uci_context *ctx,
43 const char *p, const char *s, const char *o, const char *t);
44 void ucix_add_option_int(struct uci_context *ctx,
45 const char *p, const char *s, const char *o, int t);
46 void ucix_for_each_section_type(struct uci_context *ctx,
47 const char *p, const char *t,
48 void (*cb)(const char*, void*), void *priv);
49 void ucix_for_each_section_option(struct uci_context *ctx,
50 const char *p, const char *s,
51 void (*cb)(const char*, const char*, void*), void *priv);
52 int ucix_commit(struct uci_context *ctx, const char *p);
53 void ucix_revert(struct uci_context *ctx,
54 const char *p, const char *s, const char *o);
55 void ucix_del(struct uci_context *ctx, const char *p,
56 const char *s, const char *o);
57 #endif