GNUnet 0.21.1
gnunet_testing_netjail_lib.h File Reference
Include dependency graph for gnunet_testing_netjail_lib.h:
This graph shows which files directly or indirectly include this file:

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...
 

Functions

struct GNUNET_TESTING_NetjailTopologyGNUNET_TESTING_get_topo_from_file (const char *filename)
 Getting the topology from file. More...
 
struct GNUNET_TESTING_NetjailTopologyGNUNET_TESTING_get_topo_from_string (const char *data)
 FIXME: this could use a "to_string". More...
 
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. More...
 
struct GNUNET_TESTING_NetjailNodeGNUNET_TESTING_get_node (unsigned int num, struct GNUNET_TESTING_NetjailTopology *topology)
 Get a node from the topology. More...
 
struct GNUNET_TESTING_NodeConnectionGNUNET_TESTING_get_connections (unsigned int num, const struct GNUNET_TESTING_NetjailTopology *topology)
 Get the connections to other nodes for a specific node. More...
 
char * GNUNET_TESTING_get_address (struct GNUNET_TESTING_NodeConnection *connection, const char *prefix)
 Get the address for a specific communicator from a connection. More...
 
void GNUNET_TESTING_free_topology (struct GNUNET_TESTING_NetjailTopology *topology)
 Deallocate memory of the struct GNUNET_TESTING_NetjailTopology. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_test_system (const struct GNUNET_TESTING_Command *cmd, const struct GNUNET_TESTING_System **ret)
 
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)
 
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)
 

Macro Definition Documentation

◆ GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS

#define GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS (   op,
  prefix 
)
Value:
op (prefix, test_system, const struct GNUNET_TESTING_System) \
op (prefix, async_context, struct GNUNET_TESTING_AsyncContext) \
op (prefix, helper_handles, const struct GNUNET_HELPER_Handle *) \
op (prefix, local_prepared_state, const struct GNUNET_TESTING_LocalPreparedState) \
op (prefix, block_state, struct GNUNET_TESTING_BlockState)
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
static int prefix
If printing the value of PREFIX has been requested.
Definition: gnunet-config.c:59
The handle to a helper process.
Definition: helper.c:77
State each asynchronous command must have in its closure.
Struct with information for callbacks.
Struct to hold information for callbacks.
Handle for a system on which GNUnet peers are executed; a system is used for reserving unique paths a...
Definition: testing.c:122

Call op on all simple traits.

Definition at line 536 of file gnunet_testing_netjail_lib.h.

Enumeration Type Documentation

◆ GNUNET_TESTING_NodeType

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.

55{
60
65};
@ GNUNET_TESTING_SUBNET_NODE
Node in a subnet.
@ GNUNET_TESTING_GLOBAL_NODE
Global known node.

Function Documentation

◆ GNUNET_TESTING_get_topo_from_file()

struct GNUNET_TESTING_NetjailTopology * GNUNET_TESTING_get_topo_from_file ( const char *  filename)

Getting the topology from file.

Parameters
filenameThe name of the topology file.
Returns
The GNUNET_TESTING_NetjailTopology

Definition at line 2786 of file testing.c.

2787{
2788 uint64_t fs;
2789 char *data;
2790 struct GNUNET_TESTING_NetjailTopology *topo;
2791
2793 {
2795 _ ("Topology file %s not found\n"),
2796 filename);
2797 return NULL;
2798 }
2799 if (GNUNET_OK !=
2801 {
2803 _ ("Topology file %s has no data\n"),
2804 filename);
2805 return NULL;
2806 }
2807 data = GNUNET_malloc (fs + 1);
2809 {
2811 _ ("Topology file %s cannot be read\n"),
2812 filename);
2813 GNUNET_free (data);
2814 return NULL;
2815 }
2816
2818 "file length %" PRIu64 "\n",
2819 fs);
2820 data[fs] = '\0';
2821
2823
2824 GNUNET_free (data);
2825
2826 return topo;
2827}
static char * data
The data to insert into the dht.
static char * filename
static struct GNUNET_FS_Handle * fs
Handle to FS service.
Definition: gnunet-fs.c:37
enum GNUNET_GenericReturnValue GNUNET_DISK_file_test(const char *fil)
Check that fil corresponds to a filename (of a file that exists and that is not a directory).
Definition: disk.c:482
enum GNUNET_GenericReturnValue GNUNET_DISK_file_size(const char *filename, uint64_t *size, int include_symbolic_links, int single_file_mode)
Get the size of the file (or directory) of the given file (in bytes).
Definition: disk.c:221
ssize_t GNUNET_DISK_fn_read(const char *fn, void *result, size_t len)
Read the contents of a binary file into a buffer.
Definition: disk.c:664
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
#define _(String)
GNU gettext support macro.
Definition: platform.h:178
struct GNUNET_TESTING_NetjailTopology * GNUNET_TESTING_get_topo_from_string(const char *input)
Parse the topology data.
Definition: testing.c:2515
#define LOG(kind,...)
Definition: testing.c:42

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.

