aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_testing_ng_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_testing_ng_lib.h')
-rw-r--r--src/include/gnunet_testing_ng_lib.h179
1 files changed, 178 insertions, 1 deletions
diff --git a/src/include/gnunet_testing_ng_lib.h b/src/include/gnunet_testing_ng_lib.h
index 939863d67..a6f8429f4 100644
--- a/src/include/gnunet_testing_ng_lib.h
+++ b/src/include/gnunet_testing_ng_lib.h
@@ -47,6 +47,109 @@
47 } while (0) 47 } while (0)
48 48
49 49
50/**
51 * Router of a network namespace.
52 */
53struct GNUNET_TESTING_NetjailRouter
54{
55 /**
56 * Will tcp be forwarded?
57 */
58 unsigned int tcp_port;
59
60 /**
61 * Will udp be forwarded?
62 */
63 unsigned int udp_port;
64};
65
66
67/**
68 * Node in the netjail topology.
69 */
70struct GNUNET_TESTING_NetjailNode
71{
72 /**
73 * Plugin for the test case to be run on this node.
74 */
75 char *plugin;
76
77 /**
78 * Flag indicating if this node is a global known node.
79 */
80 unsigned int is_global;
81
82 /**
83 * The number of the namespace this node is running in.
84 */
85 unsigned int namespace_n;
86
87 /**
88 * The number of this node in the namespace.
89 */
90 unsigned int node_n;
91};
92
93
94/**
95 * Namespace in a topology.
96 */
97struct GNUNET_TESTING_NetjailNamespace
98{
99 /**
100 * The number of the namespace.
101 */
102 unsigned int namespace_n;
103
104 /**
105 * Router of the namespace.
106 */
107 struct GNUNET_TESTING_NetjailRouter *router;
108
109 /**
110 * Hash map containing the nodes in this namespace.
111 */
112 struct GNUNET_CONTAINER_MultiShortmap *nodes;
113};
114
115/**
116 * Toplogy of our netjail setup.
117 */
118struct GNUNET_TESTING_NetjailTopology
119{
120
121 /**
122 * Default plugin for the test case to be run on nodes.
123 */
124 char *plugin;
125
126 /**
127 * Number of namespaces.
128 */
129 unsigned int namespaces_n;
130
131 /**
132 * Number of nodes per namespace.
133 */
134 unsigned int nodes_m;
135
136 /**
137 * Number of global known nodes per namespace.
138 */
139 unsigned int nodes_x;
140
141 /**
142 * Hash map containing the namespaces (for natted nodes) of the topology.
143 */
144 struct GNUNET_CONTAINER_MultiShortmap *map_namespaces;
145
146 /**
147 * Hash map containing the global known nodes which are not natted.
148 */
149 struct GNUNET_CONTAINER_MultiShortmap *map_globals;
150};
151
152
50/* ******************* Generic interpreter logic ************ */ 153/* ******************* Generic interpreter logic ************ */
51 154
52/** 155/**
@@ -456,6 +559,16 @@ struct GNUNET_TESTING_Timer
456 559
457 560
458/** 561/**
562 * Getting the topology from file.
563 *
564 * @param filename The name of the topology file.
565 * @return The GNUNET_TESTING_NetjailTopology
566 */
567struct GNUNET_TESTING_NetjailTopology *
568GNUNET_TESTING_get_topo_from_file (const char *filename);
569
570
571/**
459 * Obtain performance data from the interpreter. 572 * Obtain performance data from the interpreter.
460 * 573 *
461 * @param timers what commands (by label) to obtain runtimes for 574 * @param timers what commands (by label) to obtain runtimes for
@@ -853,7 +966,8 @@ GNUNET_TESTING_cmd_system_destroy (const char *label,
853 * Create command. 966 * Create command.
854 * 967 *
855 * @param label name for command. 968 * @param label name for command.
856 * @param binaryname to start. 969 * @param local_m Number of local nodes in each namespace.
970 * @param global_n The number of namespaces.
857 * @return command. 971 * @return command.
858 */ 972 */
859struct GNUNET_TESTING_Command 973struct GNUNET_TESTING_Command
@@ -861,6 +975,17 @@ GNUNET_TESTING_cmd_netjail_start (const char *label,
861 char *local_m, 975 char *local_m,
862 char *global_n); 976 char *global_n);
863 977
978/**
979 * Create command.
980 *
981 * @param label name for command.
982 * @param topology_config Configuration file for the test topology.
983 * @return command.
984 */
985struct GNUNET_TESTING_Command
986GNUNET_TESTING_cmd_netjail_start_v2 (const char *label,
987 char *topology_config);
988
864 989
865/** 990/**
866 * Create command. 991 * Create command.
@@ -880,6 +1005,20 @@ GNUNET_TESTING_cmd_netjail_start_testing_system (const char *label,
880/** 1005/**
881 * Create command. 1006 * Create command.
882 * 1007 *
1008 * @param label Name for the command.
1009 * @param topology_config Configuration file for the test topology.
1010 * @param rv Pointer to the return value of the test.
1011 * @return command.
1012 */
1013struct GNUNET_TESTING_Command
1014GNUNET_TESTING_cmd_netjail_start_testing_system_v2 (const char *label,
1015 const char *topology_config,
1016 unsigned int *rv);
1017
1018
1019/**
1020 * Create command.
1021 *
883 * @param label name for command. 1022 * @param label name for command.
884 * @param binaryname to stop. 1023 * @param binaryname to stop.
885 * @return command. 1024 * @return command.
@@ -890,12 +1029,36 @@ GNUNET_TESTING_cmd_netjail_stop (const char *label,
890 char *global_n); 1029 char *global_n);
891 1030
892 1031
1032/**
1033 * Create command.
1034 *
1035 * @param label name for command.
1036 * @param topology_config Configuration file for the test topology.
1037 * @return command.
1038 */
1039struct GNUNET_TESTING_Command
1040GNUNET_TESTING_cmd_netjail_stop_v2 (const char *label,
1041 char *topology_config);
1042
1043
893struct GNUNET_TESTING_Command 1044struct GNUNET_TESTING_Command
894GNUNET_TESTING_cmd_stop_testing_system (const char *label, 1045GNUNET_TESTING_cmd_stop_testing_system (const char *label,
895 const char *helper_start_label, 1046 const char *helper_start_label,
896 char *local_m, 1047 char *local_m,
897 char *global_n); 1048 char *global_n);
898 1049
1050/**
1051 * Create command.
1052 *
1053 * @param label name for command.
1054 * @param topology_config Configuration file for the test topology.
1055 * @return command.
1056 */
1057struct GNUNET_TESTING_Command
1058GNUNET_TESTING_cmd_stop_testing_system_v2 (const char *label,
1059 const char *helper_start_label,
1060 const char *topology_config);
1061
899 1062
900int 1063int
901GNUNET_TESTING_get_trait_helper_handles (const struct 1064GNUNET_TESTING_get_trait_helper_handles (const struct
@@ -903,6 +1066,20 @@ GNUNET_TESTING_get_trait_helper_handles (const struct
903 struct GNUNET_HELPER_Handle ***helper); 1066 struct GNUNET_HELPER_Handle ***helper);
904 1067
905 1068
1069/**
1070 * Offer handles to testing cmd helper from trait
1071 *
1072 * @param cmd command to extract the message from.
1073 * @param pt pointer to message.
1074 * @return #GNUNET_OK on success.
1075 */
1076int
1077GNUNET_TESTING_get_trait_helper_handles_v2 (const struct
1078 GNUNET_TESTING_Command *cmd,
1079 struct GNUNET_HELPER_Handle ***
1080 helper);
1081
1082
906struct GNUNET_TESTING_Command 1083struct GNUNET_TESTING_Command
907GNUNET_TESTING_cmd_block_until_all_peers_started (const char *label, 1084GNUNET_TESTING_cmd_block_until_all_peers_started (const char *label,
908 unsigned int * 1085 unsigned int *