summaryrefslogtreecommitdiff
path: root/src/namecache/namecache_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/namecache/namecache_api.c')
-rw-r--r--src/namecache/namecache_api.c353
1 files changed, 178 insertions, 175 deletions
diff --git a/src/namecache/namecache_api.c b/src/namecache/namecache_api.c
index 9cf9eca77..0c904c9ed 100644
--- a/src/namecache/namecache_api.c
+++ b/src/namecache/namecache_api.c
@@ -37,14 +37,15 @@
37#include "namecache.h" 37#include "namecache.h"
38 38
39 39
40#define LOG(kind, ...) GNUNET_log_from(kind, "namecache-api", __VA_ARGS__) 40#define LOG(kind, ...) GNUNET_log_from (kind, "namecache-api", __VA_ARGS__)
41 41
42 42
43/** 43/**
44 * An QueueEntry used to store information for a pending 44 * An QueueEntry used to store information for a pending
45 * NAMECACHE record operation 45 * NAMECACHE record operation
46 */ 46 */
47struct GNUNET_NAMECACHE_QueueEntry { 47struct GNUNET_NAMECACHE_QueueEntry
48{
48 /** 49 /**
49 * Kept in a DLL. 50 * Kept in a DLL.
50 */ 51 */
@@ -90,7 +91,8 @@ struct GNUNET_NAMECACHE_QueueEntry {
90/** 91/**
91 * Connection to the NAMECACHE service. 92 * Connection to the NAMECACHE service.
92 */ 93 */
93struct GNUNET_NAMECACHE_Handle { 94struct GNUNET_NAMECACHE_Handle
95{
94 /** 96 /**
95 * Configuration to use. 97 * Configuration to use.
96 */ 98 */
@@ -144,7 +146,7 @@ struct GNUNET_NAMECACHE_Handle {
144 * @param h our handle 146 * @param h our handle
145 */ 147 */
146static void 148static void
147force_reconnect(struct GNUNET_NAMECACHE_Handle *h); 149force_reconnect (struct GNUNET_NAMECACHE_Handle *h);
148 150
149 151
150/** 152/**
@@ -155,21 +157,21 @@ force_reconnect(struct GNUNET_NAMECACHE_Handle *h);
155 * @return NULL if not found, otherwise the queue entry (removed from the queue) 157 * @return NULL if not found, otherwise the queue entry (removed from the queue)
156 */ 158 */
157static struct GNUNET_NAMECACHE_QueueEntry * 159static struct GNUNET_NAMECACHE_QueueEntry *
158find_qe(struct GNUNET_NAMECACHE_Handle *h, 160find_qe (struct GNUNET_NAMECACHE_Handle *h,
159 uint32_t rid) 161 uint32_t rid)
160{ 162{
161 struct GNUNET_NAMECACHE_QueueEntry *qe; 163 struct GNUNET_NAMECACHE_QueueEntry *qe;
162 164
163 for (qe = h->op_head; qe != NULL; qe = qe->next) 165 for (qe = h->op_head; qe != NULL; qe = qe->next)
166 {
167 if (qe->op_id == rid)
164 { 168 {
165 if (qe->op_id == rid) 169 GNUNET_CONTAINER_DLL_remove (h->op_head,
166 { 170 h->op_tail,
167 GNUNET_CONTAINER_DLL_remove(h->op_head, 171 qe);
168 h->op_tail, 172 return qe;
169 qe);
170 return qe;
171 }
172 } 173 }
174 }
173 return NULL; 175 return NULL;
174} 176}
175 177
@@ -182,8 +184,8 @@ find_qe(struct GNUNET_NAMECACHE_Handle *h,
182 * @param msg the message we received 184 * @param msg the message we received
183 */ 185 */
184static int 186static int
185check_lookup_block_response(void *cls, 187check_lookup_block_response (void *cls,
186 const struct LookupBlockResponseMessage *msg) 188 const struct LookupBlockResponseMessage *msg)
187{ 189{
188 /* any length will do, format validation is in handler */ 190 /* any length will do, format validation is in handler */
189 return GNUNET_OK; 191 return GNUNET_OK;
@@ -198,62 +200,63 @@ check_lookup_block_response(void *cls,
198 * @param msg the message we received 200 * @param msg the message we received
199 */ 201 */
200static void 202static void
201handle_lookup_block_response(void *cls, 203handle_lookup_block_response (void *cls,
202 const struct LookupBlockResponseMessage *msg) 204 const struct LookupBlockResponseMessage *msg)
203{ 205{
204 struct GNUNET_NAMECACHE_Handle *h = cls; 206 struct GNUNET_NAMECACHE_Handle *h = cls;
205 size_t size; 207 size_t size;
206 struct GNUNET_NAMECACHE_QueueEntry *qe; 208 struct GNUNET_NAMECACHE_QueueEntry *qe;
207 209
208 LOG(GNUNET_ERROR_TYPE_DEBUG, 210 LOG (GNUNET_ERROR_TYPE_DEBUG,
209 "Received LOOKUP_BLOCK_RESPONSE\n"); 211 "Received LOOKUP_BLOCK_RESPONSE\n");
210 qe = find_qe(h, 212 qe = find_qe (h,
211 ntohl(msg->gns_header.r_id)); 213 ntohl (msg->gns_header.r_id));
212 if (NULL == qe) 214 if (NULL == qe)
213 return; 215 return;
214 if (0 == GNUNET_TIME_absolute_ntoh(msg->expire).abs_value_us) 216 if (0 == GNUNET_TIME_absolute_ntoh (msg->expire).abs_value_us)
215 { 217 {
216 /* no match found */ 218 /* no match found */
217 if (NULL != qe->block_proc) 219 if (NULL != qe->block_proc)
218 qe->block_proc(qe->block_proc_cls, 220 qe->block_proc (qe->block_proc_cls,
219 NULL); 221 NULL);
220 GNUNET_free(qe); 222 GNUNET_free (qe);
221 return; 223 return;
222 } 224 }
223 size = ntohs(msg->gns_header.header.size) 225 size = ntohs (msg->gns_header.header.size)
224 - sizeof(struct LookupBlockResponseMessage); 226 - sizeof(struct LookupBlockResponseMessage);
225 { 227 {
226 char buf[size + sizeof(struct GNUNET_GNSRECORD_Block)] GNUNET_ALIGN; 228 char buf[size + sizeof(struct GNUNET_GNSRECORD_Block)] GNUNET_ALIGN;
227 struct GNUNET_GNSRECORD_Block *block; 229 struct GNUNET_GNSRECORD_Block *block;
228 230
229 block = (struct GNUNET_GNSRECORD_Block *)buf; 231 block = (struct GNUNET_GNSRECORD_Block *) buf;
230 block->signature = msg->signature; 232 block->signature = msg->signature;
231 block->derived_key = msg->derived_key; 233 block->derived_key = msg->derived_key;
232 block->purpose.purpose = htonl(GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN); 234 block->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN);
233 block->purpose.size = htonl(size + 235 block->purpose.size = htonl (size
234 sizeof(struct GNUNET_TIME_AbsoluteNBO) + 236 + sizeof(struct GNUNET_TIME_AbsoluteNBO)
235 sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)); 237 + sizeof(struct
238 GNUNET_CRYPTO_EccSignaturePurpose));
236 block->expiration_time = msg->expire; 239 block->expiration_time = msg->expire;
237 GNUNET_memcpy(&block[1], 240 GNUNET_memcpy (&block[1],
238 &msg[1], 241 &msg[1],
239 size); 242 size);
240 if (GNUNET_OK != 243 if (GNUNET_OK !=
241 GNUNET_GNSRECORD_block_verify(block)) 244 GNUNET_GNSRECORD_block_verify (block))
242 { 245 {
243 GNUNET_break(0); 246 GNUNET_break (0);
244 if (NULL != qe->block_proc) 247 if (NULL != qe->block_proc)
245 qe->block_proc(qe->block_proc_cls, 248 qe->block_proc (qe->block_proc_cls,
246 NULL); 249 NULL);
247 force_reconnect(h); 250 force_reconnect (h);
248 } 251 }
249 else 252 else
250 { 253 {
251 if (NULL != qe->block_proc) 254 if (NULL != qe->block_proc)
252 qe->block_proc(qe->block_proc_cls, 255 qe->block_proc (qe->block_proc_cls,
253 block); 256 block);
254 } 257 }
255 } 258 }
256 GNUNET_free(qe); 259 GNUNET_free (qe);
257} 260}
258 261
259 262
@@ -267,28 +270,28 @@ handle_lookup_block_response(void *cls,
267 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error and we did NOT notify the client 270 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error and we did NOT notify the client
268 */ 271 */
269static void 272static void
270handle_block_cache_response(void *cls, 273handle_block_cache_response (void *cls,
271 const struct BlockCacheResponseMessage *msg) 274 const struct BlockCacheResponseMessage *msg)
272{ 275{
273 struct GNUNET_NAMECACHE_Handle *h = cls; 276 struct GNUNET_NAMECACHE_Handle *h = cls;
274 struct GNUNET_NAMECACHE_QueueEntry *qe; 277 struct GNUNET_NAMECACHE_QueueEntry *qe;
275 int res; 278 int res;
276 279
277 LOG(GNUNET_ERROR_TYPE_DEBUG, 280 LOG (GNUNET_ERROR_TYPE_DEBUG,
278 "Received BLOCK_CACHE_RESPONSE\n"); 281 "Received BLOCK_CACHE_RESPONSE\n");
279 qe = find_qe(h, 282 qe = find_qe (h,
280 ntohl(msg->gns_header.r_id)); 283 ntohl (msg->gns_header.r_id));
281 if (NULL == qe) 284 if (NULL == qe)
282 return; 285 return;
283 res = ntohl(msg->op_result); 286 res = ntohl (msg->op_result);
284 /* TODO: add actual error message from namecache to response... */ 287 /* TODO: add actual error message from namecache to response... */
285 if (NULL != qe->cont) 288 if (NULL != qe->cont)
286 qe->cont(qe->cont_cls, 289 qe->cont (qe->cont_cls,
287 res, 290 res,
288 (GNUNET_OK == res) 291 (GNUNET_OK == res)
289 ? NULL 292 ? NULL
290 : _("Namecache failed to cache block")); 293 : _ ("Namecache failed to cache block"));
291 GNUNET_free(qe); 294 GNUNET_free (qe);
292} 295}
293 296
294 297
@@ -301,12 +304,12 @@ handle_block_cache_response(void *cls,
301 * @param error error code 304 * @param error error code
302 */ 305 */
303static void 306static void
304mq_error_handler(void *cls, 307mq_error_handler (void *cls,
305 enum GNUNET_MQ_Error error) 308 enum GNUNET_MQ_Error error)
306{ 309{
307 struct GNUNET_NAMECACHE_Handle *h = cls; 310 struct GNUNET_NAMECACHE_Handle *h = cls;
308 311
309 force_reconnect(h); 312 force_reconnect (h);
310} 313}
311 314
312 315
@@ -316,26 +319,26 @@ mq_error_handler(void *cls,
316 * @param h the handle to the NAMECACHE service 319 * @param h the handle to the NAMECACHE service
317 */ 320 */
318static void 321static void
319reconnect(struct GNUNET_NAMECACHE_Handle *h) 322reconnect (struct GNUNET_NAMECACHE_Handle *h)
320{ 323{
321 struct GNUNET_MQ_MessageHandler handlers[] = { 324 struct GNUNET_MQ_MessageHandler handlers[] = {
322 GNUNET_MQ_hd_var_size(lookup_block_response, 325 GNUNET_MQ_hd_var_size (lookup_block_response,
323 GNUNET_MESSAGE_TYPE_NAMECACHE_LOOKUP_BLOCK_RESPONSE, 326 GNUNET_MESSAGE_TYPE_NAMECACHE_LOOKUP_BLOCK_RESPONSE,
324 struct LookupBlockResponseMessage, 327 struct LookupBlockResponseMessage,
325 h), 328 h),
326 GNUNET_MQ_hd_fixed_size(block_cache_response, 329 GNUNET_MQ_hd_fixed_size (block_cache_response,
327 GNUNET_MESSAGE_TYPE_NAMECACHE_BLOCK_CACHE_RESPONSE, 330 GNUNET_MESSAGE_TYPE_NAMECACHE_BLOCK_CACHE_RESPONSE,
328 struct BlockCacheResponseMessage, 331 struct BlockCacheResponseMessage,
329 h), 332 h),
330 GNUNET_MQ_handler_end() 333 GNUNET_MQ_handler_end ()
331 }; 334 };
332 335
333 GNUNET_assert(NULL == h->mq); 336 GNUNET_assert (NULL == h->mq);
334 h->mq = GNUNET_CLIENT_connect(h->cfg, 337 h->mq = GNUNET_CLIENT_connect (h->cfg,
335 "namecache", 338 "namecache",
336 handlers, 339 handlers,
337 &mq_error_handler, 340 &mq_error_handler,
338 h); 341 h);
339} 342}
340 343
341 344
@@ -345,12 +348,12 @@ reconnect(struct GNUNET_NAMECACHE_Handle *h)
345 * @param cls handle to use to re-connect. 348 * @param cls handle to use to re-connect.
346 */ 349 */
347static void 350static void
348reconnect_task(void *cls) 351reconnect_task (void *cls)
349{ 352{
350 struct GNUNET_NAMECACHE_Handle *h = cls; 353 struct GNUNET_NAMECACHE_Handle *h = cls;
351 354
352 h->reconnect_task = NULL; 355 h->reconnect_task = NULL;
353 reconnect(h); 356 reconnect (h);
354} 357}
355 358
356 359
@@ -360,30 +363,30 @@ reconnect_task(void *cls)
360 * @param h our handle 363 * @param h our handle
361 */ 364 */
362static void 365static void
363force_reconnect(struct GNUNET_NAMECACHE_Handle *h) 366force_reconnect (struct GNUNET_NAMECACHE_Handle *h)
364{ 367{
365 struct GNUNET_NAMECACHE_QueueEntry *qe; 368 struct GNUNET_NAMECACHE_QueueEntry *qe;
366 369
367 h->reconnect = GNUNET_NO; 370 h->reconnect = GNUNET_NO;
368 GNUNET_MQ_destroy(h->mq); 371 GNUNET_MQ_destroy (h->mq);
369 h->mq = NULL; 372 h->mq = NULL;
370 while (NULL != (qe = h->op_head)) 373 while (NULL != (qe = h->op_head))
371 { 374 {
372 GNUNET_CONTAINER_DLL_remove(h->op_head, 375 GNUNET_CONTAINER_DLL_remove (h->op_head,
373 h->op_tail, 376 h->op_tail,
374 qe); 377 qe);
375 if (NULL != qe->cont) 378 if (NULL != qe->cont)
376 qe->cont(qe->cont_cls, 379 qe->cont (qe->cont_cls,
377 GNUNET_SYSERR, 380 GNUNET_SYSERR,
378 _("Error communicating with namecache service")); 381 _ ("Error communicating with namecache service"));
379 GNUNET_free(qe); 382 GNUNET_free (qe);
380 } 383 }
381 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 384 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
382 "Reconnecting to namecache\n"); 385 "Reconnecting to namecache\n");
383 h->reconnect_delay = GNUNET_TIME_STD_BACKOFF(h->reconnect_delay); 386 h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay);
384 h->reconnect_task = GNUNET_SCHEDULER_add_delayed(h->reconnect_delay, 387 h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->reconnect_delay,
385 &reconnect_task, 388 &reconnect_task,
386 h); 389 h);
387} 390}
388 391
389 392
@@ -394,7 +397,7 @@ force_reconnect(struct GNUNET_NAMECACHE_Handle *h)
394 * @return next operation id to use 397 * @return next operation id to use
395 */ 398 */
396static uint32_t 399static uint32_t
397get_op_id(struct GNUNET_NAMECACHE_Handle *h) 400get_op_id (struct GNUNET_NAMECACHE_Handle *h)
398{ 401{
399 return h->last_op_id_used++; 402 return h->last_op_id_used++;
400} 403}
@@ -407,18 +410,18 @@ get_op_id(struct GNUNET_NAMECACHE_Handle *h)
407 * @return handle to the GNS service, or NULL on error 410 * @return handle to the GNS service, or NULL on error
408 */ 411 */
409struct GNUNET_NAMECACHE_Handle * 412struct GNUNET_NAMECACHE_Handle *
410GNUNET_NAMECACHE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg) 413GNUNET_NAMECACHE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
411{ 414{
412 struct GNUNET_NAMECACHE_Handle *h; 415 struct GNUNET_NAMECACHE_Handle *h;
413 416
414 h = GNUNET_new(struct GNUNET_NAMECACHE_Handle); 417 h = GNUNET_new (struct GNUNET_NAMECACHE_Handle);
415 h->cfg = cfg; 418 h->cfg = cfg;
416 reconnect(h); 419 reconnect (h);
417 if (NULL == h->mq) 420 if (NULL == h->mq)
418 { 421 {
419 GNUNET_free(h); 422 GNUNET_free (h);
420 return NULL; 423 return NULL;
421 } 424 }
422 return h; 425 return h;
423} 426}
424 427
@@ -430,29 +433,29 @@ GNUNET_NAMECACHE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
430 * @param h handle to the namecache 433 * @param h handle to the namecache
431 */ 434 */
432void 435void
433GNUNET_NAMECACHE_disconnect(struct GNUNET_NAMECACHE_Handle *h) 436GNUNET_NAMECACHE_disconnect (struct GNUNET_NAMECACHE_Handle *h)
434{ 437{
435 struct GNUNET_NAMECACHE_QueueEntry *q; 438 struct GNUNET_NAMECACHE_QueueEntry *q;
436 439
437 GNUNET_break(NULL == h->op_head); 440 GNUNET_break (NULL == h->op_head);
438 while (NULL != (q = h->op_head)) 441 while (NULL != (q = h->op_head))
439 { 442 {
440 GNUNET_CONTAINER_DLL_remove(h->op_head, 443 GNUNET_CONTAINER_DLL_remove (h->op_head,
441 h->op_tail, 444 h->op_tail,
442 q); 445 q);
443 GNUNET_free(q); 446 GNUNET_free (q);
444 } 447 }
445 if (NULL != h->mq) 448 if (NULL != h->mq)
446 { 449 {
447 GNUNET_MQ_destroy(h->mq); 450 GNUNET_MQ_destroy (h->mq);
448 h->mq = NULL; 451 h->mq = NULL;
449 } 452 }
450 if (NULL != h->reconnect_task) 453 if (NULL != h->reconnect_task)
451 { 454 {
452 GNUNET_SCHEDULER_cancel(h->reconnect_task); 455 GNUNET_SCHEDULER_cancel (h->reconnect_task);
453 h->reconnect_task = NULL; 456 h->reconnect_task = NULL;
454 } 457 }
455 GNUNET_free(h); 458 GNUNET_free (h);
456} 459}
457 460
458 461
@@ -467,10 +470,10 @@ GNUNET_NAMECACHE_disconnect(struct GNUNET_NAMECACHE_Handle *h)
467 * @return handle to abort the request, NULL on error 470 * @return handle to abort the request, NULL on error
468 */ 471 */
469struct GNUNET_NAMECACHE_QueueEntry * 472struct GNUNET_NAMECACHE_QueueEntry *
470GNUNET_NAMECACHE_block_cache(struct GNUNET_NAMECACHE_Handle *h, 473GNUNET_NAMECACHE_block_cache (struct GNUNET_NAMECACHE_Handle *h,
471 const struct GNUNET_GNSRECORD_Block *block, 474 const struct GNUNET_GNSRECORD_Block *block,
472 GNUNET_NAMECACHE_ContinuationWithStatus cont, 475 GNUNET_NAMECACHE_ContinuationWithStatus cont,
473 void *cont_cls) 476 void *cont_cls)
474{ 477{
475 struct GNUNET_NAMECACHE_QueueEntry *qe; 478 struct GNUNET_NAMECACHE_QueueEntry *qe;
476 struct BlockCacheMessage *msg; 479 struct BlockCacheMessage *msg;
@@ -480,33 +483,33 @@ GNUNET_NAMECACHE_block_cache(struct GNUNET_NAMECACHE_Handle *h,
480 483
481 if (NULL == h->mq) 484 if (NULL == h->mq)
482 return NULL; 485 return NULL;
483 blen = ntohl(block->purpose.size); 486 blen = ntohl (block->purpose.size);
484 GNUNET_assert(blen > (sizeof(struct GNUNET_TIME_AbsoluteNBO) + 487 GNUNET_assert (blen > (sizeof(struct GNUNET_TIME_AbsoluteNBO)
485 sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose))); 488 + sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)));
486 blen -= (sizeof(struct GNUNET_TIME_AbsoluteNBO) + 489 blen -= (sizeof(struct GNUNET_TIME_AbsoluteNBO)
487 sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)); 490 + sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose));
488 rid = get_op_id(h); 491 rid = get_op_id (h);
489 qe = GNUNET_new(struct GNUNET_NAMECACHE_QueueEntry); 492 qe = GNUNET_new (struct GNUNET_NAMECACHE_QueueEntry);
490 qe->nsh = h; 493 qe->nsh = h;
491 qe->cont = cont; 494 qe->cont = cont;
492 qe->cont_cls = cont_cls; 495 qe->cont_cls = cont_cls;
493 qe->op_id = rid; 496 qe->op_id = rid;
494 GNUNET_CONTAINER_DLL_insert_tail(h->op_head, 497 GNUNET_CONTAINER_DLL_insert_tail (h->op_head,
495 h->op_tail, 498 h->op_tail,
496 qe); 499 qe);
497 /* send msg */ 500 /* send msg */
498 env = GNUNET_MQ_msg_extra(msg, 501 env = GNUNET_MQ_msg_extra (msg,
499 blen, 502 blen,
500 GNUNET_MESSAGE_TYPE_NAMECACHE_BLOCK_CACHE); 503 GNUNET_MESSAGE_TYPE_NAMECACHE_BLOCK_CACHE);
501 msg->gns_header.r_id = htonl(rid); 504 msg->gns_header.r_id = htonl (rid);
502 msg->expire = block->expiration_time; 505 msg->expire = block->expiration_time;
503 msg->signature = block->signature; 506 msg->signature = block->signature;
504 msg->derived_key = block->derived_key; 507 msg->derived_key = block->derived_key;
505 GNUNET_memcpy(&msg[1], 508 GNUNET_memcpy (&msg[1],
506 &block[1], 509 &block[1],
507 blen); 510 blen);
508 GNUNET_MQ_send(h->mq, 511 GNUNET_MQ_send (h->mq,
509 env); 512 env);
510 return qe; 513 return qe;
511} 514}
512 515
@@ -523,10 +526,10 @@ GNUNET_NAMECACHE_block_cache(struct GNUNET_NAMECACHE_Handle *h,
523 * @return a handle that can be used to cancel, NULL on error 526 * @return a handle that can be used to cancel, NULL on error
524 */ 527 */
525struct GNUNET_NAMECACHE_QueueEntry * 528struct GNUNET_NAMECACHE_QueueEntry *
526GNUNET_NAMECACHE_lookup_block(struct GNUNET_NAMECACHE_Handle *h, 529GNUNET_NAMECACHE_lookup_block (struct GNUNET_NAMECACHE_Handle *h,
527 const struct GNUNET_HashCode *derived_hash, 530 const struct GNUNET_HashCode *derived_hash,
528 GNUNET_NAMECACHE_BlockProcessor proc, 531 GNUNET_NAMECACHE_BlockProcessor proc,
529 void *proc_cls) 532 void *proc_cls)
530{ 533{
531 struct GNUNET_NAMECACHE_QueueEntry *qe; 534 struct GNUNET_NAMECACHE_QueueEntry *qe;
532 struct LookupBlockMessage *msg; 535 struct LookupBlockMessage *msg;
@@ -535,24 +538,24 @@ GNUNET_NAMECACHE_lookup_block(struct GNUNET_NAMECACHE_Handle *h,
535 538
536 if (NULL == h->mq) 539 if (NULL == h->mq)
537 return NULL; 540 return NULL;
538 LOG(GNUNET_ERROR_TYPE_DEBUG, 541 LOG (GNUNET_ERROR_TYPE_DEBUG,
539 "Looking for block under %s\n", 542 "Looking for block under %s\n",
540 GNUNET_h2s(derived_hash)); 543 GNUNET_h2s (derived_hash));
541 rid = get_op_id(h); 544 rid = get_op_id (h);
542 qe = GNUNET_new(struct GNUNET_NAMECACHE_QueueEntry); 545 qe = GNUNET_new (struct GNUNET_NAMECACHE_QueueEntry);
543 qe->nsh = h; 546 qe->nsh = h;
544 qe->block_proc = proc; 547 qe->block_proc = proc;
545 qe->block_proc_cls = proc_cls; 548 qe->block_proc_cls = proc_cls;
546 qe->op_id = rid; 549 qe->op_id = rid;
547 GNUNET_CONTAINER_DLL_insert_tail(h->op_head, 550 GNUNET_CONTAINER_DLL_insert_tail (h->op_head,
548 h->op_tail, 551 h->op_tail,
549 qe); 552 qe);
550 env = GNUNET_MQ_msg(msg, 553 env = GNUNET_MQ_msg (msg,
551 GNUNET_MESSAGE_TYPE_NAMECACHE_LOOKUP_BLOCK); 554 GNUNET_MESSAGE_TYPE_NAMECACHE_LOOKUP_BLOCK);
552 msg->gns_header.r_id = htonl(rid); 555 msg->gns_header.r_id = htonl (rid);
553 msg->query = *derived_hash; 556 msg->query = *derived_hash;
554 GNUNET_MQ_send(h->mq, 557 GNUNET_MQ_send (h->mq,
555 env); 558 env);
556 return qe; 559 return qe;
557} 560}
558 561
@@ -564,14 +567,14 @@ GNUNET_NAMECACHE_lookup_block(struct GNUNET_NAMECACHE_Handle *h,
564 * @param qe operation to cancel 567 * @param qe operation to cancel
565 */ 568 */
566void 569void
567GNUNET_NAMECACHE_cancel(struct GNUNET_NAMECACHE_QueueEntry *qe) 570GNUNET_NAMECACHE_cancel (struct GNUNET_NAMECACHE_QueueEntry *qe)
568{ 571{
569 struct GNUNET_NAMECACHE_Handle *h = qe->nsh; 572 struct GNUNET_NAMECACHE_Handle *h = qe->nsh;
570 573
571 GNUNET_CONTAINER_DLL_remove(h->op_head, 574 GNUNET_CONTAINER_DLL_remove (h->op_head,
572 h->op_tail, 575 h->op_tail,
573 qe); 576 qe);
574 GNUNET_free(qe); 577 GNUNET_free (qe);
575} 578}
576 579
577 580