[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3003 - GNUnet/src/include
From: |
grothoff |
Subject: |
[GNUnet-SVN] r3003 - GNUnet/src/include |
Date: |
Sat, 10 Jun 2006 11:36:10 -0700 (PDT) |
Author: grothoff
Date: 2006-06-10 11:36:07 -0700 (Sat, 10 Jun 2006)
New Revision: 3003
Added:
GNUnet/src/include/gnunet_config_impl.h
Modified:
GNUnet/src/include/Makefile.am
GNUnet/src/include/gnunet_config.h
Log:
rfc
Modified: GNUnet/src/include/Makefile.am
===================================================================
--- GNUnet/src/include/Makefile.am 2006-06-10 13:02:39 UTC (rev 3002)
+++ GNUnet/src/include/Makefile.am 2006-06-10 18:36:07 UTC (rev 3003)
@@ -15,6 +15,7 @@
gnunet_blockstore.h \
gnunet_bootstrap_service.h \
gnunet_config.h \
+ gnunet_config_impl.h \
gnunet_core.h \
gnunet_datastore_service.h \
gnunet_dht.h \
Modified: GNUnet/src/include/gnunet_config.h
===================================================================
--- GNUnet/src/include/gnunet_config.h 2006-06-10 13:02:39 UTC (rev 3002)
+++ GNUnet/src/include/gnunet_config.h 2006-06-10 18:36:07 UTC (rev 3003)
@@ -41,8 +41,6 @@
struct GC_Configuration;
-struct GC_Configuration * GC_create(void);
-
void GC_free(struct GC_Configuration * cfg);
/**
Added: GNUnet/src/include/gnunet_config_impl.h
===================================================================
--- GNUnet/src/include/gnunet_config_impl.h 2006-06-10 13:02:39 UTC (rev
3002)
+++ GNUnet/src/include/gnunet_config_impl.h 2006-06-10 18:36:07 UTC (rev
3003)
@@ -0,0 +1,202 @@
+/*
+ This file is part of GNUnet.
+ (C) 2006 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file include/gnunet_config_impl.h
+ * @brief configuration API
+ *
+ * @author Christian Grothoff
+ */
+
+#ifndef GNUNET_CONFIG_IMPL_H
+#define GNUNET_CONFIG_IMPL_H
+
+#include "gnunet_config.h"
+
+#ifdef __cplusplus
+extern "C" {
+#if 0 /* keep Emacsens' auto-indent happy */
+}
+#endif
+#endif
+
+typedef struct GC_Configuration {
+
+ void * internal;
+
+ void (*free)(struct GC_Configuration * cfg);
+
+ /**
+ * Set the context for reporting configuration IO errors
+ * (and errors reported by configuration change notification
+ * callbacks when reading a new configuration).
+ *
+ * Note that for setting options a different context can be
+ * used (since failing to change an option may have to be reported
+ * in a fundamentally different way to the user).
+ *
+ * @parm ectx maybe NULL, in that case errors will no longer
+ * be reported
+ */
+ void (*set_error_context)(struct GC_Configuration * cfg,
+ struct GE_Context * ectx);
+
+ /**
+ * Parse a configuration file, add all of the options in the
+ * file to the configuration environment.
+ * @return 0 on success, -1 on error
+ */
+ int (*parse_configuration)(struct GC_Configuration * cfg,
+ const char * filename);
+
+ /**
+ * Test if there are configuration options that were
+ * changed since the last save.
+ * @return 0 if clean, 1 if dirty, -1 on error (i.e. last save failed)
+ */
+ int (*test_dirty)(struct GC_Configuration * cfg);
+
+
+ /**
+ * Write configuration file.
+ * @return 0 on success, -1 on error
+ */
+ int (*write_configuration)(struct GC_Configuration * cfg,
+ const char * filename);
+
+ /**
+ * Get a configuration value that should be a number.
+ * @param min minimal legal value
+ * @param max maximal legal value
+ * @param default default value (use indicated by return value)
+ * @return 0 on success, -1 on error, 1 for default
+ */
+ int (*get_configuration_value_number)(struct GC_Configuration * cfg,
+ const char * section,
+ const char * option,
+ unsigned long long min,
+ unsigned long long max,
+ unsigned long long default,
+ unsigned long long * number);
+
+
+ /**
+ * Get a configuration value that should be a string.
+ * @param default default value (use indicated by return value;
+ * will NOT be aliased, maybe NULL)
+ * @param value will be set to a freshly allocated configuration
+ * value, or NULL if option is not specified and no default given
+ * @return 0 on success, -1 on error, 1 for default
+ */
+ int (*get_configuration_value_string)(struct GC_Configuration * cfg,
+ const char * section,
+ const char * option,
+ const char * default,
+ char ** value);
+
+ /**
+ * Get a configuration value that should be in a set of
+ * predefined strings
+ * @param choices NULL-terminated list of legal values
+ * @param default default value (use indicated by return value;
+ * will NOT be aliased, maybe NULL), must be reference
+ * into set given by choices
+ * @param value will be set to an entry in the legal list,
+ * or NULL if option is not specified and no default given
+ * @return 0 on success, -1 on error, 1 for default
+ */
+ int (*get_configuration_value_choice)(struct GC_Configuration * cfg,
+ const char * section,
+ const char * option,
+ const char ** choices,
+ const char * default,
+ (const char *)* value);
+
+ /**
+ * Set a configuration value that should be a number.
+ * @return 0 on success, -1 on error (i.e. out of memory,
+ * or update refused by registered callback)
+ */
+ int (*set_configuration_value_number)(struct GC_Configuration * cfg,
+ struct GE_Context * ectx
+ const char * section,
+ const char * option,
+ unsigned long long number);
+
+
+ /**
+ * Set a configuration value that should be a string.
+ * @param value
+ * @return 0 on success, -1 on error (i.e. out of memory,
+ * or update refused by registered callback)
+ */
+ int (*set_configuration_value_string)(struct GC_Configuration * cfg,
+ struct GE_Context * ectx
+ const char * section,
+ const char * option,
+ const char * value);
+
+ /**
+ * Set a configuration value that should be in a set of
+ * predefined strings.
+ * @param value
+ * @return 0 on success, -1 on error (i.e. out of memory,
+ * or update refused by registered callback)
+ */
+ int (*set_configuration_value_choice)(struct GC_Configuration * cfg,
+ struct GE_Context * ectx
+ const char * section,
+ const char * option,
+ const char * choice);
+
+ /**
+ * Attach a callback that is notified whenever a
+ * configuration option changes.
+ * @return 0 on success, -1 on error
+ */
+ int (*attachChangeListener)(struct GC_Configuration * cfg,
+ GC_ChangeListener callback,
+ void * ctx);
+
+ /**
+ * Attach a callback that is notified whenever a
+ * configuration option changes.
+ * @return 0 on success, -1 on error, 1 for no such handler registered
+ */
+ int (*detachChangeListener)(struct GC_Configuration * cfg,
+ GC_ChangeListener callback,
+ void * ctx);
+
+} GC_Configuration;
+
+/**
+ * Create a GC_Configuration (C implementation).
+ */
+GC_Configuration * GC_create_C_impl(void);
+
+
+#if 0 /* keep Emacsens' auto-indent happy */
+{
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Property changes on: GNUnet/src/include/gnunet_config_impl.h
___________________________________________________________________
Name: svn:eol-style
+ native
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3003 - GNUnet/src/include,
grothoff <=