a33020f161454e47fbb49ff5daf9e797d93f024d
[oweals/gnunet.git] / src / gns / gnunet-dns2gns.c
1 /*
2      This file is part of GNUnet.
3      (C) 2012 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  * @file gnunet-dns2gns.c
22  * @brief DNS server that translates DNS requests to GNS
23  * @author Christian Grothoff
24  */
25 #include "platform.h"
26 #include <gnunet_util_lib.h>
27 #include <gnunet_namestore_service.h>
28
29 /**
30  * Data kept per request.
31  */
32 struct Request
33 {
34
35 };
36
37
38 /**
39  * Listen socket.
40  */
41 static struct GNUNET_NETWORK_Handle *listen_socket;
42
43
44 /**
45  * Task run on shutdown.  Cleans up everything.
46  *
47  * @param cls unused
48  * @param tc scheduler context
49  */
50 static void
51 do_shutdown (void *cls,
52              const struct GNUNET_SCHEDULER_TaskContext *tc)
53 {
54 }
55
56
57 /**
58  * Main function that will be run.
59  *
60  * @param cls closure
61  * @param args remaining command-line arguments
62  * @param cfgfile name of the configuration file used (for saving, can be NULL!)
63  * @param cfg configuration
64  */
65 static void
66 run (void *cls, char *const *args, const char *cfgfile,
67      const struct GNUNET_CONFIGURATION_Handle *cfg)
68 {
69   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
70                                 &do_shutdown, NULL);
71 }
72
73
74 /**
75  * The main function for the fcfs daemon.
76  *
77  * @param argc number of arguments from the command line
78  * @param argv command line arguments
79  * @return 0 ok, 1 on error
80  */
81 int
82 main (int argc, 
83       char *const *argv)
84 {
85   static const struct GNUNET_GETOPT_CommandLineOption options[] = {
86     GNUNET_GETOPT_OPTION_END
87   };
88   int ret;
89
90   if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv,
91                                                  &argc, &argv))
92     return 2;
93   GNUNET_log_setup ("gnunet-dns2gns", "WARNING", NULL);
94   ret =
95       (GNUNET_OK ==
96        GNUNET_PROGRAM_run (argc, argv, "gnunet-dns2gns",
97                            _("GNUnet DNS-to-GNS proxy (a DNS server)"), 
98                            options,
99                            &run, NULL)) ? 0 : 1;
100
101   return ret;
102 }
103
104 /* end of gnunet-dns2gns.c */