27 #ifndef GNUNET_TESTING_NETJAIL_LIB_H
28 #define GNUNET_TESTING_NETJAIL_LIB_H
396 const char *create_label);
407 const char *testdir);
420 char *topology_config,
434 char *topology_config,
469 const char *helper_start_label,
516 #define GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS(op) \
517 op (test_system, const struct GNUNET_TESTING_System) \
518 op (async_context, const struct GNUNET_TESTING_AsyncContext) \
519 op (helper_handles, const struct GNUNET_HELPER_Handle *) \
520 op (local_prepared_state, const struct GNUNET_TESTING_LocalPreparedState) \
521 op (block_state, const struct GNUNET_TESTING_BlockState)
enum GNUNET_TESTBED_TopologyOption topology
The topology to generate.
static struct GNUNET_TIME_Relative timeout
Desired timeout for the lookup (default is no timeout).
static int prefix
If printing the value of PREFIX has been requested.
static int write_message(uint16_t message_type, const char *data, size_t data_length)
Write message to the master process.
uint32_t data
The data value.
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.
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.
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.
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.
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.
#define GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS(op)
Call op on all simple traits.
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_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,...
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 lo...
struct GNUNET_TESTING_NetjailTopology * GNUNET_TESTING_get_topo_from_string(const char *data)
FIXME: this could use a "to_string".
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.
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.
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.
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.
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_file(const char *filename)
Getting the topology from file.
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.
void GNUNET_TESTING_free_topology(struct GNUNET_TESTING_NetjailTopology *topology)
Deallocate memory of the struct GNUNET_TESTING_NetjailTopology.
#define GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT(name, type)
Create headers for a trait with name name for statically allocated data of type type.
void(* GNUNET_TESTING_cmd_helper_write_cb)(struct GNUNET_MessageHeader *message, size_t msg_length)
Callback function to write messages from the helper process running on a netjail node to the master p...
enum GNUNET_GenericReturnValue read_file(char const *const filename, char **buffer)
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.
State each asynchronous command must have in its closure.
Struct with information for callbacks.
struct GNUNET_TESTING_AsyncContext ac
Context for our asynchronous completion.
unsigned int asynchronous_finish
If this command will block.
const char * label
The label of this command.
A command to be run by the interpreter.
char label[127+1]
Label for the command.
Struct to hold information for callbacks.
struct GNUNET_TESTING_AsyncContext ac
Context for our asynchronous completion.
GNUNET_TESTING_cmd_helper_write_cb write_message
Callback to write messages to the master loop.
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.
Router of a netjail subnet.
unsigned int tcp_port
Will tcp be forwarded?
unsigned int udp_port
Will udp be forwarded?
Toplogy of our netjail setup.
struct GNUNET_CONTAINER_MultiShortmap * map_globals
Hash map containing the global known nodes which are not natted.
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 int namespaces_n
Number of subnets.
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.
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 protocolls 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 protocolls this node is reachable.
enum GNUNET_TESTING_NodeType node_type
The type of the node this connection points to.
Time for relative time used by GNUnet, in microseconds.