X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Ftestbed%2Ftestbed_api_topology.h;h=64fb26f13b7f2d8d97e52dec22715fa9a752fe4c;hb=dd1927b960c7cea13733e061a11142274652ba27;hp=4603cd66a705574d083076b3e1fae6a480b1f107;hpb=468fea92f64d600ed635c417d91a235535098372;p=oweals%2Fgnunet.git diff --git a/src/testbed/testbed_api_topology.h b/src/testbed/testbed_api_topology.h index 4603cd66a..64fb26f13 100644 --- a/src/testbed/testbed_api_topology.h +++ b/src/testbed/testbed_api_topology.h @@ -1,6 +1,6 @@ /* This file is part of GNUnet - (C) 2008--2013 Christian Grothoff (and other contributing authors) + Copyright (C) 2008--2013 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -14,8 +14,8 @@ 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., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /** @@ -66,5 +66,48 @@ GNUNET_TESTBED_topology_get_ (enum GNUNET_TESTBED_TopologyOption *topology, char * GNUNET_TESTBED_topology_to_str_ (enum GNUNET_TESTBED_TopologyOption topology); + +/** + * Functions of this type are called to process underlay link + * + * @param cls closure + * @param A offset of first peer + * @param B offset of second peer + * @param bandwidth the bandwidth of the link in bytes per second + * @param latency the latency of link in milliseconds + * @param loss the percentage of messages dropped on the link + * @return GNUNET_OK to continue processing; GNUNET_SYSERR to abort + */ +typedef int (*underlay_link_processor) (void *cls, + unsigned int A, + unsigned int B, + unsigned int bandwidth, + unsigned int latency, + unsigned int loss); + + +/** + * Function to construct an underlay topology + * + * @param num_peers the number of peers for which the topology should be + * generated + * @param 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. + * @param cls closure for proc + * @param ... 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 + * @return GNUNET_OK if underlay link generation is successful; GNUNET_SYSERR + * upon error in generating the underlay or if any calls to the + * underlay link processor returned GNUNET_SYSERR + */ +int +GNUNET_TESTBED_underlay_construct_ (int num_peers, + underlay_link_processor proc, + void *cls, + ...); + #endif /* end of testbed_api_topology.h */