-adding continuation to testbed peer start/stop API
[oweals/gnunet.git] / src / include / gnunet_configuration_lib.h
index 7167d8bd6c6c5f400a4b9c06f3f90f62623dbacc..77d6d5552f0025b2753734fa9a1ed3834453cfe0 100644 (file)
@@ -86,6 +86,19 @@ GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg,
                            const char *filename);
 
 
+/**
+ * Load default configuration.  This function will parse the
+ * defaults from the given defaults_d directory.
+ *
+ * @param cfg configuration to update
+ * @param defaults_d directory with the defaults
+ * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ */
+int
+GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg,
+                               const char *defaults_d);
+
+
 /**
  * Parse a configuration file, add all of the options in the
  * file to the configuration environment.
@@ -99,6 +112,37 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
                             const char *filename);
 
 
+/**
+ * Serializes the given configuration.
+ *
+ * @param cfg configuration to serialize
+ * @param size will be set to the size of the serialized memory block
+ * @return the memory block where the serialized configuration is
+ *           present. This memory should be freed by the caller
+ */
+char *
+GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg,
+                               size_t *size);
+
+
+/**
+ * De-serializes configuration
+ *
+ * @param cfg configuration to update
+ * @param mem the memory block of serialized configuration
+ * @param size the size of the memory block
+ * @param allow_inline set to GNUNET_YES if we recursively load configuration
+ *          from inlined configurations; GNUNET_NO if not and raise warnings
+ *          when we come across them
+ * @return GNUNET_OK on success, GNUNET_ERROR on error
+ */
+int
+GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg,
+                                 const char *mem,
+                                 const size_t size,
+                                 int allow_inline);
+
+
 /**
  * Write configuration file.
  *
@@ -226,6 +270,23 @@ GNUNET_CONFIGURATION_get_value_time (const struct GNUNET_CONFIGURATION_Handle
                                      struct GNUNET_TIME_Relative *time);
 
 
+
+/**
+ * Get a configuration value that should be a size in bytes.
+ *
+ * @param cfg configuration to inspect
+ * @param section section of interest
+ * @param option option of interest
+ * @param size set to the size in bytes as stored in the configuration
+ * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ */
+int
+GNUNET_CONFIGURATION_get_value_size (const struct GNUNET_CONFIGURATION_Handle
+                                     *cfg, const char *section,
+                                     const char *option,
+                                     unsigned long long *size);
+
+
 /**
  * Test if we have a value for a particular option
  *
@@ -337,6 +398,7 @@ GNUNET_CONFIGURATION_get_value_yesno (const struct GNUNET_CONFIGURATION_Handle
                                       *cfg, const char *section,
                                       const char *option);
 
+
 /**
  * Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR"
  * where either in the "PATHS" section or the environtment
@@ -378,6 +440,7 @@ GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle *cfg,
                                        const char *section, const char *option,
                                        const char *value);
 
+
 /**
  * Remove a filename from a configuration value that
  * represents a list of filenames