summaryrefslogtreecommitdiffstats
path: root/src/openlmi.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/openlmi.h')
-rw-r--r--src/openlmi.h58
1 files changed, 56 insertions, 2 deletions
diff --git a/src/openlmi.h b/src/openlmi.h
index 6ab4158..7d64bd1 100644
--- a/src/openlmi.h
+++ b/src/openlmi.h
@@ -22,6 +22,13 @@
#define OPENLMI_H
#include <cmpidt.h>
+#include <stdbool.h>
+
+typedef struct {
+ const char *group;
+ const char *key;
+ const char *value;
+} ConfigEntry;
/**
* This function returns FQDN (fully qualified domain name) of the machine
@@ -43,11 +50,55 @@ const char *lmi_get_system_name();
const char *lmi_get_system_creation_class_name();
/**
+ * Initialize usage base openlmi tools like configuration file access,
+ * logging etc.
+ *
+ * @note You must call this function prior to getting any configuration option
+ * or usage of logging. lmi_get_system_creation_class_name requires that this
+ * function will be called first (SystemCreationClassName is read from config).
+ *
+ * This function is reentrant and thread safe, but it should be called always
+ * with same parameters
+ *
+ * @param provider Identification of the CIM provider (must be same as name of the
+ * configuration file)
+ * @param cb CMPIBroker
+ * @param provider_config_defaults Array of default config values for given provider
+ * NULL if there is no provider-specific configuration
+ */
+void lmi_init(const char *provider, const CMPIBroker *cb,
+ const ConfigEntry *provider_config_defaults);
+
+/**
+ * Reads string key out of configration files or default configration options.
+ *
+ * @param group Configration group
+ * @param key Configration key
+ * @return String value of the key or NULL if group/key is not found
+ */
+char *lmi_read_config(const char *group, const char *key);
+
+/**
+ * Reads a boolean value out of configuration files or default configuration
+ * options.
+ *
+ * Values "1", "yes", "true", and "on" are converted to TRUE, others to FALSE
+ *
+ * @param group Configration group
+ * @param key Configration key
+ * @return Boolean value of the key, false if the key is not in the
+ * configuration files neither in default options.
+ */
+bool lmi_read_config_boolean(const char *group, const char *key);
+
+/**
* To use standard CIMOM logging facility, broker must be assigned. Without
* calling this function, logging will go to stderr.
*
- * \p log_id Identification of log messages
- * \p cb CMPIBroker
+ * @deprecated Use lmi_init instead
+ *
+ * @param log_id Identification of log messages
+ * @param cb CMPIBroker
*/
void lmi_init_logging(const char *log_id, const CMPIBroker *cb);
@@ -61,6 +112,9 @@ int lmi_log_level(void);
/**
* Set logging level
*
+ * @note This method shouldn't be used directly, user setting
+ * from the configuration file should be honored
+ *
* @param level new logging level
*/
void lmi_set_log_level(int level);