diff options
Diffstat (limited to 'src/experimentation')
5 files changed, 163 insertions, 163 deletions
diff --git a/src/experimentation/gnunet-daemon-experimentation.h b/src/experimentation/gnunet-daemon-experimentation.h index 9886f5d5d..86e41a114 100644 --- a/src/experimentation/gnunet-daemon-experimentation.h +++ b/src/experimentation/gnunet-daemon-experimentation.h | |||
@@ -89,54 +89,54 @@ struct Experiment | |||
89 | /* Header */ | 89 | /* Header */ |
90 | /* ----------------- */ | 90 | /* ----------------- */ |
91 | char *name; | 91 | char *name; |
92 | 92 | ||
93 | /** | 93 | /** |
94 | * Experiment issuer | 94 | * Experiment issuer |
95 | */ | 95 | */ |
96 | struct GNUNET_CRYPTO_EccPublicSignKey issuer; | 96 | struct GNUNET_CRYPTO_EccPublicSignKey issuer; |
97 | 97 | ||
98 | /** | 98 | /** |
99 | * Experiment version as timestamp of creation | 99 | * Experiment version as timestamp of creation |
100 | */ | 100 | */ |
101 | struct GNUNET_TIME_Absolute version; | 101 | struct GNUNET_TIME_Absolute version; |
102 | 102 | ||
103 | /** | 103 | /** |
104 | * Description | 104 | * Description |
105 | */ | 105 | */ |
106 | char *description; | 106 | char *description; |
107 | 107 | ||
108 | /** | 108 | /** |
109 | * Required capabilities | 109 | * Required capabilities |
110 | */ | 110 | */ |
111 | uint32_t required_capabilities; | 111 | uint32_t required_capabilities; |
112 | 112 | ||
113 | /* Experiment timing */ | 113 | /* Experiment timing */ |
114 | /* ----------------- */ | 114 | /* ----------------- */ |
115 | 115 | ||
116 | /** | 116 | /** |
117 | * When to start experiment | 117 | * When to start experiment |
118 | */ | 118 | */ |
119 | struct GNUNET_TIME_Absolute start; | 119 | struct GNUNET_TIME_Absolute start; |
120 | 120 | ||
121 | /** | 121 | /** |
122 | * When to end experiment | 122 | * When to end experiment |
123 | */ | 123 | */ |
124 | struct GNUNET_TIME_Absolute stop; | 124 | struct GNUNET_TIME_Absolute stop; |
125 | 125 | ||
126 | /** | 126 | /** |
127 | * How often to run experiment | 127 | * How often to run experiment |
128 | */ | 128 | */ |
129 | struct GNUNET_TIME_Relative frequency; | 129 | struct GNUNET_TIME_Relative frequency; |
130 | 130 | ||
131 | /** | 131 | /** |
132 | * How long to run each execution | 132 | * How long to run each execution |
133 | */ | 133 | */ |
134 | struct GNUNET_TIME_Relative duration; | 134 | struct GNUNET_TIME_Relative duration; |
135 | 135 | ||
136 | 136 | ||
137 | /* Experiment itself */ | 137 | /* Experiment itself */ |
138 | /* ----------------- */ | 138 | /* ----------------- */ |
139 | 139 | ||
140 | /* TBD */ | 140 | /* TBD */ |
141 | }; | 141 | }; |
142 | 142 | ||
@@ -150,34 +150,34 @@ struct Node | |||
150 | * Peer id | 150 | * Peer id |
151 | */ | 151 | */ |
152 | struct GNUNET_PeerIdentity id; | 152 | struct GNUNET_PeerIdentity id; |
153 | 153 | ||
154 | /** | 154 | /** |
155 | * Task for response timeout | 155 | * Task for response timeout |
156 | */ | 156 | */ |
157 | GNUNET_SCHEDULER_TaskIdentifier timeout_task; | 157 | GNUNET_SCHEDULER_TaskIdentifier timeout_task; |
158 | 158 | ||
159 | /** | 159 | /** |
160 | * Core transmission handle | 160 | * Core transmission handle |
161 | */ | 161 | */ |
162 | struct GNUNET_CORE_TransmitHandle *cth; | 162 | struct GNUNET_CORE_TransmitHandle *cth; |
163 | 163 | ||
164 | /** | 164 | /** |
165 | * Node capabilities | 165 | * Node capabilities |
166 | */ | 166 | */ |
167 | uint32_t capabilities; | 167 | uint32_t capabilities; |
168 | 168 | ||
169 | /** | 169 | /** |
170 | * Experiment version as timestamp of creation | 170 | * Experiment version as timestamp of creation |
171 | */ | 171 | */ |
172 | struct GNUNET_TIME_Absolute version; | 172 | struct GNUNET_TIME_Absolute version; |
173 | 173 | ||
174 | struct NodeComCtx *e_req_head; | 174 | struct NodeComCtx *e_req_head; |
175 | 175 | ||
176 | struct NodeComCtx *e_req_tail; | 176 | struct NodeComCtx *e_req_tail; |
177 | 177 | ||
178 | /** | 178 | /** |
179 | * Array of issuers accepted by this neighbor. | 179 | * Array of issuers accepted by this neighbor. |
180 | */ | 180 | */ |
181 | struct GNUNET_CRYPTO_EccPublicSignKey *issuer_id; | 181 | struct GNUNET_CRYPTO_EccPublicSignKey *issuer_id; |
182 | 182 | ||
183 | unsigned int issuer_count; | 183 | unsigned int issuer_count; |
@@ -198,9 +198,9 @@ GNUNET_NETWORK_STRUCT_BEGIN | |||
198 | struct Experimentation_Request | 198 | struct Experimentation_Request |
199 | { | 199 | { |
200 | struct GNUNET_MessageHeader msg; | 200 | struct GNUNET_MessageHeader msg; |
201 | 201 | ||
202 | uint32_t capabilities GNUNET_PACKED; | 202 | uint32_t capabilities GNUNET_PACKED; |
203 | 203 | ||
204 | uint32_t issuer_count GNUNET_PACKED; | 204 | uint32_t issuer_count GNUNET_PACKED; |
205 | }; | 205 | }; |
206 | 206 | ||
@@ -215,9 +215,9 @@ struct Experimentation_Request | |||
215 | struct Experimentation_Response | 215 | struct Experimentation_Response |
216 | { | 216 | { |
217 | struct GNUNET_MessageHeader msg; | 217 | struct GNUNET_MessageHeader msg; |
218 | 218 | ||
219 | uint32_t capabilities GNUNET_PACKED; | 219 | uint32_t capabilities GNUNET_PACKED; |
220 | 220 | ||
221 | uint32_t issuer_count GNUNET_PACKED; | 221 | uint32_t issuer_count GNUNET_PACKED; |
222 | }; | 222 | }; |
223 | 223 | ||
@@ -233,7 +233,7 @@ struct Issuer | |||
233 | 233 | ||
234 | /** | 234 | /** |
235 | * Hashmap containing valid experiment issuers | 235 | * Hashmap containing valid experiment issuers |
236 | * (the key is the hash of the respective public key, | 236 | * (the key is the hash of the respective public key, |
237 | * the values are of type `struct Issuer'). | 237 | * the values are of type `struct Issuer'). |
238 | */ | 238 | */ |
239 | struct GNUNET_CONTAINER_MultiHashMap *valid_issuers; | 239 | struct GNUNET_CONTAINER_MultiHashMap *valid_issuers; |
@@ -246,19 +246,19 @@ struct GNUNET_CONTAINER_MultiHashMap *valid_issuers; | |||
246 | struct GED_start_message | 246 | struct GED_start_message |
247 | { | 247 | { |
248 | struct GNUNET_MessageHeader header; | 248 | struct GNUNET_MessageHeader header; |
249 | 249 | ||
250 | /** | 250 | /** |
251 | * String length of experiment name following the struct | 251 | * String length of experiment name following the struct |
252 | */ | 252 | */ |
253 | uint32_t len_name GNUNET_PACKED; | 253 | uint32_t len_name GNUNET_PACKED; |
254 | 254 | ||
255 | /** | 255 | /** |
256 | * Experiment issuer | 256 | * Experiment issuer |
257 | */ | 257 | */ |
258 | struct GNUNET_CRYPTO_EccPublicSignKey issuer; | 258 | struct GNUNET_CRYPTO_EccPublicSignKey issuer; |
259 | 259 | ||
260 | /** | 260 | /** |
261 | * Experiment version as timestamp of creation | 261 | * Experiment version as timestamp of creation |
262 | */ | 262 | */ |
263 | struct GNUNET_TIME_AbsoluteNBO version_nbo; | 263 | struct GNUNET_TIME_AbsoluteNBO version_nbo; |
264 | }; | 264 | }; |
@@ -267,19 +267,19 @@ struct GED_start_message | |||
267 | struct GED_start_ack_message | 267 | struct GED_start_ack_message |
268 | { | 268 | { |
269 | struct GNUNET_MessageHeader header; | 269 | struct GNUNET_MessageHeader header; |
270 | 270 | ||
271 | /** | 271 | /** |
272 | * String length of experiment name following the struct | 272 | * String length of experiment name following the struct |
273 | */ | 273 | */ |
274 | uint32_t len_name GNUNET_PACKED; | 274 | uint32_t len_name GNUNET_PACKED; |
275 | 275 | ||
276 | /** | 276 | /** |
277 | * Experiment issuer | 277 | * Experiment issuer |
278 | */ | 278 | */ |
279 | struct GNUNET_CRYPTO_EccPublicSignKey issuer; | 279 | struct GNUNET_CRYPTO_EccPublicSignKey issuer; |
280 | 280 | ||
281 | /** | 281 | /** |
282 | * Experiment version as timestamp of creation | 282 | * Experiment version as timestamp of creation |
283 | */ | 283 | */ |
284 | struct GNUNET_TIME_AbsoluteNBO version_nbo; | 284 | struct GNUNET_TIME_AbsoluteNBO version_nbo; |
285 | }; | 285 | }; |
@@ -288,19 +288,19 @@ struct GED_start_ack_message | |||
288 | struct GED_stop_message | 288 | struct GED_stop_message |
289 | { | 289 | { |
290 | struct GNUNET_MessageHeader header; | 290 | struct GNUNET_MessageHeader header; |
291 | 291 | ||
292 | /** | 292 | /** |
293 | * String length of experiment name following the struct | 293 | * String length of experiment name following the struct |
294 | */ | 294 | */ |
295 | uint32_t len_name GNUNET_PACKED; | 295 | uint32_t len_name GNUNET_PACKED; |
296 | 296 | ||
297 | /** | 297 | /** |
298 | * Experiment issuer | 298 | * Experiment issuer |
299 | */ | 299 | */ |
300 | struct GNUNET_CRYPTO_EccPublicSignKey issuer; | 300 | struct GNUNET_CRYPTO_EccPublicSignKey issuer; |
301 | 301 | ||
302 | /** | 302 | /** |
303 | * Experiment version as timestamp of creation | 303 | * Experiment version as timestamp of creation |
304 | */ | 304 | */ |
305 | struct GNUNET_TIME_AbsoluteNBO version_nbo; | 305 | struct GNUNET_TIME_AbsoluteNBO version_nbo; |
306 | }; | 306 | }; |
@@ -396,7 +396,7 @@ GED_experiments_find (const struct GNUNET_CRYPTO_EccPublicSignKey *issuer, | |||
396 | const struct GNUNET_TIME_Absolute version); | 396 | const struct GNUNET_TIME_Absolute version); |
397 | 397 | ||
398 | 398 | ||
399 | typedef void (*GNUNET_EXPERIMENTATION_experiments_get_cb) (struct Node *n, | 399 | typedef void (*GNUNET_EXPERIMENTATION_experiments_get_cb) (struct Node *n, |
400 | struct Experiment *e); | 400 | struct Experiment *e); |
401 | 401 | ||
402 | 402 | ||
@@ -461,7 +461,7 @@ GED_scheduler_handle_stop (struct Node *n, struct Experiment *e); | |||
461 | */ | 461 | */ |
462 | void | 462 | void |
463 | GED_scheduler_add (struct Node *n, | 463 | GED_scheduler_add (struct Node *n, |
464 | struct Experiment *e, | 464 | struct Experiment *e, |
465 | int outbound); | 465 | int outbound); |
466 | 466 | ||
467 | 467 | ||
diff --git a/src/experimentation/gnunet-daemon-experimentation_experiments.c b/src/experimentation/gnunet-daemon-experimentation_experiments.c index b4db5188b..928502cf5 100644 --- a/src/experimentation/gnunet-daemon-experimentation_experiments.c +++ b/src/experimentation/gnunet-daemon-experimentation_experiments.c | |||
@@ -54,14 +54,14 @@ experiment_verify (struct Issuer *i, struct Experiment *e) | |||
54 | { | 54 | { |
55 | GNUNET_assert (NULL != i); | 55 | GNUNET_assert (NULL != i); |
56 | GNUNET_assert (NULL != e); | 56 | GNUNET_assert (NULL != e); |
57 | 57 | ||
58 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 58 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
59 | "Verification: to be implemented\n"); | 59 | "Verification: to be implemented\n"); |
60 | return GNUNET_OK; | 60 | return GNUNET_OK; |
61 | } | 61 | } |
62 | 62 | ||
63 | 63 | ||
64 | static int | 64 | static int |
65 | free_experiment (void *cls, | 65 | free_experiment (void *cls, |
66 | const struct GNUNET_HashCode * key, | 66 | const struct GNUNET_HashCode * key, |
67 | void *value) | 67 | void *value) |
@@ -84,15 +84,15 @@ free_experiment (void *cls, | |||
84 | * @param value the issuer element to free | 84 | * @param value the issuer element to free |
85 | * @return GNUNET_OK to continue | 85 | * @return GNUNET_OK to continue |
86 | */ | 86 | */ |
87 | static int | 87 | static int |
88 | free_issuer (void *cls, | 88 | free_issuer (void *cls, |
89 | const struct GNUNET_HashCode * key, | 89 | const struct GNUNET_HashCode * key, |
90 | void *value) | 90 | void *value) |
91 | { | 91 | { |
92 | struct Issuer *i = value; | 92 | struct Issuer *i = value; |
93 | 93 | ||
94 | GNUNET_break (0 == GNUNET_CONTAINER_multihashmap_remove (valid_issuers, | 94 | GNUNET_break (0 == GNUNET_CONTAINER_multihashmap_remove (valid_issuers, |
95 | key, | 95 | key, |
96 | i)); | 96 | i)); |
97 | GNUNET_free (i); | 97 | GNUNET_free (i); |
98 | return GNUNET_OK; | 98 | return GNUNET_OK; |
@@ -149,8 +149,8 @@ GED_experiments_find (const struct GNUNET_CRYPTO_EccPublicSignKey *issuer, | |||
149 | const struct GNUNET_TIME_Absolute version) | 149 | const struct GNUNET_TIME_Absolute version) |
150 | { | 150 | { |
151 | struct GNUNET_HashCode hc; | 151 | struct GNUNET_HashCode hc; |
152 | 152 | ||
153 | get_experiment_key (issuer, | 153 | get_experiment_key (issuer, |
154 | name, | 154 | name, |
155 | version, | 155 | version, |
156 | &hc); | 156 | &hc); |
@@ -180,7 +180,7 @@ get_it (void *cls, | |||
180 | if (0 == memcmp (&e->issuer, | 180 | if (0 == memcmp (&e->issuer, |
181 | get_ctx->issuer, | 181 | get_ctx->issuer, |
182 | sizeof (struct GNUNET_CRYPTO_EccPublicSignKey))) | 182 | sizeof (struct GNUNET_CRYPTO_EccPublicSignKey))) |
183 | get_ctx->get_cb (get_ctx->n, e); | 183 | get_ctx->get_cb (get_ctx->n, e); |
184 | return GNUNET_OK; | 184 | return GNUNET_OK; |
185 | } | 185 | } |
186 | 186 | ||
@@ -222,7 +222,7 @@ GNUNET_EXPERIMENTATION_experiments_add (struct Issuer *i, | |||
222 | struct Experiment *e; | 222 | struct Experiment *e; |
223 | struct GNUNET_HashCode hc; | 223 | struct GNUNET_HashCode hc; |
224 | 224 | ||
225 | e = GNUNET_new (struct Experiment); | 225 | e = GNUNET_new (struct Experiment); |
226 | e->name = GNUNET_strdup (name); | 226 | e->name = GNUNET_strdup (name); |
227 | e->issuer = *issuer_id; | 227 | e->issuer = *issuer_id; |
228 | e->version = version; | 228 | e->version = version; |
@@ -233,20 +233,20 @@ GNUNET_EXPERIMENTATION_experiments_add (struct Issuer *i, | |||
233 | e->frequency = frequency; | 233 | e->frequency = frequency; |
234 | e->duration = duration; | 234 | e->duration = duration; |
235 | e->stop = stop; | 235 | e->stop = stop; |
236 | 236 | ||
237 | /* verify experiment */ | 237 | /* verify experiment */ |
238 | if (GNUNET_SYSERR == experiment_verify (i, e)) | 238 | if (GNUNET_SYSERR == experiment_verify (i, e)) |
239 | { | 239 | { |
240 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 240 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
241 | _("Experiment `%s': Experiment signature is invalid\n"), | 241 | _("Experiment `%s': Experiment signature is invalid\n"), |
242 | name); | 242 | name); |
243 | GNUNET_free (e); | 243 | GNUNET_free (e); |
244 | GNUNET_free_non_null (e->name); | 244 | GNUNET_free_non_null (e->name); |
245 | GNUNET_free_non_null (e->description); | 245 | GNUNET_free_non_null (e->description); |
246 | return GNUNET_SYSERR; | 246 | return GNUNET_SYSERR; |
247 | } | 247 | } |
248 | 248 | ||
249 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 249 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
250 | _("Adding experiment `%s' running from `%s' to `%s' every %llu sec. for %llu sec. \n"), | 250 | _("Adding experiment `%s' running from `%s' to `%s' every %llu sec. for %llu sec. \n"), |
251 | e->name, | 251 | e->name, |
252 | GNUNET_STRINGS_absolute_time_to_string (start), | 252 | GNUNET_STRINGS_absolute_time_to_string (start), |
@@ -259,12 +259,12 @@ GNUNET_EXPERIMENTATION_experiments_add (struct Issuer *i, | |||
259 | &hc); | 259 | &hc); |
260 | GNUNET_CONTAINER_multihashmap_put (experiments, | 260 | GNUNET_CONTAINER_multihashmap_put (experiments, |
261 | &hc, | 261 | &hc, |
262 | e, | 262 | e, |
263 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 263 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
264 | GNUNET_STATISTICS_set (GED_stats, | 264 | GNUNET_STATISTICS_set (GED_stats, |
265 | "# experiments", | 265 | "# experiments", |
266 | GNUNET_CONTAINER_multihashmap_size (experiments), GNUNET_NO); | 266 | GNUNET_CONTAINER_multihashmap_size (experiments), GNUNET_NO); |
267 | 267 | ||
268 | return GNUNET_OK; | 268 | return GNUNET_OK; |
269 | } | 269 | } |
270 | 270 | ||
@@ -293,9 +293,9 @@ exp_file_iterator (void *cls, | |||
293 | struct GNUNET_TIME_Relative frequency; | 293 | struct GNUNET_TIME_Relative frequency; |
294 | struct GNUNET_TIME_Relative duration; | 294 | struct GNUNET_TIME_Relative duration; |
295 | struct GNUNET_HashCode phash; | 295 | struct GNUNET_HashCode phash; |
296 | 296 | ||
297 | /* Mandatory fields */ | 297 | /* Mandatory fields */ |
298 | 298 | ||
299 | /* Issuer */ | 299 | /* Issuer */ |
300 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (exp, name, "ISSUER", &val)) | 300 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (exp, name, "ISSUER", &val)) |
301 | { | 301 | { |
@@ -303,8 +303,8 @@ exp_file_iterator (void *cls, | |||
303 | _("Experiment `%s': Issuer missing\n"), name); | 303 | _("Experiment `%s': Issuer missing\n"), name); |
304 | return; | 304 | return; |
305 | } | 305 | } |
306 | if (GNUNET_SYSERR == | 306 | if (GNUNET_SYSERR == |
307 | GNUNET_CRYPTO_ecc_public_sign_key_from_string (val, | 307 | GNUNET_CRYPTO_ecc_public_sign_key_from_string (val, |
308 | strlen (val), | 308 | strlen (val), |
309 | &issuer)) | 309 | &issuer)) |
310 | { | 310 | { |
@@ -322,20 +322,20 @@ exp_file_iterator (void *cls, | |||
322 | return; | 322 | return; |
323 | } | 323 | } |
324 | GNUNET_free (val); | 324 | GNUNET_free (val); |
325 | 325 | ||
326 | /* Version */ | 326 | /* Version */ |
327 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "VERSION", &number)) | 327 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "VERSION", &number)) |
328 | { | 328 | { |
329 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 329 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
330 | _("Experiment `%s': Version missing or invalid \n"), name); | 330 | _("Experiment `%s': Version missing or invalid \n"), name); |
331 | return; | 331 | return; |
332 | } | 332 | } |
333 | version.abs_value_us = number; // FIXME: what is this supposed to be? Version != TIME!??? | 333 | version.abs_value_us = number; // FIXME: what is this supposed to be? Version != TIME!??? |
334 | 334 | ||
335 | /* Required capabilities */ | 335 | /* Required capabilities */ |
336 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "CAPABILITIES", &number)) | 336 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "CAPABILITIES", &number)) |
337 | { | 337 | { |
338 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 338 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
339 | _("Experiment `%s': Required capabilities missing \n"), name); | 339 | _("Experiment `%s': Required capabilities missing \n"), name); |
340 | return; | 340 | return; |
341 | } | 341 | } |
@@ -346,23 +346,23 @@ exp_file_iterator (void *cls, | |||
346 | return; | 346 | return; |
347 | } | 347 | } |
348 | required_capabilities = number; | 348 | required_capabilities = number; |
349 | 349 | ||
350 | /* Optional fields */ | 350 | /* Optional fields */ |
351 | 351 | ||
352 | /* Description */ | 352 | /* Description */ |
353 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (exp, name, "DESCRIPTION", &description)) | 353 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (exp, name, "DESCRIPTION", &description)) |
354 | description = NULL; | 354 | description = NULL; |
355 | 355 | ||
356 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "START", (long long unsigned int *) &start.abs_value_us)) | 356 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "START", (long long unsigned int *) &start.abs_value_us)) |
357 | start = GNUNET_TIME_UNIT_ZERO_ABS; | 357 | start = GNUNET_TIME_UNIT_ZERO_ABS; |
358 | 358 | ||
359 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (exp, name, "FREQUENCY", &frequency)) | 359 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (exp, name, "FREQUENCY", &frequency)) |
360 | frequency = EXP_DEFAULT_EXP_FREQ; | 360 | frequency = EXP_DEFAULT_EXP_FREQ; |
361 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (exp, name, "DURATION", &duration)) | 361 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (exp, name, "DURATION", &duration)) |
362 | duration = EXP_DEFAULT_EXP_DUR; | 362 | duration = EXP_DEFAULT_EXP_DUR; |
363 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "STOP", (long long unsigned int *)&stop.abs_value_us)) | 363 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "STOP", (long long unsigned int *)&stop.abs_value_us)) |
364 | stop = GNUNET_TIME_UNIT_FOREVER_ABS; | 364 | stop = GNUNET_TIME_UNIT_FOREVER_ABS; |
365 | 365 | ||
366 | GNUNET_EXPERIMENTATION_experiments_add (i, name, &issuer, version, | 366 | GNUNET_EXPERIMENTATION_experiments_add (i, name, &issuer, version, |
367 | description, required_capabilities, | 367 | description, required_capabilities, |
368 | start, frequency, duration, stop); | 368 | start, frequency, duration, stop); |
@@ -382,12 +382,12 @@ load_file (const char * file) | |||
382 | 382 | ||
383 | if (NULL == exp) | 383 | if (NULL == exp) |
384 | return; | 384 | return; |
385 | 385 | ||
386 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_parse (exp, file)) | 386 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_parse (exp, file)) |
387 | { | 387 | { |
388 | GNUNET_CONFIGURATION_destroy (exp); | 388 | GNUNET_CONFIGURATION_destroy (exp); |
389 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 389 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
390 | _("Failed to parse file `%s'\n"), | 390 | _("Failed to parse file `%s'\n"), |
391 | file); | 391 | file); |
392 | return; | 392 | return; |
393 | } | 393 | } |
@@ -408,28 +408,28 @@ GED_experiments_start () | |||
408 | char *pos; | 408 | char *pos; |
409 | struct GNUNET_CRYPTO_EccPublicSignKey issuer_ID; | 409 | struct GNUNET_CRYPTO_EccPublicSignKey issuer_ID; |
410 | struct GNUNET_HashCode hash; | 410 | struct GNUNET_HashCode hash; |
411 | 411 | ||
412 | /* Load valid issuer */ | 412 | /* Load valid issuer */ |
413 | if (GNUNET_SYSERR == | 413 | if (GNUNET_SYSERR == |
414 | GNUNET_CONFIGURATION_get_value_string (GED_cfg, | 414 | GNUNET_CONFIGURATION_get_value_string (GED_cfg, |
415 | "EXPERIMENTATION", | 415 | "EXPERIMENTATION", |
416 | "ISSUERS", | 416 | "ISSUERS", |
417 | &issuers)) | 417 | &issuers)) |
418 | { | 418 | { |
419 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 419 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
420 | _("No valid experiment issuers configured! Set value to public keys of issuers! Exiting.\n")); | 420 | _("No valid experiment issuers configured! Set value to public keys of issuers! Exiting.\n")); |
421 | GED_experiments_stop (); | 421 | GED_experiments_stop (); |
422 | return GNUNET_SYSERR; | 422 | return GNUNET_SYSERR; |
423 | } | 423 | } |
424 | 424 | ||
425 | valid_issuers = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); | 425 | valid_issuers = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); |
426 | for (pos = strtok (issuers, " "); pos != NULL; pos = strtok (NULL, " ")) | 426 | for (pos = strtok (issuers, " "); pos != NULL; pos = strtok (NULL, " ")) |
427 | { | 427 | { |
428 | if (GNUNET_SYSERR == GNUNET_CRYPTO_ecc_public_sign_key_from_string (pos, | 428 | if (GNUNET_SYSERR == GNUNET_CRYPTO_ecc_public_sign_key_from_string (pos, |
429 | strlen (pos), | 429 | strlen (pos), |
430 | &issuer_ID)) | 430 | &issuer_ID)) |
431 | { | 431 | { |
432 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, | 432 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, |
433 | "EXPERIMENTATION", | 433 | "EXPERIMENTATION", |
434 | "ISSUERS", | 434 | "ISSUERS", |
435 | _("Invalid value for public key\n")); | 435 | _("Invalid value for public key\n")); |
@@ -439,33 +439,33 @@ GED_experiments_start () | |||
439 | i = GNUNET_new (struct Issuer); | 439 | i = GNUNET_new (struct Issuer); |
440 | i->pubkey = issuer_ID; | 440 | i->pubkey = issuer_ID; |
441 | GNUNET_CRYPTO_hash( &issuer_ID, sizeof (issuer_ID), &hash); | 441 | GNUNET_CRYPTO_hash( &issuer_ID, sizeof (issuer_ID), &hash); |
442 | GNUNET_CONTAINER_multihashmap_put (valid_issuers, | 442 | GNUNET_CONTAINER_multihashmap_put (valid_issuers, |
443 | &hash, | 443 | &hash, |
444 | i, | 444 | i, |
445 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | 445 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); |
446 | } | 446 | } |
447 | GNUNET_free (issuers); | 447 | GNUNET_free (issuers); |
448 | if (0 == GNUNET_CONTAINER_multihashmap_size (valid_issuers)) | 448 | if (0 == GNUNET_CONTAINER_multihashmap_size (valid_issuers)) |
449 | { | 449 | { |
450 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 450 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
451 | _("No valid experiment issuers configured! Set value to public keys of issuers! Exiting.\n")); | 451 | _("No valid experiment issuers configured! Set value to public keys of issuers! Exiting.\n")); |
452 | GED_experiments_stop (); | 452 | GED_experiments_stop (); |
453 | return GNUNET_SYSERR; | 453 | return GNUNET_SYSERR; |
454 | } | 454 | } |
455 | GNUNET_STATISTICS_set (GED_stats, | 455 | GNUNET_STATISTICS_set (GED_stats, |
456 | "# issuer", | 456 | "# issuer", |
457 | GNUNET_CONTAINER_multihashmap_size (valid_issuers), | 457 | GNUNET_CONTAINER_multihashmap_size (valid_issuers), |
458 | GNUNET_NO); | 458 | GNUNET_NO); |
459 | 459 | ||
460 | experiments = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); | 460 | experiments = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); |
461 | /* Load experiments from file */ | 461 | /* Load experiments from file */ |
462 | if (GNUNET_SYSERR == | 462 | if (GNUNET_SYSERR == |
463 | GNUNET_CONFIGURATION_get_value_string (GED_cfg, | 463 | GNUNET_CONFIGURATION_get_value_string (GED_cfg, |
464 | "EXPERIMENTATION", | 464 | "EXPERIMENTATION", |
465 | "EXPERIMENTS", | 465 | "EXPERIMENTS", |
466 | &file)) | 466 | &file)) |
467 | return GNUNET_OK; | 467 | return GNUNET_OK; |
468 | 468 | ||
469 | if (GNUNET_YES != GNUNET_DISK_file_test (file)) | 469 | if (GNUNET_YES != GNUNET_DISK_file_test (file)) |
470 | { | 470 | { |
471 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 471 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
diff --git a/src/experimentation/gnunet-daemon-experimentation_nodes.c b/src/experimentation/gnunet-daemon-experimentation_nodes.c index 5e29f5f73..f78569146 100644 --- a/src/experimentation/gnunet-daemon-experimentation_nodes.c +++ b/src/experimentation/gnunet-daemon-experimentation_nodes.c | |||
@@ -64,10 +64,10 @@ struct NodeComCtx | |||
64 | { | 64 | { |
65 | struct NodeComCtx *prev; | 65 | struct NodeComCtx *prev; |
66 | struct NodeComCtx *next; | 66 | struct NodeComCtx *next; |
67 | 67 | ||
68 | struct Node *n; | 68 | struct Node *n; |
69 | struct Experiment *e; | 69 | struct Experiment *e; |
70 | 70 | ||
71 | size_t size; | 71 | size_t size; |
72 | GNUNET_CONNECTION_TransmitReadyNotify notify; | 72 | GNUNET_CONNECTION_TransmitReadyNotify notify; |
73 | void *notify_cls; | 73 | void *notify_cls; |
@@ -79,7 +79,7 @@ struct NodeComCtx | |||
79 | * | 79 | * |
80 | * @param m peermap to update values from | 80 | * @param m peermap to update values from |
81 | */ | 81 | */ |
82 | static void | 82 | static void |
83 | update_stats (struct GNUNET_CONTAINER_MultiPeerMap *m) | 83 | update_stats (struct GNUNET_CONTAINER_MultiPeerMap *m) |
84 | { | 84 | { |
85 | GNUNET_assert (NULL != m); | 85 | GNUNET_assert (NULL != m); |
@@ -122,14 +122,14 @@ cleanup_node (void *cls, | |||
122 | struct NodeComCtx *e_cur; | 122 | struct NodeComCtx *e_cur; |
123 | struct NodeComCtx *e_next; | 123 | struct NodeComCtx *e_next; |
124 | struct GNUNET_CONTAINER_MultiPeerMap *cur = cls; | 124 | struct GNUNET_CONTAINER_MultiPeerMap *cur = cls; |
125 | 125 | ||
126 | n = value; | 126 | n = value; |
127 | if (GNUNET_SCHEDULER_NO_TASK != n->timeout_task) | 127 | if (GNUNET_SCHEDULER_NO_TASK != n->timeout_task) |
128 | { | 128 | { |
129 | GNUNET_SCHEDULER_cancel (n->timeout_task); | 129 | GNUNET_SCHEDULER_cancel (n->timeout_task); |
130 | n->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 130 | n->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
131 | } | 131 | } |
132 | 132 | ||
133 | if (NULL != n->cth) | 133 | if (NULL != n->cth) |
134 | { | 134 | { |
135 | GNUNET_CORE_notify_transmit_ready_cancel (n->cth); | 135 | GNUNET_CORE_notify_transmit_ready_cancel (n->cth); |
@@ -154,7 +154,7 @@ cleanup_node (void *cls, | |||
154 | * @param id the id to check | 154 | * @param id the id to check |
155 | * @return GNUNET_YES or GNUNET_NO | 155 | * @return GNUNET_YES or GNUNET_NO |
156 | */ | 156 | */ |
157 | static int | 157 | static int |
158 | is_me (const struct GNUNET_PeerIdentity *id) | 158 | is_me (const struct GNUNET_PeerIdentity *id) |
159 | { | 159 | { |
160 | if (0 == memcmp (&me, id, sizeof (me))) | 160 | if (0 == memcmp (&me, id, sizeof (me))) |
@@ -187,14 +187,14 @@ transmit_read_wrapper (void *cls, size_t bufsize, void *buf) | |||
187 | { | 187 | { |
188 | struct NodeComCtx *e_ctx = cls; | 188 | struct NodeComCtx *e_ctx = cls; |
189 | struct NodeComCtx *next; | 189 | struct NodeComCtx *next; |
190 | 190 | ||
191 | size_t res = e_ctx->notify (e_ctx->notify_cls, bufsize, buf); | 191 | size_t res = e_ctx->notify (e_ctx->notify_cls, bufsize, buf); |
192 | e_ctx->n->cth = NULL; | 192 | e_ctx->n->cth = NULL; |
193 | 193 | ||
194 | GNUNET_CONTAINER_DLL_remove (e_ctx->n->e_req_head, e_ctx->n->e_req_tail, e_ctx); | 194 | GNUNET_CONTAINER_DLL_remove (e_ctx->n->e_req_head, e_ctx->n->e_req_tail, e_ctx); |
195 | next = e_ctx->n->e_req_head; | 195 | next = e_ctx->n->e_req_head; |
196 | GNUNET_free (e_ctx); | 196 | GNUNET_free (e_ctx); |
197 | 197 | ||
198 | if (NULL != next) | 198 | if (NULL != next) |
199 | { | 199 | { |
200 | /* Schedule next message */ | 200 | /* Schedule next message */ |
@@ -209,9 +209,9 @@ schedule_transmisson (struct NodeComCtx *e_ctx) | |||
209 | { | 209 | { |
210 | if (NULL != e_ctx->n->cth) | 210 | if (NULL != e_ctx->n->cth) |
211 | return; | 211 | return; |
212 | 212 | ||
213 | e_ctx->n->cth = GNUNET_CORE_notify_transmit_ready (ch, GNUNET_NO, 0, FAST_TIMEOUT, | 213 | e_ctx->n->cth = GNUNET_CORE_notify_transmit_ready (ch, GNUNET_NO, 0, FAST_TIMEOUT, |
214 | &e_ctx->n->id, e_ctx->size, | 214 | &e_ctx->n->id, e_ctx->size, |
215 | transmit_read_wrapper, e_ctx); | 215 | transmit_read_wrapper, e_ctx); |
216 | if (NULL == e_ctx->n->cth) | 216 | if (NULL == e_ctx->n->cth) |
217 | { | 217 | { |
@@ -219,7 +219,7 @@ schedule_transmisson (struct NodeComCtx *e_ctx) | |||
219 | _("Cannot send message to peer `%s' for experiment `%s'\n"), | 219 | _("Cannot send message to peer `%s' for experiment `%s'\n"), |
220 | GNUNET_i2s(&e_ctx->n->id), e_ctx->e->name); | 220 | GNUNET_i2s(&e_ctx->n->id), e_ctx->e->name); |
221 | GNUNET_free (e_ctx); | 221 | GNUNET_free (e_ctx); |
222 | } | 222 | } |
223 | } | 223 | } |
224 | 224 | ||
225 | 225 | ||
@@ -233,10 +233,10 @@ static void | |||
233 | remove_request (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 233 | remove_request (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
234 | { | 234 | { |
235 | struct Node *n = cls; | 235 | struct Node *n = cls; |
236 | 236 | ||
237 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 237 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
238 | "Removing request for peer %s due to timeout\n", | 238 | "Removing request for peer %s due to timeout\n", |
239 | GNUNET_i2s (&n->id)); | 239 | GNUNET_i2s (&n->id)); |
240 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_requested, &n->id)) | 240 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_requested, &n->id)) |
241 | { | 241 | { |
242 | GNUNET_break (0 == GNUNET_CONTAINER_multipeermap_remove (nodes_requested, &n->id, n)); | 242 | GNUNET_break (0 == GNUNET_CONTAINER_multipeermap_remove (nodes_requested, &n->id, n)); |
@@ -271,7 +271,7 @@ append_public_key (void *cls, | |||
271 | * @param buf the buffer to copy to | 271 | * @param buf the buffer to copy to |
272 | * @return bytes passed | 272 | * @return bytes passed |
273 | */ | 273 | */ |
274 | static size_t | 274 | static size_t |
275 | send_experimentation_request_cb (void *cls, size_t bufsize, void *buf) | 275 | send_experimentation_request_cb (void *cls, size_t bufsize, void *buf) |
276 | { | 276 | { |
277 | struct Node *n = cls; | 277 | struct Node *n = cls; |
@@ -315,22 +315,22 @@ send_experimentation_request_cb (void *cls, size_t bufsize, void *buf) | |||
315 | * | 315 | * |
316 | * @param peer the peer to send to | 316 | * @param peer the peer to send to |
317 | */ | 317 | */ |
318 | static void | 318 | static void |
319 | send_experimentation_request (const struct GNUNET_PeerIdentity *peer) | 319 | send_experimentation_request (const struct GNUNET_PeerIdentity *peer) |
320 | { | 320 | { |
321 | struct Node *n; | 321 | struct Node *n; |
322 | struct NodeComCtx *e_ctx; | 322 | struct NodeComCtx *e_ctx; |
323 | size_t size; | 323 | size_t size; |
324 | size_t c_issuers; | 324 | size_t c_issuers; |
325 | 325 | ||
326 | c_issuers = GNUNET_CONTAINER_multihashmap_size (valid_issuers); | 326 | c_issuers = GNUNET_CONTAINER_multihashmap_size (valid_issuers); |
327 | size = sizeof (struct Experimentation_Request) + | 327 | size = sizeof (struct Experimentation_Request) + |
328 | c_issuers * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); | 328 | c_issuers * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); |
329 | n = GNUNET_new (struct Node); | 329 | n = GNUNET_new (struct Node); |
330 | n->id = *peer; | 330 | n->id = *peer; |
331 | n->timeout_task = GNUNET_SCHEDULER_add_delayed (EXP_RESPONSE_TIMEOUT, &remove_request, n); | 331 | n->timeout_task = GNUNET_SCHEDULER_add_delayed (EXP_RESPONSE_TIMEOUT, &remove_request, n); |
332 | n->capabilities = NONE; | 332 | n->capabilities = NONE; |
333 | 333 | ||
334 | e_ctx = GNUNET_new (struct NodeComCtx); | 334 | e_ctx = GNUNET_new (struct NodeComCtx); |
335 | e_ctx->n = n; | 335 | e_ctx->n = n; |
336 | e_ctx->e = NULL; | 336 | e_ctx->e = NULL; |
@@ -339,10 +339,10 @@ send_experimentation_request (const struct GNUNET_PeerIdentity *peer) | |||
339 | e_ctx->notify_cls = n; | 339 | e_ctx->notify_cls = n; |
340 | GNUNET_CONTAINER_DLL_insert_tail(n->e_req_head, n->e_req_tail, e_ctx); | 340 | GNUNET_CONTAINER_DLL_insert_tail(n->e_req_head, n->e_req_tail, e_ctx); |
341 | schedule_transmisson (e_ctx); | 341 | schedule_transmisson (e_ctx); |
342 | 342 | ||
343 | GNUNET_assert (GNUNET_OK == | 343 | GNUNET_assert (GNUNET_OK == |
344 | GNUNET_CONTAINER_multipeermap_put (nodes_requested, | 344 | GNUNET_CONTAINER_multipeermap_put (nodes_requested, |
345 | peer, n, | 345 | peer, n, |
346 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); | 346 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); |
347 | update_stats (nodes_requested); | 347 | update_stats (nodes_requested); |
348 | } | 348 | } |
@@ -361,17 +361,17 @@ send_response_cb (void *cls, size_t bufsize, void *buf) | |||
361 | { | 361 | { |
362 | struct Node *n = cls; | 362 | struct Node *n = cls; |
363 | struct Experimentation_Response msg; | 363 | struct Experimentation_Response msg; |
364 | size_t c_issuers = GNUNET_CONTAINER_multihashmap_size (valid_issuers); | 364 | size_t c_issuers = GNUNET_CONTAINER_multihashmap_size (valid_issuers); |
365 | size_t ri_size = c_issuers * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); | 365 | size_t ri_size = c_issuers * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); |
366 | size_t msg_size = sizeof (msg); | 366 | size_t msg_size = sizeof (msg); |
367 | size_t total_size = msg_size + ri_size; | 367 | size_t total_size = msg_size + ri_size; |
368 | struct GNUNET_CRYPTO_EccPublicSignKey *issuers; | 368 | struct GNUNET_CRYPTO_EccPublicSignKey *issuers; |
369 | 369 | ||
370 | n->cth = NULL; | 370 | n->cth = NULL; |
371 | if (buf == NULL) | 371 | if (buf == NULL) |
372 | { | 372 | { |
373 | /* client disconnected */ | 373 | /* client disconnected */ |
374 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 374 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
375 | "Client disconnected\n"); | 375 | "Client disconnected\n"); |
376 | return 0; | 376 | return 0; |
377 | } | 377 | } |
@@ -399,7 +399,7 @@ get_experiments_cb (struct Node *n, struct Experiment *e) | |||
399 | static int counter = 0; | 399 | static int counter = 0; |
400 | if (NULL == e) | 400 | if (NULL == e) |
401 | return; /* Done */ | 401 | return; /* Done */ |
402 | 402 | ||
403 | /* Tell the scheduler to add a node with an experiment */ | 403 | /* Tell the scheduler to add a node with an experiment */ |
404 | GED_scheduler_add (n, e, GNUNET_YES); | 404 | GED_scheduler_add (n, e, GNUNET_YES); |
405 | counter ++; | 405 | counter ++; |
@@ -417,19 +417,19 @@ get_node (const struct GNUNET_PeerIdentity *id) | |||
417 | tmp = GNUNET_CONTAINER_multipeermap_get (nodes_active, id); | 417 | tmp = GNUNET_CONTAINER_multipeermap_get (nodes_active, id); |
418 | if (res == NULL) | 418 | if (res == NULL) |
419 | res = tmp; | 419 | res = tmp; |
420 | 420 | ||
421 | tmp = GNUNET_CONTAINER_multipeermap_get (nodes_inactive, id); | 421 | tmp = GNUNET_CONTAINER_multipeermap_get (nodes_inactive, id); |
422 | if (res == NULL) | 422 | if (res == NULL) |
423 | res = tmp; | 423 | res = tmp; |
424 | else | 424 | else |
425 | GNUNET_break (0); /* Multiple instances */ | 425 | GNUNET_break (0); /* Multiple instances */ |
426 | 426 | ||
427 | tmp = GNUNET_CONTAINER_multipeermap_get (nodes_requested, id); | 427 | tmp = GNUNET_CONTAINER_multipeermap_get (nodes_requested, id); |
428 | if (res == NULL) | 428 | if (res == NULL) |
429 | res = tmp; | 429 | res = tmp; |
430 | else | 430 | else |
431 | GNUNET_break (0); /* Multiple instances */ | 431 | GNUNET_break (0); /* Multiple instances */ |
432 | 432 | ||
433 | return res; | 433 | return res; |
434 | } | 434 | } |
435 | 435 | ||
@@ -439,7 +439,7 @@ get_node (const struct GNUNET_PeerIdentity *id) | |||
439 | * | 439 | * |
440 | * @param n the node | 440 | * @param n the node |
441 | */ | 441 | */ |
442 | static void | 442 | static void |
443 | node_make_active (struct Node *n) | 443 | node_make_active (struct Node *n) |
444 | { | 444 | { |
445 | int c1; | 445 | int c1; |
@@ -452,7 +452,7 @@ node_make_active (struct Node *n) | |||
452 | GNUNET_i2s (&n->id)); | 452 | GNUNET_i2s (&n->id)); |
453 | /* Request experiments for this node to start them */ | 453 | /* Request experiments for this node to start them */ |
454 | for (c1 = 0; c1 < n->issuer_count; c1++) | 454 | for (c1 = 0; c1 < n->issuer_count; c1++) |
455 | { | 455 | { |
456 | GED_experiments_get (n, &n->issuer_id[c1], &get_experiments_cb); | 456 | GED_experiments_get (n, &n->issuer_id[c1], &get_experiments_cb); |
457 | } | 457 | } |
458 | } | 458 | } |
@@ -478,20 +478,20 @@ handle_request (const struct GNUNET_PeerIdentity *peer, | |||
478 | uint32_t ic; | 478 | uint32_t ic; |
479 | uint32_t ic_accepted; | 479 | uint32_t ic_accepted; |
480 | int make_active; | 480 | int make_active; |
481 | 481 | ||
482 | if (ntohs (message->size) < sizeof (struct Experimentation_Request)) | 482 | if (ntohs (message->size) < sizeof (struct Experimentation_Request)) |
483 | { | 483 | { |
484 | GNUNET_break (0); | 484 | GNUNET_break (0); |
485 | return; | 485 | return; |
486 | } | 486 | } |
487 | ic = ntohl (rm->issuer_count); | 487 | ic = ntohl (rm->issuer_count); |
488 | if (ntohs (message->size) != | 488 | if (ntohs (message->size) != |
489 | sizeof (struct Experimentation_Request) + ic * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) | 489 | sizeof (struct Experimentation_Request) + ic * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) |
490 | { | 490 | { |
491 | GNUNET_break (0); | 491 | GNUNET_break (0); |
492 | return; | 492 | return; |
493 | } | 493 | } |
494 | 494 | ||
495 | make_active = GNUNET_NO; | 495 | make_active = GNUNET_NO; |
496 | if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_active, peer))) | 496 | if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_active, peer))) |
497 | { | 497 | { |
@@ -522,10 +522,10 @@ handle_request (const struct GNUNET_PeerIdentity *peer, | |||
522 | n->capabilities = NONE; | 522 | n->capabilities = NONE; |
523 | make_active = GNUNET_YES; | 523 | make_active = GNUNET_YES; |
524 | } | 524 | } |
525 | 525 | ||
526 | /* Update node */ | 526 | /* Update node */ |
527 | n->capabilities = ntohl (rm->capabilities); | 527 | n->capabilities = ntohl (rm->capabilities); |
528 | 528 | ||
529 | /* Filter accepted issuer */ | 529 | /* Filter accepted issuer */ |
530 | ic_accepted = 0; | 530 | ic_accepted = 0; |
531 | for (c1 = 0; c1 < ic; c1++) | 531 | for (c1 = 0; c1 < ic; c1++) |
@@ -533,7 +533,7 @@ handle_request (const struct GNUNET_PeerIdentity *peer, | |||
533 | if (GNUNET_YES == GED_experiments_issuer_accepted(&rmi[c1])) | 533 | if (GNUNET_YES == GED_experiments_issuer_accepted(&rmi[c1])) |
534 | ic_accepted ++; | 534 | ic_accepted ++; |
535 | } | 535 | } |
536 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 536 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
537 | "Request from peer `%s' with %u issuers, we accepted %u issuer \n", | 537 | "Request from peer `%s' with %u issuers, we accepted %u issuer \n", |
538 | GNUNET_i2s (peer), ic, ic_accepted); | 538 | GNUNET_i2s (peer), ic, ic_accepted); |
539 | GNUNET_free_non_null (n->issuer_id); | 539 | GNUNET_free_non_null (n->issuer_id); |
@@ -548,19 +548,19 @@ handle_request (const struct GNUNET_PeerIdentity *peer, | |||
548 | } | 548 | } |
549 | } | 549 | } |
550 | n->issuer_count = ic_accepted; | 550 | n->issuer_count = ic_accepted; |
551 | 551 | ||
552 | if (GNUNET_YES == make_active) | 552 | if (GNUNET_YES == make_active) |
553 | node_make_active (n); | 553 | node_make_active (n); |
554 | 554 | ||
555 | /* Send response */ | 555 | /* Send response */ |
556 | e_ctx = GNUNET_new (struct NodeComCtx); | 556 | e_ctx = GNUNET_new (struct NodeComCtx); |
557 | e_ctx->n = n; | 557 | e_ctx->n = n; |
558 | e_ctx->e = NULL; | 558 | e_ctx->e = NULL; |
559 | e_ctx->size = sizeof (struct Experimentation_Response) + | 559 | e_ctx->size = sizeof (struct Experimentation_Response) + |
560 | my_issuer_count * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); | 560 | my_issuer_count * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); |
561 | e_ctx->notify = &send_response_cb; | 561 | e_ctx->notify = &send_response_cb; |
562 | e_ctx->notify_cls = n; | 562 | e_ctx->notify_cls = n; |
563 | 563 | ||
564 | GNUNET_CONTAINER_DLL_insert_tail(n->e_req_head, n->e_req_tail, e_ctx); | 564 | GNUNET_CONTAINER_DLL_insert_tail(n->e_req_head, n->e_req_tail, e_ctx); |
565 | schedule_transmisson (e_ctx); | 565 | schedule_transmisson (e_ctx); |
566 | } | 566 | } |
@@ -583,7 +583,7 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer, | |||
583 | int make_active; | 583 | int make_active; |
584 | unsigned int c1; | 584 | unsigned int c1; |
585 | unsigned int c2; | 585 | unsigned int c2; |
586 | 586 | ||
587 | if (ntohs (message->size) < sizeof (struct Experimentation_Response)) | 587 | if (ntohs (message->size) < sizeof (struct Experimentation_Response)) |
588 | { | 588 | { |
589 | GNUNET_break (0); | 589 | GNUNET_break (0); |
@@ -595,7 +595,7 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer, | |||
595 | GNUNET_break (0); | 595 | GNUNET_break (0); |
596 | return; | 596 | return; |
597 | } | 597 | } |
598 | 598 | ||
599 | make_active = GNUNET_NO; | 599 | make_active = GNUNET_NO; |
600 | if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_active, peer))) | 600 | if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_active, peer))) |
601 | { | 601 | { |
@@ -618,7 +618,7 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer, | |||
618 | } | 618 | } |
619 | else if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_inactive, peer))) | 619 | else if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_inactive, peer))) |
620 | { | 620 | { |
621 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 621 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
622 | "Received %s from peer `%s'\n", | 622 | "Received %s from peer `%s'\n", |
623 | "RESPONSE", "inactive", GNUNET_i2s (peer)); | 623 | "RESPONSE", "inactive", GNUNET_i2s (peer)); |
624 | GNUNET_break (0 == GNUNET_CONTAINER_multipeermap_remove (nodes_inactive, peer, n)); | 624 | GNUNET_break (0 == GNUNET_CONTAINER_multipeermap_remove (nodes_inactive, peer, n)); |
@@ -631,10 +631,10 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer, | |||
631 | "RESPONSE", "unknown", GNUNET_i2s (peer)); | 631 | "RESPONSE", "unknown", GNUNET_i2s (peer)); |
632 | return; | 632 | return; |
633 | } | 633 | } |
634 | 634 | ||
635 | /* Update */ | 635 | /* Update */ |
636 | n->capabilities = ntohl (rm->capabilities); | 636 | n->capabilities = ntohl (rm->capabilities); |
637 | 637 | ||
638 | /* Filter accepted issuer */ | 638 | /* Filter accepted issuer */ |
639 | ic_accepted = 0; | 639 | ic_accepted = 0; |
640 | for (c1 = 0; c1 < ic; c1++) | 640 | for (c1 = 0; c1 < ic; c1++) |
@@ -657,7 +657,7 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer, | |||
657 | } | 657 | } |
658 | } | 658 | } |
659 | n->issuer_count = ic_accepted; | 659 | n->issuer_count = ic_accepted; |
660 | 660 | ||
661 | if (GNUNET_YES == make_active) | 661 | if (GNUNET_YES == make_active) |
662 | node_make_active (n); | 662 | node_make_active (n); |
663 | } | 663 | } |
@@ -669,7 +669,7 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer, | |||
669 | * @param peer the source | 669 | * @param peer the source |
670 | * @param message the message | 670 | * @param message the message |
671 | */ | 671 | */ |
672 | static void | 672 | static void |
673 | handle_start (const struct GNUNET_PeerIdentity *peer, | 673 | handle_start (const struct GNUNET_PeerIdentity *peer, |
674 | const struct GNUNET_MessageHeader *message) | 674 | const struct GNUNET_MessageHeader *message) |
675 | { | 675 | { |
@@ -679,7 +679,7 @@ handle_start (const struct GNUNET_PeerIdentity *peer, | |||
679 | const char *name; | 679 | const char *name; |
680 | struct Node *n; | 680 | struct Node *n; |
681 | struct Experiment *e; | 681 | struct Experiment *e; |
682 | 682 | ||
683 | if (NULL == peer) | 683 | if (NULL == peer) |
684 | { | 684 | { |
685 | GNUNET_break (0); | 685 | GNUNET_break (0); |
@@ -690,7 +690,7 @@ handle_start (const struct GNUNET_PeerIdentity *peer, | |||
690 | GNUNET_break (0); | 690 | GNUNET_break (0); |
691 | return; | 691 | return; |
692 | } | 692 | } |
693 | 693 | ||
694 | size = ntohs (message->size); | 694 | size = ntohs (message->size); |
695 | if (size < sizeof (struct GED_start_message)) | 695 | if (size < sizeof (struct GED_start_message)) |
696 | { | 696 | { |
@@ -704,7 +704,7 @@ handle_start (const struct GNUNET_PeerIdentity *peer, | |||
704 | GNUNET_break (0); | 704 | GNUNET_break (0); |
705 | return; | 705 | return; |
706 | } | 706 | } |
707 | 707 | ||
708 | n = get_node (peer); | 708 | n = get_node (peer); |
709 | if (NULL == n) | 709 | if (NULL == n) |
710 | { | 710 | { |
@@ -716,18 +716,18 @@ handle_start (const struct GNUNET_PeerIdentity *peer, | |||
716 | { | 716 | { |
717 | GNUNET_break (0); | 717 | GNUNET_break (0); |
718 | return; | 718 | return; |
719 | } | 719 | } |
720 | if (name_len != strlen (name) + 1) | 720 | if (name_len != strlen (name) + 1) |
721 | { | 721 | { |
722 | GNUNET_break (0); | 722 | GNUNET_break (0); |
723 | return; | 723 | return; |
724 | } | 724 | } |
725 | e = GED_experiments_find (&msg->issuer, name, GNUNET_TIME_absolute_ntoh(msg->version_nbo)); | 725 | e = GED_experiments_find (&msg->issuer, name, GNUNET_TIME_absolute_ntoh(msg->version_nbo)); |
726 | if (NULL == e) | 726 | if (NULL == e) |
727 | { | 727 | { |
728 | GNUNET_break (0); | 728 | GNUNET_break (0); |
729 | return; | 729 | return; |
730 | } | 730 | } |
731 | GED_scheduler_handle_start (n, e); | 731 | GED_scheduler_handle_start (n, e); |
732 | } | 732 | } |
733 | 733 | ||
@@ -748,7 +748,7 @@ handle_start_ack (const struct GNUNET_PeerIdentity *peer, | |||
748 | const char *name; | 748 | const char *name; |
749 | struct Node *n; | 749 | struct Node *n; |
750 | struct Experiment *e; | 750 | struct Experiment *e; |
751 | 751 | ||
752 | if (NULL == peer) | 752 | if (NULL == peer) |
753 | { | 753 | { |
754 | GNUNET_break (0); | 754 | GNUNET_break (0); |
@@ -759,7 +759,7 @@ handle_start_ack (const struct GNUNET_PeerIdentity *peer, | |||
759 | GNUNET_break (0); | 759 | GNUNET_break (0); |
760 | return; | 760 | return; |
761 | } | 761 | } |
762 | 762 | ||
763 | size = ntohs (message->size); | 763 | size = ntohs (message->size); |
764 | if (size < sizeof (struct GED_start_ack_message)) | 764 | if (size < sizeof (struct GED_start_ack_message)) |
765 | { | 765 | { |
@@ -773,7 +773,7 @@ handle_start_ack (const struct GNUNET_PeerIdentity *peer, | |||
773 | GNUNET_break (0); | 773 | GNUNET_break (0); |
774 | return; | 774 | return; |
775 | } | 775 | } |
776 | 776 | ||
777 | n = get_node (peer); | 777 | n = get_node (peer); |
778 | if (NULL == n) | 778 | if (NULL == n) |
779 | { | 779 | { |
@@ -791,7 +791,7 @@ handle_start_ack (const struct GNUNET_PeerIdentity *peer, | |||
791 | GNUNET_break (0); | 791 | GNUNET_break (0); |
792 | return; | 792 | return; |
793 | } | 793 | } |
794 | 794 | ||
795 | e = GED_experiments_find (&msg->issuer, name, GNUNET_TIME_absolute_ntoh(msg->version_nbo)); | 795 | e = GED_experiments_find (&msg->issuer, name, GNUNET_TIME_absolute_ntoh(msg->version_nbo)); |
796 | if (NULL == e) | 796 | if (NULL == e) |
797 | { | 797 | { |
@@ -885,19 +885,19 @@ core_connect_handler (void *cls, | |||
885 | { | 885 | { |
886 | if (GNUNET_YES == is_me(peer)) | 886 | if (GNUNET_YES == is_me(peer)) |
887 | return; | 887 | return; |
888 | 888 | ||
889 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connected to peer %s\n"), | 889 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connected to peer %s\n"), |
890 | GNUNET_i2s (peer)); | 890 | GNUNET_i2s (peer)); |
891 | 891 | ||
892 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_requested, peer)) | 892 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_requested, peer)) |
893 | return; /* We already sent a request */ | 893 | return; /* We already sent a request */ |
894 | 894 | ||
895 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_active, peer)) | 895 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_active, peer)) |
896 | return; /* This peer is known as active */ | 896 | return; /* This peer is known as active */ |
897 | 897 | ||
898 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_inactive, peer)) | 898 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_inactive, peer)) |
899 | return; /* This peer is known as inactive */ | 899 | return; /* This peer is known as inactive */ |
900 | 900 | ||
901 | send_experimentation_request (peer); | 901 | send_experimentation_request (peer); |
902 | } | 902 | } |
903 | 903 | ||
diff --git a/src/experimentation/gnunet-daemon-experimentation_scheduler.c b/src/experimentation/gnunet-daemon-experimentation_scheduler.c index a203fe4a5..a52d60c37 100644 --- a/src/experimentation/gnunet-daemon-experimentation_scheduler.c +++ b/src/experimentation/gnunet-daemon-experimentation_scheduler.c | |||
@@ -232,8 +232,8 @@ GED_scheduler_handle_start (struct Node *n, struct Experiment *e) | |||
232 | GNUNET_break_op (0); | 232 | GNUNET_break_op (0); |
233 | return; | 233 | return; |
234 | } | 234 | } |
235 | 235 | ||
236 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 236 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
237 | "Received %s message from peer %s for experiment `%s'\n", | 237 | "Received %s message from peer %s for experiment `%s'\n", |
238 | "START", GNUNET_i2s (&n->id), e->name); | 238 | "START", GNUNET_i2s (&n->id), e->name); |
239 | GED_scheduler_add (n, e, GNUNET_NO); | 239 | GED_scheduler_add (n, e, GNUNET_NO); |
diff --git a/src/experimentation/test_experimentation_clique_connect.c b/src/experimentation/test_experimentation_clique_connect.c index a84eabd7e..e7604b0da 100644 --- a/src/experimentation/test_experimentation_clique_connect.c +++ b/src/experimentation/test_experimentation_clique_connect.c | |||
@@ -354,7 +354,7 @@ stat_disconnect_adapter (void *cls, void *op_result) | |||
354 | * failed | 354 | * failed |
355 | */ | 355 | */ |
356 | static void | 356 | static void |
357 | test_master (void *cls, | 357 | test_master (void *cls, |
358 | struct GNUNET_TESTBED_RunHandle *h, | 358 | struct GNUNET_TESTBED_RunHandle *h, |
359 | unsigned int num_peers, | 359 | unsigned int num_peers, |
360 | struct GNUNET_TESTBED_Peer **peers_, | 360 | struct GNUNET_TESTBED_Peer **peers_, |