diff options
-rw-r--r-- | HACKING | 2 | ||||
-rw-r--r-- | configure.ac | 11 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/datastore/Makefile.am | 69 | ||||
-rw-r--r-- | src/datastore/datastore.h | 34 | ||||
-rw-r--r-- | src/datastore/datastore_api.c | 160 | ||||
-rw-r--r-- | src/datastore/gnunet-service-datastore.c | 205 | ||||
-rw-r--r-- | src/datastore/plugin_datastore.h | 6 | ||||
-rw-r--r-- | src/datastore/plugin_datastore_sqlite.c | 286 | ||||
-rw-r--r-- | src/datastore/plugin_datastore_template.c | 286 | ||||
-rw-r--r-- | src/include/gnunet_datastore_service.h | 9 | ||||
-rw-r--r-- | src/include/gnunet_util_lib.h | 1 | ||||
-rw-r--r-- | src/resolver/gnunet-service-resolver.c | 2 | ||||
-rw-r--r-- | src/transport/Makefile.am | 2 |
14 files changed, 1061 insertions, 13 deletions
@@ -26,7 +26,7 @@ testcases: | |||
26 | 26 | ||
27 | performance tests: | 27 | performance tests: |
28 | - must be called "perf_module-under-test_case-description.c" | 28 | - must be called "perf_module-under-test_case-description.c" |
29 | - "case-description" maybe omitted if there is only one test | 29 | - "case-description" maybe omitted if there is only one performance test |
30 | 30 | ||
31 | 31 | ||
32 | 32 | ||
diff --git a/configure.ac b/configure.ac index 1fc3e2eb7..634ef34a1 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -750,17 +750,19 @@ AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"]) | |||
750 | 750 | ||
751 | 751 | ||
752 | 752 | ||
753 | AC_CONFIG_FILES([ po/Makefile.in m4/Makefile | 753 | AC_CONFIG_FILES([ |
754 | Makefile | 754 | Makefile |
755 | contrib/Makefile | 755 | contrib/Makefile |
756 | m4/Makefile | ||
757 | po/Makefile.in | ||
756 | src/Makefile | 758 | src/Makefile |
757 | src/arm/Makefile | 759 | src/arm/Makefile |
758 | src/core/Makefile | 760 | src/core/Makefile |
759 | src/include/Makefile | 761 | src/datastore/Makefile |
760 | src/include/gnunet_directories.h | ||
761 | src/util/Makefile | ||
762 | src/fragmentation/Makefile | 762 | src/fragmentation/Makefile |
763 | src/hello/Makefile | 763 | src/hello/Makefile |
764 | src/include/Makefile | ||
765 | src/include/gnunet_directories.h | ||
764 | src/hostlist/Makefile | 766 | src/hostlist/Makefile |
765 | src/peerinfo/Makefile | 767 | src/peerinfo/Makefile |
766 | src/resolver/Makefile | 768 | src/resolver/Makefile |
@@ -768,6 +770,7 @@ src/statistics/Makefile | |||
768 | src/template/Makefile | 770 | src/template/Makefile |
769 | src/topology/Makefile | 771 | src/topology/Makefile |
770 | src/transport/Makefile | 772 | src/transport/Makefile |
773 | src/util/Makefile | ||
771 | ]) | 774 | ]) |
772 | AC_OUTPUT | 775 | AC_OUTPUT |
773 | 776 | ||
diff --git a/src/Makefile.am b/src/Makefile.am index 4f3d7995a..c366ce20c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am | |||
@@ -11,6 +11,7 @@ SUBDIRS = \ | |||
11 | include $(INTLEMU_SUBDIRS) \ | 11 | include $(INTLEMU_SUBDIRS) \ |
12 | util \ | 12 | util \ |
13 | arm \ | 13 | arm \ |
14 | datastore \ | ||
14 | fragmentation \ | 15 | fragmentation \ |
15 | hello \ | 16 | hello \ |
16 | peerinfo \ | 17 | peerinfo \ |
diff --git a/src/datastore/Makefile.am b/src/datastore/Makefile.am new file mode 100644 index 000000000..839df983d --- /dev/null +++ b/src/datastore/Makefile.am | |||
@@ -0,0 +1,69 @@ | |||
1 | INCLUDES = -I$(top_srcdir)/src/include | ||
2 | |||
3 | plugindir = $(libdir)/gnunet | ||
4 | |||
5 | if MINGW | ||
6 | WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols | ||
7 | endif | ||
8 | |||
9 | if USE_COVERAGE | ||
10 | AM_CFLAGS = --coverage -O0 | ||
11 | XLIBS = -lgcov | ||
12 | endif | ||
13 | |||
14 | |||
15 | lib_LTLIBRARIES = \ | ||
16 | libgnunetdatastore.la | ||
17 | |||
18 | libgnunetdatastore_la_SOURCES = \ | ||
19 | datastore_api.c datastore.h | ||
20 | libgnunetdatastore_la_LIBADD = \ | ||
21 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
22 | $(GN_LIBINTL) | ||
23 | libgnunetdatastore_la_LDFLAGS = \ | ||
24 | $(GN_LIB_LDFLAGS) $(WINFLAGS) \ | ||
25 | -version-info 0:0:0 | ||
26 | |||
27 | |||
28 | bin_PROGRAMS = \ | ||
29 | gnunet-service-datastore | ||
30 | |||
31 | gnunet_service_datastore_SOURCES = \ | ||
32 | gnunet-service-datastore.c plugin_datastore.h | ||
33 | gnunet_service_datastore_LDADD = \ | ||
34 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
35 | $(GN_LIBINTL) | ||
36 | |||
37 | |||
38 | plugin_LTLIBRARIES = \ | ||
39 | libgnunet_plugin_datastore_sqlite.la \ | ||
40 | libgnunet_plugin_datastore_template.la | ||
41 | |||
42 | |||
43 | libgnunet_plugin_datastore_sqlite_la_SOURCES = \ | ||
44 | plugin_datastore_sqlite.c | ||
45 | libgnunet_plugin_datastore_sqlite_la_LIBADD = \ | ||
46 | $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lsqlite3 | ||
47 | libgnunet_plugin_datastore_sqlite_la_LDFLAGS = \ | ||
48 | $(GN_PLUGIN_LDFLAGS) | ||
49 | |||
50 | libgnunet_plugin_datastore_template_la_SOURCES = \ | ||
51 | plugin_datastore_template.c | ||
52 | libgnunet_plugin_datastore_template_la_LIBADD = \ | ||
53 | $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) | ||
54 | libgnunet_plugin_datastore_template_la_LDFLAGS = \ | ||
55 | $(GN_PLUGIN_LDFLAGS) | ||
56 | |||
57 | |||
58 | #check_PROGRAMS = \ | ||
59 | # test_datastore_api | ||
60 | # | ||
61 | #TESTS = $(check_PROGRAMS) | ||
62 | # | ||
63 | #test_datastore_api_SOURCES = \ | ||
64 | # test_datastore_api.c | ||
65 | #test_datastore_api_LDADD = \ | ||
66 | # $(top_builddir)/src/datastore/libgnunetdatastore.la \ | ||
67 | # $(top_builddir)/src/util/libgnunetutil.la | ||
68 | |||
69 | |||
diff --git a/src/datastore/datastore.h b/src/datastore/datastore.h new file mode 100644 index 000000000..e6860efbb --- /dev/null +++ b/src/datastore/datastore.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | (C) 2004, 2005, 2006, 2007, 2009 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 2, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file datastore/datastore.hc | ||
23 | * @brief structs for communication between datastore service and API | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | |||
27 | #ifndef DATASTORE_H | ||
28 | #define DATASTORE_H | ||
29 | |||
30 | #include "gnunet_util_lib.h" | ||
31 | |||
32 | |||
33 | |||
34 | #endif | ||
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c new file mode 100644 index 000000000..cc563ba79 --- /dev/null +++ b/src/datastore/datastore_api.c | |||
@@ -0,0 +1,160 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | (C) 2004, 2005, 2006, 2007, 2009 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 2, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file datastore/datastore_api.c | ||
23 | * @brief Management for the datastore for files stored on a GNUnet node | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | |||
27 | #include "platform.h" | ||
28 | #include "gnunet_datastore_service.h" | ||
29 | #include "datastore.h" | ||
30 | |||
31 | /** | ||
32 | * Handle to the datastore service. | ||
33 | */ | ||
34 | struct GNUNET_DATASTORE_Handle | ||
35 | { | ||
36 | }; | ||
37 | |||
38 | |||
39 | /** | ||
40 | * Connect to the datastore service. | ||
41 | * | ||
42 | * @param cfg configuration to use | ||
43 | * @param sched scheduler to use | ||
44 | * @return handle to use to access the service | ||
45 | */ | ||
46 | struct GNUNET_DATASTORE_Handle *GNUNET_DATASTORE_connect (struct | ||
47 | GNUNET_CONFIGURATION_Handle | ||
48 | *cfg, | ||
49 | struct | ||
50 | GNUNET_SCHEDULER_Handle | ||
51 | *sched) | ||
52 | { | ||
53 | return NULL; | ||
54 | } | ||
55 | |||
56 | |||
57 | /** | ||
58 | * Disconnect from the datastore service (and free | ||
59 | * associated resources). | ||
60 | * | ||
61 | * @param h handle to the datastore | ||
62 | * @param drop set to GNUNET_YES to delete all data in datastore (!) | ||
63 | */ | ||
64 | void GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h, | ||
65 | int drop) | ||
66 | { | ||
67 | } | ||
68 | |||
69 | |||
70 | /** | ||
71 | * Get the current on-disk size of the datastore. | ||
72 | * @param h handle to the datastore | ||
73 | * @return size estimate, -1 if datastore is not available (yet) | ||
74 | */ | ||
75 | unsigned long long GNUNET_DATASTORE_size (struct GNUNET_DATASTORE_Handle *h) | ||
76 | { | ||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | |||
81 | /** | ||
82 | * Store an item in the datastore. If the item is already present, | ||
83 | * the priorities are summed up and the higher expiration time and | ||
84 | * lower anonymity level is used. | ||
85 | * | ||
86 | * @param h handle to the datastore | ||
87 | * @param key key for the value | ||
88 | * @param size number of bytes in data | ||
89 | * @param data content stored | ||
90 | * @param type type of the content | ||
91 | * @param priority priority of the content | ||
92 | * @param anonymity anonymity-level for the content | ||
93 | * @param expiration expiration time for the content | ||
94 | */ | ||
95 | void | ||
96 | GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, | ||
97 | const GNUNET_HashCode * key, | ||
98 | uint32_t size, | ||
99 | const void *data, | ||
100 | uint32_t type, | ||
101 | uint32_t priority, | ||
102 | uint32_t anonymity, | ||
103 | struct GNUNET_TIME_Absolute expiration) | ||
104 | { | ||
105 | } | ||
106 | |||
107 | |||
108 | /** | ||
109 | * Iterate over the results for a particular key | ||
110 | * in the datastore. | ||
111 | * | ||
112 | * @param h handle to the datastore | ||
113 | * @param key maybe NULL (to match all entries) | ||
114 | * @param type desired type, 0 for any | ||
115 | * @param iter function to call on each matching value; | ||
116 | * will be called once with a NULL value at the end | ||
117 | * @param iter_cls closure for iter | ||
118 | */ | ||
119 | void | ||
120 | GNUNET_DATASTORE_get (struct GNUNET_DATASTORE_Handle *h, | ||
121 | const GNUNET_HashCode * key, | ||
122 | uint32_t type, | ||
123 | GNUNET_DATASTORE_Iterator iter, void *iter_cls) | ||
124 | { | ||
125 | } | ||
126 | |||
127 | |||
128 | /** | ||
129 | * Get a random value from the datastore. | ||
130 | * | ||
131 | * @param h handle to the datastore | ||
132 | * @param iter function to call on each matching value; | ||
133 | * will be called exactly once; if no values | ||
134 | * are available, the value will be NULL. | ||
135 | * @param iter_cls closure for iter | ||
136 | */ | ||
137 | void | ||
138 | GNUNET_DATASTORE_get_random (struct GNUNET_DATASTORE_Handle *h, | ||
139 | GNUNET_DATASTORE_Iterator iter, void *iter_cls) | ||
140 | { | ||
141 | } | ||
142 | |||
143 | |||
144 | /** | ||
145 | * Explicitly remove some content from the database. | ||
146 | * | ||
147 | * @param h handle to the datastore | ||
148 | * @param key key for the value | ||
149 | * @param size number of bytes in data | ||
150 | * @param data content stored | ||
151 | */ | ||
152 | void | ||
153 | GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h, | ||
154 | const GNUNET_HashCode * key, | ||
155 | uint32_t size, const void *data) | ||
156 | { | ||
157 | } | ||
158 | |||
159 | |||
160 | /* end of datastore_api.c */ | ||
diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c new file mode 100644 index 000000000..8ee153db0 --- /dev/null +++ b/src/datastore/gnunet-service-datastore.c | |||
@@ -0,0 +1,205 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | (C) 2004, 2005, 2006, 2007, 2009 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 2, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file datastore/gnunet-service-datastore.c | ||
23 | * @brief Management for the datastore for files stored on a GNUnet node | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | |||
27 | #include "platform.h" | ||
28 | #include "gnunet_util_lib.h" | ||
29 | #include "gnunet_protocols.h" | ||
30 | #include "plugin_datastore.h" | ||
31 | #include "datastore.h" | ||
32 | |||
33 | |||
34 | /** | ||
35 | * Our datastore plugin. | ||
36 | */ | ||
37 | struct DatastorePlugin | ||
38 | { | ||
39 | |||
40 | /** | ||
41 | * API of the transport as returned by the plugin's | ||
42 | * initialization function. | ||
43 | */ | ||
44 | struct GNUNET_DATSTORE_PluginFunctions *api; | ||
45 | |||
46 | /** | ||
47 | * Short name for the plugin (i.e. "sqlite"). | ||
48 | */ | ||
49 | char *short_name; | ||
50 | |||
51 | /** | ||
52 | * Name of the library (i.e. "gnunet_plugin_datastore_sqlite"). | ||
53 | */ | ||
54 | char *lib_name; | ||
55 | |||
56 | /** | ||
57 | * Environment this transport service is using | ||
58 | * for this plugin. | ||
59 | */ | ||
60 | struct GNUNET_DATASTORE_PluginEnvironment env; | ||
61 | |||
62 | }; | ||
63 | |||
64 | |||
65 | /** | ||
66 | * Our datastore plugin (NULL if not available). | ||
67 | */ | ||
68 | static struct DatastorePlugin *plugin; | ||
69 | |||
70 | |||
71 | /** | ||
72 | * List of handlers for the messages understood by this | ||
73 | * service. | ||
74 | */ | ||
75 | static struct GNUNET_SERVER_MessageHandler handlers[] = { | ||
76 | /* {&handle_xxx, NULL, GNUNET_MESSAGE_TYPE_DATASTORE_XXX, 0}, */ | ||
77 | {NULL, NULL, 0, 0} | ||
78 | }; | ||
79 | |||
80 | |||
81 | |||
82 | /** | ||
83 | * Load the datastore plugin. | ||
84 | */ | ||
85 | static struct DatastorePlugin * | ||
86 | load_plugin (struct GNUNET_CONFIGURATION_Handle *cfg, | ||
87 | struct GNUNET_SCHEDULER_Handle *sched) | ||
88 | { | ||
89 | struct DatastorePlugin *ret; | ||
90 | char *libname; | ||
91 | char *name; | ||
92 | |||
93 | if (GNUNET_OK != | ||
94 | GNUNET_CONFIGURATION_get_value_string (cfg, | ||
95 | "DATASTORE", "DATABASE", &name)) | ||
96 | { | ||
97 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
98 | _("No `%s' specified for `%s' in configuration!\n"), | ||
99 | "DATABASE", | ||
100 | "DATASTORE"); | ||
101 | return NULL; | ||
102 | } | ||
103 | ret = GNUNET_malloc (sizeof(struct DatastorePlugin)); | ||
104 | ret->env.cfg = cfg; | ||
105 | ret->env.sched = sched; | ||
106 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
107 | _("Loading `%s' datastore plugin\n"), name); | ||
108 | GNUNET_asprintf (&libname, "libgnunet_plugin_datastore_%s", name); | ||
109 | ret->short_name = GNUNET_strdup (name); | ||
110 | ret->lib_name = libname; | ||
111 | ret->api = GNUNET_PLUGIN_load (libname, &ret->env); | ||
112 | if (ret->api == NULL) | ||
113 | { | ||
114 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
115 | _("Failed to load datastore plugin for `%s'\n"), name); | ||
116 | GNUNET_free (ret->short_name); | ||
117 | GNUNET_free (libname); | ||
118 | GNUNET_free (ret); | ||
119 | return NULL; | ||
120 | } | ||
121 | return ret; | ||
122 | } | ||
123 | |||
124 | |||
125 | /** | ||
126 | * Function called when the service shuts | ||
127 | * down. Unloads our datastore plugin. | ||
128 | * | ||
129 | * @param cls closure | ||
130 | * @param cfg configuration to use | ||
131 | */ | ||
132 | static void | ||
133 | unload_plugin (struct DatastorePlugin *plug) | ||
134 | { | ||
135 | #if DEBUG_DATASTORE | ||
136 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
137 | "Datastore service is unloading plugin...\n"); | ||
138 | #endif | ||
139 | GNUNET_break (NULL == GNUNET_PLUGIN_unload (plug->lib_name, plug->api)); | ||
140 | GNUNET_free (plug->lib_name); | ||
141 | GNUNET_free (plug->short_name); | ||
142 | GNUNET_free (plug); | ||
143 | } | ||
144 | |||
145 | |||
146 | /** | ||
147 | * Last task run during shutdown. Disconnects us from | ||
148 | * the transport and core. | ||
149 | */ | ||
150 | static void | ||
151 | cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
152 | { | ||
153 | unload_plugin (plugin); | ||
154 | plugin = NULL; | ||
155 | } | ||
156 | |||
157 | |||
158 | /** | ||
159 | * Process datastore requests. | ||
160 | * | ||
161 | * @param cls closure | ||
162 | * @param sched scheduler to use | ||
163 | * @param server the initialized server | ||
164 | * @param cfg configuration to use | ||
165 | */ | ||
166 | static void | ||
167 | run (void *cls, | ||
168 | struct GNUNET_SCHEDULER_Handle *sched, | ||
169 | struct GNUNET_SERVER_Handle *server, | ||
170 | struct GNUNET_CONFIGURATION_Handle *cfg) | ||
171 | { | ||
172 | plugin = load_plugin (cfg, sched); | ||
173 | if (NULL == plugin) | ||
174 | return; | ||
175 | GNUNET_SERVER_add_handlers (server, handlers); | ||
176 | GNUNET_SCHEDULER_add_delayed (sched, | ||
177 | GNUNET_YES, | ||
178 | GNUNET_SCHEDULER_PRIORITY_IDLE, | ||
179 | GNUNET_SCHEDULER_NO_PREREQUISITE_TASK, | ||
180 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
181 | &cleaning_task, NULL); | ||
182 | } | ||
183 | |||
184 | |||
185 | /** | ||
186 | * The main function for the datastore service. | ||
187 | * | ||
188 | * @param argc number of arguments from the command line | ||
189 | * @param argv command line arguments | ||
190 | * @return 0 ok, 1 on error | ||
191 | */ | ||
192 | int | ||
193 | main (int argc, char *const *argv) | ||
194 | { | ||
195 | int ret; | ||
196 | |||
197 | ret = (GNUNET_OK == | ||
198 | GNUNET_SERVICE_run (argc, | ||
199 | argv, | ||
200 | "datastore", &run, NULL, NULL, NULL)) ? 0 : 1; | ||
201 | return ret; | ||
202 | } | ||
203 | |||
204 | |||
205 | /* end of gnunet-service-datastore.c */ | ||
diff --git a/src/datastore/plugin_datastore.h b/src/datastore/plugin_datastore.h index b4dc87f9d..0f3284b07 100644 --- a/src/datastore/plugin_datastore.h +++ b/src/datastore/plugin_datastore.h | |||
@@ -79,7 +79,7 @@ typedef void | |||
79 | const GNUNET_HashCode * key, | 79 | const GNUNET_HashCode * key, |
80 | uint32_t size, | 80 | uint32_t size, |
81 | const void *data, | 81 | const void *data, |
82 | unit32_t type, | 82 | uint32_t type, |
83 | uint32_t priority, | 83 | uint32_t priority, |
84 | uint32_t anonymity, | 84 | uint32_t anonymity, |
85 | struct GNUNET_TIME_Absolute expiration); | 85 | struct GNUNET_TIME_Absolute expiration); |
@@ -175,7 +175,7 @@ struct GNUNET_DATASTORE_PluginFunctions | |||
175 | * Get the current on-disk size of the SQ store. Estimates are | 175 | * Get the current on-disk size of the SQ store. Estimates are |
176 | * fine, if that's the only thing available. | 176 | * fine, if that's the only thing available. |
177 | */ | 177 | */ |
178 | GNUNET_DATASTORE_GetSize size; | 178 | GNUNET_DATASTORE_GetSize get_size; |
179 | 179 | ||
180 | /** | 180 | /** |
181 | * Function to store an item in the datastore. | 181 | * Function to store an item in the datastore. |
@@ -213,7 +213,7 @@ struct GNUNET_DATASTORE_PluginFunctions | |||
213 | * Iterate over the items in the datastore in ascending | 213 | * Iterate over the items in the datastore in ascending |
214 | * order of expiration time. | 214 | * order of expiration time. |
215 | */ | 215 | */ |
216 | GNUNET_DATSTORE_Selector iter_ascending_expiration; | 216 | GNUNET_DATASTORE_Selector iter_ascending_expiration; |
217 | 217 | ||
218 | /** | 218 | /** |
219 | * Iterate over the items in the datastore in migration | 219 | * Iterate over the items in the datastore in migration |
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c new file mode 100644 index 000000000..486b9b96e --- /dev/null +++ b/src/datastore/plugin_datastore_sqlite.c | |||
@@ -0,0 +1,286 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | (C) 2009 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 2, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file datastore/plugin_datastore_sqlite.c | ||
23 | * @brief sqlite-based datastore backend | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | |||
27 | #include "platform.h" | ||
28 | #include "plugin_datastore.h" | ||
29 | |||
30 | |||
31 | /** | ||
32 | * Context for all functions in this plugin. | ||
33 | */ | ||
34 | struct Plugin | ||
35 | { | ||
36 | /** | ||
37 | * Our execution environment. | ||
38 | */ | ||
39 | struct GNUNET_DATASTORE_PluginEnvironment *env; | ||
40 | }; | ||
41 | |||
42 | |||
43 | /** | ||
44 | * Get an estimate of how much space the database is | ||
45 | * currently using. | ||
46 | * @return number of bytes used on disk | ||
47 | */ | ||
48 | static unsigned long long sqlite_plugin_get_size (void *cls) | ||
49 | { | ||
50 | return 0; | ||
51 | } | ||
52 | |||
53 | |||
54 | /** | ||
55 | * Store an item in the datastore. | ||
56 | * | ||
57 | * @param cls closure | ||
58 | * @param key key for the item | ||
59 | * @param size number of bytes in data | ||
60 | * @param data content stored | ||
61 | * @param type type of the content | ||
62 | * @param priority priority of the content | ||
63 | * @param anonymity anonymity-level for the content | ||
64 | * @param expiration expiration time for the content | ||
65 | */ | ||
66 | static void | ||
67 | sqlite_plugin_put (void *cls, | ||
68 | const GNUNET_HashCode * key, | ||
69 | uint32_t size, | ||
70 | const void *data, | ||
71 | uint32_t type, | ||
72 | uint32_t priority, | ||
73 | uint32_t anonymity, | ||
74 | struct GNUNET_TIME_Absolute expiration) | ||
75 | { | ||
76 | } | ||
77 | |||
78 | |||
79 | /** | ||
80 | * Iterate over the results for a particular key | ||
81 | * in the datastore. | ||
82 | * | ||
83 | * @param cls closure | ||
84 | * @param key maybe NULL (to match all entries) | ||
85 | * @param vhash hash of the value, maybe NULL (to | ||
86 | * match all values that have the right key). | ||
87 | * Note that for DBlocks there is no difference | ||
88 | * betwen key and vhash, but for other blocks | ||
89 | * there may be! | ||
90 | * @param type entries of which type are relevant? | ||
91 | * Use 0 for any type. | ||
92 | * @param iter function to call on each matching value; | ||
93 | * will be called once with a NULL value at the end | ||
94 | * @param iter_cls closure for iter | ||
95 | */ | ||
96 | static void | ||
97 | sqlite_plugin_get (void *cls, | ||
98 | const GNUNET_HashCode * key, | ||
99 | const GNUNET_HashCode * vhash, | ||
100 | uint32_t type, | ||
101 | GNUNET_DATASTORE_Iterator iter, void *iter_cls) | ||
102 | { | ||
103 | } | ||
104 | |||
105 | |||
106 | /** | ||
107 | * Update the priority for a particular key in the datastore. If | ||
108 | * the expiration time in value is different than the time found in | ||
109 | * the datastore, the higher value should be kept. For the | ||
110 | * anonymity level, the lower value is to be used. The specified | ||
111 | * priority should be added to the existing priority, ignoring the | ||
112 | * priority in value. | ||
113 | * | ||
114 | * Note that it is possible for multiple values to match this put. | ||
115 | * In that case, all of the respective values are updated. | ||
116 | * | ||
117 | * @param uid unique identifier of the datum | ||
118 | * @param delta by how much should the priority | ||
119 | * change? If priority + delta < 0 the | ||
120 | * priority should be set to 0 (never go | ||
121 | * negative). | ||
122 | * @param expire new expiration time should be the | ||
123 | * MAX of any existing expiration time and | ||
124 | * this value | ||
125 | */ | ||
126 | static void | ||
127 | sqlite_plugin_update (void *cls, | ||
128 | unsigned long long uid, | ||
129 | int delta, struct GNUNET_TIME_Absolute expire) | ||
130 | { | ||
131 | } | ||
132 | |||
133 | |||
134 | /** | ||
135 | * Select a subset of the items in the datastore and call | ||
136 | * the given iterator for each of them. | ||
137 | * | ||
138 | * @param type entries of which type should be considered? | ||
139 | * Use 0 for any type. | ||
140 | * @param iter function to call on each matching value; | ||
141 | * will be called once with a NULL value at the end | ||
142 | * @param iter_cls closure for iter | ||
143 | */ | ||
144 | static void | ||
145 | sqlite_plugin_iter_low_priority (void *cls, | ||
146 | uint32_t type, | ||
147 | GNUNET_DATASTORE_Iterator iter, | ||
148 | void *iter_cls) | ||
149 | { | ||
150 | } | ||
151 | |||
152 | |||
153 | |||
154 | /** | ||
155 | * Select a subset of the items in the datastore and call | ||
156 | * the given iterator for each of them. | ||
157 | * | ||
158 | * @param type entries of which type should be considered? | ||
159 | * Use 0 for any type. | ||
160 | * @param iter function to call on each matching value; | ||
161 | * will be called once with a NULL value at the end | ||
162 | * @param iter_cls closure for iter | ||
163 | */ | ||
164 | static void | ||
165 | sqlite_plugin_iter_zero_anonymity (void *cls, | ||
166 | uint32_t type, | ||
167 | GNUNET_DATASTORE_Iterator iter, | ||
168 | void *iter_cls) | ||
169 | { | ||
170 | } | ||
171 | |||
172 | |||
173 | |||
174 | /** | ||
175 | * Select a subset of the items in the datastore and call | ||
176 | * the given iterator for each of them. | ||
177 | * | ||
178 | * @param type entries of which type should be considered? | ||
179 | * Use 0 for any type. | ||
180 | * @param iter function to call on each matching value; | ||
181 | * will be called once with a NULL value at the end | ||
182 | * @param iter_cls closure for iter | ||
183 | */ | ||
184 | static void | ||
185 | sqlite_plugin_iter_ascending_expiration (void *cls, | ||
186 | uint32_t type, | ||
187 | GNUNET_DATASTORE_Iterator iter, | ||
188 | void *iter_cls) | ||
189 | { | ||
190 | } | ||
191 | |||
192 | |||
193 | |||
194 | /** | ||
195 | * Select a subset of the items in the datastore and call | ||
196 | * the given iterator for each of them. | ||
197 | * | ||
198 | * @param type entries of which type should be considered? | ||
199 | * Use 0 for any type. | ||
200 | * @param iter function to call on each matching value; | ||
201 | * will be called once with a NULL value at the end | ||
202 | * @param iter_cls closure for iter | ||
203 | */ | ||
204 | static void | ||
205 | sqlite_plugin_iter_migration_order (void *cls, | ||
206 | uint32_t type, | ||
207 | GNUNET_DATASTORE_Iterator iter, | ||
208 | void *iter_cls) | ||
209 | { | ||
210 | } | ||
211 | |||
212 | |||
213 | |||
214 | /** | ||
215 | * Select a subset of the items in the datastore and call | ||
216 | * the given iterator for each of them. | ||
217 | * | ||
218 | * @param type entries of which type should be considered? | ||
219 | * Use 0 for any type. | ||
220 | * @param iter function to call on each matching value; | ||
221 | * will be called once with a NULL value at the end | ||
222 | * @param iter_cls closure for iter | ||
223 | */ | ||
224 | static void | ||
225 | sqlite_plugin_iter_all_now (void *cls, | ||
226 | uint32_t type, | ||
227 | GNUNET_DATASTORE_Iterator iter, | ||
228 | void *iter_cls) | ||
229 | { | ||
230 | } | ||
231 | |||
232 | |||
233 | /** | ||
234 | * Drop database. | ||
235 | */ | ||
236 | static void | ||
237 | sqlite_plugin_drop (void *cls) | ||
238 | { | ||
239 | } | ||
240 | |||
241 | |||
242 | /** | ||
243 | * Entry point for the plugin. | ||
244 | */ | ||
245 | void * | ||
246 | libgnunet_plugin_datastore_sqlite_init (void *cls) | ||
247 | { | ||
248 | struct GNUNET_DATASTORE_PluginEnvironment *env = cls; | ||
249 | struct GNUNET_DATASTORE_PluginFunctions *api; | ||
250 | struct Plugin *plugin; | ||
251 | |||
252 | plugin = GNUNET_malloc (sizeof (struct Plugin)); | ||
253 | plugin->env = env; | ||
254 | api = GNUNET_malloc (sizeof (struct GNUNET_DATASTORE_PluginFunctions)); | ||
255 | api->cls = plugin; | ||
256 | api->get_size = &sqlite_plugin_get_size; | ||
257 | api->put = &sqlite_plugin_put; | ||
258 | api->get = &sqlite_plugin_get; | ||
259 | api->update = &sqlite_plugin_update; | ||
260 | api->iter_low_priority = &sqlite_plugin_iter_low_priority; | ||
261 | api->iter_zero_anonymity = &sqlite_plugin_iter_zero_anonymity; | ||
262 | api->iter_ascending_expiration = &sqlite_plugin_iter_ascending_expiration; | ||
263 | api->iter_migration_order = &sqlite_plugin_iter_migration_order; | ||
264 | api->iter_all_now = &sqlite_plugin_iter_all_now; | ||
265 | api->drop = &sqlite_plugin_drop; | ||
266 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, | ||
267 | "sqlite", _("Sqlite database running\n")); | ||
268 | return api; | ||
269 | } | ||
270 | |||
271 | |||
272 | /** | ||
273 | * Exit point from the plugin. | ||
274 | */ | ||
275 | void * | ||
276 | libgnunet_plugin_datastore_sqlite_done (void *cls) | ||
277 | { | ||
278 | struct GNUNET_DATASTORE_PluginFunctions *api = cls; | ||
279 | struct Plugin *plugin = api->cls; | ||
280 | |||
281 | GNUNET_free (plugin); | ||
282 | GNUNET_free (api); | ||
283 | return NULL; | ||
284 | } | ||
285 | |||
286 | /* end of plugin_datastore_sqlite.c */ | ||
diff --git a/src/datastore/plugin_datastore_template.c b/src/datastore/plugin_datastore_template.c new file mode 100644 index 000000000..70b8c635e --- /dev/null +++ b/src/datastore/plugin_datastore_template.c | |||
@@ -0,0 +1,286 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | (C) 2009 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 2, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file datastore/plugin_datastore_template.c | ||
23 | * @brief template-based datastore backend | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | |||
27 | #include "platform.h" | ||
28 | #include "plugin_datastore.h" | ||
29 | |||
30 | |||
31 | /** | ||
32 | * Context for all functions in this plugin. | ||
33 | */ | ||
34 | struct Plugin | ||
35 | { | ||
36 | /** | ||
37 | * Our execution environment. | ||
38 | */ | ||
39 | struct GNUNET_DATASTORE_PluginEnvironment *env; | ||
40 | }; | ||
41 | |||
42 | |||
43 | /** | ||
44 | * Get an estimate of how much space the database is | ||
45 | * currently using. | ||
46 | * @return number of bytes used on disk | ||
47 | */ | ||
48 | static unsigned long long template_plugin_get_size (void *cls) | ||
49 | { | ||
50 | return 0; | ||
51 | } | ||
52 | |||
53 | |||
54 | /** | ||
55 | * Store an item in the datastore. | ||
56 | * | ||
57 | * @param cls closure | ||
58 | * @param key key for the item | ||
59 | * @param size number of bytes in data | ||
60 | * @param data content stored | ||
61 | * @param type type of the content | ||
62 | * @param priority priority of the content | ||
63 | * @param anonymity anonymity-level for the content | ||
64 | * @param expiration expiration time for the content | ||
65 | */ | ||
66 | static void | ||
67 | template_plugin_put (void *cls, | ||
68 | const GNUNET_HashCode * key, | ||
69 | uint32_t size, | ||
70 | const void *data, | ||
71 | uint32_t type, | ||
72 | uint32_t priority, | ||
73 | uint32_t anonymity, | ||
74 | struct GNUNET_TIME_Absolute expiration) | ||
75 | { | ||
76 | } | ||
77 | |||
78 | |||
79 | /** | ||
80 | * Iterate over the results for a particular key | ||
81 | * in the datastore. | ||
82 | * | ||
83 | * @param cls closure | ||
84 | * @param key maybe NULL (to match all entries) | ||
85 | * @param vhash hash of the value, maybe NULL (to | ||
86 | * match all values that have the right key). | ||
87 | * Note that for DBlocks there is no difference | ||
88 | * betwen key and vhash, but for other blocks | ||
89 | * there may be! | ||
90 | * @param type entries of which type are relevant? | ||
91 | * Use 0 for any type. | ||
92 | * @param iter function to call on each matching value; | ||
93 | * will be called once with a NULL value at the end | ||
94 | * @param iter_cls closure for iter | ||
95 | */ | ||
96 | static void | ||
97 | template_plugin_get (void *cls, | ||
98 | const GNUNET_HashCode * key, | ||
99 | const GNUNET_HashCode * vhash, | ||
100 | uint32_t type, | ||
101 | GNUNET_DATASTORE_Iterator iter, void *iter_cls) | ||
102 | { | ||
103 | } | ||
104 | |||
105 | |||
106 | /** | ||
107 | * Update the priority for a particular key in the datastore. If | ||
108 | * the expiration time in value is different than the time found in | ||
109 | * the datastore, the higher value should be kept. For the | ||
110 | * anonymity level, the lower value is to be used. The specified | ||
111 | * priority should be added to the existing priority, ignoring the | ||
112 | * priority in value. | ||
113 | * | ||
114 | * Note that it is possible for multiple values to match this put. | ||
115 | * In that case, all of the respective values are updated. | ||
116 | * | ||
117 | * @param uid unique identifier of the datum | ||
118 | * @param delta by how much should the priority | ||
119 | * change? If priority + delta < 0 the | ||
120 | * priority should be set to 0 (never go | ||
121 | * negative). | ||
122 | * @param expire new expiration time should be the | ||
123 | * MAX of any existing expiration time and | ||
124 | * this value | ||
125 | */ | ||
126 | static void | ||
127 | template_plugin_update (void *cls, | ||
128 | unsigned long long uid, | ||
129 | int delta, struct GNUNET_TIME_Absolute expire) | ||
130 | { | ||
131 | } | ||
132 | |||
133 | |||
134 | /** | ||
135 | * Select a subset of the items in the datastore and call | ||
136 | * the given iterator for each of them. | ||
137 | * | ||
138 | * @param type entries of which type should be considered? | ||
139 | * Use 0 for any type. | ||
140 | * @param iter function to call on each matching value; | ||
141 | * will be called once with a NULL value at the end | ||
142 | * @param iter_cls closure for iter | ||
143 | */ | ||
144 | static void | ||
145 | template_plugin_iter_low_priority (void *cls, | ||
146 | uint32_t type, | ||
147 | GNUNET_DATASTORE_Iterator iter, | ||
148 | void *iter_cls) | ||
149 | { | ||
150 | } | ||
151 | |||
152 | |||
153 | |||
154 | /** | ||
155 | * Select a subset of the items in the datastore and call | ||
156 | * the given iterator for each of them. | ||
157 | * | ||
158 | * @param type entries of which type should be considered? | ||
159 | * Use 0 for any type. | ||
160 | * @param iter function to call on each matching value; | ||
161 | * will be called once with a NULL value at the end | ||
162 | * @param iter_cls closure for iter | ||
163 | */ | ||
164 | static void | ||
165 | template_plugin_iter_zero_anonymity (void *cls, | ||
166 | uint32_t type, | ||
167 | GNUNET_DATASTORE_Iterator iter, | ||
168 | void *iter_cls) | ||
169 | { | ||
170 | } | ||
171 | |||
172 | |||
173 | |||
174 | /** | ||
175 | * Select a subset of the items in the datastore and call | ||
176 | * the given iterator for each of them. | ||
177 | * | ||
178 | * @param type entries of which type should be considered? | ||
179 | * Use 0 for any type. | ||
180 | * @param iter function to call on each matching value; | ||
181 | * will be called once with a NULL value at the end | ||
182 | * @param iter_cls closure for iter | ||
183 | */ | ||
184 | static void | ||
185 | template_plugin_iter_ascending_expiration (void *cls, | ||
186 | uint32_t type, | ||
187 | GNUNET_DATASTORE_Iterator iter, | ||
188 | void *iter_cls) | ||
189 | { | ||
190 | } | ||
191 | |||
192 | |||
193 | |||
194 | /** | ||
195 | * Select a subset of the items in the datastore and call | ||
196 | * the given iterator for each of them. | ||
197 | * | ||
198 | * @param type entries of which type should be considered? | ||
199 | * Use 0 for any type. | ||
200 | * @param iter function to call on each matching value; | ||
201 | * will be called once with a NULL value at the end | ||
202 | * @param iter_cls closure for iter | ||
203 | */ | ||
204 | static void | ||
205 | template_plugin_iter_migration_order (void *cls, | ||
206 | uint32_t type, | ||
207 | GNUNET_DATASTORE_Iterator iter, | ||
208 | void *iter_cls) | ||
209 | { | ||
210 | } | ||
211 | |||
212 | |||
213 | |||
214 | /** | ||
215 | * Select a subset of the items in the datastore and call | ||
216 | * the given iterator for each of them. | ||
217 | * | ||
218 | * @param type entries of which type should be considered? | ||
219 | * Use 0 for any type. | ||
220 | * @param iter function to call on each matching value; | ||
221 | * will be called once with a NULL value at the end | ||
222 | * @param iter_cls closure for iter | ||
223 | */ | ||
224 | static void | ||
225 | template_plugin_iter_all_now (void *cls, | ||
226 | uint32_t type, | ||
227 | GNUNET_DATASTORE_Iterator iter, | ||
228 | void *iter_cls) | ||
229 | { | ||
230 | } | ||
231 | |||
232 | |||
233 | /** | ||
234 | * Drop database. | ||
235 | */ | ||
236 | static void | ||
237 | template_plugin_drop (void *cls) | ||
238 | { | ||
239 | } | ||
240 | |||
241 | |||
242 | /** | ||
243 | * Entry point for the plugin. | ||
244 | */ | ||
245 | void * | ||
246 | libgnunet_plugin_datastore_template_init (void *cls) | ||
247 | { | ||
248 | struct GNUNET_DATASTORE_PluginEnvironment *env = cls; | ||
249 | struct GNUNET_DATASTORE_PluginFunctions *api; | ||
250 | struct Plugin *plugin; | ||
251 | |||
252 | plugin = GNUNET_malloc (sizeof (struct Plugin)); | ||
253 | plugin->env = env; | ||
254 | api = GNUNET_malloc (sizeof (struct GNUNET_DATASTORE_PluginFunctions)); | ||
255 | api->cls = plugin; | ||
256 | api->get_size = &template_plugin_get_size; | ||
257 | api->put = &template_plugin_put; | ||
258 | api->get = &template_plugin_get; | ||
259 | api->update = &template_plugin_update; | ||
260 | api->iter_low_priority = &template_plugin_iter_low_priority; | ||
261 | api->iter_zero_anonymity = &template_plugin_iter_zero_anonymity; | ||
262 | api->iter_ascending_expiration = &template_plugin_iter_ascending_expiration; | ||
263 | api->iter_migration_order = &template_plugin_iter_migration_order; | ||
264 | api->iter_all_now = &template_plugin_iter_all_now; | ||
265 | api->drop = &template_plugin_drop; | ||
266 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, | ||
267 | "template", _("Template database running\n")); | ||
268 | return api; | ||
269 | } | ||
270 | |||
271 | |||
272 | /** | ||
273 | * Exit point from the plugin. | ||
274 | */ | ||
275 | void * | ||
276 | libgnunet_plugin_datastore_template_done (void *cls) | ||
277 | { | ||
278 | struct GNUNET_DATASTORE_PluginFunctions *api = cls; | ||
279 | struct Plugin *plugin = api->cls; | ||
280 | |||
281 | GNUNET_free (plugin); | ||
282 | GNUNET_free (api); | ||
283 | return NULL; | ||
284 | } | ||
285 | |||
286 | /* end of plugin_datastore_template.c */ | ||
diff --git a/src/include/gnunet_datastore_service.h b/src/include/gnunet_datastore_service.h index b20c6b100..ed0fd0856 100644 --- a/src/include/gnunet_datastore_service.h +++ b/src/include/gnunet_datastore_service.h | |||
@@ -31,7 +31,7 @@ | |||
31 | #ifndef GNUNET_DATASTORE_SERVICE_H | 31 | #ifndef GNUNET_DATASTORE_SERVICE_H |
32 | #define GNUNET_DATASTORE_SERVICE_H | 32 | #define GNUNET_DATASTORE_SERVICE_H |
33 | 33 | ||
34 | #include "gnunet_core.h" | 34 | #include "gnunet_util_lib.h" |
35 | 35 | ||
36 | #ifdef __cplusplus | 36 | #ifdef __cplusplus |
37 | extern "C" | 37 | extern "C" |
@@ -93,9 +93,12 @@ struct GNUNET_DATASTORE_Handle *GNUNET_DATASTORE_connect (struct | |||
93 | /** | 93 | /** |
94 | * Disconnect from the datastore service (and free | 94 | * Disconnect from the datastore service (and free |
95 | * associated resources). | 95 | * associated resources). |
96 | * | ||
96 | * @param h handle to the datastore | 97 | * @param h handle to the datastore |
98 | * @param drop set to GNUNET_YES to delete all data in datastore (!) | ||
97 | */ | 99 | */ |
98 | void GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h); | 100 | void GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h, |
101 | int drop); | ||
99 | 102 | ||
100 | 103 | ||
101 | /** | 104 | /** |
@@ -125,7 +128,7 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, | |||
125 | const GNUNET_HashCode * key, | 128 | const GNUNET_HashCode * key, |
126 | uint32_t size, | 129 | uint32_t size, |
127 | const void *data, | 130 | const void *data, |
128 | unit32_t type, | 131 | uint32_t type, |
129 | uint32_t priority, | 132 | uint32_t priority, |
130 | uint32_t anonymity, | 133 | uint32_t anonymity, |
131 | struct GNUNET_TIME_Absolute expiration); | 134 | struct GNUNET_TIME_Absolute expiration); |
diff --git a/src/include/gnunet_util_lib.h b/src/include/gnunet_util_lib.h index c152377c3..6354e28fa 100644 --- a/src/include/gnunet_util_lib.h +++ b/src/include/gnunet_util_lib.h | |||
@@ -44,6 +44,7 @@ extern "C" | |||
44 | #include "gnunet_disk_lib.h" | 44 | #include "gnunet_disk_lib.h" |
45 | #include "gnunet_getopt_lib.h" | 45 | #include "gnunet_getopt_lib.h" |
46 | #include "gnunet_network_lib.h" | 46 | #include "gnunet_network_lib.h" |
47 | #include "gnunet_plugin_lib.h" | ||
47 | #include "gnunet_program_lib.h" | 48 | #include "gnunet_program_lib.h" |
48 | #include "gnunet_protocols.h" | 49 | #include "gnunet_protocols.h" |
49 | #include "gnunet_pseudonym_lib.h" | 50 | #include "gnunet_pseudonym_lib.h" |
diff --git a/src/resolver/gnunet-service-resolver.c b/src/resolver/gnunet-service-resolver.c index c65adacd3..ad62424a5 100644 --- a/src/resolver/gnunet-service-resolver.c +++ b/src/resolver/gnunet-service-resolver.c | |||
@@ -439,7 +439,7 @@ static struct GNUNET_SERVER_MessageHandler handlers[] = { | |||
439 | 439 | ||
440 | 440 | ||
441 | /** | 441 | /** |
442 | * Process statistics requests. | 442 | * Process resolver requests. |
443 | * | 443 | * |
444 | * @param cls closure | 444 | * @param cls closure |
445 | * @param sched scheduler to use | 445 | * @param sched scheduler to use |
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 88d43e279..fb38f40c8 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am | |||
@@ -38,7 +38,7 @@ gnunet_transport_LDADD = \ | |||
38 | $(GN_LIBINTL) | 38 | $(GN_LIBINTL) |
39 | 39 | ||
40 | gnunet_service_transport_SOURCES = \ | 40 | gnunet_service_transport_SOURCES = \ |
41 | gnunet-service-transport.c | 41 | gnunet-service-transport.c plugin_transport.h |
42 | gnunet_service_transport_LDADD = \ | 42 | gnunet_service_transport_LDADD = \ |
43 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | 43 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ |
44 | $(top_builddir)/src/util/libgnunetutil.la \ | 44 | $(top_builddir)/src/util/libgnunetutil.la \ |