Here is the call graph for this function:

◆ GNUNET_TESTING_get_topo_from_string()

struct GNUNET_TESTING_NetjailTopology * GNUNET_TESTING_get_topo_from_string ( const char *  input)

FIXME: this could use a "to_string".

Parse the topology data.

Parameters
dataThe topology data.
Returns
The GNUNET_TESTING_NetjailTopology

FIXME: this could use a "to_string".

Parameters
dataThe topology data.
Returns
The GNUNET_TESTING_NetjailTopology

Definition at line 2515 of file testing.c.

2516{
2517 char *token;
2518 char *key = NULL;
2519 unsigned int out;
2520 char *rest = NULL;
2521 char *value = NULL;
2522 char *value2;
2523 char *data;
2524 int ret;
2525 struct GNUNET_TESTING_NetjailTopology *topo;
2526 struct GNUNET_TESTING_NetjailRouter *router;
2527 struct GNUNET_TESTING_NetjailNamespace *namespace;
2528 struct GNUNET_HashCode hc;
2529
2530 data = GNUNET_strdup (input);
2531 token = strtok_r (data, "\n", &rest);
2533 topo->map_namespaces =
2535 topo->map_globals =
2537
2538 while (NULL != token)
2539 {
2540 if (NULL != key)
2541 GNUNET_free (key);
2542 key = get_key (token);
2544 "In the loop with token: %s beginning with %s\n",
2545 token,
2546 key);
2547 if (0 == strcmp (key, "M"))
2548 {
2550 "Get first Value for M.\n");
2551 out = get_first_value (token);
2553 "M: %u\n",
2554 out);
2555 topo->nodes_m = out;
2556 }
2557 else if (0 == strcmp (key, "N"))
2558 {
2560 "Get first Value for N.\n");
2561 out = get_first_value (token);
2563 "N: %u\n",
2564 out);
2565 topo->namespaces_n = out;
2566 }
2567 else if (0 == strcmp (key, "X"))
2568 {
2570 "Get first Value for X.\n");
2571 out = get_first_value (token);
2573 "X: %u\n",
2574 out);
2575 topo->nodes_x = out;
2576 }
2577 else if (0 == strcmp (key, "AC"))
2578 {
2580 "Get first Value for AC.\n");
2581 out = get_first_value (token);
2583 "AC: %u\n",
2584 out);
2585 topo->additional_connects = out;
2586 }
2587 else if (0 == strcmp (key, "T"))
2588 {
2590 "Get first string value for T.\n");
2591 value = get_first_string_value (token);
2593 "value: %s\n",
2594 value);
2595 topo->plugin = value;
2596 }
2597 else if (0 == strcmp (key, "K"))
2598 {
2599 struct GNUNET_ShortHashCode hkey_k;
2600 struct GNUNET_TESTING_NetjailNode *k_node = GNUNET_new (struct
2602
2604 "Get first Value for K.\n");
2605 out = get_first_value (token);
2607 "K: %u\n",
2608 out);
2609 k_node->node_n = out;
2610 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
2611 memcpy (&hkey_k,
2612 &hc,
2613 sizeof (hkey_k));
2614 k_node->is_global = GNUNET_YES;
2615
2617 topo->map_globals,
2618 &hkey_k))
2619 GNUNET_break (0);
2620 else
2622 &hkey_k,
2623 k_node,
2626 "Get value for key value on K.\n");
2627 value = get_value ("plugin", token);
2629 "value: %s\n",
2630 value);
2631 k_node->plugin = value;
2632 parse_ac (k_node, token);
2633 node_connections (token, k_node);
2635 }
2636 else if (0 == strcmp (key, "R"))
2637 {
2638 struct GNUNET_ShortHashCode hkey_r;
2639 router = GNUNET_new (struct GNUNET_TESTING_NetjailRouter);
2640
2642 "Get first Value for R.\n");
2643 out = get_first_value (token);
2645 "R: %u\n",
2646 out);
2647 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
2648 memcpy (&hkey_r,
2649 &hc,
2650 sizeof (hkey_r));
2652 "Get value for key tcp_port on R.\n");
2653 value = get_value ("tcp_port", token);
2655 "tcp_port: %s\n",
2656 value);
2657 ret = sscanf (value, "%u", &(router->tcp_port));
2659 GNUNET_break (0 != ret && 1 >= router->tcp_port);
2660
2662 "Get value for key udp_port on R.\n");
2663 value2 = get_value ("udp_port", token);
2664 ret = sscanf (value2, "%u", &(router->udp_port));
2665 GNUNET_free (value2);
2666 GNUNET_break (0 != ret && 1 >= router->udp_port);
2668 "udp_port: %s\n",
2669 value2);
2670 GNUNET_free (value2);
2672 topo->map_namespaces,
2673 &hkey_r))
2674 {
2675 namespace = GNUNET_CONTAINER_multishortmap_get (topo->map_namespaces,
2676 &hkey_r);
2677 }
2678 else
2679 {
2680 namespace = GNUNET_new (struct GNUNET_TESTING_NetjailNamespace);
2681 namespace->namespace_n = out;
2682 namespace->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
2684 &hkey_r,
2685 namespace,
2687 }
2688 namespace->router = router;
2689
2690 }
2691 else if (0 == strcmp (key, "P"))
2692 {
2693 struct GNUNET_TESTING_NetjailNode *p_node = GNUNET_new (struct
2695 struct GNUNET_ShortHashCode hkey_p;
2696
2698 "Get first Value for P.\n");
2699 out = get_first_value (token);
2701 "P: %u\n",
2702 out);
2703 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
2704 memcpy (&hkey_p,
2705 &hc,
2706 sizeof (hkey_p));
2707
2709 topo->map_namespaces,
2710 &hkey_p))
2711 {
2712 namespace = GNUNET_CONTAINER_multishortmap_get (topo->map_namespaces,
2713 &hkey_p);
2714 }
2715 else
2716 {
2717 namespace = GNUNET_new (struct GNUNET_TESTING_NetjailNamespace);
2718 namespace->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
2719 namespace->namespace_n = out;
2721 &hkey_p,
2722 namespace,
2724 }
2726 "Get second Value for P.\n");
2727 out = get_second_value (token);
2729 "P: %u\n",
2730 out);
2731 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
2732 memcpy (&hkey_p,
2733 &hc,
2734 sizeof (hkey_p));
2736 namespace->nodes,
2737 &hkey_p))
2738 {
2739 GNUNET_break (0);
2740 }
2741 else
2742 {
2743
2744 GNUNET_CONTAINER_multishortmap_put (namespace->nodes,
2745 &hkey_p,
2746 p_node,
2749 "Get value for key plugin on P.\n");
2750 value = get_value ("plugin", token);
2751 if (NULL != value)
2752 {
2754 "plugin: %s\n",
2755 value);
2756 p_node->plugin = value;
2757 }
2758 p_node->node_n = out;
2759 p_node->namespace_n = namespace->namespace_n;
2760 }
2762 "Get AC Value for P.\n");
2763 parse_ac (p_node, token);
2764 node_connections (token, p_node);
2765 }
2766 token = strtok_r (NULL, "\n", &rest);
2767 if (NULL != token)
2769 "Next token %s\n",
2770 token);
2771 }
2772 if (NULL != key)
2773 GNUNET_free (key);
2774 GNUNET_free (data);
2775 return topo;
2776}
static int ret
Final status code.
Definition: gnunet-arm.c:94
struct GNUNET_HashCode key
The key used in the DHT.
static char * value
Value of the record to add/remove.
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_contains(const struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key)
Check if the map contains any value under the given key (including values that are NULL).
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE
Allow multiple values with the same key.
@ GNUNET_NO
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
A 512-bit hashcode.
A 256-bit hashcode.
Node in the netjail topology.
unsigned int namespace_n
The number of the subnet this node is running in.
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.
API for writing an interpreter to test GNUnet components.
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.
static unsigned int get_first_value(const char *line)
Every line in the topology configuration starts with a string indicating which kind of information wi...
Definition: testing.c:1734
static void node_connections(const char *line, struct GNUNET_TESTING_NetjailNode *node)
Every line in the topology configuration starts with a string indicating which kind of information wi...
Definition: testing.c:2006
static char * get_key(const char *line)
Every line in the topology configuration starts with a string indicating which kind of information wi...
Definition: testing.c:1761
static char * get_value(const char *key, const char *line)
Every line in the topology configuration starts with a string indicating which kind of information wi...
Definition: testing.c:1857
static unsigned int get_second_value(const char *line)
Every line in the topology configuration starts with a string indicating which kind of information wi...
Definition: testing.c:1826
static char * get_first_string_value(const char *line)
Every line in the topology configuration starts with a string indicating which kind of information wi...
Definition: testing.c:1792
static void parse_ac(struct GNUNET_TESTING_NetjailNode *p_node, const char *token)
Definition: testing.c:2478

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTING_get_additional_connects()

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.

