-sketched dht resolution, fixes
[oweals/gnunet.git] / src / gns / gnunet-service-gns.c
1 /*
2      This file is part of GNUnet.
3      (C) 2009, 2010, 2011 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/gnunet-service-gns.c
23  * @brief GNUnet GNS service
24  * @author Martin Schanzenbach
25  */
26 #include "platform.h"
27 #include "gnunet_util_lib.h"
28 #include "gnunet_transport_service.h"
29 #include "gnunet_dns_service.h"
30 #include "gnunet_dnsparser_lib.h"
31 #include "gnunet_dht_service.h"
32 #include "gnunet_namestore_service.h"
33 #include "gnunet_gns_service.h"
34 #include "gns.h"
35
36
37 /* TODO into gnunet_protocols */
38 #define GNUNET_MESSAGE_TYPE_GNS_CLIENT_LOOKUP 23
39 #define GNUNET_MESSAGE_TYPE_GNS_CLIENT_RESULT 24
40
41 struct GNUNET_GNS_QueryRecordList
42 {
43   /**
44    * DLL
45    */
46   struct GNUNET_GNS_QueryRecordList * next;
47   struct GNUNET_GNS_QueryRecordList * prev;
48
49   struct GNUNET_DNSPARSER_Record * record;
50 };
51
52 /**
53  * A result list for namestore queries
54  */
55 struct GNUNET_GNS_PendingQuery
56 {
57   /* the answer packet */
58   struct GNUNET_DNSPARSER_Packet *answer;
59
60   /* records to put into answer packet */
61   struct GNUNET_GNS_QueryRecordList * records_head;
62   struct GNUNET_GNS_QueryRecordList * records_tail;
63
64   int num_records;
65   int num_authority_records; //FIXME are all of our replies auth?
66   
67   char *name;
68   uint16_t type;
69   /* the dns request id */
70   int id; // FIXME can handle->request_id also be used here?
71
72   /* the request handle to reply to */
73   struct GNUNET_DNS_RequestHandle *request_handle;
74
75   /* hast this query been answered? */
76   int answered;
77
78   /* we have an authority in namestore that
79    * may be able to resolve
80    */
81   int authority_found;
82 };
83
84
85 /**
86  * Our handle to the DNS handler library
87  */
88 struct GNUNET_DNS_Handle *dns_handle;
89
90 /**
91  * Our handle to the DHT
92  */
93 struct GNUNET_DHT_Handle *dht_handle;
94
95 struct GNUNET_TIME_Relative dht_update_interval;
96
97 /**
98  * Our private "key"
99  * FIXME get the real deal
100  */
101 struct GNUNET_CRYPTO_RsaPrivateKey *zone_key;
102
103 /**
104  * Our handle to the namestore service
105  */
106 struct GNUNET_NAMESTORE_Handle *namestore_handle;
107
108 /**
109  * The configuration the GNS service is running with
110  */
111 const struct GNUNET_CONFIGURATION_Handle *GNS_cfg;
112
113 /**
114  * Our notification context.
115  */
116 static struct GNUNET_SERVER_NotificationContext *nc;
117
118 /**
119  * Our zone hash
120  */
121 GNUNET_HashCode *zone_hash;
122
123 /**
124  * Task run during shutdown.
125  *
126  * @param cls unused
127  * @param tc unused
128  */
129 static void
130 shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
131 {
132   GNUNET_DNS_disconnect(dns_handle);
133   GNUNET_NAMESTORE_disconnect(namestore_handle, 0);
134   GNUNET_DHT_disconnect(dht_handle);
135 }
136
137 void
138 handle_dht_reply(void* cls,
139                  struct GNUNET_TIME_Absolute exp,
140                  const GNUNET_HashCode * key,
141                  const struct GNUNET_PeerIdentity *get_path,
142                  unsigned int get_path_length,
143                  const struct GNUNET_PeerIdentity *put_path,
144                  unsigned int put_path_length,
145                  enum GNUNET_BLOCK_Type type,
146                  size_t size, const void *data)
147 {
148 }
149
150 void
151 process_auth_query(void* cls, const GNUNET_HashCode *zone,
152                    const char *name, uint32_t record_type,
153                    struct GNUNET_TIME_Absolute expiration,
154                    enum GNUNET_NAMESTORE_RecordFlags flags,
155                    const struct GNUNET_NAMESTORE_SignatureLocation *sig_loc,
156                    size_t size, const void *data)
157 {
158   struct GNUNET_GNS_PendingQuery *query;
159
160   query = (struct GNUNET_GNS_PendingQuery *)cls;
161   
162   /**
163    * No authority found
164    * FIXME We assume this will never return our authority
165    */
166   if ((NULL == data) && !query->authority_found)
167   {
168     GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Find authority\n");
169     if (0 == strcmp(name, "gnunet"))
170     {
171       // Reached tld return nx
172       GNUNET_log(GNUNET_ERROR_TYPE_INFO, "NX record\n");
173       return;
174     }
175     
176     //Move name to next level
177     while ((*name) != '.')
178       name++;
179
180     name++;
181     GNUNET_NAMESTORE_lookup_name(namestore_handle,
182                                  zone_hash,
183                                  name,
184                                  GNUNET_GNS_RECORD_PKEY,
185                                  &process_auth_query,
186                                  query);
187     return;
188   }
189   
190   /**
191    * We found a PKEY that may be able to help us
192    */
193   GNUNET_HashCode *key = (GNUNET_HashCode*) data;
194   
195   //FIXME magic number
196   struct GNUNET_TIME_Relative timeout =
197     GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 20);
198   GNUNET_DHT_get_start (dht_handle,
199                         timeout,
200                         GNUNET_BLOCK_TYPE_TEST, //TODO our plugin
201                         key,
202                         5, //replication
203                         GNUNET_DHT_RO_NONE,
204                         query->name, //xquery FIXME nobody will know this name
205                         strlen(query->name),
206                         &handle_dht_reply,
207                         query); //iter cls
208
209
210 }
211
212
213 /**
214  * Phase 2 of resolution.
215  */
216 void
217 lookup_dht(struct GNUNET_GNS_PendingQuery *query)
218 {
219   /**
220    * In this phase we first want to find the
221    * responsible authority in the namestore
222    */
223   GNUNET_NAMESTORE_lookup_name(namestore_handle,
224                                zone_hash,
225                                query->name,
226                                GNUNET_GNS_RECORD_PKEY,
227                                &process_auth_query,
228                                query);
229 }
230
231 void
232 reply_to_dns(struct GNUNET_GNS_PendingQuery *answer)
233 {
234   struct GNUNET_GNS_QueryRecordList *i;
235   struct GNUNET_DNSPARSER_Packet *packet;
236   struct GNUNET_DNSPARSER_Flags dnsflags;
237   int j;
238   size_t len;
239   int ret;
240   char *buf;
241   
242   packet = GNUNET_malloc(sizeof(struct GNUNET_DNSPARSER_Packet));
243   packet->answers =
244     GNUNET_malloc(sizeof(struct GNUNET_DNSPARSER_Record) * answer->num_records);
245   
246   len = sizeof(struct GNUNET_DNSPARSER_Record*);
247   j = 0;
248   for (i=answer->records_head; i != NULL; i=i->next)
249   {
250     GNUNET_log(GNUNET_ERROR_TYPE_INFO,
251                "Adding %s to DNS response\n", i->record->name);
252     memcpy(&packet->answers[j], 
253            i->record,
254            sizeof (struct GNUNET_DNSPARSER_Record));
255     GNUNET_free(i->record);
256     j++;
257   }
258   GNUNET_log(GNUNET_ERROR_TYPE_INFO, "after memcpy\n");
259   /* FIXME how to handle auth, additional etc */
260   packet->num_answers = answer->num_records;
261   packet->num_authority_records = answer->num_authority_records;
262
263   dnsflags.authoritative_answer = 1;
264   dnsflags.opcode = GNUNET_DNSPARSER_OPCODE_QUERY;
265   dnsflags.return_code = GNUNET_DNSPARSER_RETURN_CODE_NO_ERROR; //not sure
266   dnsflags.query_or_response = 1;
267   packet->flags = dnsflags;
268
269   packet->id = answer->id;
270   ret = GNUNET_DNSPARSER_pack (packet,
271                                1024, /* FIXME magic from dns redirector */
272                                &buf,
273                                &len);
274   GNUNET_log(GNUNET_ERROR_TYPE_INFO,
275              "Built DNS response! (ret=%d)\n", ret);
276   if (ret == GNUNET_OK)
277   {
278     GNUNET_log(GNUNET_ERROR_TYPE_INFO,
279                "Answering DNS request\n");
280     GNUNET_DNS_request_answer(answer->request_handle,
281                               len,
282                               buf);
283     GNUNET_free(answer);
284     GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Answered DNS request\n");
285     //FIXME return code, free datastructures
286   }
287   else
288   {
289     GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
290                "Error building DNS response! (ret=%d)", ret);
291   }
292 }
293
294 static void
295 process_ns_result(void* cls, const GNUNET_HashCode *zone,
296                   const char *name, uint32_t record_type,
297                   struct GNUNET_TIME_Absolute expiration,
298                   enum GNUNET_NAMESTORE_RecordFlags flags,
299                   const struct GNUNET_NAMESTORE_SignatureLocation *sig_loc,
300                   size_t size, const void *data)
301 {
302   struct GNUNET_GNS_PendingQuery *query;
303   struct GNUNET_GNS_QueryRecordList *qrecord;
304   struct GNUNET_DNSPARSER_Record *record;
305   query = (struct GNUNET_GNS_PendingQuery *) cls;
306
307
308   if (NULL == data)
309   {
310     /**
311      * Last result received (or none)
312      * Do we have what we need to answer?
313      * If not -> DHT Phase
314      * FIXME free memory
315      */
316     GNUNET_log(GNUNET_ERROR_TYPE_INFO,
317                "Namestore lookup terminated. (answered=%d)", query->answered);
318
319     if (query->answered)
320       reply_to_dns(query);
321     else
322       lookup_dht(query); //TODO
323
324   }
325   else
326   {
327     /**
328      * New result
329      */
330     GNUNET_log(GNUNET_ERROR_TYPE_INFO,
331                "Processing additional result %s from namestore\n", name);
332
333     qrecord = GNUNET_malloc(sizeof(struct GNUNET_GNS_QueryRecordList));
334     record = GNUNET_malloc(sizeof(struct GNUNET_DNSPARSER_Record));
335     qrecord->record = record;
336
337     record->name = (char*)name;
338     /* FIXME for gns records this requires the dnsparser to be modified!
339      * or use RAW
340      * maybe store record data appropriately in namestore to avoid this
341      * huge switch?
342      **/
343     if (record_type == GNUNET_DNSPARSER_TYPE_A)
344     {
345       record->data.raw.data = (char*)data;
346       record->data.raw.data_len = size;
347     }
348     record->expiration_time = expiration;
349     record->type = record_type;
350     record->class = GNUNET_DNSPARSER_CLASS_INTERNET; /* srsly? */
351
352     if (flags == GNUNET_NAMESTORE_RF_AUTHORITY)
353     {
354       //query->num_authority_records++;
355     }
356
357     if ((0 == strcmp(query->name , name)) &&
358         (query->type == record_type))
359     {
360       GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Found answer to query!\n");
361       query->answered = 1;
362     }
363
364     query->num_records++;
365
366     //FIXME watch for leaks
367     GNUNET_CONTAINER_DLL_insert(query->records_head,
368                                 query->records_tail,
369                                 qrecord);
370   }
371 }
372
373
374 /**
375  * Phase 1 of name resolution: Lookup local namestore
376  *
377  * @param name the name to look up
378  * @param id the id of the dns request (for the reply)
379  * @param type the record type to look for
380  */
381 void
382 lookup_namestore(struct GNUNET_DNS_RequestHandle *rh,
383                  char* name, uint16_t id, uint16_t type)
384 {
385   struct GNUNET_GNS_PendingQuery *answer;
386   
387   /**
388    * Do db lookup here. Make dht lookup if necessary 
389    * FIXME for now only local lookups for our zone!
390    */
391   GNUNET_log (GNUNET_ERROR_TYPE_INFO, "This is .gnunet (%s)!\n", name);
392   answer = GNUNET_malloc(sizeof (struct GNUNET_GNS_PendingQuery));
393   answer->id = id;
394   answer->name = name;
395   answer->type =type;
396   answer->request_handle = rh;
397   
398   GNUNET_NAMESTORE_lookup_name(namestore_handle,
399                                zone_hash,
400                                name,
401                                type,
402                                &process_ns_result,
403                                answer);
404 }
405
406 /**
407  * The DNS request handler
408  *
409  * @param cls closure
410  * @param rh request handle to user for reply
411  * @param request_length number of bytes in request
412  * @param request udp payload of the DNS request
413  */
414 void
415 handle_dns_request(void *cls,
416                    struct GNUNET_DNS_RequestHandle *rh,
417                    size_t request_length,
418                    const char *request)
419 {
420   /**
421    * parse request for tld
422    */
423   struct GNUNET_DNSPARSER_Packet *p;
424   int namelen;
425   int i;
426   char *tail;
427
428   GNUNET_log (GNUNET_ERROR_TYPE_INFO, "hijacked a request...processing\n");
429   p = GNUNET_DNSPARSER_parse (request, request_length);
430   
431   if (NULL == p)
432   {
433     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
434                 "Received malformed DNS packet, leaving it untouched\n");
435     GNUNET_DNS_request_forward (rh);
436     return;
437   }
438   
439   /**
440    * Check tld and decide if we or
441    * legacy dns is responsible
442    */
443   for (i=0;i<p->num_queries;i++)
444   {
445     namelen = strlen(p->queries[i].name);
446     
447     if (namelen < 7) /* this can't be .gnunet */
448       continue;
449     /**
450      * Move our tld/root to config file
451      * Generate fake DNS reply that replaces .gnunet with .org for testing?
452      */
453     tail = p->queries[i].name+(namelen-7);
454     if (0 == strcmp(tail, ".gnunet"))
455     {
456       /* FIXME we need to answer to ALL queries in ONE response...
457        * What happens if some requests should be handled by us and
458        * others by DNS?
459        * Like this we only answer one...
460        */
461       lookup_namestore(rh, p->queries[i].name, p->id, p->queries[i].type);
462     }
463     else
464     {
465       /**
466        * This request does not concern us. Forward to real DNS.
467        */
468       GNUNET_log(GNUNET_ERROR_TYPE_INFO,
469                  "Request for %s is forwarded to DNS\n", p->queries[i].name);
470       GNUNET_DNS_request_forward (rh);
471     }
472   }
473 }
474
475 /*TODO*/
476 static void
477 handle_client_record_lookup(void *cls,
478                             struct GNUNET_SERVER_Client *client,
479                             const struct GNUNET_MessageHeader *message)
480 {
481 }
482
483 /**
484  * test function
485  */
486 void
487 put_some_records(void)
488 {
489   /* put a few records into namestore */
490   char* ipA = "1.2.3.4";
491   char* ipB = "5.6.7.8";
492   struct in_addr *alice = GNUNET_malloc(sizeof(struct in_addr));
493   struct in_addr *bob = GNUNET_malloc(sizeof(struct in_addr));
494   GNUNET_assert(1 == inet_pton (AF_INET, ipA, alice));
495   GNUNET_assert(1 == inet_pton (AF_INET, ipB, bob));
496   GNUNET_NAMESTORE_record_put (namestore_handle,
497                                zone_hash,
498                                "alice.gnunet",
499                                GNUNET_GNS_RECORD_TYPE_A,
500                                GNUNET_TIME_absolute_get_forever(),
501                                GNUNET_NAMESTORE_RF_AUTHORITY,
502                                NULL, //sig loc
503                                sizeof(struct in_addr),
504                                alice,
505                                NULL,
506                                NULL);
507   GNUNET_NAMESTORE_record_put (namestore_handle,
508                                zone_hash,
509                                "bob.gnunet",
510                                GNUNET_GNS_RECORD_TYPE_A,
511                                GNUNET_TIME_absolute_get_forever(),
512                                GNUNET_NAMESTORE_RF_AUTHORITY,
513                                NULL, //sig loc
514                                sizeof(struct in_addr),
515                                bob,
516                                NULL,
517                                NULL);
518 }
519
520 //Prototype... needed in put function
521 static void
522 update_zone_dht(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
523
524 void
525 put_gns_record(void *cls, const GNUNET_HashCode *zone, const char *name,
526                uint32_t record_type, struct GNUNET_TIME_Absolute expiration,
527                enum GNUNET_NAMESTORE_RecordFlags flags,
528                const struct GNUNET_NAMESTORE_SignatureLocation *sig_loc,
529                size_t size, const void *record_data)
530 {
531   struct GNUNET_TIME_Relative timeout;
532
533   char* data;
534   char* data_ptr;
535   struct GNUNET_TIME_AbsoluteNBO exp_nbo;
536   exp_nbo = GNUNET_TIME_absolute_hton (expiration);
537   uint32_t namelen = htonl(strlen(name));
538   uint16_t flags_nbo = htons(flags);
539   uint64_t offset = GNUNET_htonll(sig_loc->offset);
540   uint32_t depth = htonl(sig_loc->depth);
541   uint32_t revision = htonl(sig_loc->revision);
542
543   /**
544    * I guess this can be done prettier
545    */
546   size_t record_len = sizeof(size_t) + sizeof(uint32_t) +
547     sizeof(uint16_t) +
548     sizeof(struct GNUNET_NAMESTORE_SignatureLocation) +
549     sizeof(uint32_t) + strlen(name) + size;
550   
551   record_type = htonl(record_type);
552
553   data = GNUNET_malloc(record_len);
554   
555   /* -_- */
556   data_ptr = data;
557   memcpy(data_ptr, &namelen, sizeof(size_t));
558   data_ptr += sizeof(size_t);
559
560   memcpy(data_ptr, name, namelen);
561   data_ptr += namelen;
562   
563   memcpy(data_ptr, &record_type, sizeof(uint32_t));
564   data_ptr += sizeof(uint32_t);
565
566   memcpy(data_ptr, &exp_nbo, sizeof(struct GNUNET_TIME_AbsoluteNBO));
567   data_ptr += sizeof(struct GNUNET_TIME_AbsoluteNBO);
568
569   memcpy(data_ptr, &flags_nbo, sizeof(uint16_t));
570   data_ptr += sizeof(uint16_t);
571
572   memcpy(data_ptr, &offset, sizeof(uint64_t));
573   data_ptr += sizeof(uint64_t);
574
575   memcpy(data_ptr, &depth, sizeof(uint32_t));
576   data_ptr += sizeof(uint32_t);
577   
578   memcpy(data_ptr, &revision, sizeof(uint32_t));
579   data_ptr += sizeof(uint32_t);
580
581   memcpy(data_ptr, &size, sizeof(uint32_t));
582   data_ptr += sizeof(uint32_t);
583
584   /**
585    * FIXME note that this only works with raw data in nbo
586    * write helper function that converts properly and returns buffer
587    */
588   memcpy(data_ptr, record_data, size);
589   data_ptr += size;
590   /*Doing this made me sad...*/
591
592   /**
593    * FIXME magic number
594    */
595   timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 20);
596
597   GNUNET_DHT_put (dht_handle, zone_hash,
598                   5, //replication
599                   GNUNET_DHT_RO_NONE,
600                   GNUNET_BLOCK_TYPE_TEST, //FIXME todo
601                   (data_ptr-data),
602                   data,
603                   expiration, //FIXME from record makes sense?
604                   timeout,
605                   NULL, //FIXME continuation needed? success check?
606                   NULL); //cls for cont
607
608   /**
609    * Reschedule update
610    */
611   GNUNET_SCHEDULER_add_delayed (dht_update_interval,
612                                 &update_zone_dht,
613                                 NULL);
614
615 }
616
617 /**
618  * Periodically iterate over our zone and store everything in dht
619  */
620 static void
621 update_zone_dht(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
622 {
623   GNUNET_NAMESTORE_zone_transfer (namestore_handle, zone_hash,
624                                   &put_gns_record,
625                                   NULL);
626 }
627
628 /**
629  * Process GNS requests.
630  *
631  * @param cls closure
632  * @param server the initialized server
633  * @param c configuration to use
634  */
635 static void
636 run (void *cls, struct GNUNET_SERVER_Handle *server,
637      const struct GNUNET_CONFIGURATION_Handle *c)
638 {
639   
640   /* The IPC message types */
641   static const struct GNUNET_SERVER_MessageHandler handlers[] = {
642     /* callback, cls, type, size */
643     {&handle_client_record_lookup, NULL, GNUNET_MESSAGE_TYPE_GNS_CLIENT_LOOKUP,
644       0},
645     {NULL, NULL, 0, 0}
646   };
647   
648   zone_key = GNUNET_CRYPTO_rsa_key_create ();
649   GNUNET_CRYPTO_hash(zone_key, GNUNET_CRYPTO_RSA_KEY_LENGTH,//FIXME is this ok?
650                      zone_hash);
651
652   nc = GNUNET_SERVER_notification_context_create (server, 1);
653
654   /* FIXME - do some config parsing 
655    *       - Maybe only hijack dns if option is set (HIJACK_DNS=1)
656    */
657
658   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
659                                 NULL);
660   /**
661    * Do gnunet dns init here
662    */
663   dns_handle = GNUNET_DNS_connect(c,
664                                   GNUNET_DNS_FLAG_PRE_RESOLUTION,
665                                   &handle_dns_request, /* rh */
666                                   NULL); /* Closure */
667
668   if (NULL == dns_handle)
669   {
670     GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
671                "Failed to connect to the dnsservice!\n");
672   }
673
674   /**
675    * handle to our local namestore
676    */
677   namestore_handle = GNUNET_NAMESTORE_connect(c);
678
679   if (NULL == namestore_handle)
680   {
681     //FIXME do error handling;
682     GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
683                "Failed to connect to the namestore!\n");
684   }
685
686   /**
687    * handle to the dht
688    */
689   dht_handle = GNUNET_DHT_connect(c, 1); //FIXME get ht_len from cfg
690
691   if (NULL == dht_handle)
692   {
693     GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Could not connect to DHT!\n");
694   }
695   
696   dht_update_interval = GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS,
697                                                       60); //FIXME from cfg
698   GNUNET_SCHEDULER_add_delayed (dht_update_interval,
699                                 &update_zone_dht,
700                                 NULL);
701   
702   put_some_records();
703
704   GNUNET_SERVER_add_handlers (server, handlers);
705   /**
706    * Esp the lookup would require to keep track of the clients' context
707    * See dht.
708    * GNUNET_SERVER_disconnect_notify (server, &client_disconnect, NULL);
709    **/
710 }
711
712
713 /**
714  * The main function for the GNS service.
715  *
716  * @param argc number of arguments from the command line
717  * @param argv command line arguments
718  * @return 0 ok, 1 on error
719  */
720 int
721 main (int argc, char *const *argv)
722 {
723   int ret;
724
725   ret =
726       (GNUNET_OK ==
727        GNUNET_SERVICE_run (argc, argv, "gns", GNUNET_SERVICE_OPTION_NONE, &run,
728                            NULL)) ? 0 : 1;
729   return ret;
730 }
731
732 /* end of gnunet-service-gns.c */