check
[oweals/gnunet.git] / src / include / gnunet_configuration_lib.h
index 5510ad0958337113ae3d451005280c2f12f59b34..87aa8eacc7161363c527e77f93dc2ef198389b74 100644 (file)
@@ -45,17 +45,6 @@ extern "C"
  */
 struct GNUNET_CONFIGURATION_Handle;
 
-
-/**
- * Used for diffing a configuration object against
- * the default one
- */
-typedef struct {
-       struct GNUNET_CONFIGURATION_Handle* cfgNew;
-       struct GNUNET_CONFIGURATION_Handle* cfgDiff;
-} GNUNNET_CONFIGURATION_Diff_Handle;
-
-
 /**
  * Create a new configuration object.
  * @return fresh configuration object
@@ -87,7 +76,7 @@ void GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg);
  * to overwrite the defaults.
  *
  * @param cfg configuration to update
- * @param filename name of the configuration file
+ * @param filename name of the configuration file, NULL to load defaults
  * @return GNUNET_OK on success, GNUNET_SYSERR on error
  */
 int GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg,
@@ -124,10 +113,9 @@ int GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg,
  * @return GNUNET_OK on success, GNUNET_SYSERR on error
  */
 int
-GNUNET_CONFIGURATION_write_diffs(
-       struct GNUNET_CONFIGURATION_Handle *cfgDefault,
-       struct GNUNET_CONFIGURATION_Handle *cfgNew,
-       const char* filename);
+GNUNET_CONFIGURATION_write_diffs(const struct GNUNET_CONFIGURATION_Handle *cfgDefault,
+                                const struct GNUNET_CONFIGURATION_Handle *cfgNew,
+                                const char* filename);
 
 /**
  * Test if there are configuration options that were
@@ -153,6 +141,16 @@ typedef void (*GNUNET_CONFIGURATION_Iterator)(void *cls,
                                              const char *value);
 
 
+/**
+ * Function to iterate over section.
+ *
+ * @param cls closure
+ * @param section name of the section
+ */
+typedef void (*GNUNET_CONFIGURATION_Section_Iterator)(void *cls,
+                                             const char *section);
+
+
 /**
  * Iterate over all options in the configuration.
  *
@@ -165,6 +163,17 @@ void GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg
                                   void *iter_cls);
 
 
+/**
+ * Iterate over all sections in the configuration.
+ *
+ * @param cfg configuration to inspect
+ * @param iter function to call on each section
+ * @param iter_cls closure for iter
+ */
+void GNUNET_CONFIGURATION_iterate_sections (const struct GNUNET_CONFIGURATION_Handle *cfg,
+                                            GNUNET_CONFIGURATION_Section_Iterator iter,
+                                            void *iter_cls);
+
 /**
  * Get a configuration value that should be a number.
  *