diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-05-27 08:22:58 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-05-27 08:22:58 +0000 |
commit | d22cb6fd4b977f5d77dbc621852b41d4fdb47482 (patch) | |
tree | def463d1941dda03b2463a7cda18d5a322ae0fd4 | |
parent | 9919d858790889dd52a6d7dd2bfe88bc7a213c2c (diff) | |
download | gnunet-d22cb6fd4b977f5d77dbc621852b41d4fdb47482.tar.gz gnunet-d22cb6fd4b977f5d77dbc621852b41d4fdb47482.zip |
docu
-rw-r--r-- | src/experimentation/gnunet-daemon-experimentation_experiments.c | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/src/experimentation/gnunet-daemon-experimentation_experiments.c b/src/experimentation/gnunet-daemon-experimentation_experiments.c index dcbdc9101..046e85a98 100644 --- a/src/experimentation/gnunet-daemon-experimentation_experiments.c +++ b/src/experimentation/gnunet-daemon-experimentation_experiments.c | |||
@@ -31,6 +31,10 @@ | |||
31 | #include "gnunet_statistics_service.h" | 31 | #include "gnunet_statistics_service.h" |
32 | #include "gnunet-daemon-experimentation.h" | 32 | #include "gnunet-daemon-experimentation.h" |
33 | 33 | ||
34 | |||
35 | /** | ||
36 | * Struct to store information about a specific experiment | ||
37 | */ | ||
34 | struct Experiment | 38 | struct Experiment |
35 | { | 39 | { |
36 | /* Header */ | 40 | /* Header */ |
@@ -53,21 +57,28 @@ struct Experiment | |||
53 | /* TBD */ | 57 | /* TBD */ |
54 | }; | 58 | }; |
55 | 59 | ||
60 | |||
61 | /** | ||
62 | * Struct to store information about an experiment issuer | ||
63 | */ | ||
56 | struct Issuer | 64 | struct Issuer |
57 | { | 65 | { |
58 | struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pubkey; | 66 | struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pubkey; |
59 | }; | 67 | }; |
60 | 68 | ||
69 | |||
61 | /** | 70 | /** |
62 | * Hashmap containing valid experiment issuer | 71 | * Hashmap containing valid experiment issuer |
63 | */ | 72 | */ |
64 | static struct GNUNET_CONTAINER_MultiHashMap *valid_issuers; | 73 | static struct GNUNET_CONTAINER_MultiHashMap *valid_issuers; |
65 | 74 | ||
75 | |||
66 | /** | 76 | /** |
67 | * Hashmap containing valid experiments | 77 | * Hashmap containing valid experiments |
68 | */ | 78 | */ |
69 | static struct GNUNET_CONTAINER_MultiHashMap *experiments; | 79 | static struct GNUNET_CONTAINER_MultiHashMap *experiments; |
70 | 80 | ||
81 | |||
71 | /** | 82 | /** |
72 | * Verify experiment signature | 83 | * Verify experiment signature |
73 | * | 84 | * |
@@ -75,7 +86,6 @@ static struct GNUNET_CONTAINER_MultiHashMap *experiments; | |||
75 | * @param e experiment | 86 | * @param e experiment |
76 | * @return GNUNET_OK or GNUNET_SYSERR | 87 | * @return GNUNET_OK or GNUNET_SYSERR |
77 | */ | 88 | */ |
78 | |||
79 | int | 89 | int |
80 | experiment_verify (struct Issuer *i, struct Experiment *e) | 90 | experiment_verify (struct Issuer *i, struct Experiment *e) |
81 | { | 91 | { |
@@ -98,6 +108,15 @@ int free_experiment (void *cls, | |||
98 | return GNUNET_OK; | 108 | return GNUNET_OK; |
99 | } | 109 | } |
100 | 110 | ||
111 | |||
112 | /** | ||
113 | * Free issuer element | ||
114 | * | ||
115 | * @param cls unused | ||
116 | * @param key the key | ||
117 | * @param value the issuer element to free | ||
118 | * @return GNUNET_OK to continue | ||
119 | */ | ||
101 | int free_issuer (void *cls, | 120 | int free_issuer (void *cls, |
102 | const struct GNUNET_HashCode * key, | 121 | const struct GNUNET_HashCode * key, |
103 | void *value) | 122 | void *value) |
@@ -108,6 +127,7 @@ int free_issuer (void *cls, | |||
108 | return GNUNET_OK; | 127 | return GNUNET_OK; |
109 | } | 128 | } |
110 | 129 | ||
130 | |||
111 | /** | 131 | /** |
112 | * Is peer a valid issuer | 132 | * Is peer a valid issuer |
113 | * | 133 | * |
@@ -123,6 +143,12 @@ GNUNET_EXPERIMENTATION_experiments_issuer_accepted (struct GNUNET_PeerIdentity * | |||
123 | } | 143 | } |
124 | 144 | ||
125 | 145 | ||
146 | /** | ||
147 | * Parse a configuration section containing experiments | ||
148 | * | ||
149 | * @param cls configuration handle | ||
150 | * @param section section name | ||
151 | */ | ||
126 | void exp_file_iterator (void *cls, | 152 | void exp_file_iterator (void *cls, |
127 | const char *section) | 153 | const char *section) |
128 | { | 154 | { |
@@ -204,12 +230,12 @@ void exp_file_iterator (void *cls, | |||
204 | GNUNET_STATISTICS_set (GSE_stats, "# experiments", GNUNET_CONTAINER_multihashmap_size (experiments), GNUNET_NO); | 230 | GNUNET_STATISTICS_set (GSE_stats, "# experiments", GNUNET_CONTAINER_multihashmap_size (experiments), GNUNET_NO); |
205 | } | 231 | } |
206 | 232 | ||
233 | |||
207 | /** | 234 | /** |
208 | * Load experiments from file | 235 | * Load experiments from file |
209 | * | 236 | * |
210 | * @param file source file | 237 | * @param file source file |
211 | */ | 238 | */ |
212 | |||
213 | static void | 239 | static void |
214 | load_file (const char * file) | 240 | load_file (const char * file) |
215 | { | 241 | { |
@@ -223,12 +249,11 @@ load_file (const char * file) | |||
223 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to parse file `%s'\n"), file); | 249 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to parse file `%s'\n"), file); |
224 | return; | 250 | return; |
225 | } | 251 | } |
226 | |||
227 | GNUNET_CONFIGURATION_iterate_sections (exp, &exp_file_iterator, exp); | 252 | GNUNET_CONFIGURATION_iterate_sections (exp, &exp_file_iterator, exp); |
228 | |||
229 | GNUNET_CONFIGURATION_destroy (exp); | 253 | GNUNET_CONFIGURATION_destroy (exp); |
230 | } | 254 | } |
231 | 255 | ||
256 | |||
232 | /** | 257 | /** |
233 | * Start experiments management | 258 | * Start experiments management |
234 | */ | 259 | */ |
@@ -309,12 +334,10 @@ GNUNET_EXPERIMENTATION_experiments_start () | |||
309 | } | 334 | } |
310 | load_file (file); | 335 | load_file (file); |
311 | GNUNET_free (file); | 336 | GNUNET_free (file); |
312 | |||
313 | return GNUNET_OK; | 337 | return GNUNET_OK; |
314 | } | 338 | } |
315 | 339 | ||
316 | 340 | ||
317 | |||
318 | /** | 341 | /** |
319 | * Stop experiments management | 342 | * Stop experiments management |
320 | */ | 343 | */ |