diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-07-20 17:39:09 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-07-20 17:39:09 +0000 |
commit | d74e995ee32c4c37ca104b7ce3b0b1ee84306d22 (patch) | |
tree | aace0eeb41cda8b2746fc825ffd9d7aca57be0a0 /src/gns/gnunet-dns2gns.c | |
parent | ee27427806f329c2eff9f5b0efb956df365d83f7 (diff) | |
download | gnunet-d74e995ee32c4c37ca104b7ce3b0b1ee84306d22.tar.gz gnunet-d74e995ee32c4c37ca104b7ce3b0b1ee84306d22.zip |
-skeleton dns2gns
Diffstat (limited to 'src/gns/gnunet-dns2gns.c')
-rw-r--r-- | src/gns/gnunet-dns2gns.c | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c new file mode 100644 index 000000000..a33020f16 --- /dev/null +++ b/src/gns/gnunet-dns2gns.c | |||
@@ -0,0 +1,104 @@ | |||
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 */ | ||