API fix
authorChristian Grothoff <christian@grothoff.org>
Sun, 25 Oct 2009 19:36:38 +0000 (19:36 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 25 Oct 2009 19:36:38 +0000 (19:36 +0000)
src/fs/fs_search.c
src/fs/gnunet-search.c
src/fs/test_fs_namespace.c
src/fs/test_fs_search.c
src/include/gnunet_fs_service.h

index 94b8b20823c97e3368fc943456b12e68ddb01b2a..8b986ec7cc206e092a0574a9b1e338cacdb97a23 100644 (file)
@@ -268,6 +268,7 @@ process_ksk_result (struct GNUNET_FS_SearchContext *sc,
  * @param uri specifies the search parameters; can be
  *        a KSK URI or an SKS URI.
  * @param anonymity desired level of anonymity
+ * @param cctx client context
  * @param parent parent search (for namespace update searches)
  * @return context that can be used to control the search
  */
@@ -275,6 +276,7 @@ static struct GNUNET_FS_SearchContext *
 search_start (struct GNUNET_FS_Handle *h,
              const struct GNUNET_FS_Uri *uri,
              uint32_t anonymity,
+             void *cctx,
              struct GNUNET_FS_SearchContext *parent);
 
 
@@ -336,6 +338,7 @@ process_sks_result (struct GNUNET_FS_SearchContext *sc,
   search_start (sc->h,
                &uu,
                sc->anonymity,
+               NULL,
                sc);
 }
 
@@ -733,6 +736,7 @@ try_reconnect (struct GNUNET_FS_SearchContext *sc)
  * @param uri specifies the search parameters; can be
  *        a KSK URI or an SKS URI.
  * @param anonymity desired level of anonymity
+ * @param cctx initial value for the client context
  * @param parent parent search (for namespace update searches)
  * @return context that can be used to control the search
  */
@@ -740,6 +744,7 @@ static struct GNUNET_FS_SearchContext *
 search_start (struct GNUNET_FS_Handle *h,
              const struct GNUNET_FS_Uri *uri,
              uint32_t anonymity,
+             void *cctx,
              struct GNUNET_FS_SearchContext *parent)
 {
   struct GNUNET_FS_SearchContext *sc;
@@ -780,6 +785,7 @@ search_start (struct GNUNET_FS_Handle *h,
   sc->client = client;  
   sc->parent = parent;
   sc->master_result_map = GNUNET_CONTAINER_multihashmap_create (16);
+  sc->client_info = cctx;
 
   sc->requests = GNUNET_malloc (sizeof (struct SearchRequestEntry) *
                                sc->uri->data.ksk.keywordCount);
@@ -827,14 +833,16 @@ search_start (struct GNUNET_FS_Handle *h,
  * @param uri specifies the search parameters; can be
  *        a KSK URI or an SKS URI.
  * @param anonymity desired level of anonymity
+ * @param cctx initial value for the client context
  * @return context that can be used to control the search
  */
 struct GNUNET_FS_SearchContext *
 GNUNET_FS_search_start (struct GNUNET_FS_Handle *h,
                        const struct GNUNET_FS_Uri *uri,
-                       uint32_t anonymity)
+                       uint32_t anonymity,
+                       void *cctx)
 {
-  return search_start (h, uri, anonymity, NULL);
+  return search_start (h, uri, anonymity, cctx, NULL);
 }
 
 
index ed864fa1cfa8ac12a3f0d211c843857b662fbb58..067d7715977326645856354d073ea76101b35520 100644 (file)
@@ -179,7 +179,8 @@ run (void *cls,
     }
   sc = GNUNET_FS_search_start (ctx,
                               uri,
-                              anonymity);
+                              anonymity,
+                              NULL);
   GNUNET_FS_uri_destroy (uri);
   if (NULL == sc)
     {
index 04e82c5d70910eea23e3ed8bc7f6f32bb86603d4..7a1a6f81e94885a46f9d3e297d6a61d76a2082b9 100644 (file)
@@ -108,7 +108,7 @@ publish_cont (void *cls,
 
   GNUNET_assert (NULL == emsg);
   fprintf (stderr, "Starting namespace search...\n");
-  search = GNUNET_FS_search_start (fs, uri, 1);
+  search = GNUNET_FS_search_start (fs, uri, 1, "ns-search");
 }
 
 
index 01bb3c1f709a9dc987a9b2382f22bd94125402e0..d1b5f77aa331f5182d331fb6c192db2c70943792 100644 (file)
@@ -114,7 +114,8 @@ progress_cb (void *cls,
       start = GNUNET_TIME_absolute_get ();
       search = GNUNET_FS_search_start (fs,
                                       kuri,
-                                      1);
+                                      1,
+                                      "search");
       GNUNET_FS_uri_destroy (kuri);
       GNUNET_assert (search != NULL);
       break;
@@ -165,7 +166,7 @@ progress_cb (void *cls,
       break;
     case GNUNET_FS_STATUS_SEARCH_START:
       GNUNET_assert (search == NULL);
-      //  GNUNET_assert (0 == strcmp ("search", event->value.search.cctx));
+      GNUNET_assert (0 == strcmp ("search", event->value.search.cctx));
       GNUNET_assert (1 == event->value.search.anonymity);
       break;
     case GNUNET_FS_STATUS_SEARCH_RESULT_STOPPED:
index 6ce4b6d11ef1ef0d8800332c54d26102ba0ece68..cfba8ccba9dc0e5f003308869eb5ed36c0dd5778 100644 (file)
@@ -2153,13 +2153,14 @@ GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace,
  * @param uri specifies the search parameters; can be
  *        a KSK URI or an SKS URI.
  * @param anonymity desired level of anonymity
+ * @param cctx initial value for the client context
  * @return context that can be used to control the search
  */
-// FIXME: add a "void *" context for the client to arguments!?
 struct GNUNET_FS_SearchContext *
 GNUNET_FS_search_start (struct GNUNET_FS_Handle *h,
                        const struct GNUNET_FS_Uri *uri,
-                       uint32_t anonymity);
+                       uint32_t anonymity,
+                       void *cctx);
 
 
 /**