Parameters
numThe specific node we want the additional connects for.
Returns
The number of additional connects

Definition at line 2447 of file testing.c.

2450{
2451 struct GNUNET_TESTING_NetjailNode *node;
2452 struct GNUNET_TESTING_NetjailNamespace *namespace;
2454
2456 "get_additional_connects\n");
2457
2458 get_node_info (num, topology, &node, &namespace, &node_connections);
2459
2460 if (NULL == node)
2461 {
2463 "No info found for node %d\n", num);
2464 return 0;
2465 }
2467 "node additional_connects for node %p\n",
2468 node);
2470 "node additional_connects: %u\n",
2472
2473 return node->additional_connects;
2474}
@ GNUNET_ERROR_TYPE_WARNING
unsigned int additional_connects
The number of unintentional additional connections this node waits for.
struct GNUNET_TESTING_NetjailNode * node
The node which establish the connection.
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.
Definition: testing.c:2147

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTING_get_node()

struct GNUNET_TESTING_NetjailNode * GNUNET_TESTING_get_node ( unsigned int  num,
struct GNUNET_TESTING_NetjailTopology topology 
)

Get a node from the topology.

Parameters
numThe specific node we want the connections for.
topologyThe topology we get the connections from.
Returns
The connections of the node.

Definition at line 2229 of file testing.c.

