gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r19827 - in gnunet/src: gns include


From: gnunet
Subject: [GNUnet-SVN] r19827 - in gnunet/src: gns include
Date: Thu, 16 Feb 2012 21:38:29 +0100

Author: schanzen
Date: 2012-02-16 21:38:29 +0100 (Thu, 16 Feb 2012)
New Revision: 19827

Removed:
   gnunet/src/gns/gnunet-gns-add.c
Modified:
   gnunet/src/gns/Makefile.am
   gnunet/src/gns/gns.h
   gnunet/src/gns/gns_api.c
   gnunet/src/gns/gnunet-gns-lookup.c
   gnunet/src/gns/gnunet-service-gns.c
   gnunet/src/include/gnunet_gns_service.h
Log:
- removed add, other feedback


Modified: gnunet/src/gns/Makefile.am
===================================================================
--- gnunet/src/gns/Makefile.am  2012-02-16 20:05:40 UTC (rev 19826)
+++ gnunet/src/gns/Makefile.am  2012-02-16 20:38:29 UTC (rev 19827)
@@ -22,21 +22,12 @@
   gnunet-service-gns
 
 noinst_PROGRAMS = \
-  gnunet-gns-lookup gnunet-gns-add
+  gnunet-gns-lookup
 
 #check_SCRIPTS = \
 # test_gnunet_dns.sh
 
 
-gnunet_gns_add_SOURCES = \
- gnunet-gns-add.c
-gnunet_gns_add_LDADD = \
-  $(top_builddir)/src/gns/libgnunetgns.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(GN_LIBINTL)
-gnunet_dns_add_DEPENDENCIES = \
-  libgnunetgns.la
-
 gnunet_gns_lookup_SOURCES = \
  gnunet-gns-lookup.c
 gnunet_gns_lookup_LDADD = \

Modified: gnunet/src/gns/gns.h
===================================================================
--- gnunet/src/gns/gns.h        2012-02-16 20:05:40 UTC (rev 19826)
+++ gnunet/src/gns/gns.h        2012-02-16 20:38:29 UTC (rev 19827)
@@ -53,15 +53,9 @@
   /**
    * the type of record to look up
    */
-  // FIXME: bad type
+  // FIXME: bad type - should be of GNUNET_GNS_RecordType
   int type;
 
-  /**
-   * Length of name to lookup
-   * // FIXME: redundant
-   */
-  uint32_t namelen;
-
   /* Followed by the name to look up */
 };
 

Modified: gnunet/src/gns/gns_api.c
===================================================================
--- gnunet/src/gns/gns_api.c    2012-02-16 20:05:40 UTC (rev 19826)
+++ gnunet/src/gns/gns_api.c    2012-02-16 20:38:29 UTC (rev 19827)
@@ -435,6 +435,7 @@
 {
   const struct GNUNET_GNS_ClientResultMessage *gns_msg = cls;
   struct GNUNET_GNS_LookupHandle *lookup_handle = value;
+  const char *name = (const char*) &lookup_handle[1];
   const struct GNUNET_GNS_Record *records;
   uint32_t num_records;
   size_t meta_length;
@@ -467,7 +468,7 @@
        (unsigned int) (msize - meta_length), GNUNET_h2s (key));
 #endif
   records = (const struct GNUNET_GNS_Record *) &gns_msg[1];
-  lookup_handle->iter (lookup_handle->iter_cls, key, records, num_records);
+  lookup_handle->iter (lookup_handle->iter_cls, name, records, num_records);
   return GNUNET_YES;
 }
 
