39#define LOG(kind, ...) GNUNET_log_from (kind, "testing-api", __VA_ARGS__)
41#define CONNECT_ADDRESS_TEMPLATE "%s-192.168.15.%u"
43#define ROUTER_CONNECT_ADDRESS_TEMPLATE "%s-92.68.150.%u"
45#define KNOWN_CONNECT_ADDRESS_TEMPLATE "%s-92.68.151.%u"
47#define PREFIX_TCP "tcp"
49#define PREFIX_UDP "udp"
51#define PREFIX_TCP_NATTED "tcp_natted"
53#define PREFIX_UDP_NATTED "udp_natted"
74 "plugin: %s space: %u node: %u global: %u\n",
81 pos_connection = pos_connection->
next)
85 "namespace_n: %u node_n: %u node_type: %u\n",
134 "plugin: %s spaces: %u nodes: %u known: %u\n",
167 unsigned int namespace_n;
197 "ceil num: %u nodes_x: %u nodes_m: %u namespace_n: %u\n",
208 if (NULL !=
namespace)
210 node_m = num - topology->nodes_x - topology->nodes_m * (namespace_n - 1);
220 "node additional_connects: %u %p\n",
226 *namespace_ex =
namespace;
227 *node_connections_ex = node_connections;
272 "get_connections\n");
276 return node_connections;
377 unsigned int n,
m, num;
404 const char *
template;
408 "get address prefix: %s node_n: %u\n",
412 node = connection->
node;
423 else if (1 == connection->
node_n)
468 "get_additional_connects\n");
470 get_node_info (num, topology, &node, &
namespace, &node_connections);
475 "No info found for node %d\n", num);
479 "node additional_connects for node %p\n",
482 "node additional_connects: %u\n",
514 "Subnet peers -> Number of nodes: %u\n",
545 "Subnets -> Number of nodes: %u\n",
591 "Carrier peers -> Number of nodes: %u\n",
631 _ (
"Failed to parse configuration.\n"));
642 "Missing default SUBNETS!\n");
651 "Missing default TESTBED_PLUGIN!\n");
658 default_carrier_peers)))
661 "Missing default CARRIER_PEERS!\n");
668 default_subnet_peers)))
671 "Missing default SUBNET_PEERS!\n");
681 "No carrier configured!\n");
692 "No backbone peers configured!\n");
703 "Backbone peers -> Number of nodes: %u\n",
725 "Carrier -> Number of nodes: %u\n",
747 "Carrier -> Default number of subnets: %u\n",
751 "Carrier -> number of subnets: %u\n",
762 "Carrier -> Default number of peers: %u\n",
766 "Carrier -> Default number of peers: %u\n",
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
struct GNUNET_TESTING_NetjailTopology * njt
The loaded topology.
static const char * my_node_id
static int prefix
If printing the value of PREFIX has been requested.
struct GNUNET_HashCode key
The key used in the DHT.
static char * value
Value of the record to add/remove.
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
#define GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT(prefix, name, type)
Create C implementation for a trait with name name for statically allocated data of type type.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create(const struct GNUNET_OS_ProjectData *pd)
Create a new configuration object.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_deserialize(struct GNUNET_CONFIGURATION_Handle *cfg, const char *mem, size_t size, const char *source_filename)
De-serializes configuration.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be a string.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
struct GNUNET_CONTAINER_MultiShortmap * GNUNET_CONTAINER_multishortmap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multishortmap_put(struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
void * GNUNET_CONTAINER_multishortmap_get(const struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key)
Given a key find a value in the map matching the key.
int GNUNET_CONTAINER_multishortmap_iterate(struct GNUNET_CONTAINER_MultiShortmap *map, GNUNET_CONTAINER_ShortmapIterator it, void *it_cls)
Iterate over all entries in the map.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE
Allow multiple values with the same key.
#define GNUNET_log(kind,...)
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_gnunet(void)
Return default project data used by 'libgnunetutil' for GNUnet.
Protocol address prefix für a connection between nodes.
struct GNUNET_TESTING_AddressPrefix * next
Pointer to the next prefix in the DLL.
char * address_prefix
The address prefix.
unsigned int number
Unique identifier this part of the topology can be identified.
unsigned int number
Unique identifier this part of the topology can be identified.
unsigned int number_peers
Number of carrier peers.
struct GNUNET_CONTAINER_MultiShortmap * subnets
Hash map containing subnets.
unsigned int number_subnets
Number of carrier subnets.
unsigned int index
Of all carriers this has index.
unsigned int number
Unique identifier this part of the topology can be identified.
struct GNUNET_CONTAINER_MultiShortmap * peers
Hash map containing peers.
Node in the netjail topology.
unsigned int namespace_n
The number of the subnet this node is running in.
struct GNUNET_TESTING_NodeConnection * node_connections_head
Head of the DLL with the connections which shall be established to other nodes.
unsigned int additional_connects
The number of unintentional additional connections this node waits for.
unsigned int is_global
Flag indicating if this node is a global known node.
char * plugin
Plugin for the test case to be run on this node.
unsigned int node_n
The number of this node in the subnet.
unsigned int number_peers
Number of subnet peers.
unsigned int number
Unique identifier this part of the topology can be identified.
struct GNUNET_CONTAINER_MultiShortmap * peers
Hash map containing peers.
unsigned int index
Of all subnets this has index.
Toplogy of our netjail setup.
unsigned long long default_subnets
Default number of subnets per carrier.
struct GNUNET_CONTAINER_MultiShortmap * map_globals
Hash map containing the global known nodes which are not natted.
struct GNUNET_CONTAINER_MultiShortmap * carriers
Hash map containing the carriers.
unsigned long long default_subnet_peers
Default number of peers per subnet.
char * plugin
Default plugin for the test case to be run on nodes.
unsigned int nodes_m
Number of nodes per subnet.
unsigned int nodes_x
Number of global known nodes.
unsigned long long num_carriers
Number of carriers.
unsigned int namespaces_n
Number of subnets.
unsigned long long default_carrier_peers
Default number of peers per carrier.
unsigned int total
Total number of namespaces in the topology.
struct GNUNET_CONTAINER_MultiShortmap * backbone_peers
Hash map containing the carriers.
struct GNUNET_CONTAINER_MultiShortmap * map_namespaces
Hash map containing the subnets (for natted nodes) of the topology.
unsigned long long num_backbone_peers
Default number of backbone peers.
Connection to another node.
struct GNUNET_TESTING_NodeConnection * next
Pointer to the next connection in the DLL.
unsigned int node_n
The number of the node this connection points to.
struct GNUNET_TESTING_NetjailNode * node
The node which establish the connection.
unsigned int namespace_n
The number of the subnet of the node this connection points to.
struct GNUNET_TESTING_AddressPrefix * address_prefixes_head
Head of the DLL with the address prefixes for the protocols this node is reachable.
enum GNUNET_TESTING_NodeType node_type
The type of the node this connection points to.
#define PREFIX_UDP_NATTED
static int free_subnets_cb(void *cls, const struct GNUNET_ShortHashCode *key, void *value)
static int free_value_cb(void *cls, const struct GNUNET_ShortHashCode *key, void *value)
unsigned int GNUNET_TESTING_get_additional_connects(unsigned int num, struct GNUNET_TESTING_NetjailTopology *topology)
Get the number of unintentional additional connections the node waits for.
static int free_carriers_cb(void *cls, const struct GNUNET_ShortHashCode *key, void *value)
struct GNUNET_TESTING_NodeConnection * GNUNET_TESTING_get_connections(unsigned int num, const struct GNUNET_TESTING_NetjailTopology *topology)
Get the connections to other nodes for a specific node.
char * GNUNET_TESTING_get_plugin_from_topo(struct GNUNET_TESTING_NetjailTopology *njt, const char *my_node_id)
Get the global plugin name form the topology file.
static void create_peers(struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_NetjailTopology *topology, struct GNUNET_TESTING_NetjailCarrier *carrier)
#define PREFIX_TCP_NATTED
static void create_subnets(struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_NetjailTopology *topology, struct GNUNET_TESTING_NetjailCarrier *carrier)
struct GNUNET_TESTING_NetjailNode * GNUNET_TESTING_get_node(unsigned int num, struct GNUNET_TESTING_NetjailTopology *topology)
Get a node from the topology.
static void get_node_info(unsigned int num, const struct GNUNET_TESTING_NetjailTopology *topology, struct GNUNET_TESTING_NetjailNode **node_ex, struct GNUNET_TESTING_NetjailNamespace **namespace_ex, struct GNUNET_TESTING_NodeConnection **node_connections_ex)
This function extracts information about a specific node from the topology.
unsigned int GNUNET_TESTING_calculate_num(struct GNUNET_TESTING_NodeConnection *node_connection, struct GNUNET_TESTING_NetjailTopology *topology)
Deallocate memory of the struct GNUNET_TESTING_NetjailTopology.
#define CONNECT_ADDRESS_TEMPLATE
static int log_topo(const struct GNUNET_TESTING_NetjailTopology *topology)
Helper function to log the configuration in case of a problem with configuration.
static int log_nodes(void *cls, const struct GNUNET_ShortHashCode *id, void *value)
A helper function to log information about individual nodes.
#define KNOWN_CONNECT_ADDRESS_TEMPLATE
static void create_subnet_peers(struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_NetjailTopology *topology, struct GNUNET_TESTING_NetjailSubnet *subnet)
void GNUNET_TESTING_free_topology(struct GNUNET_TESTING_NetjailTopology *topology)
Deallocate memory of the struct GNUNET_TESTING_NetjailTopology.
#define ROUTER_CONNECT_ADDRESS_TEMPLATE
static int log_namespaces(void *cls, const struct GNUNET_ShortHashCode *id, void *value)
Helper function to log information about namespaces.
char * GNUNET_TESTING_get_address(struct GNUNET_TESTING_NodeConnection *connection, const char *prefix)
Get the address for a specific communicator from a connection.
struct GNUNET_TESTING_NetjailTopology * GNUNET_TESTING_get_topo_from_string_(const char *input)
Parse the topology data.
#define GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS(op, prefix)
Call op on all simple traits.
Message formats for communication between testing cmds helper and testcase plugins.