diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-05-12 13:35:26 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-05-12 13:35:26 +0200 |
commit | e44d0f349bd83f1bcded9621ccc9f15d42bc84d2 (patch) | |
tree | c69fab279feca5910351a665b8c5036953d34946 /src | |
parent | 47ea011912191fe183302a6f6308c586ddb472d6 (diff) | |
download | gnunet-e44d0f349bd83f1bcded9621ccc9f15d42bc84d2.tar.gz gnunet-e44d0f349bd83f1bcded9621ccc9f15d42bc84d2.zip |
last minute fixes for 0.11.4 (test cases adjustments only)
Diffstat (limited to 'src')
-rw-r--r-- | src/include/gnunet_identity_service.h | 82 | ||||
-rw-r--r-- | src/revocation/test_revocation.c | 179 | ||||
-rw-r--r-- | src/transport/Makefile.am | 3 |
3 files changed, 120 insertions, 144 deletions
diff --git a/src/include/gnunet_identity_service.h b/src/include/gnunet_identity_service.h index 043a71770..035b9e227 100644 --- a/src/include/gnunet_identity_service.h +++ b/src/include/gnunet_identity_service.h | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
@@ -43,9 +43,8 @@ | |||
43 | #define GNUNET_IDENTITY_SERVICE_H | 43 | #define GNUNET_IDENTITY_SERVICE_H |
44 | 44 | ||
45 | #ifdef __cplusplus | 45 | #ifdef __cplusplus |
46 | extern "C" | 46 | extern "C" { |
47 | { | 47 | #if 0 /* keep Emacsens' auto-indent happy */ |
48 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
49 | } | 48 | } |
50 | #endif | 49 | #endif |
51 | #endif | 50 | #endif |
@@ -101,7 +100,7 @@ GNUNET_IDENTITY_ego_get_anonymous (void); | |||
101 | */ | 100 | */ |
102 | void | 101 | void |
103 | GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego, | 102 | GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego, |
104 | struct GNUNET_CRYPTO_EcdsaPublicKey *pk); | 103 | struct GNUNET_CRYPTO_EcdsaPublicKey *pk); |
105 | 104 | ||
106 | 105 | ||
107 | /** | 106 | /** |
@@ -138,11 +137,10 @@ GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego, | |||
138 | * NULL if the user just deleted the ego and it | 137 | * NULL if the user just deleted the ego and it |
139 | * must thus no longer be used | 138 | * must thus no longer be used |
140 | */ | 139 | */ |
141 | typedef void | 140 | typedef void (*GNUNET_IDENTITY_Callback) (void *cls, |
142 | (*GNUNET_IDENTITY_Callback)(void *cls, | 141 | struct GNUNET_IDENTITY_Ego *ego, |
143 | struct GNUNET_IDENTITY_Ego *ego, | 142 | void **ctx, |
144 | void **ctx, | 143 | const char *name); |
145 | const char *name); | ||
146 | 144 | ||
147 | 145 | ||
148 | /** | 146 | /** |
@@ -155,8 +153,8 @@ typedef void | |||
155 | */ | 153 | */ |
156 | struct GNUNET_IDENTITY_Handle * | 154 | struct GNUNET_IDENTITY_Handle * |
157 | GNUNET_IDENTITY_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | 155 | GNUNET_IDENTITY_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, |
158 | GNUNET_IDENTITY_Callback cb, | 156 | GNUNET_IDENTITY_Callback cb, |
159 | void *cb_cls); | 157 | void *cb_cls); |
160 | 158 | ||
161 | 159 | ||
162 | /** | 160 | /** |
@@ -170,9 +168,9 @@ GNUNET_IDENTITY_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
170 | */ | 168 | */ |
171 | struct GNUNET_IDENTITY_Operation * | 169 | struct GNUNET_IDENTITY_Operation * |
172 | GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *id, | 170 | GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *id, |
173 | const char *service_name, | 171 | const char *service_name, |
174 | GNUNET_IDENTITY_Callback cb, | 172 | GNUNET_IDENTITY_Callback cb, |
175 | void *cb_cls); | 173 | void *cb_cls); |
176 | 174 | ||
177 | 175 | ||
178 | /** | 176 | /** |
@@ -182,9 +180,7 @@ GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *id, | |||
182 | * @param cls closure | 180 | * @param cls closure |
183 | * @param emsg NULL on success, otherwise an error message | 181 | * @param emsg NULL on success, otherwise an error message |
184 | */ | 182 | */ |
185 | typedef void | 183 | typedef void (*GNUNET_IDENTITY_Continuation) (void *cls, const char *emsg); |
186 | (*GNUNET_IDENTITY_Continuation)(void *cls, | ||
187 | const char *emsg); | ||
188 | 184 | ||
189 | 185 | ||
190 | /** | 186 | /** |
@@ -199,10 +195,10 @@ typedef void | |||
199 | */ | 195 | */ |
200 | struct GNUNET_IDENTITY_Operation * | 196 | struct GNUNET_IDENTITY_Operation * |
201 | GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *id, | 197 | GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *id, |
202 | const char *service_name, | 198 | const char *service_name, |
203 | struct GNUNET_IDENTITY_Ego *ego, | 199 | struct GNUNET_IDENTITY_Ego *ego, |
204 | GNUNET_IDENTITY_Continuation cont, | 200 | GNUNET_IDENTITY_Continuation cont, |
205 | void *cont_cls); | 201 | void *cont_cls); |
206 | 202 | ||
207 | 203 | ||
208 | /** | 204 | /** |
@@ -222,10 +218,10 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h); | |||
222 | * @param pk private key, NULL on error | 218 | * @param pk private key, NULL on error |
223 | * @param emsg error message, NULL on success | 219 | * @param emsg error message, NULL on success |
224 | */ | 220 | */ |
225 | typedef void | 221 | typedef void (*GNUNET_IDENTITY_CreateContinuation) ( |
226 | (*GNUNET_IDENTITY_CreateContinuation)(void *cls, | 222 | void *cls, |
227 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, | 223 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, |
228 | const char *emsg); | 224 | const char *emsg); |
229 | 225 | ||
230 | 226 | ||
231 | /** | 227 | /** |
@@ -239,9 +235,9 @@ typedef void | |||
239 | */ | 235 | */ |
240 | struct GNUNET_IDENTITY_Operation * | 236 | struct GNUNET_IDENTITY_Operation * |
241 | GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id, | 237 | GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id, |
242 | const char *name, | 238 | const char *name, |
243 | GNUNET_IDENTITY_CreateContinuation cont, | 239 | GNUNET_IDENTITY_CreateContinuation cont, |
244 | void *cont_cls); | 240 | void *cont_cls); |
245 | 241 | ||
246 | 242 | ||
247 | /** | 243 | /** |
@@ -256,10 +252,10 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id, | |||
256 | */ | 252 | */ |
257 | struct GNUNET_IDENTITY_Operation * | 253 | struct GNUNET_IDENTITY_Operation * |
258 | GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *id, | 254 | GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *id, |
259 | const char *old_name, | 255 | const char *old_name, |
260 | const char *new_name, | 256 | const char *new_name, |
261 | GNUNET_IDENTITY_Continuation cb, | 257 | GNUNET_IDENTITY_Continuation cb, |
262 | void *cb_cls); | 258 | void *cb_cls); |
263 | 259 | ||
264 | 260 | ||
265 | /** | 261 | /** |
@@ -273,9 +269,9 @@ GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *id, | |||
273 | */ | 269 | */ |
274 | struct GNUNET_IDENTITY_Operation * | 270 | struct GNUNET_IDENTITY_Operation * |
275 | GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *id, | 271 | GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *id, |
276 | const char *name, | 272 | const char *name, |
277 | GNUNET_IDENTITY_Continuation cb, | 273 | GNUNET_IDENTITY_Continuation cb, |
278 | void *cb_cls); | 274 | void *cb_cls); |
279 | 275 | ||
280 | 276 | ||
281 | /** | 277 | /** |
@@ -298,9 +294,9 @@ GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op); | |||
298 | * @param cls closure | 294 | * @param cls closure |
299 | * @param ego NULL on error / ego not found | 295 | * @param ego NULL on error / ego not found |
300 | */ | 296 | */ |
301 | typedef void | 297 | typedef void (*GNUNET_IDENTITY_EgoCallback) ( |
302 | (*GNUNET_IDENTITY_EgoCallback)(void *cls, | 298 | void *cls, |
303 | const struct GNUNET_IDENTITY_Ego *ego); | 299 | const struct GNUNET_IDENTITY_Ego *ego); |
304 | 300 | ||
305 | /** | 301 | /** |
306 | * Handle for ego lookup. | 302 | * Handle for ego lookup. |
@@ -319,9 +315,9 @@ struct GNUNET_IDENTITY_EgoLookup; | |||
319 | */ | 315 | */ |
320 | struct GNUNET_IDENTITY_EgoLookup * | 316 | struct GNUNET_IDENTITY_EgoLookup * |
321 | GNUNET_IDENTITY_ego_lookup (const struct GNUNET_CONFIGURATION_Handle *cfg, | 317 | GNUNET_IDENTITY_ego_lookup (const struct GNUNET_CONFIGURATION_Handle *cfg, |
322 | const char *name, | 318 | const char *name, |
323 | GNUNET_IDENTITY_EgoCallback cb, | 319 | GNUNET_IDENTITY_EgoCallback cb, |
324 | void *cb_cls); | 320 | void *cb_cls); |
325 | 321 | ||
326 | 322 | ||
327 | /** | 323 | /** |
@@ -333,7 +329,7 @@ void | |||
333 | GNUNET_IDENTITY_ego_lookup_cancel (struct GNUNET_IDENTITY_EgoLookup *el); | 329 | GNUNET_IDENTITY_ego_lookup_cancel (struct GNUNET_IDENTITY_EgoLookup *el); |
334 | 330 | ||
335 | 331 | ||
336 | #if 0 /* keep Emacsens' auto-indent happy */ | 332 | #if 0 /* keep Emacsens' auto-indent happy */ |
337 | { | 333 | { |
338 | #endif | 334 | #endif |
339 | #ifdef __cplusplus | 335 | #ifdef __cplusplus |
diff --git a/src/revocation/test_revocation.c b/src/revocation/test_revocation.c index e384d309a..22df26165 100644 --- a/src/revocation/test_revocation.c +++ b/src/revocation/test_revocation.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
@@ -95,15 +95,13 @@ check_revocation (void *cls); | |||
95 | 95 | ||
96 | 96 | ||
97 | static void | 97 | static void |
98 | revocation_remote_cb (void *cls, | 98 | revocation_remote_cb (void *cls, int is_valid) |
99 | int is_valid) | ||
100 | { | 99 | { |
101 | static int repeat = 0; | 100 | static int repeat = 0; |
102 | 101 | ||
103 | if (GNUNET_NO == is_valid) | 102 | if (GNUNET_NO == is_valid) |
104 | { | 103 | { |
105 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 104 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Local revocation successful\n"); |
106 | "Local revocation successful\n"); | ||
107 | ok = 0; | 105 | ok = 0; |
108 | GNUNET_SCHEDULER_shutdown (); | 106 | GNUNET_SCHEDULER_shutdown (); |
109 | return; | 107 | return; |
@@ -116,8 +114,7 @@ revocation_remote_cb (void *cls, | |||
116 | NULL); | 114 | NULL); |
117 | return; | 115 | return; |
118 | } | 116 | } |
119 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 117 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Flooding of revocation failed\n"); |
120 | "Flooding of revocation failed\n"); | ||
121 | ok = 2; | 118 | ok = 2; |
122 | GNUNET_SCHEDULER_shutdown (); | 119 | GNUNET_SCHEDULER_shutdown (); |
123 | } | 120 | } |
@@ -128,27 +125,25 @@ check_revocation (void *cls) | |||
128 | { | 125 | { |
129 | GNUNET_REVOCATION_query (testpeers[0].cfg, | 126 | GNUNET_REVOCATION_query (testpeers[0].cfg, |
130 | &testpeers[1].pubkey, | 127 | &testpeers[1].pubkey, |
131 | &revocation_remote_cb, NULL); | 128 | &revocation_remote_cb, |
129 | NULL); | ||
132 | } | 130 | } |
133 | 131 | ||
134 | 132 | ||
135 | static void | 133 | static void |
136 | revocation_cb (void *cls, | 134 | revocation_cb (void *cls, int is_valid) |
137 | int is_valid) | ||
138 | { | 135 | { |
139 | testpeers[1].revok_handle = NULL; | 136 | testpeers[1].revok_handle = NULL; |
140 | if (GNUNET_NO == is_valid) | 137 | if (GNUNET_NO == is_valid) |
141 | { | 138 | { |
142 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 139 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Revocation successful\n"); |
143 | "Revocation successful\n"); | ||
144 | check_revocation (NULL); | 140 | check_revocation (NULL); |
145 | } | 141 | } |
146 | } | 142 | } |
147 | 143 | ||
148 | 144 | ||
149 | static void | 145 | static void |
150 | ego_cb (void *cls, | 146 | ego_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) |
151 | const struct GNUNET_IDENTITY_Ego *ego) | ||
152 | { | 147 | { |
153 | static int completed = 0; | 148 | static int completed = 0; |
154 | 149 | ||
@@ -166,38 +161,35 @@ ego_cb (void *cls, | |||
166 | GNUNET_IDENTITY_ego_get_public_key (ego, &testpeers[1].pubkey); | 161 | GNUNET_IDENTITY_ego_get_public_key (ego, &testpeers[1].pubkey); |
167 | GNUNET_REVOCATION_sign_revocation (testpeers[1].privkey, &testpeers[1].sig); | 162 | GNUNET_REVOCATION_sign_revocation (testpeers[1].privkey, &testpeers[1].sig); |
168 | 163 | ||
169 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 164 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Calculating proof of work...\n"); |
170 | "Calculating proof of work...\n"); | ||
171 | testpeers[1].pow = 0; | 165 | testpeers[1].pow = 0; |
172 | int res = GNUNET_REVOCATION_check_pow (&testpeers[1].pubkey, | 166 | int res = |
173 | testpeers[1].pow, 5); | 167 | GNUNET_REVOCATION_check_pow (&testpeers[1].pubkey, testpeers[1].pow, 5); |
174 | while (GNUNET_OK != res) | 168 | while (GNUNET_OK != res) |
175 | { | 169 | { |
176 | testpeers[1].pow++; | 170 | testpeers[1].pow++; |
177 | res = GNUNET_REVOCATION_check_pow (&testpeers[1].pubkey, | 171 | res = |
178 | testpeers[1].pow, | 172 | GNUNET_REVOCATION_check_pow (&testpeers[1].pubkey, testpeers[1].pow, 5); |
179 | 5); | ||
180 | } | 173 | } |
181 | fprintf (stderr, | 174 | fprintf (stderr, "Done calculating proof of work\n"); |
182 | "Done calculating proof of work\n"); | ||
183 | completed++; | 175 | completed++; |
184 | } | 176 | } |
185 | if (2 == completed) | 177 | if (2 == completed) |
186 | { | 178 | { |
187 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 179 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Egos retrieved\n"); |
188 | "Egos retrieved\n"); | 180 | testpeers[1].revok_handle = GNUNET_REVOCATION_revoke (testpeers[1].cfg, |
189 | testpeers[1].revok_handle | 181 | &testpeers[1].pubkey, |
190 | = GNUNET_REVOCATION_revoke (testpeers[1].cfg, | 182 | &testpeers[1].sig, |
191 | &testpeers[1].pubkey, | 183 | testpeers[1].pow, |
192 | &testpeers[1].sig, | 184 | &revocation_cb, |
193 | testpeers[1].pow, | 185 | NULL); |
194 | &revocation_cb, NULL); | ||
195 | } | 186 | } |
196 | } | 187 | } |
197 | 188 | ||
198 | 189 | ||
199 | static void | 190 | static void |
200 | identity_create_cb (void *cls, | 191 | identity_create_cb (void *cls, |
192 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, | ||
201 | const char *emsg) | 193 | const char *emsg) |
202 | { | 194 | { |
203 | static int completed = 0; | 195 | static int completed = 0; |
@@ -214,8 +206,7 @@ identity_create_cb (void *cls, | |||
214 | } | 206 | } |
215 | if (2 != completed) | 207 | if (2 != completed) |
216 | return; | 208 | return; |
217 | fprintf (stderr, | 209 | fprintf (stderr, "Identities created\n"); |
218 | "Identities created\n"); | ||
219 | testpeers[0].ego_lookup = GNUNET_IDENTITY_ego_lookup (testpeers[0].cfg, | 210 | testpeers[0].ego_lookup = GNUNET_IDENTITY_ego_lookup (testpeers[0].cfg, |
220 | "client", | 211 | "client", |
221 | &ego_cb, | 212 | &ego_cb, |
@@ -238,18 +229,15 @@ identity_completion_cb (void *cls, | |||
238 | completed++; | 229 | completed++; |
239 | if (NUM_TEST_PEERS != completed) | 230 | if (NUM_TEST_PEERS != completed) |
240 | return; | 231 | return; |
241 | fprintf (stderr, | 232 | fprintf (stderr, "All peers connected @ IDENTITY ...\n"); |
242 | "All peers connected @ IDENTITY ...\n"); | 233 | testpeers[0].create_id_op = GNUNET_IDENTITY_create (testpeers[0].idh, |
243 | testpeers[0].create_id_op | 234 | "client", |
244 | = GNUNET_IDENTITY_create (testpeers[0].idh, | 235 | &identity_create_cb, |
245 | "client", | 236 | &testpeers[0]); |
246 | &identity_create_cb, | 237 | testpeers[1].create_id_op = GNUNET_IDENTITY_create (testpeers[1].idh, |
247 | &testpeers[0]); | 238 | "toberevoked", |
248 | testpeers[1].create_id_op | 239 | &identity_create_cb, |
249 | = GNUNET_IDENTITY_create (testpeers[1].idh, | 240 | &testpeers[1]); |
250 | "toberevoked", | ||
251 | &identity_create_cb, | ||
252 | &testpeers[1]); | ||
253 | } | 241 | } |
254 | 242 | ||
255 | 243 | ||
@@ -262,15 +250,13 @@ identity_connect_adapter (void *cls, | |||
262 | me->cfg = cfg; | 250 | me->cfg = cfg; |
263 | me->idh = GNUNET_IDENTITY_connect (cfg, NULL, NULL); | 251 | me->idh = GNUNET_IDENTITY_connect (cfg, NULL, NULL); |
264 | if (NULL == me->idh) | 252 | if (NULL == me->idh) |
265 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 253 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to create IDENTITY handle \n"); |
266 | "Failed to create IDENTITY handle \n"); | ||
267 | return me->idh; | 254 | return me->idh; |
268 | } | 255 | } |
269 | 256 | ||
270 | 257 | ||
271 | static void | 258 | static void |
272 | identity_disconnect_adapter (void *cls, | 259 | identity_disconnect_adapter (void *cls, void *op_result) |
273 | void *op_result) | ||
274 | { | 260 | { |
275 | struct TestPeer *me = cls; | 261 | struct TestPeer *me = cls; |
276 | GNUNET_IDENTITY_disconnect (me->idh); | 262 | GNUNET_IDENTITY_disconnect (me->idh); |
@@ -281,31 +267,34 @@ identity_disconnect_adapter (void *cls, | |||
281 | static void * | 267 | static void * |
282 | connect_cb (void *cls, | 268 | connect_cb (void *cls, |
283 | const struct GNUNET_PeerIdentity *peer, | 269 | const struct GNUNET_PeerIdentity *peer, |
284 | struct GNUNET_MQ_Handle *mq) | 270 | struct GNUNET_MQ_Handle *mq) |
285 | { | 271 | { |
286 | static int connects = 0; | 272 | static int connects = 0; |
287 | 273 | ||
288 | connects++; | 274 | connects++; |
289 | if (NUM_TEST_PEERS * NUM_TEST_PEERS == connects) | 275 | if (NUM_TEST_PEERS * NUM_TEST_PEERS == connects) |
290 | { | 276 | { |
291 | fprintf (stderr, | 277 | fprintf (stderr, "All peers connected @ CORE ...\n"); |
292 | "All peers connected @ CORE ...\n"); | ||
293 | 278 | ||
294 | /* Connect to identity service */ | 279 | /* Connect to identity service */ |
295 | testpeers[0].identity_op | 280 | testpeers[0].identity_op = |
296 | = GNUNET_TESTBED_service_connect (NULL, | 281 | GNUNET_TESTBED_service_connect (NULL, |
297 | testpeers[0].p, "identity", | 282 | testpeers[0].p, |
298 | &identity_completion_cb, NULL, | 283 | "identity", |
299 | &identity_connect_adapter, | 284 | &identity_completion_cb, |
300 | &identity_disconnect_adapter, | 285 | NULL, |
301 | &testpeers[0]); | 286 | &identity_connect_adapter, |
302 | testpeers[1].identity_op | 287 | &identity_disconnect_adapter, |
303 | = GNUNET_TESTBED_service_connect (NULL, | 288 | &testpeers[0]); |
304 | testpeers[1].p, "identity", | 289 | testpeers[1].identity_op = |
305 | *identity_completion_cb, NULL, | 290 | GNUNET_TESTBED_service_connect (NULL, |
306 | &identity_connect_adapter, | 291 | testpeers[1].p, |
307 | &identity_disconnect_adapter, | 292 | "identity", |
308 | &testpeers[1]); | 293 | *identity_completion_cb, |
294 | NULL, | ||
295 | &identity_connect_adapter, | ||
296 | &identity_disconnect_adapter, | ||
297 | &testpeers[1]); | ||
309 | } | 298 | } |
310 | return NULL; | 299 | return NULL; |
311 | } | 300 | } |
@@ -322,35 +311,26 @@ core_completion_cb (void *cls, | |||
322 | completed++; | 311 | completed++; |
323 | if (NUM_TEST_PEERS == completed) | 312 | if (NUM_TEST_PEERS == completed) |
324 | { | 313 | { |
325 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 314 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Connected to CORE\n"); |
326 | "Connected to CORE\n"); | ||
327 | } | 315 | } |
328 | } | 316 | } |
329 | 317 | ||
330 | 318 | ||
331 | static void * | 319 | static void * |
332 | core_connect_adapter (void *cls, | 320 | core_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) |
333 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
334 | { | 321 | { |
335 | struct TestPeer *me = cls; | 322 | struct TestPeer *me = cls; |
336 | 323 | ||
337 | me->cfg = cfg; | 324 | me->cfg = cfg; |
338 | me->ch = GNUNET_CORE_connect (cfg, | 325 | me->ch = GNUNET_CORE_connect (cfg, me, NULL, &connect_cb, NULL, NULL); |
339 | me, | ||
340 | NULL, | ||
341 | &connect_cb, | ||
342 | NULL, | ||
343 | NULL); | ||
344 | if (NULL == me->ch) | 326 | if (NULL == me->ch) |
345 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 327 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to create CORE handle \n"); |
346 | "Failed to create CORE handle \n"); | ||
347 | return me->ch; | 328 | return me->ch; |
348 | } | 329 | } |
349 | 330 | ||
350 | 331 | ||
351 | static void | 332 | static void |
352 | core_disconnect_adapter (void *cls, | 333 | core_disconnect_adapter (void *cls, void *op_result) |
353 | void *op_result) | ||
354 | { | 334 | { |
355 | struct TestPeer *me = cls; | 335 | struct TestPeer *me = cls; |
356 | 336 | ||
@@ -369,8 +349,7 @@ test_connection (void *cls, | |||
369 | { | 349 | { |
370 | unsigned int c; | 350 | unsigned int c; |
371 | 351 | ||
372 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, | 352 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); |
373 | NULL); | ||
374 | if (NUM_TEST_PEERS != num_peers) | 353 | if (NUM_TEST_PEERS != num_peers) |
375 | { | 354 | { |
376 | ok = 4; | 355 | ok = 4; |
@@ -381,28 +360,28 @@ test_connection (void *cls, | |||
381 | GNUNET_SCHEDULER_shutdown (); | 360 | GNUNET_SCHEDULER_shutdown (); |
382 | return; | 361 | return; |
383 | } | 362 | } |
384 | /* We are generating a CLIQUE */ | 363 | /* We are generating a CLIQUE */ |
385 | if (NUM_TEST_PEERS * (NUM_TEST_PEERS -1) == links_succeeded) | 364 | if (NUM_TEST_PEERS * (NUM_TEST_PEERS - 1) == links_succeeded) |
386 | { | 365 | { |
387 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 366 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
388 | "Testbed connected peers, initializing test\n"); | 367 | "Testbed connected peers, initializing test\n"); |
389 | for (c = 0; c < num_peers; c++) | 368 | for (c = 0; c < num_peers; c++) |
390 | { | 369 | { |
391 | testpeers[c].p = peers[c]; | 370 | testpeers[c].p = peers[c]; |
392 | testpeers[c].core_op | 371 | testpeers[c].core_op = |
393 | = GNUNET_TESTBED_service_connect (NULL, | 372 | GNUNET_TESTBED_service_connect (NULL, |
394 | testpeers[c].p, | 373 | testpeers[c].p, |
395 | "core", | 374 | "core", |
396 | &core_completion_cb, NULL, | 375 | &core_completion_cb, |
397 | &core_connect_adapter, | 376 | NULL, |
398 | &core_disconnect_adapter, | 377 | &core_connect_adapter, |
399 | &testpeers[c]); | 378 | &core_disconnect_adapter, |
379 | &testpeers[c]); | ||
400 | } | 380 | } |
401 | } | 381 | } |
402 | else | 382 | else |
403 | { | 383 | { |
404 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 384 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Testbed failed to connect peers\n"); |
405 | "Testbed failed to connect peers\n"); | ||
406 | ok = 5; | 385 | ok = 5; |
407 | GNUNET_SCHEDULER_shutdown (); | 386 | GNUNET_SCHEDULER_shutdown (); |
408 | return; | 387 | return; |
@@ -411,16 +390,18 @@ test_connection (void *cls, | |||
411 | 390 | ||
412 | 391 | ||
413 | int | 392 | int |
414 | main (int argc, | 393 | main (int argc, char *argv[]) |
415 | char *argv[]) | ||
416 | { | 394 | { |
417 | ok = 1; | 395 | ok = 1; |
418 | /* Connecting initial topology */ | 396 | /* Connecting initial topology */ |
419 | (void) GNUNET_TESTBED_test_run ("test-revocation", | 397 | (void) GNUNET_TESTBED_test_run ("test-revocation", |
420 | "test_revocation.conf", | 398 | "test_revocation.conf", |
421 | NUM_TEST_PEERS, 0, | 399 | NUM_TEST_PEERS, |
422 | NULL, NULL, | 400 | 0, |
423 | &test_connection, NULL); | 401 | NULL, |
402 | NULL, | ||
403 | &test_connection, | ||
404 | NULL); | ||
424 | return ok; | 405 | return ok; |
425 | } | 406 | } |
426 | 407 | ||
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index fa85e775c..c076028fe 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am | |||
@@ -595,8 +595,7 @@ check_PROGRAMS = \ | |||
595 | $(HTTP_QUOTA_TEST) \ | 595 | $(HTTP_QUOTA_TEST) \ |
596 | $(HTTPS_QUOTA_TEST) \ | 596 | $(HTTPS_QUOTA_TEST) \ |
597 | $(WLAN_QUOTA_TEST) \ | 597 | $(WLAN_QUOTA_TEST) \ |
598 | $(BT_QUOTA_TEST) \ | 598 | $(BT_QUOTA_TEST) |
599 | test_communicator_unix | ||
600 | if HAVE_GETOPT_BINARY | 599 | if HAVE_GETOPT_BINARY |
601 | check_PROGRAMS += \ | 600 | check_PROGRAMS += \ |
602 | test_transport_api_slow_ats | 601 | test_transport_api_slow_ats |