GNUnet 0.21.2
testing_api_topology.h
Go to the documentation of this file.
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 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
27#ifndef NETJAIL_H
28#define NETJAIL_H
29
30#include "gnunet_util_lib.h"
31#include "gnunet_testing_lib.h"
32
33
38{
42 unsigned int tcp_port;
43
47 unsigned int udp_port;
48};
49
50
55{
60
65};
66
71{
76
81
86};
87
88
93
98{
103
108
113 unsigned int namespace_n;
114
118 unsigned int node_n;
119
124
129
134
139};
140
145{
150
155
159 char *plugin;
160
164 unsigned int is_global;
165
169 unsigned int namespace_n;
170
174 unsigned int node_n;
175
179 unsigned int node_number;
180
185
189 unsigned int expected_reaches;
190};
191
196{
200 unsigned int namespace_n;
201
206
211};
212
217{
221 unsigned int number;
222};
223
228{
232 unsigned int number;
233};
234
239{
243 unsigned int number;
244
248 unsigned int index;
249
253 unsigned int number_peers;
254
258 unsigned int number_subnets;
259
264
269};
270
275{
279 unsigned int number;
280
284 unsigned int index;
285
289 unsigned int number_peers;
290
295};
296
301{
305 unsigned int number;
306};
307
312{
313
317 unsigned long long default_subnets;
318
322 unsigned long long default_carrier_peers;
323
327 unsigned long long default_subnet_peers;
331 char *plugin;
332
336 unsigned long long num_backbone_peers;
337
341 unsigned long long num_carriers;
342
347
352
356 unsigned int total;
357
361 unsigned int namespaces_n;
362
366 unsigned int nodes_m;
367
371 unsigned int nodes_x;
372
377
382
387};
388
389
398
399
406unsigned int
408 unsigned int num,
409 struct GNUNET_TESTING_NetjailTopology *topology);
410
411
420GNUNET_TESTING_get_node (unsigned int num,
421 struct GNUNET_TESTING_NetjailTopology *topology);
422
423
433 unsigned int num,
434 const struct GNUNET_TESTING_NetjailTopology *topology);
435
436
444char *
446 struct GNUNET_TESTING_NodeConnection *connection,
447 const char *prefix);
448
449
453char *
456 const char *my_node_id);
457
458
464void
466
467
475unsigned int
477 struct GNUNET_TESTING_NodeConnection *node_connection,
478 struct GNUNET_TESTING_NetjailTopology *topology);
479
480
484#define GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS(op, prefix) \
485 op (prefix, topology, const struct GNUNET_TESTING_NetjailTopology) \
486 op (prefix, topology_string, const char) \
487 op (prefix, async_context, struct GNUNET_TESTING_AsyncContext) \
488 op (prefix, helper_handles, const struct GNUNET_HELPER_Handle *)
489
491 GNUNET_TESTING)
492
493
494#endif
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
static char * data
The data to insert into the dht.
Internal representation of the hash map.
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.
struct GNUNET_TESTING_AddressPrefix * prev
Pointer to the previous prefix in the DLL.
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.
unsigned int namespace_n
The number of the subnet.
struct GNUNET_CONTAINER_MultiShortmap * nodes
Hash map containing the nodes in this subnet.
struct GNUNET_TESTING_NetjailRouter * router
Router of the subnet.
Node in the netjail topology.
unsigned int namespace_n
The number of the subnet this node is running in.
unsigned int node_number
The overall number of the node in the whole test system.
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 expected_reaches
The number of cmds waiting for a specific barrier.
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.
API for writing an interpreter to test GNUnet components.
unsigned int tcp_port
Will tcp be forwarded?
unsigned int udp_port
Will udp be forwarded?
unsigned int number
Unique identifier this part of the topology can be identified.
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 int additional_connects
Additional connects we do expect, beside the connects which are configured in the topology.
unsigned long long num_backbone_peers
Default number of backbone peers.
Connection to another node.
struct GNUNET_TESTING_NodeConnection * prev
Pointer to the previous connection in the DLL.
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.
GNUNET_TESTING_NodeType
Enum for the different types of nodes.
@ GNUNET_TESTING_SUBNET_NODE
Node in a subnet.
@ GNUNET_TESTING_GLOBAL_NODE
Global known node.
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.
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.
struct GNUNET_TESTING_NetjailTopology * GNUNET_TESTING_get_topo_from_string_(const char *data)
Parse the topology data.
GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT(GNUNET_TESTING, topology, const struct GNUNET_TESTING_NetjailTopology) GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT(GNUNET_TESTING
struct GNUNET_TESTING_NetjailNode * GNUNET_TESTING_get_node(unsigned int num, struct GNUNET_TESTING_NetjailTopology *topology)
Get a node from the topology.
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.
void GNUNET_TESTING_free_topology(struct GNUNET_TESTING_NetjailTopology *topology)
Deallocate memory of the struct GNUNET_TESTING_NetjailTopology.
char * GNUNET_TESTING_get_address(struct GNUNET_TESTING_NodeConnection *connection, const char *prefix)
Get the address for a specific communicator from a connection.
#define GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS(op, prefix)
Call op on all simple traits.