gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r10722 - in gnunet: . doc/man src/fs src/include


From: gnunet
Subject: [GNUnet-SVN] r10722 - in gnunet: . doc/man src/fs src/include
Date: Wed, 31 Mar 2010 08:40:20 +0200

Author: grothoff
Date: 2010-03-31 08:40:20 +0200 (Wed, 31 Mar 2010)
New Revision: 10722

Modified:
   gnunet/TODO
   gnunet/doc/man/gnunet-pseudonym.1
   gnunet/doc/man/gnunet-search.1
   gnunet/src/fs/Makefile.am
   gnunet/src/fs/fs_directory.c
   gnunet/src/fs/fs_download.c
   gnunet/src/fs/fs_search.c
   gnunet/src/fs/fs_uri.c
   gnunet/src/fs/gnunet-download.c
   gnunet/src/fs/gnunet-pseudonym.c
   gnunet/src/fs/gnunet-publish.c
   gnunet/src/fs/gnunet-search.c
   gnunet/src/include/gnunet_fs_service.h
Log:
fs hxing

Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2010-03-30 17:44:19 UTC (rev 10721)
+++ gnunet/TODO 2010-03-31 06:40:20 UTC (rev 10722)
@@ -1,77 +1,55 @@
 Implementable right now (but not necessarily important), with caveats
 (unavailable components that will limit what can be implemented right
 away), in order in which they will likely be done:
-* TESTING-TESTBED [Nate]
-* SETUP
+* TESTING [Nate]
 * DV [Nate]
-* TBENCH
-* TRACEKIT
+* DHT [Nate]
+* TBENCH [MW]
+* TRACEKIT [MW]
 * FRAGMENTATION [Ji Lu]
-* HTTP transport
-* MySQL / Postgres plugins (datastore, datacache)
+* HTTP transport [Matthias]
 * UPNP [Milan]
 * ARM [Safey]
-* FS [Christian]
+* FS [CG]
+* SETUP
+* MySQL / Postgres plugins (datastore, datacache)
 
-0.9.0pre0:
-* CORE:
+0.9.0pre0 [April]:
+* CORE: [CG]
   - "Forcing disconnect of XXX due to inactivity" -- can happen every few MS!?
     (disconnect does not really succeed, or what?)
     Also, core does not seem to actually decrement the number of active
     sessions even if no connections exist for a while! (likely related...)
