[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r19179 - gnunet/src/pt
From: |
gnunet |
Subject: |
[GNUnet-SVN] r19179 - gnunet/src/pt |
Date: |
Mon, 16 Jan 2012 20:21:48 +0100 |
Author: grothoff
Date: 2012-01-16 20:21:48 +0100 (Mon, 16 Jan 2012)
New Revision: 19179
Modified:
gnunet/src/pt/Makefile.am
gnunet/src/pt/gnunet-daemon-pt
gnunet/src/pt/gnunet-daemon-pt.c
Log:
-expanding draft code
Modified: gnunet/src/pt/Makefile.am
===================================================================
--- gnunet/src/pt/Makefile.am 2012-01-16 19:12:42 UTC (rev 19178)
+++ gnunet/src/pt/Makefile.am 2012-01-16 19:21:48 UTC (rev 19179)
@@ -23,6 +23,7 @@
gnunet_daemon_pt_LDADD = \
$(top_builddir)/src/vpn/libgnunetvpn.la \
$(top_builddir)/src/dns/libgnunetdns.la \
+ $(top_builddir)/src/dns/libgnunetdnsparser.la \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/mesh/libgnunetmesh.la \
Modified: gnunet/src/pt/gnunet-daemon-pt
===================================================================
--- gnunet/src/pt/gnunet-daemon-pt 2012-01-16 19:12:42 UTC (rev 19178)
+++ gnunet/src/pt/gnunet-daemon-pt 2012-01-16 19:21:48 UTC (rev 19179)
@@ -32,13 +32,13 @@
# if CDPATH is set.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-relink_command="(cd /home/grothoff/svn/gnunet/src/pt; { test -z
\"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export
LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH
|| { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z
\"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=;
export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset
LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; };
LD_LIBRARY_PATH=/usr/lib/debug:/home/grothoff/lib; export LD_LIBRARY_PATH;
PATH=/opt/jdk1.6.0_22/bin:/usr/lib/jvm/java-6-sun//bin:.:/home/grothoff/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games;
export PATH; gcc -fno-strict-aliasing -Wall -g -Wall -Werror -O0
-I/home/grothoff//include -o \$progdir/\$file gnunet-daemon-pt.o
-L/home/grothoff//lib ../../src/vpn/.libs/libgnunetvpn.so
../../src/dns/.libs/libgnunetdns.so
../../src/statistics/.libs/libgnunetstatistics.so ../../src/util/.libs/li
bgnunetutil.so ../../src/mesh/.libs/libgnunetmesh.so -ldl -Wl,-rpath
-Wl,/home/grothoff/svn/gnunet/src/vpn/.libs -Wl,-rpath
-Wl,/home/grothoff/svn/gnunet/src/dns/.libs -Wl,-rpath
-Wl,/home/grothoff/svn/gnunet/src/statistics/.libs -Wl,-rpath
-Wl,/home/grothoff/svn/gnunet/src/util/.libs -Wl,-rpath
-Wl,/home/grothoff/svn/gnunet/src/mesh/.libs -Wl,-rpath -Wl,/home/grothoff/lib)"
+relink_command="(cd /home/grothoff/svn/gnunet/src/pt; { test -z
\"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export
LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH
|| { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z
\"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=;
export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset
LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; };
LD_LIBRARY_PATH=/usr/lib/debug:/home/grothoff/lib; export LD_LIBRARY_PATH;
PATH=/opt/jdk1.6.0_22/bin:/usr/lib/jvm/java-6-sun//bin:.:/home/grothoff/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games;
export PATH; gcc -fno-strict-aliasing -Wall -g -Wall -Werror -O0
-I/home/grothoff//include -o \$progdir/\$file gnunet-daemon-pt.o
-L/home/grothoff//lib ../../src/vpn/.libs/libgnunetvpn.so
../../src/dns/.libs/libgnunetdns.so ../../src/dns/.libs/libgnunetdnsparser.so
../../src/statistics/.libs/libg
nunetstatistics.so ../../src/util/.libs/libgnunetutil.so
../../src/mesh/.libs/libgnunetmesh.so -ldl -Wl,-rpath
-Wl,/home/grothoff/svn/gnunet/src/vpn/.libs -Wl,-rpath
-Wl,/home/grothoff/svn/gnunet/src/dns/.libs -Wl,-rpath
-Wl,/home/grothoff/svn/gnunet/src/statistics/.libs -Wl,-rpath
-Wl,/home/grothoff/svn/gnunet/src/util/.libs -Wl,-rpath
-Wl,/home/grothoff/svn/gnunet/src/mesh/.libs -Wl,-rpath -Wl,/home/grothoff/lib)"
# This environment variable determines our operation mode.
if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then
# install mode needs the following variables:
generated_by_libtool_version='2.2.6b'
- notinst_deplibs=' ../../src/vpn/libgnunetvpn.la
../../src/dns/libgnunetdns.la ../../src/statistics/libgnunetstatistics.la
../../src/util/libgnunetutil.la ../../src/mesh/libgnunetmesh.la'
+ notinst_deplibs=' ../../src/vpn/libgnunetvpn.la
../../src/dns/libgnunetdns.la ../../src/dns/libgnunetdnsparser.la
../../src/statistics/libgnunetstatistics.la ../../src/util/libgnunetutil.la
../../src/mesh/libgnunetmesh.la'
else
# When we are sourced in execute mode, $file and $ECHO are already set.
if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
Modified: gnunet/src/pt/gnunet-daemon-pt.c
===================================================================
--- gnunet/src/pt/gnunet-daemon-pt.c 2012-01-16 19:12:42 UTC (rev 19178)
+++ gnunet/src/pt/gnunet-daemon-pt.c 2012-01-16 19:21:48 UTC (rev 19179)
@@ -27,6 +27,7 @@
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_dns_service.h"
+#include "gnunet_dnsparser_lib.h"
#include "gnunet_vpn_service.h"
#include "gnunet_statistics_service.h"
@@ -62,7 +63,37 @@
static int ipv6_pt;
+/**
+ * Test if any of the given records need protocol-translation work.
+ *
+ * @param ra array of records
+ * @param ra_len number of entries in ra
+ * @return GNUNET_YES if any of the given records require protocol-translation
+ */
+static int
+work_test (const struct GNUNET_DNSPARSER_Record *ra,
+ unsigned int ra_len)
+{
+ unsigned int i;
+ for (i=0;i<ra_len;i++)
+ {
+ switch (ra[i].type)
+ {
+ case GNUNET_DNSPARSER_TYPE_A:
+ if (ipv4_pt)
+ return GNUNET_YES;
+ break;
+ case GNUNET_DNSPARSER_TYPE_AAAA:
+ if (ipv6_pt)
+ return GNUNET_YES;
+ break;
+ }
+ }
+ return GNUNET_NO;
+}
+
+
/**
* Signature of a function that is called whenever the DNS service
* encounters a DNS request and needs to do something with it. The
@@ -92,6 +123,27 @@
size_t request_length,
const char *request)
{
+ struct GNUNET_DNSPARSER_Packet *dns;
+ int work;
+
+ dns = GNUNET_DNSPARSER_parse (request, request_length);
+ if (NULL == dns)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Failed to parse DNS request. Dropping.\n"));
+ GNUNET_DNS_request_drop (rh);
+ return;
+ }
+ work = GNUNET_NO;
+ work |= work_test (dns->answers, dns->num_answers);
+ work |= work_test (dns->authority_records, dns->num_authority_records);
+ work |= work_test (dns->additional_records, dns->num_additional_records);
+ if (! work)
+ {
+ GNUNET_DNS_request_forward (rh);
+ return;
+ }
+ /* FIXME: translate A/AAAA records using VPN! */
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r19179 - gnunet/src/pt,
gnunet <=