diff options
author | Gabor X Toth <*@tg-x.net> | 2014-07-27 13:17:03 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2014-07-27 13:17:03 +0000 |
commit | b63820a52b63d264bead047d0d6f4b76a94c4030 (patch) | |
tree | a678202b91694d3582ae61c57a7badac483693d1 /src/psycstore | |
parent | 2f0367bf715c7c0abd12b3e167f329311a35f6e2 (diff) | |
download | gnunet-b63820a52b63d264bead047d0d6f4b76a94c4030.tar.gz gnunet-b63820a52b63d264bead047d0d6f4b76a94c4030.zip |
psyc: membership store
Diffstat (limited to 'src/psycstore')
-rw-r--r-- | src/psycstore/gnunet-service-psycstore.c | 2 | ||||
-rw-r--r-- | src/psycstore/psycstore.h | 8 | ||||
-rw-r--r-- | src/psycstore/psycstore_api.c | 59 |
3 files changed, 43 insertions, 26 deletions
diff --git a/src/psycstore/gnunet-service-psycstore.c b/src/psycstore/gnunet-service-psycstore.c index 87ace92be..7d27ea29b 100644 --- a/src/psycstore/gnunet-service-psycstore.c +++ b/src/psycstore/gnunet-service-psycstore.c | |||
@@ -240,7 +240,7 @@ handle_membership_store (void *cls, | |||
240 | (const struct MembershipStoreRequest *) msg; | 240 | (const struct MembershipStoreRequest *) msg; |
241 | 241 | ||
242 | int ret = db->membership_store (db->cls, &req->channel_key, &req->slave_key, | 242 | int ret = db->membership_store (db->cls, &req->channel_key, &req->slave_key, |
243 | ntohl (req->did_join), | 243 | req->did_join, |
244 | GNUNET_ntohll (req->announced_at), | 244 | GNUNET_ntohll (req->announced_at), |
245 | GNUNET_ntohll (req->effective_since), | 245 | GNUNET_ntohll (req->effective_since), |
246 | GNUNET_ntohll (req->group_generation)); | 246 | GNUNET_ntohll (req->group_generation)); |
diff --git a/src/psycstore/psycstore.h b/src/psycstore/psycstore.h index 65d32d9fa..17905f422 100644 --- a/src/psycstore/psycstore.h +++ b/src/psycstore/psycstore.h | |||
@@ -177,10 +177,10 @@ struct MembershipStoreRequest | |||
177 | */ | 177 | */ |
178 | struct GNUNET_CRYPTO_EcdsaPublicKey slave_key; | 178 | struct GNUNET_CRYPTO_EcdsaPublicKey slave_key; |
179 | 179 | ||
180 | uint64_t announced_at GNUNET_PACKED; | 180 | uint64_t announced_at; |
181 | uint64_t effective_since GNUNET_PACKED; | 181 | uint64_t effective_since; |
182 | uint64_t group_generation GNUNET_PACKED; | 182 | uint64_t group_generation; |
183 | int did_join GNUNET_PACKED; | 183 | uint8_t did_join; |
184 | }; | 184 | }; |
185 | 185 | ||
186 | 186 | ||
diff --git a/src/psycstore/psycstore_api.c b/src/psycstore/psycstore_api.c index f034ff475..9df55888d 100644 --- a/src/psycstore/psycstore_api.c +++ b/src/psycstore/psycstore_api.c | |||
@@ -638,18 +638,27 @@ GNUNET_PSYCSTORE_operation_cancel (struct GNUNET_PSYCSTORE_OperationHandle *op) | |||
638 | * Store join/leave events for a PSYC channel in order to be able to answer | 638 | * Store join/leave events for a PSYC channel in order to be able to answer |
639 | * membership test queries later. | 639 | * membership test queries later. |
640 | * | 640 | * |
641 | * @param h Handle for the PSYCstore. | 641 | * @param h |
642 | * @param channel_key The channel where the event happened. | 642 | * Handle for the PSYCstore. |
643 | * @param slave_key Public key of joining/leaving slave. | 643 | * @param channel_key |
644 | * @param did_join #GNUNET_YES on join, #GNUNET_NO on part. | 644 | * The channel where the event happened. |
645 | * @param announced_at ID of the message that announced the membership change. | 645 | * @param slave_key |
646 | * @param effective_since Message ID this membership change is in effect since. | 646 | * Public key of joining/leaving slave. |
647 | * @param did_join | ||
648 | * #GNUNET_YES on join, #GNUNET_NO on part. | ||
649 | * @param announced_at | ||
650 | * ID of the message that announced the membership change. | ||
651 | * @param effective_since | ||
652 | * Message ID this membership change is in effect since. | ||
647 | * For joins it is <= announced_at, for parts it is always 0. | 653 | * For joins it is <= announced_at, for parts it is always 0. |
648 | * @param group_generation In case of a part, the last group generation the | 654 | * @param group_generation |
649 | * slave has access to. It has relevance when a larger message have | 655 | * In case of a part, the last group generation the slave has access to. |
650 | * fragments with different group generations. | 656 | * It has relevance when a larger message have fragments with different |
651 | * @param rcb Callback to call with the result of the storage operation. | 657 | * group generations. |
652 | * @param rcb_cls Closure for the callback. | 658 | * @param rcb |
659 | * Callback to call with the result of the storage operation. | ||
660 | * @param rcb_cls | ||
661 | * Closure for the callback. | ||
653 | * | 662 | * |
654 | * @return Operation handle that can be used to cancel the operation. | 663 | * @return Operation handle that can be used to cancel the operation. |
655 | */ | 664 | */ |
@@ -667,6 +676,7 @@ GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h, | |||
667 | GNUNET_assert (NULL != h); | 676 | GNUNET_assert (NULL != h); |
668 | GNUNET_assert (NULL != channel_key); | 677 | GNUNET_assert (NULL != channel_key); |
669 | GNUNET_assert (NULL != slave_key); | 678 | GNUNET_assert (NULL != slave_key); |
679 | GNUNET_assert (GNUNET_YES == did_join || GNUNET_NO == did_join); | ||
670 | GNUNET_assert (did_join | 680 | GNUNET_assert (did_join |
671 | ? effective_since <= announced_at | 681 | ? effective_since <= announced_at |
672 | : effective_since == 0); | 682 | : effective_since == 0); |
@@ -684,7 +694,7 @@ GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h, | |||
684 | req->header.size = htons (sizeof (*req)); | 694 | req->header.size = htons (sizeof (*req)); |
685 | req->channel_key = *channel_key; | 695 | req->channel_key = *channel_key; |
686 | req->slave_key = *slave_key; | 696 | req->slave_key = *slave_key; |
687 | req->did_join = htonl (did_join); | 697 | req->did_join = did_join; |
688 | req->announced_at = GNUNET_htonll (announced_at); | 698 | req->announced_at = GNUNET_htonll (announced_at); |
689 | req->effective_since = GNUNET_htonll (effective_since); | 699 | req->effective_since = GNUNET_htonll (effective_since); |
690 | req->group_generation = GNUNET_htonll (group_generation); | 700 | req->group_generation = GNUNET_htonll (group_generation); |
@@ -707,15 +717,22 @@ GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h, | |||
707 | * is also used when handling join requests to determine whether the slave is | 717 | * is also used when handling join requests to determine whether the slave is |
708 | * currently admitted to the channel. | 718 | * currently admitted to the channel. |
709 | * | 719 | * |
710 | * @param h Handle for the PSYCstore. | 720 | * @param h |
711 | * @param channel_key The channel we are interested in. | 721 | * Handle for the PSYCstore. |
712 | * @param slave_key Public key of slave whose membership to check. | 722 | * @param channel_key |
713 | * @param message_id Message ID for which to do the membership test. | 723 | * The channel we are interested in. |
714 | * @param group_generation Group generation of the fragment of the message to | 724 | * @param slave_key |
715 | * test. It has relevance if the message consists of multiple fragments | 725 | * Public key of slave whose membership to check. |
716 | * with different group generations. | 726 | * @param message_id |
717 | * @param rcb Callback to call with the test result. | 727 | * Message ID for which to do the membership test. |
718 | * @param rcb_cls Closure for the callback. | 728 | * @param group_generation |
729 | * Group generation of the fragment of the message to test. | ||
730 | * It has relevance if the message consists of multiple fragments with | ||
731 | * different group generations. | ||
732 | * @param rcb | ||
733 | * Callback to call with the test result. | ||
734 | * @param rcb_cls | ||
735 | * Closure for the callback. | ||
719 | * | 736 | * |
720 | * @return Operation handle that can be used to cancel the operation. | 737 | * @return Operation handle that can be used to cancel the operation. |
721 | */ | 738 | */ |