-  - transport reports bw quota violations on big-endian systems (core or
+  - transport reports bw quota violations on slow systems (core or
     transport issue?)
-* DATASTORE:
+* DATASTORE: [CG]
   - utilization can (easily, restart?) go out of control (very large), causing
     content expiration job to go crazy and delete everything!
-* FS:
-  - gnunet-publish cannot be aborted using CTRL-C
+* FS: [CG]
+  T gnunet-publish cannot be aborted using CTRL-C
   - on some systems, keyword search does not find locally published content
     (need testcase of command-line tools! - also good to cover getopt API!)
     [could be related to datastore issue above!]
   - 2-peer download is still too slow (why?)
   - advanced FS API parts
-    + search: SBlocks, NBlocks, probes, notify FS-service of known results
-    + gnunet-publish (URI args)
-    + gnunet-download (directory)
-    + gnunet-search (options, incl. namespace search)
-    + gnunet-download (many options)
-    + gnunet-directory (man page, options)
-    + gnunet-pseudonym (listing of namespaces, advertisement uris, testing)
+    T gnunet-download (directory-file download [easy])
+    T fs_download (recursive download; bounded parallelism)
+    T indexing: index-failure-cleanup [easy]
     + gnunet-service-fs (remove failing on-demand blocks, hot-path routing, 
       load-based routing, nitpicks)
-    + indexing: index-failure-cleanup
-  - implement adv. FS testcases 
-  - [./fs/gnunet-service-fs.c:208]: (style) struct or union member 
'LocalGetContext::results_bf_size' is never used
-  - [./fs/gnunet-service-fs.c:501]: (style) struct or union member 
'PendingRequest::used_pids_size' is never used
-  - [./fs/gnunet-service-fs.c:654]: (style) struct or union member 
'ConnectedPeer::last_client_replies' is never used
-  - [./fs/gnunet-service-fs.c:669]: (style) struct or union member 
'ConnectedPeer::avg_delay' is never used
-  - [./fs/gnunet-service-fs.c:675]: (style) struct or union member 
'ConnectedPeer::avg_priority' is never used
-  - [./fs/gnunet-service-fs.c:688]: (style) struct or union member 
'ConnectedPeer::pending_requests' is never used
-  - [./fs/gnunet-service-fs.c:694]: (style) struct or union member 
'ConnectedPeer::last_p2p_replies_woff' is never used
-  - [./fs/gnunet-service-fs.c:700]: (style) struct or union member 
'ConnectedPeer::last_client_replies_woff' is never used
+  - [gnunet-service-fs.c:208]: member 'LocalGetContext::results_bf_size' is 
never used
+  - [gnunet-service-fs.c:501]: member 'PendingRequest::used_pids_size' is 
never used
+  - [gnunet-service-fs.c:654]: member 'ConnectedPeer::last_client_replies' is 
never used
+  - [gnunet-service-fs.c:669]: member 'ConnectedPeer::avg_delay' is never used
+  - [gnunet-service-fs.c:675]: member 'ConnectedPeer::avg_priority' is never 
used
+  - [gnunet-service-fs.c:688]: member 'ConnectedPeer::pending_requests' is 
never used
+  - [gnunet-service-fs.c:694]: member 'ConnectedPeer::last_p2p_replies_woff' 
is never used
+  - [gnunet-service-fs.c:700]: member 
'ConnectedPeer::last_client_replies_woff' is never used
 * WWW:
   - Get IPv6 hooked up
   - change DNS
 
 0.9.0pre1:
-* Module features to implement:
-  - tbench (RC-pre1)
-    + good to have for DV evaluation! [MW]
-  - DV (RC-pre1)
-    + write DV API 
-    + implement DV service [Nate & CG]
-    + implement DV library [Nate]
-    + implement DV transport plugin [Nate & CG]
-    + implement testcases [Nate]
-    + implement performance tests [Nate]
-* SETUP:
-  - design & implement new setup tool
-* GUIs to implement:
-  - gtk (RC-pre1)
-    + how to integrate scheduler with GTK event loop!
-* STATISTICS:
-  - does not seem to work with timeouts (especially if service is not running)
 * PEERINFO:
   - trust: need *fast* way to check/update trust in peers
            (async peerinfo would not be right; certainly not with the
@@ -82,17 +60,21 @@
   - only connect() sockets that are ready (select()) [Nils]
     [On W32, we need to select after calling socket before
      doing connect etc.]
-* FS:
-  - datastore reservation (publishing)
-  - persistence support (publish, unindex, search, download)
-  - download: management/bounding of parallel downloads (for recursive dl.)
-  - non-anonymous FS service (needs DHT)
-    + basic DHT integration
-    + CS-DHT-functions (DHT-put of LOC)
-    + P2P-functions (DHT-get)
-  - active migration support (in fs or in datastore or new daemon?)
-  - GAP improvements:
-    + active reply route caching design & implementation of service; gap 
extension!
+* HELLO: [CG]
+  - need function to test "equivalency" of HELLOs (or integrate with 
"merge"?); use in PEERINFO
+* SETUP:
+  - design & implement new setup tool
+* TBENCH: [MW]
+  - good to have for transport/DV evaluation! 
+* DV: [Nate]
+  - write DV API 
+  - implement DV service
+  - implement DV library
+  - implement DV transport plugin
+  - implement testcases 
+  - implement performance tests
+* STATISTICS:
+  - does not seem to work with timeouts (especially if service is not running)
 * TOPOLOGY:
   - needs more testing (especially F2F topology)
   - needs to re-try connecting after disconnect (currently, it
@@ -110,37 +92,40 @@
      disconnect-reconnect events and the implicit whitelisting
      that might happen here; that's not so bad since we will
      re-blacklist on pre-connect attempts anyway, so this is 
-     a minor issue).
+     a minor issue; OTOH, we might want to be more explicit about
+     allowing/forbidding connects on pre-connect to avoid 
+     entering connect attempts to just be blacklisted shortly afterwards).
   - the code uses the term 'blacklist' for both peers that are forbidden
     to connect (i.e. F2F mode) as well as peers that we currently
     won't try to actively connect to ourselves (since we just tried);
-    This is confusing.  We need two distinct terms.
+    This is confusing.  We need two distinct terms (greylist?).
   - move code to use hash table instead of linked list
   - instead of periodically discarding blacklisted entries,
     simply add task that is triggered at the right time (earlier free,
     more balanced load)
   - check if new HELLO learned is different from old HELLO
     before resetting entire state!
-* HELLO:
-  - need function to test "equivalency" of HELLOs (or integrate with 
"merge"?); use in PEERINFO
+* FS: [CG]
+  - datastore reservation (publishing)
+  - search: availability probes
+  - persistence support (publish, unindex, search, download)
+  - active migration support (in fs or in datastore or new daemon?)
+  - GAP improvements:
+    + active reply route caching design & implementation of service; gap 
extension!
+* GNUNET-GTK:
+  - how to integrate scheduler with GTK event loop!?
 
 0.9.0pre2:
-* Module features to implement:
-  - tracekit (RC-pre2)
-    + good to have for DV/DHT evaluation!
-  - DHT (RC-pre2)
-    + implement DHT service (needs DV, DATACACHE)
-    + implement DHT library
-    + implement testcases
-    + implement performance tests
-* GUIs to implement:
-  - fuse (RC-pre2)
-* Plugins to implement:
-  - UDP backend (RC-pre2)
-    + Fragmentation library 
-    + actual plugin
-  - HTTP backend (RC-pre2)
-* ARM:
+* TRACEKIT: [MW]
+  - good to have for DV/DHT evaluation!
+* DHT: [Nate]
+  - implement DHT service (needs DV, DATACACHE)
+  - implement DHT library
+  - implement testcases
+  - implement performance tests
+* TRANSPORT:
+  - HTTP backend [MW]
+* ARM: [Safey]
   - need to get rid of synchronous API for service starts (cause all kinds of 
problems)
     [=> eliminate for need to tell ARM about service starts most of the time!] 
[Safey]
   - better tracking of which config changes actually need to cause process 
restarts by ARM.
@@ -149,8 +134,12 @@
   - better crash management (attach debugging support, capture and analyze
     debug output, detect random vs. deterministic crashes)
   - shutdown sequence?
-* FS:
+* FS: [CG]
   - location URIs (publish, search, download)
+  - non-anonymous FS service (needs DHT)
+    + DHT integration for search
+    + CS-DHT-functions (DHT-put of LOC)
+    + P2P-functions (DHT-get)
   - collection API & tests
     + gnunet-pseudonym (collection support)
   - implement FS performance tests
@@ -159,28 +148,20 @@
     + search
     + unindex
 
-
 0.9.0pre3:
-* GUIs to implement:
-  - qt (RC-pre3)
-    + see discussions @ FISL about integration with event loop!
 * Determine RC bugs and fix those!
-* TESTING:
+* TESTING: [Nate]
   - modify configuration to allow controlling connections for non-local starts
-  - testbed creation with topology (needs working F2F topology) [Nate]
-  - testbed with churn [Nate]
-  - implement testcases for distributed testing [Nate]
-  - test basic peer re-configure [Nate]
-  - test topology creation [Nate]
-  - test churn generation [Nate]
+  - testbed creation with topology (needs working F2F topology) 
+  - testbed with churn 
+  - implement testcases for distributed testing
+  - test basic peer re-configure 
+  - test topology creation 
+  - test churn generation 
   - consider changing API for peer-group termination to 
     call continuation when done
 
-
 0.9.0:
-* Documentation
-  - update man pages
-  - update webpage documentation
 * new webpage:
   - expand bibliography
   - convert documentation pages to books
@@ -190,20 +171,18 @@
     enable developers to publish TGZs nicely
   - port "contact" page
   - add content type for "todo" items?
-  - DNS activation
-* Plugins to implement:
+* Plugins to implement: [CG]
   - MySQL database backends
     + datacache
     + datastore
   - Postgres database backends
     + datacache
     + datastore
-  - vpn
+* VPN
 * Determine RC bugs and fix those!
 
-
 0.9.x:
-* TRANSPORT:
+* TRANSPORT: [MW]
   - SMTP transport backend
   - HTTPS transport backend
     + improved HTTPS support in MHD
@@ -226,11 +205,11 @@
   - implement gnunet-transport (transport configurator / tester)
   - UPnP-based IP detection
     (Note: build library always, build service when libxml2/etc. are available)
-* FS:
+* FS: [CG]
   - Remove KBlocks in gnunet-unindex (see discussion with Kenneth Almquist on 
gnunet-devs in 9/2009)
   - Allow checking of presence of search results and/or content via 
command-line tools
     (add options to gnunet-search / gnunet-download to limit search to local 
peer)
-* PEERINFO:
+* PEERINFO: [CG]
   - expire 'ancient' HELLOs (those without valid addresses AND that 
     we have not 'used' (for their public keys) in a while; need a way
     to track actual 'use')

Modified: gnunet/doc/man/gnunet-pseudonym.1
===================================================================
--- gnunet/doc/man/gnunet-pseudonym.1   2010-03-30 17:44:19 UTC (rev 10721)
+++ gnunet/doc/man/gnunet-pseudonym.1   2010-03-31 06:40:20 UTC (rev 10722)
@@ -57,10 +57,6 @@
 For the main file (or directory), set the metadata of the given TYPE to the 
given VALUE.  Note that this will not add the respective VALUE to the set of 
keywords under which the file can be found.
 
 .TP
-\fB\-n\fR, \fB\-\-no\-advertisement\fR
-Do not generate an advertisement for the namespace (use with \-C).
-
-.TP
 \fB\-p \fIPRIORITY\fR, \fB\-\-prio=\fIPRIORITY\fR
 Set the priority of the namespace advertisement (default: 365).  If the local 
database is full, GNUnet will discard the content with the lowest ranking.  
Note that ranks change over time depending on popularity.  The default should 
be high enough to preserve the locally inserted content in favor of content 
that migrates from other peers.
 
@@ -70,7 +66,7 @@
 
 .TP
 \fB\-r IDENTIFIER\fR, \fB\-\-root=IDENTIFIER\fR
-Specify the identifier for the root of the namespace.  Used in the namespace 
advertisement to tell users that find the namespace advertisement about an 
entry\-point into the namespace (use with \-C).
+Specify the identifier for the root of the namespace.  Used in the namespace 
advertisement to tell users that find the namespace advertisement about an 
entry\-point into the namespace (use with \-C).  Advertisements are only 
created if "\-C" and "\-r" are specified.
 
 .TP
 \fB\-s ID:VALUE\fR, \fB\-\-set-rating=ID:VALUE\fR

Modified: gnunet/doc/man/gnunet-search.1
===================================================================
--- gnunet/doc/man/gnunet-search.1      2010-03-30 17:44:19 UTC (rev 10721)
+++ gnunet/doc/man/gnunet-search.1      2010-03-31 06:40:20 UTC (rev 10722)
@@ -31,14 +31,14 @@
 Change the loglevel.  Possible values for LOGLEVEL are 
 ERROR, WARNING, INFO and DEBUG. 
 .TP
-\fB\-o \fIPREFIX\fR, \fB\-\-output=\fIPREFIX\fR
-Writes the encountered (unencrypted) RBlocks or SBlocks to files with name 
PREFIX.XXX, where XXX is a number. This is useful to keep search results around.
+\fB\-o \fIFILENAME\fR, \fB\-\-output=\fIFILENAME\fR
+Writes a GNUnet directory containing all of the search results to FILENAME.
 .TP
 \fB\-v\fR, \fB\-\-version\fR
 print the version number
 .SH NOTES
 
-You can run gnunet\-search with an URI instead of a keyword.  The URI can have 
the format for a namespace search or for a keyword search.  For a namespace 
search, the format is gnunet://fs/sks/NAMESPACE/IDENTIFIER.  For a keyword 
search, use gnunet://ecrs/ksk/KEYWORD[+KEYWORD]*.  If the format does not 
correspond to a GNUnet URI, GNUnet will automatically assume that keywords are 
supplied directly.  
+You can run gnunet\-search with an URI instead of a keyword.  The URI can have 
the format for a namespace search or for a keyword search.  For a namespace 
search, the format is gnunet://fs/sks/NAMESPACE/IDENTIFIER.  For a keyword 
search, use gnunet://fs/ksk/KEYWORD[+KEYWORD]*.  If the format does not 
correspond to a GNUnet URI, GNUnet will automatically assume that keywords are 
supplied directly.  
 
 If multiple keywords are passed, gnunet-search will look for content matching 
any of the keywords.  The prefix "+" makes a keyword mandatory.  
 
@@ -60,13 +60,13 @@
                Mime-type: text/plain
 .ad b
 
-The first line contains the command to run to download the file.  The 
suggested filename in the example is COPYING.  The GNUnet URI consists of the 
key and query hash of the file and finally the size of the file.  After the 
command to download the file GNUnet will print meta\-data about the file as 
advertised in the search result, here "The GNU Public License" and the 
mime\-type (see the options for gnunet\-insert on how to supply meta-data by 
hand).
+The first line contains the command to run to download the file.  The 
suggested filename in the example is COPYING.  The GNUnet URI consists of the 
key and query hash of the file and finally the size of the file.  After the 
command to download the file GNUnet will print meta\-data about the file as 
advertised in the search result, here "The GNU Public License" and the 
mime\-type (see the options for gnunet\-publish on how to supply meta-data by 
hand).
 
 .SH FILES
 .TP
 ~/.gnunet/gnunet.conf
 GNUnet configuration file; specifies the default value for the timeout
 .SH "REPORTING BUGS"
-Report bugs to <https://gnunet.org/bugs/> or by sending electronic mail to 
<address@hidden>
+Report bugs to <https://gnunet.org/bugs/> or by sending electronic mail to 
<address@hidden>
 .SH "SEE ALSO"
 \fBgnunet\-gtk\fP(1), \fBgnunet\-publish\fP(1), \fBgnunet\-download\fP(1), 
\fBgnunet\-pseudonym\fP(1), \fBgnunet.conf\fP(5), \fBgnunetd\fP(1)

Modified: gnunet/src/fs/Makefile.am
===================================================================
--- gnunet/src/fs/Makefile.am   2010-03-30 17:44:19 UTC (rev 10721)
+++ gnunet/src/fs/Makefile.am   2010-03-31 06:40:20 UTC (rev 10722)
@@ -82,6 +82,7 @@
 gnunet_pseudonym_LDADD = \
   $(top_builddir)/src/fs/libgnunetfs.la \
   $(top_builddir)/src/util/libgnunetutil.la \
+  -lextractor \
   $(GN_LIBINTL)
 
 gnunet_search_SOURCES = \

Modified: gnunet/src/fs/fs_directory.c
===================================================================
--- gnunet/src/fs/fs_directory.c        2010-03-30 17:44:19 UTC (rev 10721)
+++ gnunet/src/fs/fs_directory.c        2010-03-31 06:40:20 UTC (rev 10722)
@@ -291,7 +291,10 @@
   struct GNUNET_FS_DirectoryBuilder *ret;
 
   ret = GNUNET_malloc(sizeof(struct GNUNET_FS_DirectoryBuilder));
-  ret->meta = GNUNET_CONTAINER_meta_data_duplicate (mdir);
+  if (mdir != NULL)
+    ret->meta = GNUNET_CONTAINER_meta_data_duplicate (mdir);
+  else
+    ret->meta = GNUNET_CONTAINER_meta_data_create ();
   GNUNET_FS_meta_data_make_directory (ret->meta);
   return ret;
 }