2231{
2232 struct GNUNET_TESTING_NetjailNode *node;
2233 struct GNUNET_TESTING_NetjailNamespace *namespace;
2235
2236 get_node_info (num, topology, &node, &namespace, &node_connections);
2237
2238 return node;
2239
2240}

References get_node_info(), GNUNET_TESTING_NodeConnection::node, and node_connections().

Here is the call graph for this function:

◆ GNUNET_TESTING_get_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.

Parameters
numThe specific node we want the connections for.
topologyThe topology we get the connections from.
Returns
The connections of the node.

Definition at line 2251 of file testing.c.

2254{
2255 struct GNUNET_TESTING_NetjailNode *node;
2256 struct GNUNET_TESTING_NetjailNamespace *namespace;
2258
2260 "get_connections\n");
2261
2262 get_node_info (num, topology, &node, &namespace, &node_connections);
2263
2264 return node_connections;
2265}

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTING_get_address()

char * GNUNET_TESTING_get_address ( struct GNUNET_TESTING_NodeConnection connection,
const char *  prefix 
)

Get the address for a specific communicator from a connection.

Parameters
connectionThe connection we like to have the address from.
prefixThe communicator protocol prefix.
Returns
The address of the communicator.

Definition at line 2387 of file testing.c.

2389{
2390 struct GNUNET_TESTING_NetjailNode *node;
2391 char *addr;
2392 char *template;
2393 unsigned int node_n;
2394
2396 "get address prefix: %s node_n: %u\n",
2397 prefix,
2398 connection->node_n);
2399
2400 node = connection->node;
2401 if (connection->namespace_n == node->namespace_n)
2402 {
2403 template = CONNECT_ADDRESS_TEMPLATE;
2404 node_n = connection->node_n;
2405 }
2406 else if (0 == connection->namespace_n)
2407 {
2409 node_n = connection->node_n;
2410 }
2411 else if (1 == connection->node_n)
2412 {
2414 node_n = connection->namespace_n;
2415 }
2416 else
2417 {
2418 return NULL;
2419 }
2420
2421 if (0 == strcmp (PREFIX_TCP, prefix) ||
2422 0 == strcmp (PREFIX_UDP, prefix) ||
2423 0 == strcmp (PREFIX_UDP_NATTED, prefix) ||
2424 0 == strcmp (PREFIX_TCP_NATTED, prefix))
2425 {
2426 GNUNET_asprintf (&addr,
2427 template,
2428 prefix,
2429 node_n);
2430 }
2431 else
2432 {
2433 GNUNET_assert (0);
2434 }
2435
2436 return addr;
2437}
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
unsigned int node_n
The number of the node this connection points to.
unsigned int namespace_n
The number of the subnet of the node this connection points to.
#define PREFIX_UDP_NATTED
Definition: testing.c:68
#define PREFIX_TCP
Definition: testing.c:62
#define PREFIX_TCP_NATTED
Definition: testing.c:66
#define CONNECT_ADDRESS_TEMPLATE
Definition: testing.c:44
#define PREFIX_UDP
Definition: testing.c:64
#define KNOWN_CONNECT_ADDRESS_TEMPLATE
Definition: testing.c:48
#define ROUTER_CONNECT_ADDRESS_TEMPLATE
Definition: testing.c:46

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTING_free_topology()