@@ -559,37 +560,10 @@
 
 
 /**
- * Add a new record to the GNS.
- *
- * @param handle handle to GNS service
- * @param record the record to store
- * @param exp desired expiration time for the value
- * @param timeout how long to wait for transmission of this request
- */
-void
-GNUNET_GNS_add_record (struct GNUNET_GNS_Handle *handle,
-                       const char* name,
-                       enum GNUNET_GNS_RecordType type,
-                       size_t size, const char *data,
-                       struct GNUNET_TIME_Absolute exp,
-                       struct GNUNET_TIME_Relative timeout)
-{
-  /**
-   * build add record message
-   */
-  struct GNUNET_GNS_Record *record;
-
-  record = GNUNET_malloc(sizeof (struct GNUNET_GNS_Record));
-  /**
-   * TODO
-   * queue_record_msg(handle, record);
-   **/
-}
-
-
-/**
  * Perform an asynchronous Lookup operation on the GNS.
- * TODO: Still not sure what we query for... "names" it is for now
+ * TODO:
+ *    - Still not sure what we query for... "names" it is for now
+ *    - Do we need such sophisticated message queueing like dht? simplify?
  *
  * @param handle handle to the GNS service
  * @param timeout how long to wait for transmission of this request to the 
service
@@ -632,7 +606,6 @@
   pending->free_on_send = GNUNET_NO;
   lookup_msg->header.size = htons (msize);
   lookup_msg->header.type = htons (GNUNET_MESSAGE_TYPE_GNS_CLIENT_LOOKUP);
-  lookup_msg->namelen = strlen(name);
   lookup_msg->key = key;
   memcpy(&lookup_msg[1], name, strlen(name));
   handle->uid_gen++;

Deleted: gnunet/src/gns/gnunet-gns-add.c
===================================================================
--- gnunet/src/gns/gnunet-gns-add.c     2012-02-16 20:05:40 UTC (rev 19826)
+++ gnunet/src/gns/gnunet-gns-add.c     2012-02-16 20:38:29 UTC (rev 19827)
@@ -1,200 +0,0 @@
-/*
-     This file is part of GNUnet.
-     (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009 Christian Grothoff (and 
other contributing authors)
-
-     GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
-
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
-*/
-/**
- * @file gns/gnunet-gns-add.c
- * @brief search for data in GNS
- * @author Martin Schanzenbach
- */
-#include "platform.h"
-#include "gnunet_gns_service.h"
-
-/**
- * The type of the record
- */
-static unsigned int record_type;
-
-/**
- * The key for the recprd
- */
-static char *record_key;
-
-/**
- * User supplied timeout value
- */
-static unsigned long long timeout_request = 5;
-
-/**
- * User supplied expiration value
- */
-static unsigned long long expiration_seconds = 3600;
-
-/**
- * Desired replication level.
- */
-static unsigned int replication = 5;
-
-/**
- * Be verbose
- */
-static int verbose;
-
-/**
- * Handle to the GNS
- */
-static struct GNUNET_GNS_Handle *gns_handle;
-
-
-/**
- * Global handle of the configuration
- */
-static const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-/**
- * Global status value
- */
-static int ret;
-
-/**
- * The data to insert into the dht
- */
-static char *data;
-
-static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  if (gns_handle != NULL)
-  {
-    GNUNET_GNS_disconnect (gns_handle);
-    gns_handle = NULL;
-  }
-}
-
-/**
- * Signature of the main function of a task.
- *
- * @param cls closure
- * @param tc context information (why was this task triggered now)
- */
-void
-message_sent_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  if (verbose)
-    FPRINTF (stderr, "%s",  _("PUT request sent!\n"));
-  GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
-}
-
-/**
- * Main function that will be run by the scheduler.
- *
- * @param cls closure
- * @param args remaining command-line arguments
- * @param cfgfile name of the configuration file used (for saving, can be 
NULL!)
- * @param c configuration
- */
-static void
-run (void *cls, char *const *args, const char *cfgfile,
-     const struct GNUNET_CONFIGURATION_Handle *c)
-{
-  struct GNUNET_TIME_Relative timeout;
-  struct GNUNET_TIME_Absolute expiration;
-
-  cfg = c;
-
-  if ((record_key == NULL) || (data == NULL))
-  {
-    FPRINTF (stderr, "%s",  _("Must provide KEY and DATA for GNS record!\n"));
-    ret = 1;
-    return;
-  }
-
-  gns_handle = GNUNET_GNS_connect (cfg, 1);
-  if (gns_handle == NULL)
-  {
-    FPRINTF (stderr, _("Could not connect to %s service!\n"), "GNS");
-    ret = 1;
-    return;
-  }
-  else if (verbose)
-    FPRINTF (stderr, _("Connected to %s service!\n"), "GNS");
-
-  timeout =
-      GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 
timeout_request);
-  expiration =
-      GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply
-                                        (GNUNET_TIME_UNIT_SECONDS,
-                                         expiration_seconds));
-
-  if (verbose)
-    FPRINTF (stderr, _("Issuing add request for `%s' with data `%s'!\n"),
-             record_key, data);
-  GNUNET_GNS_add_record (gns_handle, record_key,
-                         0/*RecordType*/,
-                         strlen (data), data, expiration, timeout);
-
-}
-
-
-/**
- * gnunet-gns-add command line options
- */
-static struct GNUNET_GETOPT_CommandLineOption options[] = {
-  {'d', "data", "DATA",
-   gettext_noop ("the data to insert under the key"),
-   1, &GNUNET_GETOPT_set_string, &data},
-  {'e', "expiration", "EXPIRATION",
-   gettext_noop ("how long to store this entry in the GNS (in seconds)"),
-   1, &GNUNET_GETOPT_set_ulong, &expiration_seconds},
-  {'k', "key", "KEY",
-   gettext_noop ("the record key"),
-   1, &GNUNET_GETOPT_set_string, &record_key},
-  {'r', "replication", "LEVEL",
-   gettext_noop ("how many replicas to create"),
-   1, &GNUNET_GETOPT_set_uint, &replication},
-  {'t', "type", "TYPE",
-   gettext_noop ("the type to insert record as"),
-   1, &GNUNET_GETOPT_set_uint, &record_type},
-  {'T', "timeout", "TIMEOUT",
-   gettext_noop ("how long to execute this query before giving up?"),
-   1, &GNUNET_GETOPT_set_ulong, &timeout_request},
-  {'V', "verbose", NULL,
-   gettext_noop ("be verbose (print progress information)"),
-   0, &GNUNET_GETOPT_set_one, &verbose},
-  GNUNET_GETOPT_OPTION_END
-};
-
-
-/**
- * Entry point for gnunet-gns-add
- *
- * @param argc number of arguments from the command line
- * @param argv command line arguments
- * @return 0 ok, 1 on error
- */
-int
-main (int argc, char *const *argv)
-{
-  return (GNUNET_OK ==
-          GNUNET_PROGRAM_run (argc, argv, "gnunet-gns-add",
-                              gettext_noop
-                              ("Issue an add to the GNUnet NS of DATA under 
KEY."),
-                              options, &run, NULL)) ? ret : 1;
-}
-
-/* end of gnunet-gns-put.c */

Modified: gnunet/src/gns/gnunet-gns-lookup.c
===================================================================
--- gnunet/src/gns/gnunet-gns-lookup.c  2012-02-16 20:05:40 UTC (rev 19826)
+++ gnunet/src/gns/gnunet-gns-lookup.c  2012-02-16 20:38:29 UTC (rev 19827)
@@ -71,11 +71,6 @@
 static struct GNUNET_GNS_LookupHandle *lookup_handle;
 
 /**
- * Count of results found
- */
-static unsigned int result_count;
-
-/**
  * Global status value
  */
 static int ret;
@@ -121,11 +116,11 @@
  */
 static void
 lookup_result_iterator (void *cls,
-                        const GNUNET_HashCode * key,
+                        const char * name,
                         const struct GNUNET_GNS_Record *record,
                         unsigned int num_records)
 {
-  FPRINTF (stdout, "Results %d\n", num_records);
+  FPRINTF (stdout, "%d results for %s\n", num_records, name);
 }
 
 

Modified: gnunet/src/gns/gnunet-service-gns.c
===================================================================
--- gnunet/src/gns/gnunet-service-gns.c 2012-02-16 20:05:40 UTC (rev 19826)
+++ gnunet/src/gns/gnunet-service-gns.c 2012-02-16 20:38:29 UTC (rev 19827)
@@ -134,14 +134,6 @@
 {
 }
 
-/*TODO*/
-static void
-handle_client_record_add(void *cls,
-                         struct GNUNET_SERVER_Client *client,
-                         const struct GNUNET_MessageHeader *message)
-{
-}
-
 /**
  * Process GNS requests.
  *
@@ -158,8 +150,6 @@
     /* callback, cls, type, size */
     {&handle_client_record_lookup, NULL, GNUNET_MESSAGE_TYPE_GNS_CLIENT_LOOKUP,
       0},
-    /*{&handle_client_record_add, NULL, GNUNET_MESSAGE_TYPE_GNS_CLIENT_ADD,
-      0},*/
     {NULL, NULL, 0, 0}
   };
   

