From 2b81464a43485fcc8ce079fafdee7b7a171835f4 Mon Sep 17 00:00:00 2001 From: Bertrand Marc Date: Wed, 2 May 2012 21:43:37 +0200 Subject: Imported Upstream version 0.9.2 --- src/nse/Makefile.am | 90 +++ src/nse/Makefile.in | 939 +++++++++++++++++++++++++ src/nse/gnunet-nse-profiler.c | 934 +++++++++++++++++++++++++ src/nse/gnunet-service-nse.c | 1497 ++++++++++++++++++++++++++++++++++++++++ src/nse/nse.conf.in | 25 + src/nse/nse.h | 78 +++ src/nse/nse_api.c | 298 ++++++++ src/nse/nse_profiler_test.conf | 170 +++++ src/nse/test_nse.conf | 77 +++ src/nse/test_nse_api.c | 187 +++++ src/nse/test_nse_multipeer.c | 275 ++++++++ 11 files changed, 4570 insertions(+) create mode 100644 src/nse/Makefile.am create mode 100644 src/nse/Makefile.in create mode 100644 src/nse/gnunet-nse-profiler.c create mode 100644 src/nse/gnunet-service-nse.c create mode 100644 src/nse/nse.conf.in create mode 100644 src/nse/nse.h create mode 100644 src/nse/nse_api.c create mode 100644 src/nse/nse_profiler_test.conf create mode 100644 src/nse/test_nse.conf create mode 100644 src/nse/test_nse_api.c create mode 100644 src/nse/test_nse_multipeer.c (limited to 'src/nse') diff --git a/src/nse/Makefile.am b/src/nse/Makefile.am new file mode 100644 index 0000000..054a776 --- /dev/null +++ b/src/nse/Makefile.am @@ -0,0 +1,90 @@ +INCLUDES = -I$(top_srcdir)/src/include + +if MINGW + WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols +endif + +if USE_COVERAGE + AM_CFLAGS = --coverage -O0 + XLIB = -lgcov +endif + +pkgcfgdir= $(pkgdatadir)/config.d/ + +pkgcfg_DATA = \ + nse.conf + + +lib_LTLIBRARIES = libgnunetnse.la + +libgnunetnse_la_SOURCES = \ + nse_api.c nse.h +libgnunetnse_la_LIBADD = \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(GN_LIBINTL) $(XLIB) +libgnunetnse_la_LDFLAGS = \ + $(GN_LIB_LDFLAGS) $(WINFLAGS) \ + -version-info 0:0:0 + + +bin_PROGRAMS = \ + gnunet-service-nse + +noinst_PROGRAMS = \ + gnunet-nse-profiler + +gnunet_nse_profiler_SOURCES = \ + gnunet-nse-profiler.c +gnunet_nse_profiler_LDADD = -lm \ + $(top_builddir)/src/nse/libgnunetnse.la \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/statistics/libgnunetstatistics.la \ + $(top_builddir)/src/testing/libgnunettesting.la \ + $(GN_LIBINTL) +gnunet_nse_profiler_DEPENDENCIES = \ + libgnunetnse.la + +gnunet_service_nse_SOURCES = \ + gnunet-service-nse.c +gnunet_service_nse_LDADD = \ + $(top_builddir)/src/nse/libgnunetnse.la \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/core/libgnunetcore.la \ + $(top_builddir)/src/statistics/libgnunetstatistics.la \ + -lm \ + $(GN_LIBINTL) +gnunet_service_nse_DEPENDENCIES = \ + libgnunetnse.la + +if HAVE_BENCHMARKS + MULTIPEER_TEST = test_nse_multipeer +endif + +check_PROGRAMS = \ + test_nse_api \ + $(MULTIPEER_TEST) + + +if ENABLE_TEST_RUN +TESTS = $(check_PROGRAMS) +endif + +test_nse_api_SOURCES = \ + test_nse_api.c +test_nse_api_LDADD = \ + $(top_builddir)/src/nse/libgnunetnse.la \ + $(top_builddir)/src/util/libgnunetutil.la + +test_nse_multipeer_SOURCES = \ + test_nse_multipeer.c +test_nse_multipeer_LDADD = \ + $(top_builddir)/src/nse/libgnunetnse.la \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/testing/libgnunettesting.la \ + -lm + +EXTRA_DIST = \ + test_nse.conf \ + nse_profiler_test.conf + + diff --git a/src/nse/Makefile.in b/src/nse/Makefile.in new file mode 100644 index 0000000..7c03cbe --- /dev/null +++ b/src/nse/Makefile.in @@ -0,0 +1,939 @@ +# Makefile.in generated by automake 1.11.1 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. +# 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. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +bin_PROGRAMS = gnunet-service-nse$(EXEEXT) +noinst_PROGRAMS = gnunet-nse-profiler$(EXEEXT) +check_PROGRAMS = test_nse_api$(EXEEXT) $(am__EXEEXT_1) +subdir = src/nse +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/nse.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/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/gnunet_config.h +CONFIG_CLEAN_FILES = nse.conf +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ + "$(DESTDIR)$(pkgcfgdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +libgnunetnse_la_DEPENDENCIES = \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_libgnunetnse_la_OBJECTS = nse_api.lo +libgnunetnse_la_OBJECTS = $(am_libgnunetnse_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libgnunetnse_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(libgnunetnse_la_LDFLAGS) $(LDFLAGS) \ + -o $@ +@HAVE_BENCHMARKS_TRUE@am__EXEEXT_1 = test_nse_multipeer$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) +am_gnunet_nse_profiler_OBJECTS = gnunet-nse-profiler.$(OBJEXT) +gnunet_nse_profiler_OBJECTS = $(am_gnunet_nse_profiler_OBJECTS) +am_gnunet_service_nse_OBJECTS = gnunet-service-nse.$(OBJEXT) +gnunet_service_nse_OBJECTS = $(am_gnunet_service_nse_OBJECTS) +am_test_nse_api_OBJECTS = test_nse_api.$(OBJEXT) +test_nse_api_OBJECTS = $(am_test_nse_api_OBJECTS) +test_nse_api_DEPENDENCIES = $(top_builddir)/src/nse/libgnunetnse.la \ + $(top_builddir)/src/util/libgnunetutil.la +am_test_nse_multipeer_OBJECTS = test_nse_multipeer.$(OBJEXT) +test_nse_multipeer_OBJECTS = $(am_test_nse_multipeer_OBJECTS) +test_nse_multipeer_DEPENDENCIES = \ + $(top_builddir)/src/nse/libgnunetnse.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 +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +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_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +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_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libgnunetnse_la_SOURCES) $(gnunet_nse_profiler_SOURCES) \ + $(gnunet_service_nse_SOURCES) $(test_nse_api_SOURCES) \ + $(test_nse_multipeer_SOURCES) +DIST_SOURCES = $(libgnunetnse_la_SOURCES) \ + $(gnunet_nse_profiler_SOURCES) $(gnunet_service_nse_SOURCES) \ + $(test_nse_api_SOURCES) $(test_nse_multipeer_SOURCES) +DATA = $(pkgcfg_DATA) +ETAGS = etags +CTAGS = ctags +am__tty_colors = \ +red=; grn=; lgn=; blu=; std= +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +ARGZ_H = @ARGZ_H@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFAULT_INTERFACE = @DEFAULT_INTERFACE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLDIR = @DLLDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +EXT_LIBS = @EXT_LIBS@ +EXT_LIB_PATH = @EXT_LIB_PATH@ +FGREP = @FGREP@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GNUNETDNS_GROUP = @GNUNETDNS_GROUP@ +GN_DAEMON_CONFIG_DIR = @GN_DAEMON_CONFIG_DIR@ +GN_DAEMON_HOME_DIR = @GN_DAEMON_HOME_DIR@ +GN_INTLINCL = @GN_INTLINCL@ +GN_LIBINTL = @GN_LIBINTL@ +GN_LIB_LDFLAGS = @GN_LIB_LDFLAGS@ +GN_PLUGIN_LDFLAGS = @GN_PLUGIN_LDFLAGS@ +GN_USER_HOME_DIR = @GN_USER_HOME_DIR@ +GREP = @GREP@ +HAVE_LIBUNISTRING = @HAVE_LIBUNISTRING@ +INCLTDL = @INCLTDL@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBADD_DL = @LIBADD_DL@ +LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ +LIBADD_DLOPEN = @LIBADD_DLOPEN@ +LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ +LIBCURL = @LIBCURL@ +LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBLTDL = @LIBLTDL@ +LIBOBJS = @LIBOBJS@ +LIBPREFIX = @LIBPREFIX@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBUNISTRING = @LIBUNISTRING@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTDLDEPS = @LTDLDEPS@ +LTDLINCL = @LTDLINCL@ +LTDLOPEN = @LTDLOPEN@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +LTLIBUNISTRING = @LTLIBUNISTRING@ +LT_CONFIG_H = @LT_CONFIG_H@ +LT_DLLOADERS = @LT_DLLOADERS@ +LT_DLPREOPEN = @LT_DLPREOPEN@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +MYSQL_CPPFLAGS = @MYSQL_CPPFLAGS@ +MYSQL_LDFLAGS = @MYSQL_LDFLAGS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSTGRES_CPPFLAGS = @POSTGRES_CPPFLAGS@ +POSTGRES_LDFLAGS = @POSTGRES_LDFLAGS@ +POSUB = @POSUB@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SQLITE_CPPFLAGS = @SQLITE_CPPFLAGS@ +SQLITE_LDFLAGS = @SQLITE_LDFLAGS@ +STRIP = @STRIP@ +SUDO_BINARY = @SUDO_BINARY@ +UNIXONLY = @UNIXONLY@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XMKMF = @XMKMF@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +_libcurl_config = @_libcurl_config@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_target = @build_target@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +ltdl_LIBOBJS = @ltdl_LIBOBJS@ +ltdl_LTLIBOBJS = @ltdl_LTLIBOBJS@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +subdirs = @subdirs@ +sys_symbol_underscore = @sys_symbol_underscore@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +INCLUDES = -I$(top_srcdir)/src/include +@MINGW_TRUE@WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols +@USE_COVERAGE_TRUE@AM_CFLAGS = --coverage -O0 +@USE_COVERAGE_TRUE@XLIB = -lgcov +pkgcfgdir = $(pkgdatadir)/config.d/ +pkgcfg_DATA = \ + nse.conf + +lib_LTLIBRARIES = libgnunetnse.la +libgnunetnse_la_SOURCES = \ + nse_api.c nse.h + +libgnunetnse_la_LIBADD = \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(GN_LIBINTL) $(XLIB) + +libgnunetnse_la_LDFLAGS = \ + $(GN_LIB_LDFLAGS) $(WINFLAGS) \ + -version-info 0:0:0 + +gnunet_nse_profiler_SOURCES = \ + gnunet-nse-profiler.c + +gnunet_nse_profiler_LDADD = -lm \ + $(top_builddir)/src/nse/libgnunetnse.la \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/statistics/libgnunetstatistics.la \ + $(top_builddir)/src/testing/libgnunettesting.la \ + $(GN_LIBINTL) + +gnunet_nse_profiler_DEPENDENCIES = \ + libgnunetnse.la + +gnunet_service_nse_SOURCES = \ + gnunet-service-nse.c + +gnunet_service_nse_LDADD = \ + $(top_builddir)/src/nse/libgnunetnse.la \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/core/libgnunetcore.la \ + $(top_builddir)/src/statistics/libgnunetstatistics.la \ + -lm \ + $(GN_LIBINTL) + +gnunet_service_nse_DEPENDENCIES = \ + libgnunetnse.la + +@HAVE_BENCHMARKS_TRUE@MULTIPEER_TEST = test_nse_multipeer +@ENABLE_TEST_RUN_TRUE@TESTS = $(check_PROGRAMS) +test_nse_api_SOURCES = \ + test_nse_api.c + +test_nse_api_LDADD = \ + $(top_builddir)/src/nse/libgnunetnse.la \ + $(top_builddir)/src/util/libgnunetutil.la + +test_nse_multipeer_SOURCES = \ + test_nse_multipeer.c + +test_nse_multipeer_LDADD = \ + $(top_builddir)/src/nse/libgnunetnse.la \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/testing/libgnunettesting.la \ + -lm + +EXTRA_DIST = \ + test_nse.conf \ + nse_profiler_test.conf + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/nse/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/nse/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +nse.conf: $(top_builddir)/config.status $(srcdir)/nse.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 \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + 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)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libgnunetnse.la: $(libgnunetnse_la_OBJECTS) $(libgnunetnse_la_DEPENDENCIES) + $(AM_V_CCLD)$(libgnunetnse_la_LINK) -rpath $(libdir) $(libgnunetnse_la_OBJECTS) $(libgnunetnse_la_LIBADD) $(LIBS) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + 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 $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || 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 + +clean-checkPROGRAMS: + @list='$(check_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 + +clean-noinstPROGRAMS: + @list='$(noinst_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-nse-profiler$(EXEEXT): $(gnunet_nse_profiler_OBJECTS) $(gnunet_nse_profiler_DEPENDENCIES) + @rm -f gnunet-nse-profiler$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gnunet_nse_profiler_OBJECTS) $(gnunet_nse_profiler_LDADD) $(LIBS) +gnunet-service-nse$(EXEEXT): $(gnunet_service_nse_OBJECTS) $(gnunet_service_nse_DEPENDENCIES) + @rm -f gnunet-service-nse$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gnunet_service_nse_OBJECTS) $(gnunet_service_nse_LDADD) $(LIBS) +test_nse_api$(EXEEXT): $(test_nse_api_OBJECTS) $(test_nse_api_DEPENDENCIES) + @rm -f test_nse_api$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_nse_api_OBJECTS) $(test_nse_api_LDADD) $(LIBS) +test_nse_multipeer$(EXEEXT): $(test_nse_multipeer_OBJECTS) $(test_nse_multipeer_DEPENDENCIES) + @rm -f test_nse_multipeer$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_nse_multipeer_OBJECTS) $(test_nse_multipeer_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnunet-nse-profiler.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnunet-service-nse.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nse_api.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_nse_api.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_nse_multipeer.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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +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=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgcfgdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgcfgdir)" || exit $$?; \ + done + +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 + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + echo "$$grn$$dashes"; \ + else \ + echo "$$red$$dashes"; \ + fi; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes$$std"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + 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)$(bindir)" "$(DESTDIR)$(pkgcfgdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-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 +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @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-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pkgcfgDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES \ + uninstall-pkgcfgDATA + +.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-noinstPROGRAMS 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 \ + 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-pkgcfgDATA + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c new file mode 100644 index 0000000..a10d237 --- /dev/null +++ b/src/nse/gnunet-nse-profiler.c @@ -0,0 +1,934 @@ +/* + This file is part of GNUnet. + (C) 2011 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 nse/gnunet-nse-profiler.c + * + * @brief Profiling driver for the network size estimation service. + * Generally, the profiler starts a given number of peers, + * then churns some off, waits a certain amount of time, then + * churns again, and repeats. + */ +#include "platform.h" +#include "gnunet_testing_lib.h" +#include "gnunet_nse_service.h" + +#define VERBOSE 3 + +struct NSEPeer +{ + struct NSEPeer *prev; + + struct NSEPeer *next; + + struct GNUNET_TESTING_Daemon *daemon; + + struct GNUNET_NSE_Handle *nse_handle; + + struct GNUNET_STATISTICS_Handle *stats; + + GNUNET_SCHEDULER_TaskIdentifier stats_task; +}; + + +struct StatsContext +{ + /** + * Whether or not shoutdown after finishing. + */ + int shutdown; + + /** + * How many messages have peers received during the test. + */ + unsigned long long total_nse_received_messages; + + /** + * How many messages have peers send during the test (should be == received). + */ + unsigned long long total_nse_transmitted_messages; + + /** + * How many messages have travelled an edge in both directions. + */ + unsigned long long total_nse_cross; + + /** + * How many extra messages per edge (corrections) have been received. + */ + unsigned long long total_nse_extra; + + /** + * How many messages have been discarded. + */ + unsigned long long total_discarded; +}; + + +static struct NSEPeer *peer_head; + +static struct NSEPeer *peer_tail; + +/** + * How long until we give up on connecting the peers? + */ +#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1500) + +static int ok; + +/** + * Be verbose + */ +static int verbose; + +/** + * Total number of peers in the test. + */ +static unsigned long long num_peers; + +/** + * Global configuration file + */ +static struct GNUNET_CONFIGURATION_Handle *testing_cfg; + +/** + * Total number of currently running peers. + */ +static unsigned long long peers_running; + +/** + * Current round we are in. + */ +static unsigned long long current_round; + +/** + * Peers desired in the next round. + */ +static unsigned long long peers_next_round; + +/** + * Maximum number of connections to NSE services. + */ +static unsigned long long connection_limit; + +/** + * Total number of connections in the whole network. + */ +static unsigned int total_connections; + +/** + * The currently running peer group. + */ +static struct GNUNET_TESTING_PeerGroup *pg; + +/** + * File to report results to. + */ +static struct GNUNET_DISK_FileHandle *output_file; + +/** + * File to log connection info, statistics to. + */ +static struct GNUNET_DISK_FileHandle *data_file; + +/** + * How many data points to capture before triggering next round? + */ +static struct GNUNET_TIME_Relative wait_time; + +/** + * NSE interval. + */ +static struct GNUNET_TIME_Relative interval; + +/** + * Task called to disconnect peers. + */ +static GNUNET_SCHEDULER_TaskIdentifier disconnect_task; + +/** + * Task called to shutdown test. + */ +static GNUNET_SCHEDULER_TaskIdentifier shutdown_handle; + +/** + * Task used to churn the network. + */ +static GNUNET_SCHEDULER_TaskIdentifier churn_task; + +static char *topology_file; + +/** + * Check whether peers successfully shut down. + */ +static 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 + ok = 0; + } +} + + +static void +shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +{ + struct NSEPeer *pos; + +#if VERBOSE + FPRINTF (stderr, "%s", "Ending test.\n"); +#endif + + if (disconnect_task != GNUNET_SCHEDULER_NO_TASK) + { + GNUNET_SCHEDULER_cancel (disconnect_task); + disconnect_task = GNUNET_SCHEDULER_NO_TASK; + } + while (NULL != (pos = peer_head)) + { + if (pos->nse_handle != NULL) + GNUNET_NSE_disconnect (pos->nse_handle); + GNUNET_CONTAINER_DLL_remove (peer_head, peer_tail, pos); + if (GNUNET_SCHEDULER_NO_TASK != pos->stats_task) + { + GNUNET_SCHEDULER_cancel (pos->stats_task); + if (NULL != pos->stats) + GNUNET_STATISTICS_destroy(pos->stats, GNUNET_NO); + } + GNUNET_free (pos); + } + + if (data_file != NULL) + GNUNET_DISK_file_close (data_file); + GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); +} + + +/** + * Callback to call when network size estimate is updated. + * + * @param cls closure + * @param timestamp server timestamp + * @param estimate the value of the current network size estimate + * @param std_dev standard deviation (rounded down to nearest integer) + * of the size estimation values seen + * + */ +static void +handle_estimate (void *cls, struct GNUNET_TIME_Absolute timestamp, + double estimate, double std_dev) +{ + struct NSEPeer *peer = cls; + char *output_buffer; + size_t size; + + if (output_file != NULL) + { + size = + GNUNET_asprintf (&output_buffer, "%s %llu %llu %f %f %f\n", + GNUNET_i2s (&peer->daemon->id), peers_running, + timestamp.abs_value, + GNUNET_NSE_log_estimate_to_n (estimate), estimate, + std_dev); + if (size != GNUNET_DISK_file_write (output_file, output_buffer, size)) + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n"); + GNUNET_free (output_buffer); + } + else + FPRINTF (stderr, + "Received network size estimate from peer %s. Size: %f std.dev. %f\n", + GNUNET_i2s (&peer->daemon->id), estimate, std_dev); + +} + +/** + * Process core statistic values. + * + * @param cls closure + * @param subsystem name of subsystem that created the statistic + * @param name the name of the datum + * @param value the current value + * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not + * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration + */ +static int +core_stats_iterator (void *cls, const char *subsystem, const char *name, + uint64_t value, int is_persistent) +{ + struct NSEPeer *peer = cls; + char *output_buffer; + size_t size; + + if (output_file != NULL) + { + size = + GNUNET_asprintf (&output_buffer, "%s [%s] %s %llu\n", + GNUNET_i2s (&peer->daemon->id), + subsystem, name, value); + if (size != GNUNET_DISK_file_write (output_file, output_buffer, size)) + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n"); + GNUNET_free (output_buffer); + } + else + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "%s -> %s [%s]: %llu\n", + GNUNET_i2s (&peer->daemon->id), subsystem, name, value); + + return GNUNET_OK; +} + +/** + * Continuation called by "get_stats" function. + * + * @param cls closure + * @param success GNUNET_OK if statistics were + * successfully obtained, GNUNET_SYSERR if not. + */ +static void +core_stats_cont (void *cls, int success); + +static void +core_get_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +{ + struct NSEPeer *peer = cls; + + if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) + { + GNUNET_STATISTICS_destroy(peer->stats, GNUNET_NO); + peer->stats = NULL; + return; + } + else + { + GNUNET_STATISTICS_get(peer->stats, "core", NULL, + GNUNET_TIME_UNIT_FOREVER_REL, + &core_stats_cont, &core_stats_iterator, peer); + GNUNET_STATISTICS_get(peer->stats, "transport", NULL, + GNUNET_TIME_UNIT_FOREVER_REL, + NULL, &core_stats_iterator, peer); + GNUNET_STATISTICS_get(peer->stats, "nse", NULL, + GNUNET_TIME_UNIT_FOREVER_REL, + NULL, &core_stats_iterator, peer); + } + peer->stats_task = GNUNET_SCHEDULER_NO_TASK; +} + +/** + * Continuation called by "get_stats" function. + * + * @param cls closure + * @param success GNUNET_OK if statistics were + * successfully obtained, GNUNET_SYSERR if not. + */ +static void +core_stats_cont (void *cls, int success) +{ + struct NSEPeer *peer = cls; + peer->stats_task = GNUNET_SCHEDULER_add_delayed (interval, &core_get_stats, + peer); +} + + +/** + * + */ +static void +connect_nse_service (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +{ + struct NSEPeer *current_peer; + unsigned int i; + +#if VERBOSE + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to nse service of peers\n"); +#endif + for (i = 0; i < num_peers; i++) + { + if ((connection_limit > 0) && (i % (num_peers / connection_limit) != 0)) + continue; +#if VERBOSE + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "nse-profiler: connecting to nse service of peer %d\n", i); +#endif + current_peer = GNUNET_malloc (sizeof (struct NSEPeer)); + current_peer->daemon = GNUNET_TESTING_daemon_get (pg, i); + if (GNUNET_YES == + GNUNET_TESTING_test_daemon_running (GNUNET_TESTING_daemon_get (pg, i))) + { + current_peer->nse_handle = + GNUNET_NSE_connect (current_peer->daemon->cfg, &handle_estimate, + current_peer); + GNUNET_assert (current_peer->nse_handle != NULL); + } + current_peer->stats = GNUNET_STATISTICS_create("profiler", current_peer->daemon->cfg); + GNUNET_STATISTICS_get(current_peer->stats, "core", NULL, + GNUNET_TIME_UNIT_FOREVER_REL, + &core_stats_cont, &core_stats_iterator, current_peer); + GNUNET_STATISTICS_get(current_peer->stats, "transport", NULL, + GNUNET_TIME_UNIT_FOREVER_REL, + NULL, &core_stats_iterator, current_peer); + GNUNET_STATISTICS_get(current_peer->stats, "nse", NULL, + GNUNET_TIME_UNIT_FOREVER_REL, + NULL, &core_stats_iterator, current_peer); + GNUNET_CONTAINER_DLL_insert (peer_head, peer_tail, current_peer); + } +} + + +static void +churn_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); + + +/** + * Continuation called by the "get_all" and "get" functions. + * + * @param cls struct StatsContext + * @param success GNUNET_OK if statistics were + * successfully obtained, GNUNET_SYSERR if not. + */ +static void +stats_finished_callback (void *cls, int success) +{ + struct StatsContext *stats_context = cls; + char *buf; + int buf_len; + + if ((GNUNET_OK == success) && (data_file != NULL)) + { + /* Stats lookup successful, write out data */ + buf = NULL; + buf_len = + GNUNET_asprintf (&buf, "TOTAL_NSE_RECEIVED_MESSAGES_%d: %u \n", + stats_context->shutdown, + stats_context->total_nse_received_messages); + if (buf_len > 0) + { + GNUNET_DISK_file_write (data_file, buf, buf_len); + } + GNUNET_free_non_null (buf); + + buf = NULL; + buf_len = + GNUNET_asprintf (&buf, "TOTAL_NSE_TRANSMITTED_MESSAGES_%d: %u\n", + stats_context->shutdown, + stats_context->total_nse_transmitted_messages); + if (buf_len > 0) + { + GNUNET_DISK_file_write (data_file, buf, buf_len); + } + GNUNET_free_non_null (buf); + + buf = NULL; + buf_len = + GNUNET_asprintf (&buf, "TOTAL_NSE_CROSS_%d: %u \n", + stats_context->shutdown, + stats_context->total_nse_cross); + if (buf_len > 0) + { + GNUNET_DISK_file_write (data_file, buf, buf_len); + } + GNUNET_free_non_null (buf); + + buf = NULL; + buf_len = + GNUNET_asprintf (&buf, "TOTAL_NSE_EXTRA_%d: %u \n", + stats_context->shutdown, + stats_context->total_nse_extra); + if (buf_len > 0) + { + GNUNET_DISK_file_write (data_file, buf, buf_len); + } + GNUNET_free_non_null (buf); + + buf = NULL; + buf_len = + GNUNET_asprintf (&buf, "TOTAL_NSE_DISCARDED_%d: %u \n", + stats_context->shutdown, + stats_context->total_discarded); + if (buf_len > 0) + { + GNUNET_DISK_file_write (data_file, buf, buf_len); + } + GNUNET_free_non_null (buf); + + } + + if (GNUNET_YES == stats_context->shutdown) + { + GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == shutdown_handle); + shutdown_handle = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); + } + else + { + GNUNET_assert (churn_task == GNUNET_SCHEDULER_NO_TASK); + churn_task = GNUNET_SCHEDULER_add_now (&churn_peers, NULL); + } + GNUNET_free (stats_context); +} + + +/** + * Callback function to process statistic values. + * + * @param cls struct StatsContext + * @param peer the peer the statistics belong to + * @param subsystem name of subsystem that created the statistic + * @param name the name of the datum + * @param value the current value + * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not + * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration + */ +static int +statistics_iterator (void *cls, const struct GNUNET_PeerIdentity *peer, + const char *subsystem, const char *name, uint64_t value, + int is_persistent) +{ + struct StatsContext *stats_context = cls; + + if (0 == strcmp (subsystem, "nse")) + { + if (0 == strcmp (name, "# flood messages received")) + { + stats_context->total_nse_received_messages += value; +#if VERBOSE + if (data_file != NULL) + { + char *buf; + int buf_len; + + buf = NULL; + buf_len = + GNUNET_asprintf (&buf, "%s %u RECEIVED\n", GNUNET_i2s(peer), value); + if (buf_len > 0) + { + GNUNET_DISK_file_write (data_file, buf, buf_len); + } + GNUNET_free_non_null (buf); + } +#endif + } + if (0 == strcmp (name, "# flood messages transmitted")) + { + stats_context->total_nse_transmitted_messages += value; +#if VERBOSE + if (data_file != NULL) + { + char *buf; + int buf_len; + + buf = NULL; + buf_len = + GNUNET_asprintf (&buf, "%s %u TRANSMITTED\n", + GNUNET_i2s(peer), value); + if (buf_len > 0) + { + GNUNET_DISK_file_write (data_file, buf, buf_len); + } + GNUNET_free_non_null (buf); + } +#endif + } + if (0 == strcmp (name, "# cross messages")) + { + stats_context->total_nse_cross += value; + } + if (0 == strcmp (name, "# extra messages")) + { + stats_context->total_nse_extra += value; + } + if (0 == strcmp (name, "# flood messages discarded (clock skew too large)")) + { + stats_context->total_discarded += value; + } + } + return GNUNET_OK; +} + + +static void +disconnect_nse_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +{ + struct NSEPeer *pos; + char *buf; + struct StatsContext *stats_context; + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "disconnecting nse service of peers\n"); + disconnect_task = GNUNET_SCHEDULER_NO_TASK; + while (NULL != (pos = peer_head)) + { + if (pos->nse_handle != NULL) + { + GNUNET_NSE_disconnect (pos->nse_handle); + pos->nse_handle = NULL; + } + GNUNET_CONTAINER_DLL_remove (peer_head, peer_tail, pos); + if (NULL != pos->stats) + GNUNET_STATISTICS_destroy(pos->stats, GNUNET_NO); + if (GNUNET_SCHEDULER_NO_TASK != pos->stats_task) + GNUNET_SCHEDULER_cancel (pos->stats_task); + GNUNET_free (pos); + } + + GNUNET_asprintf (&buf, "round%llu", current_round); + if (GNUNET_OK == + GNUNET_CONFIGURATION_get_value_number (testing_cfg, "nse-profiler", buf, + &peers_next_round)) + { + current_round++; + if (current_round == 1) + { + stats_context = GNUNET_malloc (sizeof (struct StatsContext)); + stats_context->shutdown = GNUNET_NO; + GNUNET_TESTING_get_statistics (pg, &stats_finished_callback, + &statistics_iterator, stats_context); + } + else + { + GNUNET_assert (churn_task == GNUNET_SCHEDULER_NO_TASK); + churn_task = GNUNET_SCHEDULER_add_now (&churn_peers, NULL); + } + } + else /* No more rounds, let's shut it down! */ + { + stats_context = GNUNET_malloc (sizeof (struct StatsContext)); + stats_context->shutdown = GNUNET_YES; + GNUNET_SCHEDULER_cancel (shutdown_handle); + shutdown_handle = GNUNET_SCHEDULER_NO_TASK; + GNUNET_TESTING_get_statistics (pg, &stats_finished_callback, + &statistics_iterator, stats_context); + } + GNUNET_free (buf); +} + + +/** + * FIXME. + * + * @param cls unused + * @param emsg NULL on success + */ +static void +topology_output_callback (void *cls, const char *emsg) +{ + disconnect_task = + GNUNET_SCHEDULER_add_delayed (wait_time, &disconnect_nse_peers, NULL); + GNUNET_SCHEDULER_add_now (&connect_nse_service, NULL); +} + + +/** + * FIXME. + * + * @param cls closure + * @param emsg NULL on success + */ +static void +churn_callback (void *cls, const char *emsg) +{ + char *temp_output_file; + + if (emsg == NULL) /* Everything is okay! */ + { + peers_running = peers_next_round; + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Round %llu, churn finished successfully.\n", current_round); + GNUNET_assert (disconnect_task == GNUNET_SCHEDULER_NO_TASK); + GNUNET_asprintf (&temp_output_file, "%s_%llu.dot", topology_file, + current_round); + GNUNET_TESTING_peergroup_topology_to_file (pg, temp_output_file, + &topology_output_callback, NULL); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Writing topology to file %s\n", + temp_output_file); + GNUNET_free (temp_output_file); + } + else + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Round %llu, churn FAILED!!\n", + current_round); + GNUNET_SCHEDULER_cancel (shutdown_handle); + shutdown_handle = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); + } +} + + +static void +churn_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +{ + /* peers_running = GNUNET_TESTING_daemons_running(pg); */ + churn_task = GNUNET_SCHEDULER_NO_TASK; + if (peers_next_round == peers_running) + { + /* Nothing to do... */ + GNUNET_SCHEDULER_add_now (&connect_nse_service, NULL); + GNUNET_assert (disconnect_task == GNUNET_SCHEDULER_NO_TASK); + disconnect_task = + GNUNET_SCHEDULER_add_delayed (wait_time, &disconnect_nse_peers, NULL); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Round %lu, doing nothing!\n", + current_round); + } + else + { + if (peers_next_round > num_peers) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Asked to turn on more peers than we have!!\n"); + GNUNET_SCHEDULER_cancel (shutdown_handle); + GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); + } + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Round %llu, turning off %llu peers, turning on %llu peers!\n", + current_round, + (peers_running > + peers_next_round) ? peers_running - peers_next_round : 0, + (peers_next_round > + peers_running) ? peers_next_round - peers_running : 0); + GNUNET_TESTING_daemons_churn (pg, "nse", + (peers_running > + peers_next_round) ? peers_running - + peers_next_round : 0, + (peers_next_round > + peers_running) ? peers_next_round - + peers_running : 0, wait_time, &churn_callback, + NULL); + } +} + + +static void +nse_started_cb (void *cls, const char *emsg) +{ + GNUNET_SCHEDULER_add_now (&connect_nse_service, NULL); + disconnect_task = + GNUNET_SCHEDULER_add_delayed (wait_time, &disconnect_nse_peers, NULL); +} + + +static void +my_cb (void *cls, const char *emsg) +{ + char *buf; + int buf_len; + + if (emsg != NULL) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Peergroup callback called with error, aborting test!\n"); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Error from testing: `%s'\n"); + ok = 1; + GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); + return; + } +#if VERBOSE + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Peer Group started successfully, connecting to NSE service for each peer!\n"); +#endif + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Have %u connections\n", + total_connections); + if (data_file != NULL) + { + buf = NULL; + buf_len = GNUNET_asprintf (&buf, "CONNECTIONS_0: %u\n", total_connections); + if (buf_len > 0) + GNUNET_DISK_file_write (data_file, buf, buf_len); + GNUNET_free (buf); + } + peers_running = GNUNET_TESTING_daemons_running (pg); + GNUNET_TESTING_daemons_start_service (pg, "nse", wait_time, &nse_started_cb, + NULL); + +} + + +/** + * Function that will be called whenever two daemons are connected by + * the testing library. + * + * @param cls closure + * @param first peer id for first daemon + * @param second peer id for the second daemon + * @param distance distance between the connected peers + * @param first_cfg config for the first daemon + * @param second_cfg config for the second daemon + * @param first_daemon handle for the first daemon + * @param second_daemon handle for the second daemon + * @param emsg error message (NULL on success) + */ +static void +connect_cb (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) +{ + if (emsg == NULL) + total_connections++; +} + + +static void +run (void *cls, char *const *args, const char *cfgfile, + const struct GNUNET_CONFIGURATION_Handle *cfg) +{ + char *temp_str; + struct GNUNET_TESTING_Host *hosts; + char *data_filename; + + ok = 1; + //testing_cfg = GNUNET_CONFIGURATION_create (); + testing_cfg = GNUNET_CONFIGURATION_dup (cfg); +#if VERBOSE + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting daemons.\n"); + GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing", + "use_progressbars", "YES"); +#endif + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_number (testing_cfg, "testing", + "num_peers", &num_peers)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Option TESTING:NUM_PEERS is required!\n"); + return; + } + + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_time (testing_cfg, "nse-profiler", + "WAIT_TIME", &wait_time)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Option nse-profiler:wait_time is required!\n"); + return; + } + + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_time (testing_cfg, "nse", + "INTERVAL", &interval)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Option nse:interval is required!\n"); + return; + } + + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_number (testing_cfg, "nse-profiler", + "connection_limit", + &connection_limit)) + { + connection_limit = 0; + } + + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_string (testing_cfg, "nse-profiler", + "topology_output_file", + &topology_file)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Option nse-profiler:topology_output_file is required!\n"); + return; + } + + if (GNUNET_OK == + GNUNET_CONFIGURATION_get_value_string (testing_cfg, "nse-profiler", + "data_output_file", + &data_filename)) + { + data_file = + GNUNET_DISK_file_open (data_filename, + GNUNET_DISK_OPEN_READWRITE | + GNUNET_DISK_OPEN_TRUNCATE | + GNUNET_DISK_OPEN_CREATE, + GNUNET_DISK_PERM_USER_READ | + GNUNET_DISK_PERM_USER_WRITE); + if (data_file == NULL) + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to open %s for output!\n", + data_filename); + GNUNET_free (data_filename); + } + + if (GNUNET_YES == + GNUNET_CONFIGURATION_get_value_string (cfg, "nse-profiler", "output_file", + &temp_str)) + { + output_file = + GNUNET_DISK_file_open (temp_str, + GNUNET_DISK_OPEN_READWRITE | + GNUNET_DISK_OPEN_CREATE, + GNUNET_DISK_PERM_USER_READ | + GNUNET_DISK_PERM_USER_WRITE); + if (output_file == NULL) + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to open %s for output!\n", + temp_str); + } + GNUNET_free_non_null (temp_str); + + hosts = GNUNET_TESTING_hosts_load (testing_cfg); + + pg = GNUNET_TESTING_peergroup_start (testing_cfg, num_peers, TIMEOUT, + &connect_cb, &my_cb, NULL, hosts); + GNUNET_assert (pg != NULL); + shutdown_handle = + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_get_forever (), + &shutdown_task, NULL); +} + + + +/** + * nse-profiler command line options + */ +static struct GNUNET_GETOPT_CommandLineOption options[] = { + {'V', "verbose", NULL, + gettext_noop ("be verbose (print progress information)"), + 0, &GNUNET_GETOPT_set_one, &verbose}, + GNUNET_GETOPT_OPTION_END +}; + + +int +main (int argc, char *argv[]) +{ + GNUNET_log_setup ("nse-profiler", +#if VERBOSE + "DEBUG", +#else + "WARNING", +#endif + NULL); + GNUNET_PROGRAM_run (argc, argv, "nse-profiler", + gettext_noop + ("Measure quality and performance of the NSE service."), + options, &run, NULL); +#if REMOVE_DIR + GNUNET_DISK_directory_remove ("/tmp/nse-profiler"); +#endif + return ok; +} + +/* end of nse-profiler.c */ diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c new file mode 100644 index 0000000..3af9bb7 --- /dev/null +++ b/src/nse/gnunet-service-nse.c @@ -0,0 +1,1497 @@ +/* + This file is part of GNUnet. + (C) 2009, 2010, 2011 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