| 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 |
typedef enum { noit_false = 0, noit_true } noit_conf_boolean; |
|---|
| 14 |
typedef void * noit_conf_section_t; |
|---|
| 15 |
|
|---|
| 16 |
#define NOIT_CONF_T_USERDATA "noit::state::conf_t" |
|---|
| 17 |
typedef struct { |
|---|
| 18 |
char *path; |
|---|
| 19 |
uuid_t current_check; |
|---|
| 20 |
char prompt[50]; |
|---|
| 21 |
} noit_conf_t_userdata_t; |
|---|
| 22 |
|
|---|
| 23 |
API_EXPORT(void) noit_conf_init(const char *toplevel); |
|---|
| 24 |
API_EXPORT(int) noit_conf_load(const char *path); |
|---|
| 25 |
API_EXPORT(int) noit_conf_save(const char *path); |
|---|
| 26 |
|
|---|
| 27 |
API_EXPORT(noit_conf_section_t) |
|---|
| 28 |
noit_conf_get_section(noit_conf_section_t section, const char *path); |
|---|
| 29 |
API_EXPORT(noit_conf_section_t *) |
|---|
| 30 |
noit_conf_get_sections(noit_conf_section_t section, const char *path, |
|---|
| 31 |
int *cnt); |
|---|
| 32 |
|
|---|
| 33 |
API_EXPORT(noit_hash_table *) |
|---|
| 34 |
noit_conf_get_hash(noit_conf_section_t section, const char *path); |
|---|
| 35 |
|
|---|
| 36 |
API_EXPORT(int) noit_conf_get_string(noit_conf_section_t section, |
|---|
| 37 |
const char *path, char **value); |
|---|
| 38 |
|
|---|
| 39 |
API_EXPORT(int) noit_conf_get_stringbuf(noit_conf_section_t section, |
|---|
| 40 |
const char *path, char *value, int len); |
|---|
| 41 |
API_EXPORT(int) noit_conf_get_int(noit_conf_section_t section, |
|---|
| 42 |
const char *path, int *value); |
|---|
| 43 |
API_EXPORT(int) noit_conf_get_float(noit_conf_section_t section, |
|---|
| 44 |
const char *path, float *value); |
|---|
| 45 |
API_EXPORT(int) noit_conf_get_boolean(noit_conf_section_t section, |
|---|
| 46 |
const char *path, noit_conf_boolean *value); |
|---|
| 47 |
API_EXPORT(int) |
|---|
| 48 |
noit_conf_get_uuid(noit_conf_section_t section, |
|---|
| 49 |
const char *path, uuid_t out); |
|---|
| 50 |
|
|---|
| 51 |
API_EXPORT(int) noit_conf_set_string(noit_conf_section_t section, |
|---|
| 52 |
const char *path, const char *value); |
|---|
| 53 |
API_EXPORT(int) noit_conf_set_int(noit_conf_section_t section, |
|---|
| 54 |
const char *path, int value); |
|---|
| 55 |
API_EXPORT(int) noit_conf_set_float(noit_conf_section_t section, |
|---|
| 56 |
const char *path, float value); |
|---|
| 57 |
API_EXPORT(int) noit_conf_set_boolean(noit_conf_section_t section, |
|---|
| 58 |
const char *path, noit_conf_boolean value); |
|---|
| 59 |
|
|---|
| 60 |
API_EXPORT(int) |
|---|
| 61 |
noit_conf_reload(noit_console_closure_t ncct, |
|---|
| 62 |
int argc, char **argv, |
|---|
| 63 |
noit_console_state_t *state, void *closure); |
|---|
| 64 |
API_EXPORT(int) |
|---|
| 65 |
noit_conf_write_terminal(noit_console_closure_t ncct, |
|---|
| 66 |
int argc, char **argv, |
|---|
| 67 |
noit_console_state_t *state, void *closure); |
|---|
| 68 |
API_EXPORT(int) |
|---|
| 69 |
noit_conf_write_file(noit_console_closure_t ncct, |
|---|
| 70 |
int argc, char **argv, |
|---|
| 71 |
noit_console_state_t *state, void *closure); |
|---|
| 72 |
|
|---|
| 73 |
API_EXPORT(void) noit_conf_log_init(const char *toplevel); |
|---|
| 74 |
|
|---|
| 75 |
#endif |
|---|