diff options
Diffstat (limited to 'src/psyc/gnunet-service-psyc.c')
-rw-r--r-- | src/psyc/gnunet-service-psyc.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/psyc/gnunet-service-psyc.c b/src/psyc/gnunet-service-psyc.c index 827f3d79b..fa9e6b1d0 100644 --- a/src/psyc/gnunet-service-psyc.c +++ b/src/psyc/gnunet-service-psyc.c | |||
@@ -315,7 +315,7 @@ struct Master | |||
315 | 315 | ||
316 | /** | 316 | /** |
317 | * Incoming join requests from multicast. | 317 | * Incoming join requests from multicast. |
318 | * member_key -> struct GNUNET_MULTICAST_JoinHandle * | 318 | * member_pub_key -> struct GNUNET_MULTICAST_JoinHandle * |
319 | */ | 319 | */ |
320 | struct GNUNET_CONTAINER_MultiHashMap *join_reqs; | 320 | struct GNUNET_CONTAINER_MultiHashMap *join_reqs; |
321 | 321 | ||
@@ -697,7 +697,7 @@ client_send_result (struct GNUNET_SERVER_Client *client, uint64_t op_id, | |||
697 | */ | 697 | */ |
698 | struct JoinMemTestClosure | 698 | struct JoinMemTestClosure |
699 | { | 699 | { |
700 | struct GNUNET_CRYPTO_EcdsaPublicKey slave_key; | 700 | struct GNUNET_CRYPTO_EcdsaPublicKey slave_pub_key; |
701 | struct Channel *chn; | 701 | struct Channel *chn; |
702 | struct GNUNET_MULTICAST_JoinHandle *jh; | 702 | struct GNUNET_MULTICAST_JoinHandle *jh; |
703 | struct GNUNET_PSYC_JoinRequestMessage *join_msg; | 703 | struct GNUNET_PSYC_JoinRequestMessage *join_msg; |
@@ -716,10 +716,10 @@ join_mem_test_cb (void *cls, int64_t result, | |||
716 | if (GNUNET_NO == result && GNUNET_YES == jcls->chn->is_master) | 716 | if (GNUNET_NO == result && GNUNET_YES == jcls->chn->is_master) |
717 | { /* Pass on join request to client if this is a master channel */ | 717 | { /* Pass on join request to client if this is a master channel */ |
718 | struct Master *mst = (struct Master *) jcls->chn; | 718 | struct Master *mst = (struct Master *) jcls->chn; |
719 | struct GNUNET_HashCode slave_key_hash; | 719 | struct GNUNET_HashCode slave_pub_hash; |
720 | GNUNET_CRYPTO_hash (&jcls->slave_key, sizeof (jcls->slave_key), | 720 | GNUNET_CRYPTO_hash (&jcls->slave_pub_key, sizeof (jcls->slave_pub_key), |
721 | &slave_key_hash); | 721 | &slave_pub_hash); |
722 | GNUNET_CONTAINER_multihashmap_put (mst->join_reqs, &slave_key_hash, jcls->jh, | 722 | GNUNET_CONTAINER_multihashmap_put (mst->join_reqs, &slave_pub_hash, jcls->jh, |
723 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 723 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
724 | client_send_msg (jcls->chn, &jcls->join_msg->header); | 724 | client_send_msg (jcls->chn, &jcls->join_msg->header); |
725 | } | 725 | } |
@@ -744,7 +744,7 @@ join_mem_test_cb (void *cls, int64_t result, | |||
744 | */ | 744 | */ |
745 | static void | 745 | static void |
746 | mcast_recv_join_request (void *cls, | 746 | mcast_recv_join_request (void *cls, |
747 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, | 747 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_pub_key, |
748 | const struct GNUNET_MessageHeader *join_msg, | 748 | const struct GNUNET_MessageHeader *join_msg, |
749 | struct GNUNET_MULTICAST_JoinHandle *jh) | 749 | struct GNUNET_MULTICAST_JoinHandle *jh) |
750 | { | 750 | { |
@@ -770,17 +770,17 @@ mcast_recv_join_request (void *cls, | |||
770 | req = GNUNET_malloc (sizeof (*req) + join_msg_size); | 770 | req = GNUNET_malloc (sizeof (*req) + join_msg_size); |
771 | req->header.size = htons (sizeof (*req) + join_msg_size); | 771 | req->header.size = htons (sizeof (*req) + join_msg_size); |
772 | req->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_JOIN_REQUEST); | 772 | req->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_JOIN_REQUEST); |
773 | req->slave_key = *slave_key; | 773 | req->slave_pub_key = *slave_pub_key; |
774 | if (0 < join_msg_size) | 774 | if (0 < join_msg_size) |
775 | memcpy (&req[1], join_msg, join_msg_size); | 775 | memcpy (&req[1], join_msg, join_msg_size); |
776 | 776 | ||
777 | struct JoinMemTestClosure *jcls = GNUNET_malloc (sizeof (*jcls)); | 777 | struct JoinMemTestClosure *jcls = GNUNET_malloc (sizeof (*jcls)); |
778 | jcls->slave_key = *slave_key; | 778 | jcls->slave_pub_key = *slave_pub_key; |
779 | jcls->chn = chn; | 779 | jcls->chn = chn; |
780 | jcls->jh = jh; | 780 | jcls->jh = jh; |
781 | jcls->join_msg = req; | 781 | jcls->join_msg = req; |
782 | 782 | ||
783 | GNUNET_PSYCSTORE_membership_test (store, &chn->pub_key, slave_key, | 783 | GNUNET_PSYCSTORE_membership_test (store, &chn->pub_key, slave_pub_key, |
784 | chn->max_message_id, 0, | 784 | chn->max_message_id, 0, |
785 | &join_mem_test_cb, jcls); | 785 | &join_mem_test_cb, jcls); |
786 | } | 786 | } |
@@ -878,13 +878,13 @@ store_recv_fragment_replay_result (void *cls, int64_t result, | |||
878 | */ | 878 | */ |
879 | static void | 879 | static void |
880 | mcast_recv_replay_fragment (void *cls, | 880 | mcast_recv_replay_fragment (void *cls, |
881 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, | 881 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_pub_key, |
882 | uint64_t fragment_id, uint64_t flags, | 882 | uint64_t fragment_id, uint64_t flags, |
883 | struct GNUNET_MULTICAST_ReplayHandle *rh) | 883 | struct GNUNET_MULTICAST_ReplayHandle *rh) |
884 | 884 | ||
885 | { | 885 | { |
886 | struct Channel *chn = cls; | 886 | struct Channel *chn = cls; |
887 | GNUNET_PSYCSTORE_fragment_get (store, &chn->pub_key, slave_key, | 887 | GNUNET_PSYCSTORE_fragment_get (store, &chn->pub_key, slave_pub_key, |
888 | fragment_id, fragment_id, | 888 | fragment_id, fragment_id, |
889 | &store_recv_fragment_replay, | 889 | &store_recv_fragment_replay, |
890 | &store_recv_fragment_replay_result, rh); | 890 | &store_recv_fragment_replay_result, rh); |
@@ -896,14 +896,14 @@ mcast_recv_replay_fragment (void *cls, | |||
896 | */ | 896 | */ |
897 | static void | 897 | static void |
898 | mcast_recv_replay_message (void *cls, | 898 | mcast_recv_replay_message (void *cls, |
899 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, | 899 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_pub_key, |
900 | uint64_t message_id, | 900 | uint64_t message_id, |
901 | uint64_t fragment_offset, | 901 | uint64_t fragment_offset, |
902 | uint64_t flags, | 902 | uint64_t flags, |
903 | struct GNUNET_MULTICAST_ReplayHandle *rh) | 903 | struct GNUNET_MULTICAST_ReplayHandle *rh) |
904 | { | 904 | { |
905 | struct Channel *chn = cls; | 905 | struct Channel *chn = cls; |
906 | GNUNET_PSYCSTORE_message_get (store, &chn->pub_key, slave_key, | 906 | GNUNET_PSYCSTORE_message_get (store, &chn->pub_key, slave_pub_key, |
907 | message_id, message_id, 1, NULL, | 907 | message_id, message_id, 1, NULL, |
908 | &store_recv_fragment_replay, | 908 | &store_recv_fragment_replay, |
909 | &store_recv_fragment_replay_result, rh); | 909 | &store_recv_fragment_replay_result, rh); |
@@ -1029,7 +1029,7 @@ client_send_mcast_req (struct Master *mst, | |||
1029 | pmsg->message_id = req->request_id; | 1029 | pmsg->message_id = req->request_id; |
1030 | pmsg->fragment_offset = req->fragment_offset; | 1030 | pmsg->fragment_offset = req->fragment_offset; |
1031 | pmsg->flags = htonl (GNUNET_PSYC_MESSAGE_REQUEST); | 1031 | pmsg->flags = htonl (GNUNET_PSYC_MESSAGE_REQUEST); |
1032 | pmsg->slave_key = req->member_key; | 1032 | pmsg->slave_pub_key = req->member_pub_key; |
1033 | 1033 | ||
1034 | memcpy (&pmsg[1], &req[1], size - sizeof (*req)); | 1034 | memcpy (&pmsg[1], &req[1], size - sizeof (*req)); |
1035 | client_send_msg (chn, &pmsg->header); | 1035 | client_send_msg (chn, &pmsg->header); |
@@ -1535,7 +1535,7 @@ mcast_recv_request (void *cls, | |||
1535 | struct Master *mst = cls; | 1535 | struct Master *mst = cls; |
1536 | uint16_t size = ntohs (req->header.size); | 1536 | uint16_t size = ntohs (req->header.size); |
1537 | 1537 | ||
1538 | char *str = GNUNET_CRYPTO_ecdsa_public_key_to_string (&req->member_key); | 1538 | char *str = GNUNET_CRYPTO_ecdsa_public_key_to_string (&req->member_pub_key); |
1539 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1539 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1540 | "%p Received multicast request of size %u from %s.\n", | 1540 | "%p Received multicast request of size %u from %s.\n", |
1541 | mst, size, str); | 1541 | mst, size, str); |
@@ -1745,10 +1745,10 @@ client_recv_slave_join (void *cls, struct GNUNET_SERVER_Client *client, | |||
1745 | uint16_t req_size = ntohs (req->header.size); | 1745 | uint16_t req_size = ntohs (req->header.size); |
1746 | 1746 | ||
1747 | struct GNUNET_CRYPTO_EcdsaPublicKey slv_pub_key; | 1747 | struct GNUNET_CRYPTO_EcdsaPublicKey slv_pub_key; |
1748 | struct GNUNET_HashCode pub_key_hash, slv_pub_key_hash; | 1748 | struct GNUNET_HashCode pub_key_hash, slv_pub_hash; |
1749 | 1749 | ||
1750 | GNUNET_CRYPTO_ecdsa_key_get_public (&req->slave_key, &slv_pub_key); | 1750 | GNUNET_CRYPTO_ecdsa_key_get_public (&req->slave_key, &slv_pub_key); |
1751 | GNUNET_CRYPTO_hash (&slv_pub_key, sizeof (slv_pub_key), &slv_pub_key_hash); | 1751 | GNUNET_CRYPTO_hash (&slv_pub_key, sizeof (slv_pub_key), &slv_pub_hash); |
1752 | GNUNET_CRYPTO_hash (&req->channel_pub_key, sizeof (req->channel_pub_key), &pub_key_hash); | 1752 | GNUNET_CRYPTO_hash (&req->channel_pub_key, sizeof (req->channel_pub_key), &pub_key_hash); |
1753 | 1753 | ||
1754 | struct GNUNET_CONTAINER_MultiHashMap * | 1754 | struct GNUNET_CONTAINER_MultiHashMap * |
@@ -1758,14 +1758,14 @@ client_recv_slave_join (void *cls, struct GNUNET_SERVER_Client *client, | |||
1758 | 1758 | ||
1759 | if (NULL != chn_slv) | 1759 | if (NULL != chn_slv) |
1760 | { | 1760 | { |
1761 | slv = GNUNET_CONTAINER_multihashmap_get (chn_slv, &slv_pub_key_hash); | 1761 | slv = GNUNET_CONTAINER_multihashmap_get (chn_slv, &slv_pub_hash); |
1762 | } | 1762 | } |
1763 | if (NULL == slv) | 1763 | if (NULL == slv) |
1764 | { | 1764 | { |
1765 | slv = GNUNET_new (struct Slave); | 1765 | slv = GNUNET_new (struct Slave); |
1766 | slv->priv_key = req->slave_key; | 1766 | slv->priv_key = req->slave_key; |
1767 | slv->pub_key = slv_pub_key; | 1767 | slv->pub_key = slv_pub_key; |
1768 | slv->pub_key_hash = slv_pub_key_hash; | 1768 | slv->pub_key_hash = slv_pub_hash; |
1769 | slv->origin = req->origin; | 1769 | slv->origin = req->origin; |
1770 | slv->relay_count = ntohl (req->relay_count); | 1770 | slv->relay_count = ntohl (req->relay_count); |
1771 | slv->join_flags = ntohl (req->flags); | 1771 | slv->join_flags = ntohl (req->flags); |
@@ -1928,20 +1928,20 @@ client_recv_join_decision (void *cls, struct GNUNET_SERVER_Client *client, | |||
1928 | ? (struct GNUNET_MessageHeader *) &dcsn[1] | 1928 | ? (struct GNUNET_MessageHeader *) &dcsn[1] |
1929 | : NULL; | 1929 | : NULL; |
1930 | 1930 | ||
1931 | struct GNUNET_HashCode slave_key_hash; | 1931 | struct GNUNET_HashCode slave_pub_hash; |
1932 | GNUNET_CRYPTO_hash (&dcsn->slave_key, sizeof (dcsn->slave_key), | 1932 | GNUNET_CRYPTO_hash (&dcsn->slave_pub_key, sizeof (dcsn->slave_pub_key), |
1933 | &slave_key_hash); | 1933 | &slave_pub_hash); |
1934 | 1934 | ||
1935 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1935 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1936 | "%p Got join decision (%d) from client for channel %s..\n", | 1936 | "%p Got join decision (%d) from client for channel %s..\n", |
1937 | mst, jcls.is_admitted, GNUNET_h2s (&chn->pub_key_hash)); | 1937 | mst, jcls.is_admitted, GNUNET_h2s (&chn->pub_key_hash)); |
1938 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1938 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1939 | "%p ..and slave %s.\n", | 1939 | "%p ..and slave %s.\n", |
1940 | mst, GNUNET_h2s (&slave_key_hash)); | 1940 | mst, GNUNET_h2s (&slave_pub_hash)); |
1941 | 1941 | ||
1942 | GNUNET_CONTAINER_multihashmap_get_multiple (mst->join_reqs, &slave_key_hash, | 1942 | GNUNET_CONTAINER_multihashmap_get_multiple (mst->join_reqs, &slave_pub_hash, |
1943 | &mcast_send_join_decision, &jcls); | 1943 | &mcast_send_join_decision, &jcls); |
1944 | GNUNET_CONTAINER_multihashmap_remove_all (mst->join_reqs, &slave_key_hash); | 1944 | GNUNET_CONTAINER_multihashmap_remove_all (mst->join_reqs, &slave_pub_hash); |
1945 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 1945 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
1946 | } | 1946 | } |
1947 | 1947 | ||
@@ -2326,7 +2326,7 @@ client_recv_membership_store (void *cls, struct GNUNET_SERVER_Client *client, | |||
2326 | "%p did_join: %u, announced_at: %" PRIu64 ", effective_since: %" PRIu64 "\n", | 2326 | "%p did_join: %u, announced_at: %" PRIu64 ", effective_since: %" PRIu64 "\n", |
2327 | chn, req->did_join, announced_at, effective_since); | 2327 | chn, req->did_join, announced_at, effective_since); |
2328 | 2328 | ||
2329 | GNUNET_PSYCSTORE_membership_store (store, &chn->pub_key, &req->slave_key, | 2329 | GNUNET_PSYCSTORE_membership_store (store, &chn->pub_key, &req->slave_pub_key, |
2330 | req->did_join, announced_at, effective_since, | 2330 | req->did_join, announced_at, effective_since, |
2331 | 0, /* FIXME: group_generation */ | 2331 | 0, /* FIXME: group_generation */ |
2332 | &store_recv_membership_store_result, op); | 2332 | &store_recv_membership_store_result, op); |