header for intra library exported functions More...
Go to the source code of this file.
Typedefs | |
typedef int(* | underlay_link_processor) (void *cls, unsigned int A, unsigned int B, unsigned int bandwidth, unsigned int latency, unsigned int loss) |
Functions of this type are called to process underlay link. More... | |
Functions | |
unsigned int | GNUNET_TESTBED_2dtorus_calc_links (unsigned int num_peers, unsigned int *rows, unsigned int **rows_len) |
Returns the number of links that are required to generate a 2d torus for the given number of peers. More... | |
int | GNUNET_TESTBED_topology_get_ (enum GNUNET_TESTBED_TopologyOption *topology, const char *topology_string) |
Get a topology from a string input. More... | |
char * | GNUNET_TESTBED_topology_to_str_ (enum GNUNET_TESTBED_TopologyOption topology) |
Returns the string corresponding to the given topology. More... | |
int | GNUNET_TESTBED_underlay_construct_ (int num_peers, underlay_link_processor proc, void *cls,...) |
Function to construct an underlay topology. More... | |
header for intra library exported functions
Definition in file testbed_api_topology.h.
typedef int(* underlay_link_processor) (void *cls, unsigned int A, unsigned int B, unsigned int bandwidth, unsigned int latency, unsigned int loss) |
Functions of this type are called to process underlay link.
cls | closure |
A | offset of first peer |
B | offset of second peer |
bandwidth | the bandwidth of the link in bytes per second |
latency | the latency of link in milliseconds |
loss | the percentage of messages dropped on the link |
Definition at line 83 of file testbed_api_topology.h.
unsigned int GNUNET_TESTBED_2dtorus_calc_links | ( | unsigned int | num_peers, |
unsigned int * | rows, | ||
unsigned int ** | rows_len | ||
) |
Returns the number of links that are required to generate a 2d torus for the given number of peers.
Also returns the arrangement (number of rows and the length of each row)
num_peers | number of peers |
rows | number of rows in the 2d torus. Can be NULL. |
rows_len | the length of each row. This array will be allocated fresh. The caller should free it. Can be NULL. |
Definition at line 641 of file testbed_api_topology.c.
References GNUNET_free, GNUNET_malloc, consensus-simulation::int, and num_peers.
Referenced by gen_topo_2dtorus().
int GNUNET_TESTBED_topology_get_ | ( | enum GNUNET_TESTBED_TopologyOption * | topology, |
const char * | topology_string | ||
) |
Get a topology from a string input.
topology | where to write the retrieved topology |
topology_string | The string to attempt to get a configuration value from |
Definition at line 1446 of file testbed_api_topology.c.
References GNUNET_assert, GNUNET_NO, GNUNET_TESTBED_TOPOLOGY_OPTION_END, GNUNET_YES, topology, and topology_strings.
Referenced by GNUNET_TESTBED_run(), and run().
char* GNUNET_TESTBED_topology_to_str_ | ( | enum GNUNET_TESTBED_TopologyOption | topology | ) |
Returns the string corresponding to the given topology.
topology | the topology |
Definition at line 1474 of file testbed_api_topology.c.
References GNUNET_strdup, GNUNET_TESTBED_TOPOLOGY_OPTION_END, topology, and topology_strings.
int GNUNET_TESTBED_underlay_construct_ | ( | int | num_peers, |
underlay_link_processor | proc, | ||
void * | cls, | ||
... | |||
) |
Function to construct an underlay topology.
num_peers | the number of peers for which the topology should be generated |
proc | the underlay link processor callback. Will be called for each underlay link generated unless a previous call to this callback returned GNUNET_SYSERR. Cannot be NULL. |
cls | closure for proc |
... | variable arguments denoting the topology and its parameters. They should start with the type of topology to generate followed by their options. These arguments should always end with GNUNET_TESTBED_TOPOLOGY_OPTION_END option |
num_peers | the number of peers for which the topology should be generated |
proc | the underlay link processor callback. Will be called for each underlay link generated unless a previous call to this callback returned GNUNET_SYSERR. Cannot be NULL. |
cls | closure for proc |
... | variable arguments denoting the topology and its parameters. They should start with the type of topology to generate followed by their options. |
Definition at line 1499 of file testbed_api_topology.c.
References UnderlayLink::A, UnderlayLink::B, UnderlayLink::bandwidth, filename, gen_topo_2dtorus(), gen_topo_clique(), gen_topo_from_file(), gen_topo_line(), gen_topo_random(), gen_topo_ring(), gen_topo_scale_free(), gen_topo_star(), GNUNET_assert, GNUNET_free, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_TESTBED_TOPOLOGY_2D_TORUS, GNUNET_TESTBED_TOPOLOGY_CLIQUE, GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, GNUNET_TESTBED_TOPOLOGY_FROM_FILE, GNUNET_TESTBED_TOPOLOGY_LINE, GNUNET_TESTBED_TOPOLOGY_RING, GNUNET_TESTBED_TOPOLOGY_SCALE_FREE, GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD, GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING, GNUNET_TESTBED_TOPOLOGY_STAR, GNUNET_VA_ARG_ENUM, GNUNET_YES, UnderlayLink::latency, TopologyContextUnderlay::link_array, UnderlayLink::loss, m, num_peers, ret, tc, and topology.
Referenced by run().