diff options
author | Gabor X Toth <*@tg-x.net> | 2014-07-10 17:49:53 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2014-07-10 17:49:53 +0000 |
commit | a8133f3ff80aaaccc904e4bbaf69bc53dee499cb (patch) | |
tree | c10edd7a8156280c61357ccf9e0f1f27c7a0d6db /src/psyc/psyc_api.c | |
parent | 6c75526e936fcc74ee79b13831b2b6dda57f293d (diff) | |
download | gnunet-a8133f3ff80aaaccc904e4bbaf69bc53dee499cb.tar.gz gnunet-a8133f3ff80aaaccc904e4bbaf69bc53dee499cb.zip |
PSYC(store), Multicast: use ECDSA slave/member keys; PSYC: add GNUNET_PSYC_message_create()
Diffstat (limited to 'src/psyc/psyc_api.c')
-rw-r--r-- | src/psyc/psyc_api.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/src/psyc/psyc_api.c b/src/psyc/psyc_api.c index bfb6f43fb..88b007a0f 100644 --- a/src/psyc/psyc_api.c +++ b/src/psyc/psyc_api.c | |||
@@ -133,7 +133,7 @@ struct GNUNET_PSYC_Slave | |||
133 | struct GNUNET_PSYC_JoinHandle | 133 | struct GNUNET_PSYC_JoinHandle |
134 | { | 134 | { |
135 | struct GNUNET_PSYC_Master *mst; | 135 | struct GNUNET_PSYC_Master *mst; |
136 | struct GNUNET_CRYPTO_EddsaPublicKey slave_key; | 136 | struct GNUNET_CRYPTO_EcdsaPublicKey slave_key; |
137 | }; | 137 | }; |
138 | 138 | ||
139 | 139 | ||
@@ -270,8 +270,8 @@ slave_recv_join_decision (void *cls, | |||
270 | struct GNUNET_PSYC_Slave * | 270 | struct GNUNET_PSYC_Slave * |
271 | slv = GNUNET_CLIENT_MANAGER_get_user_context_ (client, | 271 | slv = GNUNET_CLIENT_MANAGER_get_user_context_ (client, |
272 | sizeof (struct GNUNET_PSYC_Channel)); | 272 | sizeof (struct GNUNET_PSYC_Channel)); |
273 | const struct SlaveJoinDecision * | 273 | const struct GNUNET_PSYC_JoinDecisionMessage * |
274 | dcsn = (const struct SlaveJoinDecision *) msg; | 274 | dcsn = (const struct GNUNET_PSYC_JoinDecisionMessage *) msg; |
275 | 275 | ||
276 | struct GNUNET_PSYC_MessageHeader *pmsg = NULL; | 276 | struct GNUNET_PSYC_MessageHeader *pmsg = NULL; |
277 | if (ntohs (dcsn->header.size) <= sizeof (*dcsn) + sizeof (*pmsg)) | 277 | if (ntohs (dcsn->header.size) <= sizeof (*dcsn) + sizeof (*pmsg)) |
@@ -285,8 +285,6 @@ slave_recv_join_decision (void *cls, | |||
285 | 285 | ||
286 | static struct GNUNET_CLIENT_MANAGER_MessageHandler master_handlers[] = | 286 | static struct GNUNET_CLIENT_MANAGER_MessageHandler master_handlers[] = |
287 | { | 287 | { |
288 | { &channel_recv_disconnect, NULL, 0, 0, GNUNET_NO }, | ||
289 | |||
290 | { &channel_recv_message, NULL, | 288 | { &channel_recv_message, NULL, |
291 | GNUNET_MESSAGE_TYPE_PSYC_MESSAGE, | 289 | GNUNET_MESSAGE_TYPE_PSYC_MESSAGE, |
292 | sizeof (struct GNUNET_PSYC_MessageHeader), GNUNET_YES }, | 290 | sizeof (struct GNUNET_PSYC_MessageHeader), GNUNET_YES }, |
@@ -303,14 +301,14 @@ static struct GNUNET_CLIENT_MANAGER_MessageHandler master_handlers[] = | |||
303 | GNUNET_MESSAGE_TYPE_PSYC_JOIN_REQUEST, | 301 | GNUNET_MESSAGE_TYPE_PSYC_JOIN_REQUEST, |
304 | sizeof (struct MasterJoinRequest), GNUNET_YES }, | 302 | sizeof (struct MasterJoinRequest), GNUNET_YES }, |
305 | 303 | ||
304 | { &channel_recv_disconnect, NULL, 0, 0, GNUNET_NO }, | ||
305 | |||
306 | { NULL, NULL, 0, 0, GNUNET_NO } | 306 | { NULL, NULL, 0, 0, GNUNET_NO } |
307 | }; | 307 | }; |
308 | 308 | ||
309 | 309 | ||
310 | static struct GNUNET_CLIENT_MANAGER_MessageHandler slave_handlers[] = | 310 | static struct GNUNET_CLIENT_MANAGER_MessageHandler slave_handlers[] = |
311 | { | 311 | { |
312 | { &channel_recv_disconnect, NULL, 0, 0, GNUNET_NO }, | ||
313 | |||
314 | { &channel_recv_message, NULL, | 312 | { &channel_recv_message, NULL, |
315 | GNUNET_MESSAGE_TYPE_PSYC_MESSAGE, | 313 | GNUNET_MESSAGE_TYPE_PSYC_MESSAGE, |
316 | sizeof (struct GNUNET_PSYC_MessageHeader), GNUNET_YES }, | 314 | sizeof (struct GNUNET_PSYC_MessageHeader), GNUNET_YES }, |
@@ -325,7 +323,9 @@ static struct GNUNET_CLIENT_MANAGER_MessageHandler slave_handlers[] = | |||
325 | 323 | ||
326 | { &slave_recv_join_decision, NULL, | 324 | { &slave_recv_join_decision, NULL, |
327 | GNUNET_MESSAGE_TYPE_PSYC_JOIN_DECISION, | 325 | GNUNET_MESSAGE_TYPE_PSYC_JOIN_DECISION, |
328 | sizeof (struct SlaveJoinDecision), GNUNET_YES }, | 326 | sizeof (struct GNUNET_PSYC_JoinDecisionMessage), GNUNET_YES }, |
327 | |||
328 | { &channel_recv_disconnect, NULL, 0, 0, GNUNET_NO }, | ||
329 | 329 | ||
330 | { NULL, NULL, 0, 0, GNUNET_NO } | 330 | { NULL, NULL, 0, 0, GNUNET_NO } |
331 | }; | 331 | }; |
@@ -442,7 +442,7 @@ GNUNET_PSYC_join_decision (struct GNUNET_PSYC_JoinHandle *jh, | |||
442 | const struct GNUNET_PSYC_MessageHeader *join_resp) | 442 | const struct GNUNET_PSYC_MessageHeader *join_resp) |
443 | { | 443 | { |
444 | struct GNUNET_PSYC_Channel *chn = &jh->mst->chn; | 444 | struct GNUNET_PSYC_Channel *chn = &jh->mst->chn; |
445 | struct MasterJoinDecision *dcsn; | 445 | struct GNUNET_PSYC_JoinDecisionMessage *dcsn; |
446 | uint16_t join_resp_size | 446 | uint16_t join_resp_size |
447 | = (NULL != join_resp) ? ntohs (join_resp->header.size) : 0; | 447 | = (NULL != join_resp) ? ntohs (join_resp->header.size) : 0; |
448 | uint16_t relay_size = relay_count * sizeof (*relays); | 448 | uint16_t relay_size = relay_count * sizeof (*relays); |
@@ -571,7 +571,7 @@ GNUNET_PSYC_master_get_channel (struct GNUNET_PSYC_Master *master) | |||
571 | struct GNUNET_PSYC_Slave * | 571 | struct GNUNET_PSYC_Slave * |
572 | GNUNET_PSYC_slave_join (const struct GNUNET_CONFIGURATION_Handle *cfg, | 572 | GNUNET_PSYC_slave_join (const struct GNUNET_CONFIGURATION_Handle *cfg, |
573 | const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, | 573 | const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, |
574 | const struct GNUNET_CRYPTO_EddsaPrivateKey *slave_key, | 574 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *slave_key, |
575 | const struct GNUNET_PeerIdentity *origin, | 575 | const struct GNUNET_PeerIdentity *origin, |
576 | uint32_t relay_count, | 576 | uint32_t relay_count, |
577 | const struct GNUNET_PeerIdentity *relays, | 577 | const struct GNUNET_PeerIdentity *relays, |
@@ -579,10 +579,7 @@ GNUNET_PSYC_slave_join (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
579 | GNUNET_PSYC_SlaveConnectCallback connect_cb, | 579 | GNUNET_PSYC_SlaveConnectCallback connect_cb, |
580 | GNUNET_PSYC_JoinDecisionCallback join_decision_cb, | 580 | GNUNET_PSYC_JoinDecisionCallback join_decision_cb, |
581 | void *cls, | 581 | void *cls, |
582 | const char *method_name, | 582 | const struct GNUNET_MessageHeader *join_msg) |
583 | const struct GNUNET_ENV_Environment *env, | ||
584 | const void *data, | ||
585 | uint16_t data_size) | ||
586 | { | 583 | { |
587 | struct GNUNET_PSYC_Slave *slv = GNUNET_malloc (sizeof (*slv)); | 584 | struct GNUNET_PSYC_Slave *slv = GNUNET_malloc (sizeof (*slv)); |
588 | struct GNUNET_PSYC_Channel *chn = &slv->chn; | 585 | struct GNUNET_PSYC_Channel *chn = &slv->chn; |
@@ -725,11 +722,11 @@ GNUNET_PSYC_slave_get_channel (struct GNUNET_PSYC_Slave *slv) | |||
725 | */ | 722 | */ |
726 | void | 723 | void |
727 | GNUNET_PSYC_channel_slave_add (struct GNUNET_PSYC_Channel *chn, | 724 | GNUNET_PSYC_channel_slave_add (struct GNUNET_PSYC_Channel *chn, |
728 | const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key, | 725 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, |
729 | uint64_t announced_at, | 726 | uint64_t announced_at, |
730 | uint64_t effective_since) | 727 | uint64_t effective_since) |
731 | { | 728 | { |
732 | struct ChannelSlaveAdd *add = GNUNET_malloc (sizeof (*add)); | 729 | struct ChannelSlaveAddRequest *add = GNUNET_malloc (sizeof (*add)); |
733 | add->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_SLAVE_ADD); | 730 | add->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_SLAVE_ADD); |
734 | add->header.size = htons (sizeof (*add)); | 731 | add->header.size = htons (sizeof (*add)); |
735 | add->announced_at = GNUNET_htonll (announced_at); | 732 | add->announced_at = GNUNET_htonll (announced_at); |
@@ -761,10 +758,10 @@ GNUNET_PSYC_channel_slave_add (struct GNUNET_PSYC_Channel *chn, | |||
761 | */ | 758 | */ |
762 | void | 759 | void |
763 | GNUNET_PSYC_channel_slave_remove (struct GNUNET_PSYC_Channel *chn, | 760 | GNUNET_PSYC_channel_slave_remove (struct GNUNET_PSYC_Channel *chn, |
764 | const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key, | 761 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, |
765 | uint64_t announced_at) | 762 | uint64_t announced_at) |
766 | { | 763 | { |
767 | struct ChannelSlaveRemove *rm = GNUNET_malloc (sizeof (*rm)); | 764 | struct ChannelSlaveRemoveRequest *rm = GNUNET_malloc (sizeof (*rm)); |
768 | rm->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_SLAVE_RM); | 765 | rm->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_SLAVE_RM); |
769 | rm->header.size = htons (sizeof (*rm)); | 766 | rm->header.size = htons (sizeof (*rm)); |
770 | rm->announced_at = GNUNET_htonll (announced_at); | 767 | rm->announced_at = GNUNET_htonll (announced_at); |