Go to the source code of this file.
Data Structures | |
struct | GNUNET_TESTING_NetjailRouter |
API for writing an interpreter to test GNUnet components. More... | |
struct | GNUNET_TESTING_AddressPrefix |
Protocol address prefix für a connection between nodes. More... | |
struct | GNUNET_TESTING_NodeConnection |
Connection to another node. More... | |
struct | GNUNET_TESTING_NetjailNode |
Node in the netjail topology. More... | |
struct | GNUNET_TESTING_NetjailNamespace |
Subnet in a topology. More... | |
struct | GNUNET_TESTING_NetjailTopology |
Toplogy of our netjail setup. More... | |
struct | GNUNET_TESTING_BlockState |
Struct with information for callbacks. More... | |
struct | GNUNET_TESTING_LocalPreparedState |
Struct to hold information for callbacks. More... | |
Macros | |
#define | GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS(op, prefix) |
Call op on all simple traits. More... | |
Enumerations | |
enum | GNUNET_TESTING_NodeType { GNUNET_TESTING_SUBNET_NODE , GNUNET_TESTING_GLOBAL_NODE } |
Enum for the different types of nodes. More... | |
Call op on all simple traits.
Definition at line 536 of file gnunet_testing_netjail_lib.h.
Enum for the different types of nodes.
Enumerator | |
---|---|
GNUNET_TESTING_SUBNET_NODE | Node in a subnet. |
GNUNET_TESTING_GLOBAL_NODE | Global known node. |
Definition at line 54 of file gnunet_testing_netjail_lib.h.
struct GNUNET_TESTING_NetjailTopology * GNUNET_TESTING_get_topo_from_file | ( | const char * | filename | ) |
Getting the topology from file.
filename | The name of the topology file. |
Definition at line 2786 of file testing.c.
References _, data, filename, fs, GNUNET_DISK_file_size(), GNUNET_DISK_file_test(), GNUNET_DISK_fn_read(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_malloc, GNUNET_OK, GNUNET_TESTING_get_topo_from_string(), GNUNET_YES, and LOG.
struct GNUNET_TESTING_NetjailTopology * GNUNET_TESTING_get_topo_from_string | ( | const char * | input | ) |
FIXME: this could use a "to_string".
Parse the topology data.
data | The topology data. |
FIXME: this could use a "to_string".
data | The topology data. |
Definition at line 2515 of file testing.c.
References GNUNET_TESTING_NetjailTopology::additional_connects, data, get_first_string_value(), get_first_value(), get_key(), get_second_value(), get_value(), GNUNET_break, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_multishortmap_contains(), GNUNET_CONTAINER_multishortmap_create(), GNUNET_CONTAINER_multishortmap_get(), GNUNET_CONTAINER_multishortmap_put(), GNUNET_CRYPTO_hash(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_new, GNUNET_NO, GNUNET_strdup, GNUNET_YES, GNUNET_TESTING_NetjailNode::is_global, key, LOG, GNUNET_TESTING_NetjailTopology::map_globals, GNUNET_TESTING_NetjailTopology::map_namespaces, GNUNET_TESTING_NetjailNode::namespace_n, GNUNET_TESTING_NetjailTopology::namespaces_n, node_connections(), GNUNET_TESTING_NetjailNode::node_n, GNUNET_TESTING_NetjailTopology::nodes_m, GNUNET_TESTING_NetjailTopology::nodes_x, parse_ac(), GNUNET_TESTING_NetjailNode::plugin, GNUNET_TESTING_NetjailTopology::plugin, ret, GNUNET_TESTING_NetjailRouter::tcp_port, GNUNET_TESTING_NetjailRouter::udp_port, and value.
Referenced by GNUNET_TESTING_get_topo_from_file().
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.
num | The specific node we want the additional connects for. |
Definition at line 2447 of file testing.c.
References GNUNET_TESTING_NetjailNode::additional_connects, get_node_info(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, LOG, and node_connections().
Referenced by GNUNET_CORE_cmd_connect_peers(), and GNUNET_TRANSPORT_cmd_connect_peers().
struct GNUNET_TESTING_NetjailNode * GNUNET_TESTING_get_node | ( | unsigned int | num, |
struct GNUNET_TESTING_NetjailTopology * | topology | ||
) |
Get a node from the topology.
num | The specific node we want the connections for. |
topology | The topology we get the connections from. |
Definition at line 2229 of file testing.c.
References get_node_info(), GNUNET_TESTING_NodeConnection::node, and node_connections().
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.
num | The specific node we want the connections for. |
topology | The topology we get the connections from. |
Definition at line 2251 of file testing.c.
References get_node_info(), GNUNET_ERROR_TYPE_DEBUG, LOG, GNUNET_TESTING_NodeConnection::node, and node_connections().
Referenced by backchannel_check_run(), and connect_peers_run().
char * GNUNET_TESTING_get_address | ( | struct GNUNET_TESTING_NodeConnection * | connection, |
const char * | prefix | ||
) |
Get the address for a specific communicator from a connection.
connection | The connection we like to have the address from. |
prefix | The communicator protocol prefix. |
Definition at line 2387 of file testing.c.
References CONNECT_ADDRESS_TEMPLATE, GNUNET_asprintf(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, KNOWN_CONNECT_ADDRESS_TEMPLATE, LOG, GNUNET_TESTING_NodeConnection::namespace_n, GNUNET_TESTING_NetjailNode::namespace_n, GNUNET_TESTING_NodeConnection::node, GNUNET_TESTING_NodeConnection::node_n, GNUNET_TESTING_NetjailNode::node_n, prefix, PREFIX_TCP, PREFIX_TCP_NATTED, PREFIX_UDP, PREFIX_UDP_NATTED, and ROUTER_CONNECT_ADDRESS_TEMPLATE.
Referenced by connect_peers_run().
void GNUNET_TESTING_free_topology | ( | struct GNUNET_TESTING_NetjailTopology * | topology | ) |
Deallocate memory of the struct GNUNET_TESTING_NetjailTopology.
topology | The GNUNET_TESTING_NetjailTopology to be deallocated. |
Definition at line 2347 of file testing.c.
References free_namespaces_cb(), free_nodes_cb(), GNUNET_CONTAINER_multishortmap_destroy(), GNUNET_CONTAINER_multishortmap_iterate(), GNUNET_free, GNUNET_TESTING_NetjailTopology::map_globals, GNUNET_TESTING_NetjailTopology::map_namespaces, and GNUNET_TESTING_NetjailTopology::plugin.
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.
node_connection | The connection we calculate the id from. |
topology | The topology we get all needed information from. |
Definition at line 2361 of file testing.c.
References m, GNUNET_TESTING_NodeConnection::namespace_n, GNUNET_TESTING_NodeConnection::node_n, GNUNET_TESTING_NetjailTopology::nodes_m, and GNUNET_TESTING_NetjailTopology::nodes_x.
Referenced by connect_peers_run(), and notify_connect().
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_system_destroy | ( | const char * | label, |
const char * | create_label | ||
) |
This command destroys the ressources allocated for the test system setup.
label | Name for command. |
create_label | Label of the cmd which started the test system. |
write_message | Callback to write messages to the master loop. |
This command destroys the ressources allocated for the test system setup.
label | name for command. |
create_label | Label of the cmd which started the test system. |
Definition at line 101 of file testing_api_cmd_system_destroy.c.
References TestSystemState::create_label, GNUNET_new, GNUNET_TESTING_command_new(), system_destroy_cleanup(), system_destroy_run(), and system_destroy_traits().
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_system_create | ( | const char * | label, |
const char * | testdir | ||
) |
This command is setting up a test environment for a peer to start.
label | Name for command. |
testdir | Only the directory name without any path. Temporary directory used for all service homes. |
This command is setting up a test environment for a peer to start.
label | name for command. |
label | name for the test environment directory. |
Definition at line 113 of file testing_api_cmd_system_create.c.
References GNUNET_new, GNUNET_TESTING_command_new(), system_create_cleanup(), system_create_run(), system_create_traits(), and TestSystemState::testdir.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_netjail_start | ( | const char * | label, |
char * | topology_config, | ||
unsigned int * | read_file | ||
) |
This command executes a shell script to setup the netjail environment.
label | name for command. |
topology_config | Configuration file for the test topology. |
read_file | Flag indicating if the the name of the topology file is send to the helper, or a string with the topology data. |
This command executes a shell script to setup the netjail environment.
label | name for command. |
topology_config | Configuration file for the test topology. |
Definition at line 218 of file testing_api_cmd_netjail_start.c.
References GNUNET_new, GNUNET_TESTING_command_new(), netjail_start_cleanup(), netjail_start_run(), ns, read_file(), and NetJailState::topology_config.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_netjail_stop | ( | const char * | label, |
char * | topology_config, | ||
unsigned int * | read_file | ||
) |
This command executes a shell script to remove the netjail environment.
label | name for command. |
topology_config | Configuration file for the test topology. |
read_file | Flag indicating if the the name of the topology file is send to the helper, or a string with the topology data. |
Definition at line 187 of file testing_api_cmd_netjail_stop.c.
References GNUNET_new, GNUNET_TESTING_command_new(), netjail_stop_cleanup(), netjail_stop_run(), ns, read_file(), and NetJailState::topology_config.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_netjail_start_cmds_helper | ( | const char * | label, |
struct GNUNET_TESTING_NetjailTopology * | topology, | ||
unsigned int * | read_file, | ||
char * | topology_data, | ||
struct GNUNET_TIME_Relative | timeout | ||
) |
This command executes a shell script which starts a helper process.
This process is running on a netjail node, executing a defined test case.
label | Name for the command. |
topology | The complete topology information. |
read_file | Flag indicating if the the name of the topology file is send to the helper, or a string with the topology data. |
topology_data | If read_file is GNUNET_NO, topology_data holds the string with the topology. |
timeout | Before this timeout is reached this cmd MUST finish. |
This command executes a shell script which starts a helper process.
label | Name for the command. |
topology | The complete topology information. |
read_file | Flag indicating if the the name of the topology file is send to the helper, or a string with the topology data. |
topology_data | If read_file is GNUNET_NO, topology_data holds the string with the topology. |
timeout | Before this timeout is reached this cmd MUST finish. |
Definition at line 893 of file testing_api_cmd_netjail_start_cmds_helper.c.
References GNUNET_new, GNUNET_TESTING_command_new(), GNUNET_TIME_relative_subtract(), GNUNET_TESTING_NetjailTopology::namespaces_n, netjail_exec_cleanup(), netjail_exec_run(), netjail_exec_traits(), GNUNET_TESTING_NetjailTopology::nodes_m, GNUNET_TESTING_NetjailTopology::nodes_x, ns, GNUNET_TESTING_NetjailTopology::plugin, read_file(), timeout, TIMEOUT, NetJailState::topology, and NetJailState::topology_data.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_stop_cmds_helper | ( | const char * | label, |
const char * | helper_start_label, | ||
struct GNUNET_TESTING_NetjailTopology * | topology | ||
) |
Create command.
label | name for command. |
helper_start_label | label of the cmd to start the test system. |
topology | The complete topology information. |
Definition at line 139 of file testing_api_cmd_netjail_stop_cmds_helper.c.
References StopHelperState::global_n, GNUNET_new, GNUNET_TESTING_command_new(), StopHelperState::helper_start_label, StopHelperState::known, StopHelperState::local_m, GNUNET_TESTING_NetjailTopology::namespaces_n, GNUNET_TESTING_NetjailTopology::nodes_m, GNUNET_TESTING_NetjailTopology::nodes_x, stop_testing_system_cleanup(), stop_testing_system_run(), and StopHelperState::topology.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_block_until_external_trigger | ( | const char * | label | ) |
This command is used to block the loop, until the command is finished by other commands, using a trait to get this commands struct GNUNET_TESTING_AsyncContext.
label | name for command. |
This command is used to block the loop, until the command is finished by other commands, using a trait to get this commands struct GNUNET_TESTING_AsyncContext.
label | name for command. |
Definition at line 106 of file testing_api_cmd_block_until_external_trigger.c.
References GNUNET_TESTING_BlockState::ac, block_until_all_peers_started_cleanup(), block_until_all_peers_started_run(), block_until_external_trigger_traits(), GNUNET_new, GNUNET_TESTING_command_new(), and GNUNET_TESTING_BlockState::label.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_send_peer_ready | ( | const char * | label, |
GNUNET_TESTING_cmd_helper_write_cb | write_message | ||
) |
DEPRECATED This command sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED message to the master loop.
label | name for command. |
write_message | Callback to write messages to the master loop. |
DEPRECATED This command sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED message to the master loop.
label | name for command. |
write_message | Callback to write messages to the master loop. |
Definition at line 111 of file testing_api_cmd_send_peer_ready.c.
References GNUNET_new, GNUNET_TESTING_command_new(), send_peer_ready_cleanup(), send_peer_ready_run(), send_peer_ready_traits(), write_message(), and SendPeerReadyState::write_message.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_local_test_prepared | ( | const char * | label, |
GNUNET_TESTING_cmd_helper_write_cb | write_message | ||
) |
This command sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TESTS_PREPARED message to the master loop.
label | name for command. |
write_message | Callback to write messages to the master loop. |
Definition at line 98 of file testing_api_cmd_local_test_prepared.c.
References GNUNET_TESTING_LocalPreparedState::ac, GNUNET_new, GNUNET_TESTING_command_new(), local_test_prepared_cleanup(), local_test_prepared_run(), local_test_prepared_traits(), GNUNET_TESTING_LocalPreparedState::write_message, and write_message().
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_start_peer | ( | const char * | label, |
const char * | system_label, | ||
uint32_t | no, | ||
const char * | node_ip, | ||
const char * | cfgname, | ||
unsigned int | broadcast | ||
) |
Create command.
label | name for command. |
system_label | Label of the cmd to setup a test environment. |
no | Decimal number representing the last byte of the IP address of this peer. |
node_ip | The IP address of this node. |
cfgname | Configuration file name for this peer. |
broadcast | Flag indicating, if broadcast should be switched on. |
Definition at line 271 of file testing_api_cmd_start_peer.c.
References GNUNET_TESTING_StartPeerState::broadcast, GNUNET_TESTING_StartPeerState::cfgname, GNUNET_TESTING_StartPeerState::connected_peers_map, GNUNET_CONTAINER_multishortmap_create(), GNUNET_new, GNUNET_NO, GNUNET_strdup, GNUNET_TESTING_command_new(), GNUNET_TESTING_StartPeerState::no, GNUNET_TESTING_StartPeerState::node_ip, start_peer_cleanup(), start_peer_run(), start_peer_traits(), and GNUNET_TESTING_StartPeerState::system_label.
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_test_system | ( | const struct GNUNET_TESTING_Command * | cmd, |
const struct GNUNET_TESTING_System ** | ret | ||
) |
Referenced by backchannel_check_run(), connect_peers_run(), send_simple_run(), start_peer_run(), start_service_run(), and system_destroy_run().
struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_test_system | ( | const struct GNUNET_TESTING_System * | value | ) |
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_async_context | ( | const struct GNUNET_TESTING_Command * | cmd, |
struct GNUNET_TESTING_AsyncContext ** | ret | ||
) |
struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_async_context | ( | struct GNUNET_TESTING_AsyncContext * | value | ) |
Referenced by barrier_reached_traits(), and block_until_external_trigger_traits().
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_helper_handles | ( | const struct GNUNET_TESTING_Command * | cmd, |
const struct GNUNET_HELPER_Handle *** | ret | ||
) |
struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_helper_handles | ( | const struct GNUNET_HELPER_Handle ** | value | ) |
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_local_prepared_state | ( | const struct GNUNET_TESTING_Command * | cmd, |
const struct GNUNET_TESTING_LocalPreparedState ** | ret | ||
) |
struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_local_prepared_state | ( | const struct GNUNET_TESTING_LocalPreparedState * | value | ) |
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_block_state | ( | const struct GNUNET_TESTING_Command * | cmd, |
struct GNUNET_TESTING_BlockState ** | ret | ||
) |
struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_block_state | ( | struct GNUNET_TESTING_BlockState * | value | ) |