void GNUNET_TESTING_free_topology ( struct GNUNET_TESTING_NetjailTopology topology)

Deallocate memory of the struct GNUNET_TESTING_NetjailTopology.

Parameters
topologyThe GNUNET_TESTING_NetjailTopology to be deallocated.

Definition at line 2347 of file testing.c.

2348{
2350 free_namespaces_cb, NULL);
2353 NULL);
2355 GNUNET_free (topology->plugin);
2356 GNUNET_free (topology);
2357}
int GNUNET_CONTAINER_multishortmap_iterate(struct GNUNET_CONTAINER_MultiShortmap *map, GNUNET_CONTAINER_ShortmapIterator it, void *it_cls)
Iterate over all entries in the map.
void GNUNET_CONTAINER_multishortmap_destroy(struct GNUNET_CONTAINER_MultiShortmap *map)
Destroy a hash map.
int free_nodes_cb(void *cls, const struct GNUNET_ShortHashCode *key, void *value)
Definition: testing.c:2294
int free_namespaces_cb(void *cls, const struct GNUNET_ShortHashCode *key, void *value)
Definition: testing.c:2326

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.

Here is the call graph for this function:

◆ GNUNET_TESTING_calculate_num()

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.

Parameters
node_connectionThe connection we calculate the id from.
topologyThe topology we get all needed information from.
Returns
The unique id of the node from the connection.

Definition at line 2361 of file testing.c.

2364{
2365 unsigned int n, m, num;
2366
2367 n = node_connection->namespace_n;
2368 m = node_connection->node_n;
2369
2370 if (0 == n)
2371 num = m;
2372 else
2373 num = (n - 1) * topology->nodes_m + m + topology->nodes_x;
2374
2375 return num;
2376}
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
Definition: gnunet-arm.c:104

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().

Here is the caller graph for this function:

◆ GNUNET_TESTING_cmd_system_destroy()

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.

Parameters
labelName for command.
create_labelLabel of the cmd which started the test system.
write_messageCallback to write messages to the master loop.
Returns
command.

This command destroys the ressources allocated for the test system setup.

Parameters
labelname for command.
create_labelLabel of the cmd which started the test system.
Returns
command.

Definition at line 101 of file testing_api_cmd_system_destroy.c.

103{
104 struct TestSystemState *tss;
105
106 tss = GNUNET_new (struct TestSystemState);
110 &system_destroy_traits, NULL);
111}
struct GNUNET_TESTING_Command GNUNET_TESTING_command_new(void *cls, const char *label, GNUNET_TESTING_CommandRunRoutine run, GNUNET_TESTING_CommandCleanupRoutine cleanup, GNUNET_TESTING_CommandGetTraits traits, struct GNUNET_TESTING_AsyncContext *ac)
Create a new command.
Struct to hold information for callbacks.
static void system_destroy_cleanup(void *cls)
The cleanup function of this cmd frees resources the cmd allocated.
static void system_destroy_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
The run method of this cmd will remove the test environment for a node.
static enum GNUNET_GenericReturnValue system_destroy_traits(void *cls, const void **ret, const char *trait, unsigned int index)
Trait function of this cmd does nothing.

References TestSystemState::create_label, GNUNET_new, GNUNET_TESTING_command_new(), system_destroy_cleanup(), system_destroy_run(), and system_destroy_traits().

