- Changes for long churn (test with 10 peers)
[oweals/gnunet.git] / src / namestore / namestore_api.c
1 /*
2      This file is part of GNUnet.
3      (C) 2009, 2010 Christian Grothoff (and other contributing authors)
4
5      GNUnet is free software; you can redistribute it and/or modify
6      it under the terms of the GNU General Public License as published
7      by the Free Software Foundation; either version 3, or (at your
8      option) any later version.
9
10      GNUnet is distributed in the hope that it will be useful, but
11      WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13      General Public License for more details.
14
15      You should have received a copy of the GNU General Public License
16      along with GNUnet; see the file COPYING.  If not, write to the
17      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18      Boston, MA 02111-1307, USA.
19 */
20
21 /**
22  * @file gns/namestore_api.c
23  * @brief API to access the NAMESTORE service
24  * @author Martin Schanzenbach
25  * @author Matthias Wachs
26  */
27
28 #include "platform.h"
29 #include "gnunet_util_lib.h"
30 #include "gnunet_constants.h"
31 #include "gnunet_arm_service.h"
32 #include "gnunet_namestore_service.h"
33 #include "namestore.h"
34 #define DEBUG_GNS_API GNUNET_EXTRA_LOGGING
35
36 #define LOG(kind,...) GNUNET_log_from (kind, "gns-api",__VA_ARGS__)
37
38 /**
39  * A QueueEntry.
40  */
41 struct GNUNET_NAMESTORE_QueueEntry
42 {
43   char *data; /*stub data pointer*/
44 };
45
46
47 /**
48  * Message in linked list we should send to the service.  The
49  * actual binary message follows this struct.
50  */
51 struct PendingMessage
52 {
53
54   /**
55    * Kept in a DLL.
56    */
57   struct PendingMessage *next;
58
59   /**
60    * Kept in a DLL.
61    */
62   struct PendingMessage *prev;
63
64   /**
65    * Size of the message.
66    */
67   size_t size;
68
69   /**
70    * Is this the 'START' message?
71    */
72   int is_init;
73 };
74
75
76 /**
77  * Connection to the NAMESTORE service.
78  */
79 struct GNUNET_NAMESTORE_Handle
80 {
81
82   /**
83    * Configuration to use.
84    */
85   const struct GNUNET_CONFIGURATION_Handle *cfg;
86
87   /**
88    * Socket (if available).
89    */
90   struct GNUNET_CLIENT_Connection *client;
91
92   /**
93    * Currently pending transmission request (or NULL).
94    */
95   struct GNUNET_CLIENT_TransmitHandle *th;
96
97   /**
98    * Reconnect task
99    */
100   GNUNET_SCHEDULER_TaskIdentifier reconnect_task;
101
102   /**
103    * Pending messages to send to the service
104    */
105
106   struct PendingMessage * pending_head;
107   struct PendingMessage * pending_tail;
108
109   /**
110    * Should we reconnect to service due to some serious error?
111    */
112   int reconnect;
113 };
114
115 struct GNUNET_NAMESTORE_SimpleRecord
116 {
117   /**
118    * DLL
119    */
120   struct GNUNET_NAMESTORE_SimpleRecord *next;
121
122   /**
123    * DLL
124    */
125   struct GNUNET_NAMESTORE_SimpleRecord *prev;
126   
127   const char *name;
128   const GNUNET_HashCode *zone;
129   uint32_t record_type;
130   struct GNUNET_TIME_Absolute expiration;
131   enum GNUNET_NAMESTORE_RecordFlags flags;
132   size_t data_size;
133   const void *data;
134 };
135
136 /**
137  * Disconnect from service and then reconnect.
138  *
139  * @param nsh our handle
140  */
141 static void
142 force_reconnect (struct GNUNET_NAMESTORE_Handle *nsh);
143
144
145 /**
146  * Type of a function to call when we receive a message
147  * from the service.
148  *
149  * @param cls the 'struct GNUNET_NAMESTORE_SchedulingHandle'
150  * @param msg message received, NULL on timeout or fatal error
151  */
152 static void
153 process_namestore_message (void *cls, const struct GNUNET_MessageHeader *msg)
154 {
155   struct GNUNET_NAMESTORE_Handle *nsh = cls;
156   uint16_t size;
157   uint16_t type;
158
159   if (NULL == msg)
160   {
161     force_reconnect (nsh);
162     return;
163   }
164
165   size = ntohs (msg->size);
166   type = ntohs (msg->type);
167
168   switch (type) {
169     case GNUNET_MESSAGE_TYPE_TEST:
170       /* handle message here */
171       break;
172     default:
173       break;
174   }
175
176   GNUNET_CLIENT_receive (nsh->client, &process_namestore_message, nsh,
177                          GNUNET_TIME_UNIT_FOREVER_REL);
178
179   if (GNUNET_YES == nsh->reconnect)
180     force_reconnect (nsh);
181 }
182
183
184 /**
185  * Transmit messages from the message queue to the service
186  * (if there are any, and if we are not already trying).
187  *
188  * @param nsh handle to use
189  */
190 static void
191 do_transmit (struct GNUNET_NAMESTORE_Handle *nsh);
192
193
194 /**
195  * We can now transmit a message to NAMESTORE. Do it.
196  *
197  * @param cls the 'struct GNUNET_NAMESTORE_Handle'
198  * @param size number of bytes we can transmit
199  * @param buf where to copy the messages
200  * @return number of bytes copied into buf
201  */
202 static size_t
203 transmit_message_to_namestore (void *cls, size_t size, void *buf)
204 {
205   struct GNUNET_NAMESTORE_Handle *nsh = cls;
206   struct PendingMessage *p;
207   size_t ret;
208   char *cbuf;
209
210   nsh->th = NULL;
211   if ((size == 0) || (buf == NULL))
212   {
213     force_reconnect (nsh);
214     return 0;
215   }
216   ret = 0;
217   cbuf = buf;
218   while ((NULL != (p = nsh->pending_head)) && (p->size <= size))
219   {
220     memcpy (&cbuf[ret], &p[1], p->size);
221     ret += p->size;
222     size -= p->size;
223     GNUNET_CONTAINER_DLL_remove (nsh->pending_head, nsh->pending_tail, p);
224     if (GNUNET_YES == p->is_init)
225       GNUNET_CLIENT_receive (nsh->client, &process_namestore_message, nsh,
226                              GNUNET_TIME_UNIT_FOREVER_REL);
227     GNUNET_free (p);
228   }
229   do_transmit (nsh);
230   return ret;
231 }
232
233
234 /**
235  * Transmit messages from the message queue to the service
236  * (if there are any, and if we are not already trying).
237  *
238  * @param nsh handle to use
239  */
240 static void
241 do_transmit (struct GNUNET_NAMESTORE_Handle *nsh)
242 {
243   struct PendingMessage *p;
244
245   if (NULL != nsh->th)
246     return;
247   if (NULL == (p = nsh->pending_head))
248     return;
249   if (NULL == nsh->client)
250     return;                     /* currently reconnecting */
251
252   nsh->th = GNUNET_CLIENT_notify_transmit_ready (nsh->client, p->size,
253                                            GNUNET_TIME_UNIT_FOREVER_REL,
254                                            GNUNET_NO, &transmit_message_to_namestore,
255                                            nsh);
256 }
257
258
259 /**
260  * Try again to connect to namestore service.
261  *
262  * @param cls the handle to the namestore service
263  * @param tc scheduler context
264  */
265 static void
266 reconnect (struct GNUNET_NAMESTORE_Handle *nsh)
267 {
268   struct PendingMessage *p;
269   struct StartMessage *init;
270
271   GNUNET_assert (NULL == nsh->client);
272   nsh->client = GNUNET_CLIENT_connect ("namestore", nsh->cfg);
273   GNUNET_assert (NULL != nsh->client);
274
275   if ((NULL == (p = nsh->pending_head)) || (GNUNET_YES != p->is_init))
276   {
277     p = GNUNET_malloc (sizeof (struct PendingMessage) +
278                        sizeof (struct StartMessage));
279     p->size = sizeof (struct StartMessage);
280     p->is_init = GNUNET_YES;
281     init = (struct StartMessage *) &p[1];
282     init->header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_START);
283     init->header.size = htons (sizeof (struct StartMessage));
284     GNUNET_CONTAINER_DLL_insert (nsh->pending_head, nsh->pending_tail, p);
285   }
286   do_transmit (nsh);
287 }
288
289 /**
290  * Re-establish the connection to the service.
291  *
292  * @param cls handle to use to re-connect.
293  * @param tc scheduler context
294  */
295 static void
296 reconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
297 {
298   struct GNUNET_NAMESTORE_Handle *nsh = cls;
299
300   nsh->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
301   reconnect (nsh);
302 }
303
304
305 /**
306  * Disconnect from service and then reconnect.
307  *
308  * @param nsh our handle
309  */
310 static void
311 force_reconnect (struct GNUNET_NAMESTORE_Handle *nsh)
312 {
313   nsh->reconnect = GNUNET_NO;
314   GNUNET_CLIENT_disconnect (nsh->client, GNUNET_NO);
315   nsh->client = NULL;
316   nsh->reconnect_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
317                                     &reconnect_task,
318                                     nsh);
319 }
320
321
322
323 /**
324  * Initialize the connection with the NAMESTORE service.
325  *
326  * @param cfg configuration to use
327  * @return handle to the GNS service, or NULL on error
328  */
329 struct GNUNET_NAMESTORE_Handle *
330 GNUNET_NAMESTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
331 {
332   struct GNUNET_NAMESTORE_Handle *nsh;
333
334   nsh = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_Handle));
335   nsh->cfg = cfg;
336   nsh->reconnect_task = GNUNET_SCHEDULER_add_now (&reconnect_task, nsh);
337   return nsh;
338 }
339
340
341 /**
342  * Shutdown connection with the NAMESTORE service.
343  *
344  * @param handle handle of the NAMESTORE connection to stop
345  */
346 void
347 GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *nsh, int drop)
348 {
349   struct PendingMessage *p;
350
351   while (NULL != (p = nsh->pending_head))
352   {
353     GNUNET_CONTAINER_DLL_remove (nsh->pending_head, nsh->pending_tail, p);
354     GNUNET_free (p);
355   }
356   if (NULL != nsh->client)
357   {
358     GNUNET_CLIENT_disconnect (nsh->client, GNUNET_NO);
359     nsh->client = NULL;
360   }
361   if (GNUNET_SCHEDULER_NO_TASK != nsh->reconnect_task)
362   {
363     GNUNET_SCHEDULER_cancel (nsh->reconnect_task);
364     nsh->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
365   }
366   GNUNET_free(nsh);
367   nsh = NULL;
368 }
369
370 /**
371  * Sign a record.  This function is used by the authority of the zone
372  * to add a record.
373  *
374  * @param h handle to the namestore
375  * @param zone_privkey private key of the zone
376  * @param record_hash hash of the record to be signed
377  * @param cont continuation to call when done
378  * @param cont_cls closure for cont
379  * @return handle to abort the request
380  */
381 struct GNUNET_NAMESTORE_QueueEntry *
382 GNUNET_NAMESTORE_stree_extend (struct GNUNET_NAMESTORE_Handle *h,
383              const struct GNUNET_CRYPTO_RsaPrivateKey *zone_privkey,
384              const GNUNET_HashCode *record_hash,
385              GNUNET_NAMESTORE_ContinuationWithSignature cont,
386              void *cont_cls)
387 {
388   struct GNUNET_NAMESTORE_QueueEntry *qe;
389   qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry));
390   return qe;
391 }
392
393 /**
394  * Rebalance the signature tree of our zone.  This function should
395  * be called "rarely" to rebalance the tree.
396  *
397  * @param h handle to the namestore
398  * @param zone_privkey private key for the zone to rebalance
399  * @param cont continuation to call when done
400  * @param cont_cls closure for cont
401  * @return handle to abort the request
402  */
403 struct GNUNET_NAMESTORE_QueueEntry *
404 GNUNET_NAMESTORE_stree_rebalance (struct GNUNET_NAMESTORE_Handle *h,
405           const struct GNUNET_CRYPTO_RsaPrivateKey *zone_privkey,
406           GNUNET_NAMESTORE_ContinuationWithStatus cont,
407           void *cont_cls)
408 {
409   struct GNUNET_NAMESTORE_QueueEntry *qe;
410   qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry));
411   return qe;
412 }
413
414 /**
415  * Provide the root of a signature tree.  This function is 
416  * used by non-authorities as the first operation when 
417  * adding a foreign zone.
418  *
419  * @param h handle to the namestore
420  * @param zone_key public key of the zone
421  * @param signature signature of the top-level entry of the zone
422  * @param revision revision number of the zone
423  * @param top_hash top-level hash of the zone
424  * @param cont continuation to call when done
425  * @param cont_cls closure for cont
426  * @return handle to abort the request
427  */
428 struct GNUNET_NAMESTORE_QueueEntry *
429 GNUNET_NAMESTORE_stree_start (struct GNUNET_NAMESTORE_Handle *h,
430                               const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key,
431                               const struct GNUNET_CRYPTO_RsaSignature *signature,
432                               uint32_t revision,
433                               const GNUNET_HashCode *top_hash,
434                               GNUNET_NAMESTORE_ContinuationWithSignature cont,
435                               void *cont_cls)
436 {
437   struct GNUNET_NAMESTORE_QueueEntry *qe;
438   qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry));
439   return qe;
440 }
441
442 /**
443  * Store part of a signature B-tree in the namestore.  This function
444  * is used by non-authorities to cache parts of a zone's signature tree.
445  * Note that the tree must be build top-down.  This function must check
446  * that the nodes being added are valid, and if not refuse the operation.
447  *
448  * @param h handle to the namestore
449  * @param zone_key public key of the zone
450  * @param loc location in the B-tree
451  * @param ploc parent's location in the B-tree (must have depth = loc.depth - 1)
452  * @param num_entries number of entries at this node in the B-tree
453  * @param entries the 'num_entries' entries to store (hashes over the
454  *                records)
455  * @param cont continuation to call when done
456  * @param cont_cls closure for cont
457  * @return handle to abort the request
458  */
459 struct GNUNET_NAMESTORE_QueueEntry *
460 GNUNET_NAMESTORE_stree_put (struct GNUNET_NAMESTORE_Handle *h,
461                             const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key,
462                             const struct GNUNET_NAMESTORE_SignatureLocation *loc,
463                             const struct GNUNET_NAMESTORE_SignatureLocation *ploc,
464                             unsigned int num_entries,
465                             const GNUNET_HashCode *entries,
466                             GNUNET_NAMESTORE_ContinuationWithStatus cont,
467                             void *cont_cls)
468 {
469   struct GNUNET_NAMESTORE_QueueEntry *qe;
470   qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry));
471   return qe;
472 }
473
474 /**
475  * Store an item in the namestore.  If the item is already present,
476  * the expiration time is updated to the max of the existing time and
477  * the new time.  The operation must fail if there is no matching
478  * entry in the signature tree.
479  *
480  * @param h handle to the namestore
481  * @param zone hash of the public key of the zone
482  * @param name name that is being mapped (at most 255 characters long)
483  * @param record_type type of the record (A, AAAA, PKEY, etc.)
484  * @param expiration expiration time for the content
485  * @param flags flags for the content
486  * @param sig_loc where is the information about the signature for this record stored?
487  * @param data_size number of bytes in data
488  * @param data value, semantics depend on 'record_type' (see RFCs for DNS and 
489  *             GNS specification for GNS extensions)
490  * @param cont continuation to call when done
491  * @param cont_cls closure for cont
492  * @return handle to abort the request
493  */
494 struct GNUNET_NAMESTORE_QueueEntry *
495 GNUNET_NAMESTORE_record_put (struct GNUNET_NAMESTORE_Handle *h,
496                              const GNUNET_HashCode *zone,
497                              const char *name,
498                              uint32_t record_type,
499                              struct GNUNET_TIME_Absolute expiration,
500                              enum GNUNET_NAMESTORE_RecordFlags flags,
501                              const struct GNUNET_NAMESTORE_SignatureLocation *sig_loc,
502                              size_t data_size,
503                              const void *data,
504                              GNUNET_NAMESTORE_ContinuationWithStatus cont,
505                              void *cont_cls)
506 {
507   struct GNUNET_NAMESTORE_QueueEntry *qe;
508   qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry));
509 #if 0
510   struct GNUNET_NAMESTORE_SimpleRecord *sr;
511   sr = GNUNET_malloc(sizeof(struct GNUNET_NAMESTORE_SimpleRecord));
512   sr->name = name;
513   sr->record_type = record_type;
514   sr->expiration = expiration;
515   sr->flags = flags;
516   sr->data_size = data_size;
517   sr->data = data;
518   GNUNET_CONTAINER_DLL_insert(h->records_head, h->records_tail, sr);
519 #endif
520   return qe;
521 }
522
523 /**
524  * Explicitly remove some content from the database.  The
525  * "cont"inuation will be called with status "GNUNET_OK" if content
526  * was removed, "GNUNET_NO" if no matching entry was found and
527  * "GNUNET_SYSERR" on all other types of errors.
528  *
529  * @param h handle to the namestore
530  * @param zone hash of the public key of the zone
531  * @param name name that is being mapped (at most 255 characters long)
532  * @param record_type type of the record (A, AAAA, PKEY, etc.)
533  * @param size number of bytes in data
534  * @param data content stored
535  * @param cont continuation to call when done
536  * @param cont_cls closure for cont
537  * @return handle to abort the request
538  */
539 struct GNUNET_NAMESTORE_QueueEntry *
540 GNUNET_NAMESTORE_record_remove (struct GNUNET_NAMESTORE_Handle *h,
541                                 const GNUNET_HashCode *zone,
542                                 const char *name,
543                                 uint32_t record_type,
544                                 size_t size,
545                                 const void *data,
546                                 GNUNET_NAMESTORE_ContinuationWithStatus cont,
547                                 void *cont_cls)
548 {
549   struct GNUNET_NAMESTORE_QueueEntry *qe;
550   qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry));
551 #if 0
552   struct GNUNET_NAMESTORE_SimpleRecord *iter;
553   for (iter=h->records_head; iter != NULL; iter=iter->next)
554   {
555     if (strcmp ( iter->name, name ) &&
556         iter->record_type == record_type &&
557         GNUNET_CRYPTO_hash_cmp (iter->zone, zone))
558       break;
559   }
560   if (iter)
561     GNUNET_CONTAINER_DLL_remove(h->records_head,
562                                 h->records_tail,
563                                 iter);
564 #endif
565   return qe;
566 }
567
568 /**
569  * Get a result for a particular key from the namestore.  The processor
570  * will only be called once.
571  *
572  * @param h handle to the namestore
573  * @param zone zone to look up a record from
574  * @param name name to look up
575  * @param record_type desired record type
576  * @param proc function to call on each matching value;
577  *        will be called once with a NULL value at the end
578  * @param proc_cls closure for proc
579  * @return a handle that can be used to
580  *         cancel
581  */
582 struct GNUNET_NAMESTORE_QueueEntry *
583 GNUNET_NAMESTORE_lookup_name (struct GNUNET_NAMESTORE_Handle *nsh,
584                               const GNUNET_HashCode *zone,
585                               const char *name,
586                               uint32_t record_type,
587                               GNUNET_NAMESTORE_RecordProcessor proc, void *proc_cls)
588 {
589   struct GNUNET_NAMESTORE_QueueEntry *qe;
590   qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry));
591 #if 0
592   struct GNUNET_NAMESTORE_SimpleRecord *iter;
593   for (iter=h->records_head; iter != NULL; iter=iter->next)
594   {
595     proc(proc_cls, iter->zone, iter->name, iter->record_type,
596        iter->expiration,
597        iter->flags,
598        NULL /*sig loc*/,
599        iter->data_size /*size*/,
600        iter->data /* data */);
601   }
602   proc(proc_cls, zone, name, record_type,
603        GNUNET_TIME_absolute_get_forever(), 0, NULL, 0, NULL); /*TERMINATE*/
604 #endif
605
606   GNUNET_assert (NULL != nsh);
607
608   struct PendingMessage * p;
609   struct LookupNameMessage * msg;
610   size_t msg_len = sizeof (struct LookupNameMessage);
611
612   p = GNUNET_malloc (sizeof (struct PendingMessage) + msg_len);
613   p->size = msg_len;
614   p->is_init = GNUNET_NO;
615   msg = (struct LookupNameMessage *) &p[1];
616   msg->header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME);
617   msg->header.size = htons (msg_len);
618   GNUNET_CONTAINER_DLL_insert (nsh->pending_head, nsh->pending_tail, p);
619   do_transmit (nsh);
620
621   return qe;
622 }
623
624
625 /**
626  * Get the hash of a record (what will be signed in the Stree for
627  * the record).
628  *
629  * @param zone hash of the public key of the zone
630  * @param name name that is being mapped (at most 255 characters long)
631  * @param record_type type of the record (A, AAAA, PKEY, etc.)
632  * @param expiration expiration time for the content
633  * @param flags flags for the content
634  * @param data_size number of bytes in data
635  * @param data value, semantics depend on 'record_type' (see RFCs for DNS and.
636  *             GNS specification for GNS extensions)
637  * @param record_hash hash of the record (set)
638  */
639 void
640 GNUNET_NAMESTORE_record_hash (struct GNUNET_NAMESTORE_Handle *h,
641                               const GNUNET_HashCode *zone,
642                               const char *name,
643                               uint32_t record_type,
644                               struct GNUNET_TIME_Absolute expiration,
645                               enum GNUNET_NAMESTORE_RecordFlags flags,
646                               size_t data_size,
647                               const void *data,
648                               GNUNET_HashCode *record_hash)
649 {
650   char* teststring = "namestore-stub";
651   GNUNET_CRYPTO_hash(teststring, strlen(teststring), record_hash);
652 }
653
654 /**
655  * Obtain part of a signature B-tree.  The processor
656  * will only be called once.
657  *
658  * @param h handle to the namestore
659  * @param zone zone to look up a record from
660  * @param sig_loc location to look up
661  * @param proc function to call on each matching value;
662  *        will be called once with a NULL value at the end
663  * @param proc_cls closure for proc
664  * @return a handle that can be used to
665  *         cancel
666  */
667 struct GNUNET_NAMESTORE_QueueEntry *
668 GNUNET_NAMESTORE_lookup_stree (struct GNUNET_NAMESTORE_Handle *h,
669                       const GNUNET_HashCode *zone,
670                       const struct GNUNET_NAMESTORE_SignatureLocation *sig_loc,
671                       GNUNET_NAMESTORE_StreeProcessor proc, void *proc_cls)
672 {
673   struct GNUNET_NAMESTORE_QueueEntry *qe;
674   qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry));
675   return qe;
676 }
677
678
679 /**
680  * Get all records of a zone.
681  *
682  * @param h handle to the namestore
683  * @param zone zone to access
684  * @param proc function to call on a random value; it
685  *        will be called repeatedly with a value (if available)
686  *        and always once at the end with a zone and name of NULL.
687  * @param proc_cls closure for proc
688  * @return a handle that can be used to
689  *         cancel
690  */
691 struct GNUNET_NAMESTORE_QueueEntry *
692 GNUNET_NAMESTORE_zone_transfer (struct GNUNET_NAMESTORE_Handle *h,
693                                 const GNUNET_HashCode *zone,
694                                 GNUNET_NAMESTORE_RecordProcessor proc,
695                                 void *proc_cls)
696 {
697   struct GNUNET_NAMESTORE_QueueEntry *qe;
698   qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry));
699   return qe;
700 }
701
702
703
704
705 /**
706  * Cancel a namestore operation.  The final callback from the
707  * operation must not have been done yet.
708  *
709  * @param qe operation to cancel
710  */
711 void
712 GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe)
713 {
714   if (qe)
715     GNUNET_free(qe);
716 }
717
718 /* end of namestore_api.c */