gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r385 - in GNUnet: . src/applications/fs/ecrs src/applicatio


From: grothoff
Subject: [GNUnet-SVN] r385 - in GNUnet: . src/applications/fs/ecrs src/applications/fs/tools src/server
Date: Sun, 6 Mar 2005 01:55:26 -0800 (PST)

Author: grothoff
Date: 2005-03-06 01:55:24 -0800 (Sun, 06 Mar 2005)
New Revision: 385

Modified:
   GNUnet/src/applications/fs/ecrs/meta.c
   GNUnet/src/applications/fs/ecrs/search.c
   GNUnet/src/applications/fs/tools/gnunet-search.c
   GNUnet/src/server/core.c
   GNUnet/todo
Log:
actually implement equalsMetaData

Modified: GNUnet/src/applications/fs/ecrs/meta.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/meta.c      2005-03-06 09:45:08 UTC (rev 
384)
+++ GNUnet/src/applications/fs/ecrs/meta.c      2005-03-06 09:55:24 UTC (rev 
385)
@@ -728,6 +728,22 @@
  */
 int ECRS_equalsMetaData(const struct ECRS_MetaData * md1,
                        const struct ECRS_MetaData * md2) {
+  int i;
+  int j;
+  int found;
+
+  if (md1->itemCount != md2->itemCount)
+    return NO;
+  for (i=0;i<md1->itemCount;i++) {
+    found = NO;
+    for (j=0;j<md2->itemCount;j++)
+      if ( (md1->items[i].type == md2->items[j].type) &&
+          (0 == strcmp(md1->items[i].data,
+                       md2->items[j].data)) )
+       found = YES;
+    if (found == NO)
+      return NO;
+  }
   return YES;
 }
 

Modified: GNUnet/src/applications/fs/ecrs/search.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/search.c    2005-03-06 09:45:08 UTC (rev 
384)
+++ GNUnet/src/applications/fs/ecrs/search.c    2005-03-06 09:55:24 UTC (rev 
385)
@@ -550,9 +550,6 @@
       if (new_priority > 0xFFFFFF)
        new_priority = randomi(0xFFFFFF); /* if we get to large, reduce! */
       ps->priority = new_priority;
-
-      /* FIXME: checkAnonymityPolicy here */
-
       ps->lastTransmission = now;
       LOG(LOG_DEBUG,
          "ECRS initiating FS search with timeout %llus and priority %u.\n",

Modified: GNUnet/src/applications/fs/tools/gnunet-search.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-search.c    2005-03-06 09:45:08 UTC 
(rev 384)
+++ GNUnet/src/applications/fs/tools/gnunet-search.c    2005-03-06 09:55:24 UTC 
(rev 385)
@@ -30,8 +30,6 @@
 typedef struct {
   unsigned int resultCount;
   unsigned int max;
-
-  int buildDirectory;
   ECRS_FileInfo * fis;
   unsigned int fiCount;
 } SearchClosure;
@@ -63,16 +61,15 @@
   if (event->type != search_result)
     return;
   
+  /* retain URIs for possible directory dump later */
+  GROW(sc->fis,
+       sc->fiCount,
+       sc->fiCount+1);
+  sc->fis[sc->fiCount-1].uri
+    = ECRS_dupUri(event->data.SearchResult.fi.uri);
+  sc->fis[sc->fiCount-1].meta
+    = ECRS_dupMetaData(event->data.SearchResult.fi.meta);  
 
-  /* collect results to write directory? */
-  if (sc->buildDirectory) {
-    GROW(sc->fis,
-        sc->fiCount,
-        sc->fiCount+1);
-    sc->fis[sc->fiCount-1].uri = ECRS_dupUri(event->data.SearchResult.fi.uri);
-    sc->fis[sc->fiCount-1].meta = 
ECRS_dupMetaData(event->data.SearchResult.fi.meta);
-  }
-
   uri = ECRS_uriToString(event->data.SearchResult.fi.uri);
   printf("%s:\n",
         uri);
@@ -86,9 +83,9 @@
     printf("gnunet-download %s\n",
           uri);
   printMeta(event->data.SearchResult.fi.meta);
+  printf("\n");
   FREENONNULL(filename);
   FREE(uri);
-
   if (0 == --sc->max)
     run_shutdown(0);
 }
@@ -107,8 +104,8 @@
     HELP_LOGLEVEL,
     { 'm', "max", "LIMIT",
       gettext_noop("exit after receiving LIMIT results") },
