gnunet

Main GNUnet Logic
Log | Files | Refs | Submodules | README | LICENSE

commit 6ea60b3c0f51e600f2d3d9be5d4eaa6eb424c538
parent 14dc1d94810a77ed35ce9e8d7090c8a489707351
Author: Christian Grothoff <christian@grothoff.org>
Date:   Mon, 30 Sep 2013 19:02:32 +0000

-doxygen, todos, minor code cleanup



Diffstat:
Msrc/include/gnunet_revocation_service.h | 4+++-
Msrc/include/gnunet_set_service.h | 10+++++-----
Msrc/revocation/gnunet-service-revocation.c | 21++++++++++++++++++++-
Msrc/set/set_api.c | 23++++++++++++-----------
4 files changed, 40 insertions(+), 18 deletions(-)

diff --git a/src/include/gnunet_revocation_service.h b/src/include/gnunet_revocation_service.h @@ -129,11 +129,13 @@ GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h); * * @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); /** diff --git a/src/include/gnunet_set_service.h b/src/include/gnunet_set_service.h @@ -248,8 +248,8 @@ GNUNET_SET_create (const struct GNUNET_CONFIGURATION_Handle *cfg, * @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 @@ GNUNET_SET_add_element (struct GNUNET_SET_Handle *set, * @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 @@ GNUNET_SET_destroy (struct GNUNET_SET_Handle *set); * @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 * diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c @@ -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 @@ struct PeerEntry }; +/** + * Set from all revocations known to us. + */ +static struct GNUNET_SET_Handle *revocation_set; /** * Handle to our current configuration. @@ -305,6 +317,11 @@ static void 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 @@ run (void *cls, 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); diff --git a/src/set/set_api.c b/src/set/set_api.c @@ -310,7 +310,7 @@ handle_result (void *cls, const struct GNUNET_MessageHeader *mh) 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 @@ GNUNET_SET_create (const struct GNUNET_CONFIGURATION_Handle *cfg, * @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 @@ GNUNET_SET_listen_cancel (struct GNUNET_SET_ListenHandle *lh) /** - * 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 @@ GNUNET_SET_operation_cancel (struct GNUNET_SET_OperationHandle *oh) * * @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 @@ GNUNET_SET_commit (struct GNUNET_SET_OperationHandle *oh, * * @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 @@ GNUNET_SET_iterate (struct GNUNET_SET_Handle *set, GNUNET_SET_ElementIterator it return GNUNET_YES; } +/* end of set_api.c */