check
[oweals/gnunet.git] / src / include / gnunet_configuration_lib.h
index 84c20bde02854fa12115aee6e111e3d88aba2a76..87aa8eacc7161363c527e77f93dc2ef198389b74 100644 (file)
@@ -55,11 +55,11 @@ struct GNUNET_CONFIGURATION_Handle *GNUNET_CONFIGURATION_create (void);
 /**
  * Duplicate an existing configuration object.
  *
- * @param c configuration to duplicate
+ * @param cfg configuration to duplicate
  * @return duplicate configuration
  */
 struct GNUNET_CONFIGURATION_Handle *
-GNUNET_CONFIGURATION_dup (const struct GNUNET_CONFIGURATION_Handle *c);
+GNUNET_CONFIGURATION_dup (const struct GNUNET_CONFIGURATION_Handle *cfg);
 
 
 /**
@@ -76,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,
@@ -105,6 +105,17 @@ int GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
 int GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg,
                                 const char *filename);
 
+/**
+ * Write only configuration entries that have been changed to configuration file
+ * @param cfgDefault default configuration
+ * @param cfgNew new configuration
+ * @param filename where to write the configuration diff between default and new
+ * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ */
+int
+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
@@ -130,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.
  *
@@ -142,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.
  *
@@ -156,6 +188,7 @@ int GNUNET_CONFIGURATION_get_value_number (const struct GNUNET_CONFIGURATION_Han
                                            const char *option,
                                            unsigned long long *number);
 
+
 /**
  * Get a configuration value that should be a relative time.
  *
@@ -170,6 +203,7 @@ int GNUNET_CONFIGURATION_get_value_time (const struct GNUNET_CONFIGURATION_Handl
                                         const char *option,
                                         struct GNUNET_TIME_Relative *time);
 
+
 /**
  * Test if we have a value for a particular option
  *
@@ -181,6 +215,7 @@ int GNUNET_CONFIGURATION_get_value_time (const struct GNUNET_CONFIGURATION_Handl
 int GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg,
                                      const char *section, const char *option);
 
+
 /**
  * Get a configuration value that should be a string.
  *
@@ -195,6 +230,7 @@ int GNUNET_CONFIGURATION_get_value_string (const struct GNUNET_CONFIGURATION_Han
                                            *cfg, const char *section,
                                            const char *option, char **value);
 
+
 /**
  * Get a configuration value that should be the name of a file
  * or directory.
@@ -267,11 +303,12 @@ int GNUNET_CONFIGURATION_get_value_yesno (const struct GNUNET_CONFIGURATION_Hand
  * "FOO" is set to "DIRECTORY".
  *
  * @param cfg configuration to use for path expansion
- * @param old string to $-expand (will be freed!)
+ * @param orig string to $-expand (will be freed!)
  * @return $-expanded string
  */
 char *GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Handle
-                                          *cfg, char *old);
+                                          *cfg, char *orig);
+
 
 /**
  * Set a configuration value that should be a number.