summaryrefslogtreecommitdiffstats
path: root/src/libnetdata/config/appconfig_api_boolean.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libnetdata/config/appconfig_api_boolean.h')
-rw-r--r--src/libnetdata/config/appconfig_api_boolean.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/libnetdata/config/appconfig_api_boolean.h b/src/libnetdata/config/appconfig_api_boolean.h
new file mode 100644
index 000000000..2b05fce60
--- /dev/null
+++ b/src/libnetdata/config/appconfig_api_boolean.h
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#ifndef NETDATA_APPCONFIG_API_BOOLEAN_H
+#define NETDATA_APPCONFIG_API_BOOLEAN_H
+
+#define CONFIG_BOOLEAN_INVALID 100 // an invalid value to check for validity (used as default initialization when needed)
+
+#define CONFIG_BOOLEAN_NO 0 // disabled
+#define CONFIG_BOOLEAN_YES 1 // enabled
+
+#ifndef CONFIG_BOOLEAN_AUTO
+#define CONFIG_BOOLEAN_AUTO 2 // enabled if it has useful info when enabled
+#endif
+
+int appconfig_get_boolean(struct config *root, const char *section, const char *name, int value);
+#define config_get_boolean(section, name, value) appconfig_get_boolean(&netdata_config, section, name, value)
+
+int appconfig_get_boolean_ondemand(struct config *root, const char *section, const char *name, int value);
+#define config_get_boolean_ondemand(section, name, value) appconfig_get_boolean_ondemand(&netdata_config, section, name, value)
+
+int appconfig_set_boolean(struct config *root, const char *section, const char *name, int value);
+#define config_set_boolean(section, name, value) appconfig_set_boolean(&netdata_config, section, name, value)
+
+#endif //NETDATA_APPCONFIG_API_BOOLEAN_H