Here is the call graph for this function:

◆ GNUNET_TESTING_cmd_system_create()

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.

Parameters
labelName for command.
testdirOnly 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.

Parameters
labelname for command.
labelname for the test environment directory.
Returns
command.

Definition at line 113 of file testing_api_cmd_system_create.c.

115{
116 struct TestSystemState *tss;
117
118 tss = GNUNET_new (struct TestSystemState);
119 tss->testdir = testdir;
120
123 &system_create_traits, NULL);
124}
static void system_create_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
The run method of this cmd will setup a test environment for a node.
static int system_create_traits(void *cls, const void **ret, const char *trait, unsigned int index)
This function prepares an array with traits.
static void system_create_cleanup(void *cls)
The cleanup function of this cmd frees resources the cmd allocated.

References GNUNET_new, GNUNET_TESTING_command_new(), system_create_cleanup(), system_create_run(), system_create_traits(), and TestSystemState::testdir.

Here is the call graph for this function:

◆ GNUNET_TESTING_cmd_netjail_start()

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.

Parameters
labelname for command.
topology_configConfiguration file for the test topology.
read_fileFlag indicating if the the name of the topology file is send to the helper, or a string with the topology data.
Returns
command.

This command executes a shell script to setup the netjail environment.

Parameters
labelname for command.
topology_configConfiguration file for the test topology.
Returns
command.

Definition at line 218 of file testing_api_cmd_netjail_start.c.

221{
222 struct NetJailState *ns;
223
224 ns = GNUNET_new (struct NetJailState);
225 ns->topology_config = topology_config;
226 ns->read_file = read_file;
227 return GNUNET_TESTING_command_new (ns, label,
230 NULL, &ns->ac);
231}
static struct GNUNET_NAMECACHE_Handle * ns
Handle to the namecache.
enum GNUNET_GenericReturnValue read_file(char const *const filename, char **buffer)
Definition: pabc_helper.c:71
Struct to hold information for callbacks.
char * topology_config
Configuration file for the test topology.
static void netjail_start_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
The run method starts the script which setup the network namespaces.
static void netjail_start_cleanup(void *cls)
The cleanup function of this cmd frees resources the cmd allocated.

References GNUNET_new, GNUNET_TESTING_command_new(), netjail_start_cleanup(), netjail_start_run(), ns, read_file(), and NetJailState::topology_config.

Here is the call graph for this function:

◆ GNUNET_TESTING_cmd_netjail_stop()

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.

Parameters
labelname for command.
topology_configConfiguration file for the test topology.
read_fileFlag indicating if the the name of the topology file is send to the helper, or a string with the topology data.
Returns
command.

Definition at line 187 of file testing_api_cmd_netjail_stop.c.

190{
191 struct NetJailState *ns;
192
193 ns = GNUNET_new (struct NetJailState);
194 ns->topology_config = topology_config;
195 ns->read_file = read_file;
196 return GNUNET_TESTING_command_new (ns, label,
199 NULL, &ns->ac);
200}
static void netjail_stop_cleanup(void *cls)
The cleanup function of this cmd frees resources the cmd allocated.
static void netjail_stop_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
The run method starts the script which deletes the network namespaces.

References GNUNET_new, GNUNET_TESTING_command_new(), netjail_stop_cleanup(), netjail_stop_run(), ns, read_file(), and NetJailState::topology_config.

Here is the call graph for this function:

◆ GNUNET_TESTING_cmd_netjail_start_cmds_helper()

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.

Parameters
labelName for the command.
topologyThe complete topology information.
read_fileFlag indicating if the the name of the topology file is send to the helper, or a string with the topology data.
topology_dataIf read_file is GNUNET_NO, topology_data holds the string with the topology.
timeoutBefore this timeout is reached this cmd MUST finish.
Returns
command.

This command executes a shell script which starts a helper process.

Parameters
labelName for the command.
topologyThe complete topology information.
read_fileFlag indicating if the the name of the topology file is send to the helper, or a string with the topology data.
topology_dataIf read_file is GNUNET_NO, topology_data holds the string with the topology.
timeoutBefore this timeout is reached this cmd MUST finish.
Returns
command.

Definition at line 893 of file testing_api_cmd_netjail_start_cmds_helper.c.