-    { 'o', "output", "PREFIX",
-      gettext_noop("write encountered (decrypted) search results to the file 
PREFIX") },
+    { 'o', "output", "FILENAME",
+      gettext_noop("write encountered (decrypted) search results to FILENAME") 
},
     { 't', "timeout", "TIMEOUT",
       gettext_noop("wait TIMEOUT seconds for search results before aborting") 
},
     HELP_VERSION,
@@ -141,7 +138,7 @@
     };    
     c = GNgetopt_long(argc,
                      argv, 
-                     "a:vhdc:L:H:t:o:m:", 
+                     "a:c:dhH:L:m:o:t:v", 
                      long_options, 
                      &option_index);    
     if (c == -1) 
@@ -231,9 +228,11 @@
  */
 static int runSearch() {
   struct FSUI_Context * ctx;
-  SearchClosure max;
+  SearchClosure sc;
   char * suri;
   struct ECRS_URI * uri;
+  int i;
+  char * prefix;
 
   suri = getConfigurationString("GNUNET-SEARCH",
                                "URI");
@@ -246,18 +245,16 @@
     uri = FSUI_parseCharKeywordURI(suri);
   FREE(suri);
   
-  memset(&max, 0, sizeof(SearchClosure));
-  max.max = getConfigurationInt("FS",
-                               "MAXRESULTS");
-  max.resultCount = 0;  
-  if (max.max == 0)
-    max.max = (unsigned int)-1; /* infty */
-  /* FIXME: initialize max.buildDirectory */
-
+  memset(&sc, 0, sizeof(SearchClosure));
+  sc.max = getConfigurationInt("FS",
+                              "MAXRESULTS");
+  sc.resultCount = 0;  
+  if (sc.max == 0)
+    sc.max = (unsigned int)-1; /* infty */
   ctx = FSUI_start("gnunet-search",
                   NO,
                   (FSUI_EventCallback) &eventCallback,
-                  &max);
+                  &sc);
   if (ctx == NULL) {
     ECRS_freeUri(uri);
     return SYSERR;
@@ -272,38 +269,38 @@
   ECRS_freeUri(uri);
   FSUI_stop(ctx);
 
-#if 0  
   prefix = getConfigurationString("GNUNET-SEARCH",
                                  "OUTPUT_PREFIX");
   if (prefix != NULL) {
     char * outfile;
     unsigned long long n;
     char * data;
+    struct ECRS_MetaData * meta;
 
+    meta = ECRS_createMetaData();
+    /* ?: anything here to put into meta? */
     if (OK == ECRS_createDirectory(&data,
                                   &n,
-                                  42,
-                                  fis,
-                                  NULL)) {
-      n = strlen(prefix)+16;
-      outfile = MALLOC(n);
-      SNPRINTF(outfile, 
-              n,
-              "%s%s", 
-              prefix, 
-              ".gnd");
+                                  sc.fiCount,
+                                  sc.fis,
+                                  meta)) {
+      outfile = expandFileName(prefix);
       writeFile(outfile,
-               rootNode,
-               sizeof(RootNode),
+               data,
+               n,
                "600");
-      FREE(outfile);
-      FREE(prefix);
+      FREE(outfile);    
       FREE(data);
-    }
+    } 
+    FREE(prefix);
   }
-#endif
-
-
+  for (i=0;i<sc.fiCount;i++) {
+    ECRS_freeUri(sc.fis[i].uri);
+    ECRS_freeMetaData(sc.fis[i].meta);    
+  }
+  GROW(sc.fis,
+       sc.fiCount,
+       0);
   return OK;
 }
 

Modified: GNUnet/src/server/core.c
===================================================================
--- GNUnet/src/server/core.c    2005-03-06 09:45:08 UTC (rev 384)
+++ GNUnet/src/server/core.c    2005-03-06 09:55:24 UTC (rev 385)
@@ -86,16 +86,23 @@
  * Load the application module named "pos".
  * @return OK on success, SYSERR on error
  */ 
-static int loadApplicationModule(const char * pos) {
+static int loadApplicationModule(const char * rpos) {
   int ok;
   ShutdownList * nxt;
   ApplicationInitMethod mptr;
   void * library;
   char * name;
+  char * pos;
 
+  pos = getConfigurationString("MODULES",
+                              rpos);
+  if (pos == NULL)
+    pos = STRDUP(rpos);
+
   name = MALLOC(strlen(pos) + strlen("module_") + 1);
   strcpy(name, "module_");
   strcat(name, pos);
+  FREE(pos);    
 
   nxt = shutdownList;
   while (nxt != NULL) {

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2005-03-06 09:45:08 UTC (rev 384)
+++ GNUnet/todo 2005-03-06 09:55:24 UTC (rev 385)
@@ -7,21 +7,19 @@
 
 0.7.0pre1 [4'05] (aka "preview"):
 - testing:
-  * sqlite-tests: test update function, concurrency with iterators
-  * gnunet-directory
+  * sqlite-tests: test update function, concurrency with iterators, multiple 
results
   * gnunet-pseudonym
+- gnunet-search:
+  * multiple search results don't work (yet); test on sqlite, FSLIB and ECRS 
levels!
 - topology:
   * do aggressive bootstrap on first start (Christian) [ easy ]
-- gnunet-search: 
-  * dump directory with search results [ easy ]
-- ecrs-search:
-  * anonymity policy is ignored (really?) [ easy ]
 - gap:
   * economy for local queries (see applications/gap/TODO) [ tricky ]
 - FSUI:
   * download: various details wrt generated events
   * namespace updates
   * collections
+  * testing
 
 0.7.0 [5'05] (aka "compatibility? what's that?"):
 - Missing Features:





reply via email to

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