Modified: gnunet/src/include/gnunet_gns_service.h
===================================================================
--- gnunet/src/include/gnunet_gns_service.h     2012-02-16 20:05:40 UTC (rev 
19826)
+++ gnunet/src/include/gnunet_gns_service.h     2012-02-16 20:38:29 UTC (rev 
19827)
@@ -93,61 +93,21 @@
 GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle);
 
 
-/* *************** Standard API: add and lookup ******************* */
+/* *************** Standard API: lookup ******************* */
 
 /**
- * Perform an add operation storing records in the GNS.
- *
- * FIXME: Yes, we need this kind of API, but should it not be with the
- * NameDataStore, rather than the GNS-service?
- *
- * @param handle handle to GNS service
- * @param name the key to store under
- * // FIXME: need to be precise here what 'name' is. Does it
-   // include '.gnunet'?  What happens if we specify 'a.b.c.gnunet'
-   //  but 'b.c.gnunet' has been delegated? (error?)  
- * @param desired_replication_level estimate of how many
- *                nearest peers this request should reach
- * @param options routing options for this message
-   // FIXME: which are? where is the arg?
-   // FIXME: we should probably distinguish between 'private' and 'public'
-   //        records;
- * @param type type of the value
- * @param size number of bytes in data; must be less than 64k
- * @param data the data to store
-   // FIXME: what is the exact format of data?
- * @param exp desired expiration time for the value
- * @param timeout how long to wait for transmission of this request
- * @param cont continuation to call when done (transmitting request to service)
- * @param cont_cls closure for cont
- * // FIXME: where are the continuations?
- */
-void
-GNUNET_GNS_add_record (struct GNUNET_GNS_Handle *handle,
-                       const char* name,
-                       enum GNUNET_GNS_RecordType type,
-                       size_t size, const char *data,
-                       struct GNUNET_TIME_Absolute exp,
-                       struct GNUNET_TIME_Relative timeout);
-
-
-/**
  * Iterator called on each result obtained for a GNS
  * operation that expects a reply TODO: eh?
  *
  *
  * @param cls closure
- * @param exp when will this value expire
- * @param key key of the result
- * // how does the key relate to the name exactly? Why not give the name?
+ * @param name "name" of the original lookup
  * @param record the records in reply
- * // FIXME: shouldn't this then be an array of pointers?
+ * // FIXME: shouldn't this then be an array of pointers? - not sure as of yet
  * @param num_records the number of records in reply
- * @param type type of the result
- * // FIXME: not in signature
  */
 typedef void (*GNUNET_GNS_LookupIterator) (void *cls,
-                                        const GNUNET_HashCode * key,
+                                        const char * name,
                                         const struct GNUNET_GNS_Record *record,
                                         unsigned int num_records);
 