Modified: gnunet/src/fs/fs_download.c
===================================================================
--- gnunet/src/fs/fs_download.c 2010-03-30 17:44:19 UTC (rev 10721)
+++ gnunet/src/fs/fs_download.c 2010-03-31 06:40:20 UTC (rev 10722)
@@ -23,10 +23,10 @@
  * @author Christian Grothoff
  *
  * TODO:
+ * - handle recursive downloads (need directory & 
+ *   fs-level download-parallelism management)
  * - location URI suppport (can wait, easy)
  * - check if blocks exist already (can wait, easy)
- * - handle recursive downloads (need directory & 
- *   fs-level download-parallelism management, can wait)
  * - check if iblocks can be computed from existing blocks (can wait, hard)
  * - persistence (can wait)
  */

Modified: gnunet/src/fs/fs_search.c
===================================================================
--- gnunet/src/fs/fs_search.c   2010-03-30 17:44:19 UTC (rev 10721)
+++ gnunet/src/fs/fs_search.c   2010-03-31 06:40:20 UTC (rev 10722)
@@ -24,12 +24,11 @@
  * @author Christian Grothoff
  *
  * TODO:
- * - handle SKS updates searches nicely (can wait)
- * - handle availability probes (can wait)
- * - make operations persistent (can wait)
- * - handle namespace advertisements (can wait)
+ * - handle namespace advertisements (can wait; might already work!?)
  * - add support for pushing "already seen" information
  *   to FS service for bloomfilter (can wait)
