diff options
Diffstat (limited to 'src/mesh/gnunet-mesh-profiler.c')
-rw-r--r-- | src/mesh/gnunet-mesh-profiler.c | 172 |
1 files changed, 86 insertions, 86 deletions
diff --git a/src/mesh/gnunet-mesh-profiler.c b/src/mesh/gnunet-mesh-profiler.c index a1f1107bc..c944caa75 100644 --- a/src/mesh/gnunet-mesh-profiler.c +++ b/src/mesh/gnunet-mesh-profiler.c | |||
@@ -18,14 +18,14 @@ | |||
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @file mesh/gnunet-mesh-profiler.c | 21 | * @file cadet/gnunet-cadet-profiler.c |
22 | * | 22 | * |
23 | * @brief Profiler for mesh experiments. | 23 | * @brief Profiler for cadet experiments. |
24 | */ | 24 | */ |
25 | #include <stdio.h> | 25 | #include <stdio.h> |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "mesh_test_lib.h" | 27 | #include "cadet_test_lib.h" |
28 | #include "gnunet_mesh_service.h" | 28 | #include "gnunet_cadet_service.h" |
29 | #include "gnunet_statistics_service.h" | 29 | #include "gnunet_statistics_service.h" |
30 | 30 | ||
31 | 31 | ||
@@ -61,7 +61,7 @@ static float rounds[] = {0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.0}; | |||
61 | /** | 61 | /** |
62 | * Message type for pings. | 62 | * Message type for pings. |
63 | */ | 63 | */ |
64 | struct MeshPingMessage | 64 | struct CadetPingMessage |
65 | { | 65 | { |
66 | /** | 66 | /** |
67 | * Header. Type PING/PONG. | 67 | * Header. Type PING/PONG. |
@@ -87,7 +87,7 @@ struct MeshPingMessage | |||
87 | /** | 87 | /** |
88 | * Peer description. | 88 | * Peer description. |
89 | */ | 89 | */ |
90 | struct MeshPeer | 90 | struct CadetPeer |
91 | { | 91 | { |
92 | /** | 92 | /** |
93 | * Testbed Operation (to get peer id, etc). | 93 | * Testbed Operation (to get peer id, etc). |
@@ -100,24 +100,24 @@ struct MeshPeer | |||
100 | struct GNUNET_PeerIdentity id; | 100 | struct GNUNET_PeerIdentity id; |
101 | 101 | ||
102 | /** | 102 | /** |
103 | * Mesh handle for the root peer | 103 | * Cadet handle for the root peer |
104 | */ | 104 | */ |
105 | struct GNUNET_MESH_Handle *mesh; | 105 | struct GNUNET_CADET_Handle *cadet; |
106 | 106 | ||
107 | /** | 107 | /** |
108 | * Channel handle for the root peer | 108 | * Channel handle for the root peer |
109 | */ | 109 | */ |
110 | struct GNUNET_MESH_Channel *ch; | 110 | struct GNUNET_CADET_Channel *ch; |
111 | 111 | ||
112 | /** | 112 | /** |
113 | * Channel handle for the dest peer | 113 | * Channel handle for the dest peer |
114 | */ | 114 | */ |
115 | struct GNUNET_MESH_Channel *incoming_ch; | 115 | struct GNUNET_CADET_Channel *incoming_ch; |
116 | 116 | ||
117 | /** | 117 | /** |
118 | * Channel handle for a warmup channel. | 118 | * Channel handle for a warmup channel. |
119 | */ | 119 | */ |
120 | struct GNUNET_MESH_Channel *warmup_ch; | 120 | struct GNUNET_CADET_Channel *warmup_ch; |
121 | 121 | ||
122 | /** | 122 | /** |
123 | * Number of payload packes sent | 123 | * Number of payload packes sent |
@@ -137,12 +137,12 @@ struct MeshPeer | |||
137 | /** | 137 | /** |
138 | * Destinaton to ping. | 138 | * Destinaton to ping. |
139 | */ | 139 | */ |
140 | struct MeshPeer *dest; | 140 | struct CadetPeer *dest; |
141 | 141 | ||
142 | /** | 142 | /** |
143 | * Incoming channel for pings. | 143 | * Incoming channel for pings. |
144 | */ | 144 | */ |
145 | struct MeshPeer *incoming; | 145 | struct CadetPeer *incoming; |
146 | 146 | ||
147 | /** | 147 | /** |
148 | * Task to do the next ping. | 148 | * Task to do the next ping. |
@@ -162,7 +162,7 @@ struct MeshPeer | |||
162 | static struct GNUNET_TIME_Relative round_time; | 162 | static struct GNUNET_TIME_Relative round_time; |
163 | 163 | ||
164 | /** | 164 | /** |
165 | * GNUNET_PeerIdentity -> MeshPeer | 165 | * GNUNET_PeerIdentity -> CadetPeer |
166 | */ | 166 | */ |
167 | static struct GNUNET_CONTAINER_MultiPeerMap *ids; | 167 | static struct GNUNET_CONTAINER_MultiPeerMap *ids; |
168 | 168 | ||
@@ -179,7 +179,7 @@ static struct GNUNET_TESTBED_Operation *stats_op; | |||
179 | /** | 179 | /** |
180 | * Operation to get peer ids. | 180 | * Operation to get peer ids. |
181 | */ | 181 | */ |
182 | struct MeshPeer *peers; | 182 | struct CadetPeer *peers; |
183 | 183 | ||
184 | /** | 184 | /** |
185 | * Peer ids counter. | 185 | * Peer ids counter. |
@@ -204,7 +204,7 @@ static unsigned long long peers_pinging; | |||
204 | /** | 204 | /** |
205 | * Test context (to shut down). | 205 | * Test context (to shut down). |
206 | */ | 206 | */ |
207 | static struct GNUNET_MESH_TEST_Context *test_ctx; | 207 | static struct GNUNET_CADET_TEST_Context *test_ctx; |
208 | 208 | ||
209 | /** | 209 | /** |
210 | * Task called to shutdown test. | 210 | * Task called to shutdown test. |
@@ -243,7 +243,7 @@ static int test_finished; | |||
243 | 243 | ||
244 | 244 | ||
245 | /** | 245 | /** |
246 | * START THE TEST ITSELF, AS WE ARE CONNECTED TO THE MESH SERVICES. | 246 | * START THE TEST ITSELF, AS WE ARE CONNECTED TO THE CADET SERVICES. |
247 | * | 247 | * |
248 | * Testcase continues when the root receives confirmation of connected peers, | 248 | * Testcase continues when the root receives confirmation of connected peers, |
249 | * on callback funtion ch. | 249 | * on callback funtion ch. |
@@ -280,7 +280,7 @@ delay_ms_rnd (unsigned int max) | |||
280 | * @return Index of peer in peers. | 280 | * @return Index of peer in peers. |
281 | */ | 281 | */ |
282 | static unsigned int | 282 | static unsigned int |
283 | get_index (struct MeshPeer *peer) | 283 | get_index (struct CadetPeer *peer) |
284 | { | 284 | { |
285 | return peer - peers; | 285 | return peer - peers; |
286 | } | 286 | } |
@@ -292,7 +292,7 @@ get_index (struct MeshPeer *peer) | |||
292 | static void | 292 | static void |
293 | show_end_data (void) | 293 | show_end_data (void) |
294 | { | 294 | { |
295 | struct MeshPeer *peer; | 295 | struct CadetPeer *peer; |
296 | unsigned int i; | 296 | unsigned int i; |
297 | unsigned int j; | 297 | unsigned int j; |
298 | 298 | ||
@@ -325,19 +325,19 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
325 | 325 | ||
326 | 326 | ||
327 | /** | 327 | /** |
328 | * Disconnect from mesh services af all peers, call shutdown. | 328 | * Disconnect from cadet services af all peers, call shutdown. |
329 | * | 329 | * |
330 | * @param cls Closure (unused). | 330 | * @param cls Closure (unused). |
331 | * @param tc Task Context. | 331 | * @param tc Task Context. |
332 | */ | 332 | */ |
333 | static void | 333 | static void |
334 | disconnect_mesh_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 334 | disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
335 | { | 335 | { |
336 | long line = (long) cls; | 336 | long line = (long) cls; |
337 | unsigned int i; | 337 | unsigned int i; |
338 | 338 | ||
339 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 339 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
340 | "disconnecting mesh service, called from line %ld\n", line); | 340 | "disconnecting cadet service, called from line %ld\n", line); |
341 | disconnect_task = GNUNET_SCHEDULER_NO_TASK; | 341 | disconnect_task = GNUNET_SCHEDULER_NO_TASK; |
342 | for (i = 0; i < peers_total; i++) | 342 | for (i = 0; i < peers_total; i++) |
343 | { | 343 | { |
@@ -350,22 +350,22 @@ disconnect_mesh_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
350 | if (NULL != peers[i].ch) | 350 | if (NULL != peers[i].ch) |
351 | { | 351 | { |
352 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u: channel %p\n", i, peers[i].ch); | 352 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u: channel %p\n", i, peers[i].ch); |
353 | GNUNET_MESH_channel_destroy (peers[i].ch); | 353 | GNUNET_CADET_channel_destroy (peers[i].ch); |
354 | } | 354 | } |
355 | if (NULL != peers[i].warmup_ch) | 355 | if (NULL != peers[i].warmup_ch) |
356 | { | 356 | { |
357 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u: warmup channel %p\n", | 357 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u: warmup channel %p\n", |
358 | i, peers[i].warmup_ch); | 358 | i, peers[i].warmup_ch); |
359 | GNUNET_MESH_channel_destroy (peers[i].warmup_ch); | 359 | GNUNET_CADET_channel_destroy (peers[i].warmup_ch); |
360 | } | 360 | } |
361 | if (NULL != peers[i].incoming_ch) | 361 | if (NULL != peers[i].incoming_ch) |
362 | { | 362 | { |
363 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u: incoming channel %p\n", | 363 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u: incoming channel %p\n", |
364 | i, peers[i].incoming_ch); | 364 | i, peers[i].incoming_ch); |
365 | GNUNET_MESH_channel_destroy (peers[i].incoming_ch); | 365 | GNUNET_CADET_channel_destroy (peers[i].incoming_ch); |
366 | } | 366 | } |
367 | } | 367 | } |
368 | GNUNET_MESH_TEST_cleanup (test_ctx); | 368 | GNUNET_CADET_TEST_cleanup (test_ctx); |
369 | if (GNUNET_SCHEDULER_NO_TASK != shutdown_handle) | 369 | if (GNUNET_SCHEDULER_NO_TASK != shutdown_handle) |
370 | { | 370 | { |
371 | GNUNET_SCHEDULER_cancel (shutdown_handle); | 371 | GNUNET_SCHEDULER_cancel (shutdown_handle); |
@@ -385,7 +385,7 @@ abort_test (long line) | |||
385 | if (disconnect_task != GNUNET_SCHEDULER_NO_TASK) | 385 | if (disconnect_task != GNUNET_SCHEDULER_NO_TASK) |
386 | { | 386 | { |
387 | GNUNET_SCHEDULER_cancel (disconnect_task); | 387 | GNUNET_SCHEDULER_cancel (disconnect_task); |
388 | disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_mesh_peers, | 388 | disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers, |
389 | (void *) line); | 389 | (void *) line); |
390 | } | 390 | } |
391 | } | 391 | } |
@@ -407,7 +407,7 @@ stats_cont (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg) | |||
407 | 407 | ||
408 | if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) | 408 | if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) |
409 | GNUNET_SCHEDULER_cancel (disconnect_task); | 409 | GNUNET_SCHEDULER_cancel (disconnect_task); |
410 | disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_mesh_peers, | 410 | disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers, |
411 | (void *) __LINE__); | 411 | (void *) __LINE__); |
412 | 412 | ||
413 | } | 413 | } |
@@ -520,17 +520,17 @@ adjust_running_peers (unsigned int target) | |||
520 | peers[r].up = run; | 520 | peers[r].up = run; |
521 | 521 | ||
522 | if (NULL != peers[r].ch) | 522 | if (NULL != peers[r].ch) |
523 | GNUNET_MESH_channel_destroy (peers[r].ch); | 523 | GNUNET_CADET_channel_destroy (peers[r].ch); |
524 | peers[r].ch = NULL; | 524 | peers[r].ch = NULL; |
525 | if (NULL != peers[r].dest) | 525 | if (NULL != peers[r].dest) |
526 | { | 526 | { |
527 | if (NULL != peers[r].dest->incoming_ch) | 527 | if (NULL != peers[r].dest->incoming_ch) |
528 | GNUNET_MESH_channel_destroy (peers[r].dest->incoming_ch); | 528 | GNUNET_CADET_channel_destroy (peers[r].dest->incoming_ch); |
529 | peers[r].dest->incoming_ch = NULL; | 529 | peers[r].dest->incoming_ch = NULL; |
530 | } | 530 | } |
531 | 531 | ||
532 | op = GNUNET_TESTBED_peer_manage_service (&peers[r], testbed_handles[r], | 532 | op = GNUNET_TESTBED_peer_manage_service (&peers[r], testbed_handles[r], |
533 | "mesh", NULL, NULL, run); | 533 | "cadet", NULL, NULL, run); |
534 | GNUNET_break (NULL != op); | 534 | GNUNET_break (NULL != op); |
535 | peers_running += run ? 1 : -1; | 535 | peers_running += run ? 1 : -1; |
536 | GNUNET_assert (peers_running > 0); | 536 | GNUNET_assert (peers_running > 0); |
@@ -587,15 +587,15 @@ tmt_rdy_ping (void *cls, size_t size, void *buf); | |||
587 | static size_t | 587 | static size_t |
588 | tmt_rdy_pong (void *cls, size_t size, void *buf) | 588 | tmt_rdy_pong (void *cls, size_t size, void *buf) |
589 | { | 589 | { |
590 | struct MeshPingMessage *ping = cls; | 590 | struct CadetPingMessage *ping = cls; |
591 | struct MeshPingMessage *pong; | 591 | struct CadetPingMessage *pong; |
592 | 592 | ||
593 | if (0 == size || NULL == buf) | 593 | if (0 == size || NULL == buf) |
594 | { | 594 | { |
595 | GNUNET_free (ping); | 595 | GNUNET_free (ping); |
596 | return 0; | 596 | return 0; |
597 | } | 597 | } |
598 | pong = (struct MeshPingMessage *) buf; | 598 | pong = (struct CadetPingMessage *) buf; |
599 | memcpy (pong, ping, sizeof (*ping)); | 599 | memcpy (pong, ping, sizeof (*ping)); |
600 | pong->header.type = htons (PONG); | 600 | pong->header.type = htons (PONG); |
601 | 601 | ||
@@ -613,7 +613,7 @@ tmt_rdy_pong (void *cls, size_t size, void *buf) | |||
613 | static void | 613 | static void |
614 | ping (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 614 | ping (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
615 | { | 615 | { |
616 | struct MeshPeer *peer = (struct MeshPeer *) cls; | 616 | struct CadetPeer *peer = (struct CadetPeer *) cls; |
617 | 617 | ||
618 | peer->ping_task = GNUNET_SCHEDULER_NO_TASK; | 618 | peer->ping_task = GNUNET_SCHEDULER_NO_TASK; |
619 | 619 | ||
@@ -624,9 +624,9 @@ ping (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
624 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u -> %u (%u)\n", | 624 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u -> %u (%u)\n", |
625 | get_index (peer), get_index (peer->dest), peer->data_sent); | 625 | get_index (peer), get_index (peer->dest), peer->data_sent); |
626 | 626 | ||
627 | GNUNET_MESH_notify_transmit_ready (peer->ch, GNUNET_NO, | 627 | GNUNET_CADET_notify_transmit_ready (peer->ch, GNUNET_NO, |
628 | GNUNET_TIME_UNIT_FOREVER_REL, | 628 | GNUNET_TIME_UNIT_FOREVER_REL, |
629 | sizeof (struct MeshPingMessage), | 629 | sizeof (struct CadetPingMessage), |
630 | &tmt_rdy_ping, peer); | 630 | &tmt_rdy_ping, peer); |
631 | } | 631 | } |
632 | 632 | ||
@@ -637,15 +637,15 @@ ping (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
637 | * @param tc Task context. | 637 | * @param tc Task context. |
638 | */ | 638 | */ |
639 | static void | 639 | static void |
640 | pong (struct GNUNET_MESH_Channel *channel, const struct MeshPingMessage *ping) | 640 | pong (struct GNUNET_CADET_Channel *channel, const struct CadetPingMessage *ping) |
641 | { | 641 | { |
642 | struct MeshPingMessage *copy; | 642 | struct CadetPingMessage *copy; |
643 | 643 | ||
644 | copy = GNUNET_new (struct MeshPingMessage); | 644 | copy = GNUNET_new (struct CadetPingMessage); |
645 | memcpy (copy, ping, sizeof (*ping)); | 645 | memcpy (copy, ping, sizeof (*ping)); |
646 | GNUNET_MESH_notify_transmit_ready (channel, GNUNET_NO, | 646 | GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO, |
647 | GNUNET_TIME_UNIT_FOREVER_REL, | 647 | GNUNET_TIME_UNIT_FOREVER_REL, |
648 | sizeof (struct MeshPingMessage), | 648 | sizeof (struct CadetPingMessage), |
649 | &tmt_rdy_pong, copy); | 649 | &tmt_rdy_pong, copy); |
650 | } | 650 | } |
651 | 651 | ||
@@ -660,11 +660,11 @@ pong (struct GNUNET_MESH_Channel *channel, const struct MeshPingMessage *ping) | |||
660 | static size_t | 660 | static size_t |
661 | tmt_rdy_ping (void *cls, size_t size, void *buf) | 661 | tmt_rdy_ping (void *cls, size_t size, void *buf) |
662 | { | 662 | { |
663 | struct MeshPeer *peer = (struct MeshPeer *) cls; | 663 | struct CadetPeer *peer = (struct CadetPeer *) cls; |
664 | struct MeshPingMessage *msg = buf; | 664 | struct CadetPingMessage *msg = buf; |
665 | 665 | ||
666 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tmt_rdy called, filling buffer\n"); | 666 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tmt_rdy called, filling buffer\n"); |
667 | if (size < sizeof (struct MeshPingMessage) || NULL == buf) | 667 | if (size < sizeof (struct CadetPingMessage) || NULL == buf) |
668 | { | 668 | { |
669 | GNUNET_break (GNUNET_YES == test_finished); | 669 | GNUNET_break (GNUNET_YES == test_finished); |
670 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 670 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -683,14 +683,14 @@ tmt_rdy_ping (void *cls, size_t size, void *buf) | |||
683 | peer->ping_task = GNUNET_SCHEDULER_add_delayed (delay_ms_rnd (PING_PERIOD), | 683 | peer->ping_task = GNUNET_SCHEDULER_add_delayed (delay_ms_rnd (PING_PERIOD), |
684 | &ping, peer); | 684 | &ping, peer); |
685 | 685 | ||
686 | return sizeof (struct MeshPingMessage); | 686 | return sizeof (struct CadetPingMessage); |
687 | } | 687 | } |
688 | 688 | ||
689 | 689 | ||
690 | /** | 690 | /** |
691 | * Function is called whenever a PING message is received. | 691 | * Function is called whenever a PING message is received. |
692 | * | 692 | * |
693 | * @param cls closure (peer #, set from GNUNET_MESH_connect) | 693 | * @param cls closure (peer #, set from GNUNET_CADET_connect) |
694 | * @param channel connection to the other end | 694 | * @param channel connection to the other end |
695 | * @param channel_ctx place to store local state associated with the channel | 695 | * @param channel_ctx place to store local state associated with the channel |
696 | * @param message the actual message | 696 | * @param message the actual message |
@@ -698,16 +698,16 @@ tmt_rdy_ping (void *cls, size_t size, void *buf) | |||
698 | * GNUNET_SYSERR to close it (signal serious error) | 698 | * GNUNET_SYSERR to close it (signal serious error) |
699 | */ | 699 | */ |
700 | int | 700 | int |
701 | ping_handler (void *cls, struct GNUNET_MESH_Channel *channel, | 701 | ping_handler (void *cls, struct GNUNET_CADET_Channel *channel, |
702 | void **channel_ctx, | 702 | void **channel_ctx, |
703 | const struct GNUNET_MessageHeader *message) | 703 | const struct GNUNET_MessageHeader *message) |
704 | { | 704 | { |
705 | long n = (long) cls; | 705 | long n = (long) cls; |
706 | 706 | ||
707 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%u got PING\n", n); | 707 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%u got PING\n", n); |
708 | GNUNET_MESH_receive_done (channel); | 708 | GNUNET_CADET_receive_done (channel); |
709 | if (GNUNET_NO == test_finished) | 709 | if (GNUNET_NO == test_finished) |
710 | pong (channel, (struct MeshPingMessage *) message); | 710 | pong (channel, (struct CadetPingMessage *) message); |
711 | 711 | ||
712 | return GNUNET_OK; | 712 | return GNUNET_OK; |
713 | } | 713 | } |
@@ -716,7 +716,7 @@ ping_handler (void *cls, struct GNUNET_MESH_Channel *channel, | |||
716 | /** | 716 | /** |
717 | * Function is called whenever a PONG message is received. | 717 | * Function is called whenever a PONG message is received. |
718 | * | 718 | * |
719 | * @param cls closure (peer #, set from GNUNET_MESH_connect) | 719 | * @param cls closure (peer #, set from GNUNET_CADET_connect) |
720 | * @param channel connection to the other end | 720 | * @param channel connection to the other end |
721 | * @param channel_ctx place to store local state associated with the channel | 721 | * @param channel_ctx place to store local state associated with the channel |
722 | * @param message the actual message | 722 | * @param message the actual message |
@@ -724,22 +724,22 @@ ping_handler (void *cls, struct GNUNET_MESH_Channel *channel, | |||
724 | * GNUNET_SYSERR to close it (signal serious error) | 724 | * GNUNET_SYSERR to close it (signal serious error) |
725 | */ | 725 | */ |
726 | int | 726 | int |
727 | pong_handler (void *cls, struct GNUNET_MESH_Channel *channel, | 727 | pong_handler (void *cls, struct GNUNET_CADET_Channel *channel, |
728 | void **channel_ctx, | 728 | void **channel_ctx, |
729 | const struct GNUNET_MessageHeader *message) | 729 | const struct GNUNET_MessageHeader *message) |
730 | { | 730 | { |
731 | long n = (long) cls; | 731 | long n = (long) cls; |
732 | struct MeshPeer *peer; | 732 | struct CadetPeer *peer; |
733 | struct MeshPingMessage *msg; | 733 | struct CadetPingMessage *msg; |
734 | struct GNUNET_TIME_Absolute send_time; | 734 | struct GNUNET_TIME_Absolute send_time; |
735 | struct GNUNET_TIME_Relative latency; | 735 | struct GNUNET_TIME_Relative latency; |
736 | unsigned int r /* Ping round */; | 736 | unsigned int r /* Ping round */; |
737 | float delta; | 737 | float delta; |
738 | 738 | ||
739 | GNUNET_MESH_receive_done (channel); | 739 | GNUNET_CADET_receive_done (channel); |
740 | peer = &peers[n]; | 740 | peer = &peers[n]; |
741 | 741 | ||
742 | msg = (struct MeshPingMessage *) message; | 742 | msg = (struct CadetPingMessage *) message; |
743 | 743 | ||
744 | send_time = GNUNET_TIME_absolute_ntoh (msg->timestamp); | 744 | send_time = GNUNET_TIME_absolute_ntoh (msg->timestamp); |
745 | latency = GNUNET_TIME_absolute_get_duration (send_time); | 745 | latency = GNUNET_TIME_absolute_get_duration (send_time); |
@@ -761,9 +761,9 @@ pong_handler (void *cls, struct GNUNET_MESH_Channel *channel, | |||
761 | /** | 761 | /** |
762 | * Handlers, for diverse services | 762 | * Handlers, for diverse services |
763 | */ | 763 | */ |
764 | static struct GNUNET_MESH_MessageHandler handlers[] = { | 764 | static struct GNUNET_CADET_MessageHandler handlers[] = { |
765 | {&ping_handler, PING, sizeof (struct MeshPingMessage)}, | 765 | {&ping_handler, PING, sizeof (struct CadetPingMessage)}, |
766 | {&pong_handler, PONG, sizeof (struct MeshPingMessage)}, | 766 | {&pong_handler, PONG, sizeof (struct CadetPingMessage)}, |
767 | {NULL, 0, 0} | 767 | {NULL, 0, 0} |
768 | }; | 768 | }; |
769 | 769 | ||
@@ -781,12 +781,12 @@ static struct GNUNET_MESH_MessageHandler handlers[] = { | |||
781 | * (can be NULL -- that's not an error). | 781 | * (can be NULL -- that's not an error). |
782 | */ | 782 | */ |
783 | static void * | 783 | static void * |
784 | incoming_channel (void *cls, struct GNUNET_MESH_Channel *channel, | 784 | incoming_channel (void *cls, struct GNUNET_CADET_Channel *channel, |
785 | const struct GNUNET_PeerIdentity *initiator, | 785 | const struct GNUNET_PeerIdentity *initiator, |
786 | uint32_t port, enum GNUNET_MESH_ChannelOption options) | 786 | uint32_t port, enum GNUNET_CADET_ChannelOption options) |
787 | { | 787 | { |
788 | long n = (long) cls; | 788 | long n = (long) cls; |
789 | struct MeshPeer *peer; | 789 | struct CadetPeer *peer; |
790 | 790 | ||
791 | peer = GNUNET_CONTAINER_multipeermap_get (ids, initiator); | 791 | peer = GNUNET_CONTAINER_multipeermap_get (ids, initiator); |
792 | GNUNET_assert (NULL != peer); | 792 | GNUNET_assert (NULL != peer); |
@@ -818,17 +818,17 @@ incoming_channel (void *cls, struct GNUNET_MESH_Channel *channel, | |||
818 | * Function called whenever an inbound channel is destroyed. Should clean up | 818 | * Function called whenever an inbound channel is destroyed. Should clean up |
819 | * any associated state. | 819 | * any associated state. |
820 | * | 820 | * |
821 | * @param cls closure (set from GNUNET_MESH_connect) | 821 | * @param cls closure (set from GNUNET_CADET_connect) |
822 | * @param channel connection to the other end (henceforth invalid) | 822 | * @param channel connection to the other end (henceforth invalid) |
823 | * @param channel_ctx place where local state associated | 823 | * @param channel_ctx place where local state associated |
824 | * with the channel is stored | 824 | * with the channel is stored |
825 | */ | 825 | */ |
826 | static void | 826 | static void |
827 | channel_cleaner (void *cls, const struct GNUNET_MESH_Channel *channel, | 827 | channel_cleaner (void *cls, const struct GNUNET_CADET_Channel *channel, |
828 | void *channel_ctx) | 828 | void *channel_ctx) |
829 | { | 829 | { |
830 | long n = (long) cls; | 830 | long n = (long) cls; |
831 | struct MeshPeer *peer = &peers[n]; | 831 | struct CadetPeer *peer = &peers[n]; |
832 | 832 | ||
833 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 833 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
834 | "Channel %p disconnected at peer %ld\n", channel, n); | 834 | "Channel %p disconnected at peer %ld\n", channel, n); |
@@ -844,8 +844,8 @@ channel_cleaner (void *cls, const struct GNUNET_MESH_Channel *channel, | |||
844 | * | 844 | * |
845 | * @return Random peer not yet connected to. | 845 | * @return Random peer not yet connected to. |
846 | */ | 846 | */ |
847 | static struct MeshPeer * | 847 | static struct CadetPeer * |
848 | select_random_peer (struct MeshPeer *peer) | 848 | select_random_peer (struct CadetPeer *peer) |
849 | { | 849 | { |
850 | unsigned int r; | 850 | unsigned int r; |
851 | 851 | ||
@@ -859,7 +859,7 @@ select_random_peer (struct MeshPeer *peer) | |||
859 | } | 859 | } |
860 | 860 | ||
861 | /** | 861 | /** |
862 | * START THE TEST ITSELF, AS WE ARE CONNECTED TO THE MESH SERVICES. | 862 | * START THE TEST ITSELF, AS WE ARE CONNECTED TO THE CADET SERVICES. |
863 | * | 863 | * |
864 | * Testcase continues when the root receives confirmation of connected peers, | 864 | * Testcase continues when the root receives confirmation of connected peers, |
865 | * on callback funtion ch. | 865 | * on callback funtion ch. |
@@ -870,7 +870,7 @@ select_random_peer (struct MeshPeer *peer) | |||
870 | static void | 870 | static void |
871 | start_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 871 | start_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
872 | { | 872 | { |
873 | enum GNUNET_MESH_ChannelOption flags; | 873 | enum GNUNET_CADET_ChannelOption flags; |
874 | unsigned long i; | 874 | unsigned long i; |
875 | 875 | ||
876 | test_task = GNUNET_SCHEDULER_NO_TASK; | 876 | test_task = GNUNET_SCHEDULER_NO_TASK; |
@@ -879,17 +879,17 @@ start_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
879 | 879 | ||
880 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Start profiler\n"); | 880 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Start profiler\n"); |
881 | 881 | ||
882 | flags = GNUNET_MESH_OPTION_DEFAULT; | 882 | flags = GNUNET_CADET_OPTION_DEFAULT; |
883 | for (i = 0; i < peers_pinging; i++) | 883 | for (i = 0; i < peers_pinging; i++) |
884 | { | 884 | { |
885 | peers[i].dest = select_random_peer (&peers[i]); | 885 | peers[i].dest = select_random_peer (&peers[i]); |
886 | peers[i].ch = GNUNET_MESH_channel_create (peers[i].mesh, NULL, | 886 | peers[i].ch = GNUNET_CADET_channel_create (peers[i].cadet, NULL, |
887 | &peers[i].dest->id, | 887 | &peers[i].dest->id, |
888 | 1, flags); | 888 | 1, flags); |
889 | if (NULL == peers[i].ch) | 889 | if (NULL == peers[i].ch) |
890 | { | 890 | { |
891 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Channel %lu failed\n", i); | 891 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Channel %lu failed\n", i); |
892 | GNUNET_MESH_TEST_cleanup (test_ctx); | 892 | GNUNET_CADET_TEST_cleanup (test_ctx); |
893 | return; | 893 | return; |
894 | } | 894 | } |
895 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u => %u %p\n", | 895 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u => %u %p\n", |
@@ -903,7 +903,7 @@ start_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
903 | disconnect_task = | 903 | disconnect_task = |
904 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(round_time, | 904 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(round_time, |
905 | number_rounds + 1), | 905 | number_rounds + 1), |
906 | &disconnect_mesh_peers, | 906 | &disconnect_cadet_peers, |
907 | (void *) __LINE__); | 907 | (void *) __LINE__); |
908 | GNUNET_SCHEDULER_add_delayed (round_time, &next_rnd, NULL); | 908 | GNUNET_SCHEDULER_add_delayed (round_time, &next_rnd, NULL); |
909 | } | 909 | } |
@@ -915,7 +915,7 @@ start_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
915 | static void | 915 | static void |
916 | warmup (void) | 916 | warmup (void) |
917 | { | 917 | { |
918 | struct MeshPeer *peer; | 918 | struct CadetPeer *peer; |
919 | unsigned int i; | 919 | unsigned int i; |
920 | 920 | ||
921 | for (i = 0; i < peers_total; i++) | 921 | for (i = 0; i < peers_total; i++) |
@@ -924,12 +924,12 @@ warmup (void) | |||
924 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "WARMUP %u => %u\n", | 924 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "WARMUP %u => %u\n", |
925 | i, get_index (peer)); | 925 | i, get_index (peer)); |
926 | peers[i].warmup_ch = | 926 | peers[i].warmup_ch = |
927 | GNUNET_MESH_channel_create (peers[i].mesh, NULL, &peer->id, | 927 | GNUNET_CADET_channel_create (peers[i].cadet, NULL, &peer->id, |
928 | 1, GNUNET_MESH_OPTION_DEFAULT); | 928 | 1, GNUNET_CADET_OPTION_DEFAULT); |
929 | if (NULL == peers[i].warmup_ch) | 929 | if (NULL == peers[i].warmup_ch) |
930 | { | 930 | { |
931 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Warmup %u failed\n", i); | 931 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Warmup %u failed\n", i); |
932 | GNUNET_MESH_TEST_cleanup (test_ctx); | 932 | GNUNET_CADET_TEST_cleanup (test_ctx); |
933 | return; | 933 | return; |
934 | } | 934 | } |
935 | } | 935 | } |
@@ -991,17 +991,17 @@ peer_id_cb (void *cls, | |||
991 | * test main: start test when all peers are connected | 991 | * test main: start test when all peers are connected |
992 | * | 992 | * |
993 | * @param cls Closure. | 993 | * @param cls Closure. |
994 | * @param ctx Argument to give to GNUNET_MESH_TEST_cleanup on test end. | 994 | * @param ctx Argument to give to GNUNET_CADET_TEST_cleanup on test end. |
995 | * @param num_peers Number of peers that are running. | 995 | * @param num_peers Number of peers that are running. |
996 | * @param testbed_peers Array of peers. | 996 | * @param testbed_peers Array of peers. |
997 | * @param meshes Handle to each of the MESHs of the peers. | 997 | * @param cadetes Handle to each of the CADETs of the peers. |
998 | */ | 998 | */ |
999 | static void | 999 | static void |
1000 | tmain (void *cls, | 1000 | tmain (void *cls, |
1001 | struct GNUNET_MESH_TEST_Context *ctx, | 1001 | struct GNUNET_CADET_TEST_Context *ctx, |
1002 | unsigned int num_peers, | 1002 | unsigned int num_peers, |
1003 | struct GNUNET_TESTBED_Peer **testbed_peers, | 1003 | struct GNUNET_TESTBED_Peer **testbed_peers, |
1004 | struct GNUNET_MESH_Handle **meshes) | 1004 | struct GNUNET_CADET_Handle **cadetes) |
1005 | { | 1005 | { |
1006 | unsigned long i; | 1006 | unsigned long i; |
1007 | 1007 | ||
@@ -1011,7 +1011,7 @@ tmain (void *cls, | |||
1011 | peers_running = num_peers; | 1011 | peers_running = num_peers; |
1012 | testbed_handles = testbed_peers; | 1012 | testbed_handles = testbed_peers; |
1013 | disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, | 1013 | disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, |
1014 | &disconnect_mesh_peers, | 1014 | &disconnect_cadet_peers, |
1015 | (void *) __LINE__); | 1015 | (void *) __LINE__); |
1016 | shutdown_handle = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 1016 | shutdown_handle = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
1017 | &shutdown_task, NULL); | 1017 | &shutdown_task, NULL); |
@@ -1019,7 +1019,7 @@ tmain (void *cls, | |||
1019 | { | 1019 | { |
1020 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "requesting id %ld\n", i); | 1020 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "requesting id %ld\n", i); |
1021 | peers[i].up = GNUNET_YES; | 1021 | peers[i].up = GNUNET_YES; |
1022 | peers[i].mesh = meshes[i]; | 1022 | peers[i].cadet = cadetes[i]; |
1023 | peers[i].op = | 1023 | peers[i].op = |
1024 | GNUNET_TESTBED_peer_get_information (testbed_handles[i], | 1024 | GNUNET_TESTBED_peer_get_information (testbed_handles[i], |
1025 | GNUNET_TESTBED_PIT_IDENTITY, | 1025 | GNUNET_TESTBED_PIT_IDENTITY, |
@@ -1060,7 +1060,7 @@ main (int argc, char *argv[]) | |||
1060 | fprintf (stderr, "%s peers is not valid (> 2)\n", argv[1]); | 1060 | fprintf (stderr, "%s peers is not valid (> 2)\n", argv[1]); |
1061 | return 1; | 1061 | return 1; |
1062 | } | 1062 | } |
1063 | peers = GNUNET_malloc (sizeof (struct MeshPeer) * peers_total); | 1063 | peers = GNUNET_malloc (sizeof (struct CadetPeer) * peers_total); |
1064 | 1064 | ||
1065 | peers_pinging = atoll (argv[3]); | 1065 | peers_pinging = atoll (argv[3]); |
1066 | 1066 | ||
@@ -1079,7 +1079,7 @@ main (int argc, char *argv[]) | |||
1079 | test_finished = GNUNET_NO; | 1079 | test_finished = GNUNET_NO; |
1080 | ports[0] = 1; | 1080 | ports[0] = 1; |
1081 | ports[1] = 0; | 1081 | ports[1] = 0; |
1082 | GNUNET_MESH_TEST_run ("mesh-profiler", config_file, peers_total, | 1082 | GNUNET_CADET_TEST_run ("cadet-profiler", config_file, peers_total, |
1083 | &tmain, NULL, /* tmain cls */ | 1083 | &tmain, NULL, /* tmain cls */ |
1084 | &incoming_channel, &channel_cleaner, | 1084 | &incoming_channel, &channel_cleaner, |
1085 | handlers, ports); | 1085 | handlers, ports); |
@@ -1088,5 +1088,5 @@ main (int argc, char *argv[]) | |||
1088 | return 0; | 1088 | return 0; |
1089 | } | 1089 | } |
1090 | 1090 | ||
1091 | /* end of gnunet-mesh-profiler.c */ | 1091 | /* end of gnunet-cadet-profiler.c */ |
1092 | 1092 | ||