1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
|
/*
* This file is part of GNUnet
* Copyright (C) 2013 GNUnet e.V.
*
* 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
* Affero General Public License for more details.
*
* 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/>.
*/
/**
* @file multicast/test_multicast.c
* @brief Tests for the Multicast API.
* @author Gabor X Toth
*/
#include <inttypes.h>
#include "platform.h"
#include "gnunet_crypto_lib.h"
#include "gnunet_common.h"
#include "gnunet_util_lib.h"
#include "gnunet_testing_lib.h"
#include "gnunet_multicast_service.h"
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
/**
* Return value from 'main'.
*/
static int res;
/**
* Handle for task for timeout termination.
*/
static struct GNUNET_SCHEDULER_Task * end_badly_task;
static const struct GNUNET_CONFIGURATION_Handle *cfg;
struct GNUNET_PeerIdentity this_peer;
struct GNUNET_MULTICAST_Origin *origin;
struct GNUNET_MULTICAST_Member *member;
struct GNUNET_CRYPTO_EddsaPrivateKey *group_key;
struct GNUNET_CRYPTO_EddsaPublicKey group_pub_key;
struct GNUNET_CRYPTO_EcdsaPrivateKey *member_key;
struct GNUNET_CRYPTO_EcdsaPublicKey member_pub_key;
struct TransmitClosure {
struct GNUNET_MULTICAST_OriginTransmitHandle *orig_tmit;
struct GNUNET_MULTICAST_MemberTransmitHandle *mem_tmit;
char * data[16];
uint8_t data_delay[16];
uint8_t data_count;
uint8_t paused;
uint8_t n;
} tmit_cls;
struct OriginClosure {
uint8_t msgs_expected;
uint8_t n;
} origin_cls;
struct MemberClosure {
uint8_t msgs_expected;
size_t n;
} member_cls;
struct GNUNET_MessageHeader *join_req, *join_resp;
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_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);
/**
* Clean up all resources used.
*/
static void
cleanup ()
{
if (NULL != member)
{
GNUNET_MULTICAST_member_part (member, NULL, NULL);
member = NULL;
}
if (NULL != origin)
{
GNUNET_MULTICAST_origin_stop (origin, NULL, NULL);
origin = NULL;
}
}
/**
* Terminate the test case (failure).
*
* @param cls NULL
*/
static void
end_badly (void *cls)
{
res = 1;
cleanup ();
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Test FAILED.\n");
}
/**
* Terminate the test case (success).
*
* @param cls NULL
*/
static void
end_normally (void *cls)
{
res = 0;
cleanup ();
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Test PASSED.\n");
}
/**
* Finish the test case (successfully).
*/
static void
end ()
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending tests.\n");
if (end_badly_task != NULL)
{
GNUNET_SCHEDULER_cancel (end_badly_task);
end_badly_task = NULL;
}
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS,
&end_normally, NULL);
}
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 if (NULL != tmit->mem_tmit)
GNUNET_MULTICAST_member_to_origin_resume (tmit->mem_tmit);
}
static int
tmit_notify (void *cls, size_t *data_size, void *data)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Test #%u: origin_tmit_notify()\n", test);
struct TransmitClosure *tmit = cls;
if (0 == tmit->data_count)
{
*data_size = 0;
return GNUNET_YES;
}
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",
(unsigned int) *data_size,
tmit->n + 1,
tmit->data_count,
size);
if (*data_size < size)
{
*data_size = 0;
GNUNET_assert (0);
return GNUNET_SYSERR;
}
if (GNUNET_YES != tmit->paused && 0 < tmit->data_delay[tmit->n])
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmission paused.\n");
tmit->paused = GNUNET_YES;
GNUNET_SCHEDULER_add_delayed (
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
tmit->data_delay[tmit->n]),
tmit_resume, tmit);
*data_size = 0;
return GNUNET_NO;
}
tmit->paused = GNUNET_NO;
*data_size = size;
GNUNET_memcpy (data, tmit->data[tmit->n], size);
return ++tmit->n < tmit->data_count ? GNUNET_NO : GNUNET_YES;
}
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)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: member_recv_join_request()\n", test);
}
static void
origin_stopped (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: origin_stopped()\n", test);
end ();
}
static void
schedule_origin_stop (void *cls)
{
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_parted (void *cls)
{
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
schedule_member_part (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: schedule_member_part()\n", test);
GNUNET_MULTICAST_member_part (member, member_parted, NULL);
}
static void
member_part ()
{
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_replay_ok ()
{
// 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
member_replay_error ()
{
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
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)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: origin_recv_replay_msg()\n", test);
GNUNET_assert (0);
}
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)
{
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_REPLAY_ERROR:
// Test 8 starts here
GNUNET_MULTICAST_replay_response (rh, NULL, GNUNET_SYSERR);
member_replay_ok ();
break;
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 origin_recv_replay_frag()\n", test);
GNUNET_assert (0);
}
}
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)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: member_recv_replay_frag()\n", test);
GNUNET_assert (0);
}
static void
origin_recv_request (void *cls,
const struct GNUNET_MULTICAST_RequestHeader *req)
{
struct OriginClosure *ocls = cls;
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_pub_key,
&member_pub_key, sizeof (member_pub_key)));
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));
// Test 7 starts here
member_replay_error ();
}
static void
member_to_origin ()
{
test = TEST_MEMBER_TO_ORIGIN;
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] = 2;
tmit->data[2] = "pqr stuw xyz";
tmit->data_count = 3;
origin_cls.n = 0;
origin_cls.msgs_expected = 1;
tmit->mem_tmit = GNUNET_MULTICAST_member_to_origin (member, 1,
tmit_notify, tmit);
}
static void
member_recv_message (void *cls,
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,
(unsigned int) (mcls->n + 1),
mcls->msgs_expected);
if (++mcls->n != mcls->msgs_expected)
return;
// FIXME: check message content
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);
GNUNET_assert (0);
}
}
static void
origin_recv_message (void *cls,
const struct GNUNET_MULTICAST_MessageHeader *msg)
{
struct OriginClosure *ocls = cls;
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)
return;
// FIXME: check message content
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);
GNUNET_assert (0);
}
}
static void
origin_to_all ()
{
test = TEST_ORIGIN_TO_ALL;
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] = 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 = tmit->data_count;
tmit->orig_tmit = GNUNET_MULTICAST_origin_to_all (origin, 1, 1,
tmit_notify, tmit);
}
static void
member_recv_join_decision (void *cls,
int is_admitted,
const struct GNUNET_PeerIdentity *peer,
uint16_t relay_count,
const struct GNUNET_PeerIdentity *relays,
const struct GNUNET_MessageHeader *join_msg)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: member_recv_join_decision() - is_admitted: %d\n",
test, is_admitted);
GNUNET_assert (join_msg->size == join_resp->size);
GNUNET_assert (join_msg->type == join_resp->type);
GNUNET_assert (0 == memcmp (join_msg, join_resp, ntohs (join_resp->size)));
switch (test)
{
case TEST_MEMBER_JOIN_REFUSE:
GNUNET_assert (0 == relay_count);
// 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;
default:
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid test #%d in member_recv_join_decision()\n", test);
GNUNET_assert (0);
}
}
/**
* 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_INFO,
"Test #%u: origin_recv_join_request()\n", test);
GNUNET_assert (0 == memcmp (mem_key, &member_pub_key, sizeof (member_pub_key)));
GNUNET_assert (join_msg->size == join_req->size);
GNUNET_assert (join_msg->type == join_req->type);
GNUNET_assert (0 == memcmp (join_msg, join_req, ntohs (join_req->size)));
char data[] = "here's the decision";
uint8_t data_size = strlen (data) + 1;
join_resp = GNUNET_malloc (sizeof (join_resp) + data_size);
join_resp->size = htons (sizeof (join_resp) + data_size);
join_resp->type = htons (456);
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;
default:
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid test #%d in origin_recv_join_request()\n", test);
GNUNET_assert (0);
break;
}
}
/**
* Test: member joins multicast group
*/
static void
member_join (int t)
{
test = t;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: member_join()\n", test);
member_key = GNUNET_CRYPTO_ecdsa_key_create ();
GNUNET_CRYPTO_ecdsa_key_get_public (member_key, &member_pub_key);
if (NULL != join_req)
GNUNET_free (join_req);
char data[] = "let me in!";
uint8_t data_size = strlen (data) + 1;
join_req = GNUNET_malloc (sizeof (join_req) + data_size);
join_req->size = htons (sizeof (join_req) + data_size);
join_req->type = htons (123);
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_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_INFO,
"Test #%u: origin_start()\n", test);
group_key = GNUNET_CRYPTO_eddsa_key_create ();
GNUNET_CRYPTO_eddsa_key_get_public (group_key, &group_pub_key);
origin = GNUNET_MULTICAST_origin_start (cfg, group_key, 0,
origin_recv_join_request,
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);
}
/**
* Main function of the test, run from scheduler.
*
* @param cls NULL
* @param cfg configuration we use (also to connect to Multicast service)
* @param peer handle to access more of the peer (not used)
*/
static void
#if DEBUG_TEST_MULTICAST
run (void *cls,
char *const *args,
const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *c)
#else
run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *c,
struct GNUNET_TESTING_Peer *peer)
#endif
{
cfg = c;
end_badly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
&end_badly, NULL);
GNUNET_CRYPTO_get_peer_identity (cfg, &this_peer);
// Test 1 starts here
origin_start ();
}
int
main (int argc, char *argv[])
{
res = 1;
#if DEBUG_TEST_MULTICAST
const struct GNUNET_GETOPT_CommandLineOption opts[] = {
GNUNET_GETOPT_OPTION_END
};
if (GNUNET_OK != GNUNET_PROGRAM_run (argc, argv, "test-multicast",
"test-multicast [options]",
opts, &run, NULL))
return 1;
#else
if (0 != GNUNET_TESTING_peer_run ("test-multicast", "test_multicast.conf", &run, NULL))
return 1;
#endif
return res;
}
/* end of test_multicast.c */
|