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/test_psyc.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/test_psyc.c')
-rw-r--r-- | src/psyc/test_psyc.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/psyc/test_psyc.c b/src/psyc/test_psyc.c index 6468b8a2b..0077bc9b7 100644 --- a/src/psyc/test_psyc.c +++ b/src/psyc/test_psyc.c | |||
@@ -33,11 +33,12 @@ | |||
33 | #include "gnunet_util_lib.h" | 33 | #include "gnunet_util_lib.h" |
34 | #include "gnunet_testing_lib.h" | 34 | #include "gnunet_testing_lib.h" |
35 | #include "gnunet_env_lib.h" | 35 | #include "gnunet_env_lib.h" |
36 | #include "gnunet_psyc_util_lib.h" | ||
36 | #include "gnunet_psyc_service.h" | 37 | #include "gnunet_psyc_service.h" |
37 | 38 | ||
38 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) | 39 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) |
39 | 40 | ||
40 | #define DEBUG_SERVICE 1 | 41 | #define DEBUG_SERVICE 0 |
41 | 42 | ||
42 | 43 | ||
43 | /** | 44 | /** |
@@ -56,10 +57,10 @@ static struct GNUNET_PSYC_Master *mst; | |||
56 | static struct GNUNET_PSYC_Slave *slv; | 57 | static struct GNUNET_PSYC_Slave *slv; |
57 | 58 | ||
58 | static struct GNUNET_CRYPTO_EddsaPrivateKey *channel_key; | 59 | static struct GNUNET_CRYPTO_EddsaPrivateKey *channel_key; |
59 | static struct GNUNET_CRYPTO_EddsaPrivateKey *slave_key; | 60 | static struct GNUNET_CRYPTO_EcdsaPrivateKey *slave_key; |
60 | 61 | ||
61 | static struct GNUNET_CRYPTO_EddsaPublicKey channel_pub_key; | 62 | static struct GNUNET_CRYPTO_EddsaPublicKey channel_pub_key; |
62 | static struct GNUNET_CRYPTO_EddsaPublicKey slave_pub_key; | 63 | static struct GNUNET_CRYPTO_EcdsaPublicKey slave_pub_key; |
63 | 64 | ||
64 | struct GNUNET_PSYC_MasterTransmitHandle *mth; | 65 | struct GNUNET_PSYC_MasterTransmitHandle *mth; |
65 | 66 | ||
@@ -414,7 +415,7 @@ join_decision_cb (void *cls, int is_admitted, | |||
414 | 415 | ||
415 | 416 | ||
416 | static void | 417 | static void |
417 | join_request_cb (void *cls, const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key, | 418 | join_request_cb (void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, |
418 | const struct GNUNET_PSYC_MessageHeader *msg, | 419 | const struct GNUNET_PSYC_MessageHeader *msg, |
419 | struct GNUNET_PSYC_JoinHandle *jh) | 420 | struct GNUNET_PSYC_JoinHandle *jh) |
420 | { | 421 | { |
@@ -449,10 +450,13 @@ slave_join () | |||
449 | "_foo", "bar baz", 7); | 450 | "_foo", "bar baz", 7); |
450 | GNUNET_ENV_environment_add (env, GNUNET_ENV_OP_ASSIGN, | 451 | GNUNET_ENV_environment_add (env, GNUNET_ENV_OP_ASSIGN, |
451 | "_foo_bar", "foo bar baz", 11); | 452 | "_foo_bar", "foo bar baz", 11); |
453 | struct GNUNET_MessageHeader * | ||
454 | join_msg = GNUNET_PSYC_message_create ("_request_join", env, "some data", 9); | ||
455 | |||
452 | slv = GNUNET_PSYC_slave_join (cfg, &channel_pub_key, slave_key, &origin, | 456 | slv = GNUNET_PSYC_slave_join (cfg, &channel_pub_key, slave_key, &origin, |
453 | 0, NULL, &slave_message_cb, | 457 | 0, NULL, &slave_message_cb, |
454 | &slave_connect_cb, &join_decision_cb, NULL, | 458 | &slave_connect_cb, &join_decision_cb, NULL, |
455 | "_request_join", env, "some data", 9); | 459 | join_msg); |
456 | GNUNET_ENV_environment_destroy (env); | 460 | GNUNET_ENV_environment_destroy (env); |
457 | } | 461 | } |
458 | 462 | ||
@@ -539,10 +543,10 @@ run (void *cls, | |||
539 | end_badly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); | 543 | end_badly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); |
540 | 544 | ||
541 | channel_key = GNUNET_CRYPTO_eddsa_key_create (); | 545 | channel_key = GNUNET_CRYPTO_eddsa_key_create (); |
542 | slave_key = GNUNET_CRYPTO_eddsa_key_create (); | 546 | slave_key = GNUNET_CRYPTO_ecdsa_key_create (); |
543 | 547 | ||
544 | GNUNET_CRYPTO_eddsa_key_get_public (channel_key, &channel_pub_key); | 548 | GNUNET_CRYPTO_eddsa_key_get_public (channel_key, &channel_pub_key); |
545 | GNUNET_CRYPTO_eddsa_key_get_public (slave_key, &slave_pub_key); | 549 | GNUNET_CRYPTO_ecdsa_key_get_public (slave_key, &slave_pub_key); |
546 | 550 | ||
547 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Starting master.\n"); | 551 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Starting master.\n"); |
548 | mst = GNUNET_PSYC_master_start (cfg, channel_key, GNUNET_PSYC_CHANNEL_PRIVATE, | 552 | mst = GNUNET_PSYC_master_start (cfg, channel_key, GNUNET_PSYC_CHANNEL_PRIVATE, |