aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-11-20 12:29:57 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-11-20 12:29:57 +0000
commitb0ca95f6c05e8486e252b4d8bdd6ae16b6d2560a (patch)
tree09352f2efafd76b317cb7ccd1a3a47f97d6cc798 /src
parent984eaa29119a4b1ae01490db9b16cf1020e01d55 (diff)
downloadgnunet-b0ca95f6c05e8486e252b4d8bdd6ae16b6d2560a.tar.gz
gnunet-b0ca95f6c05e8486e252b4d8bdd6ae16b6d2560a.zip
extended overlay configure topology to return max connections
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_testbed_service.h6
-rw-r--r--src/mesh/gnunet-regex-profiler.c1
-rw-r--r--src/testbed/gnunet-testbed-profiler.c4
-rw-r--r--src/testbed/test_testbed_api_topology.c2
-rw-r--r--src/testbed/test_testbed_api_topology_clique.c1
-rw-r--r--src/testbed/testbed_api_testbed.c34
-rw-r--r--src/testbed/testbed_api_topology.c11
7 files changed, 30 insertions, 29 deletions
diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h
index 12f699975..91fb424c4 100644
--- a/src/include/gnunet_testbed_service.h
+++ b/src/include/gnunet_testbed_service.h
@@ -1062,6 +1062,8 @@ GNUNET_TESTBED_overlay_connect (void *op_cls,
1062 * @param op_cls closure argument to give with the operation event 1062 * @param op_cls closure argument to give with the operation event
1063 * @param num_peers number of peers in 'peers' 1063 * @param num_peers number of peers in 'peers'
1064 * @param peers array of 'num_peers' with the peers to configure 1064 * @param peers array of 'num_peers' with the peers to configure
1065 * @param max_connections the maximums number of overlay connections that will
1066 * be made to achieve the given topology
1065 * @param topo desired underlay topology to use 1067 * @param topo desired underlay topology to use
1066 * @param va topology-specific options 1068 * @param va topology-specific options
1067 * @return handle to the operation, NULL if connecting these 1069 * @return handle to the operation, NULL if connecting these
@@ -1072,6 +1074,7 @@ struct GNUNET_TESTBED_Operation *
1072GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls, 1074GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
1073 unsigned int num_peers, 1075 unsigned int num_peers,
1074 struct GNUNET_TESTBED_Peer **peers, 1076 struct GNUNET_TESTBED_Peer **peers,
1077 unsigned int *max_connections,
1075 enum GNUNET_TESTBED_TopologyOption topo, 1078 enum GNUNET_TESTBED_TopologyOption topo,
1076 va_list va); 1079 va_list va);
1077 1080
@@ -1084,6 +1087,8 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
1084 * @param op_cls closure argument to give with the operation event 1087 * @param op_cls closure argument to give with the operation event
1085 * @param num_peers number of peers in 'peers' 1088 * @param num_peers number of peers in 'peers'
1086 * @param peers array of 'num_peers' with the peers to configure 1089 * @param peers array of 'num_peers' with the peers to configure
1090 * @param max_connections the maximums number of overlay connections that will
1091 * be made to achieve the given topology
1087 * @param topo desired underlay topology to use 1092 * @param topo desired underlay topology to use
1088 * @param ... topology-specific options 1093 * @param ... topology-specific options
1089 * @return handle to the operation, NULL if connecting these 1094 * @return handle to the operation, NULL if connecting these
@@ -1094,6 +1099,7 @@ struct GNUNET_TESTBED_Operation *
1094GNUNET_TESTBED_overlay_configure_topology (void *op_cls, 1099GNUNET_TESTBED_overlay_configure_topology (void *op_cls,
1095 unsigned int num_peers, 1100 unsigned int num_peers,
1096 struct GNUNET_TESTBED_Peer **peers, 1101 struct GNUNET_TESTBED_Peer **peers,
1102 unsigned int *max_connections,
1097 enum GNUNET_TESTBED_TopologyOption topo, 1103 enum GNUNET_TESTBED_TopologyOption topo,
1098 ...); 1104 ...);
1099 1105
diff --git a/src/mesh/gnunet-regex-profiler.c b/src/mesh/gnunet-regex-profiler.c
index 1e785b888..0733e267f 100644
--- a/src/mesh/gnunet-regex-profiler.c
+++ b/src/mesh/gnunet-regex-profiler.c
@@ -1109,6 +1109,7 @@ do_configure_topology (void *cls,
1109 prof_start_time = GNUNET_TIME_absolute_get (); 1109 prof_start_time = GNUNET_TIME_absolute_get ();
1110 topology_op = 1110 topology_op =
1111 GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peer_handles, 1111 GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peer_handles,
1112 NULL,
1112 GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, 1113 GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI,
1113 num_links, 1114 num_links,
1114 GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY, 1115 GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY,
diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c
index 9bfeaddd2..083926cbf 100644
--- a/src/testbed/gnunet-testbed-profiler.c
+++ b/src/testbed/gnunet-testbed-profiler.c
@@ -345,7 +345,7 @@ peer_churn_cb (void *cls, const char *emsg)
345 { 345 {
346 case GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI: 346 case GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI:
347 topology_op = 347 topology_op =
348 GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peers, 348 GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peers, NULL,
349 topology, 349 topology,
350 num_links, 350 num_links,
351 GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY, 351 GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY,
@@ -353,7 +353,7 @@ peer_churn_cb (void *cls, const char *emsg)
353 break; 353 break;
354 case GNUNET_TESTBED_TOPOLOGY_CLIQUE: 354 case GNUNET_TESTBED_TOPOLOGY_CLIQUE:
355 topology_op = 355 topology_op =
356 GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peers, 356 GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peers, NULL,
357 topology, 357 topology,
358 GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY, 358 GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY,
359 GNUNET_TESTBED_TOPOLOGY_OPTION_END); 359 GNUNET_TESTBED_TOPOLOGY_OPTION_END);
diff --git a/src/testbed/test_testbed_api_topology.c b/src/testbed/test_testbed_api_topology.c
index 7166bf266..5efaf8137 100644
--- a/src/testbed/test_testbed_api_topology.c
+++ b/src/testbed/test_testbed_api_topology.c
@@ -134,7 +134,7 @@ test_master (void *cls, unsigned int num_peers,
134 GNUNET_assert (NULL != peers_[peer]); 134 GNUNET_assert (NULL != peers_[peer]);
135 peers = peers_; 135 peers = peers_;
136 overlay_connects = 0; 136 overlay_connects = 0;
137 op = GNUNET_TESTBED_overlay_configure_topology (NULL, NUM_PEERS, peers, 137 op = GNUNET_TESTBED_overlay_configure_topology (NULL, NUM_PEERS, peers, NULL,
138 GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, 138 GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI,
139 NUM_PEERS, GNUNET_TESTBED_TOPOLOGY_OPTION_END); 139 NUM_PEERS, GNUNET_TESTBED_TOPOLOGY_OPTION_END);
140 GNUNET_assert (NULL != op); 140 GNUNET_assert (NULL != op);
diff --git a/src/testbed/test_testbed_api_topology_clique.c b/src/testbed/test_testbed_api_topology_clique.c
index 83687f337..2fbf48729 100644
--- a/src/testbed/test_testbed_api_topology_clique.c
+++ b/src/testbed/test_testbed_api_topology_clique.c
@@ -130,6 +130,7 @@ test_master (void *cls, unsigned int num_peers,
130 peers = peers_; 130 peers = peers_;
131 overlay_connects = 0; 131 overlay_connects = 0;
132 op = GNUNET_TESTBED_overlay_configure_topology (NULL, NUM_PEERS, peers, 132 op = GNUNET_TESTBED_overlay_configure_topology (NULL, NUM_PEERS, peers,
133 NULL,
133 GNUNET_TESTBED_TOPOLOGY_CLIQUE, 134 GNUNET_TESTBED_TOPOLOGY_CLIQUE,
134 /* GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, */ 135 /* GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, */
135 /* NUM_PEERS, */ 136 /* NUM_PEERS, */
diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c
index 20633378d..f195baa1c 100644
--- a/src/testbed/testbed_api_testbed.c
+++ b/src/testbed/testbed_api_testbed.c
@@ -217,6 +217,11 @@ struct RunContext
217 * Expected overlay connects. Should be zero if no topology is relavant 217 * Expected overlay connects. Should be zero if no topology is relavant
218 */ 218 */
219 unsigned int num_oc; 219 unsigned int num_oc;
220
221 /**
222 * Number of random links to established
223 */
224 unsigned int random_links;
220 225
221}; 226};
222 227
@@ -444,29 +449,13 @@ call_cc:
444 || (GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING == rc->topology) 449 || (GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING == rc->topology)
445 || (GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD == rc->topology)) 450 || (GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD == rc->topology))
446 { 451 {
447 unsigned int rand_links;
448
449 switch (rc->topology)
450 {
451 case GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI:
452 rand_links = rc->num_oc;
453 break;
454 case GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING:
455 rand_links = rc->num_oc - rc->num_peers;
456 break;
457 case GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD:
458 rand_links = GNUNET_TESTBED_2dtorus_calc_links (rc->num_peers, NULL, NULL);
459 break;
460 default:
461 GNUNET_break (0);
462 rand_links = 0;
463 }
464 rc->topology_operation = 452 rc->topology_operation =
465 GNUNET_TESTBED_overlay_configure_topology (NULL, 453 GNUNET_TESTBED_overlay_configure_topology (NULL,
466 rc->num_peers, 454 rc->num_peers,
467 rc->peers, 455 rc->peers,
456 &rc->num_oc,
468 rc->topology, 457 rc->topology,
469 rand_links, 458 rc->random_links,
470 GNUNET_TESTBED_TOPOLOGY_OPTION_END); 459 GNUNET_TESTBED_TOPOLOGY_OPTION_END);
471 } 460 }
472 else 461 else
@@ -474,6 +463,7 @@ call_cc:
474 GNUNET_TESTBED_overlay_configure_topology (NULL, 463 GNUNET_TESTBED_overlay_configure_topology (NULL,
475 rc->num_peers, 464 rc->num_peers,
476 rc->peers, 465 rc->peers,
466 &rc->num_oc,
477 rc->topology, 467 rc->topology,
478 GNUNET_TESTBED_TOPOLOGY_OPTION_END); 468 GNUNET_TESTBED_TOPOLOGY_OPTION_END);
479 if (NULL == rc->topology_operation) 469 if (NULL == rc->topology_operation)
@@ -672,32 +662,26 @@ GNUNET_TESTBED_run (const char *host_filename,
672 else if (0 == strcasecmp (topology, "SMALL_WORLD_RING")) 662 else if (0 == strcasecmp (topology, "SMALL_WORLD_RING"))
673 { 663 {
674 rc->topology = GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING; 664 rc->topology = GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING;
675 rc->num_oc = num_peers;
676 } 665 }
677 else if (0 == strcasecmp (topology, "SMALL_WORLD")) 666 else if (0 == strcasecmp (topology, "SMALL_WORLD"))
678 { 667 {
679 rc->topology = GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD; 668 rc->topology = GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD;
680 rc->num_oc = GNUNET_TESTBED_2dtorus_calc_links (num_peers, NULL, NULL);
681 } 669 }
682 else if (0 == strcasecmp (topology, "CLIQUE")) 670 else if (0 == strcasecmp (topology, "CLIQUE"))
683 { 671 {
684 rc->topology = GNUNET_TESTBED_TOPOLOGY_CLIQUE; 672 rc->topology = GNUNET_TESTBED_TOPOLOGY_CLIQUE;
685 rc->num_oc = num_peers * (num_peers - 1);
686 } 673 }
687 else if (0 == strcasecmp (topology, "LINE")) 674 else if (0 == strcasecmp (topology, "LINE"))
688 { 675 {
689 rc->topology = GNUNET_TESTBED_TOPOLOGY_LINE; 676 rc->topology = GNUNET_TESTBED_TOPOLOGY_LINE;
690 rc->num_oc = num_peers - 1;
691 } 677 }
692 else if (0 == strcasecmp (topology, "RING")) 678 else if (0 == strcasecmp (topology, "RING"))
693 { 679 {
694 rc->topology = GNUNET_TESTBED_TOPOLOGY_RING; 680 rc->topology = GNUNET_TESTBED_TOPOLOGY_RING;
695 rc->num_oc = num_peers;
696 } 681 }
697 else if (0 == strcasecmp (topology, "2D_TORUS")) 682 else if (0 == strcasecmp (topology, "2D_TORUS"))
698 { 683 {
699 rc->topology = GNUNET_TESTBED_TOPOLOGY_2D_TORUS; 684 rc->topology = GNUNET_TESTBED_TOPOLOGY_2D_TORUS;
700 rc->num_oc = GNUNET_TESTBED_2dtorus_calc_links (num_peers, NULL, NULL);
701 } 685 }
702 else 686 else
703 LOG (GNUNET_ERROR_TYPE_WARNING, 687 LOG (GNUNET_ERROR_TYPE_WARNING,
@@ -724,7 +708,7 @@ GNUNET_TESTBED_run (const char *host_filename,
724 GNUNET_free (rc); 708 GNUNET_free (rc);
725 return; 709 return;
726 } 710 }
727 rc->num_oc += (unsigned int) random_links; 711 rc->random_links = (unsigned int) random_links;
728 } 712 }
729 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 713 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
730 &shutdown_run_task, rc); 714 &shutdown_run_task, rc);
diff --git a/src/testbed/testbed_api_topology.c b/src/testbed/testbed_api_topology.c
index 17fb7070a..2c1e7b1bc 100644
--- a/src/testbed/testbed_api_topology.c
+++ b/src/testbed/testbed_api_topology.c
@@ -527,6 +527,8 @@ GNUNET_TESTBED_underlay_configure_topology (void *op_cls,
527 * @param op_cls closure argument to give with the operation event 527 * @param op_cls closure argument to give with the operation event
528 * @param num_peers number of peers in 'peers' 528 * @param num_peers number of peers in 'peers'
529 * @param peers array of 'num_peers' with the peers to configure 529 * @param peers array of 'num_peers' with the peers to configure
530 * @param max_connections the maximums number of overlay connections that will
531 * be made to achieve the given topology
530 * @param topo desired underlay topology to use 532 * @param topo desired underlay topology to use
531 * @param va topology-specific options 533 * @param va topology-specific options
532 * @return handle to the operation, NULL if connecting these 534 * @return handle to the operation, NULL if connecting these
@@ -537,6 +539,7 @@ struct GNUNET_TESTBED_Operation *
537GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls, 539GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
538 unsigned int num_peers, 540 unsigned int num_peers,
539 struct GNUNET_TESTBED_Peer **peers, 541 struct GNUNET_TESTBED_Peer **peers,
542 unsigned int *max_connections,
540 enum GNUNET_TESTBED_TopologyOption 543 enum GNUNET_TESTBED_TopologyOption
541 topo, va_list va) 544 topo, va_list va)
542{ 545{
@@ -637,6 +640,8 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
637 GNUNET_TESTBED_operation_queue_insert_ 640 GNUNET_TESTBED_operation_queue_insert_
638 (c->opq_parallel_topology_config_operations, op); 641 (c->opq_parallel_topology_config_operations, op);
639 GNUNET_TESTBED_operation_begin_wait_ (op); 642 GNUNET_TESTBED_operation_begin_wait_ (op);
643 if (NULL != max_connections)
644 *max_connections = tc->link_array_size;
640 return op; 645 return op;
641} 646}
642 647
@@ -649,6 +654,8 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
649 * @param op_cls closure argument to give with the operation event 654 * @param op_cls closure argument to give with the operation event
650 * @param num_peers number of peers in 'peers' 655 * @param num_peers number of peers in 'peers'
651 * @param peers array of 'num_peers' with the peers to configure 656 * @param peers array of 'num_peers' with the peers to configure
657 * @param max_connections the maximums number of overlay connections that will
658 * be made to achieve the given topology
652 * @param topo desired underlay topology to use 659 * @param topo desired underlay topology to use
653 * @param ... topology-specific options 660 * @param ... topology-specific options
654 * @return handle to the operation, NULL if connecting these 661 * @return handle to the operation, NULL if connecting these
@@ -658,6 +665,7 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
658struct GNUNET_TESTBED_Operation * 665struct GNUNET_TESTBED_Operation *
659GNUNET_TESTBED_overlay_configure_topology (void *op_cls, unsigned int num_peers, 666GNUNET_TESTBED_overlay_configure_topology (void *op_cls, unsigned int num_peers,
660 struct GNUNET_TESTBED_Peer **peers, 667 struct GNUNET_TESTBED_Peer **peers,
668 unsigned int *max_connections,
661 enum GNUNET_TESTBED_TopologyOption 669 enum GNUNET_TESTBED_TopologyOption
662 topo, ...) 670 topo, ...)
663{ 671{
@@ -667,7 +675,8 @@ GNUNET_TESTBED_overlay_configure_topology (void *op_cls, unsigned int num_peers,
667 GNUNET_assert (topo < GNUNET_TESTBED_TOPOLOGY_OPTION_END); 675 GNUNET_assert (topo < GNUNET_TESTBED_TOPOLOGY_OPTION_END);
668 va_start (vargs, topo); 676 va_start (vargs, topo);
669 op = GNUNET_TESTBED_overlay_configure_topology_va (op_cls, num_peers, peers, 677 op = GNUNET_TESTBED_overlay_configure_topology_va (op_cls, num_peers, peers,
670 topo, vargs); 678 max_connections,
679 topo, vargs);
671 va_end (vargs); 680 va_end (vargs);
672 return op; 681 return op;
673} 682}