+ * - handle availability probes (can wait)
+ * - make operations persistent (can wait)
  */
 
 #include "platform.h"

Modified: gnunet/src/fs/fs_uri.c
===================================================================
--- gnunet/src/fs/fs_uri.c      2010-03-30 17:44:19 UTC (rev 10721)
+++ gnunet/src/fs/fs_uri.c      2010-03-31 06:40:20 UTC (rev 10722)
@@ -882,6 +882,34 @@
 
 
 /**
+ * Create an SKS URI from a namespace and an identifier.
+ *
+ * @param ns namespace
+ * @param id identifier
+ * @param emsg where to store an error message
+ * @return an FS URI for the given namespace and identifier
+ */
+struct GNUNET_FS_Uri *
+GNUNET_FS_uri_sks_create (struct GNUNET_FS_Namespace *ns,
+                         const char *id,
+                         char **emsg)
+{
+  struct GNUNET_FS_Uri *ns_uri;
+  struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pk;
+             
+  ns_uri = GNUNET_malloc (sizeof (struct GNUNET_FS_Uri));
+  ns_uri->type = sks;
+  GNUNET_CRYPTO_rsa_key_get_public (ns->key,
+                                   &pk);
+  GNUNET_CRYPTO_hash (&pk,
+                     sizeof (pk),
+                     &ns_uri->data.sks.namespace);
+  ns_uri->data.sks.identifier = GNUNET_strdup (id);
+  return ns_uri;
+}
+
+
+/**
  * Canonicalize a keyword.
  * 
  * @param in input string (the keyword)

Modified: gnunet/src/fs/gnunet-download.c
===================================================================
--- gnunet/src/fs/gnunet-download.c     2010-03-30 17:44:19 UTC (rev 10721)
+++ gnunet/src/fs/gnunet-download.c     2010-03-31 06:40:20 UTC (rev 10722)
@@ -26,7 +26,7 @@
  * @author Igor Wronsky
  *
  * TODO:
- * - many command-line options
+ * - download-directory option support (do_directory)
  */
 #include "platform.h"
 #include "gnunet_fs_service.h"
