aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/core.h2
-rw-r--r--src/fs/fs_publish.c2
-rw-r--r--src/fs/fs_search.c2
-rw-r--r--src/fs/fs_test_lib_data.conf4
-rw-r--r--src/fs/gnunet-pseudonym.c248
-rw-r--r--src/fs/gnunet-service-fs.c16
-rw-r--r--src/fs/test_fs_download.c2
-rw-r--r--src/fs/test_fs_namespace.c2
-rw-r--r--src/fs/test_fs_namespace_data.conf4
-rw-r--r--src/fs/test_fs_search.c2
-rw-r--r--src/fs/test_fs_search_data.conf4
-rw-r--r--src/fs/test_fs_test_lib.c2
-rw-r--r--src/fs/test_gnunet_service_fs_p2p.c2
13 files changed, 273 insertions, 19 deletions
diff --git a/src/core/core.h b/src/core/core.h
index 45d138140..ea2925797 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -29,7 +29,7 @@
29/** 29/**
30 * General core debugging. 30 * General core debugging.
31 */ 31 */
32#define DEBUG_CORE GNUNET_YES 32#define DEBUG_CORE GNUNET_NO
33 33
34/** 34/**
35 * Debugging interaction core-clients. 35 * Debugging interaction core-clients.
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c
index dbecdfab7..18b064698 100644
--- a/src/fs/fs_publish.c
+++ b/src/fs/fs_publish.c
@@ -40,7 +40,7 @@
40#include "fs.h" 40#include "fs.h"
41#include "fs_tree.h" 41#include "fs_tree.h"
42 42
43#define DEBUG_PUBLISH GNUNET_YES 43#define DEBUG_PUBLISH GNUNET_NO
44 44
45/** 45/**
46 * Main function that performs the upload. 46 * Main function that performs the upload.
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c
index 98168c3f4..596ea0c63 100644
--- a/src/fs/fs_search.c
+++ b/src/fs/fs_search.c
@@ -38,7 +38,7 @@
38#include "gnunet_protocols.h" 38#include "gnunet_protocols.h"
39#include "fs.h" 39#include "fs.h"
40 40
41#define DEBUG_SEARCH GNUNET_YES 41#define DEBUG_SEARCH GNUNET_NO
42 42
43 43
44 44
diff --git a/src/fs/fs_test_lib_data.conf b/src/fs/fs_test_lib_data.conf
index 5d2f60527..b2fbd5ee0 100644
--- a/src/fs/fs_test_lib_data.conf
+++ b/src/fs/fs_test_lib_data.conf
@@ -42,14 +42,14 @@ PORT = 43470
42HOSTNAME = localhost 42HOSTNAME = localhost
43#TOTAL_QUOTA_IN = 3932160 43#TOTAL_QUOTA_IN = 3932160
44#TOTAL_QUOTA_OUT = 3932160 44#TOTAL_QUOTA_OUT = 3932160
45DEBUG = YES 45#DEBUG = YES
46#PREFIX = valgrind --tool=memcheck --leak-check=yes 46#PREFIX = valgrind --tool=memcheck --leak-check=yes
47#BINARY = /home/grothoff/bin/gnunet-service-core 47#BINARY = /home/grothoff/bin/gnunet-service-core
48 48
49[fs] 49[fs]
50PORT = 43471 50PORT = 43471
51HOSTNAME = localhost 51HOSTNAME = localhost
52DEBUG = YES 52#DEBUG = YES
53#PREFIX = valgrind --tool=memcheck --leak-check=yes 53#PREFIX = valgrind --tool=memcheck --leak-check=yes
54#BINARY = /home/grothoff/bin/gnunet-service-fs 54#BINARY = /home/grothoff/bin/gnunet-service-fs
55#PREFIX = xterm -e gdb -x cmd --args 55#PREFIX = xterm -e gdb -x cmd --args
diff --git a/src/fs/gnunet-pseudonym.c b/src/fs/gnunet-pseudonym.c
index e443d1e32..2d35e8e8c 100644
--- a/src/fs/gnunet-pseudonym.c
+++ b/src/fs/gnunet-pseudonym.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009 Christian Grothoff (and other contributing authors) 3 (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009, 2010 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published
@@ -25,8 +25,152 @@
25#include "platform.h" 25#include "platform.h"
26#include "gnunet_fs_service.h" 26#include "gnunet_fs_service.h"
27 27
28/**
29 * -a optiton.
30 */
31static unsigned int anonymity;
32
33/**
34 * -A option.
35 */
36static int start_automate;
37
38/**
39 * -e option
40 */
41static int stop_automate;
42
43/**
44 * -C option
45 */
46static char *create_ns;
47
48/**
49 * -D option
50 */
51static char *delete_ns;
52
53/**
54 * -k option
55 */
56static struct GNUNET_FS_Uri *ksk_uri;
57
58/**
59 * -l option.
60 */
61static int print_local_only;
62
63/**
64 * -m option.
65 */
66static struct GNUNET_CONTAINER_MetaData *adv_metadata;
67
68/**
69 * -n option.
70 */
71static int no_advertising;
72
73/**
74 * -p option.
75 */
76static unsigned int priority = 365;
77
78/**
79 * -q option given.
80 */
81static int no_remote_printing;
82
83/**
84 * -r option.
85 */
86static char *root_identifier;
87
88/**
89 * -s option.
90 */
91static char *rating_change;
92
93/**
94 * Handle to fs service.
95 */
96static struct GNUNET_FS_Handle *h;
97
98/**
99 * Namespace we are looking at.
100 */
101static struct GNUNET_FS_Namespace *ns;
102
103
28static int ret; 104static int ret;
29 105
106static void*
107progress_cb (void *cls,
108 const struct GNUNET_FS_ProgressInfo *info)
109{
110 return NULL;
111}
112
113
114static void
115ns_printer (void *cls,
116 const char *name,
117 const GNUNET_HashCode *id)
118{
119 struct GNUNET_CRYPTO_HashAsciiEncoded enc;
120
121 GNUNET_CRYPTO_hash_to_enc (id, &enc);
122 fprintf (stdout,
123 "%s (%s)\n",
124 name,
125 (const char*) &enc);
126}
127
128
129static void
130post_advertising (void *cls,
131 const struct GNUNET_FS_Uri *uri,
132 const char *emsg)
133{
134 if (emsg != NULL)
135 {
136 fprintf (stderr, "%s", emsg);
137 ret = 1;
138 }
139 if (ns != NULL)
140 {
141 if (GNUNET_OK !=
142 GNUNET_FS_namespace_delete (ns,
143 GNUNET_NO))
144 ret = 1;
145 }
146 if (0 != stop_automate)
147 {
148 GNUNET_break (0); // FIXME: not implemented
149 }
150 if (0 != start_automate)
151 {
152 GNUNET_break (0); // FIXME: not implemented
153 }
154 if (NULL != rating_change)
155 {
156 GNUNET_break (0); // FIXME: not implemented
157 }
158 if (0 != print_local_only)
159 {
160 GNUNET_FS_namespace_list (h,
161 &ns_printer,
162 NULL);
163 }
164 else if (0 == no_remote_printing)
165 {
166 GNUNET_break (0); // FIXME: not implemented
167 }
168 /* FIXME: is this OK here, or do we need
169 for completion of previous requests? */
170 GNUNET_FS_stop (h);
171}
172
173
30/** 174/**
31 * Main function that will be run by the scheduler. 175 * Main function that will be run by the scheduler.
32 * 176 *
@@ -43,15 +187,111 @@ run (void *cls,
43 const char *cfgfile, 187 const char *cfgfile,
44 const struct GNUNET_CONFIGURATION_Handle *cfg) 188 const struct GNUNET_CONFIGURATION_Handle *cfg)
45{ 189{
46 // FIXME 190 struct GNUNET_FS_Uri *ns_uri;
47} 191 struct GNUNET_TIME_Absolute expiration;
48 192
193 h = GNUNET_FS_start (sched,
194 cfg,
195 "gnunet-pseudonym",
196 &progress_cb,
197 NULL,
198 GNUNET_FS_FLAGS_NONE);
199 if (NULL != delete_ns)
200 {
201 ns = GNUNET_FS_namespace_create (h, delete_ns);
202 if (ns == NULL)
203 {
204 ret = 1;
205 }
206 else
207 {
208 if (GNUNET_OK !=
209 GNUNET_FS_namespace_delete (ns,
210 GNUNET_YES))
211 ret = 1;
212 ns = NULL;
213 }
214 }
215 if (NULL != create_ns)
216 {
217 ns = GNUNET_FS_namespace_create (h, create_ns);
218 if (ns == NULL)
219 {
220 ret = 1;
221 }
222 else
223 {
224 if (0 == no_advertising)
225 {
226 GNUNET_break (0); // FIXME: not implemented
227 ns_uri = NULL; // FIXME!!
228 expiration = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_YEARS);
229 GNUNET_FS_publish_ksk (h,
230 ksk_uri,
231 adv_metadata,
232 ns_uri,
233 expiration,
234 anonymity,
235 priority,
236 GNUNET_FS_PUBLISH_OPTION_NONE,
237 &post_advertising,
238 NULL);
239 return;
240 }
241 }
242 }
243 post_advertising (NULL, NULL, NULL);
244}
49 245
50/** 246/**
51 * gnunet-pseudonym command line options 247 * gnunet-pseudonym command line options
52 */ 248 */
53static struct GNUNET_GETOPT_CommandLineOption options[] = { 249static struct GNUNET_GETOPT_CommandLineOption options[] = {
54 // FIXME: options! 250 {'a', "anonymity", "LEVEL",
251 gettext_noop ("set the desired LEVEL of sender-anonymity"),
252 1, &GNUNET_GETOPT_set_uint, &anonymity},
253 {'A', "automate", NULL,
254 gettext_noop ("start a collection"),
255 0, &GNUNET_GETOPT_set_one, &start_automate},
256 {'C', "create", "NAME",
257 gettext_noop
258 ("create or advertise namespace NAME"),
259 1, &GNUNET_GETOPT_set_string, &create_ns},
260 {'D', "delete", "NAME",
261 gettext_noop
262 ("delete namespace NAME "),
263 1, &GNUNET_GETOPT_set_string, &delete_ns},
264 {'e', "end", NULL,
265 gettext_noop ("end current collection"),
266 0, &GNUNET_GETOPT_set_one, &stop_automate},
267 {'k', "keyword", "VALUE",
268 gettext_noop
269 ("add an additional keyword for the advertisment"
270 " (this option can be specified multiple times)"),
271 1, &GNUNET_FS_getopt_set_keywords, &ksk_uri},
272 {'l', "local-only", NULL,
273 gettext_noop ("print names of local namespaces"),
274 0, &GNUNET_GETOPT_set_one, &print_local_only},
275 {'m', "meta", "TYPE:VALUE",
276 gettext_noop ("set the meta-data for the given TYPE to the given VALUE"),
277 1, &GNUNET_FS_getopt_set_metadata, &adv_metadata},
278 {'n', "no-advertisement", NULL,
279 gettext_noop ("do not create an advertisement"),
280 0, &GNUNET_GETOPT_set_one, &no_advertising},
281 {'p', "priority", "PRIORITY",
282 gettext_noop ("use the given PRIORITY for the advertisments"),
283 1, &GNUNET_GETOPT_set_uint, &priority},
284 {'q', "quiet", NULL,
285 gettext_noop ("do not print names of remote namespaces"),
286 0, &GNUNET_GETOPT_set_one, &no_remote_printing},
287 {'r', "root", "ID",
288 gettext_noop
289 ("specify ID of the root of the namespace"),
290 1, &GNUNET_GETOPT_set_string, &root_identifier},
291 {'s', "set-rating", "ID:VALUE",
292 gettext_noop
293 ("change rating of namespace ID by VALUE"),
294 1, &GNUNET_GETOPT_set_string, &rating_change},
55 GNUNET_GETOPT_OPTION_END 295 GNUNET_GETOPT_OPTION_END
56}; 296};
57 297
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index 7f2230747..9b8a14052 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -47,7 +47,7 @@
47#include "gnunet-service-fs_indexing.h" 47#include "gnunet-service-fs_indexing.h"
48#include "fs.h" 48#include "fs.h"
49 49
50#define DEBUG_FS 2 50#define DEBUG_FS GNUNET_NO
51 51
52/** 52/**
53 * Maximum number of outgoing messages we queue per peer. 53 * Maximum number of outgoing messages we queue per peer.
@@ -1188,8 +1188,10 @@ transmit_query_continuation (void *cls,
1188 1188
1189 if (tpid == 0) 1189 if (tpid == 0)
1190 { 1190 {
1191#if DEBUG_FS
1191 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1192 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1192 "Transmission of request failed, will try again later.\n"); 1193 "Transmission of request failed, will try again later.\n");
1194#endif
1193 if (pr->task == GNUNET_SCHEDULER_NO_TASK) 1195 if (pr->task == GNUNET_SCHEDULER_NO_TASK)
1194 pr->task = GNUNET_SCHEDULER_add_delayed (sched, 1196 pr->task = GNUNET_SCHEDULER_add_delayed (sched,
1195 get_processing_delay (), 1197 get_processing_delay (),
@@ -1863,14 +1865,18 @@ process_reply (void *cls,
1863 gettext_noop ("# duplicate replies discarded (bloomfilter)"), 1865 gettext_noop ("# duplicate replies discarded (bloomfilter)"),
1864 1, 1866 1,
1865 GNUNET_NO); 1867 GNUNET_NO);
1868#if DEBUG_FS
1866 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1869 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1867 "Duplicate response `%s', discarding.\n", 1870 "Duplicate response `%s', discarding.\n",
1868 GNUNET_h2s (&mhash)); 1871 GNUNET_h2s (&mhash));
1872#endif
1869 return GNUNET_YES; /* duplicate */ 1873 return GNUNET_YES; /* duplicate */
1870 } 1874 }
1875#if DEBUG_FS
1871 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1876 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1872 "New response `%s', adding to filter.\n", 1877 "New response `%s', adding to filter.\n",
1873 GNUNET_h2s (&mhash)); 1878 GNUNET_h2s (&mhash));
1879#endif
1874 GNUNET_CONTAINER_bloomfilter_add (pr->bf, 1880 GNUNET_CONTAINER_bloomfilter_add (pr->bf,
1875 &mhash); 1881 &mhash);
1876 } 1882 }
@@ -1970,9 +1976,11 @@ process_reply (void *cls,
1970 } 1976 }
1971 if (GNUNET_YES == do_remove) 1977 if (GNUNET_YES == do_remove)
1972 { 1978 {
1979#if DEBUG_FS
1973 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1980 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1974 "Removing request `%s' from request map (has been satisfied)\n", 1981 "Removing request `%s' from request map (has been satisfied)\n",
1975 GNUNET_h2s (key)); 1982 GNUNET_h2s (key));
1983#endif
1976 GNUNET_break (GNUNET_YES == 1984 GNUNET_break (GNUNET_YES ==
1977 GNUNET_CONTAINER_multihashmap_remove (query_request_map, 1985 GNUNET_CONTAINER_multihashmap_remove (query_request_map,
1978 key, 1986 key,
@@ -2210,10 +2218,12 @@ process_local_reply (void *cls,
2210 pr); 2218 pr);
2211 return; 2219 return;
2212 } 2220 }
2221#if DEBUG_FS
2213 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2222 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2214 "New local response to `%s' of type %u.\n", 2223 "New local response to `%s' of type %u.\n",
2215 GNUNET_h2s (key), 2224 GNUNET_h2s (key),
2216 type); 2225 type);
2226#endif
2217 if (type == GNUNET_DATASTORE_BLOCKTYPE_ONDEMAND) 2227 if (type == GNUNET_DATASTORE_BLOCKTYPE_ONDEMAND)
2218 { 2228 {
2219#if DEBUG_FS 2229#if DEBUG_FS
@@ -2274,10 +2284,14 @@ process_local_reply (void *cls,
2274 pr->bf_size, 2284 pr->bf_size,
2275 BLOOMFILTER_K); 2285 BLOOMFILTER_K);
2276 } 2286 }
2287#if DEBUG_FS
2277 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2288 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2278 "New local response `%s', adding to filter.\n", 2289 "New local response `%s', adding to filter.\n",
2279 GNUNET_h2s (&mhash)); 2290 GNUNET_h2s (&mhash));
2291#endif
2280#if 0 2292#if 0
2293 /* this would break stuff since we will check the bf later
2294 again (and would then discard the reply!) */
2281 GNUNET_CONTAINER_bloomfilter_add (pr->bf, 2295 GNUNET_CONTAINER_bloomfilter_add (pr->bf,
2282 &mhash); 2296 &mhash);
2283#endif 2297#endif
diff --git a/src/fs/test_fs_download.c b/src/fs/test_fs_download.c
index afb95bc71..af1fbfa50 100644
--- a/src/fs/test_fs_download.c
+++ b/src/fs/test_fs_download.c
@@ -29,7 +29,7 @@
29#include "gnunet_arm_service.h" 29#include "gnunet_arm_service.h"
30#include "gnunet_fs_service.h" 30#include "gnunet_fs_service.h"
31 31
32#define VERBOSE GNUNET_YES 32#define VERBOSE GNUNET_NO
33 33
34#define START_ARM GNUNET_YES 34#define START_ARM GNUNET_YES
35 35
diff --git a/src/fs/test_fs_namespace.c b/src/fs/test_fs_namespace.c
index a7ccbeccf..9e02521a8 100644
--- a/src/fs/test_fs_namespace.c
+++ b/src/fs/test_fs_namespace.c
@@ -31,7 +31,7 @@
31#include "gnunet_arm_service.h" 31#include "gnunet_arm_service.h"
32#include "gnunet_fs_service.h" 32#include "gnunet_fs_service.h"
33 33
34#define VERBOSE GNUNET_YES 34#define VERBOSE GNUNET_NO
35 35
36#define START_ARM GNUNET_YES 36#define START_ARM GNUNET_YES
37 37
diff --git a/src/fs/test_fs_namespace_data.conf b/src/fs/test_fs_namespace_data.conf
index 3316da3da..3b4ba5c70 100644
--- a/src/fs/test_fs_namespace_data.conf
+++ b/src/fs/test_fs_namespace_data.conf
@@ -19,7 +19,7 @@ HOSTNAME = localhost
19DEFAULTSERVICES = resolver datastore transport core fs 19DEFAULTSERVICES = resolver datastore transport core fs
20 20
21[datastore] 21[datastore]
22DEBUG = YES 22# DEBUG = YES
23 23
24[statistics] 24[statistics]
25PORT = 42467 25PORT = 42467
@@ -37,7 +37,7 @@ HOSTNAME = localhost
37PORT = 42471 37PORT = 42471
38HOSTNAME = localhost 38HOSTNAME = localhost
39IDENTITY_DIR = $SERVICEHOME/pseudos/ 39IDENTITY_DIR = $SERVICEHOME/pseudos/
40DEBUG = YES 40# DEBUG = YES
41 41
42[testing] 42[testing]
43WEAKRANDOM = YES 43WEAKRANDOM = YES
diff --git a/src/fs/test_fs_search.c b/src/fs/test_fs_search.c
index d4d000c40..4320f965f 100644
--- a/src/fs/test_fs_search.c
+++ b/src/fs/test_fs_search.c
@@ -29,7 +29,7 @@
29#include "gnunet_arm_service.h" 29#include "gnunet_arm_service.h"
30#include "gnunet_fs_service.h" 30#include "gnunet_fs_service.h"
31 31
32#define VERBOSE GNUNET_YES 32#define VERBOSE GNUNET_NO
33 33
34#define START_ARM GNUNET_YES 34#define START_ARM GNUNET_YES
35 35
diff --git a/src/fs/test_fs_search_data.conf b/src/fs/test_fs_search_data.conf
index 40b440b2e..ce89cd8df 100644
--- a/src/fs/test_fs_search_data.conf
+++ b/src/fs/test_fs_search_data.conf
@@ -19,7 +19,7 @@ HOSTNAME = localhost
19DEFAULTSERVICES = resolver datastore transport core fs 19DEFAULTSERVICES = resolver datastore transport core fs
20 20
21[datastore] 21[datastore]
22DEBUG = YES 22# DEBUG = YES
23 23
24[statistics] 24[statistics]
25PORT = 42467 25PORT = 42467
@@ -36,7 +36,7 @@ HOSTNAME = localhost
36[fs] 36[fs]
37PORT = 42471 37PORT = 42471
38HOSTNAME = localhost 38HOSTNAME = localhost
39DEBUG = YES 39# DEBUG = YES
40 40
41[testing] 41[testing]
42WEAKRANDOM = YES 42WEAKRANDOM = YES
diff --git a/src/fs/test_fs_test_lib.c b/src/fs/test_fs_test_lib.c
index 0abb539d6..a62200100 100644
--- a/src/fs/test_fs_test_lib.c
+++ b/src/fs/test_fs_test_lib.c
@@ -26,7 +26,7 @@
26#include "platform.h" 26#include "platform.h"
27#include "fs_test_lib.h" 27#include "fs_test_lib.h"
28 28
29#define VERBOSE GNUNET_YES 29#define VERBOSE GNUNET_NO
30 30
31/** 31/**
32 * File-size we use for testing. 32 * File-size we use for testing.
diff --git a/src/fs/test_gnunet_service_fs_p2p.c b/src/fs/test_gnunet_service_fs_p2p.c
index 024e08155..4153c6584 100644
--- a/src/fs/test_gnunet_service_fs_p2p.c
+++ b/src/fs/test_gnunet_service_fs_p2p.c
@@ -26,7 +26,7 @@
26#include "platform.h" 26#include "platform.h"
27#include "fs_test_lib.h" 27#include "fs_test_lib.h"
28 28
29#define VERBOSE GNUNET_YES 29#define VERBOSE GNUNET_NO
30 30
31/** 31/**
32 * File-size we use for testing. 32 * File-size we use for testing.