@@ -160,14 +120,8 @@
  * @param timeout how long to wait for transmission of this request to the 
service
  * // FIXME: what happens afterwards?
  * @param type expected type of the response object
- * @param key the key to look up
- * // FIXME: key, name, what format?
- * @param desired_replication_level estimate of how many
-                  nearest peers this request should reach
- * @param options routing options for this message
- * //FIXME: missmatch between documented and actual options...
- * @param xquery extended query data (can be NULL, depending on type)
- * @param xquery_size number of bytes in xquery
+ * @param name the name to look up
+ * @param type the GNUNET_GNS_RecordType to look for
  * @param iter function to call on each result
  * @param iter_cls closure for iter
  *
@@ -175,11 +129,11 @@
  */
 struct GNUNET_GNS_LookupHandle *
 GNUNET_GNS_lookup_start (struct GNUNET_GNS_Handle *handle,
-                      struct GNUNET_TIME_Relative timeout,
-                      const char * name,
-                      enum GNUNET_GNS_RecordType type,
-                      GNUNET_GNS_LookupIterator iter,
-                      void *iter_cls);
+                         struct GNUNET_TIME_Relative timeout,
+                         const char * name,
+                         enum GNUNET_GNS_RecordType type,
+                         GNUNET_GNS_LookupIterator iter,
+                         void *iter_cls);
 
 
 /**




reply via email to

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