aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/test_namestore_api_zone_iteration.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-10-05 15:09:28 +0200
committerChristian Grothoff <christian@grothoff.org>2019-10-05 15:09:28 +0200
commitc4e9ba925ffd758aaa3feee2ccfc0b76f26fe207 (patch)
treecac3ce030d77b4cbe7c7dc62ed58cfe6d24f73e1 /src/namestore/test_namestore_api_zone_iteration.c
parentfbb71d527c7d6babf269a8fefce1db291b9f7068 (diff)
downloadgnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.tar.gz
gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.zip
global reindent, now with uncrustify hook enabled
Diffstat (limited to 'src/namestore/test_namestore_api_zone_iteration.c')
-rw-r--r--src/namestore/test_namestore_api_zone_iteration.c617
1 files changed, 309 insertions, 308 deletions
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c
index 62686403a..d69b7cc62 100644
--- a/src/namestore/test_namestore_api_zone_iteration.c
+++ b/src/namestore/test_namestore_api_zone_iteration.c
@@ -30,16 +30,16 @@
30#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT 30#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
31 31
32 32
33#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 100) 33#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100)
34 34
35 35
36static struct GNUNET_NAMESTORE_Handle * nsh; 36static struct GNUNET_NAMESTORE_Handle *nsh;
37 37
38static struct GNUNET_SCHEDULER_Task * endbadly_task; 38static struct GNUNET_SCHEDULER_Task *endbadly_task;
39 39
40static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey; 40static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey;
41 41
42static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey2; 42static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey2;
43 43
44static struct GNUNET_NAMESTORE_ZoneIterator *zi; 44static struct GNUNET_NAMESTORE_ZoneIterator *zi;
45 45
@@ -47,15 +47,15 @@ static int res;
47 47
48static int returned_records; 48static int returned_records;
49 49
50static char * s_name_1; 50static char *s_name_1;
51 51
52static struct GNUNET_GNSRECORD_Data *s_rd_1; 52static struct GNUNET_GNSRECORD_Data *s_rd_1;
53 53
54static char * s_name_2; 54static char *s_name_2;
55 55
56static struct GNUNET_GNSRECORD_Data *s_rd_2; 56static struct GNUNET_GNSRECORD_Data *s_rd_2;
57 57
58static char * s_name_3; 58static char *s_name_3;
59 59
60static struct GNUNET_GNSRECORD_Data *s_rd_3; 60static struct GNUNET_GNSRECORD_Data *s_rd_3;
61 61
@@ -67,268 +67,269 @@ static struct GNUNET_GNSRECORD_Data *s_rd_3;
67 * @param tc scheduler context 67 * @param tc scheduler context
68 */ 68 */
69static void 69static void
70endbadly(void *cls) 70endbadly (void *cls)
71{ 71{
72 endbadly_task = NULL; 72 endbadly_task = NULL;
73 GNUNET_SCHEDULER_shutdown(); 73 GNUNET_SCHEDULER_shutdown ();
74 res = 1; 74 res = 1;
75} 75}
76 76
77 77
78static void 78static void
79end(void *cls) 79end (void *cls)
80{ 80{
81 if (NULL != zi) 81 if (NULL != zi)
82 { 82 {
83 GNUNET_NAMESTORE_zone_iteration_stop(zi); 83 GNUNET_NAMESTORE_zone_iteration_stop (zi);
84 zi = NULL; 84 zi = NULL;
85 } 85 }
86 if (NULL != endbadly_task) 86 if (NULL != endbadly_task)
87 { 87 {
88 GNUNET_SCHEDULER_cancel(endbadly_task); 88 GNUNET_SCHEDULER_cancel (endbadly_task);
89 endbadly_task = NULL; 89 endbadly_task = NULL;
90 } 90 }
91 if (NULL != privkey) 91 if (NULL != privkey)
92 { 92 {
93 GNUNET_free(privkey); 93 GNUNET_free (privkey);
94 privkey = NULL; 94 privkey = NULL;
95 } 95 }
96 if (NULL != privkey2) 96 if (NULL != privkey2)
97 { 97 {
98 GNUNET_free(privkey2); 98 GNUNET_free (privkey2);
99 privkey2 = NULL; 99 privkey2 = NULL;
100 } 100 }
101 GNUNET_free_non_null(s_name_1); 101 GNUNET_free_non_null (s_name_1);
102 GNUNET_free_non_null(s_name_2); 102 GNUNET_free_non_null (s_name_2);
103 GNUNET_free_non_null(s_name_3); 103 GNUNET_free_non_null (s_name_3);
104 if (NULL != s_rd_1) 104 if (NULL != s_rd_1)
105 { 105 {
106 GNUNET_free((void *)s_rd_1->data); 106 GNUNET_free ((void *) s_rd_1->data);
107 GNUNET_free(s_rd_1); 107 GNUNET_free (s_rd_1);
108 } 108 }
109 if (NULL != s_rd_2) 109 if (NULL != s_rd_2)
110 { 110 {
111 GNUNET_free((void *)s_rd_2->data); 111 GNUNET_free ((void *) s_rd_2->data);
112 GNUNET_free(s_rd_2); 112 GNUNET_free (s_rd_2);
113 } 113 }
114 if (NULL != s_rd_3) 114 if (NULL != s_rd_3)
115 { 115 {
116 GNUNET_free((void *)s_rd_3->data); 116 GNUNET_free ((void *) s_rd_3->data);
117 GNUNET_free(s_rd_3); 117 GNUNET_free (s_rd_3);
118 } 118 }
119 if (NULL != nsh) 119 if (NULL != nsh)
120 { 120 {
121 GNUNET_NAMESTORE_disconnect(nsh); 121 GNUNET_NAMESTORE_disconnect (nsh);
122 nsh = NULL; 122 nsh = NULL;
123 } 123 }
124} 124}
125 125
126 126
127static void 127static void
128zone_end(void *cls) 128zone_end (void *cls)
129{ 129{
130 GNUNET_break(3 == returned_records); 130 GNUNET_break (3 == returned_records);
131 if (3 == returned_records) 131 if (3 == returned_records)
132 { 132 {
133 res = 0; /* Last iteraterator callback, we are done */ 133 res = 0; /* Last iteraterator callback, we are done */
134 zi = NULL; 134 zi = NULL;
135 } 135 }
136 else 136 else
137 res = 1; 137 res = 1;
138 138
139 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 139 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
140 "Received last result, iteration done after receing %u results\n", 140 "Received last result, iteration done after receing %u results\n",
141 returned_records); 141 returned_records);
142 GNUNET_SCHEDULER_shutdown(); 142 GNUNET_SCHEDULER_shutdown ();
143} 143}
144 144
145 145
146static void 146static void
147fail_cb(void *cls) 147fail_cb (void *cls)
148{ 148{
149 GNUNET_assert(0); 149 GNUNET_assert (0);
150} 150}
151 151
152 152
153static void 153static void
154zone_proc(void *cls, 154zone_proc (void *cls,
155 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 155 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
156 const char *label, 156 const char *label,
157 unsigned int rd_count, 157 unsigned int rd_count,
158 const struct GNUNET_GNSRECORD_Data *rd) 158 const struct GNUNET_GNSRECORD_Data *rd)
159{ 159{
160 int failed = GNUNET_NO; 160 int failed = GNUNET_NO;
161 161
162 GNUNET_assert(NULL != zone); 162 GNUNET_assert (NULL != zone);
163 if (0 == GNUNET_memcmp(zone, 163 if (0 == GNUNET_memcmp (zone,
164 privkey)) 164 privkey))
165 {
166 if (0 == strcmp (label, s_name_1))
165 { 167 {
166 if (0 == strcmp(label, s_name_1)) 168 if (rd_count == 1)
167 { 169 {
168 if (rd_count == 1) 170 if (GNUNET_YES != GNUNET_GNSRECORD_records_cmp (rd, s_rd_1))
169 {
170 if (GNUNET_YES != GNUNET_GNSRECORD_records_cmp(rd, s_rd_1))
171 {
172 failed = GNUNET_YES;
173 GNUNET_break(0);
174 }
175 }
176 else
177 {
178 failed = GNUNET_YES;
179 GNUNET_break(0);
180 }
181 }
182 else if (0 == strcmp(label, s_name_2))
183 { 171 {
184 if (rd_count == 1)
185 {
186 if (GNUNET_YES != GNUNET_GNSRECORD_records_cmp(rd, s_rd_2))
187 {
188 failed = GNUNET_YES;
189 GNUNET_break(0);
190 }
191 }
192 else
193 {
194 GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
195 "Received invalid record count\n");
196 failed = GNUNET_YES;
197 GNUNET_break(0);
198 }
199 }
200 else
201 {
202 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
203 "Comparing result failed: got name `%s' for first zone\n",
204 label);
205 failed = GNUNET_YES; 172 failed = GNUNET_YES;
206 GNUNET_break(0); 173 GNUNET_break (0);
207 } 174 }
175 }
176 else
177 {
178 failed = GNUNET_YES;
179 GNUNET_break (0);
180 }
208 } 181 }
209 else if (0 == GNUNET_memcmp(zone, 182 else if (0 == strcmp (label, s_name_2))
210 privkey2))
211 { 183 {
212 if (0 == strcmp(label, s_name_3)) 184 if (rd_count == 1)
185 {
186 if (GNUNET_YES != GNUNET_GNSRECORD_records_cmp (rd, s_rd_2))
213 { 187 {
214 if (rd_count == 1) 188 failed = GNUNET_YES;
215 { 189 GNUNET_break (0);
216 if (GNUNET_YES != GNUNET_GNSRECORD_records_cmp(rd, s_rd_3))
217 {
218 failed = GNUNET_YES;
219 GNUNET_break(0);
220 }
221 }
222 else
223 {
224 GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
225 "Received invalid record count\n");
226 failed = GNUNET_YES;
227 GNUNET_break(0);
228 }
229 } 190 }
191 }
230 else 192 else
193 {
194 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
195 "Received invalid record count\n");
196 failed = GNUNET_YES;
197 GNUNET_break (0);
198 }
199 }
200 else
201 {
202 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
203 "Comparing result failed: got name `%s' for first zone\n",
204 label);
205 failed = GNUNET_YES;
206 GNUNET_break (0);
207 }
208 }
209 else if (0 == GNUNET_memcmp (zone,
210 privkey2))
211 {
212 if (0 == strcmp (label, s_name_3))
213 {
214 if (rd_count == 1)
215 {
216 if (GNUNET_YES != GNUNET_GNSRECORD_records_cmp (rd, s_rd_3))
231 { 217 {
232 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
233 "Comparing result failed: got name `%s' for first zone\n",
234 label);
235 failed = GNUNET_YES; 218 failed = GNUNET_YES;
236 GNUNET_break(0); 219 GNUNET_break (0);
237 } 220 }
221 }
222 else
223 {
224 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
225 "Received invalid record count\n");
226 failed = GNUNET_YES;
227 GNUNET_break (0);
228 }
238 } 229 }
239 else 230 else
240 { 231 {
241 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 232 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
242 "Received invalid zone\n"); 233 "Comparing result failed: got name `%s' for first zone\n",
234 label);
243 failed = GNUNET_YES; 235 failed = GNUNET_YES;
244 GNUNET_break(0); 236 GNUNET_break (0);
245 } 237 }
238 }
239 else
240 {
241 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
242 "Received invalid zone\n");
243 failed = GNUNET_YES;
244 GNUNET_break (0);
245 }
246 246
247 if (failed == GNUNET_NO) 247 if (failed == GNUNET_NO)
248 { 248 {
249 returned_records++; 249 returned_records++;
250 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 250 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
251 "Telling namestore to send the next result\n"); 251 "Telling namestore to send the next result\n");
252 GNUNET_NAMESTORE_zone_iterator_next(zi, 252 GNUNET_NAMESTORE_zone_iterator_next (zi,
253 1); 253 1);
254 } 254 }
255 else 255 else
256 { 256 {
257 GNUNET_break(0); 257 GNUNET_break (0);
258 GNUNET_SCHEDULER_shutdown(); 258 GNUNET_SCHEDULER_shutdown ();
259 res = 1; 259 res = 1;
260 } 260 }
261} 261}
262 262
263 263
264static void 264static void
265put_cont(void *cls, 265put_cont (void *cls,
266 int32_t success, 266 int32_t success,
267 const char *emsg) 267 const char *emsg)
268{ 268{
269 static int c = 0; 269 static int c = 0;
270 270
271 if (success == GNUNET_OK) 271 if (success == GNUNET_OK)
272 { 272 {
273 c++; 273 c++;
274 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 274 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
275 "Created record %u \n", 275 "Created record %u \n",
276 c); 276 c);
277 } 277 }
278 else 278 else
279 { 279 {
280 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 280 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
281 "Failed to created records: `%s'\n", 281 "Failed to created records: `%s'\n",
282 emsg); 282 emsg);
283 GNUNET_break(0); 283 GNUNET_break (0);
284 GNUNET_SCHEDULER_shutdown(); 284 GNUNET_SCHEDULER_shutdown ();
285 res = 1; 285 res = 1;
286 return; 286 return;
287 } 287 }
288 288
289 if (c == 3) 289 if (c == 3)
290 {
291 res = 1;
292 returned_records = 0;
293 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
294 "All records created, starting iteration over all zones \n");
295 zi = GNUNET_NAMESTORE_zone_iteration_start (nsh,
296 NULL,
297 &fail_cb,
298 NULL,
299 &zone_proc,
300 NULL,
301 &zone_end,
302 NULL);
303 if (zi == NULL)
290 { 304 {
305 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
306 "Failed to create zone iterator\n");
307 GNUNET_break (0);
308 GNUNET_SCHEDULER_shutdown ();
291 res = 1; 309 res = 1;
292 returned_records = 0; 310 return;
293 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
294 "All records created, starting iteration over all zones \n");
295 zi = GNUNET_NAMESTORE_zone_iteration_start(nsh,
296 NULL,
297 &fail_cb,
298 NULL,
299 &zone_proc,
300 NULL,
301 &zone_end,
302 NULL);
303 if (zi == NULL)
304 {
305 GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
306 "Failed to create zone iterator\n");
307 GNUNET_break(0);
308 GNUNET_SCHEDULER_shutdown();
309 res = 1;
310 return;
311 }
312 } 311 }
312 }
313} 313}
314 314
315 315
316static struct GNUNET_GNSRECORD_Data * 316static struct GNUNET_GNSRECORD_Data *
317create_record(unsigned int count) 317create_record (unsigned int count)
318{ 318{
319 struct GNUNET_GNSRECORD_Data * rd; 319 struct GNUNET_GNSRECORD_Data *rd;
320 320
321 rd = GNUNET_new_array(count, 321 rd = GNUNET_new_array (count,
322 struct GNUNET_GNSRECORD_Data); 322 struct GNUNET_GNSRECORD_Data);
323 for (unsigned int c = 0; c < count; c++) 323 for (unsigned int c = 0; c < count; c++)
324 { 324 {
325 rd[c].expiration_time = GNUNET_TIME_relative_to_absolute(GNUNET_TIME_UNIT_HOURS).abs_value_us; 325 rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (
326 rd[c].record_type = TEST_RECORD_TYPE; 326 GNUNET_TIME_UNIT_HOURS).abs_value_us;
327 rd[c].data_size = 50; 327 rd[c].record_type = TEST_RECORD_TYPE;
328 rd[c].data = GNUNET_malloc(50); 328 rd[c].data_size = 50;
329 rd[c].flags = 0; 329 rd[c].data = GNUNET_malloc (50);
330 memset((char *)rd[c].data, 'a', 50); 330 rd[c].flags = 0;
331 } 331 memset ((char *) rd[c].data, 'a', 50);
332 }
332 return rd; 333 return rd;
333} 334}
334 335
@@ -339,128 +340,128 @@ create_record(unsigned int count)
339 * start the actual tests by filling the zone. 340 * start the actual tests by filling the zone.
340 */ 341 */
341static void 342static void
342empty_zone_proc(void *cls, 343empty_zone_proc (void *cls,
343 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 344 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
344 const char *label, 345 const char *label,
345 unsigned int rd_count, 346 unsigned int rd_count,
346 const struct GNUNET_GNSRECORD_Data *rd) 347 const struct GNUNET_GNSRECORD_Data *rd)
347{ 348{
348 GNUNET_assert(nsh == cls); 349 GNUNET_assert (nsh == cls);
349 if (NULL != zone) 350 if (NULL != zone)
350 { 351 {
351 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 352 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
352 _("Expected empty zone but received zone private key\n")); 353 _ ("Expected empty zone but received zone private key\n"));
353 GNUNET_break(0); 354 GNUNET_break (0);
354 GNUNET_SCHEDULER_shutdown(); 355 GNUNET_SCHEDULER_shutdown ();
355 res = 1; 356 res = 1;
356 return; 357 return;
357 } 358 }
358 if ((NULL != label) || (NULL != rd) || (0 != rd_count)) 359 if ((NULL != label) || (NULL != rd) || (0 != rd_count))
359 { 360 {
360 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 361 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
361 _("Expected no zone content but received data\n")); 362 _ ("Expected no zone content but received data\n"));
362 GNUNET_break(0); 363 GNUNET_break (0);
363 GNUNET_SCHEDULER_shutdown(); 364 GNUNET_SCHEDULER_shutdown ();
364 res = 1; 365 res = 1;
365 return; 366 return;
366 } 367 }
367 GNUNET_assert(0); 368 GNUNET_assert (0);
368} 369}
369 370
370 371
371static void 372static void
372empty_zone_end(void *cls) 373empty_zone_end (void *cls)
373{ 374{
374 char *hostkey_file; 375 char *hostkey_file;
375 376
376 zi = NULL; 377 zi = NULL;
377 GNUNET_asprintf(&hostkey_file, 378 GNUNET_asprintf (&hostkey_file,
378 "zonefiles%s%s", 379 "zonefiles%s%s",
379 DIR_SEPARATOR_STR, 380 DIR_SEPARATOR_STR,
380 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); 381 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey");
381 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 382 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
382 "Using zonekey file `%s' \n", 383 "Using zonekey file `%s' \n",
383 hostkey_file); 384 hostkey_file);
384 privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file(hostkey_file); 385 privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file);
385 GNUNET_free(hostkey_file); 386 GNUNET_free (hostkey_file);
386 GNUNET_assert(privkey != NULL); 387 GNUNET_assert (privkey != NULL);
387 388
388 GNUNET_asprintf(&hostkey_file, 389 GNUNET_asprintf (&hostkey_file,
389 "zonefiles%s%s", 390 "zonefiles%s%s",
390 DIR_SEPARATOR_STR, 391 DIR_SEPARATOR_STR,
391 "HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey"); 392 "HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey");
392 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 393 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
393 "Using zonekey file `%s' \n", 394 "Using zonekey file `%s' \n",
394 hostkey_file); 395 hostkey_file);
395 privkey2 = GNUNET_CRYPTO_ecdsa_key_create_from_file(hostkey_file); 396 privkey2 = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file);
396 GNUNET_free(hostkey_file); 397 GNUNET_free (hostkey_file);
397 GNUNET_assert(privkey2 != NULL); 398 GNUNET_assert (privkey2 != NULL);
398 399
399 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Created record 1\n"); 400 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 1\n");
400 401
401 GNUNET_asprintf(&s_name_1, "dummy1"); 402 GNUNET_asprintf (&s_name_1, "dummy1");
402 s_rd_1 = create_record(1); 403 s_rd_1 = create_record (1);
403 GNUNET_NAMESTORE_records_store(nsh, 404 GNUNET_NAMESTORE_records_store (nsh,
404 privkey, 405 privkey,
405 s_name_1, 406 s_name_1,
406 1, s_rd_1, 407 1, s_rd_1,
407 &put_cont, 408 &put_cont,
408 NULL); 409 NULL);
409 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 410 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
410 "Created record 2 \n"); 411 "Created record 2 \n");
411 GNUNET_asprintf(&s_name_2, "dummy2"); 412 GNUNET_asprintf (&s_name_2, "dummy2");
412 s_rd_2 = create_record(1); 413 s_rd_2 = create_record (1);
413 GNUNET_NAMESTORE_records_store(nsh, 414 GNUNET_NAMESTORE_records_store (nsh,
414 privkey, 415 privkey,
415 s_name_2, 416 s_name_2,
416 1, s_rd_2, 417 1, s_rd_2,
417 &put_cont, 418 &put_cont,
418 NULL); 419 NULL);
419 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 420 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
420 "Created record 3\n"); 421 "Created record 3\n");
421 /* name in different zone */ 422 /* name in different zone */
422 GNUNET_asprintf(&s_name_3, "dummy3"); 423 GNUNET_asprintf (&s_name_3, "dummy3");
423 s_rd_3 = create_record(1); 424 s_rd_3 = create_record (1);
424 GNUNET_NAMESTORE_records_store(nsh, 425 GNUNET_NAMESTORE_records_store (nsh,
425 privkey2, 426 privkey2,
426 s_name_3, 427 s_name_3,
427 1, 428 1,
428 s_rd_3, 429 s_rd_3,
429 &put_cont, 430 &put_cont,
430 NULL); 431 NULL);
431} 432}
432 433
433 434
434static void 435static void
435run(void *cls, 436run (void *cls,
436 const struct GNUNET_CONFIGURATION_Handle *cfg, 437 const struct GNUNET_CONFIGURATION_Handle *cfg,
437 struct GNUNET_TESTING_Peer *peer) 438 struct GNUNET_TESTING_Peer *peer)
438{ 439{
439 endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT, 440 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
440 &endbadly, 441 &endbadly,
441 NULL); 442 NULL);
442 GNUNET_SCHEDULER_add_shutdown(&end, 443 GNUNET_SCHEDULER_add_shutdown (&end,
443 NULL); 444 NULL);
444 445
445 nsh = GNUNET_NAMESTORE_connect(cfg); 446 nsh = GNUNET_NAMESTORE_connect (cfg);
446 GNUNET_break(NULL != nsh); 447 GNUNET_break (NULL != nsh);
447 /* first, iterate over empty namestore */ 448 /* first, iterate over empty namestore */
448 zi = GNUNET_NAMESTORE_zone_iteration_start(nsh, 449 zi = GNUNET_NAMESTORE_zone_iteration_start (nsh,
449 NULL, 450 NULL,
450 &fail_cb, 451 &fail_cb,
451 NULL, 452 NULL,
452 &empty_zone_proc, 453 &empty_zone_proc,
453 nsh, 454 nsh,
454 &empty_zone_end, 455 &empty_zone_end,
455 NULL); 456 NULL);
456 if (NULL == zi) 457 if (NULL == zi)
457 { 458 {
458 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 459 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
459 "Failed to create zone iterator\n"); 460 "Failed to create zone iterator\n");
460 GNUNET_break(0); 461 GNUNET_break (0);
461 res = 1; 462 res = 1;
462 GNUNET_SCHEDULER_shutdown(); 463 GNUNET_SCHEDULER_shutdown ();
463 } 464 }
464} 465}
465 466
466 467
@@ -468,24 +469,24 @@ run(void *cls,
468 469
469 470
470int 471int
471main(int argc, char *argv[]) 472main (int argc, char *argv[])
472{ 473{
473 const char *plugin_name; 474 const char *plugin_name;
474 char *cfg_name; 475 char *cfg_name;
475 476
476 SETUP_CFG(plugin_name, cfg_name); 477 SETUP_CFG (plugin_name, cfg_name);
477 res = 1; 478 res = 1;
478 if (0 != 479 if (0 !=
479 GNUNET_TESTING_peer_run("test-namestore-api-zone-iteration", 480 GNUNET_TESTING_peer_run ("test-namestore-api-zone-iteration",
480 cfg_name, 481 cfg_name,
481 &run, 482 &run,
482 NULL)) 483 NULL))
483 { 484 {
484 res = 1; 485 res = 1;
485 } 486 }
486 GNUNET_DISK_purge_cfg_dir(cfg_name, 487 GNUNET_DISK_purge_cfg_dir (cfg_name,
487 "GNUNET_TEST_HOME"); 488 "GNUNET_TEST_HOME");
488 GNUNET_free(cfg_name); 489 GNUNET_free (cfg_name);
489 return res; 490 return res;
490} 491}
491 492