aboutsummaryrefslogtreecommitdiff
path: root/src/psycstore
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2014-07-10 17:49:53 +0000
committerGabor X Toth <*@tg-x.net>2014-07-10 17:49:53 +0000
commita8133f3ff80aaaccc904e4bbaf69bc53dee499cb (patch)
treec10edd7a8156280c61357ccf9e0f1f27c7a0d6db /src/psycstore
parent6c75526e936fcc74ee79b13831b2b6dda57f293d (diff)
downloadgnunet-a8133f3ff80aaaccc904e4bbaf69bc53dee499cb.tar.gz
gnunet-a8133f3ff80aaaccc904e4bbaf69bc53dee499cb.zip
PSYC(store), Multicast: use ECDSA slave/member keys; PSYC: add GNUNET_PSYC_message_create()
Diffstat (limited to 'src/psycstore')
-rw-r--r--src/psycstore/plugin_psycstore_sqlite.c6
-rw-r--r--src/psycstore/psycstore.h11
-rw-r--r--src/psycstore/psycstore_api.c12
3 files changed, 18 insertions, 11 deletions
diff --git a/src/psycstore/plugin_psycstore_sqlite.c b/src/psycstore/plugin_psycstore_sqlite.c
index 6ca0236d5..86b969c5d 100644
--- a/src/psycstore/plugin_psycstore_sqlite.c
+++ b/src/psycstore/plugin_psycstore_sqlite.c
@@ -750,7 +750,7 @@ channel_key_store (struct Plugin *plugin,
750 750
751static int 751static int
752slave_key_store (struct Plugin *plugin, 752slave_key_store (struct Plugin *plugin,
753 const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key) 753 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key)
754{ 754{
755 sqlite3_stmt *stmt = plugin->insert_slave_key; 755 sqlite3_stmt *stmt = plugin->insert_slave_key;
756 756
@@ -789,7 +789,7 @@ slave_key_store (struct Plugin *plugin,
789static int 789static int
790membership_store (void *cls, 790membership_store (void *cls,
791 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, 791 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
792 const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key, 792 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
793 int did_join, 793 int did_join,
794 uint64_t announced_at, 794 uint64_t announced_at,
795 uint64_t effective_since, 795 uint64_t effective_since,
@@ -851,7 +851,7 @@ membership_store (void *cls,
851static int 851static int
852membership_test (void *cls, 852membership_test (void *cls,
853 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, 853 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
854 const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key, 854 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
855 uint64_t message_id) 855 uint64_t message_id)
856{ 856{
857 struct Plugin *plugin = cls; 857 struct Plugin *plugin = cls;
diff --git a/src/psycstore/psycstore.h b/src/psycstore/psycstore.h
index 16d898a45..1d586990f 100644
--- a/src/psycstore/psycstore.h
+++ b/src/psycstore/psycstore.h
@@ -175,7 +175,7 @@ struct MembershipStoreRequest
175 /** 175 /**
176 * Slave's public key. 176 * Slave's public key.
177 */ 177 */
178 struct GNUNET_CRYPTO_EddsaPublicKey slave_key; 178 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
179 179
180 uint64_t announced_at GNUNET_PACKED; 180 uint64_t announced_at GNUNET_PACKED;
181 uint64_t effective_since GNUNET_PACKED; 181 uint64_t effective_since GNUNET_PACKED;
@@ -207,7 +207,7 @@ struct MembershipTestRequest
207 /** 207 /**
208 * Slave's public key. 208 * Slave's public key.
209 */ 209 */
210 struct GNUNET_CRYPTO_EddsaPublicKey slave_key; 210 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
211 211
212 uint64_t message_id GNUNET_PACKED; 212 uint64_t message_id GNUNET_PACKED;
213 213
@@ -235,7 +235,12 @@ struct FragmentStoreRequest
235 */ 235 */
236 struct GNUNET_CRYPTO_EddsaPublicKey channel_key; 236 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
237 237
238 /**
239 * enum GNUNET_PSYCSTORE_MessageFlags
240 */
238 uint32_t psycstore_flags GNUNET_PACKED; 241 uint32_t psycstore_flags GNUNET_PACKED;
242
243 /* Followed by fragment */
239}; 244};
240 245
241 246
@@ -336,12 +341,14 @@ struct StateHashUpdateRequest
336 struct GNUNET_HashCode hash; 341 struct GNUNET_HashCode hash;
337}; 342};
338 343
344
339enum StateOpFlags 345enum StateOpFlags
340{ 346{
341 STATE_OP_FIRST = 1 << 0, 347 STATE_OP_FIRST = 1 << 0,
342 STATE_OP_LAST = 1 << 1 348 STATE_OP_LAST = 1 << 1
343}; 349};
344 350
351
345/** 352/**
346 * @see GNUNET_PSYCSTORE_state_modify() 353 * @see GNUNET_PSYCSTORE_state_modify()
347 */ 354 */
diff --git a/src/psycstore/psycstore_api.c b/src/psycstore/psycstore_api.c
index a5fdea10b..38580b013 100644
--- a/src/psycstore/psycstore_api.c
+++ b/src/psycstore/psycstore_api.c
@@ -656,7 +656,7 @@ GNUNET_PSYCSTORE_operation_cancel (struct GNUNET_PSYCSTORE_OperationHandle *op)
656struct GNUNET_PSYCSTORE_OperationHandle * 656struct GNUNET_PSYCSTORE_OperationHandle *
657GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h, 657GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h,
658 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, 658 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
659 const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key, 659 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
660 int did_join, 660 int did_join,
661 uint64_t announced_at, 661 uint64_t announced_at,
662 uint64_t effective_since, 662 uint64_t effective_since,
@@ -722,7 +722,7 @@ GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h,
722struct GNUNET_PSYCSTORE_OperationHandle * 722struct GNUNET_PSYCSTORE_OperationHandle *
723GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h, 723GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h,
724 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, 724 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
725 const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key, 725 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
726 uint64_t message_id, 726 uint64_t message_id,
727 uint64_t group_generation, 727 uint64_t group_generation,
728 GNUNET_PSYCSTORE_ResultCallback rcb, 728 GNUNET_PSYCSTORE_ResultCallback rcb,
@@ -770,12 +770,12 @@ GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h,
770struct GNUNET_PSYCSTORE_OperationHandle * 770struct GNUNET_PSYCSTORE_OperationHandle *
771GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h, 771GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h,
772 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, 772 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
773 const struct GNUNET_MULTICAST_MessageHeader *message, 773 const struct GNUNET_MULTICAST_MessageHeader *msg,
774 uint32_t psycstore_flags, 774 enum GNUNET_PSYCSTORE_MessageFlags psycstore_flags,
775 GNUNET_PSYCSTORE_ResultCallback rcb, 775 GNUNET_PSYCSTORE_ResultCallback rcb,
776 void *rcb_cls) 776 void *rcb_cls)
777{ 777{
778 uint16_t size = ntohs (message->header.size); 778 uint16_t size = ntohs (msg->header.size);
779 struct FragmentStoreRequest *req; 779 struct FragmentStoreRequest *req;
780 struct GNUNET_PSYCSTORE_OperationHandle *op 780 struct GNUNET_PSYCSTORE_OperationHandle *op
781 = GNUNET_malloc (sizeof (*op) + sizeof (*req) + size); 781 = GNUNET_malloc (sizeof (*op) + sizeof (*req) + size);
@@ -789,7 +789,7 @@ GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h,
789 req->header.size = htons (sizeof (*req) + size); 789 req->header.size = htons (sizeof (*req) + size);
790 req->channel_key = *channel_key; 790 req->channel_key = *channel_key;
791 req->psycstore_flags = htonl (psycstore_flags); 791 req->psycstore_flags = htonl (psycstore_flags);
792 memcpy (&req[1], message, size); 792 memcpy (&req[1], msg, size);
793 793
794 op->op_id = get_next_op_id (h); 794 op->op_id = get_next_op_id (h);
795 req->op_id = htonl (op->op_id); 795 req->op_id = htonl (op->op_id);