899{
900 struct NetJailState *ns;
901
902 ns = GNUNET_new (struct NetJailState);
903 ns->local_m = topology->nodes_m;
904 ns->global_n = topology->namespaces_n;
905 ns->known = topology->nodes_x;
906 ns->plugin_name = topology->plugin;
907 ns->topology = topology;
908 ns->read_file = read_file;
909 ns->topology_data = topology_data;
911
912 return GNUNET_TESTING_command_new (ns, label,
916 &ns->ac);
917}
static struct GNUNET_TIME_Relative timeout
User defined timestamp for completing operations.
Definition: gnunet-arm.c:119
struct GNUNET_TIME_Relative GNUNET_TIME_relative_subtract(struct GNUNET_TIME_Relative a1, struct GNUNET_TIME_Relative a2)
Subtract relative timestamp from the other.
Definition: time.c:603
struct GNUNET_TESTING_NetjailTopology * topology
The complete topology information.
char * topology_data
String with topology data or name of topology file.
static void netjail_exec_cleanup(void *cls)
Code to clean up resource this cmd used.
static void netjail_exec_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
This function starts a helper process for each node.
static enum GNUNET_GenericReturnValue netjail_exec_traits(void *cls, const void **ret, const char *trait, unsigned int index)
This function prepares an array with traits.

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.

Here is the call graph for this function:

◆ GNUNET_TESTING_cmd_stop_cmds_helper()

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.

Parameters
labelname for command.
helper_start_labellabel of the cmd to start the test system.
topologyThe complete topology information.
Returns
command.

Definition at line 139 of file testing_api_cmd_netjail_stop_cmds_helper.c.

143{
144 struct StopHelperState *shs;
145
146 shs = GNUNET_new (struct StopHelperState);
148 shs->local_m = topology->nodes_m;
150 shs->known = topology->nodes_x;
151 shs->topology = topology;
152
153 return GNUNET_TESTING_command_new (shs, label,
156 NULL, NULL);
157}
Struct to store information handed over to callbacks.
unsigned int known
Number of global known nodes.
struct GNUNET_TESTING_NetjailTopology * topology
The complete topology information.
static void stop_testing_system_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
This function stops the helper process for each node.
static void stop_testing_system_cleanup(void *cls)
Code to clean up resource this cmd used.

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.

Here is the call graph for this function:

◆ GNUNET_TESTING_cmd_block_until_external_trigger()

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.

Parameters
labelname for command.
Returns
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.

Parameters
labelname for command.
Returns
command.

Definition at line 106 of file testing_api_cmd_block_until_external_trigger.c.

108{
109 struct GNUNET_TESTING_BlockState *bs;
110
112 bs->label = label;
114 label,
118 &bs->ac);
119}
struct GNUNET_TESTING_AsyncContext ac
Context for our asynchronous completion.
const char * label
The label of this command.
static void block_until_all_peers_started_cleanup(void *cls)
The cleanup function of this cmd frees resources the cmd allocated.
static int block_until_external_trigger_traits(void *cls, const void **ret, const char *trait, unsigned int index)
static void block_until_all_peers_started_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
This function does nothing but to start the cmd.

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.

Here is the call graph for this function:

◆ GNUNET_TESTING_cmd_send_peer_ready()

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.

Parameters
labelname for command.
write_messageCallback to write messages to the master loop.
Returns
command.

DEPRECATED This command sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED message to the master loop.

Parameters
labelname for command.
write_messageCallback to write messages to the master loop.
Returns
command.

Definition at line 111 of file testing_api_cmd_send_peer_ready.c.

