Code

store, plugin: Let the plugin module determine an objects backends.
[sysdb.git] / src / liboconfig / oconfig.h
1 /**
2  * SysDB - src/liboconfig/oconfig.h
3  * Based on collectd's oconfig, <http://collectd.org>
4  * Copyright (C) 2006-2009  Florian Forster
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
25 #ifndef SDB_OCONFIG_OCONFIG_H
26 #define SDB_OCONFIG_OCONFIG_H 1
28 #include <stdio.h>
30 /*
31  * Types
32  */
33 #define OCONFIG_TYPE_STRING  0
34 #define OCONFIG_TYPE_NUMBER  1
35 #define OCONFIG_TYPE_BOOLEAN 2
37 struct oconfig_value_s
38 {
39   union
40   {
41     char  *string;
42     double number;
43     int    boolean;
44   } value;
45   int type;
46 };
47 typedef struct oconfig_value_s oconfig_value_t;
49 struct oconfig_item_s;
50 typedef struct oconfig_item_s oconfig_item_t;
51 struct oconfig_item_s
52 {
53   char            *key;
54   oconfig_value_t *values;
55   int              values_num;
57   oconfig_item_t  *parent;
58   oconfig_item_t  *children;
59   int              children_num;
60 };
62 /*
63  * Functions
64  */
65 oconfig_item_t *oconfig_parse_fh (FILE *fh);
66 oconfig_item_t *oconfig_parse_file (const char *file);
68 oconfig_item_t *oconfig_clone (const oconfig_item_t *ci);
70 void oconfig_free (oconfig_item_t *ci);
72 /*
73  * vim: shiftwidth=2:tabstop=8:softtabstop=2
74  */
75 #endif /* SDB_OCONFIG_OCONFIG_H */