GNUnet 0.24.1-15-gab6ed22f1
testing_api_topology.c
Go to the documentation of this file.
1/*
2 This file is part of GNUnet
3 Copyright (C) 2008, 2009, 2012 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
32#include "platform.h"
33#include "gnunet_common.h"
34#include "gnunet_util_lib.h"
35#include "gnunet_testing_lib.h"
37#include "testing_cmds.h"
38
39#define LOG(kind, ...) GNUNET_log_from (kind, "testing-api", __VA_ARGS__)
40
41#define CONNECT_ADDRESS_TEMPLATE "%s-192.168.15.%u"
42
43#define ROUTER_CONNECT_ADDRESS_TEMPLATE "%s-92.68.150.%u"
44
45#define KNOWN_CONNECT_ADDRESS_TEMPLATE "%s-92.68.151.%u"
46
47#define PREFIX_TCP "tcp"
48
49#define PREFIX_UDP "udp"
50
51#define PREFIX_TCP_NATTED "tcp_natted"
52
53#define PREFIX_UDP_NATTED "udp_natted"
54
55
64static int
65log_nodes (void *cls,
66 const struct GNUNET_ShortHashCode *id,
67 void *value)
68{
69 struct GNUNET_TESTING_NetjailNode *node = value;
70 struct GNUNET_TESTING_NodeConnection *pos_connection;
71 struct GNUNET_TESTING_AddressPrefix *pos_prefix;
72
74 "plugin: %s space: %u node: %u global: %u\n",
75 node->plugin,
76 node->namespace_n,
77 node->node_n,
78 node->is_global);
79
80 for (pos_connection = node->node_connections_head; NULL != pos_connection;
81 pos_connection = pos_connection->next)
82 {
83
85 "namespace_n: %u node_n: %u node_type: %u\n",
86 pos_connection->namespace_n,
87 pos_connection->node_n,
88 pos_connection->node_type);
89
90 for (pos_prefix = pos_connection->address_prefixes_head; NULL != pos_prefix;
91 pos_prefix =
92 pos_prefix->next)
93 {
95 "prefix: %s\n",
96 pos_prefix->address_prefix);
97 }
98 }
99 return GNUNET_YES;
100}
101
102
111static int
112log_namespaces (void *cls,
113 const struct GNUNET_ShortHashCode *id,
114 void *value)
115{
116 struct GNUNET_TESTING_NetjailNamespace *namespace = value;
117
119 &log_nodes,
120 NULL);
121 return GNUNET_YES;
122}
123
124
130static int
132{
134 "plugin: %s spaces: %u nodes: %u known: %u\n",
135 topology->plugin,
136 topology->namespaces_n,
137 topology->nodes_m,
138 topology->nodes_x);
139
141 log_namespaces, NULL);
143 NULL);
144 return GNUNET_YES;
145}
146
147
158static void
159get_node_info (unsigned int num,
160 const struct GNUNET_TESTING_NetjailTopology *topology,
161 struct GNUNET_TESTING_NetjailNode **node_ex,
162 struct GNUNET_TESTING_NetjailNamespace **namespace_ex,
163 struct GNUNET_TESTING_NodeConnection **node_connections_ex)
164{
165 struct GNUNET_ShortHashCode hkey;
166 struct GNUNET_HashCode hc;
167 unsigned int namespace_n;
168 unsigned int node_m;
169 struct GNUNET_TESTING_NetjailNode *node;
170 struct GNUNET_TESTING_NetjailNamespace *namespace;
171 struct GNUNET_TESTING_NodeConnection *node_connections = NULL;
172
173 log_topo (topology);
175 "num: %u \n",
176 num);
177 if (topology->nodes_x >= num)
178 {
179
180 GNUNET_CRYPTO_hash (&num, sizeof(num), &hc);
181 memcpy (&hkey,
182 &hc,
183 sizeof (hkey));
185 &hkey);
186 if (NULL != node)
187 {
188 *node_ex = node;
189 *node_connections_ex = node->node_connections_head;
190 }
191 }
192 else
193 {
194 namespace_n = (unsigned int) ceil ((double) (num - topology->nodes_x)
195 / topology->nodes_m);
197 "ceil num: %u nodes_x: %u nodes_m: %u namespace_n: %u\n",
198 num,
199 topology->nodes_x,
200 topology->nodes_m,
203 memcpy (&hkey,
204 &hc,
205 sizeof (hkey));
206 namespace = GNUNET_CONTAINER_multishortmap_get (topology->map_namespaces,
207 &hkey);
208 if (NULL != namespace)
209 {
210 node_m = num - topology->nodes_x - topology->nodes_m * (namespace_n - 1);
211 GNUNET_CRYPTO_hash (&node_m, sizeof(node_m), &hc);
212 memcpy (&hkey,
213 &hc,
214 sizeof (hkey));
215 node = GNUNET_CONTAINER_multishortmap_get (namespace->nodes,
216 &hkey);
217 if (NULL != node)
218 {
220 "node additional_connects: %u %p\n",
222 node);
223 node_connections = node->node_connections_head;
224 }
225 *node_ex = node;
226 *namespace_ex = namespace;
227 *node_connections_ex = node_connections;
228 }
229 }
230}
231
232
241GNUNET_TESTING_get_node (unsigned int num,
242 struct GNUNET_TESTING_NetjailTopology *topology)
243{
244 struct GNUNET_TESTING_NetjailNode *node;
245 struct GNUNET_TESTING_NetjailNamespace *namespace;
246 struct GNUNET_TESTING_NodeConnection *node_connections;
247
248 get_node_info (num, topology, &node, &namespace, &node_connections);
249
250 return node;
251
252}
253
254
264 const struct
266{
267 struct GNUNET_TESTING_NetjailNode *node;
268 struct GNUNET_TESTING_NetjailNamespace *namespace;
269 struct GNUNET_TESTING_NodeConnection *node_connections;
270
272 "get_connections\n");
273
274 get_node_info (num, topology, &node, &namespace, &node_connections);
275
276 return node_connections;
277}
278
279
280static int
281free_value_cb (void *cls,
282 const struct GNUNET_ShortHashCode *key,
283 void *value)
284{
285 (void) cls;
286
288
289 return GNUNET_OK;
290}
291
292
293static int
295 const struct GNUNET_ShortHashCode *key,
296 void *value)
297{
298 struct GNUNET_TESTING_NetjailSubnet *subnet = value;
299 (void) cls;
300
303 NULL);
304
305 GNUNET_free (subnet);
306
307 return GNUNET_OK;
308}
309
310
311static int
313 const struct GNUNET_ShortHashCode *key,
314 void *value)
315{
316 struct GNUNET_TESTING_NetjailCarrier *carrier = value;
317 (void) cls;
318
321 NULL);
324 NULL);
325
326 GNUNET_free (carrier);
327
328 return GNUNET_OK;
329}
330
331
337void
339{
342 NULL);
345 NULL);
346 GNUNET_free (topology->plugin);
347 GNUNET_free (topology);
348}
349
350
351unsigned int
353 struct GNUNET_TESTING_NodeConnection *node_connection,
354 struct GNUNET_TESTING_NetjailTopology *topology)
355{
356 unsigned int n, m, num;
357
358 n = node_connection->namespace_n;
359 m = node_connection->node_n;
360
361 if (0 == n)
362 num = m;
363 else
364 num = (n - 1) * topology->nodes_m + m + topology->nodes_x;
365
366 return num;
367}
368
369
377char *
379 const char *prefix)
380{
381 struct GNUNET_TESTING_NetjailNode *node;
382 char *addr;
383 const char *template;
384 unsigned int node_n;
385
387 "get address prefix: %s node_n: %u\n",
388 prefix,
389 connection->node_n);
390
391 node = connection->node;
392 if (connection->namespace_n == node->namespace_n)
393 {
394 template = CONNECT_ADDRESS_TEMPLATE;
395 node_n = connection->node_n;
396 }
397 else if (0 == connection->namespace_n)
398 {
400 node_n = connection->node_n;
401 }
402 else if (1 == connection->node_n)
403 {
405 node_n = connection->namespace_n;
406 }
407 else
408 {
409 return NULL;
410 }
411
412 if (0 == strcmp (PREFIX_TCP, prefix) ||
413 0 == strcmp (PREFIX_UDP, prefix) ||
414 0 == strcmp (PREFIX_UDP_NATTED, prefix) ||
415 0 == strcmp (PREFIX_TCP_NATTED, prefix))
416 {
417 GNUNET_asprintf (&addr,
418 template,
419 prefix,
420 node_n);
421 }
422 else
423 {
424 GNUNET_assert (0);
425 }
426
427 return addr;
428}
429
430
437unsigned int
440 topology)
441{
442 struct GNUNET_TESTING_NetjailNode *node;
443 struct GNUNET_TESTING_NetjailNamespace *namespace;
444 struct GNUNET_TESTING_NodeConnection *node_connections;
445
447 "get_additional_connects\n");
448
449 get_node_info (num, topology, &node, &namespace, &node_connections);
450
451 if (NULL == node)
452 {
454 "No info found for node %d\n", num);
455 return 0;
456 }
458 "node additional_connects for node %p\n",
459 node);
461 "node additional_connects: %u\n",
462 node->additional_connects);
463
464 return node->additional_connects;
465}
466
467
468const char *
471 const char *my_node_id)
472{
473 return njt->plugin;
474}
475
476
477static void
479 struct GNUNET_TESTING_NetjailTopology *topology,
480 struct GNUNET_TESTING_NetjailSubnet *subnet)
481{
482 struct GNUNET_HashCode hc = {0};
484
485 for (int i = 0; i < subnet->number_peers; i++)
486 {
487 struct GNUNET_ShortHashCode hkey;
488 struct GNUNET_TESTING_NetjailSubnetPeer *subnet_peer = GNUNET_new (struct
490
491 topology->total++;
493 "Subnet peers -> Number of nodes: %u\n",
494 topology->total);
495 GNUNET_CRYPTO_hash (&topology->total, sizeof(topology->total), &hc);
496 memcpy (&hkey,
497 &hc,
498 sizeof (hkey));
500 &hkey,
501 subnet_peer,
503 }
504}
505
506
507static void
509 struct GNUNET_TESTING_NetjailTopology *topology,
510 struct GNUNET_TESTING_NetjailCarrier *carrier)
511{
512 struct GNUNET_HashCode hc = {0};
514
515 for (int i = 0; i < carrier->number_subnets; i++)
516 {
517 struct GNUNET_ShortHashCode hkey;
518 struct GNUNET_TESTING_NetjailSubnet *subnet = GNUNET_new (struct
520 char *section;
521
522 topology->total++;
524 "Subnets -> Number of nodes: %u\n",
525 topology->total);
526 subnet->number = topology->total;
527 subnet->index = i;
528 GNUNET_CRYPTO_hash (&topology->total, sizeof(topology->total), &hc);
529 memcpy (&hkey,
530 &hc,
531 sizeof (hkey));
533 &hkey,
534 subnet,
536 GNUNET_asprintf (&section, "CARRIER-%u-SUBNET-%u", carrier->index, i);
538 section,
539 "SUBNET_PEERS",
540 (unsigned long
541 long *) &subnet->
542 number_peers))
543 {
544 subnet->number_peers = topology->default_subnet_peers;
545 }
546
547 create_subnet_peers (cfg, topology, subnet);
548
549 GNUNET_free (section);
550 }
551}
552
553
554static void
556 struct GNUNET_TESTING_NetjailTopology *topology,
557 struct GNUNET_TESTING_NetjailCarrier *carrier)
558{
559 struct GNUNET_HashCode hc = {0};
561
562 for (int i = 0; i < carrier->number_peers; i++)
563 {
564 struct GNUNET_ShortHashCode hkey;
565 struct GNUNET_TESTING_NetjailCarrierPeer *peer = GNUNET_new (struct
567
568 topology->total++;
570 "Carrier peers -> Number of nodes: %u\n",
571 topology->total);
572 peer->number = topology->total;
573 GNUNET_CRYPTO_hash (&topology->total, sizeof(topology->total), &hc);
574 memcpy (&hkey,
575 &hc,
576 sizeof (hkey));
578 &hkey,
579 peer,
581 }
582}
583
584
587{
589 struct GNUNET_HashCode hc = {0};
590 struct GNUNET_TESTING_NetjailTopology *topology = GNUNET_new (struct
592
593 topology->backbone_peers
595 GNUNET_NO);
596 topology->carriers
598 GNUNET_NO);
600 GNUNET_assert (NULL != topology->carriers);
601
602 if (GNUNET_OK !=
604 input,
605 strlen (input),
606 NULL))
607 {
609 _ ("Failed to parse configuration.\n"));
611 return NULL;
612 }
613 if (GNUNET_OK !=
615 "DEFAULTS",
616 "SUBNETS",
617 &topology->default_subnets))
618 {
620 "Missing default SUBNETS!\n");
621 return NULL;
622 }
624 "DEFAULTS",
625 "TESTBED_PLUGIN",
626 &topology->plugin))
627 {
629 "Missing default TESTBED_PLUGIN!\n");
630 return NULL;
631 }
633 "DEFAULTS",
634 "CARRIER_PEERS",
635 &(topology->
636 default_carrier_peers)))
637 {
639 "Missing default CARRIER_PEERS!\n");
640 return NULL;
641 }
643 "DEFAULTS",
644 "SUBNET_PEERS",
645 &(topology->
646 default_subnet_peers)))
647 {
649 "Missing default SUBNET_PEERS!\n");
650 return NULL;
651 }
653 "BACKBONE",
654 "CARRIERS",
655 &(topology->
656 num_carriers)))
657 {
659 "No carrier configured!\n");
660 return NULL;
661 }
663 "BACKBONE",
664 "BACKBONE_PEERS",
665 &(topology->
666 num_backbone_peers))
667 )
668 {
670 "No backbone peers configured!\n");
671 return NULL;
672 }
673 for (int i = 0; i < topology->num_backbone_peers; i++)
674 {
677 struct GNUNET_ShortHashCode hkey;
678
679 topology->total++;
681 "Backbone peers -> Number of nodes: %u\n",
682 topology->total);
683 peer->number = topology->total;
684 GNUNET_CRYPTO_hash (&topology->total, sizeof(topology->total), &hc);
685 memcpy (&hkey,
686 &hc,
687 sizeof (hkey));
689 &hkey,
690 peer,
692 }
693 GNUNET_assert (NULL != topology->carriers);
694 for (int i = 0; i < topology->num_carriers; i++)
695 {
696 struct GNUNET_TESTING_NetjailCarrier *carrier = GNUNET_new (struct
698 struct GNUNET_ShortHashCode hkey;
699 char *section;
700
701 topology->total++;
703 "Carrier -> Number of nodes: %u\n",
704 topology->total);
705 carrier->number = topology->total;
706 GNUNET_CRYPTO_hash (&topology->total, sizeof(topology->total), &hc);
707 memcpy (&hkey,
708 &hc,
709 sizeof (hkey));
710 GNUNET_assert (NULL != topology->carriers);
712 &hkey,
713 carrier,
715 GNUNET_asprintf (&section, "CARRIER-%u", i);
717 section,
718 "SUBNETS",
719 (unsigned long
720 long *) &carrier->
721 number_subnets))
722 {
723 carrier->number_subnets = topology->default_subnets;
725 "Carrier -> Default number of subnets: %u\n",
726 carrier->number_subnets);
727 }
729 "Carrier -> number of subnets: %u\n",
730 carrier->number_subnets);
732 section,
733 "CARRIER_PEERS",
734 (unsigned long
735 long *) &carrier->
736 number_peers))
737 {
738 carrier->number_peers = topology->default_carrier_peers;
740 "Carrier -> Default number of peers: %u\n",
741 carrier->number_peers);
742 }
744 "Carrier -> Default number of peers: %u\n",
745 carrier->number_peers);
746 create_peers (cfg, topology, carrier);
747 create_subnets (cfg, topology, carrier);
748
749 GNUNET_free (section);
750 }
751
753
754 return topology;
755}
756
757
760 GNUNET_TESTING)
761
762
763/* end of netjail.c */
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
Definition: gnunet-arm.c:103
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:108
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.
Definition: gnunet-config.c:65
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.
Definition: crypto_hash.c:41
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,...)
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
#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
@ GNUNET_ERROR_TYPE_INFO
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.
#define _(String)
GNU gettext support macro.
Definition: platform.h:179
A 512-bit hashcode.
A 256-bit hashcode.
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.
Topology 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.
#define PREFIX_TCP
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.
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.
const 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.
unsigned int GNUNET_TESTING_calculate_num(struct GNUNET_TESTING_NodeConnection *node_connection, struct GNUNET_TESTING_NetjailTopology *topology)
Calculate the unique id identifying a node from a given connection.
#define LOG(kind,...)
#define CONNECT_ADDRESS_TEMPLATE
#define PREFIX_UDP
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.