114{
115 struct SendPeerReadyState *sprs;
116
117 sprs = GNUNET_new (struct SendPeerReadyState);
119 return GNUNET_TESTING_command_new (sprs, label,
123}
static int write_message(uint16_t message_type, const char *data, size_t data_length)
Write message to the master process.
Struct to hold information for callbacks.
GNUNET_TESTING_cmd_helper_write_cb write_message
Callback to write messages to the master loop.
static void send_peer_ready_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
This function sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED message to the master loop.
static void send_peer_ready_cleanup(void *cls)
The cleanup function of this cmd frees resources the cmd allocated.
static enum GNUNET_GenericReturnValue send_peer_ready_traits(void *cls, const void **ret, const char *trait, unsigned int index)
Trait function of this cmd does nothing.

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.

Here is the call graph for this function:

◆ GNUNET_TESTING_cmd_local_test_prepared()

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.

Parameters
labelname for command.
write_messageCallback to write messages to the master loop.
Returns
command.

Definition at line 98 of file testing_api_cmd_local_test_prepared.c.

101{
103
106
107 return GNUNET_TESTING_command_new (lfs, label,
111 &lfs->ac);
112}
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.
static void local_test_prepared_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
This function sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TESTS_PREPARED message to the master loop...
enum GNUNET_GenericReturnValue local_test_prepared_traits(void *cls, const void **ret, const char *trait, unsigned int index)
This function prepares an array with traits.
static void local_test_prepared_cleanup(void *cls)
The cleanup function of this cmd frees resources the cmd allocated.

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().

Here is the call graph for this function:

◆ GNUNET_TESTING_cmd_start_peer()

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.

Parameters
labelname for command.
system_labelLabel of the cmd to setup a test environment.
noDecimal number representing the last byte of the IP address of this peer.
node_ipThe IP address of this node.
cfgnameConfiguration file name for this peer.
broadcastFlag indicating, if broadcast should be switched on.
Returns
command.

Definition at line 271 of file testing_api_cmd_start_peer.c.

277{
279 struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map =
281
283 sps->no = no;
284 sps->system_label = GNUNET_strdup (system_label);
285 sps->connected_peers_map = connected_peers_map;
286 sps->cfgname = GNUNET_strdup (cfgname);
287 sps->node_ip = GNUNET_strdup (node_ip);
288 sps->broadcast = broadcast;
289
290 return GNUNET_TESTING_command_new (sps,
291 label,
295 NULL);
296}
Internal representation of the hash map.
char * system_label
The label of the command which was started by calling GNUNET_TESTING_cmd_system_create.
unsigned int no
An unique number to identify the peer.
struct GNUNET_CONTAINER_MultiShortmap * connected_peers_map
A map with struct GNUNET_MQ_Handle values for each peer this peer is connected to.
enum GNUNET_GenericReturnValue broadcast
Flag indicating, if udp broadcast should be switched on.
char * cfgname
GNUnet configuration file used to start a peer.
static void start_peer_cleanup(void *cls)
The cleanup function of this cmd frees resources the cmd allocated.
static int start_peer_traits(void *cls, const void **ret, const char *trait, unsigned int index)
This function prepares an array with traits.
static void start_peer_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
The run method of this cmd will start all services of a peer to test the transport service.

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.

Here is the call graph for this function:

◆ GNUNET_TESTING_get_trait_test_system()

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().

Here is the caller graph for this function:

◆ GNUNET_TESTING_make_trait_test_system()

struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_test_system ( const struct GNUNET_TESTING_System value)

Referenced by system_create_traits().

Here is the caller graph for this function:

◆ GNUNET_TESTING_get_trait_async_context()

enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_async_context ( const struct GNUNET_TESTING_Command cmd,
struct GNUNET_TESTING_AsyncContext **  ret 
)

◆ GNUNET_TESTING_make_trait_async_context()

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().

Here is the caller graph for this function:

◆ GNUNET_TESTING_get_trait_helper_handles()

enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_helper_handles ( const struct GNUNET_TESTING_Command cmd,
const struct GNUNET_HELPER_Handle ***  ret 
)

Referenced by stop_testing_system_run().

Here is the caller graph for this function:

◆ GNUNET_TESTING_make_trait_helper_handles()

struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_helper_handles ( const struct GNUNET_HELPER_Handle **  value)

Referenced by netjail_exec_traits().

Here is the caller graph for this function:

◆ GNUNET_TESTING_get_trait_local_prepared_state()

enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_local_prepared_state ( const struct GNUNET_TESTING_Command cmd,
const struct GNUNET_TESTING_LocalPreparedState **  ret 
)

◆ GNUNET_TESTING_make_trait_local_prepared_state()

struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_local_prepared_state ( const struct GNUNET_TESTING_LocalPreparedState value)

Referenced by local_test_prepared_traits().

Here is the caller graph for this function:

◆ GNUNET_TESTING_get_trait_block_state()

enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_block_state ( const struct GNUNET_TESTING_Command cmd,
struct GNUNET_TESTING_BlockState **  ret 
)

◆ GNUNET_TESTING_make_trait_block_state()

struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_block_state ( struct GNUNET_TESTING_BlockState value)

Referenced by block_until_external_trigger_traits().

Here is the caller graph for this function: