solaris-fixes branch: Applied the swap-patch by Christophe Kalt.
[collectd.git] / src / libconfig / libconfig.h
1 #  ifndef _RSK_LIBCONFIG_H
2 #  define _RSK_LIBCONFIG_H
3 #  ifdef __cplusplus
4 extern "C" {
5 #  endif
6
7 #  define LC_VAR_LIST 0x80
8
9 typedef enum {
10         LC_CONF_SECTION,
11         LC_CONF_APACHE,
12         LC_CONF_COLON,
13         LC_CONF_EQUAL,
14         LC_CONF_SPACE,
15         LC_CONF_XML
16 } lc_conf_type_t;
17
18 typedef enum {
19         LC_VAR_UNKNOWN,
20         LC_VAR_NONE,
21         LC_VAR_STRING,
22         LC_VAR_LONG_LONG,
23         LC_VAR_LONG,
24         LC_VAR_INT,
25         LC_VAR_SHORT,
26         LC_VAR_BOOL,
27         LC_VAR_FILENAME,
28         LC_VAR_DIRECTORY,
29         LC_VAR_SIZE_LONG_LONG,
30         LC_VAR_SIZE_LONG,
31         LC_VAR_SIZE_INT,
32         LC_VAR_SIZE_SHORT,
33         LC_VAR_TIME,
34         LC_VAR_DATE,
35         LC_VAR_SECTION,
36         LC_VAR_SECTIONSTART,
37         LC_VAR_SECTIONEND,
38         LC_VAR_BOOL_BY_EXISTANCE,
39         LC_VAR_SIZE_SIZE_T,
40         LC_VAR_CIDR,
41         LC_VAR_IP,
42         LC_VAR_IP4,
43         LC_VAR_IP6,
44         LC_VAR_HOSTNAME4,
45         LC_VAR_HOSTNAME6,
46 } lc_var_type_t;
47
48 typedef enum {
49         LC_FLAGS_VAR,
50         LC_FLAGS_CMDLINE,
51         LC_FLAGS_ENVIRON,
52         LC_FLAGS_SECTIONSTART,
53         LC_FLAGS_SECTIONEND
54 } lc_flags_t;
55
56 typedef enum {
57         LC_ERR_NONE,
58         LC_ERR_INVCMD,
59         LC_ERR_INVSECTION,
60         LC_ERR_INVDATA,
61         LC_ERR_BADFORMAT,
62         LC_ERR_CANTOPEN,
63         LC_ERR_CALLBACK,
64         LC_ERR_ENOMEM
65 } lc_err_t;
66
67 int lc_process(int argc, char **argv, const char *appname, lc_conf_type_t type, const char *extra);
68 int lc_register_callback(const char *var, char opt, lc_var_type_t type, int (*callback)(const char *, const char *, const char *, const char *, lc_flags_t, void *), void *extra);
69 int lc_register_var(const char *var, lc_var_type_t type, void *data, char opt);
70 lc_err_t lc_geterrno(void);
71 char *lc_geterrstr(void);
72 int lc_process_file(const char *appname, const char *pathname, lc_conf_type_t type);
73 void lc_cleanup(void);
74
75 #  define LC_CBRET_IGNORESECTION (255)
76 #  define LC_CBRET_OKAY (0)
77 #  define LC_CBRET_ERROR (-1)
78
79 extern int lc_optind;
80
81 #  ifdef __cplusplus
82 }
83 #  endif
84 #  endif