diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/revocation/Makefile.am | 2 | ||||
-rw-r--r-- | src/revocation/gnunet-service-revocation.c | 90 |
2 files changed, 41 insertions, 51 deletions
diff --git a/src/revocation/Makefile.am b/src/revocation/Makefile.am index a90f8cd79..9d98502a6 100644 --- a/src/revocation/Makefile.am +++ b/src/revocation/Makefile.am | |||
@@ -78,7 +78,7 @@ gnunet_service_revocation_SOURCES = \ | |||
78 | gnunet_service_revocation_LDADD = \ | 78 | gnunet_service_revocation_LDADD = \ |
79 | libgnunetrevocation.la \ | 79 | libgnunetrevocation.la \ |
80 | $(top_builddir)/src/core/libgnunetcore.la \ | 80 | $(top_builddir)/src/core/libgnunetcore.la \ |
81 | $(top_builddir)/src/set/libgnunetset.la \ | 81 | $(top_builddir)/src/setu/libgnunetsetu.la \ |
82 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 82 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
83 | $(top_builddir)/src/util/libgnunetutil.la \ | 83 | $(top_builddir)/src/util/libgnunetutil.la \ |
84 | -lm \ | 84 | -lm \ |
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c index 81a30748c..ddebb38ad 100644 --- a/src/revocation/gnunet-service-revocation.c +++ b/src/revocation/gnunet-service-revocation.c | |||
@@ -45,7 +45,7 @@ | |||
45 | #include "gnunet_statistics_service.h" | 45 | #include "gnunet_statistics_service.h" |
46 | #include "gnunet_core_service.h" | 46 | #include "gnunet_core_service.h" |
47 | #include "gnunet_revocation_service.h" | 47 | #include "gnunet_revocation_service.h" |
48 | #include "gnunet_set_service.h" | 48 | #include "gnunet_setu_service.h" |
49 | #include "revocation.h" | 49 | #include "revocation.h" |
50 | #include <gcrypt.h> | 50 | #include <gcrypt.h> |
51 | 51 | ||
@@ -73,14 +73,14 @@ struct PeerEntry | |||
73 | /** | 73 | /** |
74 | * Handle to active set union operation (over revocation sets). | 74 | * Handle to active set union operation (over revocation sets). |
75 | */ | 75 | */ |
76 | struct GNUNET_SET_OperationHandle *so; | 76 | struct GNUNET_SETU_OperationHandle *so; |
77 | }; | 77 | }; |
78 | 78 | ||
79 | 79 | ||
80 | /** | 80 | /** |
81 | * Set from all revocations known to us. | 81 | * Set from all revocations known to us. |
82 | */ | 82 | */ |
83 | static struct GNUNET_SET_Handle *revocation_set; | 83 | static struct GNUNET_SETU_Handle *revocation_set; |
84 | 84 | ||
85 | /** | 85 | /** |
86 | * Hash map with all revoked keys, maps the hash of the public key | 86 | * Hash map with all revoked keys, maps the hash of the public key |
@@ -121,7 +121,7 @@ static struct GNUNET_DISK_FileHandle *revocation_db; | |||
121 | /** | 121 | /** |
122 | * Handle for us listening to incoming revocation set union requests. | 122 | * Handle for us listening to incoming revocation set union requests. |
123 | */ | 123 | */ |
124 | static struct GNUNET_SET_ListenHandle *revocation_union_listen_handle; | 124 | static struct GNUNET_SETU_ListenHandle *revocation_union_listen_handle; |
125 | 125 | ||
126 | /** | 126 | /** |
127 | * Amount of work required (W-bit collisions) for REVOCATION proofs, in collision-bits. | 127 | * Amount of work required (W-bit collisions) for REVOCATION proofs, in collision-bits. |
@@ -302,7 +302,7 @@ publicize_rm (const struct RevokeMessage *rm) | |||
302 | { | 302 | { |
303 | struct RevokeMessage *cp; | 303 | struct RevokeMessage *cp; |
304 | struct GNUNET_HashCode hc; | 304 | struct GNUNET_HashCode hc; |
305 | struct GNUNET_SET_Element e; | 305 | struct GNUNET_SETU_Element e; |
306 | 306 | ||
307 | GNUNET_CRYPTO_hash (&rm->proof_of_work.key, | 307 | GNUNET_CRYPTO_hash (&rm->proof_of_work.key, |
308 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), | 308 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), |
@@ -350,10 +350,10 @@ publicize_rm (const struct RevokeMessage *rm) | |||
350 | e.element_type = GNUNET_BLOCK_TYPE_REVOCATION; | 350 | e.element_type = GNUNET_BLOCK_TYPE_REVOCATION; |
351 | e.data = rm; | 351 | e.data = rm; |
352 | if (GNUNET_OK != | 352 | if (GNUNET_OK != |
353 | GNUNET_SET_add_element (revocation_set, | 353 | GNUNET_SETU_add_element (revocation_set, |
354 | &e, | 354 | &e, |
355 | NULL, | 355 | NULL, |
356 | NULL)) | 356 | NULL)) |
357 | { | 357 | { |
358 | GNUNET_break (0); | 358 | GNUNET_break (0); |
359 | return GNUNET_OK; | 359 | return GNUNET_OK; |
@@ -426,22 +426,22 @@ handle_p2p_revoke (void *cls, | |||
426 | * validate and then add to our revocation list (and set). | 426 | * validate and then add to our revocation list (and set). |
427 | * | 427 | * |
428 | * @param cls closure | 428 | * @param cls closure |
429 | * @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK | 429 | * @param element a result element, only valid if status is #GNUNET_SETU_STATUS_OK |
430 | * @param current_size current set size | 430 | * @param current_size current set size |
431 | * @param status see `enum GNUNET_SET_Status` | 431 | * @param status see `enum GNUNET_SETU_Status` |
432 | */ | 432 | */ |
433 | static void | 433 | static void |
434 | add_revocation (void *cls, | 434 | add_revocation (void *cls, |
435 | const struct GNUNET_SET_Element *element, | 435 | const struct GNUNET_SETU_Element *element, |
436 | uint64_t current_size, | 436 | uint64_t current_size, |
437 | enum GNUNET_SET_Status status) | 437 | enum GNUNET_SETU_Status status) |
438 | { | 438 | { |
439 | struct PeerEntry *peer_entry = cls; | 439 | struct PeerEntry *peer_entry = cls; |
440 | const struct RevokeMessage *rm; | 440 | const struct RevokeMessage *rm; |
441 | 441 | ||
442 | switch (status) | 442 | switch (status) |
443 | { | 443 | { |
444 | case GNUNET_SET_STATUS_OK: | 444 | case GNUNET_SETU_STATUS_ADD_LOCAL: |
445 | if (element->size != sizeof(struct RevokeMessage)) | 445 | if (element->size != sizeof(struct RevokeMessage)) |
446 | { | 446 | { |
447 | GNUNET_break_op (0); | 447 | GNUNET_break_op (0); |
@@ -464,8 +464,7 @@ add_revocation (void *cls, | |||
464 | "# revocation messages received via set union"), | 464 | "# revocation messages received via set union"), |
465 | 1, GNUNET_NO); | 465 | 1, GNUNET_NO); |
466 | break; | 466 | break; |
467 | 467 | case GNUNET_SETU_STATUS_FAILURE: | |
468 | case GNUNET_SET_STATUS_FAILURE: | ||
469 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 468 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
470 | _ ("Error computing revocation set union with %s\n"), | 469 | _ ("Error computing revocation set union with %s\n"), |
471 | GNUNET_i2s (&peer_entry->id)); | 470 | GNUNET_i2s (&peer_entry->id)); |
@@ -475,11 +474,7 @@ add_revocation (void *cls, | |||
475 | 1, | 474 | 1, |
476 | GNUNET_NO); | 475 | GNUNET_NO); |
477 | break; | 476 | break; |
478 | 477 | case GNUNET_SETU_STATUS_DONE: | |
479 | case GNUNET_SET_STATUS_HALF_DONE: | ||
480 | break; | ||
481 | |||
482 | case GNUNET_SET_STATUS_DONE: | ||
483 | peer_entry->so = NULL; | 478 | peer_entry->so = NULL; |
484 | GNUNET_STATISTICS_update (stats, | 479 | GNUNET_STATISTICS_update (stats, |
485 | gettext_noop ( | 480 | gettext_noop ( |
@@ -487,7 +482,6 @@ add_revocation (void *cls, | |||
487 | 1, | 482 | 1, |
488 | GNUNET_NO); | 483 | GNUNET_NO); |
489 | break; | 484 | break; |
490 | |||
491 | default: | 485 | default: |
492 | GNUNET_break (0); | 486 | GNUNET_break (0); |
493 | break; | 487 | break; |
@@ -511,16 +505,15 @@ transmit_task_cb (void *cls) | |||
511 | GNUNET_i2s (&peer_entry->id)); | 505 | GNUNET_i2s (&peer_entry->id)); |
512 | peer_entry->transmit_task = NULL; | 506 | peer_entry->transmit_task = NULL; |
513 | GNUNET_assert (NULL == peer_entry->so); | 507 | GNUNET_assert (NULL == peer_entry->so); |
514 | peer_entry->so = GNUNET_SET_prepare (&peer_entry->id, | 508 | peer_entry->so = GNUNET_SETU_prepare (&peer_entry->id, |
515 | &revocation_set_union_app_id, | 509 | &revocation_set_union_app_id, |
516 | NULL, | 510 | NULL, |
517 | GNUNET_SET_RESULT_ADDED, | 511 | (struct GNUNET_SETU_Option[]) { { 0 } }, |
518 | (struct GNUNET_SET_Option[]) { { 0 } }, | 512 | &add_revocation, |
519 | &add_revocation, | 513 | peer_entry); |
520 | peer_entry); | ||
521 | if (GNUNET_OK != | 514 | if (GNUNET_OK != |
522 | GNUNET_SET_commit (peer_entry->so, | 515 | GNUNET_SETU_commit (peer_entry->so, |
523 | revocation_set)) | 516 | revocation_set)) |
524 | { | 517 | { |
525 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 518 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
526 | _ ("SET service crashed, terminating revocation service\n")); | 519 | _ ("SET service crashed, terminating revocation service\n")); |
@@ -626,7 +619,7 @@ handle_core_disconnect (void *cls, | |||
626 | } | 619 | } |
627 | if (NULL != peer_entry->so) | 620 | if (NULL != peer_entry->so) |
628 | { | 621 | { |
629 | GNUNET_SET_operation_cancel (peer_entry->so); | 622 | GNUNET_SETU_operation_cancel (peer_entry->so); |
630 | peer_entry->so = NULL; | 623 | peer_entry->so = NULL; |
631 | } | 624 | } |
632 | GNUNET_free (peer_entry); | 625 | GNUNET_free (peer_entry); |
@@ -665,12 +658,12 @@ shutdown_task (void *cls) | |||
665 | { | 658 | { |
666 | if (NULL != revocation_set) | 659 | if (NULL != revocation_set) |
667 | { | 660 | { |
668 | GNUNET_SET_destroy (revocation_set); | 661 | GNUNET_SETU_destroy (revocation_set); |
669 | revocation_set = NULL; | 662 | revocation_set = NULL; |
670 | } | 663 | } |
671 | if (NULL != revocation_union_listen_handle) | 664 | if (NULL != revocation_union_listen_handle) |
672 | { | 665 | { |
673 | GNUNET_SET_listen_cancel (revocation_union_listen_handle); | 666 | GNUNET_SETU_listen_cancel (revocation_union_listen_handle); |
674 | revocation_union_listen_handle = NULL; | 667 | revocation_union_listen_handle = NULL; |
675 | } | 668 | } |
676 | if (NULL != core_api) | 669 | if (NULL != core_api) |
@@ -729,7 +722,7 @@ core_init (void *cls, | |||
729 | * @param other_peer the other peer | 722 | * @param other_peer the other peer |
730 | * @param context_msg message with application specific information from | 723 | * @param context_msg message with application specific information from |
731 | * the other peer | 724 | * the other peer |
732 | * @param request request from the other peer (never NULL), use GNUNET_SET_accept() | 725 | * @param request request from the other peer (never NULL), use GNUNET_SETU_accept() |
733 | * to accept it, otherwise the request will be refused | 726 | * to accept it, otherwise the request will be refused |
734 | * Note that we can't just return value from the listen callback, | 727 | * Note that we can't just return value from the listen callback, |
735 | * as it is also necessary to specify the set we want to do the | 728 | * as it is also necessary to specify the set we want to do the |
@@ -740,7 +733,7 @@ static void | |||
740 | handle_revocation_union_request (void *cls, | 733 | handle_revocation_union_request (void *cls, |
741 | const struct GNUNET_PeerIdentity *other_peer, | 734 | const struct GNUNET_PeerIdentity *other_peer, |
742 | const struct GNUNET_MessageHeader *context_msg, | 735 | const struct GNUNET_MessageHeader *context_msg, |
743 | struct GNUNET_SET_Request *request) | 736 | struct GNUNET_SETU_Request *request) |
744 | { | 737 | { |
745 | struct PeerEntry *peer_entry; | 738 | struct PeerEntry *peer_entry; |
746 | 739 | ||
@@ -763,14 +756,13 @@ handle_revocation_union_request (void *cls, | |||
763 | GNUNET_break_op (0); | 756 | GNUNET_break_op (0); |
764 | return; | 757 | return; |
765 | } | 758 | } |
766 | peer_entry->so = GNUNET_SET_accept (request, | 759 | peer_entry->so = GNUNET_SETU_accept (request, |
767 | GNUNET_SET_RESULT_ADDED, | 760 | (struct GNUNET_SETU_Option[]) { { 0 } }, |
768 | (struct GNUNET_SET_Option[]) { { 0 } }, | 761 | &add_revocation, |
769 | &add_revocation, | 762 | peer_entry); |
770 | peer_entry); | ||
771 | if (GNUNET_OK != | 763 | if (GNUNET_OK != |
772 | GNUNET_SET_commit (peer_entry->so, | 764 | GNUNET_SETU_commit (peer_entry->so, |
773 | revocation_set)) | 765 | revocation_set)) |
774 | { | 766 | { |
775 | GNUNET_break (0); | 767 | GNUNET_break (0); |
776 | GNUNET_SCHEDULER_shutdown (); | 768 | GNUNET_SCHEDULER_shutdown (); |
@@ -858,14 +850,12 @@ run (void *cls, | |||
858 | return; | 850 | return; |
859 | } | 851 | } |
860 | 852 | ||
861 | revocation_set = GNUNET_SET_create (cfg, | 853 | revocation_set = GNUNET_SETU_create (cfg); |
862 | GNUNET_SET_OPERATION_UNION); | ||
863 | revocation_union_listen_handle | 854 | revocation_union_listen_handle |
864 | = GNUNET_SET_listen (cfg, | 855 | = GNUNET_SETU_listen (cfg, |
865 | GNUNET_SET_OPERATION_UNION, | 856 | &revocation_set_union_app_id, |
866 | &revocation_set_union_app_id, | 857 | &handle_revocation_union_request, |
867 | &handle_revocation_union_request, | 858 | NULL); |
868 | NULL); | ||
869 | revocation_db = GNUNET_DISK_file_open (fn, | 859 | revocation_db = GNUNET_DISK_file_open (fn, |
870 | GNUNET_DISK_OPEN_READWRITE | 860 | GNUNET_DISK_OPEN_READWRITE |
871 | | GNUNET_DISK_OPEN_CREATE, | 861 | | GNUNET_DISK_OPEN_CREATE, |