gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r29721 - in gnunet/src: include revocation set


From: gnunet
Subject: [GNUnet-SVN] r29721 - in gnunet/src: include revocation set
Date: Mon, 30 Sep 2013 21:02:32 +0200

Author: grothoff
Date: 2013-09-30 21:02:32 +0200 (Mon, 30 Sep 2013)
New Revision: 29721

Modified:
   gnunet/src/include/gnunet_revocation_service.h
   gnunet/src/include/gnunet_set_service.h
   gnunet/src/revocation/gnunet-service-revocation.c
   gnunet/src/set/set_api.c
Log:
-doxygen, todos, minor code cleanup



Modified: gnunet/src/include/gnunet_revocation_service.h
===================================================================
--- gnunet/src/include/gnunet_revocation_service.h      2013-09-30 18:55:53 UTC 
(rev 29720)
+++ gnunet/src/include/gnunet_revocation_service.h      2013-09-30 19:02:32 UTC 
(rev 29721)
@@ -129,11 +129,13 @@
  *
  * @param key key to check for
  * @param pow proof of work value
+ * @param matching_bits how many bits must match (configuration)
  * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not
  */
 int
 GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EccPublicSignKey *key,
-                            uint64_t pow);
+                            uint64_t pow,
+                            unsigned int matching_bits);
 
 
 /**

Modified: gnunet/src/include/gnunet_set_service.h
===================================================================
--- gnunet/src/include/gnunet_set_service.h     2013-09-30 18:55:53 UTC (rev 
29720)
+++ gnunet/src/include/gnunet_set_service.h     2013-09-30 19:02:32 UTC (rev 
29721)
@@ -248,8 +248,8 @@
  * @param set set to add element to
  * @param element element to add to the set
  * @param cont continuation called after the element has been added
- * @param cont_cls closure for cont
- * @return GNUNET_OK on success, GNUNET_SYSERR if the
+ * @param cont_cls closure for @a cont
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if the
  *         set is invalid (e.g. the set service crashed)
  */
 int
@@ -268,8 +268,8 @@
  * @param set set to remove element from
  * @param element element to remove from the set
  * @param cont continuation called after the element has been removed
- * @param cont_cls closure for cont
- * @return GNUNET_OK on success, GNUNET_SYSERR if the
+ * @param cont_cls closure for @a cont
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if the
  *         set is invalid (e.g. the set service crashed)
  */
 int
@@ -300,7 +300,7 @@
  * @param result_mode specified how results will be returned,
  *        see 'GNUNET_SET_ResultMode'.
  * @param result_cb called on error or success
- * @param result_cls closure for result_cb
+ * @param result_cls closure for @a result_cb
  * @return a handle to cancel the operation
  */
 struct GNUNET_SET_OperationHandle *

Modified: gnunet/src/revocation/gnunet-service-revocation.c
===================================================================
--- gnunet/src/revocation/gnunet-service-revocation.c   2013-09-30 18:55:53 UTC 
(rev 29720)
+++ gnunet/src/revocation/gnunet-service-revocation.c   2013-09-30 19:02:32 UTC 
(rev 29721)
@@ -29,6 +29,14 @@
  * flooding, revocations must include a proof of work.  We use the
  * set service for efficiently computing the union of revocations of
  * peers that connect.
+ *
+ * TODO:
+ * - load revocations from disk
+ * - store revocations to disk
+ * - handle p2p revocations
+ * - handle p2p connect (trigger SET union)
+ * - handle client revoke message
+ * - handle client query message
  */
 #include "platform.h"
 #include <math.h>
@@ -68,6 +76,10 @@
 };
 
 
+/**
+ * Set from all revocations known to us.
+ */
+static struct GNUNET_SET_Handle *revocation_set;
 
 /**
  * Handle to our current configuration.
@@ -305,6 +317,11 @@
 shutdown_task (void *cls,
               const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
+  if (NULL != revocation_set)
+  {
+    GNUNET_SET_destroy (revocation_set);
+    revocation_set = NULL;
+  }
   if (NULL != coreAPI)
   {
     GNUNET_CORE_disconnect (coreAPI);
@@ -386,10 +403,12 @@
     GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
                               "REVOCATION",
                               "WORKBITS",
-                              _("Value for WORKBITS is too large.\n"));
+                              _("Value is too large.\n"));
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
+  revocation_set = GNUNET_SET_create (cfg,
+                                     GNUNET_SET_OPERATION_UNION);
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
                                 NULL);
   peers = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO);

Modified: gnunet/src/set/set_api.c
===================================================================
--- gnunet/src/set/set_api.c    2013-09-30 18:55:53 UTC (rev 29720)
+++ gnunet/src/set/set_api.c    2013-09-30 19:02:32 UTC (rev 29721)
@@ -310,7 +310,7 @@
 static void
 handle_request (void *cls, const struct GNUNET_MessageHeader *mh)
 {
-  struct GNUNET_SET_RequestMessage *msg = (struct GNUNET_SET_RequestMessage *) 
mh;
+  const struct GNUNET_SET_RequestMessage *msg = (const struct 
GNUNET_SET_RequestMessage *) mh;
   struct GNUNET_SET_ListenHandle *lh = cls;
   struct GNUNET_SET_Request *req;
   struct GNUNET_MessageHeader *context_msg;
@@ -427,8 +427,8 @@
  * @param set set to add element to
  * @param element element to add to the set
  * @param cont continuation called after the element has been added
- * @param cont_cls closure for cont
- * @return GNUNET_OK on success, GNUNET_SYSERR if the
+ * @param cont_cls closure for @a cont
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if the
  *         set is invalid (e.g. the set service crashed)
  */
 int
@@ -646,10 +646,10 @@
 
 
 /**
- * Accept a request we got via GNUNET_SET_listen.  Must be called during
- * GNUNET_SET_listen, as the 'struct GNUNET_SET_Request' becomes invalid
+ * Accept a request we got via #GNUNET_SET_listen.  Must be called during
+ * #GNUNET_SET_listen, as the 'struct GNUNET_SET_Request' becomes invalid
  * afterwards.
- * Call GNUNET_SET_conclude to provide the local set to use for the operation,
+ * Call #GNUNET_SET_conclude to provide the local set to use for the operation,
  * and to begin the exchange with the remote peer. 
  *
  * @param request request to accept
@@ -731,7 +731,7 @@
  *
  * @param oh handle to the set operation 
  * @param set the set to use for the operation
- * @return GNUNET_OK on success, GNUNET_SYSERR if the
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if the
  *         set is invalid (e.g. the set service crashed)
  */
 int
@@ -760,10 +760,10 @@
  *
  * @param set the set to iterate over
  * @param iter the iterator to call for each element
- * @param cls closure for 'iter'
- * @return GNUNET_YES if the iteration started successfuly,
- *         GNUNET_NO if another iteration is active
- *         GNUNET_SYSERR if the set is invalid (e.g. the server crashed, 
disconnected)
+ * @param cls closure for @a iter
+ * @return #GNUNET_YES if the iteration started successfuly,
+ *         #GNUNET_NO if another iteration is active
+ *         #GNUNET_SYSERR if the set is invalid (e.g. the server crashed, 
disconnected)
  */
 int
 GNUNET_SET_iterate (struct GNUNET_SET_Handle *set, GNUNET_SET_ElementIterator 
iter, void *cls)
@@ -784,3 +784,4 @@
   return GNUNET_YES;
 }
 
+/* end of set_api.c */




reply via email to

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