diff options
Diffstat (limited to 'src/transport/transport-testing-cmds.h')
-rw-r--r-- | src/transport/transport-testing-cmds.h | 233 |
1 files changed, 232 insertions, 1 deletions
diff --git a/src/transport/transport-testing-cmds.h b/src/transport/transport-testing-cmds.h index 1461a3d4d..f9ebafade 100644 --- a/src/transport/transport-testing-cmds.h +++ b/src/transport/transport-testing-cmds.h | |||
@@ -28,12 +28,195 @@ | |||
28 | #define TRANSPORT_TESTING_CMDS_H | 28 | #define TRANSPORT_TESTING_CMDS_H |
29 | #include "gnunet_testing_lib.h" | 29 | #include "gnunet_testing_lib.h" |
30 | 30 | ||
31 | |||
32 | struct StartPeerState_v2 | ||
33 | { | ||
34 | /** | ||
35 | * The ip of a node. | ||
36 | */ | ||
37 | char *node_ip; | ||
38 | |||
39 | /** | ||
40 | * Receive callback | ||
41 | */ | ||
42 | struct GNUNET_MQ_MessageHandler *handlers; | ||
43 | |||
44 | const char *cfgname; | ||
45 | |||
46 | /** | ||
47 | * Peer's configuration | ||
48 | */ | ||
49 | struct GNUNET_CONFIGURATION_Handle *cfg; | ||
50 | |||
51 | struct GNUNET_TESTING_Peer *peer; | ||
52 | |||
53 | /** | ||
54 | * Peer identity | ||
55 | */ | ||
56 | struct GNUNET_PeerIdentity id; | ||
57 | |||
58 | /** | ||
59 | * Peer's transport service handle | ||
60 | */ | ||
61 | struct GNUNET_TRANSPORT_CoreHandle *th; | ||
62 | |||
63 | /** | ||
64 | * Application handle | ||
65 | */ | ||
66 | struct GNUNET_TRANSPORT_ApplicationHandle *ah; | ||
67 | |||
68 | /** | ||
69 | * Peer's PEERSTORE Handle | ||
70 | */ | ||
71 | struct GNUNET_PEERSTORE_Handle *ph; | ||
72 | |||
73 | /** | ||
74 | * Hello get task | ||
75 | */ | ||
76 | struct GNUNET_SCHEDULER_Task *rh_task; | ||
77 | |||
78 | /** | ||
79 | * Peer's transport get hello handle to retrieve peer's HELLO message | ||
80 | */ | ||
81 | struct GNUNET_PEERSTORE_IterateContext *pic; | ||
82 | |||
83 | /** | ||
84 | * Hello | ||
85 | */ | ||
86 | char *hello; | ||
87 | |||
88 | /** | ||
89 | * Hello size | ||
90 | */ | ||
91 | size_t hello_size; | ||
92 | |||
93 | char *m; | ||
94 | |||
95 | char *n; | ||
96 | |||
97 | char *local_m; | ||
98 | |||
99 | unsigned int finished; | ||
100 | |||
101 | const char *system_label; | ||
102 | |||
103 | /** | ||
104 | * An unique number to identify the peer | ||
105 | */ | ||
106 | unsigned int no; | ||
107 | |||
108 | struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map; | ||
109 | |||
110 | struct GNUNET_TESTING_System *tl_system; | ||
111 | |||
112 | }; | ||
113 | |||
114 | |||
115 | struct StartPeerState | ||
116 | { | ||
117 | /** | ||
118 | * The ip of a node. | ||
119 | */ | ||
120 | char *node_ip; | ||
121 | |||
122 | /** | ||
123 | * Receive callback | ||
124 | */ | ||
125 | struct GNUNET_MQ_MessageHandler *handlers; | ||
126 | |||
127 | const char *cfgname; | ||
128 | |||
129 | /** | ||
130 | * Peer's configuration | ||
131 | */ | ||
132 | struct GNUNET_CONFIGURATION_Handle *cfg; | ||
133 | |||
134 | struct GNUNET_TESTING_Peer *peer; | ||
135 | |||
136 | /** | ||
137 | * Peer identity | ||
138 | */ | ||
139 | struct GNUNET_PeerIdentity id; | ||
140 | |||
141 | /** | ||
142 | * Peer's transport service handle | ||
143 | */ | ||
144 | struct GNUNET_TRANSPORT_CoreHandle *th; | ||
145 | |||
146 | /** | ||
147 | * Application handle | ||
148 | */ | ||
149 | struct GNUNET_TRANSPORT_ApplicationHandle *ah; | ||
150 | |||
151 | /** | ||
152 | * Peer's PEERSTORE Handle | ||
153 | */ | ||
154 | struct GNUNET_PEERSTORE_Handle *ph; | ||
155 | |||
156 | /** | ||
157 | * Hello get task | ||
158 | */ | ||
159 | struct GNUNET_SCHEDULER_Task *rh_task; | ||
160 | |||
161 | /** | ||
162 | * Peer's transport get hello handle to retrieve peer's HELLO message | ||
163 | */ | ||
164 | struct GNUNET_PEERSTORE_IterateContext *pic; | ||
165 | |||
166 | /** | ||
167 | * Hello | ||
168 | */ | ||
169 | char *hello; | ||
170 | |||
171 | /** | ||
172 | * Hello size | ||
173 | */ | ||
174 | size_t hello_size; | ||
175 | |||
176 | char *m; | ||
177 | |||
178 | char *n; | ||
179 | |||
180 | char *local_m; | ||
181 | |||
182 | unsigned int finished; | ||
183 | |||
184 | const char *system_label; | ||
185 | |||
186 | /** | ||
187 | * An unique number to identify the peer | ||
188 | */ | ||
189 | unsigned int no; | ||
190 | |||
191 | struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map; | ||
192 | |||
193 | struct GNUNET_TESTING_System *tl_system; | ||
194 | |||
195 | }; | ||
196 | |||
197 | |||
198 | int | ||
199 | GNUNET_TRANSPORT_get_trait_state (const struct | ||
200 | GNUNET_TESTING_Command | ||
201 | *cmd, | ||
202 | struct StartPeerState **sps); | ||
203 | |||
204 | |||
205 | struct GNUNET_TESTING_Command | ||
206 | GNUNET_TRANSPORT_cmd_start_peer_v2 (const char *label, | ||
207 | const char *system_label, | ||
208 | uint32_t no, | ||
209 | char *node_ip, | ||
210 | struct GNUNET_MQ_MessageHandler *handlers, | ||
211 | const char *cfgname); | ||
212 | |||
31 | struct GNUNET_TESTING_Command | 213 | struct GNUNET_TESTING_Command |
32 | GNUNET_TRANSPORT_cmd_start_peer (const char *label, | 214 | GNUNET_TRANSPORT_cmd_start_peer (const char *label, |
33 | const char *system_label, | 215 | const char *system_label, |
34 | char *m, | 216 | char *m, |
35 | char *n, | 217 | char *n, |
36 | char *local_m, | 218 | char *local_m, |
219 | char *node_ip, | ||
37 | struct GNUNET_MQ_MessageHandler *handlers, | 220 | struct GNUNET_MQ_MessageHandler *handlers, |
38 | const char *cfgname); | 221 | const char *cfgname); |
39 | 222 | ||
@@ -43,7 +226,15 @@ GNUNET_TRANSPORT_cmd_stop_peer (const char *label, | |||
43 | 226 | ||
44 | struct GNUNET_TESTING_Command | 227 | struct GNUNET_TESTING_Command |
45 | GNUNET_TRANSPORT_cmd_connect_peers (const char *label, | 228 | GNUNET_TRANSPORT_cmd_connect_peers (const char *label, |
46 | const char *start_peer_label); | 229 | const char *start_peer_label, |
230 | const char *create_label, | ||
231 | uint32_t num); | ||
232 | |||
233 | struct GNUNET_TESTING_Command | ||
234 | GNUNET_TRANSPORT_cmd_connect_peers_v2 (const char *label, | ||
235 | const char *start_peer_label, | ||
236 | const char *create_label, | ||
237 | uint32_t num); | ||
47 | 238 | ||
48 | struct GNUNET_TESTING_Command | 239 | struct GNUNET_TESTING_Command |
49 | GNUNET_TRANSPORT_cmd_send_simple (const char *label, | 240 | GNUNET_TRANSPORT_cmd_send_simple (const char *label, |
@@ -52,6 +243,21 @@ GNUNET_TRANSPORT_cmd_send_simple (const char *label, | |||
52 | uint32_t num, | 243 | uint32_t num, |
53 | const char *start_peer_label); | 244 | const char *start_peer_label); |
54 | 245 | ||
246 | /** | ||
247 | * Create command. | ||
248 | * | ||
249 | * @param label name for command. | ||
250 | * @param m The number of the local node of the actual network namespace. | ||
251 | * @param n The number of the actual namespace. | ||
252 | * @param num Number globally identifying the node. | ||
253 | * @param start_peer_label Label of the cmd to start a peer. | ||
254 | * @return command. | ||
255 | */ | ||
256 | struct GNUNET_TESTING_Command | ||
257 | GNUNET_TRANSPORT_cmd_send_simple_v2 (const char *label, | ||
258 | const char *start_peer_label, | ||
259 | uint32_t num); | ||
260 | |||
55 | int | 261 | int |
56 | GNUNET_TRANSPORT_get_trait_peer_id (const struct | 262 | GNUNET_TRANSPORT_get_trait_peer_id (const struct |
57 | GNUNET_TESTING_Command *cmd, | 263 | GNUNET_TESTING_Command *cmd, |
@@ -65,6 +271,16 @@ GNUNET_TRANSPORT_get_trait_connected_peers_map (const struct | |||
65 | GNUNET_CONTAINER_MultiShortmap * | 271 | GNUNET_CONTAINER_MultiShortmap * |
66 | * | 272 | * |
67 | connected_peers_map); | 273 | connected_peers_map); |
274 | |||
275 | int | ||
276 | GNUNET_TRANSPORT_get_trait_connected_peers_map_v2 (const struct | ||
277 | GNUNET_TESTING_Command | ||
278 | *cmd, | ||
279 | struct | ||
280 | GNUNET_CONTAINER_MultiShortmap | ||
281 | * | ||
282 | * | ||
283 | connected_peers_map); | ||
68 | int | 284 | int |
69 | GNUNET_TRANSPORT_get_trait_hello_size (const struct | 285 | GNUNET_TRANSPORT_get_trait_hello_size (const struct |
70 | GNUNET_TESTING_Command | 286 | GNUNET_TESTING_Command |
@@ -77,5 +293,20 @@ GNUNET_TRANSPORT_get_trait_hello (const struct | |||
77 | *cmd, | 293 | *cmd, |
78 | char **hello); | 294 | char **hello); |
79 | 295 | ||
296 | |||
297 | int | ||
298 | GNUNET_TRANSPORT_get_trait_application_handle (const struct | ||
299 | GNUNET_TESTING_Command *cmd, | ||
300 | struct | ||
301 | GNUNET_TRANSPORT_ApplicationHandle | ||
302 | **ah); | ||
303 | |||
304 | int | ||
305 | GNUNET_TRANSPORT_get_trait_application_handle_v2 (const struct | ||
306 | GNUNET_TESTING_Command *cmd, | ||
307 | struct | ||
308 | GNUNET_TRANSPORT_ApplicationHandle | ||
309 | **ah); | ||
310 | |||
80 | #endif | 311 | #endif |
81 | /* end of transport_testing.h */ | 312 | /* end of transport_testing.h */ |