@@ -47,6 +47,12 @@
 
 static unsigned int anonymity = 1;
 
+static unsigned int parallelism = 16;
+
+static int do_recursive;
+
+static int do_directory;
+
 static char *filename;
 
 
@@ -127,8 +133,15 @@
               info->value.download.filename,
               s);
       GNUNET_free (s);
-      if (info->value.download.dc == dc)
-       GNUNET_SCHEDULER_shutdown (sched);
+      if (do_directory)
+       {
+         GNUNET_break (0); //FIXME: not implemented
+       }
+      else
+       {
+         if (info->value.download.dc == dc)
+           GNUNET_SCHEDULER_shutdown (sched);
+       }
       break;
     case GNUNET_FS_STATUS_DOWNLOAD_STOPPED: 
       if (info->value.download.dc == dc)
@@ -168,25 +181,31 @@
   enum GNUNET_FS_DownloadOptions options;
 
   sched = s;
-  /* FIXME: check arguments */
-  uri = GNUNET_FS_uri_parse (args[0],
-                            &emsg);
-  if (NULL == uri)
+  if (do_directory)
     {
-      fprintf (stderr,
-              _("Failed to parse URI: %s\n"),
-              emsg);
-      GNUNET_free (emsg);
-      ret = 1;
-      return;
+      GNUNET_break (0); //FIXME: not implemented    
     }
-  if (! GNUNET_FS_uri_test_chk (uri))
+  else
     {
-      fprintf (stderr,
-              "Only CHK URIs supported right now.\n");
-      ret = 1;
-      GNUNET_FS_uri_destroy (uri);
-      return;           
+      uri = GNUNET_FS_uri_parse (args[0],
+                                &emsg);
+      if (NULL == uri)
+       {
+         fprintf (stderr,
+                  _("Failed to parse URI: %s\n"),
+                  emsg);
+         GNUNET_free (emsg);
+         ret = 1;
+         return;
+       }
+      if (! GNUNET_FS_uri_test_chk (uri))
+       {
+         fprintf (stderr,
+                  "Only CHK URIs supported right now.\n");
+         ret = 1;
+         GNUNET_FS_uri_destroy (uri);
+         return;                
+       }
     }
   if (NULL == filename)
     {
@@ -203,6 +222,8 @@
                         &progress_cb,
                         NULL,
                         GNUNET_FS_FLAGS_NONE,
+                        GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM,
+                        parallelism,
                         GNUNET_FS_OPTIONS_END);
   if (NULL == ctx)
     {
@@ -214,23 +235,32 @@
       return;
     }
   options = GNUNET_FS_DOWNLOAD_OPTION_NONE;
