gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r22120 - gnunet/src/namestore


From: gnunet
Subject: [GNUnet-SVN] r22120 - gnunet/src/namestore
Date: Tue, 19 Jun 2012 23:14:48 +0200

Author: grothoff
Date: 2012-06-19 23:14:47 +0200 (Tue, 19 Jun 2012)
New Revision: 22120

Modified:
   gnunet/src/namestore/namestore_api.c
Log:
-starting a bit with namestore_api cleanup


Modified: gnunet/src/namestore/namestore_api.c
===================================================================
--- gnunet/src/namestore/namestore_api.c        2012-06-19 18:41:47 UTC (rev 
22119)
+++ gnunet/src/namestore/namestore_api.c        2012-06-19 21:14:47 UTC (rev 
22120)
@@ -54,17 +54,41 @@
    */
   struct GNUNET_NAMESTORE_QueueEntry *prev;
 
+  /**
+   * Main handle to access the namestore.
+   */
   struct GNUNET_NAMESTORE_Handle *nsh;
 
-  uint32_t op_id;
+  /**
+   *
+   */
+  GNUNET_NAMESTORE_ContinuationWithStatus cont;
 
-  GNUNET_NAMESTORE_ContinuationWithStatus cont;
+  /**
+   * Closure for 'cont'.
+   */
   void *cont_cls;
 
+  /**
+   * Function to call with the records we get back; or NULL.
+   */
   GNUNET_NAMESTORE_RecordProcessor proc;
+
+  /**
+   * Closure for 'proc'.
+   */
   void *proc_cls;
 
-  char *data; /*stub data pointer*/
+  /**
+   * stub data pointer (???)
+   */
+  char *data; 
+
+  /**
+   *
+   */
+  uint32_t op_id;
+
 };
 
 
@@ -84,15 +108,46 @@
    */
   struct GNUNET_NAMESTORE_ZoneIterator *prev;
 
-  uint32_t op_id;
+  /**
+   * Main handle to access the namestore.
+   */
+  struct GNUNET_NAMESTORE_Handle *h;
 
-  struct GNUNET_NAMESTORE_Handle *h;
+  /**
+   *
+   */
   GNUNET_NAMESTORE_RecordProcessor proc;
+
+  /**
+   * Closure for 'proc'.
+   */
   void* proc_cls;
+
+  /**
+   *
+   */
   struct GNUNET_CRYPTO_ShortHashCode zone;
+
+  /**
+   *
+   */
   uint32_t no_flags;
+
+  /**
+   *
+   */
   uint32_t flags;
+
+  /**
+   *
+   */
+  uint32_t op_id;
+
+  /**
+   *
+   */
   int has_zone;
+
 };
 
 
@@ -147,38 +202,56 @@
   struct GNUNET_CLIENT_TransmitHandle *th;
 
   /**
-   * Reconnect task
+   * Head of linked list of pending messages to send to the service
    */
-  GNUNET_SCHEDULER_TaskIdentifier reconnect_task;
+  struct PendingMessage * pending_head;
 
   /**
-   * Pending messages to send to the service
+   * Tail of linked list of pending messages to send to the service
    */
-
-  struct PendingMessage * pending_head;
   struct PendingMessage * pending_tail;
 
   /**
-   * Should we reconnect to service due to some serious error?
+   * Head of pending namestore queue entries
    */
-  int reconnect;
+  struct GNUNET_NAMESTORE_QueueEntry * op_head;
 
-
   /**
-   * Pending namestore queue entries
+   * Tail of pending namestore queue entries
    */
-  struct GNUNET_NAMESTORE_QueueEntry * op_head;
   struct GNUNET_NAMESTORE_QueueEntry * op_tail;
 
-  uint32_t op_id;
+  /**
+   * Head of pending namestore zone iterator entries
+   */
+  struct GNUNET_NAMESTORE_ZoneIterator * z_head;
 
   /**
-   * Pending namestore zone iterator entries
+   * Tail of pending namestore zone iterator entries
    */
-  struct GNUNET_NAMESTORE_ZoneIterator * z_head;
   struct GNUNET_NAMESTORE_ZoneIterator * z_tail;
+
+  /**
+   * Reconnect task
+   */
+  GNUNET_SCHEDULER_TaskIdentifier reconnect_task;
+
+  /**
+   * Should we reconnect to service due to some serious error?
+   */
+  int reconnect;
+
+  /**
+   * ???
+   */
+  uint32_t op_id;
+
 };
 
+
+/**
+ * ???
+ */
 struct GNUNET_NAMESTORE_SimpleRecord
 {
   /**
@@ -191,13 +264,41 @@
    */
   struct GNUNET_NAMESTORE_SimpleRecord *prev;
   
+  /**
+   * ???
+   */
   const char *name;
+
+  /**
+   * ???
+   */
   const struct GNUNET_CRYPTO_ShortHashCode *zone;
-  uint32_t record_type;
+
+  /**
+   * ???
+   */
+  const void *data;
+
+  /**
+   * ???
+   */
   struct GNUNET_TIME_Absolute expiration;
+
+  /**
+   * ???
+   */
+  size_t data_size;
+
+  /**
+   * ???
+   */
   enum GNUNET_NAMESTORE_RecordFlags flags;
-  size_t data_size;
-  const void *data;
+
+  /**
+   * ???
+   */
+  uint32_t record_type;
+
 };
 
 
@@ -210,23 +311,15 @@
 static void
 force_reconnect (struct GNUNET_NAMESTORE_Handle *h);
 
+
 static void
 handle_lookup_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
                              struct LookupNameResponseMessage * msg,
                              size_t size)
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' \n",
-              "LOOKUP_NAME_RESPONSE");
-
   struct GNUNET_NAMESTORE_Handle *h = qe->nsh;
-
-  /* Operation done, remove */
-  GNUNET_CONTAINER_DLL_remove(h->op_head, h->op_tail, qe);
-
-
   char *name;
   char * rd_tmp;
-
   struct GNUNET_CRYPTO_RsaSignature *signature = NULL;
   struct GNUNET_TIME_Absolute expire;
   struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *public_key_tmp;
@@ -237,6 +330,10 @@
   int contains_sig = GNUNET_NO;
   int rd_count = 0;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' \n",
+              "LOOKUP_NAME_RESPONSE");
+  /* Operation done, remove */
+  GNUNET_CONTAINER_DLL_remove(h->op_head, h->op_tail, qe);
   rd_len = ntohs (msg->rd_len);
   rd_count = ntohs (msg->rd_count);
   msg_len = ntohs (msg->gns_header.header.size);
@@ -437,6 +534,7 @@
   GNUNET_free (qe);
 }
 
+
 static void
 handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
                              struct ZoneToNameResponseMessage* msg,
@@ -559,6 +657,7 @@
   }
 }
 
+
 static void
 handle_zone_iteration_response (struct GNUNET_NAMESTORE_ZoneIterator *ze,
                                 struct ZoneIterationResponseMessage *msg,
@@ -653,6 +752,7 @@
   }
 }
 
+
 /**
  * Type of a function to call when we receive a message
  * from the service.
@@ -870,6 +970,7 @@
                                     h);
 }
 
+
 static uint32_t
 get_op_id (struct GNUNET_NAMESTORE_Handle *h)
 {
@@ -878,6 +979,7 @@
   return op_id;
 }
 
+
 /**
  * Initialize the connection with the NAMESTORE service.
  *
@@ -896,6 +998,7 @@
   return h;
 }
 
+
 static void
 clean_up_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
@@ -1477,8 +1580,6 @@
   uint32_t rid = 0;
 
   GNUNET_assert (NULL != h);
-
-
   rid = get_op_id(h);
   it = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_ZoneIterator));
   it->h = h;
@@ -1523,8 +1624,6 @@
   msg->must_have_flags = ntohs (must_have_flags);
   msg->must_not_have_flags = ntohs (must_not_have_flags);
 
-
-
   /* transmit message */
   GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe);
   do_transmit(h);
@@ -1637,10 +1736,8 @@
   struct GNUNET_NAMESTORE_Handle *h = qe->nsh;
 
   GNUNET_assert (qe != NULL);
-
   GNUNET_CONTAINER_DLL_remove(h->op_head, h->op_tail, qe);
   GNUNET_free(qe);
-
 }
 
 /* end of namestore_api.c */




reply via email to

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