gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r8014 - GNUnet/src/include


From: gnunet
Subject: [GNUnet-SVN] r8014 - GNUnet/src/include
Date: Thu, 25 Dec 2008 23:42:40 -0700 (MST)

Author: grothoff
Date: 2008-12-25 23:42:40 -0700 (Thu, 25 Dec 2008)
New Revision: 8014

Modified:
   GNUnet/src/include/gnunet_dht_lib.h
   GNUnet/src/include/gnunet_util_containers.h
Log:
api cleanup

Modified: GNUnet/src/include/gnunet_dht_lib.h
===================================================================
--- GNUnet/src/include/gnunet_dht_lib.h 2008-12-26 06:42:27 UTC (rev 8013)
+++ GNUnet/src/include/gnunet_dht_lib.h 2008-12-26 06:42:40 UTC (rev 8014)
@@ -37,9 +37,17 @@
 #endif
 #endif
 
+/**
+ * Opaque handle for asynchronous DHT get operation group.
+ */
 struct GNUNET_DHT_Context;
 
 /**
+ * Opaque handle for a DHT get request.
+ */
+struct GNUNET_DHT_GetRequest;
+
+/**
  * Set up a context for performing asynchronous DHT operations.
  *
  * @param resultCallback function to call for results,
@@ -47,15 +55,11 @@
  *        GNUNET_SYSERR
  * @return NULL on error
  */
-struct GNUNET_DHT_Context *GNUNET_DHT_context_create (struct
-                                                      GNUNET_GC_Configuration
-                                                      *cfg,
-                                                      struct GNUNET_GE_Context
-                                                      *ectx,
-                                                      GNUNET_ResultProcessor
-                                                      resultCallback,
-                                                      void
-                                                      *resCallbackClosure);
+struct GNUNET_DHT_Context *
+GNUNET_DHT_context_create (struct GNUNET_GC_Configuration *cfg,
+                          struct GNUNET_GE_Context *ectx,
+                          GNUNET_ResultProcessor resultCallback,
+                          void *resCallbackClosure);
 
 /**
  * Start an asynchronous GET operation on the DHT looking for
@@ -63,21 +67,21 @@
  *
  * @param type the type of key to look up
  * @param key the key to look up
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @return NULL on error
  */
-int GNUNET_DHT_get_start (struct GNUNET_DHT_Context *ctx,
-                          unsigned int type, const GNUNET_HashCode * key);
+struct GNUNET_DHT_GetRequest *
+GNUNET_DHT_get_start (struct GNUNET_DHT_Context *ctx,
+                     unsigned int type, const GNUNET_HashCode * key);
 
-
 /**
  * Stop an asynchronous GET operation on the DHT looking for
  * key.
- * @param type the type of key to look up
- * @param key the key to look up
+ *
+ * @param handle request to stop
  * @return GNUNET_OK on success, GNUNET_SYSERR on error
  */
 int GNUNET_DHT_get_stop (struct GNUNET_DHT_Context *ctx,
-                         unsigned int type, const GNUNET_HashCode * key);
+                        struct GNUNET_DHT_GetRequest * handle);
 
 /**
  * Destroy a previously created context for DHT operations.

Modified: GNUnet/src/include/gnunet_util_containers.h
===================================================================
--- GNUnet/src/include/gnunet_util_containers.h 2008-12-26 06:42:27 UTC (rev 
8013)
+++ GNUnet/src/include/gnunet_util_containers.h 2008-12-26 06:42:40 UTC (rev 
8014)
@@ -23,10 +23,6 @@
  * @brief container classes for GNUnet
  *
  * @author Christian Grothoff
- * @author Krista Bennett
- * @author Gerd Knorr <address@hidden>
- * @author Ioana Patrascu
- * @author Tzvetan Horozov
  * @author Nils Durner
  */
 
@@ -522,6 +518,44 @@
 void *GNUNET_multi_hash_map_get_random (const struct GNUNET_MultiHashMap
                                         *map);
 
+
+
+
+/* ******************** doubly-linked list *************** */
+
+/**
+ * Insert an element into a DLL. Assumes
+ * that head, tail and element are structs
+ * with prev and next fields.
+ */
+#define GNUNET_DLL_insert(head,tail,element) \
+  (element)->next = (head); \
+  (element)->prev = NULL; \
+  if ((tail) == NULL) \
+    (tail) = element; \
+  else \
+    (head)->prev = element; \
+  (head) = (element);
+
+/**
+ * Remove an element from a DLL. Assumes
+ * that head, tail and element are structs
+ * with prev and next fields.
+ */
+#define GNUNET_DLL_remove(head,tail,element) \
+  if ((element)->prev == NULL) \
+    (head) = (element)->next;  \
+  else \
+    (element)->prev->next = (element)->next; \
+  if ((element)->next == NULL) \
+    (tail) = (element)->prev;  \
+  else \
+    (element)->next->prev = (element)->prev;
+
+
+
+
+
 #if 0                           /* keep Emacsens' auto-indent happy */
 {
 #endif





reply via email to

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