root/src/noit_conf.h

Revision 70451c561661f38403852e3585f41976f6a42843, 3.4 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 6 years ago)

implements configuration pushing into the DB. refs #26

  • Property mode set to 100644
Line 
1 /*
2  * Copyright (c) 2007, OmniTI Computer Consulting, Inc.
3  * All rights reserved.
4  */
5
6 #ifndef _NOIT_CONF_H
7 #define _NOIT_CONF_H
8
9 #include "noit_defines.h"
10 #include "utils/noit_hash.h"
11 #include "noit_console.h"
12
13 #include <uuid/uuid.h>
14
15 typedef enum { noit_false = 0, noit_true } noit_conf_boolean;
16 typedef void * noit_conf_section_t;
17
18 #define NOIT_CONF_T_USERDATA "noit::state::conf_t"
19 typedef struct {
20   char *path;
21   uuid_t current_check;
22   char prompt[50];
23 } noit_conf_t_userdata_t;
24
25 /* seconds == 0 disable config journaling watchdog */
26 API_EXPORT(void) noit_conf_coalesce_changes(u_int32_t seconds);
27 /* Start the watchdog */
28 API_EXPORT(void) noit_conf_watch_and_journal_watchdog(int (*f)(void *), void *c);
29
30 /* marks the config as changed.. if you manipulate the XML tree in any way
31  * you must call this function to "let the system know."  This is used
32  * to notice changes which are in turn flushed out.
33  */
34 API_EXPORT(void) noit_conf_mark_changed();
35
36 API_EXPORT(void) noit_conf_init(const char *toplevel);
37 API_EXPORT(int) noit_conf_load(const char *path);
38 API_EXPORT(int) noit_conf_save(const char *path);
39
40 API_EXPORT(noit_conf_section_t)
41   noit_conf_get_section(noit_conf_section_t section, const char *path);
42 API_EXPORT(noit_conf_section_t *)
43   noit_conf_get_sections(noit_conf_section_t section, const char *path,
44                          int *cnt);
45
46 API_EXPORT(noit_hash_table *)
47   noit_conf_get_hash(noit_conf_section_t section, const char *path);
48
49 API_EXPORT(int) noit_conf_get_string(noit_conf_section_t section,
50                                      const char *path, char **value);
51
52 API_EXPORT(int) noit_conf_get_stringbuf(noit_conf_section_t section,
53                                         const char *path, char *value, int len);
54 API_EXPORT(int) noit_conf_get_int(noit_conf_section_t section,
55                                   const char *path, int *value);
56 API_EXPORT(int) noit_conf_get_float(noit_conf_section_t section,
57                                     const char *path, float *value);
58 API_EXPORT(int) noit_conf_get_boolean(noit_conf_section_t section,
59                                       const char *path, noit_conf_boolean *value);
60 API_EXPORT(int)
61   noit_conf_get_uuid(noit_conf_section_t section,
62                      const char *path, uuid_t out);
63
64 API_EXPORT(int) noit_conf_set_string(noit_conf_section_t section,
65                                      const char *path, const char *value);
66 API_EXPORT(int) noit_conf_set_int(noit_conf_section_t section,
67                                   const char *path, int value);
68 API_EXPORT(int) noit_conf_set_float(noit_conf_section_t section,
69                                     const char *path, float value);
70 API_EXPORT(int) noit_conf_set_boolean(noit_conf_section_t section,
71                                       const char *path, noit_conf_boolean value);
72
73 API_EXPORT(int)
74   noit_conf_reload(noit_console_closure_t ncct,
75                    int argc, char **argv,
76                    noit_console_state_t *state, void *closure);
77 API_EXPORT(int)
78   noit_conf_write_terminal(noit_console_closure_t ncct,
79                            int argc, char **argv,
80                            noit_console_state_t *state, void *closure);
81 API_EXPORT(int)
82   noit_conf_write_file(noit_console_closure_t ncct,
83                        int argc, char **argv,
84                        noit_console_state_t *state, void *closure);
85
86 API_EXPORT(int)
87   noit_conf_write_log();
88
89 API_EXPORT(void) noit_conf_log_init(const char *toplevel);
90
91 #endif
Note: See TracBrowser for help on using the browser.