diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-09-30 19:02:32 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-09-30 19:02:32 +0000 |
commit | 6ea60b3c0f51e600f2d3d9be5d4eaa6eb424c538 (patch) | |
tree | c2319d6db715df848d548f01a4ff1f937c03b2e9 /src | |
parent | 14dc1d94810a77ed35ce9e8d7090c8a489707351 (diff) | |
download | gnunet-6ea60b3c0f51e600f2d3d9be5d4eaa6eb424c538.tar.gz gnunet-6ea60b3c0f51e600f2d3d9be5d4eaa6eb424c538.zip |
-doxygen, todos, minor code cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/include/gnunet_revocation_service.h | 4 | ||||
-rw-r--r-- | src/include/gnunet_set_service.h | 10 | ||||
-rw-r--r-- | src/revocation/gnunet-service-revocation.c | 21 | ||||
-rw-r--r-- | src/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 index 7176abb7a..0cbe0ea14 100644 --- 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); | |||
129 | * | 129 | * |
130 | * @param key key to check for | 130 | * @param key key to check for |
131 | * @param pow proof of work value | 131 | * @param pow proof of work value |
132 | * @param matching_bits how many bits must match (configuration) | ||
132 | * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not | 133 | * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not |
133 | */ | 134 | */ |
134 | int | 135 | int |
135 | GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EccPublicSignKey *key, | 136 | GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EccPublicSignKey *key, |
136 | uint64_t pow); | 137 | uint64_t pow, |
138 | unsigned int matching_bits); | ||
137 | 139 | ||
138 | 140 | ||
139 | /** | 141 | /** |
diff --git a/src/include/gnunet_set_service.h b/src/include/gnunet_set_service.h index da6ba1301..b78e1850a 100644 --- 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, | |||
248 | * @param set set to add element to | 248 | * @param set set to add element to |
249 | * @param element element to add to the set | 249 | * @param element element to add to the set |
250 | * @param cont continuation called after the element has been added | 250 | * @param cont continuation called after the element has been added |
251 | * @param cont_cls closure for cont | 251 | * @param cont_cls closure for @a cont |
252 | * @return GNUNET_OK on success, GNUNET_SYSERR if the | 252 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if the |
253 | * set is invalid (e.g. the set service crashed) | 253 | * set is invalid (e.g. the set service crashed) |
254 | */ | 254 | */ |
255 | int | 255 | int |
@@ -268,8 +268,8 @@ GNUNET_SET_add_element (struct GNUNET_SET_Handle *set, | |||
268 | * @param set set to remove element from | 268 | * @param set set to remove element from |
269 | * @param element element to remove from the set | 269 | * @param element element to remove from the set |
270 | * @param cont continuation called after the element has been removed | 270 | * @param cont continuation called after the element has been removed |
271 | * @param cont_cls closure for cont | 271 | * @param cont_cls closure for @a cont |
272 | * @return GNUNET_OK on success, GNUNET_SYSERR if the | 272 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if the |
273 | * set is invalid (e.g. the set service crashed) | 273 | * set is invalid (e.g. the set service crashed) |
274 | */ | 274 | */ |
275 | int | 275 | int |
@@ -300,7 +300,7 @@ GNUNET_SET_destroy (struct GNUNET_SET_Handle *set); | |||
300 | * @param result_mode specified how results will be returned, | 300 | * @param result_mode specified how results will be returned, |
301 | * see 'GNUNET_SET_ResultMode'. | 301 | * see 'GNUNET_SET_ResultMode'. |
302 | * @param result_cb called on error or success | 302 | * @param result_cb called on error or success |
303 | * @param result_cls closure for result_cb | 303 | * @param result_cls closure for @a result_cb |
304 | * @return a handle to cancel the operation | 304 | * @return a handle to cancel the operation |
305 | */ | 305 | */ |
306 | struct GNUNET_SET_OperationHandle * | 306 | struct GNUNET_SET_OperationHandle * |
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c index a3d802d10..8ab8f8ae1 100644 --- a/src/revocation/gnunet-service-revocation.c +++ b/src/revocation/gnunet-service-revocation.c | |||
@@ -29,6 +29,14 @@ | |||
29 | * flooding, revocations must include a proof of work. We use the | 29 | * flooding, revocations must include a proof of work. We use the |
30 | * set service for efficiently computing the union of revocations of | 30 | * set service for efficiently computing the union of revocations of |
31 | * peers that connect. | 31 | * peers that connect. |
32 | * | ||
33 | * TODO: | ||
34 | * - load revocations from disk | ||
35 | * - store revocations to disk | ||
36 | * - handle p2p revocations | ||
37 | * - handle p2p connect (trigger SET union) | ||
38 | * - handle client revoke message | ||
39 | * - handle client query message | ||
32 | */ | 40 | */ |
33 | #include "platform.h" | 41 | #include "platform.h" |
34 | #include <math.h> | 42 | #include <math.h> |
@@ -68,6 +76,10 @@ struct PeerEntry | |||
68 | }; | 76 | }; |
69 | 77 | ||
70 | 78 | ||
79 | /** | ||
80 | * Set from all revocations known to us. | ||
81 | */ | ||
82 | static struct GNUNET_SET_Handle *revocation_set; | ||
71 | 83 | ||
72 | /** | 84 | /** |
73 | * Handle to our current configuration. | 85 | * Handle to our current configuration. |
@@ -305,6 +317,11 @@ static void | |||
305 | shutdown_task (void *cls, | 317 | shutdown_task (void *cls, |
306 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 318 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
307 | { | 319 | { |
320 | if (NULL != revocation_set) | ||
321 | { | ||
322 | GNUNET_SET_destroy (revocation_set); | ||
323 | revocation_set = NULL; | ||
324 | } | ||
308 | if (NULL != coreAPI) | 325 | if (NULL != coreAPI) |
309 | { | 326 | { |
310 | GNUNET_CORE_disconnect (coreAPI); | 327 | GNUNET_CORE_disconnect (coreAPI); |
@@ -386,10 +403,12 @@ run (void *cls, | |||
386 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, | 403 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, |
387 | "REVOCATION", | 404 | "REVOCATION", |
388 | "WORKBITS", | 405 | "WORKBITS", |
389 | _("Value for WORKBITS is too large.\n")); | 406 | _("Value is too large.\n")); |
390 | GNUNET_SCHEDULER_shutdown (); | 407 | GNUNET_SCHEDULER_shutdown (); |
391 | return; | 408 | return; |
392 | } | 409 | } |
410 | revocation_set = GNUNET_SET_create (cfg, | ||
411 | GNUNET_SET_OPERATION_UNION); | ||
393 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, | 412 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, |
394 | NULL); | 413 | NULL); |
395 | peers = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO); | 414 | peers = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO); |
diff --git a/src/set/set_api.c b/src/set/set_api.c index 56a50af5e..267fe3fc6 100644 --- 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) | |||
310 | static void | 310 | static void |
311 | handle_request (void *cls, const struct GNUNET_MessageHeader *mh) | 311 | handle_request (void *cls, const struct GNUNET_MessageHeader *mh) |
312 | { | 312 | { |
313 | struct GNUNET_SET_RequestMessage *msg = (struct GNUNET_SET_RequestMessage *) mh; | 313 | const struct GNUNET_SET_RequestMessage *msg = (const struct GNUNET_SET_RequestMessage *) mh; |
314 | struct GNUNET_SET_ListenHandle *lh = cls; | 314 | struct GNUNET_SET_ListenHandle *lh = cls; |
315 | struct GNUNET_SET_Request *req; | 315 | struct GNUNET_SET_Request *req; |
316 | struct GNUNET_MessageHeader *context_msg; | 316 | struct GNUNET_MessageHeader *context_msg; |
@@ -427,8 +427,8 @@ GNUNET_SET_create (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
427 | * @param set set to add element to | 427 | * @param set set to add element to |
428 | * @param element element to add to the set | 428 | * @param element element to add to the set |
429 | * @param cont continuation called after the element has been added | 429 | * @param cont continuation called after the element has been added |
430 | * @param cont_cls closure for cont | 430 | * @param cont_cls closure for @a cont |
431 | * @return GNUNET_OK on success, GNUNET_SYSERR if the | 431 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if the |
432 | * set is invalid (e.g. the set service crashed) | 432 | * set is invalid (e.g. the set service crashed) |
433 | */ | 433 | */ |
434 | int | 434 | int |
@@ -646,10 +646,10 @@ GNUNET_SET_listen_cancel (struct GNUNET_SET_ListenHandle *lh) | |||
646 | 646 | ||
647 | 647 | ||
648 | /** | 648 | /** |
649 | * Accept a request we got via GNUNET_SET_listen. Must be called during | 649 | * Accept a request we got via #GNUNET_SET_listen. Must be called during |
650 | * GNUNET_SET_listen, as the 'struct GNUNET_SET_Request' becomes invalid | 650 | * #GNUNET_SET_listen, as the 'struct GNUNET_SET_Request' becomes invalid |
651 | * afterwards. | 651 | * afterwards. |
652 | * Call GNUNET_SET_conclude to provide the local set to use for the operation, | 652 | * Call #GNUNET_SET_conclude to provide the local set to use for the operation, |
653 | * and to begin the exchange with the remote peer. | 653 | * and to begin the exchange with the remote peer. |
654 | * | 654 | * |
655 | * @param request request to accept | 655 | * @param request request to accept |
@@ -731,7 +731,7 @@ GNUNET_SET_operation_cancel (struct GNUNET_SET_OperationHandle *oh) | |||
731 | * | 731 | * |
732 | * @param oh handle to the set operation | 732 | * @param oh handle to the set operation |
733 | * @param set the set to use for the operation | 733 | * @param set the set to use for the operation |
734 | * @return GNUNET_OK on success, GNUNET_SYSERR if the | 734 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if the |
735 | * set is invalid (e.g. the set service crashed) | 735 | * set is invalid (e.g. the set service crashed) |
736 | */ | 736 | */ |
737 | int | 737 | int |
@@ -760,10 +760,10 @@ GNUNET_SET_commit (struct GNUNET_SET_OperationHandle *oh, | |||
760 | * | 760 | * |
761 | * @param set the set to iterate over | 761 | * @param set the set to iterate over |
762 | * @param iter the iterator to call for each element | 762 | * @param iter the iterator to call for each element |
763 | * @param cls closure for 'iter' | 763 | * @param cls closure for @a iter |
764 | * @return GNUNET_YES if the iteration started successfuly, | 764 | * @return #GNUNET_YES if the iteration started successfuly, |
765 | * GNUNET_NO if another iteration is active | 765 | * #GNUNET_NO if another iteration is active |
766 | * GNUNET_SYSERR if the set is invalid (e.g. the server crashed, disconnected) | 766 | * #GNUNET_SYSERR if the set is invalid (e.g. the server crashed, disconnected) |
767 | */ | 767 | */ |
768 | int | 768 | int |
769 | GNUNET_SET_iterate (struct GNUNET_SET_Handle *set, GNUNET_SET_ElementIterator iter, void *cls) | 769 | 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 | |||
784 | return GNUNET_YES; | 784 | return GNUNET_YES; |
785 | } | 785 | } |
786 | 786 | ||
787 | /* end of set_api.c */ | ||