From: Christian Grothoff Date: Fri, 20 Jul 2012 17:39:09 +0000 (+0000) Subject: -skeleton dns2gns X-Git-Tag: initial-import-from-subversion-38251~12400 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d74e995ee32c4c37ca104b7ce3b0b1ee84306d22;p=oweals%2Fgnunet.git -skeleton dns2gns --- diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am index c91b26ceb..45bacda3c 100644 --- a/src/gns/Makefile.am +++ b/src/gns/Makefile.am @@ -42,7 +42,8 @@ bin_PROGRAMS = \ $(DO_PROXY) \ $(DO_W32_HELPER) \ $(DO_W32_NSPTOOLS) \ - gnunet-gns + gnunet-gns \ + gnunet-dns2gns bin_SCRIPTS=gnunet-gns-proxy-setup-ca @@ -286,6 +287,14 @@ gnunet_gns_LDADD = \ gnunet_gns_DEPENDENCIES = \ libgnunetgns.la +gnunet_dns2gns_SOURCES = \ + gnunet-dns2gns.c +gnunet_dns2gns_LDADD = \ + $(top_builddir)/src/gns/libgnunetgns.la \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/namestore/libgnunetnamestore.la \ + $(GN_LIBINTL) + gnunet_gns_proxy_SOURCES = \ gnunet-gns-proxy.c gns_proxy_proto.h gnunet_gns_proxy_LDADD = -lmicrohttpd -lcurl -lgnutls \ 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 @@ +/* + This file is part of GNUnet. + (C) 2012 Christian Grothoff (and other contributing authors) + + GNUnet is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNUnet; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +/** + * @file gnunet-dns2gns.c + * @brief DNS server that translates DNS requests to GNS + * @author Christian Grothoff + */ +#include "platform.h" +#include +#include + +/** + * Data kept per request. + */ +struct Request +{ + +}; + + +/** + * Listen socket. + */ +static struct GNUNET_NETWORK_Handle *listen_socket; + + +/** + * Task run on shutdown. Cleans up everything. + * + * @param cls unused + * @param tc scheduler context + */ +static void +do_shutdown (void *cls, + const struct GNUNET_SCHEDULER_TaskContext *tc) +{ +} + + +/** + * Main function that will be run. + * + * @param cls closure + * @param args remaining command-line arguments + * @param cfgfile name of the configuration file used (for saving, can be NULL!) + * @param cfg configuration + */ +static void +run (void *cls, char *const *args, const char *cfgfile, + const struct GNUNET_CONFIGURATION_Handle *cfg) +{ + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, + &do_shutdown, NULL); +} + + +/** + * The main function for the fcfs daemon. + * + * @param argc number of arguments from the command line + * @param argv command line arguments + * @return 0 ok, 1 on error + */ +int +main (int argc, + char *const *argv) +{ + static const struct GNUNET_GETOPT_CommandLineOption options[] = { + GNUNET_GETOPT_OPTION_END + }; + int ret; + + if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, + &argc, &argv)) + return 2; + GNUNET_log_setup ("gnunet-dns2gns", "WARNING", NULL); + ret = + (GNUNET_OK == + GNUNET_PROGRAM_run (argc, argv, "gnunet-dns2gns", + _("GNUnet DNS-to-GNS proxy (a DNS server)"), + options, + &run, NULL)) ? 0 : 1; + + return ret; +} + +/* end of gnunet-dns2gns.c */