summaryrefslogtreecommitdiffstats
path: root/src/openlmi.h
diff options
context:
space:
mode:
authorRadek Novacek <rnovacek@redhat.com>2013-09-18 08:00:08 +0200
committerRadek Novacek <rnovacek@redhat.com>2013-09-18 08:00:38 +0200
commite4d72c3b72f2f363ec556c5f0ec6d94bd4f038ed (patch)
treed50d5e7ba4d238725a48c97659a7c40e1131729a /src/openlmi.h
parent87ac9c8b710ff016ac6db4311503a5b699b91c41 (diff)
downloadopenlmi-providers-e4d72c3b72f2f363ec556c5f0ec6d94bd4f038ed.tar.gz
openlmi-providers-e4d72c3b72f2f363ec556c5f0ec6d94bd4f038ed.tar.xz
openlmi-providers-e4d72c3b72f2f363ec556c5f0ec6d94bd4f038ed.zip
Introduce toplevel openlmi config file
Toplevel openlmi configuration file (/etc/openlmi/openlmi.conf) now contains common configuration options for all providers. Configuration for each provider could be overriden in provider-specific config (/etc/openlmi/$provider/$provider.conf). This patch also modify config file handling in python providers to include this config file. There is also support for C providers (in libopenlmicommon) for reading these config files and providing default configuration options.
Diffstat (limited to 'src/openlmi.h')
-rw-r--r--src/openlmi.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/openlmi.h b/src/openlmi.h
index 6ab4158..93778ce 100644
--- a/src/openlmi.h
+++ b/src/openlmi.h
@@ -23,6 +23,12 @@
#include <cmpidt.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,6 +49,35 @@ 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);
+
+/**
* To use standard CIMOM logging facility, broker must be assigned. Without
* calling this function, logging will go to stderr.
*