aboutsummaryrefslogtreecommitdiff
path: root/src/dv
diff options
context:
space:
mode:
Diffstat (limited to 'src/dv')
-rw-r--r--src/dv/Makefile.am21
-rw-r--r--src/dv/Makefile.in257
-rw-r--r--src/dv/dv.conf.in2
-rw-r--r--src/dv/dv_api.c28
-rw-r--r--src/dv/gnunet-service-dv.c36
-rw-r--r--src/dv/test_transport_api_dv.c1247
-rw-r--r--src/dv/test_transport_dv_data.conf7
7 files changed, 190 insertions, 1408 deletions
diff --git a/src/dv/Makefile.am b/src/dv/Makefile.am
index e0cd2e4..0fa26a9 100644
--- a/src/dv/Makefile.am
+++ b/src/dv/Makefile.am
@@ -11,6 +11,8 @@ endif
plugindir = $(libdir)/gnunet
+libexecdir= $(pkglibdir)/libexec/
+
pkgcfgdir= $(pkgdatadir)/config.d/
pkgcfg_DATA = \
@@ -31,7 +33,7 @@ libgnunetdv_la_LDFLAGS = \
-version-info 0:0:0
-bin_PROGRAMS = \
+libexec_PROGRAMS = \
gnunet-service-dv
gnunet_service_dv_SOURCES = \
@@ -59,21 +61,20 @@ libgnunet_plugin_transport_dv_la_LDFLAGS = \
libgnunet_plugin_transport_dv_la_DEPENDENCIES = \
libgnunetdv.la
-check_PROGRAMS = \
- test_transport_api_dv
+#check_PROGRAMS = \
+# test_transport_api_dv
# test_dv_topology
if ENABLE_TEST_RUN
TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
endif
-test_transport_api_dv_SOURCES = \
- test_transport_api_dv.c
-test_transport_api_dv_LDADD = \
- $(top_builddir)/src/core/libgnunetcore.la \
- $(top_builddir)/src/transport/libgnunettransport.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/testing/libgnunettesting.la
+#test_transport_api_dv_SOURCES = \
+# test_transport_api_dv.c
+#test_transport_api_dv_LDADD = \
+# $(top_builddir)/src/core/libgnunetcore.la \
+# $(top_builddir)/src/transport/libgnunettransport.la \
+# $(top_builddir)/src/util/libgnunetutil.la
EXTRA_DIST = \
test_transport_dv_data.conf
diff --git a/src/dv/Makefile.in b/src/dv/Makefile.in
index 3389e56..9d47dfd 100644
--- a/src/dv/Makefile.in
+++ b/src/dv/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -18,6 +18,23 @@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -37,23 +54,23 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-bin_PROGRAMS = gnunet-service-dv$(EXEEXT)
-check_PROGRAMS = test_transport_api_dv$(EXEEXT)
-@ENABLE_TEST_RUN_TRUE@TESTS = $(check_PROGRAMS)
+libexec_PROGRAMS = gnunet-service-dv$(EXEEXT)
+TESTS =
subdir = src/dv
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/dv.conf.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/absolute-header.m4 \
$(top_srcdir)/m4/align.m4 $(top_srcdir)/m4/argz.m4 \
- $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/iconv.m4 \
- $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
- $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libcurl.m4 \
- $(top_srcdir)/m4/libgcrypt.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/libunistring.m4 $(top_srcdir)/m4/ltdl.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glib-2.0.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/libunistring.m4 \
+ $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/po.m4 \
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -83,14 +100,20 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(plugindir)" \
- "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgcfgdir)"
+ "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(pkgcfgdir)"
LTLIBRARIES = $(lib_LTLIBRARIES) $(plugin_LTLIBRARIES)
am_libgnunet_plugin_transport_dv_la_OBJECTS = plugin_transport_dv.lo
libgnunet_plugin_transport_dv_la_OBJECTS = \
$(am_libgnunet_plugin_transport_dv_la_OBJECTS)
-AM_V_lt = $(am__v_lt_$(V))
-am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
libgnunet_plugin_transport_dv_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
@@ -107,16 +130,9 @@ libgnunetdv_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) $(libgnunetdv_la_LDFLAGS) $(LDFLAGS) -o \
$@
-PROGRAMS = $(bin_PROGRAMS)
+PROGRAMS = $(libexec_PROGRAMS)
am_gnunet_service_dv_OBJECTS = gnunet-service-dv.$(OBJEXT)
gnunet_service_dv_OBJECTS = $(am_gnunet_service_dv_OBJECTS)
-am_test_transport_api_dv_OBJECTS = test_transport_api_dv.$(OBJEXT)
-test_transport_api_dv_OBJECTS = $(am_test_transport_api_dv_OBJECTS)
-test_transport_api_dv_DEPENDENCIES = \
- $(top_builddir)/src/core/libgnunetcore.la \
- $(top_builddir)/src/transport/libgnunettransport.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/testing/libgnunettesting.la
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -127,28 +143,31 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_$(V))
-am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_$(V))
-am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(libgnunet_plugin_transport_dv_la_SOURCES) \
- $(libgnunetdv_la_SOURCES) $(gnunet_service_dv_SOURCES) \
- $(test_transport_api_dv_SOURCES)
+ $(libgnunetdv_la_SOURCES) $(gnunet_service_dv_SOURCES)
DIST_SOURCES = $(libgnunet_plugin_transport_dv_la_SOURCES) \
- $(libgnunetdv_la_SOURCES) $(gnunet_service_dv_SOURCES) \
- $(test_transport_api_dv_SOURCES)
+ $(libgnunetdv_la_SOURCES) $(gnunet_service_dv_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
DATA = $(pkgcfg_DATA)
ETAGS = etags
CTAGS = ctags
@@ -190,6 +209,10 @@ EXEEXT = @EXEEXT@
EXT_LIBS = @EXT_LIBS@
EXT_LIB_PATH = @EXT_LIB_PATH@
FGREP = @FGREP@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
GNUNETDNS_GROUP = @GNUNETDNS_GROUP@
@@ -200,6 +223,7 @@ GN_LIBINTL = @GN_LIBINTL@
GN_LIB_LDFLAGS = @GN_LIB_LDFLAGS@
GN_PLUGIN_LDFLAGS = @GN_PLUGIN_LDFLAGS@
GN_USER_HOME_DIR = @GN_USER_HOME_DIR@
+GOBJECT_QUERY = @GOBJECT_QUERY@
GREP = @GREP@
HAVE_LIBUNISTRING = @HAVE_LIBUNISTRING@
INCLTDL = @INCLTDL@
@@ -222,6 +246,8 @@ LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@
LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+LIBGTOP_CFLAGS = @LIBGTOP_CFLAGS@
+LIBGTOP_LIBS = @LIBGTOP_LIBS@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBLTDL = @LIBLTDL@
@@ -243,6 +269,7 @@ LT_CONFIG_H = @LT_CONFIG_H@
LT_DLLOADERS = @LT_DLLOADERS@
LT_DLPREOPEN = @LT_DLPREOPEN@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MONKEYPREFIX = @MONKEYPREFIX@
MSGFMT = @MSGFMT@
@@ -252,6 +279,7 @@ MYSQL_CPPFLAGS = @MYSQL_CPPFLAGS@
MYSQL_LDFLAGS = @MYSQL_LDFLAGS@
NM = @NM@
NMEDIT = @NMEDIT@
+NSS_DIR = @NSS_DIR@
OBJC = @OBJC@
OBJCDEPMODE = @OBJCDEPMODE@
OBJCFLAGS = @OBJCFLAGS@
@@ -267,6 +295,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
POSTGRES_CPPFLAGS = @POSTGRES_CPPFLAGS@
POSTGRES_LDFLAGS = @POSTGRES_LDFLAGS@
POSUB = @POSUB@
@@ -298,6 +327,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -320,6 +350,7 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+gitcommand = @gitcommand@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -330,10 +361,9 @@ includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
-libexecdir = @libexecdir@
+libexecdir = $(pkglibdir)/libexec/
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
ltdl_LIBOBJS = @ltdl_LIBOBJS@
ltdl_LTLIBOBJS = @ltdl_LTLIBOBJS@
mandir = @mandir@
@@ -351,6 +381,7 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
+svnversioncommand = @svnversioncommand@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target = @target@
@@ -414,15 +445,13 @@ libgnunet_plugin_transport_dv_la_LDFLAGS = \
libgnunet_plugin_transport_dv_la_DEPENDENCIES = \
libgnunetdv.la
-test_transport_api_dv_SOURCES = \
- test_transport_api_dv.c
-
-test_transport_api_dv_LDADD = \
- $(top_builddir)/src/core/libgnunetcore.la \
- $(top_builddir)/src/transport/libgnunettransport.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/testing/libgnunettesting.la
+#test_transport_api_dv_SOURCES = \
+# test_transport_api_dv.c
+#test_transport_api_dv_LDADD = \
+# $(top_builddir)/src/core/libgnunetcore.la \
+# $(top_builddir)/src/transport/libgnunettransport.la \
+# $(top_builddir)/src/util/libgnunetutil.la
EXTRA_DIST = \
test_transport_dv_data.conf
@@ -464,7 +493,6 @@ dv.conf: $(top_builddir)/config.status $(srcdir)/dv.conf.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
@@ -472,6 +500,8 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES)
else :; fi; \
done; \
test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
@@ -495,7 +525,6 @@ clean-libLTLIBRARIES:
done
install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)"
@list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
@@ -503,6 +532,8 @@ install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
else :; fi; \
done; \
test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \
}
@@ -524,14 +555,17 @@ clean-pluginLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libgnunet_plugin_transport_dv.la: $(libgnunet_plugin_transport_dv_la_OBJECTS) $(libgnunet_plugin_transport_dv_la_DEPENDENCIES)
+libgnunet_plugin_transport_dv.la: $(libgnunet_plugin_transport_dv_la_OBJECTS) $(libgnunet_plugin_transport_dv_la_DEPENDENCIES) $(EXTRA_libgnunet_plugin_transport_dv_la_DEPENDENCIES)
$(AM_V_CCLD)$(libgnunet_plugin_transport_dv_la_LINK) -rpath $(plugindir) $(libgnunet_plugin_transport_dv_la_OBJECTS) $(libgnunet_plugin_transport_dv_la_LIBADD) $(LIBS)
-libgnunetdv.la: $(libgnunetdv_la_OBJECTS) $(libgnunetdv_la_DEPENDENCIES)
+libgnunetdv.la: $(libgnunetdv_la_OBJECTS) $(libgnunetdv_la_DEPENDENCIES) $(EXTRA_libgnunetdv_la_DEPENDENCIES)
$(AM_V_CCLD)$(libgnunetdv_la_LINK) -rpath $(libdir) $(libgnunetdv_la_OBJECTS) $(libgnunetdv_la_LIBADD) $(LIBS)
-install-binPROGRAMS: $(bin_PROGRAMS)
+install-libexecPROGRAMS: $(libexec_PROGRAMS)
@$(NORMAL_INSTALL)
- test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
- @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \
+ fi; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p || test -f $$p1; \
@@ -548,44 +582,32 @@ install-binPROGRAMS: $(bin_PROGRAMS)
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
- echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
- $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \
} \
; done
-uninstall-binPROGRAMS:
+uninstall-libexecPROGRAMS:
@$(NORMAL_UNINSTALL)
- @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' `; \
test -n "$$list" || exit 0; \
- echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(bindir)" && rm -f $$files
-
-clean-binPROGRAMS:
- @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
- echo " rm -f" $$list; \
- rm -f $$list || exit $$?; \
- test -n "$(EXEEXT)" || exit 0; \
- list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f" $$list; \
- rm -f $$list
+ echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(libexecdir)" && rm -f $$files
-clean-checkPROGRAMS:
- @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+clean-libexecPROGRAMS:
+ @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
-gnunet-service-dv$(EXEEXT): $(gnunet_service_dv_OBJECTS) $(gnunet_service_dv_DEPENDENCIES)
+gnunet-service-dv$(EXEEXT): $(gnunet_service_dv_OBJECTS) $(gnunet_service_dv_DEPENDENCIES) $(EXTRA_gnunet_service_dv_DEPENDENCIES)
@rm -f gnunet-service-dv$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(gnunet_service_dv_OBJECTS) $(gnunet_service_dv_LDADD) $(LIBS)
-test_transport_api_dv$(EXEEXT): $(test_transport_api_dv_OBJECTS) $(test_transport_api_dv_DEPENDENCIES)
- @rm -f test_transport_api_dv$(EXEEXT)
- $(AM_V_CCLD)$(LINK) $(test_transport_api_dv_OBJECTS) $(test_transport_api_dv_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -596,31 +618,27 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dv_api.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnunet-service-dv.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_transport_dv.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_transport_api_dv.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
@@ -629,8 +647,11 @@ clean-libtool:
-rm -rf .libs _libs
install-pkgcfgDATA: $(pkgcfg_DATA)
@$(NORMAL_INSTALL)
- test -z "$(pkgcfgdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgcfgdir)"
@list='$(pkgcfg_DATA)'; test -n "$(pkgcfgdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkgcfgdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkgcfgdir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@@ -644,9 +665,7 @@ uninstall-pkgcfgDATA:
@$(NORMAL_UNINSTALL)
@list='$(pkgcfg_DATA)'; test -n "$(pkgcfgdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- test -n "$$files" || exit 0; \
- echo " ( cd '$(DESTDIR)$(pkgcfgdir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(pkgcfgdir)" && rm -f $$files
+ dir='$(DESTDIR)$(pkgcfgdir)'; $(am__uninstall_files_from_dir)
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -781,14 +800,15 @@ check-TESTS: $(TESTS)
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
if test "$$failed" -eq 0; then \
- echo "$$grn$$dashes"; \
+ col="$$grn"; \
else \
- echo "$$red$$dashes"; \
+ col="$$red"; \
fi; \
- echo "$$banner"; \
- test -z "$$skipped" || echo "$$skipped"; \
- test -z "$$report" || echo "$$report"; \
- echo "$$dashes$$std"; \
+ echo "$${col}$$dashes$${std}"; \
+ echo "$${col}$$banner$${std}"; \
+ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+ test -z "$$report" || echo "$${col}$$report$${std}"; \
+ echo "$${col}$$dashes$${std}"; \
test "$$failed" -eq 0; \
else :; fi
@@ -823,14 +843,11 @@ distdir: $(DISTFILES)
fi; \
done
check-am: all-am
- $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA)
-install-binPROGRAMS: install-libLTLIBRARIES
-
installdirs:
- for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgcfgdir)"; do \
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(pkgcfgdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
@@ -843,10 +860,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
@@ -860,9 +882,8 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
- clean-libLTLIBRARIES clean-libtool clean-pluginLTLIBRARIES \
- mostlyclean-am
+clean-am: clean-generic clean-libLTLIBRARIES clean-libexecPROGRAMS \
+ clean-libtool clean-pluginLTLIBRARIES mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
@@ -888,7 +909,7 @@ install-dvi: install-dvi-am
install-dvi-am:
-install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
+install-exec-am: install-libLTLIBRARIES install-libexecPROGRAMS
install-html: install-html-am
@@ -928,27 +949,27 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES \
+uninstall-am: uninstall-libLTLIBRARIES uninstall-libexecPROGRAMS \
uninstall-pkgcfgDATA uninstall-pluginLTLIBRARIES
.MAKE: check-am install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
- clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
- clean-libLTLIBRARIES clean-libtool clean-pluginLTLIBRARIES \
- ctags distclean distclean-compile distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-binPROGRAMS \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-libLTLIBRARIES \
- install-man install-pdf install-pdf-am install-pkgcfgDATA \
+ clean-generic clean-libLTLIBRARIES clean-libexecPROGRAMS \
+ clean-libtool clean-pluginLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am \
+ install-libLTLIBRARIES install-libexecPROGRAMS install-man \
+ install-pdf install-pdf-am install-pkgcfgDATA \
install-pluginLTLIBRARIES install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am \
- uninstall-binPROGRAMS uninstall-libLTLIBRARIES \
+ uninstall-libLTLIBRARIES uninstall-libexecPROGRAMS \
uninstall-pkgcfgDATA uninstall-pluginLTLIBRARIES
diff --git a/src/dv/dv.conf.in b/src/dv/dv.conf.in
index 93278df..c0dc21b 100644
--- a/src/dv/dv.conf.in
+++ b/src/dv/dv.conf.in
@@ -1,10 +1,8 @@
[dv]
AUTOSTART = YES
-DEBUG = NO
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
BINARY = gnunet-service-dv
-CONFIG = $DEFAULTCONFIG
HOME = $SERVICEHOME
HOSTNAME = localhost
@UNIXONLY@ PORT = 2571
diff --git a/src/dv/dv_api.c b/src/dv/dv_api.c
index 93891ca..d3cdb0f 100644
--- a/src/dv/dv_api.c
+++ b/src/dv/dv_api.c
@@ -145,6 +145,16 @@ struct SendCallbackContext
* Target of the message.
*/
struct GNUNET_PeerIdentity target;
+
+ /**
+ * Payload size in bytes
+ */
+ size_t payload_size;
+
+ /**
+ * DV message size
+ */
+ size_t msg_size;
};
/**
@@ -154,9 +164,9 @@ struct SendCallbackContext
* @param hash set to uid (extended with zeros)
*/
static void
-hash_from_uid (uint32_t uid, GNUNET_HashCode * hash)
+hash_from_uid (uint32_t uid, struct GNUNET_HashCode * hash)
{
- memset (hash, 0, sizeof (GNUNET_HashCode));
+ memset (hash, 0, sizeof (struct GNUNET_HashCode));
*((uint32_t *) hash) = uid;
}
@@ -351,7 +361,7 @@ handle_message_receipt (void *cls, const struct GNUNET_MessageHeader *msg)
char *sender_address;
char *packed_msg;
char *packed_msg_start;
- GNUNET_HashCode uidhash;
+ struct GNUNET_HashCode uidhash;
struct SendCallbackContext *send_ctx;
if (msg == NULL)
@@ -416,11 +426,13 @@ handle_message_receipt (void *cls, const struct GNUNET_MessageHeader *msg)
{
if (ntohl (send_result_msg->result) == 0)
{
- send_ctx->cont (send_ctx->cont_cls, &send_ctx->target, GNUNET_OK);
+ send_ctx->cont (send_ctx->cont_cls, &send_ctx->target, GNUNET_OK,
+ send_ctx->payload_size, send_ctx->msg_size);
}
else
{
- send_ctx->cont (send_ctx->cont_cls, &send_ctx->target, GNUNET_SYSERR);
+ send_ctx->cont (send_ctx->cont_cls, &send_ctx->target, GNUNET_SYSERR,
+ send_ctx->payload_size, 0);
}
}
GNUNET_free_non_null (send_ctx);
@@ -459,7 +471,7 @@ GNUNET_DV_send (struct GNUNET_DV_Handle *dv_handle,
struct GNUNET_DV_SendMessage *msg;
struct SendCallbackContext *send_ctx;
char *end_of_message;
- GNUNET_HashCode uidhash;
+ struct GNUNET_HashCode uidhash;
int msize;
#if DEBUG_DV_MESSAGES
@@ -484,6 +496,8 @@ GNUNET_DV_send (struct GNUNET_DV_Handle *dv_handle,
memcpy (end_of_message, msgbuf, msgbuf_size);
add_pending (dv_handle, msg);
send_ctx = GNUNET_malloc (sizeof (struct SendCallbackContext));
+ send_ctx->payload_size = msgbuf_size;
+ send_ctx->msg_size = msize;
send_ctx->cont = cont;
send_ctx->cont_cls = cont_cls;
memcpy (&send_ctx->target, target, sizeof (struct GNUNET_PeerIdentity));
@@ -587,7 +601,7 @@ GNUNET_DV_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_YES, &transmit_start,
start_context);
- handle->send_callbacks = GNUNET_CONTAINER_multihashmap_create (100);
+ handle->send_callbacks = GNUNET_CONTAINER_multihashmap_create (100, GNUNET_NO);
return handle;
}
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c
index 956595f..ca881aa 100644
--- a/src/dv/gnunet-service-dv.c
+++ b/src/dv/gnunet-service-dv.c
@@ -681,7 +681,7 @@ find_destination (void *cls, struct GNUNET_CONTAINER_HeapNode *node,
* respective neighbor.
*/
static int
-find_specific_id (void *cls, const GNUNET_HashCode * key, void *value)
+find_specific_id (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct FindIDContext *fdc = cls;
struct DistantNeighbor *dn = value;
@@ -704,7 +704,7 @@ find_specific_id (void *cls, const GNUNET_HashCode * key, void *value)
* route.
*/
static int
-find_distant_peer (void *cls, const GNUNET_HashCode * key, void *value)
+find_distant_peer (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct FindDestinationContext *fdc = cls;
struct DistantNeighbor *distant = value;
@@ -1085,7 +1085,7 @@ send_message_via (const struct GNUNET_PeerIdentity *sender,
* @return GNUNET_YES to continue iteration, GNUNET_NO to stop
*/
static int
-find_least_cost_peer (void *cls, const GNUNET_HashCode * key, void *value)
+find_least_cost_peer (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct FindLeastCostContext *find_context = cls;
struct DistantNeighbor *dn = value;
@@ -1264,7 +1264,7 @@ struct CheckPeerContext
* GNUNET_NO if not.
*/
int
-checkPeerID (void *cls, const GNUNET_HashCode * key, void *value)
+checkPeerID (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct CheckPeerContext *ctx = cls;
struct DistantNeighbor *distant = value;
@@ -1661,7 +1661,7 @@ handle_dv_data_message (void *cls, const struct GNUNET_PeerIdentity *peer,
* GNUNET_NO if not.
*/
int
-print_neighbors (void *cls, const GNUNET_HashCode * key, void *abs_value)
+print_neighbors (void *cls, const struct GNUNET_HashCode * key, void *abs_value)
{
struct DistantNeighbor *distant_neighbor = abs_value;
char my_shortname[5];
@@ -1849,7 +1849,7 @@ handle_start (void *cls, struct GNUNET_SERVER_Client *client,
* GNUNET_NO if not.
*/
int
-send_iterator (void *cls, const GNUNET_HashCode * key, void *abs_value)
+send_iterator (void *cls, const struct GNUNET_HashCode * key, void *abs_value)
{
struct DV_SendContext *send_context = cls;
struct DistantNeighbor *distant_neighbor = abs_value;
@@ -2174,7 +2174,7 @@ direct_neighbor_free (struct DirectNeighbor *direct)
* @return GNUNET_YES to continue iteration, GNUNET_NO to stop
*/
static int
-schedule_disconnect_messages (void *cls, const GNUNET_HashCode * key,
+schedule_disconnect_messages (void *cls, const struct GNUNET_HashCode * key,
void *value)
{
struct DisconnectContext *disconnect_context = cls;
@@ -2222,7 +2222,7 @@ schedule_disconnect_messages (void *cls, const GNUNET_HashCode * key,
* @return GNUNET_YES to continue iteration, GNUNET_NO to stop
*/
static int
-free_extended_neighbors (void *cls, const GNUNET_HashCode * key, void *value)
+free_extended_neighbors (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct DistantNeighbor *distant = value;
@@ -2240,7 +2240,7 @@ free_extended_neighbors (void *cls, const GNUNET_HashCode * key, void *value)
* @return GNUNET_YES to continue iteration, GNUNET_NO to stop
*/
static int
-free_direct_neighbors (void *cls, const GNUNET_HashCode * key, void *value)
+free_direct_neighbors (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct DirectNeighbor *direct = value;
@@ -2320,7 +2320,7 @@ core_init (void *cls, struct GNUNET_CORE_Handle *server,
* GNUNET_NO if not.
*/
static int
-add_pkey_to_extended (void *cls, const GNUNET_HashCode * key, void *abs_value)
+add_pkey_to_extended (void *cls, const struct GNUNET_HashCode * key, void *abs_value)
{
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *pkey = cls;
struct DistantNeighbor *distant_neighbor = abs_value;
@@ -2348,7 +2348,7 @@ add_pkey_to_extended (void *cls, const GNUNET_HashCode * key, void *abs_value)
* GNUNET_NO if not.
*/
static int
-update_matching_neighbors (void *cls, const GNUNET_HashCode * key, void *value)
+update_matching_neighbors (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct NeighborUpdateInfo *update_info = cls;
struct DistantNeighbor *distant_neighbor = value;
@@ -2384,7 +2384,7 @@ update_matching_neighbors (void *cls, const GNUNET_HashCode * key, void *value)
* @return GNUNET_YES to continue iteration, GNUNET_NO otherwise
*/
static int
-add_distant_all_direct_neighbors (void *cls, const GNUNET_HashCode * key,
+add_distant_all_direct_neighbors (void *cls, const struct GNUNET_HashCode * key,
void *value)
{
struct DirectNeighbor *direct = (struct DirectNeighbor *) value;
@@ -2837,7 +2837,7 @@ handle_dv_gossip_message (void *cls, const struct GNUNET_PeerIdentity *peer,
* @return GNUNET_YES to continue iteration, GNUNET_NO otherwise
*/
static int
-add_all_extended_peers (void *cls, const GNUNET_HashCode * key, void *value)
+add_all_extended_peers (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct NeighborSendContext *send_context = (struct NeighborSendContext *) cls;
struct DistantNeighbor *distant = (struct DistantNeighbor *) value;
@@ -2875,7 +2875,7 @@ add_all_extended_peers (void *cls, const GNUNET_HashCode * key, void *value)
* GNUNET_NO if not.
*/
static int
-gossip_all_to_all_iterator (void *cls, const GNUNET_HashCode * key,
+gossip_all_to_all_iterator (void *cls, const struct GNUNET_HashCode * key,
void *abs_value)
{
struct DirectNeighbor *direct = abs_value;
@@ -2922,7 +2922,7 @@ gossip_all_to_all (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* @return GNUNET_YES to continue iteration, GNUNET_NO otherwise
*/
static int
-add_all_direct_neighbors (void *cls, const GNUNET_HashCode * key, void *value)
+add_all_direct_neighbors (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct DirectNeighbor *direct = (struct DirectNeighbor *) value;
struct DirectNeighbor *to = (struct DirectNeighbor *) cls;
@@ -3290,12 +3290,12 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
neighbor_max_heap =
GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MAX);
- direct_neighbors = GNUNET_CONTAINER_multihashmap_create (max_hosts);
+ direct_neighbors = GNUNET_CONTAINER_multihashmap_create (max_hosts, GNUNET_NO);
extended_neighbors =
- GNUNET_CONTAINER_multihashmap_create (max_table_size * 3);
+ GNUNET_CONTAINER_multihashmap_create (max_table_size * 3, GNUNET_NO);
GNUNET_SERVER_add_handlers (server, plugin_handlers);
- coreAPI = GNUNET_CORE_connect (cfg, 1, NULL, /* FIXME: anything we want to pass around? */
+ coreAPI = GNUNET_CORE_connect (cfg, NULL, /* FIXME: anything we want to pass around? */
&core_init, &handle_core_connect,
&handle_core_disconnect, NULL, GNUNET_NO, NULL,
GNUNET_NO, core_handlers);
diff --git a/src/dv/test_transport_api_dv.c b/src/dv/test_transport_api_dv.c
deleted file mode 100644
index 6165a9d..0000000
--- a/src/dv/test_transport_api_dv.c
+++ /dev/null
@@ -1,1247 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2009 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 dv/test_transport_api_dv.c
- * @brief base testcase for testing distance vector transport
- */
-#include "platform.h"
-#include "gnunet_testing_lib.h"
-#include "gnunet_core_service.h"
-
-#define VERBOSE 1
-
-#define TEST_ALL GNUNET_NO
-
-/**
- * How long until we fail the whole testcase?
- */
-#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600)
-
-/**
- * How long until we give up on starting the peers?
- */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 500)
-
-#define DEFAULT_NUM_PEERS 4
-
-#define DEFAULT_ADDITIONAL_MESSAGES 2
-
-#define MAX_OUTSTANDING_CONNECTIONS 100
-
-static float fail_percentage = 0.00;
-
-static int ok;
-
-static unsigned long long num_additional_messages;
-
-static unsigned long long num_peers;
-
-static unsigned int total_connections;
-
-static unsigned int failed_connections;
-
-static unsigned int total_server_connections;
-
-static unsigned int total_messages_received;
-
-static unsigned int total_other_expected_messages;
-
-static unsigned int temp_total_other_messages;
-
-static unsigned int total_other_messages;
-
-static unsigned int expected_messages;
-
-static unsigned int expected_connections;
-
-static unsigned long long peers_left;
-
-static struct GNUNET_TESTING_PeerGroup *pg;
-
-const struct GNUNET_CONFIGURATION_Handle *main_cfg;
-
-static GNUNET_SCHEDULER_TaskIdentifier die_task;
-
-static char *dotOutFileName = "topology.dot";
-
-static FILE *dotOutFile;
-
-static char *blacklist_transports;
-
-static int transmit_ready_scheduled;
-
-static int transmit_ready_failed;
-
-static int transmit_ready_called;
-
-static enum GNUNET_TESTING_Topology topology;
-
-static enum GNUNET_TESTING_Topology blacklist_topology = GNUNET_TESTING_TOPOLOGY_NONE; /* Don't do any blacklisting */
-
-static enum GNUNET_TESTING_Topology connection_topology = GNUNET_TESTING_TOPOLOGY_NONE; /* NONE actually means connect all allowed peers */
-
-static enum GNUNET_TESTING_TopologyOption connect_topology_option =
- GNUNET_TESTING_TOPOLOGY_OPTION_ALL;
-
-static double connect_topology_option_modifier = 0.0;
-
-static char *test_directory;
-
-struct GNUNET_CONTAINER_MultiHashMap *peer_daemon_hash;
-
-#define MTYPE 12345
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-struct GNUNET_TestMessage
-{
- /**
- * Header of the message
- */
- struct GNUNET_MessageHeader header;
-
- /**
- * Unique identifier for this message.
- */
- uint32_t uid;
-};
-GNUNET_NETWORK_STRUCT_END
-
-struct PeerContext
-{
- /* This is a linked list */
- struct PeerContext *next;
-
- /**
- * Handle to the daemon
- */
- struct GNUNET_TESTING_Daemon *daemon;
-
- /* Handle to the peer core */
- struct GNUNET_CORE_Handle *peer_handle;
-};
-
-static struct PeerContext *all_peers;
-
-struct TestMessageContext
-{
- /* This is a linked list */
- struct TestMessageContext *next;
-
- /* Handle to the sending peer core */
- struct GNUNET_CORE_Handle *peer1handle;
-
- /* Handle to the receiving peer core */
- struct GNUNET_CORE_Handle *peer2handle;
-
- /* Handle to the sending peer daemon */
- struct GNUNET_TESTING_Daemon *peer1;
-
- /* Handle to the receiving peer daemon */
- struct GNUNET_TESTING_Daemon *peer2;
-
- /* Identifier for this message, so we don't disconnect other peers! */
- uint32_t uid;
-
- /* Task for disconnecting cores, allow task to be cancelled on shutdown */
- GNUNET_SCHEDULER_TaskIdentifier disconnect_task;
-};
-
-static struct TestMessageContext *test_messages;
-
-static struct TestMessageContext *other_test_messages;
-
-/**
- * Check whether peers successfully shut down.
- */
-void
-shutdown_callback (void *cls, const char *emsg)
-{
- if (emsg != NULL)
- {
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown of peers failed!\n");
-#endif
- if (ok == 0)
- ok = 666;
- }
- else
- {
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All peers successfully shut down!\n");
-#endif
- }
-}
-
-static void
-finish_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- GNUNET_assert (pg != NULL);
- struct PeerContext *peer_pos;
- struct PeerContext *free_peer_pos;
- struct TestMessageContext *pos;
- struct TestMessageContext *free_pos;
-
- die_task = GNUNET_SCHEDULER_NO_TASK;
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Called finish testing, stopping daemons.\n");
-#endif
- peer_pos = all_peers;
- while (peer_pos != NULL)
- {
- if (peer_pos->peer_handle != NULL)
- GNUNET_CORE_disconnect (peer_pos->peer_handle);
- free_peer_pos = peer_pos;
- peer_pos = peer_pos->next;
- GNUNET_free (free_peer_pos);
- }
- all_peers = NULL;
-
- pos = test_messages;
- while (pos != NULL)
- {
- if (pos->peer1handle != NULL)
- {
- GNUNET_CORE_disconnect (pos->peer1handle);
- pos->peer1handle = NULL;
- }
- if (pos->peer2handle != NULL)
- {
- GNUNET_CORE_disconnect (pos->peer2handle);
- pos->peer2handle = NULL;
- }
- free_pos = pos;
- pos = pos->next;
- if (free_pos->disconnect_task != GNUNET_SCHEDULER_NO_TASK)
- {
- GNUNET_SCHEDULER_cancel (free_pos->disconnect_task);
- }
- GNUNET_free (free_pos);
- }
-
- pos = other_test_messages;
- while (pos != NULL)
- {
- if (pos->peer1handle != NULL)
- {
- GNUNET_CORE_disconnect (pos->peer1handle);
- pos->peer1handle = NULL;
- }
- if (pos->peer2handle != NULL)
- {
- GNUNET_CORE_disconnect (pos->peer2handle);
- pos->peer2handle = NULL;
- }
- free_pos = pos;
- pos = pos->next;
- if (free_pos->disconnect_task != GNUNET_SCHEDULER_NO_TASK)
- {
- GNUNET_SCHEDULER_cancel (free_pos->disconnect_task);
- }
- GNUNET_free (free_pos);
- }
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "transmit_ready's scheduled %d, failed %d, transmit_ready's called %d\n",
- transmit_ready_scheduled, transmit_ready_failed,
- transmit_ready_called);
-#endif
-
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Calling daemons_stop\n");
-#endif
- GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "daemons_stop finished\n");
-#endif
- if (dotOutFile != NULL)
- {
- FPRINTF (dotOutFile, "%s", "}");
- FCLOSE (dotOutFile);
- }
-
- ok = 0;
-}
-
-
-static void
-disconnect_cores (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- struct TestMessageContext *pos = cls;
-
- /* Disconnect from the respective cores */
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from peer 1 `%4s'\n",
- GNUNET_i2s (&pos->peer1->id));
-#endif
- if (pos->peer1handle != NULL)
- GNUNET_CORE_disconnect (pos->peer1handle);
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from peer 2 `%4s'\n",
- GNUNET_i2s (&pos->peer2->id));
-#endif
- if (pos->peer2handle != NULL)
- GNUNET_CORE_disconnect (pos->peer2handle);
- /* Set handles to NULL so test case can be ended properly */
- pos->peer1handle = NULL;
- pos->peer2handle = NULL;
- pos->disconnect_task = GNUNET_SCHEDULER_NO_TASK;
- /* Decrement total connections so new can be established */
- total_server_connections -= 2;
-}
-
-static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- char *msg = cls;
- struct TestMessageContext *pos;
- struct TestMessageContext *free_pos;
- struct PeerContext *peer_pos;
- struct PeerContext *free_peer_pos;
-
- die_task = GNUNET_SCHEDULER_NO_TASK;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "End badly was called (%s)... stopping daemons.\n", msg);
-
- peer_pos = all_peers;
- while (peer_pos != NULL)
- {
- if (peer_pos->peer_handle != NULL)
- GNUNET_CORE_disconnect (peer_pos->peer_handle);
- free_peer_pos = peer_pos;
- peer_pos = peer_pos->next;
- GNUNET_free (free_peer_pos);
- }
- all_peers = NULL;
-
- pos = test_messages;
- while (pos != NULL)
- {
- if (pos->peer1handle != NULL)
- {
- GNUNET_CORE_disconnect (pos->peer1handle);
- pos->peer1handle = NULL;
- }
- if (pos->peer2handle != NULL)
- {
- GNUNET_CORE_disconnect (pos->peer2handle);
- pos->peer2handle = NULL;
- }
- free_pos = pos;
- pos = pos->next;
- GNUNET_free (free_pos);
- }
-
- pos = other_test_messages;
- while (pos != NULL)
- {
- if (pos->peer1handle != NULL)
- {
- GNUNET_CORE_disconnect (pos->peer1handle);
- pos->peer1handle = NULL;
- }
- if (pos->peer2handle != NULL)
- {
- GNUNET_CORE_disconnect (pos->peer2handle);
- pos->peer2handle = NULL;
- }
- free_pos = pos;
- pos = pos->next;
- if (free_pos->disconnect_task != GNUNET_SCHEDULER_NO_TASK)
- {
- GNUNET_SCHEDULER_cancel (free_pos->disconnect_task);
- }
- GNUNET_free (free_pos);
- }
-
- if (pg != NULL)
- {
- GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
- ok = 7331; /* Opposite of leet */
- }
- else
- ok = 401; /* Never got peers started */
-
- if (dotOutFile != NULL)
- {
- FPRINTF (dotOutFile, "%s", "}");
- FCLOSE (dotOutFile);
- }
-}
-
-static void
-send_other_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
-
-/**
- * Get distance information from 'atsi'.
- *
- * @param atsi performance data
- * @return connected transport distance
- */
-static uint32_t
-get_atsi_distance (const struct GNUNET_ATS_Information *atsi,
- unsigned int atsi_count)
-{
- unsigned int i;
-
- for (i = 0; i < atsi_count; i++)
- {
- if (ntohl (atsi->type) == GNUNET_ATS_QUALITY_NET_DISTANCE)
- return ntohl (atsi->value);
- }
-
- GNUNET_break (0);
- /* FIXME: we do not have distance data? Assume direct neighbor. */
- return 1;
-}
-
-
-static int
-process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi,
- unsigned int atsi_count)
-{
- struct TestMessageContext *pos = cls;
- struct GNUNET_TestMessage *msg = (struct GNUNET_TestMessage *) message;
-
-#if VERBOSE
- uint32_t distance;
-#endif
- if (pos->uid != ntohl (msg->uid))
- return GNUNET_OK;
-
-#if VERBOSE
- distance = get_atsi_distance (atsi, atsi_count);
-#endif
- GNUNET_assert (0 ==
- memcmp (peer, &pos->peer1->id,
- sizeof (struct GNUNET_PeerIdentity)));
- if (total_other_expected_messages == 0)
- {
- total_messages_received++;
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received message from `%4s', type %d, uid %u, distance %u.\n",
- GNUNET_i2s (peer), ntohs (message->type), ntohl (msg->uid),
- distance);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Total messages received %d, expected %d.\n",
- total_messages_received, expected_messages);
-#endif
- }
- else
- {
- total_other_messages++;
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received message from `%4s', type %d, uid %u, distance %u.\n",
- GNUNET_i2s (peer), ntohs (message->type), ntohl (msg->uid),
- distance);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Total OTHER messages received %d, expected %d.\n",
- total_other_messages, total_other_expected_messages);
-#endif
- }
-
- if ((total_messages_received == expected_messages) &&
- (total_other_messages == 0))
- {
- GNUNET_SCHEDULER_cancel (die_task);
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Scheduling timeout from DV connections.\n");
-#endif
- die_task =
- GNUNET_SCHEDULER_add_delayed (TEST_TIMEOUT, &end_badly,
- "waiting for DV peers to connect!");
- }
- else if ((total_other_expected_messages > 0) &&
- (total_other_messages == total_other_expected_messages))
- {
- GNUNET_SCHEDULER_cancel (die_task);
- die_task = GNUNET_SCHEDULER_add_now (&finish_testing, NULL);
- }
- else
- {
- pos->disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cores, pos);
- }
-
- return GNUNET_OK;
-}
-
-static size_t
-transmit_ready (void *cls, size_t size, void *buf)
-{
- struct GNUNET_TestMessage *m;
- struct TestMessageContext *pos = cls;
-
- GNUNET_assert (buf != NULL);
- m = (struct GNUNET_TestMessage *) buf;
- m->header.type = htons (MTYPE);
- m->header.size = htons (sizeof (struct GNUNET_TestMessage));
- m->uid = htonl (pos->uid);
- transmit_ready_called++;
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "transmit ready for peer %s\ntransmit_ready's scheduled %d, transmit_ready's called %d\n",
- GNUNET_i2s (&pos->peer1->id), transmit_ready_scheduled,
- transmit_ready_called);
-#endif
- return sizeof (struct GNUNET_TestMessage);
-}
-
-
-static struct GNUNET_CORE_MessageHandler no_handlers[] = {
- {NULL, 0, 0}
-};
-
-static struct GNUNET_CORE_MessageHandler handlers[] = {
- {&process_mtype, MTYPE, sizeof (struct GNUNET_TestMessage)},
- {NULL, 0, 0}
-};
-
-/**
- * Notify of all peer1's peers, once peer 2 is found, schedule connect
- * to peer two for message send.
- *
- * @param cls closure
- * @param peer peer identity this notification is about
- * @param atsi performance data for the connection
- * @param atsi_count number of ATS information included
- */
-static void
-connect_notify_peer2 (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi,
- unsigned int atsi_count)
-{
- struct TestMessageContext *pos = cls;
-
- if (0 == memcmp (&pos->peer1->id, peer, sizeof (struct GNUNET_PeerIdentity)))
- {
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Core connection from `%s' to `%4s' verfied, sending message!\n",
- GNUNET_i2s (&pos->peer2->id), GNUNET_h2s (&peer->hashPubKey));
-#endif
- if (NULL ==
- GNUNET_CORE_notify_transmit_ready (pos->peer1handle, GNUNET_YES, 0,
- TIMEOUT, &pos->peer2->id,
- sizeof (struct GNUNET_TestMessage),
- &transmit_ready, pos))
- {
- /* This probably shouldn't happen, but it does (timing issue?) */
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "RECEIVED NULL when asking core (1) for transmission to peer `%4s'\n",
- GNUNET_i2s (&pos->peer2->id));
- transmit_ready_failed++;
- total_other_expected_messages--;
- }
- else
- {
- transmit_ready_scheduled++;
- }
- }
-}
-
-static void
-init_notify_peer2 (void *cls, struct GNUNET_CORE_Handle *server,
- const struct GNUNET_PeerIdentity *my_identity)
-{
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Core connection to `%4s' established, awaiting connections.\n",
- GNUNET_i2s (my_identity));
-#endif
- total_server_connections++;
-}
-
-/**
- * Notify of all peer1's peers, once peer 2 is found, schedule connect
- * to peer two for message send.
- *
- * @param cls closure
- * @param peer peer identity this notification is about
- * @param atsi performance data for the connection
- * @param atsi_count number of atsi datums
- */
-static void
-connect_notify_peer1 (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi,
- unsigned int atsi_count)
-{
- struct TestMessageContext *pos = cls;
-
- if (0 == memcmp (&pos->peer2->id, peer, sizeof (struct GNUNET_PeerIdentity)))
- {
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Core connection from `%s' to `%4s' verified.\n",
- GNUNET_i2s (&pos->peer1->id), GNUNET_h2s (&peer->hashPubKey));
-#endif
- /*
- * Connect to the receiving peer
- */
- pos->peer2handle =
- GNUNET_CORE_connect (pos->peer2->cfg, 1, pos, &init_notify_peer2,
- &connect_notify_peer2, NULL, NULL, GNUNET_YES,
- NULL, GNUNET_YES, handlers);
- }
-}
-
-static void
-init_notify_peer1 (void *cls, struct GNUNET_CORE_Handle *server,
- const struct GNUNET_PeerIdentity *my_identity)
-{
- total_server_connections++;
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Core connection to `%4s' established, awaiting connections...\n",
- GNUNET_i2s (my_identity));
-#endif
-}
-
-
-static void
-send_test_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- struct TestMessageContext *pos = cls;
-
- if (((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) || (cls == NULL))
- return;
-
- if (die_task == GNUNET_SCHEDULER_NO_TASK)
- {
- die_task =
- GNUNET_SCHEDULER_add_delayed (TEST_TIMEOUT, &end_badly,
- "from create topology (timeout)");
- }
-
- if (total_server_connections >= MAX_OUTSTANDING_CONNECTIONS)
- {
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 1),
- &send_test_messages, pos);
- return; /* Otherwise we'll double schedule messages here! */
- }
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Attempting to send test message from %s to %s\n",
- pos->peer1->shortname, pos->peer2->shortname);
-#endif
- /*
- * Connect to the sending peer
- */
- pos->peer1handle =
- GNUNET_CORE_connect (pos->peer1->cfg, 1, pos, &init_notify_peer1,
- &connect_notify_peer1, NULL, NULL, GNUNET_NO, NULL,
- GNUNET_NO, no_handlers);
-
- GNUNET_assert (pos->peer1handle != NULL);
-
- if (total_server_connections < MAX_OUTSTANDING_CONNECTIONS)
- {
- GNUNET_SCHEDULER_add_now (&send_test_messages, pos->next);
- }
- else
- {
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 1),
- &send_test_messages, pos->next);
- }
-}
-
-static void
-send_other_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- struct TestMessageContext *pos;
- struct TestMessageContext *free_pos;
- struct PeerContext *peer_pos;
-
-#if TEST_ALL
- struct PeerContext *inner_peer_pos;
- struct TestMessageContext *temp_context;
-#endif
- peer_pos = all_peers;
- while (peer_pos != NULL)
- {
- if (peer_pos->peer_handle != NULL)
- {
- GNUNET_CORE_disconnect (peer_pos->peer_handle);
- peer_pos->peer_handle = NULL;
- }
-#if TEST_ALL
- inner_peer_pos = all_peers;
- while (inner_peer_pos != NULL)
- {
- if (inner_peer_pos != peer_pos)
- {
- temp_total_other_messages++;
- temp_context = GNUNET_malloc (sizeof (struct TestMessageContext));
- temp_context->peer1 = peer_pos->daemon;
- temp_context->peer2 = inner_peer_pos->daemon;
- temp_context->next = other_test_messages;
- temp_context->uid = total_connections + temp_total_other_messages;
- temp_context->disconnect_task = GNUNET_SCHEDULER_NO_TASK;
- other_test_messages = temp_context;
- }
- inner_peer_pos = inner_peer_pos->next;
- }
-#endif
- peer_pos = peer_pos->next;
- }
- all_peers = NULL;
-
- pos = test_messages;
- while (pos != NULL)
- {
- if (pos->peer1handle != NULL)
- {
- GNUNET_CORE_disconnect (pos->peer1handle);
- pos->peer1handle = NULL;
- }
- if (pos->peer2handle != NULL)
- {
- GNUNET_CORE_disconnect (pos->peer2handle);
- pos->peer2handle = NULL;
- }
- free_pos = pos;
- pos = pos->next;
- if (free_pos->disconnect_task != GNUNET_SCHEDULER_NO_TASK)
- {
- GNUNET_SCHEDULER_cancel (free_pos->disconnect_task);
- }
- GNUNET_free (free_pos);
- }
- test_messages = NULL;
-
- total_other_expected_messages = temp_total_other_messages;
- if (total_other_expected_messages == 0)
- {
- GNUNET_SCHEDULER_add_now (&end_badly,
- "send_other_messages had 0 messages to send, no DV connections made!");
- }
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Preparing to send %d other test messages\n",
- total_other_expected_messages);
-#endif
-
- GNUNET_SCHEDULER_add_now (&send_test_messages, other_test_messages);
- if (GNUNET_SCHEDULER_NO_TASK != die_task)
- GNUNET_SCHEDULER_cancel (die_task);
- die_task =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 250), &end_badly,
- "from send_other_messages");
-}
-
-static void
-topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
- const struct GNUNET_PeerIdentity *second, uint32_t distance,
- const struct GNUNET_CONFIGURATION_Handle *first_cfg,
- const struct GNUNET_CONFIGURATION_Handle *second_cfg,
- struct GNUNET_TESTING_Daemon *first_daemon,
- struct GNUNET_TESTING_Daemon *second_daemon,
- const char *emsg)
-{
- struct TestMessageContext *temp_context;
-
- if (emsg == NULL)
- {
- total_connections++;
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "connected peer %s to peer %s, distance %u\n",
- first_daemon->shortname, second_daemon->shortname, distance);
-#endif
- temp_context = GNUNET_malloc (sizeof (struct TestMessageContext));
- temp_context->peer1 = first_daemon;
- temp_context->peer2 = second_daemon;
- temp_context->next = test_messages;
- temp_context->uid = total_connections;
- temp_context->disconnect_task = GNUNET_SCHEDULER_NO_TASK;
- test_messages = temp_context;
- expected_messages++;
- }
-#if VERBOSE
- else
- {
- failed_connections++;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Failed to connect peer %s to peer %s with error :\n%s\n",
- first_daemon->shortname, second_daemon->shortname, emsg);
- }
-#endif
-
- if (total_connections == expected_connections)
- {
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Created %u total connections, which is our target number! Calling send messages.\n",
- total_connections);
-#endif
- if (GNUNET_SCHEDULER_NO_TASK != die_task)
- GNUNET_SCHEDULER_cancel (die_task);
- die_task = GNUNET_SCHEDULER_NO_TASK;
- GNUNET_SCHEDULER_add_now (&send_test_messages, test_messages);
- }
- else if (total_connections + failed_connections == expected_connections)
- {
- if (failed_connections <
- (unsigned int) (fail_percentage * total_connections))
- {
- GNUNET_SCHEDULER_cancel (die_task);
- die_task = GNUNET_SCHEDULER_NO_TASK;
- /* FIXME: ret value!? */ GNUNET_SCHEDULER_add_now (&send_test_messages,
- test_messages);
- }
- else
- {
- if (die_task != GNUNET_SCHEDULER_NO_TASK)
- GNUNET_SCHEDULER_cancel (die_task);
- die_task =
- GNUNET_SCHEDULER_add_now (&end_badly,
- "from topology_callback (too many failed connections)");
- }
- }
- else
- {
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Have %d total connections, %d failed connections, Want %d (at least %d)\n",
- total_connections, failed_connections, expected_connections,
- expected_connections -
- (unsigned int) (fail_percentage * expected_connections));
-#endif
- }
-}
-
-
-/**
- * Method called whenever a given peer connects.
- *
- * @param cls closure
- * @param peer peer identity this notification is about
- * @param atsi performance data about this peer's connection
- * @param atsi_count number of atsi datums
- *
- */
-static void
-all_connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi,
- unsigned int atsi_count)
-{
- struct GNUNET_TESTING_Daemon *d = cls;
- struct GNUNET_TESTING_Daemon *second_daemon;
- char *second_shortname;
-
-#if !TEST_ALL
- struct TestMessageContext *temp_context;
-#endif
- uint32_t distance;
-
- if (0 == memcmp (&d->id, peer, sizeof (struct GNUNET_PeerIdentity)))
- return;
- second_shortname = GNUNET_strdup (GNUNET_i2s (peer));
- distance = get_atsi_distance (atsi, atsi_count);
-
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "connected peer %s to peer %s, distance %u\n", d->shortname,
- second_shortname, distance);
-#endif
-
- second_daemon =
- GNUNET_CONTAINER_multihashmap_get (peer_daemon_hash, &peer->hashPubKey);
-
- if (second_daemon == NULL)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Couldn't find second peer!\n");
- GNUNET_free (second_shortname);
- return;
- }
-#if !TEST_ALL
- if (distance > 1)
- {
- temp_total_other_messages++;
- temp_context = GNUNET_malloc (sizeof (struct TestMessageContext));
- temp_context->peer1 = d;
- temp_context->peer2 = second_daemon;
- temp_context->next = other_test_messages;
- temp_context->uid = total_connections + temp_total_other_messages;
- temp_context->disconnect_task = GNUNET_SCHEDULER_NO_TASK;
- other_test_messages = temp_context;
- }
-#endif
-
- if (dotOutFile != NULL)
- {
- if (distance == 1)
- FPRINTF (dotOutFile, "\tn%s -- n%s;\n", d->shortname, second_shortname);
- else if (distance == 2)
- FPRINTF (dotOutFile, "\tn%s -- n%s [color=blue];\n", d->shortname,
- second_shortname);
- else if (distance == 3)
- FPRINTF (dotOutFile, "\tn%s -- n%s [color=red];\n", d->shortname,
- second_shortname);
- else if (distance == 4)
- FPRINTF (dotOutFile, "\tn%s -- n%s [color=green];\n", d->shortname,
- second_shortname);
- else
- FPRINTF (dotOutFile, "\tn%s -- n%s [color=brown];\n", d->shortname,
- second_shortname);
- }
- GNUNET_free (second_shortname);
-
- if (temp_total_other_messages == num_additional_messages)
- {
- /* FIXME: ret value!? */ GNUNET_SCHEDULER_add_now (&send_other_messages,
- NULL);
- }
-}
-
-static void
-peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id,
- const struct GNUNET_CONFIGURATION_Handle *cfg,
- struct GNUNET_TESTING_Daemon *d, const char *emsg)
-{
- struct PeerContext *new_peer;
-
- if (emsg != NULL)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Failed to start daemon with error: `%s'\n", emsg);
- return;
- }
- GNUNET_assert (id != NULL);
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Started daemon %llu out of %llu\n",
- (num_peers - peers_left) + 1, num_peers);
-#endif
- GNUNET_assert (GNUNET_SYSERR !=
- GNUNET_CONTAINER_multihashmap_put (peer_daemon_hash,
- &id->hashPubKey, d,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
-
- new_peer = GNUNET_malloc (sizeof (struct PeerContext));
- new_peer->peer_handle =
- GNUNET_CORE_connect (cfg, 1, d, NULL, &all_connect_handler, NULL, NULL,
- GNUNET_NO, NULL, GNUNET_NO, no_handlers);
- new_peer->daemon = d;
- new_peer->next = all_peers;
- all_peers = new_peer;
- peers_left--;
-
- if (peers_left == 0)
- {
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "All %d daemons started, now creating topology!\n", num_peers);
-#endif
- GNUNET_SCHEDULER_cancel (die_task);
- die_task = GNUNET_SCHEDULER_NO_TASK;
- expected_connections = -1;
- if ((pg != NULL) && (peers_left == 0))
- {
- expected_connections =
- GNUNET_TESTING_connect_topology (pg, connection_topology,
- connect_topology_option,
- connect_topology_option_modifier,
- TIMEOUT, 12, NULL, NULL);
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Have %d expected connections\n",
- expected_connections);
-#endif
- }
-
- if (expected_connections == GNUNET_SYSERR)
- {
- die_task =
- GNUNET_SCHEDULER_add_now (&end_badly,
- "from connect topology (bad return)");
- }
- else
- {
- /* Set up task in case topology creation doesn't finish
- * within a reasonable amount of time */
- die_task =
- GNUNET_SCHEDULER_add_delayed (TEST_TIMEOUT, &end_badly,
- "from connect topology (timeout)");
- }
- ok = 0;
- }
-}
-
-/**
- * Callback indicating that the hostkey was created for a peer.
- *
- * @param cls NULL
- * @param id the peer identity
- * @param d the daemon handle (pretty useless at this point, remove?)
- * @param emsg non-null on failure
- */
-static void
-hostkey_callback (void *cls, const struct GNUNET_PeerIdentity *id,
- struct GNUNET_TESTING_Daemon *d, const char *emsg)
-{
- if (emsg != NULL)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Hostkey callback received error: %s\n", emsg);
- }
-
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Hostkey created for peer `%s'\n",
- GNUNET_i2s (id));
-#endif
- peers_left--;
- if (peers_left == 0)
- {
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "All %d hostkeys created, now creating topology!\n", num_peers);
-#endif
- if (GNUNET_SCHEDULER_NO_TASK != die_task)
- {
- GNUNET_SCHEDULER_cancel (die_task);
- die_task = GNUNET_SCHEDULER_NO_TASK;
- }
- /* create topology */
- peers_left = num_peers; /* Reset counter */
- if (GNUNET_TESTING_create_topology
- (pg, topology, blacklist_topology,
- blacklist_transports) != GNUNET_SYSERR)
- {
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Topology set up, now starting peers!\n");
-#endif
- GNUNET_TESTING_daemons_continue_startup (pg);
- /* Set up task in case topology creation doesn't finish
- * within a reasonable amount of time */
- die_task =
- GNUNET_SCHEDULER_add_delayed (TEST_TIMEOUT, &end_badly,
- "from continue startup (timeout)");
- }
- else
- {
- die_task =
- GNUNET_SCHEDULER_add_now (&end_badly,
- "from create topology (bad return)");
- }
- ok = 0;
- }
-}
-
-static void
-run (void *cls, char *const *args, const char *cfgfile,
- const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
- char *topology_str;
- char *connect_topology_str;
- char *blacklist_topology_str;
- char *connect_topology_option_str;
- char *connect_topology_option_modifier_string;
-
- ok = 1;
-
- dotOutFile = fopen (dotOutFileName, "w");
- if (dotOutFile != NULL)
- {
- FPRINTF (dotOutFile, "%s", "strict graph G {\n");
- }
-
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Starting daemons based on config file %s\n", cfgfile);
-#endif
-
- if (GNUNET_YES !=
- GNUNET_CONFIGURATION_get_value_string (cfg, "paths", "servicehome",
- &test_directory))
- {
- ok = 404;
- return;
- }
-
- if ((GNUNET_YES ==
- GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "topology",
- &topology_str)) &&
- (GNUNET_NO == GNUNET_TESTING_topology_get (&topology, topology_str)))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Invalid topology `%s' given for section %s option %s\n",
- topology_str, "TESTING", "TOPOLOGY");
- topology = GNUNET_TESTING_TOPOLOGY_CLIQUE; /* Defaults to NONE, so set better default here */
- }
-
- if ((GNUNET_YES ==
- GNUNET_CONFIGURATION_get_value_string (cfg, "testing",
- "connect_topology",
- &connect_topology_str)) &&
- (GNUNET_NO ==
- GNUNET_TESTING_topology_get (&connection_topology,
- connect_topology_str)))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Invalid connect topology `%s' given for section %s option %s\n",
- connect_topology_str, "TESTING", "CONNECT_TOPOLOGY");
- }
- GNUNET_free_non_null (connect_topology_str);
- if ((GNUNET_YES ==
- GNUNET_CONFIGURATION_get_value_string (cfg, "testing",
- "connect_topology_option",
- &connect_topology_option_str)) &&
- (GNUNET_NO ==
- GNUNET_TESTING_topology_option_get (&connect_topology_option,
- connect_topology_option_str)))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Invalid connect topology option `%s' given for section %s option %s\n",
- connect_topology_option_str, "TESTING",
- "CONNECT_TOPOLOGY_OPTION");
- connect_topology_option = GNUNET_TESTING_TOPOLOGY_OPTION_ALL; /* Defaults to NONE, set to ALL */
- }
- GNUNET_free_non_null (connect_topology_option_str);
- if (GNUNET_YES ==
- GNUNET_CONFIGURATION_get_value_string (cfg, "testing",
- "connect_topology_option_modifier",
- &connect_topology_option_modifier_string))
- {
- if (SSCANF
- (connect_topology_option_modifier_string, "%lf",
- &connect_topology_option_modifier) != 1)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _
- ("Invalid value `%s' for option `%s' in section `%s': expected float\n"),
- connect_topology_option_modifier_string,
- "connect_topology_option_modifier", "TESTING");
- }
- GNUNET_free (connect_topology_option_modifier_string);
- }
-
- if (GNUNET_YES !=
- GNUNET_CONFIGURATION_get_value_string (cfg, "testing",
- "blacklist_transports",
- &blacklist_transports))
- blacklist_transports = NULL;
-
- if ((GNUNET_YES ==
- GNUNET_CONFIGURATION_get_value_string (cfg, "testing",
- "blacklist_topology",
- &blacklist_topology_str)) &&
- (GNUNET_NO ==
- GNUNET_TESTING_topology_get (&blacklist_topology,
- blacklist_topology_str)))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Invalid topology `%s' given for section %s option %s\n",
- topology_str, "TESTING", "BLACKLIST_TOPOLOGY");
- }
- GNUNET_free_non_null (topology_str);
- GNUNET_free_non_null (blacklist_topology_str);
- if (GNUNET_SYSERR ==
- GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "num_peers",
- &num_peers))
- num_peers = DEFAULT_NUM_PEERS;
-
- if (GNUNET_SYSERR ==
- GNUNET_CONFIGURATION_get_value_number (cfg, "testing",
- "additional_messages",
- &num_additional_messages))
- num_additional_messages = DEFAULT_ADDITIONAL_MESSAGES;
-
- main_cfg = cfg;
-
- GNUNET_assert (num_peers > 0 && num_peers < (unsigned int) -1);
- peers_left = num_peers;
-
- /* Set up a task to end testing if peer start fails */
- die_task =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_MINUTES, 5), &end_badly,
- "didn't start all daemons in reasonable amount of time!!!");
-
- peer_daemon_hash = GNUNET_CONTAINER_multihashmap_create (peers_left);
- pg = GNUNET_TESTING_daemons_start (cfg, peers_left, /* Total number of peers */
- peers_left, /* Number of outstanding connections */
- peers_left, /* Number of parallel ssh connections, or peers being started at once */
- TIMEOUT, &hostkey_callback, NULL,
- &peers_started_callback, NULL,
- &topology_callback, NULL, NULL);
-
-}
-
-static int
-check ()
-{
- int ret;
-
- char *const argv[] = { "test-transport-dv",
- "-c",
- "test_transport_dv_data.conf",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
- NULL
- };
- struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_OPTION_END
- };
- ret =
- GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
- "test-transport-dv", "nohelp", options, &run, &ok);
- if (ret != GNUNET_OK)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "`test-transport-dv': Failed with error code %d\n", ret);
- }
- return ok;
-}
-
-int
-main (int argc, char *argv[])
-{
- int ret;
-
- GNUNET_log_setup ("test-transport-dv",
-#if VERBOSE
- "DEBUG",
-#else
- "WARNING",
-#endif
- NULL);
- ret = check ();
- /**
- * Need to remove base directory, subdirectories taken care
- * of by the testing framework.
- */
- if (GNUNET_DISK_directory_remove (test_directory) != GNUNET_OK)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Failed to remove testing directory %s\n", test_directory);
- }
- return ret;
-}
-
-/* end of test_transport_api_dv.c */
diff --git a/src/dv/test_transport_dv_data.conf b/src/dv/test_transport_dv_data.conf
index 80eb873..8232461 100644
--- a/src/dv/test_transport_dv_data.conf
+++ b/src/dv/test_transport_dv_data.conf
@@ -1,12 +1,10 @@
[PATHS]
SERVICEHOME = /tmp/test-gnunet-dv-testing/
-DEFAULTCONFIG = test_transport_dv_data.conf
[resolver]
PORT = 2564
[transport]
-DEBUG = YES
PORT = 2565
PLUGINS = tcp dv
BLACKLIST_FILE = $SERVICEHOME/blacklist
@@ -35,11 +33,9 @@ PORT = 2570
[dv]
AUTOSTART = YES
-DEBUG = NO
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
BINARY = gnunet-service-dv
-CONFIG = $DEFAULTCONFIG
HOME = $SERVICEHOME
HOSTNAME = localhost
PORT = 2571
@@ -47,14 +43,13 @@ PORT = 2571
[testing]
NUM_PEERS = 3
ADDITIONAL_MESSAGES = 10
-DEBUG = NO
WEAKRANDOM = YES
TOPOLOGY = CLIQUE
CONNECT_TOPOLOGY = LINE
BLACKLIST_TOPOLOGY = LINE
BLACKLIST_TRANSPORTS = tcp
F2F = YES
-HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat
+HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat
[fs]
AUTOSTART = NO