-  dc = GNUNET_FS_download_start (ctx,
-                                uri,
-                                NULL,
-                                filename,
-                                0,
-                                GNUNET_FS_uri_chk_get_file_size (uri),
-                                anonymity,
-                                options,
-                                NULL,
-                                NULL);
-  GNUNET_FS_uri_destroy (uri);
-  if (dc == NULL)
+  if (do_recursive)
+    options |= GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE;
+  if (do_directory)
     {
-      GNUNET_FS_stop (ctx);
-      ctx = NULL;
-      return;
+      GNUNET_break (0); //FIXME: not implemented
     }
+  else
+    {  
+      dc = GNUNET_FS_download_start (ctx,
+                                    uri,
+                                    NULL,
+                                    filename,
+                                    0,
+                                    GNUNET_FS_uri_chk_get_file_size (uri),
+                                    anonymity,
+                                    options,
+                                    NULL,
+                                    NULL);
+      GNUNET_FS_uri_destroy (uri);
+      if (dc == NULL)
+       {
+         GNUNET_FS_stop (ctx);
+         ctx = NULL;
+         return;
+       }
+    }
   GNUNET_SCHEDULER_add_delayed (sched,
                                GNUNET_TIME_UNIT_FOREVER_REL,
                                &shutdown_task,
@@ -245,28 +275,23 @@
   {'a', "anonymity", "LEVEL",
    gettext_noop ("set the desired LEVEL of receiver-anonymity"),
    1, &GNUNET_GETOPT_set_uint, &anonymity},
-#if 0
-  // FIXME: options!
   {'d', "directory", NULL,
    gettext_noop
    ("download a GNUnet directory that has already been downloaded.  Requires 
that a filename of an existing file is specified instead of the URI.  The 
download will only download the top-level files in the directory unless the 
`-R' option is also specified."),
-   0, &GNUNET_getopt_configure_set_one, &do_directory},
+   0, &GNUNET_GETOPT_set_one, &do_directory},
   {'D', "delete-incomplete", NULL,
    gettext_noop ("delete incomplete downloads (when aborted with CTRL-C)"),
-   0, &GNUNET_getopt_configure_set_one, &do_delete_incomplete},
-#endif
+   0, &GNUNET_GETOPT_set_one, &delete_incomplete},
   {'o', "output", "FILENAME",
    gettext_noop ("write the file to FILENAME"),
    1, &GNUNET_GETOPT_set_string, &filename},
-#if 0
   {'p', "parallelism", "DOWNLOADS",
    gettext_noop
    ("set the maximum number of parallel downloads that are allowed"),
-   1, &GNUNET_getopt_configure_set_uint, &parallelism},
+   1, &GNUNET_GETOPT_set_uint, &parallelism},
   {'R', "recursive", NULL,
    gettext_noop ("download a GNUnet directory recursively"),
-   0, &GNUNET_getopt_configure_set_one, &do_recursive},
-#endif
+   0, &GNUNET_GETOPT_set_one, &do_recursive},
   {'V', "verbose", NULL,
    gettext_noop ("be verbose (print progress information)"),
    0, &GNUNET_GETOPT_set_one, &verbose},

Modified: gnunet/src/fs/gnunet-pseudonym.c
===================================================================
--- gnunet/src/fs/gnunet-pseudonym.c    2010-03-30 17:44:19 UTC (rev 10721)
+++ gnunet/src/fs/gnunet-pseudonym.c    2010-03-31 06:40:20 UTC (rev 10722)
@@ -66,11 +66,6 @@
 static struct GNUNET_CONTAINER_MetaData *adv_metadata;
 
 /**
- * -n option.
- */
-static int no_advertising;
-
-/**
  * -p option.
  */
 static unsigned int priority = 365;
@@ -100,6 +95,10 @@
  */
 static struct GNUNET_FS_Namespace *ns;
 
+/**
+ * Our configuration.
+ */
+static const struct GNUNET_CONFIGURATION_Handle *cfg;
 
 static int ret;
 
@@ -126,11 +125,45 @@
 }
 
 
+static int
+pseudo_printer (void *cls,
+               const GNUNET_HashCode *
+               pseudonym,
+               const struct
+               GNUNET_CONTAINER_MetaData * md,
+               int rating)
+{
+  char *id;
+
+  id = GNUNET_PSEUDONYM_id_to_name (cfg,
+                                   pseudonym);
+  if (id == NULL)
+    {
+      GNUNET_break (0);
+      return GNUNET_OK;
+    }
+  fprintf (stdout, 
+          "%s (%d):\n",
+          id,
+          rating);
+  GNUNET_CONTAINER_meta_data_iterate (md,
+                                     &EXTRACTOR_meta_data_print, 
+                                     stdout);
+  fprintf (stdout, "\n");
+  GNUNET_free (id);
+  return GNUNET_OK;
+}
+
+
 static void
 post_advertising (void *cls,
                  const struct GNUNET_FS_Uri *uri,
                  const char *emsg)
 {
+  GNUNET_HashCode nsid;
+  char *set;
+  int delta;
+
   if (emsg != NULL)
     {
       fprintf (stderr, "%s", emsg);
@@ -153,7 +186,39 @@
     }
   if (NULL != rating_change)
     {
-      GNUNET_break (0); // FIXME: not implemented
+      set = rating_change;
+      while ((*set != '\0') && (*set != ':'))
+        set++;
+      if (*set != ':')
+       {
+         GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                     _("Invalid argument `%s'\n"),
+                     rating_change);
+       }
+      else
+       {
+         *set = '\0';
+         delta = strtol (&set[1], NULL, /* no error handling yet */
+                          10);
+         if (GNUNET_OK ==
+             GNUNET_PSEUDONYM_name_to_id (cfg,
+                                          rating_change,
+                                          &nsid))
+           {
+             GNUNET_PSEUDONYM_rank (cfg,
+                                    &nsid,
+                                    delta);
+             
+           }
+         else
+           {
+             GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                         _("Namespace `%s' unknown.\n"),
+                         rating_change);
+           }
+       }
+      GNUNET_free (rating_change);
+      rating_change = NULL;
     }
   if (0 != print_local_only)
     {
@@ -163,10 +228,10 @@
     }  
   else if (0 == no_remote_printing)
     {
-      GNUNET_break (0); // FIXME: not implemented
+      GNUNET_PSEUDONYM_list_all (cfg,
+                                &pseudo_printer,
+                                NULL);
     }
