/*
* This file is part of GNUnet
- * Copyright (C) 2013 Christian Grothoff (and other contributing authors)
+ * Copyright (C) 2013 GNUnet e.V.
*
- * GNUnet is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 3, or (at your
- * option) any later version.
+ * GNUnet is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
*
* GNUnet is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
+ * Affero General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with GNUnet; see the file COPYING. If not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
#include "gnunet_common.h"
#include "gnunet_util_lib.h"
#include "gnunet_testing_lib.h"
-#include "gnunet_core_service.h"
#include "gnunet_multicast_service.h"
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
static const struct GNUNET_CONFIGURATION_Handle *cfg;
-struct GNUNET_CORE_Handle *core;
struct GNUNET_PeerIdentity this_peer;
struct GNUNET_MULTICAST_Origin *origin;
enum
{
- TEST_NONE = 0,
- TEST_ORIGIN_START = 1,
- TEST_MEMBER_JOIN_REFUSE = 2,
- TEST_MEMBER_JOIN_ADMIT = 3,
- TEST_ORIGIN_TO_ALL = 4,
- TEST_ORIGIN_TO_ALL_RECV = 5,
- TEST_MEMBER_TO_ORIGIN = 6,
- TEST_MEMBER_PART = 7,
- TEST_ORIGIN_STOP = 8,
+ TEST_NONE = 0,
+ TEST_ORIGIN_START = 1,
+ TEST_MEMBER_JOIN_REFUSE = 2,
+ TEST_MEMBER_JOIN_ADMIT = 3,
+ TEST_ORIGIN_TO_ALL = 4,
+ TEST_ORIGIN_TO_ALL_RECV = 5,
+ TEST_MEMBER_TO_ORIGIN = 6,
+ TEST_MEMBER_REPLAY_ERROR = 7,
+ TEST_MEMBER_REPLAY_OK = 8,
+ TEST_MEMBER_PART = 9,
+ TEST_ORIGIN_STOP = 10,
} test;
+uint64_t replay_fragment_id;
+uint64_t replay_flags;
static void
member_join (int t);
static void
cleanup ()
{
- if (NULL != core)
- {
- GNUNET_CORE_disconnect (core);
- core = NULL;
- }
if (NULL != member)
{
GNUNET_MULTICAST_member_part (member, NULL, NULL);
* Terminate the test case (failure).
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
res = 1;
cleanup ();
* Terminate the test case (success).
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_normally (void *cls)
{
res = 0;
cleanup ();
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Test PASSED.\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Test PASSED.\n");
}
}
-void
-tmit_resume (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+static void
+tmit_resume (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmission resumed.\n");
struct TransmitClosure *tmit = cls;
if (NULL != tmit->orig_tmit)
GNUNET_MULTICAST_origin_to_all_resume (tmit->orig_tmit);
- else
+ else if (NULL != tmit->mem_tmit)
GNUNET_MULTICAST_member_to_origin_resume (tmit->mem_tmit);
}
uint16_t size = strlen (tmit->data[tmit->n]);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Transmit notify data: %u bytes available, "
- "processing fragment %u/%u (size %u).\n",
- *data_size, tmit->n + 1, tmit->data_count, size);
+ "Transmit notify data: %u bytes available, processing fragment %u/%u (size %u).\n",
+ (unsigned int) *data_size,
+ tmit->n + 1,
+ tmit->data_count,
+ size);
if (*data_size < size)
{
*data_size = 0;
tmit->paused = GNUNET_NO;
*data_size = size;
- memcpy (data, tmit->data[tmit->n], size);
+ GNUNET_memcpy (data, tmit->data[tmit->n], size);
return ++tmit->n < tmit->data_count ? GNUNET_NO : GNUNET_YES;
}
static void
-origin_recv_replay_msg (void *cls,
- const struct GNUNET_CRYPTO_EcdsaPublicKey *member_key,
- uint64_t message_id,
- uint64_t fragment_offset,
- uint64_t flags,
- struct GNUNET_MULTICAST_ReplayHandle *rh)
+member_recv_join_request (void *cls,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey *member_key,
+ const struct GNUNET_MessageHeader *join_msg,
+ struct GNUNET_MULTICAST_JoinHandle *jh)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Test #%u: origin_recv_replay_msg()\n", test);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: member_recv_join_request()\n", test);
}
static void
-member_recv_replay_msg (void *cls,
- const struct GNUNET_CRYPTO_EcdsaPublicKey *member_key,
- uint64_t message_id,
- uint64_t fragment_offset,
- uint64_t flags,
- struct GNUNET_MULTICAST_ReplayHandle *rh)
+origin_stopped (void *cls)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Test #%u: member_recv_replay_msg()\n", test);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: origin_stopped()\n", test);
+ end ();
}
static void
-origin_recv_replay_frag (void *cls,
- const struct GNUNET_CRYPTO_EcdsaPublicKey *member_key,
- uint64_t fragment_id,
- uint64_t flags,
- struct GNUNET_MULTICAST_ReplayHandle *rh)
+schedule_origin_stop (void *cls)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Test #%u: origin_recv_replay_frag()\n", test);
+ test = TEST_ORIGIN_STOP;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: origin_stop()\n", test);
+ GNUNET_MULTICAST_origin_stop (origin, origin_stopped, NULL);
+ origin = NULL;
}
static void
-member_recv_replay_frag (void *cls,
- const struct GNUNET_CRYPTO_EcdsaPublicKey *member_key,
- uint64_t fragment_id,
- uint64_t flags,
- struct GNUNET_MULTICAST_ReplayHandle *rh)
+member_parted (void *cls)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Test #%u: member_recv_replay_frag()\n", test);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: member_parted()\n", test);
+ member = NULL;
+
+ switch (test)
+ {
+ case TEST_MEMBER_JOIN_REFUSE:
+ // Test 3 starts here
+ member_join (TEST_MEMBER_JOIN_ADMIT);
+ break;
+
+ case TEST_MEMBER_PART:
+ GNUNET_SCHEDULER_add_now (&schedule_origin_stop, NULL);
+ break;
+
+ default:
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Invalid test #%d in member_parted()\n", test);
+ GNUNET_assert (0);
+ }
}
static void
-origin_recv_membership_test (void *cls,
- const struct GNUNET_CRYPTO_EcdsaPublicKey *member_key,
- uint64_t message_id,
- uint64_t group_generation,
- struct GNUNET_MULTICAST_MembershipTestHandle *mth)
+schedule_member_part (void *cls)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Test #%u: origin_recv_membership_test()\n", test);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: schedule_member_part()\n", test);
+ GNUNET_MULTICAST_member_part (member, member_parted, NULL);
}
static void
-member_recv_membership_test (void *cls,
- const struct GNUNET_CRYPTO_EcdsaPublicKey *member_key,
- uint64_t message_id,
- uint64_t group_generation,
- struct GNUNET_MULTICAST_MembershipTestHandle *mth)
+member_part ()
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Test #%u: member_recv_membership_test()\n", test);
+ test = TEST_MEMBER_PART;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: member_part()\n", test);
+ // Test 10 starts here
+ GNUNET_SCHEDULER_add_now (&schedule_member_part, NULL);
}
static void
-member_recv_join_request (void *cls,
- const struct GNUNET_CRYPTO_EcdsaPublicKey *member_key,
- const struct GNUNET_MessageHeader *join_msg,
- struct GNUNET_MULTICAST_JoinHandle *jh)
+member_replay_ok ()
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Test #%u: member_recv_join_request()\n", test);
+ // Execution of test 8 here
+ test = TEST_MEMBER_REPLAY_OK;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: member_replay_ok()\n", test);
+ replay_fragment_id = 1;
+ replay_flags = 1 | 1<<11;
+ GNUNET_MULTICAST_member_replay_fragment (member, replay_fragment_id,
+ replay_flags);
}
static void
-origin_stopped (void *cls)
+member_replay_error ()
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Test #%u: origin_stopped()\n", test);
- end ();
+ test = TEST_MEMBER_REPLAY_ERROR;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: member_replay_error()\n", test);
+ replay_fragment_id = 1234;
+ replay_flags = 11 | 1<<11;
+ GNUNET_MULTICAST_member_replay_fragment (member, replay_fragment_id,
+ replay_flags);
}
static void
-schedule_origin_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+origin_recv_replay_msg (void *cls,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey *member_key,
+ uint64_t message_id,
+ uint64_t fragment_offset,
+ uint64_t flags,
+ struct GNUNET_MULTICAST_ReplayHandle *rh)
{
- test = TEST_ORIGIN_STOP;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Test #%u: origin_stop()\n", test);
- GNUNET_MULTICAST_origin_stop (origin, origin_stopped, NULL);
- origin = NULL;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: origin_recv_replay_msg()\n", test);
+ GNUNET_assert (0);
}
static void
-member_parted (void *cls)
+member_recv_replay_msg (void *cls,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey *member_key,
+ uint64_t message_id,
+ uint64_t fragment_offset,
+ uint64_t flags,
+ struct GNUNET_MULTICAST_ReplayHandle *rh)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Test #%u: member_parted()\n", test);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: member_recv_replay_msg()\n", test);
+ GNUNET_assert (0);
+}
+
+static void
+origin_recv_replay_frag (void *cls,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey *member_key,
+ uint64_t fragment_id,
+ uint64_t flags,
+ struct GNUNET_MULTICAST_ReplayHandle *rh)
+{
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: origin_recv_replay_frag()"
+ " - fragment_id=%" PRIu64 " flags=%" PRIu64 "\n",
+ test, fragment_id, flags);
+ GNUNET_assert (replay_fragment_id == fragment_id && replay_flags == flags);
switch (test)
{
- case TEST_MEMBER_JOIN_REFUSE:
- member_join (TEST_MEMBER_JOIN_ADMIT);
+ case TEST_MEMBER_REPLAY_ERROR:
+ // Test 8 starts here
+ GNUNET_MULTICAST_replay_response (rh, NULL, GNUNET_SYSERR);
+ member_replay_ok ();
break;
- case TEST_MEMBER_PART:
- GNUNET_SCHEDULER_add_now (schedule_origin_stop, NULL);
+ case TEST_MEMBER_REPLAY_OK:
+ {
+ struct GNUNET_MULTICAST_MessageHeader mmsg = {
+ .header = {
+ .type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE),
+ .size = htons (sizeof (mmsg)),
+ },
+ .fragment_id = GNUNET_htonll (1),
+ .message_id = GNUNET_htonll (1),
+ .fragment_offset = 0,
+ .group_generation = GNUNET_htonll (1),
+ .flags = 0,
+ };
+ member_cls.n = 0;
+ member_cls.msgs_expected = 1;
+ GNUNET_MULTICAST_replay_response (rh, &mmsg.header, GNUNET_MULTICAST_REC_OK);
+ GNUNET_MULTICAST_replay_response_end (rh);
break;
+ }
default:
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Invalid test #%d in member_recv_join_decision()\n", test);
+ "Invalid test #%d in origin_recv_replay_frag()\n", test);
GNUNET_assert (0);
}
}
static void
-member_part ()
-{
- test = TEST_MEMBER_PART;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Test #%u: member_part()\n", test);
- GNUNET_MULTICAST_member_part (member, member_parted, NULL);
- member = NULL;
-}
-
-
-static void
-schedule_member_part (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+member_recv_replay_frag (void *cls,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey *member_key,
+ uint64_t fragment_id,
+ uint64_t flags,
+ struct GNUNET_MULTICAST_ReplayHandle *rh)
{
- GNUNET_MULTICAST_member_part (member, member_parted, NULL);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: member_recv_replay_frag()\n", test);
+ GNUNET_assert (0);
}
const struct GNUNET_MULTICAST_RequestHeader *req)
{
struct OriginClosure *ocls = cls;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: origin_recv_request()\n", test);
if (++ocls->n != ocls->msgs_expected)
return;
-
- GNUNET_assert (0 == memcmp (&req->member_key,
- &member_pub_key, sizeof (member_pub_key)));
+ GNUNET_assert (0 == memcmp (&req->member_pub_key,
+ &member_pub_key, sizeof (member_pub_key)));
- // FIXME: check message content
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Test #%u: verify message content, take first 3 bytes: %.3s\n",
+ test, (char *)&req[1]);
+ GNUNET_assert (0 == memcmp (&req[1], "abc", 3));
- member_part ();
+ // Test 7 starts here
+ member_replay_error ();
}
member_to_origin ()
{
test = TEST_MEMBER_TO_ORIGIN;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: member_to_origin()\n", test);
struct TransmitClosure *tmit = &tmit_cls;
*tmit = (struct TransmitClosure) {};
tmit->data[0] = "abc def";
tmit->data[1] = "ghi jkl mno";
- tmit->data_delay[1] = 1;
+ tmit->data_delay[1] = 2;
tmit->data[2] = "pqr stuw xyz";
tmit->data_count = 3;
origin_cls.n = 0;
origin_cls.msgs_expected = 1;
- GNUNET_MULTICAST_member_to_origin (member, 1, tmit_notify, tmit);
+ tmit->mem_tmit = GNUNET_MULTICAST_member_to_origin (member, 1,
+ tmit_notify, tmit);
}
const struct GNUNET_MULTICAST_MessageHeader *msg)
{
struct MemberClosure *mcls = cls;
+
+ // Test 5 starts here after message has been received from origin
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Test #%u: member_recv_message() %u/%u\n",
- test, mcls->n + 1, mcls->msgs_expected);
+ test,
+ (unsigned int) (mcls->n + 1),
+ mcls->msgs_expected);
if (++mcls->n != mcls->msgs_expected)
return;
switch (test)
{
+ case TEST_ORIGIN_TO_ALL:
+ test = TEST_ORIGIN_TO_ALL_RECV;
+ break;
+
case TEST_ORIGIN_TO_ALL_RECV:
+ // Test 6 starts here
member_to_origin ();
break;
+ case TEST_MEMBER_REPLAY_OK:
+ // Test 9 starts here
+ GNUNET_assert (replay_fragment_id == GNUNET_ntohll (msg->fragment_id));
+ member_part ();
+ break;
+
default:
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid test #%d in origin_recv_message()\n", test);
const struct GNUNET_MULTICAST_MessageHeader *msg)
{
struct OriginClosure *ocls = cls;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: origin_recv_message() %u/%u\n",
test, ocls->n + 1, ocls->msgs_expected);
if (++ocls->n != ocls->msgs_expected)
switch (test)
{
case TEST_ORIGIN_TO_ALL:
+ // Prepare to execute test 5
test = TEST_ORIGIN_TO_ALL_RECV;
break;
+ case TEST_ORIGIN_TO_ALL_RECV:
+ // Test 6 starts here
+ member_to_origin ();
+ break;
+
default:
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid test #%d in origin_recv_message()\n", test);
origin_to_all ()
{
test = TEST_ORIGIN_TO_ALL;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: origin_to_all()\n", test);
struct TransmitClosure *tmit = &tmit_cls;
*tmit = (struct TransmitClosure) {};
tmit->data[0] = "ABC DEF";
- tmit->data[1] = "GHI JKL MNO";
- tmit->data_delay[1] = 1;
- tmit->data[2] = "PQR STUW XYZ";
- tmit->data_count = 3;
+ tmit->data[1] = GNUNET_malloc (GNUNET_MULTICAST_FRAGMENT_MAX_PAYLOAD + 1);
+ uint16_t i;
+ for (i = 0; i < GNUNET_MULTICAST_FRAGMENT_MAX_PAYLOAD; i++)
+ tmit->data[1][i] = (0 == i % 10000) ? '0' + i / 10000 : '_';
+ tmit->data[2] = "GHI JKL MNO";
+ tmit->data_delay[2] = 2;
+ tmit->data[3] = "PQR STUW XYZ";
+ tmit->data_count = 4;
origin_cls.n = member_cls.n = 0;
- origin_cls.msgs_expected = member_cls.msgs_expected = 1;
+ origin_cls.msgs_expected = member_cls.msgs_expected = tmit->data_count;
- GNUNET_MULTICAST_origin_to_all (origin, 1, 1, tmit_notify, tmit);
+ tmit->orig_tmit = GNUNET_MULTICAST_origin_to_all (origin, 1, 1,
+ tmit_notify, tmit);
}
const struct GNUNET_PeerIdentity *relays,
const struct GNUNET_MessageHeader *join_msg)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: member_recv_join_decision() - is_admitted: %d\n",
test, is_admitted);
{
case TEST_MEMBER_JOIN_REFUSE:
GNUNET_assert (0 == relay_count);
- GNUNET_SCHEDULER_add_now (schedule_member_part, NULL);
+ // Test 3 starts here
+ GNUNET_SCHEDULER_add_now (&schedule_member_part, NULL);
break;
-
+
case TEST_MEMBER_JOIN_ADMIT:
GNUNET_assert (1 == relay_count);
GNUNET_assert (0 == memcmp (relays, &this_peer, sizeof (this_peer)));
+ // Test 4 starts here
origin_to_all ();
break;
}
}
-
+/**
+ * Test: origin receives join request
+ */
static void
origin_recv_join_request (void *cls,
const struct GNUNET_CRYPTO_EcdsaPublicKey *mem_key,
const struct GNUNET_MessageHeader *join_msg,
struct GNUNET_MULTICAST_JoinHandle *jh)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: origin_recv_join_request()\n", test);
GNUNET_assert (0 == memcmp (mem_key, &member_pub_key, sizeof (member_pub_key)));
join_resp = GNUNET_malloc (sizeof (join_resp) + data_size);
join_resp->size = htons (sizeof (join_resp) + data_size);
join_resp->type = htons (456);
- memcpy (&join_resp[1], data, data_size);
-
+ GNUNET_memcpy (&join_resp[1], data, data_size);
+
switch (test)
{
case TEST_MEMBER_JOIN_REFUSE:
+ // Test 3 starts here
GNUNET_MULTICAST_join_decision (jh, GNUNET_NO, 0, NULL, join_resp);
break;
-
+
case TEST_MEMBER_JOIN_ADMIT:
+ // Test 3 is running
GNUNET_MULTICAST_join_decision (jh, GNUNET_YES, 1, &this_peer, join_resp);
break;
}
}
-
+/**
+ * Test: member joins multicast group
+ */
static void
member_join (int t)
{
test = t;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: member_join()\n", test);
member_key = GNUNET_CRYPTO_ecdsa_key_create ();
join_req = GNUNET_malloc (sizeof (join_req) + data_size);
join_req->size = htons (sizeof (join_req) + data_size);
join_req->type = htons (123);
- memcpy (&join_req[1], data, data_size);
+ GNUNET_memcpy (&join_req[1], data, data_size);
member = GNUNET_MULTICAST_member_join (cfg, &group_pub_key, member_key,
&this_peer, 1, &this_peer, join_req,
member_recv_join_request,
member_recv_join_decision,
- member_recv_membership_test,
member_recv_replay_frag,
member_recv_replay_msg,
member_recv_message,
&member_cls);
}
-
+/**
+ * Test: Start a multicast group as origin
+ */
static void
origin_start ()
{
test = TEST_ORIGIN_START;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: origin_start()\n", test);
group_key = GNUNET_CRYPTO_eddsa_key_create ();
origin = GNUNET_MULTICAST_origin_start (cfg, group_key, 0,
origin_recv_join_request,
- origin_recv_membership_test,
origin_recv_replay_frag,
origin_recv_replay_msg,
origin_recv_request,
origin_recv_message,
&origin_cls);
+ // Test 2 starts here
member_join (TEST_MEMBER_JOIN_REFUSE);
}
-static void
-core_connected (void *cls, const struct GNUNET_PeerIdentity *my_identity)
-{
- this_peer = *my_identity;
- origin_start ();
-}
-
-
/**
* Main function of the test, run from scheduler.
*
*/
static void
#if DEBUG_TEST_MULTICAST
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
+ char *const *args,
+ const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *c)
#else
run (void *cls,
#endif
{
cfg = c;
- end_badly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
+ end_badly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
+ &end_badly, NULL);
+ GNUNET_CRYPTO_get_peer_identity (cfg, &this_peer);
- core = GNUNET_CORE_connect (cfg, NULL, &core_connected, NULL, NULL,
- NULL, GNUNET_NO, NULL, GNUNET_NO, NULL);
+ // Test 1 starts here
+ origin_start ();
}