GNUnet 0.22.0
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_util_lib.h"
34#include "gnunet_testing_lib.h"
36#include "testing_cmds.h"
37
38#define LOG(kind, ...) GNUNET_log_from (kind, "testing-api", __VA_ARGS__)
39
40#define CONNECT_ADDRESS_TEMPLATE "%s-192.168.15.%u"
41
42#define ROUTER_CONNECT_ADDRESS_TEMPLATE "%s-92.68.150.%u"
43
44#define KNOWN_CONNECT_ADDRESS_TEMPLATE "%s-92.68.151.%u"
45
46#define PREFIX_TCP "tcp"
47
48#define PREFIX_UDP "udp"
49
50#define PREFIX_TCP_NATTED "tcp_natted"
51
52#define PREFIX_UDP_NATTED "udp_natted"
53
54
63static int
64log_nodes (void *cls,
65 const struct GNUNET_ShortHashCode *id,
66 void *value)
67{
68 struct GNUNET_TESTING_NetjailNode *node = value;
69 struct GNUNET_TESTING_NodeConnection *pos_connection;
70 struct GNUNET_TESTING_AddressPrefix *pos_prefix;
71
73 "plugin: %s space: %u node: %u global: %u\n",
74 node->plugin,
75 node->namespace_n,
76 node->node_n,
77 node->is_global);
78
79 for (pos_connection = node->node_connections_head; NULL != pos_connection;
80 pos_connection = pos_connection->next)
81 {
82
84 "namespace_n: %u node_n: %u node_type: %u\n",
85 pos_connection->namespace_n,
86 pos_connection->node_n,
87 pos_connection->node_type);
88
89 for (pos_prefix = pos_connection->address_prefixes_head; NULL != pos_prefix;
90 pos_prefix =
91 pos_prefix->next)
92 {
94 "prefix: %s\n",
95 pos_prefix->address_prefix);
96 }
97 }
98 return GNUNET_YES;
99}
100
101
110static int
111log_namespaces (void *cls,
112 const struct GNUNET_ShortHashCode *id,
113 void *value)
114{
115 struct GNUNET_TESTING_NetjailNamespace *namespace = value;
116
118 &log_nodes,
119 NULL);
120 return GNUNET_YES;
121}
122
123
129static int
131{
133 "plugin: %s spaces: %u nodes: %u known: %u\n",
134 topology->plugin,
135 topology->namespaces_n,
136 topology->nodes_m,
137 topology->nodes_x);
138
140 log_namespaces, NULL);
142 NULL);
143 return GNUNET_YES;
144}
145
146
157static void
158get_node_info (unsigned int num,
159 const struct GNUNET_TESTING_NetjailTopology *topology,
160 struct GNUNET_TESTING_NetjailNode **node_ex,
161 struct GNUNET_TESTING_NetjailNamespace **namespace_ex,
162 struct GNUNET_TESTING_NodeConnection **node_connections_ex)
163{
164 struct GNUNET_ShortHashCode hkey;
165 struct GNUNET_HashCode hc;
166 unsigned int namespace_n;
167 unsigned int node_m;
168 struct GNUNET_TESTING_NetjailNode *node;
169 struct GNUNET_TESTING_NetjailNamespace *namespace;
170 struct GNUNET_TESTING_NodeConnection *node_connections = NULL;
171
172 log_topo (topology);
174 "num: %u \n",
175 num);
176 if (topology->nodes_x >= num)
177 {
178
179 GNUNET_CRYPTO_hash (&num, sizeof(num), &hc);
180 memcpy (&hkey,
181 &hc,
182 sizeof (hkey));
184 &hkey);
185 if (NULL != node)
186 {
187 *node_ex = node;
188 *node_connections_ex = node->node_connections_head;
189 }
190 }
191 else
192 {
193 namespace_n = (unsigned int) ceil ((double) (num - topology->nodes_x)
194 / topology->nodes_m);
196 "ceil num: %u nodes_x: %u nodes_m: %u namespace_n: %u\n",
197 num,
198 topology->nodes_x,
199 topology->nodes_m,
202 memcpy (&hkey,
203 &hc,
204 sizeof (hkey));
205 namespace = GNUNET_CONTAINER_multishortmap_get (topology->map_namespaces,
206 &hkey);
207 if (NULL != namespace)
208 {
209 node_m = num - topology->nodes_x - topology->nodes_m * (namespace_n - 1);
210 GNUNET_CRYPTO_hash (&node_m, sizeof(node_m), &hc);
211 memcpy (&hkey,
212 &hc,
213 sizeof (hkey));
214 node = GNUNET_CONTAINER_multishortmap_get (namespace->nodes,
215 &hkey);
216 if (NULL != node)
217 {
219 "node additional_connects: %u %p\n",
221 node);
222 node_connections = node->node_connections_head;
223 }
224 *node_ex = node;
225 *namespace_ex = namespace;
226 *node_connections_ex = node_connections;
227 }
228 }
229}
230
231
240GNUNET_TESTING_get_node (unsigned int num,
241 struct GNUNET_TESTING_NetjailTopology *topology)
242{
243 struct GNUNET_TESTING_NetjailNode *node;
244 struct GNUNET_TESTING_NetjailNamespace *namespace;
245 struct GNUNET_TESTING_NodeConnection *node_connections;
246
247 get_node_info (num, topology, &node, &namespace, &node_connections);
248
249 return node;
250
251}
252
253
263 const struct
265{
266 struct GNUNET_TESTING_NetjailNode *node;
267 struct GNUNET_TESTING_NetjailNamespace *namespace;
268 struct GNUNET_TESTING_NodeConnection *node_connections;
269
271 "get_connections\n");
272
273 get_node_info (num, topology, &node, &namespace, &node_connections);
274
275 return node_connections;
276}
277
278
279int
280free_nodes_cb (void *cls,
281 const struct GNUNET_ShortHashCode *key,
282 void *value)
283{
284 (void) cls;
285 struct GNUNET_TESTING_NetjailNode *node = value;
286 struct GNUNET_TESTING_NodeConnection *pos_connection;
287 struct GNUNET_TESTING_AddressPrefix *pos_prefix;
288
289 while (NULL != (pos_connection = node->node_connections_head))
290 {
291 while (NULL != (pos_prefix = pos_connection->address_prefixes_head))
292 {
294 pos_connection->address_prefixes_tail,
295 pos_prefix);
296 GNUNET_free (pos_prefix->address_prefix);
297 GNUNET_free (pos_prefix);
298 }
301 pos_connection);
302 GNUNET_free (pos_connection);
303 }
304
305 GNUNET_free (node->plugin);
306 GNUNET_free (node);
307 return GNUNET_OK;
308}
309
310
311int
313 const struct GNUNET_ShortHashCode *key,
314 void *value)
315{
316 (void) cls;
317 struct GNUNET_TESTING_NetjailNamespace *namespace = value;
318
319 GNUNET_free (namespace->router);
321 namespace->nodes);
322 return GNUNET_OK;
323
324}
325
326
327static int
328free_value_cb (void *cls,
329 const struct GNUNET_ShortHashCode *key,
330 void *value)
331{
332 (void) cls;
333
335
336 return GNUNET_OK;
337}
338
339
340static int
342 const struct GNUNET_ShortHashCode *key,
343 void *value)
344{
345 (void) cls;
346 struct GNUNET_TESTING_NetjailSubnet *subnet = value;
347
350 NULL);
351
352 GNUNET_free (subnet);
353
354 return GNUNET_OK;
355}
356
357
358static int
360 const struct GNUNET_ShortHashCode *key,
361 void *value)
362{
363 (void) cls;
364 struct GNUNET_TESTING_NetjailCarrier *carrier = value;
365
368 NULL);
371 NULL);
372
373 GNUNET_free (carrier);
374
375 return GNUNET_OK;
376}
377
378
384void
386{
389 NULL);
392 NULL);
393 GNUNET_free (topology->plugin);
394 GNUNET_free (topology);
395}
396
397
419unsigned int
421 struct GNUNET_TESTING_NodeConnection *node_connection,
422 struct GNUNET_TESTING_NetjailTopology *topology)
423{
424 unsigned int n, m, num;
425
426 n = node_connection->namespace_n;
427 m = node_connection->node_n;
428
429 if (0 == n)
430 num = m;
431 else
432 num = (n - 1) * topology->nodes_m + m + topology->nodes_x;
433
434 return num;
435}
436
437
445char *
447 const char *prefix)
448{
449 struct GNUNET_TESTING_NetjailNode *node;
450 char *addr;
451 char *template;
452 unsigned int node_n;
453
455 "get address prefix: %s node_n: %u\n",
456 prefix,
457 connection->node_n);
458
459 node = connection->node;
460 if (connection->namespace_n == node->namespace_n)
461 {
462 template = CONNECT_ADDRESS_TEMPLATE;
463 node_n = connection->node_n;
464 }
465 else if (0 == connection->namespace_n)
466 {
468 node_n = connection->node_n;
469 }
470 else if (1 == connection->node_n)
471 {
473 node_n = connection->namespace_n;
474 }
475 else
476 {
477 return NULL;
478 }
479
480 if (0 == strcmp (PREFIX_TCP, prefix) ||
481 0 == strcmp (PREFIX_UDP, prefix) ||
482 0 == strcmp (PREFIX_UDP_NATTED, prefix) ||
483 0 == strcmp (PREFIX_TCP_NATTED, prefix))
484 {
485 GNUNET_asprintf (&addr,
486 template,
487 prefix,
488 node_n);
489 }
490 else
491 {
492 GNUNET_assert (0);
493 }
494
495 return addr;
496}
497
498
505unsigned int
508 topology)
509{
510 struct GNUNET_TESTING_NetjailNode *node;
511 struct GNUNET_TESTING_NetjailNamespace *namespace;
512 struct GNUNET_TESTING_NodeConnection *node_connections;
513
515 "get_additional_connects\n");
516
517 get_node_info (num, topology, &node, &namespace, &node_connections);
518
519 if (NULL == node)
520 {
522 "No info found for node %d\n", num);
523 return 0;
524 }
526 "node additional_connects for node %p\n",
527 node);
529 "node additional_connects: %u\n",
530 node->additional_connects);
531
532 return node->additional_connects;
533}
534
535char *
538 const char *my_node_id)
539{
540 return njt->plugin;
541}
542
543
544static void
546 struct GNUNET_TESTING_NetjailTopology *topology,
547 struct GNUNET_TESTING_NetjailSubnet *subnet)
548{
549 struct GNUNET_HashCode hc;
551
552 for (int i = 0; i < subnet->number_peers; i++)
553 {
554 struct GNUNET_ShortHashCode hkey;
556
557 topology->total++;
559 "Subnet peers -> Number of nodes: %u\n",
560 topology->total);
561 GNUNET_CRYPTO_hash (&topology->total, sizeof(topology->total), &hc);
562 memcpy (&hkey,
563 &hc,
564 sizeof (hkey));
566 &hkey,
567 subnet_peer,
569 }
570}
571
572
573static void
575 struct GNUNET_TESTING_NetjailTopology *topology,
576 struct GNUNET_TESTING_NetjailCarrier *carrier)
577{
578 struct GNUNET_HashCode hc;
580
581 for (int i = 0; i < carrier->number_subnets; i++)
582 {
583 struct GNUNET_ShortHashCode hkey;
585 char *section;
586
587 topology->total++;
589 "Subnets -> Number of nodes: %u\n",
590 topology->total);
591 subnet->number = topology->total;
592 subnet->index = i;
593 GNUNET_CRYPTO_hash (&topology->total, sizeof(topology->total), &hc);
594 memcpy (&hkey,
595 &hc,
596 sizeof (hkey));
598 &hkey,
599 subnet,
601 GNUNET_asprintf (&section, "CARRIER-%u-SUBNET-%u", carrier->index, i);
603 section,
604 "SUBNET_PEERS",
605 (unsigned long long *) &subnet->number_peers))
606 {
607 subnet->number_peers = topology->default_subnet_peers;
608 }
609
610 create_subnet_peers (cfg, topology, subnet);
611
612 GNUNET_free (section);
613 }
614}
615
616
617static void
619 struct GNUNET_TESTING_NetjailTopology *topology,
620 struct GNUNET_TESTING_NetjailCarrier *carrier)
621{
622 struct GNUNET_HashCode hc;
624
625 for (int i = 0; i < carrier->number_peers; i++)
626 {
627 struct GNUNET_ShortHashCode hkey;
629
630 topology->total++;
632 "Carrier peers -> Number of nodes: %u\n",
633 topology->total);
634 peer->number = topology->total;
635 GNUNET_CRYPTO_hash (&topology->total, sizeof(topology->total), &hc);
636 memcpy (&hkey,
637 &hc,
638 sizeof (hkey));
640 &hkey,
641 peer,
643 //GNUNET_asprintf (&section, "CARRIER-%u-PEER-%u", carrier->index, i);
644 }
645}
646
647
650{
655 struct GNUNET_HashCode hc;
656
658 GNUNET_assert (NULL != topology->carriers);
659
660 if (GNUNET_OK !=
662 input,
663 strlen (input),
664 NULL))
665 {
667 _ ("Failed to parse configuration.\n"));
669 return NULL;
670 }
672 "DEFAULTS",
673 "SUBNETS",
674 &(topology->default_subnets)))
675 {
677 "Missing default SUBNETS!\n");
678 return NULL;
679 }
681 "DEFAULTS",
682 "TESTBED_PLUGIN",
683 &topology->plugin))
684 {
686 "Missing default TESTBED_PLUGIN!\n");
687 return NULL;
688 }
690 "DEFAULTS",
691 "CARRIER_PEERS",
692 &(topology->default_carrier_peers)))
693 {
695 "Missing default CARRIER_PEERS!\n");
696 return NULL;
697 }
699 "DEFAULTS",
700 "SUBNET_PEERS",
701 &(topology->default_subnet_peers)))
702 {
704 "Missing default SUBNET_PEERS!\n");
705 return NULL;
706 }
708 "BACKBONE",
709 "CARRIERS",
710 &(topology->num_carriers)))
711 {
713 "No carrier configured!\n");
714 return NULL;
715 }
717 "BACKBONE",
718 "BACKBONE_PEERS",
719 &(topology->num_backbone_peers)))
720 {
722 "No backbone peers configured!\n");
723 return NULL;
724 }
725 for (int i = 0;i < topology->num_backbone_peers; i++)
726 {
728 struct GNUNET_ShortHashCode hkey;
729
730 topology->total++;
732 "Backbone peers -> Number of nodes: %u\n",
733 topology->total);
734 peer->number = topology->total;
735 GNUNET_CRYPTO_hash (&topology->total, sizeof(topology->total), &hc);
736 memcpy (&hkey,
737 &hc,
738 sizeof (hkey));
740 &hkey,
741 peer,
743 }
744 GNUNET_assert (NULL != topology->carriers);
745 for (int i = 0;i < topology->num_carriers; i++)
746 {
748 struct GNUNET_ShortHashCode hkey;
749 char *section;
750
751 topology->total++;
753 "Carrier -> Number of nodes: %u\n",
754 topology->total);
755 carrier->number = topology->total;
756 GNUNET_CRYPTO_hash (&topology->total, sizeof(topology->total), &hc);
757 memcpy (&hkey,
758 &hc,
759 sizeof (hkey));
760 GNUNET_assert (NULL != topology->carriers);
762 &hkey,
763 carrier,
765 GNUNET_asprintf (&section, "CARRIER-%u", i);
767 section,
768 "SUBNETS",
769 (unsigned long long *) &carrier->number_subnets))
770 {
771 carrier->number_subnets = topology->default_subnets;
773 "Carrier -> Default number of subnets: %u\n",
774 carrier->number_subnets);
775 }
777 "Carrier -> number of subnets: %u\n",
778 carrier->number_subnets);
780 section,
781 "CARRIER_PEERS",
782 (unsigned long long *) &carrier->number_peers))
783 {
784 carrier->number_peers = topology->default_carrier_peers;
786 "Carrier -> Default number of peers: %u\n",
787 carrier->number_peers);
788 }
790 "Carrier -> Default number of peers: %u\n",
791 carrier->number_peers);
792 create_peers (cfg, topology, carrier);
793 create_subnets (cfg, topology, carrier);
794
795 GNUNET_free (section);
796 }
797
799
800 return topology;
801}
802
803
1077 GNUNET_TESTING)
1078
1079
1080/* 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:66
struct GNUNET_HashCode key
The key used in the DHT.
static char * value
Value of the record to add/remove.
#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.
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.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create(void)
Create a new configuration object.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
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.
#define _(String)
GNU gettext support macro.
Definition: platform.h:178
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.
struct GNUNET_TESTING_NodeConnection * node_connections_tail
Tail of the DLL with the connections which shall be established to other nodes.
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_AddressPrefix * address_prefixes_tail
Tail of the DLL with the address prefixes for the protocols this node is reachable.
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.
int free_nodes_cb(void *cls, const struct GNUNET_ShortHashCode *key, void *value)
#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.
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)
int free_namespaces_cb(void *cls, const struct GNUNET_ShortHashCode *key, void *value)
#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 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.