-  /* FIXME: is this OK here, or do we need
-     for completion of previous requests? */
   GNUNET_FS_stop (h);
 }
 
@@ -178,18 +243,20 @@
  * @param sched the scheduler to use
  * @param args remaining command-line arguments
  * @param cfgfile name of the configuration file used (for saving, can be 
NULL!)
- * @param cfg configuration
+ * @param c configuration
  */
 static void
 run (void *cls,
      struct GNUNET_SCHEDULER_Handle *sched,
      char *const *args,
      const char *cfgfile,
-     const struct GNUNET_CONFIGURATION_Handle *cfg)
+     const struct GNUNET_CONFIGURATION_Handle *c)
 {
   struct GNUNET_FS_Uri *ns_uri;
   struct GNUNET_TIME_Absolute expiration;
+  char *emsg;
 
+  cfg = c;
   h = GNUNET_FS_start (sched,
                       cfg,
                       "gnunet-pseudonym",
@@ -221,11 +288,18 @@
        }
       else
        {
-         if (0 == no_advertising)
+         if (NULL != root_identifier)
            {
-             GNUNET_break (0); // FIXME: not implemented
-             ns_uri = NULL; // FIXME!!
+             emsg = NULL;
+             ns_uri = GNUNET_FS_uri_sks_create (ns, root_identifier, &emsg);
+             GNUNET_assert (emsg == NULL);
              expiration = GNUNET_TIME_relative_to_absolute 
(GNUNET_TIME_UNIT_YEARS);
+             if (ksk_uri == NULL)
+               {
+                 emsg = NULL;
+                 ksk_uri = GNUNET_FS_uri_parse ("gnunet://fs/ksk/namespace", 
&emsg);
+                 GNUNET_assert (NULL == emsg);
+               }
              GNUNET_FS_publish_ksk (h,
                                     ksk_uri,
                                     adv_metadata,
@@ -275,9 +349,6 @@
   {'m', "meta", "TYPE:VALUE",
    gettext_noop ("set the meta-data for the given TYPE to the given VALUE"),
    1, &GNUNET_FS_getopt_set_metadata, &adv_metadata},
-  {'n', "no-advertisement", NULL,
-   gettext_noop ("do not create an advertisement"),
-   0, &GNUNET_GETOPT_set_one, &no_advertising},
   {'p', "priority", "PRIORITY",
    gettext_noop ("use the given PRIORITY for the advertisments"),
    1, &GNUNET_GETOPT_set_uint, &priority},

Modified: gnunet/src/fs/gnunet-publish.c
===================================================================
--- gnunet/src/fs/gnunet-publish.c      2010-03-30 17:44:19 UTC (rev 10721)
+++ gnunet/src/fs/gnunet-publish.c      2010-03-31 06:40:20 UTC (rev 10722)
@@ -24,9 +24,6 @@
  * @author Krista Bennett
  * @author James Blackwell
  * @author Igor Wronsky
- *
- * TODO:
- * - support for some options is still missing (uri argument)
  */
 #include "platform.h"
 #include "gnunet_fs_service.h"
@@ -307,6 +304,22 @@
 }
 
 
+static void 
+uri_ksk_continuation (void *cls,
+                     const struct GNUNET_FS_Uri *uri,
+                     const char *emsg)
+{
+  if (emsg != NULL)
+    {
+      fprintf (stderr,
+              "%s\n",
+              emsg);
+      ret = 1;
+    }
+  GNUNET_FS_stop (ctx);
+}
+
+
 /**
  * Main function that will be run by the scheduler.
  *
@@ -329,6 +342,7 @@
   struct stat sbuf;
   char *ex;
   char *emsg;
+  struct GNUNET_FS_Uri *uri;
   
   sched = s;
   /* check arguments */
@@ -421,11 +435,32 @@
        }
     }
   if (NULL != uri_string)
-    {
-      // FIXME -- implement!
+    {      
+      emsg = NULL;
+      uri = GNUNET_FS_uri_parse (uri_string,
+                                &emsg);
+      if (uri == NULL)
+       {
+         fprintf (stderr, 
+                  _("Failed to parse URI: %s\n"),
+                  emsg);
+         GNUNET_free (emsg);
+         GNUNET_FS_stop (ctx);
+         ret = 1;
+         return;         
+       }
+      GNUNET_FS_publish_ksk (ctx,
+                            topKeywords,
+                            meta,
+                            uri,
+                            GNUNET_TIME_relative_to_absolute 
(DEFAULT_EXPIRATION),
+                            anonymity,
+                            priority,
+                            GNUNET_FS_PUBLISH_OPTION_NONE,
+                            &uri_ksk_continuation,
+                            NULL);
       return;
     }
-
   l = NULL;
   if (! disable_extractor)
     {

Modified: gnunet/src/fs/gnunet-search.c
===================================================================
--- gnunet/src/fs/gnunet-search.c       2010-03-30 17:44:19 UTC (rev 10721)
+++ gnunet/src/fs/gnunet-search.c       2010-03-31 06:40:20 UTC (rev 10722)
@@ -24,9 +24,6 @@
  * @author Krista Bennett
  * @author James Blackwell
  * @author Igor Wronsky
- *
- * TODO:
- * - add many options (timeout, namespace search, etc.)
  */
 #include "platform.h"
 #include "gnunet_fs_service.h"
@@ -41,6 +38,10 @@
 
 static struct GNUNET_FS_SearchContext *sc;
 
+static char *output_filename;
+
+static struct GNUNET_FS_DirectoryBuilder *db;
+
 static unsigned int anonymity = 1;
 
 static int verbose;
@@ -64,12 +65,39 @@
   return GNUNET_OK;
 }
 
+
 static void
 clean_task (void *cls,
            const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
+  size_t dsize;
+  void *ddata;
+
   GNUNET_FS_stop (ctx);
   ctx = NULL;
+  if (output_filename == NULL)
+    return;
+  if (GNUNET_OK !=
+      GNUNET_FS_directory_builder_finish (db,
+                                         &dsize,       
+                                         &ddata))
+    {
+      GNUNET_break (0);
+      GNUNET_free (output_filename);    
+      return;
+    }
+  if (dsize != 
+      GNUNET_DISK_fn_write (output_filename,
+                           ddata,
+                           dsize,
+                           GNUNET_DISK_PERM_USER_READ | 
GNUNET_DISK_PERM_USER_WRITE))
+    {
+      fprintf (stderr,
+              _("Failed to write directory with search results to `%s'\n"),
+              output_filename);
+    }
+  GNUNET_free_non_null (ddata);
+  GNUNET_free (output_filename);
 }
 
 
@@ -99,6 +127,11 @@
     case GNUNET_FS_STATUS_SEARCH_START:
       break;
     case GNUNET_FS_STATUS_SEARCH_RESULT:
+      if (db != NULL)
+       GNUNET_FS_directory_builder_add (db,
+                                        
info->value.search.specifics.result.uri,
+                                        
info->value.search.specifics.result.meta,
+                                        NULL);
       uri = GNUNET_FS_uri_to_string (info->value.search.specifics.result.uri);
       printf ("%s:\n", uri);
       filename =
@@ -135,7 +168,6 @@
       GNUNET_SCHEDULER_shutdown (sched);
       break;
     case GNUNET_FS_STATUS_SEARCH_STOPPED: 
-      sc = NULL;
       GNUNET_SCHEDULER_add_continuation (sched,
                                         &clean_task, 
                                         NULL,
@@ -214,6 +246,8 @@
       ret = 1;
       return;
     }
+  if (output_filename != NULL)
+    db = GNUNET_FS_directory_builder_create (NULL);
   sc = GNUNET_FS_search_start (ctx,
                               uri,
                               anonymity,
@@ -241,7 +275,10 @@
   {'a', "anonymity", "LEVEL",
    gettext_noop ("set the desired LEVEL of receiver-anonymity"),
    1, &GNUNET_GETOPT_set_uint, &anonymity},
-  // FIXME: options!
+  {'o', "output", "PREFIX",
+   gettext_noop
+   ("write search results to file starting with PREFIX"),
+   1, &GNUNET_GETOPT_set_string, &output_filename},
   GNUNET_GETOPT_OPTION_END
 };
 

Modified: gnunet/src/include/gnunet_fs_service.h
===================================================================
--- gnunet/src/include/gnunet_fs_service.h      2010-03-30 17:44:19 UTC (rev 
10721)
+++ gnunet/src/include/gnunet_fs_service.h      2010-03-31 06:40:20 UTC (rev 
10722)
@@ -312,6 +312,26 @@
 
 
 /**
+ * Handle to one of our namespaces.
+ */
+struct GNUNET_FS_Namespace;
+
+
+/**
+ * Create an SKS URI from a namespace and an identifier.
+ *
+ * @param ns namespace
+ * @param id identifier
+ * @param emsg where to store an error message
+ * @return an FS URI for the given namespace and identifier
+ */
+struct GNUNET_FS_Uri *
+GNUNET_FS_uri_sks_create (struct GNUNET_FS_Namespace *ns,
+                         const char *id,
+                         char **emsg);
+
+
+/**
  * Get the ID of a namespace from the given
  * namespace URI.
  *
@@ -655,12 +675,6 @@
 
 
 /**
- * Handle to one of our namespaces.
- */
-struct GNUNET_FS_Namespace;
-
-
-/**
  * Handle for controlling an upload.
  */
 struct GNUNET_FS_PublishContext;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]