airplane hackery
authorChristian Grothoff <christian@grothoff.org>
Sun, 28 Jun 2009 17:08:07 +0000 (17:08 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 28 Jun 2009 17:08:07 +0000 (17:08 +0000)
20 files changed:
HACKING
contrib/defaults.conf
m4/argz.m4
m4/libtool.m4
m4/ltdl.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
src/datastore/Makefile.am
src/datastore/datastore_api.c
src/datastore/perf_datastore_api.c
src/datastore/perf_datastore_api_iterators.c
src/datastore/plugin_datastore_sqlite.c
src/datastore/test_datastore_api.c
src/include/gnunet_datastore_service.h
src/transport/plugin_transport_tcp.c
src/transport/test_transport_api_data.conf
src/transport/test_transport_api_peer1.conf
src/transport/test_transport_api_peer2.conf
src/util/disk.c

diff --git a/HACKING b/HACKING
index aa44285785dfe61f824ead0f1ad84c75324b01d3..142f83315bfd9be45683f575ad07820672887e89 100644 (file)
--- a/HACKING
+++ b/HACKING
@@ -13,6 +13,15 @@ include files:
   * gnunet_directories.h --- generated
   * gettext.h            --- external library
 
+configuration:
+- paths (that are substituted in all filenames) are in PATHS (have as few as possible)
+- globals for the daemon are in [gnunetd] (for now, have as few as possible!)
+- all options for a particular module (src/MODULE) are under [MODULE]
+- options for a plugin of a module are under [MODULE-PLUGINNAME]
+- options only for debugging / testing / profiling are under [TESTING],
+  together with the options for the testing module itself
+
+
 
 exported symbols:
 - must start with "GNUNET_modulename_" and be defined in "modulename.c"
index d3eb190fca8069bbaea4f57009021af868261f2f..0af2752fba8006f93aa1a52752791e0b55f0fe6e 100644 (file)
@@ -9,7 +9,7 @@ HOSTKEY = $SERVICEHOME/.hostkey
 WEAKRANDOM = NO
 
 
-[tcp]
+[transport-tcp]
 PORT = 2086
 TIMEOUT = 300000
 ALLOW_SHUTDOWN = NO
@@ -174,3 +174,6 @@ ALLOW_SHUTDOWN = YES
 QUOTA = 10000000
 BLOOMFILTER = $SERVICEHOME/fs/bloomfilter
 DATABASE = sqlite
+
+[datastore-sqlite]
+FILENAME = $SERVICEHOME/datastore/sqlite.db
index edc99bbce24acaa8f35b990630c34d2c070cf3b3..37c1b11e4b954d784dfc9662dbd3a71b6ead5b73 100644 (file)
@@ -28,14 +28,14 @@ ARGZ_H=
 AC_CHECK_FUNCS([argz_add argz_append argz_count argz_create_sep argz_insert \
        argz_next argz_stringify], [], [ARGZ_H=argz.h; AC_LIBOBJ([argz])])
 
-dnl if have system argz functions, allow forced use of 
+dnl if have system argz functions, allow forced use of
 dnl libltdl-supplied implementation (and default to do so
 dnl on "known bad" systems). Could use a runtime check, but
 dnl (a) detecting malloc issues is notoriously unreliable
 dnl (b) only known system that declares argz functions,
 dnl     provides them, yet they are broken, is cygwin
 dnl     releases prior to 16-Mar-2007 (1.5.24 and earlier)
-dnl So, it's more straightforward simply to special case 
+dnl So, it's more straightforward simply to special case
 dnl this for known bad systems.
 AS_IF([test -z "$ARGZ_H"],
     [AC_CACHE_CHECK(
index 6e86e5b43e2e90432f6690c6c59706daf8557075..1e7ea47c080122c2411d3b703333f404d19ff314 100644 (file)
@@ -380,12 +380,12 @@ m4_define([lt_decl_dquote_varnames],
 # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
 # ---------------------------------------------------
 m4_define([lt_decl_varnames_tagged],
-[_$0(m4_quote(m4_default([$1], [[, ]])),
-     m4_quote(m4_if([$2], [],
-                    m4_quote(lt_decl_tag_varnames),
-                 m4_quote(m4_shift($@)))),
-     m4_split(m4_normalize(m4_quote(_LT_TAGS))))])
-m4_define([_lt_decl_varnames_tagged], [lt_combine([$1], [$2], [_], $3)])
+[m4_assert([$# <= 2])dnl
+_$0(m4_quote(m4_default([$1], [[, ]])),
+    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
+    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
+m4_define([_lt_decl_varnames_tagged],
+[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
 
 
 # lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
@@ -945,10 +945,10 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
       _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
     darwin1.*)
       _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-    darwin*) # darwin 5.x on 
+    darwin*) # darwin 5.x on
       # if running on 10.5 or later, the deployment target defaults
       # to the OS version, if on x86, and 10.4, the deployment
-      # target defaults to 10.4. Don't you love it? 
+      # target defaults to 10.4. Don't you love it?
       case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
        10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
          _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
@@ -990,7 +990,11 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
   _LT_TAGVAR(whole_archive_flag_spec, $1)=''
   _LT_TAGVAR(link_all_deplibs, $1)=yes
   _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
-  if test "$GCC" = "yes"; then
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
     output_verbose_link_cmd=echo
     _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
     _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
@@ -1512,7 +1516,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     lt_cv_sys_max_cmd_len=-1;
     ;;
 
-  cygwin* | mingw*)
+  cygwin* | mingw* | cegcc*)
     # On Win9x/ME, this test blows up -- it succeeds, but takes
     # about 5 minutes as the teststring grows exponentially.
     # Worse, since 9x/ME are not pre-emptively multitasking,
@@ -1680,10 +1684,6 @@ else
 #  endif
 #endif
 
-#ifdef __cplusplus
-extern "C" void exit (int);
-#endif
-
 void fnord() { int i=42;}
 int main ()
 {
@@ -1699,7 +1699,7 @@ int main ()
   else
     puts (dlerror ());
 
-    exit (status);
+  return status;
 }]
 _LT_EOF
   if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
@@ -1738,7 +1738,7 @@ else
     lt_cv_dlopen_self=yes
     ;;
 
-  mingw* | pw32*)
+  mingw* | pw32* | cegcc*)
     lt_cv_dlopen="LoadLibrary"
     lt_cv_dlopen_libs=
     ;;
@@ -2035,6 +2035,7 @@ m4_defun([_LT_SYS_DYNAMIC_LINKER],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 m4_require([_LT_DECL_EGREP])dnl
 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_OBJDUMP])dnl
 m4_require([_LT_DECL_SED])dnl
 AC_MSG_CHECKING([dynamic linker characteristics])
 m4_if([$1],
@@ -2199,14 +2200,14 @@ bsdi[[45]]*)
   # libtool to hard-code these into programs
   ;;
 
-cygwin* | mingw* | pw32*)
+cygwin* | mingw* | pw32* | cegcc*)
   version_type=windows
   shrext_cmds=".dll"
   need_version=no
   need_lib_prefix=no
 
   case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32*)
+  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
     postinstall_cmds='base_file=`basename \${file}`~
@@ -2229,7 +2230,7 @@ cygwin* | mingw* | pw32*)
       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
       sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
       ;;
-    mingw*)
+    mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
       soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
       sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
@@ -2667,7 +2668,7 @@ tpf*)
   version_type=linux
   need_lib_prefix=no
   need_version=no
-  library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
@@ -2691,7 +2692,7 @@ variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
 if test "$GCC" = yes; then
   variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
 fi
+
 if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
   sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
 fi
@@ -2968,6 +2969,7 @@ _LT_DECL([], [reload_cmds], [2])dnl
 #  -- PORTME fill in with the dynamic library characteristics
 m4_defun([_LT_CHECK_MAGIC_METHOD],
 [m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
 AC_CACHE_CHECK([how to recognize dependent libraries],
 lt_cv_deplibs_check_method,
 [lt_cv_file_magic_cmd='$MAGIC_CMD'
@@ -3018,6 +3020,12 @@ mingw* | pw32*)
   fi
   ;;
 
+cegcc)
+  # use the weaker test based on 'objdump'. See mingw*.
+  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
 darwin* | rhapsody*)
   lt_cv_deplibs_check_method=pass_all
   ;;
@@ -3329,7 +3337,7 @@ case $host_os in
 aix*)
   symcode='[[BCDT]]'
   ;;
-cygwin* | mingw* | pw32*)
+cygwin* | mingw* | pw32* | cegcc*)
   symcode='[[ABCDGISTW]]'
   ;;
 hpux*)
@@ -3575,7 +3583,7 @@ m4_if([$1], [CXX], [
     beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
       # PIC is the default for these OSes.
       ;;
-    mingw* | cygwin* | os2* | pw32*)
+    mingw* | cygwin* | os2* | pw32* | cegcc*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
       # Although the cygwin gcc ignores -fPIC, still need this for old-style
@@ -3602,10 +3610,11 @@ m4_if([$1], [CXX], [
       fi
       ;;
     hpux*)
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
       case $host_cpu in
-      hppa*64*|ia64*)
+      hppa*64*)
        ;;
       *)
        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
@@ -3703,12 +3712,19 @@ m4_if([$1], [CXX], [
            _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
            ;;
-         icpc* | ecpc* )
-           # Intel C++
+         ecpc* )
+           # old Intel C++ for x86_64 which still supported -KPIC.
            _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
            _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
            ;;
+         icpc* )
+           # Intel C++, used to be incompatible with GCC.
+           # ICC 10 doesn't accept -KPIC any more.
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+           ;;
          pgCC* | pgcpp*)
            # Portland Group C++ compiler
            _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
@@ -3874,7 +3890,7 @@ m4_if([$1], [CXX], [
       # PIC is the default for these OSes.
       ;;
 
-    mingw* | cygwin* | pw32* | os2*)
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
       # Although the cygwin gcc ignores -fPIC, still need this for old-style
@@ -3890,10 +3906,11 @@ m4_if([$1], [CXX], [
       ;;
 
     hpux*)
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
       case $host_cpu in
-      hppa*64*|ia64*)
+      hppa*64*)
        # +Z the default
        ;;
       *)
@@ -3943,7 +3960,7 @@ m4_if([$1], [CXX], [
       fi
       ;;
 
-    mingw* | cygwin* | pw32* | os2*)
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
       m4_if([$1], [GCJ], [],
@@ -3974,11 +3991,25 @@ m4_if([$1], [CXX], [
 
     linux* | k*bsd*-gnu)
       case $cc_basename in
-      icc* | ecc* | ifort*)
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
        _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
         ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
+       ;;
       pgcc* | pgf77* | pgf90* | pgf95*)
         # Portland Group compilers (*not* the Pentium gcc compiler,
        # which looks to be a dead project)
@@ -4160,7 +4191,7 @@ m4_if([$1], [CXX], [
   pw32*)
     _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
   ;;
-  cygwin* | mingw*)
+  cygwin* | mingw* | cegcc*)
     _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
   ;;
   linux* | k*bsd*-gnu)
@@ -4215,7 +4246,7 @@ dnl Note also adjust exclude_expsyms for C++ above.
   extract_expsyms_cmds=
 
   case $host_os in
-  cygwin* | mingw* | pw32*)
+  cygwin* | mingw* | pw32* | cegcc*)
     # FIXME: the MSVC++ port hasn't been tested in a loooong time
     # When not using gcc, we currently assume that we are using
     # Microsoft Visual C++.
@@ -4230,6 +4261,9 @@ dnl Note also adjust exclude_expsyms for C++ above.
   openbsd*)
     with_gnu_ld=no
     ;;
+  linux* | k*bsd*-gnu)
+    _LT_TAGVAR(link_all_deplibs, $1)=no
+    ;;
   esac
 
   _LT_TAGVAR(ld_shlibs, $1)=yes
@@ -4302,7 +4336,7 @@ _LT_EOF
       fi
       ;;
 
-    cygwin* | mingw* | pw32*)
+    cygwin* | mingw* | pw32* | cegcc*)
       # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
       # as there is no search path for DLLs.
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
@@ -4368,6 +4402,9 @@ _LT_EOF
          tmp_addflag=' -i_dynamic -nofor_main' ;;
        ifc* | ifort*)                  # Intel Fortran compiler
          tmp_addflag=' -nofor_main' ;;
+       lf95*)                          # Lahey Fortran 8.1
+         _LT_TAGVAR(whole_archive_flag_spec, $1)=
+         tmp_sharedflag='--shared' ;;
        xl[[cC]]*)                      # IBM XL C 8.0 on PPC (deal with xlf below)
          tmp_sharedflag='-qmkshrobj'
          tmp_addflag= ;;
@@ -4600,6 +4637,7 @@ _LT_EOF
        fi
       fi
 
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
       # It seems that -bexpall does not export symbols beginning with
       # underscore (_), so it is better to generate a list of symbols to export.
       _LT_TAGVAR(always_export_symbols, $1)=yes
@@ -4654,7 +4692,7 @@ _LT_EOF
       _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
       ;;
 
-    cygwin* | mingw* | pw32*)
+    cygwin* | mingw* | pw32* | cegcc*)
       # When not using gcc, we currently assume that we are using
       # Microsoft Visual C++.
       # hardcode_libdir_flag_spec is actually meaningless, as there is
@@ -4758,7 +4796,7 @@ _LT_EOF
          _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
          ;;
        ia64*)
-         _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
          ;;
        *)
          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
@@ -5543,6 +5581,7 @@ if test "$_lt_caught_CXX_error" != yes; then
           fi
         fi
 
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
         # It seems that -bexpall does not export symbols beginning with
         # underscore (_), so it is better to generate a list of symbols to
        # export.
@@ -5601,7 +5640,7 @@ if test "$_lt_caught_CXX_error" != yes; then
         esac
         ;;
 
-      cygwin* | mingw* | pw32*)
+      cygwin* | mingw* | pw32* | cegcc*)
         # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
         # as there is no search path for DLLs.
         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
@@ -6986,6 +7025,18 @@ AC_SUBST([GREP])
 ])
 
 
+# _LT_DECL_OBJDUMP
+# --------------
+# If we don't have a new enough Autoconf to choose the best objdump
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_OBJDUMP],
+[AC_CHECK_TOOL(OBJDUMP, objdump, false)
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
+AC_SUBST([OBJDUMP])
+])
+
+
 # _LT_DECL_SED
 # ------------
 # Check for a fully-functional sed program, that truncates
index eb8db0cd123f670fd7d7fd5a109f58e4315c1b3c..46535e2e11559aa79db0363152cce41b8f36b872 100644 (file)
@@ -7,7 +7,7 @@
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 15 LTDL_INIT
+# serial 17 LTDL_INIT
 
 # LT_CONFIG_LTDL_DIR(DIRECTORY, [LTDL-MODE])
 # ------------------------------------------
@@ -212,26 +212,10 @@ m4_define([$0], [])
 # of into LIBOBJS.
 AC_DEFUN([_LT_LIBOBJ], [
   m4_pattern_allow([^_LT_LIBOBJS$])
-  AS_LITERAL_IF([$1], [_LT_LIBSOURCES([$1.c])])dnl
   _LT_LIBOBJS="$_LT_LIBOBJS $1.$ac_objext"
 ])# _LT_LIBOBJS
 
 
-# _LT_LIBSOURCES(MODULE_NAMES)
-# ----------------------------
-# Like AC_LIBSOURCES, except the directory where the libltdl source files
-# are expected is distinct from the user LIBOBJ directory.
-AC_DEFUN([_LT_LIBSOURCES], [
-  m4_foreach([_LTNAME], [$1], [
-    m4_syscmd([test -r "$lt_libobj_prefix]_LTNAME[" ||
-               test -z "$lt_libobj_prefix" ||
-               test ! -d "$lt_libobj_prefix"])dnl
-    m4_if(m4_sysval, [0], [],
-      [AC_FATAL([missing $lt_libobj_prefix/]_LTNAME)])
-  ])
-])# _LT_LIBSOURCES
-
-
 # LTDL_INIT([OPTIONS])
 # --------------------
 # Clients of libltdl can use this macro to allow the installer to
@@ -245,9 +229,9 @@ _LT_SET_OPTIONS([$0], [$1])
 
 dnl We need to keep our own list of libobjs separate from our parent project,
 dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while
-dnl we look for our own LIBOBJs. Definitions in ltdl-libobj.m4.
+dnl we look for our own LIBOBJs.
 m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ]))
-m4_pushdef([AC_LIBSOURCES], m4_defn([_LT_LIBSOURCES]))
+m4_pushdef([AC_LIBSOURCES])
 
 dnl If not otherwise defined, default to the 1.5.x compatible subproject mode:
 m4_if(_LTDL_MODE, [],
@@ -264,7 +248,7 @@ if test "x$with_included_ltdl" != xyes; then
   # decide whether there is a useful installed version we can use.
   AC_CHECK_HEADER([ltdl.h],
       [AC_CHECK_DECL([lt_dlinterface_register],
-          [AC_CHECK_LIB([ltdl], [lt_dlinterface_register],
+          [AC_CHECK_LIB([ltdl], [lt_dladvise_preload],
               [with_included_ltdl=no],
               [with_included_ltdl=yes])],
           [with_included_ltdl=yes],
@@ -396,12 +380,6 @@ m4_require([_LT_HEADER_DLFCN])dnl
 m4_require([_LT_CHECK_DLPREOPEN])dnl
 m4_require([_LT_DECL_SED])dnl
 
-# lt_cv_dlopen_self gets defined by LT_SYS_DLOPEN_SELF, called by LT_INIT
-if test "$lt_cv_dlopen_self" = yes; then
-  AC_DEFINE([LTDL_DLOPEN_SELF_WORKS], [1],
-    [Define if dlopen(NULL) is able to resolve symbols from the main program.])
-fi
-
 dnl Don't require this, or it will be expanded earlier than the code
 dnl that sets the variables it relies on:
 _LT_ENABLE_INSTALL
@@ -429,6 +407,8 @@ AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h],
 AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])])
 AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])])
 
+AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension])
+
 name=ltdl
 LTDLOPEN=`eval "\\$ECHO \"$libname_spec\""`
 AC_SUBST([LTDLOPEN])
index e97011948b481651bdfb2cb9c3acd88b80a74831..34151a3ba625f326e6645d6afc79586f10746a3e 100644 (file)
@@ -125,7 +125,7 @@ LT_OPTION_DEFINE([LT_INIT], [win32-dll],
 [enable_win32_dll=yes
 
 case $host in
-*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
   AC_CHECK_TOOL(AS, as, false)
   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
   AC_CHECK_TOOL(OBJDUMP, objdump, false)
index 0d258e070a24d695ceba7e2f3a6071b6915e1d01..9000a057d31ddf75cb85ccda8757de4493bcdbe7 100644 (file)
@@ -1,13 +1,13 @@
 # ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
 #
-#   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
-#   Written by Gary V. Vaughan, 2004
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
 #
 # This file 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.
 
-# serial 5 ltsugar.m4
+# serial 6 ltsugar.m4
 
 # This is to help aclocal find these macros, as it can't see m4_define.
 AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
@@ -63,14 +63,14 @@ m4_define([lt_append],
 # Produce a SEP delimited list of all paired combinations of elements of
 # PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
 # has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
 m4_define([lt_combine],
-[m4_if([$2], [], [],
-  [m4_if([$4], [], [],
-    [lt_join(m4_quote(m4_default([$1], [[, ]])),
-      lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_prefix, [$2],
-                  [m4_foreach(_Lt_suffix, lt_car([m4_shiftn(3, $@)]),
-                              [_Lt_prefix[]$3[]_Lt_suffix ])])))))])])dnl
-])
+[m4_if(m4_eval([$# > 3]), [1],
+       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+            [m4_foreach([_Lt_suffix],
+               ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+       [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
 
 
 # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
index 45cb1557c3af3e759b210080388311d2b29ac217..b8e154fe6e10fb20e2cf7d9e3a59116fb27cb79b 100644 (file)
@@ -9,15 +9,15 @@
 
 # Generated from ltversion.in.
 
-# serial 2976 ltversion.m4
+# serial 3012 ltversion.m4
 # This file is part of GNU Libtool
 
-m4_define([LT_PACKAGE_VERSION], [2.2.4])
-m4_define([LT_PACKAGE_REVISION], [1.2976])
+m4_define([LT_PACKAGE_VERSION], [2.2.6])
+m4_define([LT_PACKAGE_REVISION], [1.3012])
 
 AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.2.4'
-macro_revision='1.2976'
+[macro_version='2.2.6'
+macro_revision='1.3012'
 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
 _LT_DECL(, macro_revision, 0)
 ])
index 1ad59099c0d5b8a3c66afa4cc02a08f80835b8cb..c3b8a9b15c2121b6363ccaf1b8c38049dd24abfd 100644 (file)
@@ -43,6 +43,7 @@ plugin_LTLIBRARIES = \
 libgnunet_plugin_datastore_sqlite_la_SOURCES = \
   plugin_datastore_sqlite.c
 libgnunet_plugin_datastore_sqlite_la_LIBADD = \
+  $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lsqlite3
 libgnunet_plugin_datastore_sqlite_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
index 968e09b20e81e696cb801b3c506607b5d5d9d153..3b9e22a3a0953b9639454295a19ac333350da783 100644 (file)
@@ -112,6 +112,32 @@ struct GNUNET_DATASTORE_Handle *GNUNET_DATASTORE_connect (struct
 }
 
 
+/**
+ * Transmit DROP message to Database service.
+ */
+static size_t
+transmit_drop (void *cls,
+              size_t size, void *buf)
+{
+  struct GNUNET_DATASTORE_Handle *h = cls;
+  struct GNUNET_MessageHeader *hdr;
+
+  if (buf == NULL)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                 _("Failed to transmit request to drop database.\n"));
+      GNUNET_DATASTORE_disconnect (h, GNUNET_NO);
+      return 0;
+    }
+  GNUNET_assert (size >= sizeof(struct GNUNET_MessageHeader));
+  hdr = buf;
+  hdr->size = htons(sizeof(struct GNUNET_MessageHeader));
+  hdr->type = htons(GNUNET_MESSAGE_TYPE_DATASTORE_DROP));
+  GNUNET_DATASTORE_disconnect (h, GNUNET_NO);
+  return sizeof(struct GNUNET_MessageHeader);
+}
+
+
 /**
  * Disconnect from the datastore service (and free
  * associated resources).
@@ -124,13 +150,59 @@ void GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h,
 {
   if (GNUNET_YES == drop)
     {
-      /* FIXME: send 'drop' request */
+      if (NULL != 
+         GNUNET_CLIENT_notify_transmit_ready (h->client,
+                                              sizeof(struct GNUNET_MessageHeader),
+                                              GNUNET_TIME_UNIT_MINUTES,
+                                              &transmit_drop,
+                                              h))
+       return;
+      GNUNET_break (0);
     }
   GNUNET_CLIENT_disconnect (h->client);
   GNUNET_free (h);
 }
 
 
+/**
+ * The closure is followed by the data message.
+ */
+struct PutClosure
+{
+  struct GNUNET_DATASTORE_Handle *h;
+  GNUNET_DATASTORE_ContinuationWithStatus cont;
+  void *cont_cls;
+};
+
+
+/**
+ * Transmit PUT message to Database service.
+ */
+static size_t
+transmit_put (void *cls,
+             size_t size, void *buf)
+{
+  struct PutClosure *pc = cls;
+  struct DataMessage *dm;
+  uint16_t msize;
+
+  if (buf == NULL)
+    {
+      pc->cont (pc->cont_cls, GNUNET_SYSERR,
+               gettext_noop ("Error transmitting `PUT' message to datastore service.\n"));
+      GNUNET_free (pc);
+      return 0;
+    }
+  dm = (struct DataMessage*) &pc[1];
+  msize = ntohs(dm->size);
+  GNUNET_assert (msize <= size);
+  memcpy (buf, dm, msize);
+  /* FIXME: wait for response from datastore, then
+     call our continuation! */
+  return msize;
+}
+
+
 /**
  * Store an item in the datastore.  If the item is already present,
  * the priorities are summed up and the higher expiration time and
@@ -144,6 +216,7 @@ void GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h,
  * @param priority priority of the content
  * @param anonymity anonymity-level for the content
  * @param expiration expiration time for the content
+ * @param timeout timeout for the operation
  * @param cont continuation to call when done
  * @param cont_cls closure for cont
  */
@@ -157,10 +230,41 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h,
                       uint32_t priority,
                       uint32_t anonymity,
                       struct GNUNET_TIME_Absolute expiration,
+                      struct GNUNET_TIME_Relative timeout,
                      GNUNET_DATASTORE_ContinuationWithStatus cont,
                      void *cont_cls)
 {
-  cont (cont_cls, GNUNET_SYSERR, "not implemented");
+  struct PutClosure *pc;
+  struct DataMessage *dm;
+
+  pc = GNUNET_malloc (sizeof(struct PutClosure) + 
+                     sizeof(struct DataMessage) + 
+                     size);
+  dm = (struct DataMessage*) &pc[1];
+  pc->h = h;
+  pc->cont = cont;
+  pc->cont_cls = cont_cls;
+  dm->header.type = htons(GNUNET_MESSAGE_TYPE_DATASTORE_PUT);
+  dm->header.size = htons(sizeof(struct DataMessage) + size);
+  dm->rid = htonl(rid);
+  dm->size = htonl(size);
+  dm->type = htonl(type);
+  dm->priority = htonl(priority);
+  dm->anonymity = htonl(anonymity);
+  dm->uid = GNUNET_htonll(0);
+  dm->expiration = GNUNET_htonll(expiration);
+  dm->key = *key;
+  memcpy (&dm[1], data, size);
+  if (NULL == GNUNET_CLIENT_notify_transmit_ready (h->client,
+                                                  sizeof(struct DataMessage) + size,
+                                                  timeout,
+                                                  &transmit_put,
+                                                  pc))
+    {
+      GNUNET_break (0);
+      cont (cont_cls, GNUNET_SYSERR,
+           gettext_noop ("Not ready to transmit request to datastore service"));
+    }
 }
 
 
index 95ee18dad40fac030ea9e57df4dc57cdf1585625..f10f6d0f5e0f6ed18069ebf89795a466b590f4a5 100644 (file)
@@ -104,6 +104,9 @@ static unsigned long long stored_ops;
 
 static struct GNUNET_TIME_Absolute start_time;
 
+static int ok;
+
+
 static int
 putValue (int i, int k)
 {
@@ -206,7 +209,6 @@ run (void *cls,
 static int
 check ()
 {
-  int ok = 1 + 2 + 4 + 8;
   pid_t pid;
   char *const argv[] = { "perf-datastore-api",
     "-c",
@@ -228,7 +230,7 @@ check ()
   sleep (1);
   GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
                       argv, "perf-datastore-api", "nohelp",
-                      options, &run, &ok);
+                      options, &run, NULL);
   if (0 != PLIBC_KILL (pid, SIGTERM))
     {
       GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
index 328cceb757d8b637f074984d78e4840dad5be1a1..635fa1f28475a4e1d2475c2a2ddc7279db8185fa 100644 (file)
@@ -52,6 +52,9 @@ static unsigned long long stored_ops;
 static struct GNUNET_CONFIGURATION_Handle *cfg;
 
 static struct GNUNET_SCHEDULER_Handle *sched;
+
+static int ok;
+
             
 static int
 putValue (struct GNUNET_DATASTORE_PluginFunctions * api, int i, int k)
@@ -271,7 +274,6 @@ run (void *cls,
 static int
 check ()
 {
-  int ok = 1 + 2 + 4 + 8;
   char *const argv[] = { "perf-datastore-api-iterators",
     "-c",
     "test_datastore_api_data.conf",
@@ -285,7 +287,7 @@ check ()
   };
   GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
                       argv, "perf-datastore-api-iterators", "nohelp",
-                      options, &run, &ok);
+                      options, &run, NULL);
   if (ok != 0)
     fprintf (stderr, "Missed some testcases: %u\n", ok);
   return ok;
index 5ae03b9bb23e9d346188b292d8008026d43dea78..6abb08dd8fe15e1e4a7cc0a9c02085191e67210c 100644 (file)
@@ -1,4 +1,4 @@
-/*
+ /*
      This file is part of GNUnet
      (C) 2009 Christian Grothoff (and other contributing authors)
 
   "ORDER BY prio ASC, hash ASC LIMIT 1"
 
 #define SELECT_IT_NON_ANONYMOUS_1 \
-  "SELECT size,type,prio,anonLevel,expire,hash,value,_ROWID_ FROM gn080 WHERE (prio = ? AND hash < ? AND anonLevel = 0) "\
+  "SELECT size,type,prio,anonLevel,expire,hash,value,_ROWID_ FROM gn080 WHERE (prio = ? AND hash < ? AND anonLevel = 0 AND expire > %llu) "\
   " ORDER BY hash DESC LIMIT 1"
 
 #define SELECT_IT_NON_ANONYMOUS_2 \
-  "SELECT size,type,prio,anonLevel,expire,hash,value,_ROWID_ FROM gn080 WHERE (prio < ? AND anonLevel = 0)"\
+  "SELECT size,type,prio,anonLevel,expire,hash,value,_ROWID_ FROM gn080 WHERE (prio < ? AND anonLevel = 0 AND expire > %llu)"\
   " ORDER BY prio DESC, hash DESC LIMIT 1"
 
 #define SELECT_IT_EXPIRATION_TIME_1 \
@@ -83,7 +83,7 @@
   " ORDER BY hash DESC LIMIT 1"
 
 #define SELECT_IT_MIGRATION_ORDER_2 \
-  "SELECT size,type,prio,anonLevel,expire,hash,value,_ROWID_ FROM gn080 WHERE (expire < ?) "\
+  "SELECT size,type,prio,anonLevel,expire,hash,value,_ROWID_ FROM gn080 WHERE (expire < ? AND expire > %llu) "\
   " ORDER BY expire DESC, hash DESC LIMIT 1"
 
 /**
@@ -220,7 +220,6 @@ database_setup (struct GNUNET_CONFIGURATION_Handle *cfg,
                struct Plugin *plugin)
 {
   sqlite3_stmt *stmt;
-  char *dir;
   char *afsdir;
 #if ENULL_DEFINED
   char *e;
@@ -228,33 +227,31 @@ database_setup (struct GNUNET_CONFIGURATION_Handle *cfg,
   
   if (GNUNET_OK != 
       GNUNET_CONFIGURATION_get_value_filename (cfg,
-                                              "FS",
-                                              "DIR",
+                                              "datastore-sqlite",
+                                              "FILENAME",
                                               &afsdir))
     {
       GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
                       "sqlite",
                       _("Option `%s' in section `%s' missing in configuration!\n"),
-                      "DIR",
-                      "FS");
+                      "FILENAME",
+                      "datastore-sqlite");
       return GNUNET_SYSERR;
     }
-  GNUNET_asprintf (&dir, "%s/content/gnunet.dat", afsdir);
-  GNUNET_free (afsdir);
-  if (GNUNET_OK != GNUNET_DISK_directory_create_for_file (dir))
+  if (GNUNET_OK != GNUNET_DISK_directory_create_for_file (afsdir))
     {
       GNUNET_break (0);
-      GNUNET_free (dir);
+      GNUNET_free (afsdir);
       return GNUNET_SYSERR;
     }
-  plugin->fn = GNUNET_STRINGS_to_utf8 (dir, strlen (dir),
+  plugin->fn = GNUNET_STRINGS_to_utf8 (afsdir, strlen (afsdir),
 #ifdef ENABLE_NLS
                                              nl_langinfo (CODESET)
 #else
                                              "UTF-8"   /* good luck */
 #endif
                                              );
-  GNUNET_free (dir);
+  GNUNET_free (afsdir);
   
   /* Open database and precompile statements */
   if (sqlite3_open (plugin->fn, &plugin->dbh) != SQLITE_OK)
@@ -794,7 +791,7 @@ iter_next_prepare (void *cls,
 {
   struct IterContext *ic = cls;
   struct Plugin *plugin = nc->plugin;
-  struct GNUNET_TIME_Absolute now;
+  int ret;
 
   if (nc == NULL)
     {
@@ -802,7 +799,6 @@ iter_next_prepare (void *cls,
       sqlite3_finalize (ic->stmt_2);
       return GNUNET_SYSERR;
     }
-  now = GNUNET_TIME_absolute_get ();
   if (ic->is_prio)
     {
       sqlite3_bind_int (ic->stmt_1, 1, nc->lastPriority);
@@ -817,13 +813,7 @@ iter_next_prepare (void *cls,
                     &ic->key, 
                     sizeof (GNUNET_HashCode),
                     SQLITE_TRANSIENT);
-  datum_1 = NULL;
-  datum_2 = last_datum_2;
-  last_datum_2 = NULL;
-
-  if ( (SQLITE_ROW == (ret = sqlite3_step (stmt_1))) &&
-       ( (GNUNET_NO == ic->is_migr) || 
-        (sqlite3_column_int64 (stmt_1, 4) >= now.value) ) )
+  if (SQLITE_ROW == (ret = sqlite3_step (ic->stmt_1)))
     {
       nc->stmt = ic->stmt_1;
       return GNUNET_OK;
@@ -836,117 +826,30 @@ iter_next_prepare (void *cls,
                  "sqlite3_step");
       return GNUNET_SYSERR;
     }
-  if (SQLITE_OK != sqlite3_reset (stmt_1))
-    LOG_SQLITE (handle, NULL,
+  if (SQLITE_OK != sqlite3_reset (ic->stmt_1))
+    LOG_SQLITE (plugin, NULL,
                GNUNET_ERROR_TYPE_ERROR | 
                GNUNET_ERROR_TYPE_BULK, 
                "sqlite3_reset");
-  
-  if (datum_2 == NULL)
-    {
-      if ( (SQLITE_ROW == (ret = sqlite3_step (ic->stmt_2))) && 
-          ( (GNUNET_NO == ic->is_migr) ||
-            sqlite3_column_int64 (stmt_2, 4) >= now.value) )
-       {
-         nc->stmt = ic->stmt_2;
-         return GNUNET_OK;
-       }
-      if (ret != SQLITE_DONE)
-       {
-         LOG_SQLITE (plugin, NULL,
-                     GNUNET_ERROR_TYPE_ERROR |
-                     GNUNET_ERROR_TYPE_BULK,
-                     "sqlite3_step");
-         return GNUNET_SYSERR;
-       }
-      if (SQLITE_OK != sqlite3_reset (stmt_2))
-       LOG_SQLITE (plugin, NULL,
-                   GNUNET_ERROR_TYPE_ERROR |
-                   GNUNET_ERROR_TYPE_BULK,
-                   "sqlite3_reset");
-    }
-  datum = NULL;
-  if (datum_1 == NULL)
-    {
-      datum = datum_2;
-      rowid = rowid_2;
-      key = key_2;
-    }
-  else if (datum_2 == NULL)
+  if (SQLITE_ROW == (ret = sqlite3_step (ic->stmt_2))) 
     {
-      datum = datum_1;
-      rowid = rowid_1;
-      key = key_1;
-    }
-  else
-    {
-      /* have to pick between 1 and 2 */
-      if (is_prio)
-       {
-         if ((ntohl (datum_1->priority) < ntohl (datum_2->priority)) ==
-             is_asc)
-           {
-             datum = datum_1;
-             rowid = rowid_1;
-             key = key_1;
-             last_datum_2 = datum_2;
-           }
-         else
-           {
-             datum = datum_2;
-             rowid = rowid_2;
-             key = key_2;
-             GNUNET_free (datum_1);
-           }
-       }
-      else
-       {
-         if ((GNUNET_ntohll (datum_1->expiration_time) <
-              GNUNET_ntohll (datum_2->expiration_time)) == is_asc)
-           {
-             datum = datum_1;
-             rowid = rowid_1;
-             key = key_1;
-             last_datum_2 = datum_2;
-           }
-         else
-           {
-             datum = datum_2;
-             rowid = rowid_2;
-             key = key_2;
-             GNUNET_free (datum_1);
-           }
-       }
+      nc->stmt = ic->stmt_2;
+      return GNUNET_OK;
     }
-  if (datum == NULL)
-    break;
-#if 0
-  printf ("FOUND %4u prio %4u exp %20llu old: %4u, %20llu\n",
-         (ntohl (datum->size) - sizeof (GNUNET_DatastoreValue)),
-         ntohl (datum->priority),
-         GNUNET_ntohll (datum->expiration_time), lastPrio, lastExp);
-#endif
-  if (((GNUNET_NO == limit_nonanonymous) ||
-       (ntohl (datum->anonymity_level) == 0)) &&
-      ((type == GNUNET_ECRS_BLOCKTYPE_ANY) ||
-       (type == ntohl (datum->type))))
+  if (ret != SQLITE_DONE)
     {
-      count++;
-      if (iter != NULL)
-       {
-         ret = iter (&key, datum, closure, rowid);
-         if (ret == GNUNET_SYSERR)
-           {
-             GNUNET_free (datum);
-             break;
-           }
-         if (ret == GNUNET_NO)
-           {
-             payload -= getContentDatastoreSize (datum);
-             delete_by_rowid (handle, rowid);
-           }
-       }
+      LOG_SQLITE (plugin, NULL,
+                 GNUNET_ERROR_TYPE_ERROR |
+                 GNUNET_ERROR_TYPE_BULK,
+                 "sqlite3_step");
+      return GNUNET_SYSERR;
     }
+  if (SQLITE_OK != sqlite3_reset (ic->stmt_2))
+    LOG_SQLITE (plugin, NULL,
+               GNUNET_ERROR_TYPE_ERROR |
+               GNUNET_ERROR_TYPE_BULK,
+               "sqlite3_reset");
+  return GNUNET_NO;
 }
 
 
@@ -1070,8 +973,13 @@ sqlite_plugin_iter_zero_anonymity (void *cls,
                                   PluginIterator iter,
                                   void *iter_cls)
 {
-  static struct GNUNET_TIME_Absolute zero;
-  iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, zero, 0);
+  basic_iter (cls,
+             type, 
+             GNUNET_NO, GNUNET_YES, 
+             GNUNET_NO, GNUNET_YES,
+             SELECT_IT_NON_ANONYMOUS_1,
+             SELECT_IT_NON_ANONYMOUS_2, 
+             iter, iter_cls);
 }
 
 
@@ -1092,10 +1000,24 @@ sqlite_plugin_iter_ascending_expiration (void *cls,
                                         PluginIterator iter,
                                         void *iter_cls)
 {
-  static struct GNUNET_TIME_Absolute zero;
-  iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, zero, 0);
-}
+  struct GNUNET_TIME_Absolute now;
+  char *q1;
+  char *q2;
 
+  now = GNUNET_TIME_absolute_get ();
+  GNUNET_asprintf (&q1, SELECT_IT_EXPIRATION_TIME_1,
+                  now.value);
+  GNUNET_asprintf (&q2, SELECT_IT_EXPIRATION_TIME_2,
+                  now.value);
+  basic_iter (cls,
+             type, 
+             GNUNET_YES, GNUNET_NO, 
+             GNUNET_NO, GNUNET_NO,
+             q1, q2,
+             iter, iter_cls);
+  GNUNET_free (q1);
+  GNUNET_free (q2);
+}
 
 
 /**
@@ -1114,8 +1036,20 @@ sqlite_plugin_iter_migration_order (void *cls,
                                    PluginIterator iter,
                                    void *iter_cls)
 {
-  static struct GNUNET_TIME_Absolute zero;
-  iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, zero, 0);
+  struct GNUNET_TIME_Absolute now;
+  char *q;
+
+  now = GNUNET_TIME_absolute_get ();
+  GNUNET_asprintf (&q, SELECT_IT_MIGRATION_ORDER_2,
+                  now.value);
+  basic_iter (cls,
+             type, 
+             GNUNET_NO, GNUNET_NO, 
+             GNUNET_YES, GNUNET_NO,
+             SELECT_IT_MIGRATION_ORDER_1,
+             q,
+             iter, iter_cls);
+  GNUNET_free (q);
 }
 
 
index 0b08cfe8fa293e499296910b0cc10e7e4135bc9d..b4da05fdad7718b13c51bd530d2377adf8aa6822 100644 (file)
@@ -37,6 +37,8 @@ static struct GNUNET_DATASTORE_Handle *datastore;
 
 static struct GNUNET_TIME_Absolute now;
 
+static int ok;
+
 
 static size_t
 get_size (int i)
@@ -84,13 +86,47 @@ get_expiration (int i)
   return av;
 }
 
+enum RunPhase
+  {
+    RP_DONE = 0,
+    RP_PUT,
+    RP_GET,
+    RP_DEL,
+    RP_DELVALIDATE
+  };
+
+
+struct CpsRunContext
+{
+  GNUNET_HashCode key;
+  int i;
+  int *iptr;
+  struct GNUNET_SCHEDULER_Handle *sched;
+  struct GNUNET_CONFIGURATION_Handle *cfg;
+  enum RunPhase phase;
+};
+
+
+static void
+run_continuation (void *cls,
+                 const struct GNUNET_SCHEDULER_TaskContext *tc);
+
 
 static void
 check_success (void *cls,
               int success,
               const char *msg)
 {
+  struct CpsRunContext *crc = cls;
+  if (GNUNET_OK != success)
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+               "%s\n", msg);
   GNUNET_assert (GNUNET_OK == success);
+  GNUNET_SCHEDULER_add_continuation (crc->sched,
+                                    GNUNET_NO,
+                                    &run_continuation,
+                                    crc,
+                                    GNUNET_SCHEDULER_REASON_PREREQ_DONE);
 }
 
 
@@ -99,8 +135,14 @@ check_failure (void *cls,
               int success,
               const char *msg)
 {
+  struct CpsRunContext *crc = cls;
   GNUNET_assert (GNUNET_OK != success);
   GNUNET_assert (NULL != msg);
+  GNUNET_SCHEDULER_add_continuation (crc->sched,
+                                    GNUNET_NO,
+                                    &run_continuation,
+                                    crc,
+                                    GNUNET_SCHEDULER_REASON_PREREQ_DONE);
 }
 
 
@@ -115,18 +157,23 @@ check_value (void *cls,
             struct GNUNET_TIME_Absolute
             expiration, uint64_t uid)
 {
-  int *iptr = cls;
+  struct CpsRunContext *crc = cls;
   int i;
 
   if (key == NULL)
     return;
-  i = *iptr;
+  i = crc->i;
   GNUNET_assert (size == get_size (i));
   GNUNET_assert (0 == memcmp (data, get_data(i), size));
   GNUNET_assert (type == get_type (i));
   GNUNET_assert (priority == get_priority (i));
   GNUNET_assert (anonymity == get_anonymity(i));
   GNUNET_assert (expiration.value == get_expiration(i).value);
+  GNUNET_SCHEDULER_add_continuation (crc->sched,
+                                    GNUNET_NO,
+                                    &run_continuation,
+                                    crc,
+                                    GNUNET_SCHEDULER_REASON_PREREQ_DONE);
 }
 
 
@@ -141,6 +188,7 @@ delete_value (void *cls,
             struct GNUNET_TIME_Absolute
             expiration, uint64_t uid)
 {
+  struct CpsRunContext *crc = cls;
   if (key == NULL)
     return;
   GNUNET_DATASTORE_remove (datastore,
@@ -156,6 +204,11 @@ delete_value (void *cls,
                           data,
                           &check_failure,
                           NULL);
+  GNUNET_SCHEDULER_add_continuation (crc->sched,
+                                    GNUNET_NO,
+                                    &run_continuation,
+                                    crc,
+                                    GNUNET_SCHEDULER_REASON_PREREQ_DONE);
 }
 
 
@@ -171,78 +224,112 @@ check_nothing (void *cls,
             struct GNUNET_TIME_Absolute
             expiration, uint64_t uid)
 {
+  struct CpsRunContext *crc = cls;
   GNUNET_assert (key == NULL);
+  GNUNET_SCHEDULER_add_continuation (crc->sched,
+                                    GNUNET_NO,
+                                    &run_continuation,
+                                    crc,
+                                    GNUNET_SCHEDULER_REASON_PREREQ_DONE);
 }
 
 
-
 static void
-run (void *cls,
-     struct GNUNET_SCHEDULER_Handle *sched,
-     char *const *args,
-     const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg)
+run_continuation (void *cls,
+                 const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  GNUNET_HashCode key;
-  int i;
-  int *iptr;
-
-  datastore = GNUNET_DATASTORE_connect (cfg, sched);
-  now.value = 1000000;
-  for (i = 0; i < 256; i++)
+  struct CpsRunContext *crc = cls;
+  ok = (int) crc->phase;
+  switch (crc->phase)
     {
-      memset (&key, 256 - i, sizeof (GNUNET_HashCode));
+    case RP_PUT:
+      memset (&crc->key, 256 - crc->i, sizeof (GNUNET_HashCode));
       GNUNET_DATASTORE_put (datastore,
                            0,
-                           &key,
-                           get_size (i),
-                           get_data (i),
-                           get_type (i),
-                           get_priority (i),
-                           get_anonymity (i),
-                           get_expiration (i),
+                           &crc->key,
+                           get_size (crc->i),
+                           get_data (crc->i),
+                           get_type (crc->i),
+                           get_priority (crc->i),
+                           get_anonymity (crc->i),
+                           get_expiration (crc->i),
                            &check_success,
-                           NULL);
-    }
-  for (i = 255; i >= 0; i--)
-    {
-      memset (&key, 256 - i, sizeof (GNUNET_HashCode));
-      iptr = GNUNET_malloc(sizeof(int));
-      *iptr = i;
+                           crc);
+      crc->i++;
+      if (crc->i == 256)
+       crc->phase = RP_GET;
+      break;
+    case RP_GET:
+      crc->i--;
+      memset (&crc->key, 256 - crc->i, sizeof (GNUNET_HashCode));
       GNUNET_DATASTORE_get (datastore, 
-                           &key,
-                           get_type (i),
+                           &crc->key,
+                           get_type (crc->i),
                            &check_value,
-                           iptr);
-    }
-  for (i = 255; i >= 0; i--)
-    {
-      memset (&key, 256 - i, sizeof (GNUNET_HashCode));
-      iptr = GNUNET_malloc(sizeof(int));
-      *iptr = i;
+                           crc);
+      if (crc->i == 0)
+       {
+         crc->phase = RP_DEL;
+         crc->i = 256;
+       }
+      break;
+    case RP_DEL:
+      crc->i--;
+      memset (&crc->key, 256 - crc->i, sizeof (GNUNET_HashCode));
       GNUNET_DATASTORE_get (datastore, 
-                           &key,
-                           get_type (i),
+                           &crc->key,
+                           get_type (crc->i),
                            &delete_value,
-                           iptr);
-    }
-  for (i = 255; i >= 0; i--)
-    {
-      memset (&key, 256 - i, sizeof (GNUNET_HashCode));
-      iptr = GNUNET_malloc(sizeof(int));
-      *iptr = i;
+                           crc);
+      if (crc->i == 0)
+       {
+         crc->phase = RP_DELVALIDATE;
+         crc->i = 256;  
+       }
+      break;
+    case RP_DELVALIDATE:
+      crc->i--;
+      memset (&crc->key, 256 - crc->i, sizeof (GNUNET_HashCode));
       GNUNET_DATASTORE_get (datastore, 
-                           &key,
-                           get_type (i),
+                           &crc->key,
+                           get_type (crc->i),
                            &check_nothing,
-                           iptr);
-    }
+                           crc);
+      if (crc->i == 0)
+       {
+         crc->phase = RP_DONE;   
+       }
+      break;
   /* check reservations */
-
   /* check update */
-
   /* test multiple results */
+    case RP_DONE:
+      GNUNET_DATASTORE_disconnect (datastore, GNUNET_YES);
+      ok = 0;
+    }
+}
+
+
+static void
+run (void *cls,
+     struct GNUNET_SCHEDULER_Handle *sched,
+     char *const *args,
+     const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg)
+{
+  struct CpsRunContext *crc;
+
+  crc = GNUNET_malloc(sizeof(struct CpsRunContext));
+  crc->sched = sched;
+  crc->cfg = cfg;
+  crc->phase = RP_PUT;
+  now.value = 1000000;
+  datastore = GNUNET_DATASTORE_connect (cfg, sched);
+  GNUNET_SCHEDULER_add_continuation (crc->sched,
+                                    GNUNET_NO,
+                                    &run_continuation,
+                                    crc,
+                                    GNUNET_SCHEDULER_REASON_PREREQ_DONE);
 
-  GNUNET_DATASTORE_disconnect (datastore, GNUNET_YES);
 }
 
 
@@ -250,7 +337,6 @@ run (void *cls,
 static int
 check ()
 {
-  int ok = 1 + 2 + 4 + 8;
   pid_t pid;
   char *const argv[] = { "test-datastore-api",
     "-c",
@@ -272,7 +358,7 @@ check ()
   sleep (1);
   GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
                       argv, "test-datastore-api", "nohelp",
-                      options, &run, &ok);
+                      options, &run, NULL);
   if (0 != PLIBC_KILL (pid, SIGTERM))
     {
       GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
index 10b2157d3cb06735b6b9e6a640579dcdd05f03f1..2dcc153e6cfc722dd621456fb97e46b092f3178d 100644 (file)
@@ -122,6 +122,7 @@ GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h,
  * @param priority priority of the content
  * @param anonymity anonymity-level for the content
  * @param expiration expiration time for the content
+ * @param timeout timeout for the operation
  * @param cont continuation to call when done
  * @param cont_cls closure for cont
  */
@@ -135,6 +136,7 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h,
                       uint32_t priority,
                       uint32_t anonymity,
                       struct GNUNET_TIME_Absolute expiration,
+                      struct GNUNET_TIME_Relative timeout,
                      GNUNET_DATASTORE_ContinuationWithStatus cont,
                      void *cont_cls);
 
index 792f777edc84d08d9aa1c3f2cf2bd40de9157bbc..629e355ad34b76184cf0160824a5389504ce66a4 100644 (file)
@@ -1683,7 +1683,7 @@ libgnunet_plugin_transport_tcp_init (void *cls)
   unsigned long long aport;
   unsigned long long bport;
 
-  service = GNUNET_SERVICE_start ("tcp", env->sched, env->cfg);
+  service = GNUNET_SERVICE_start ("transport-tcp", env->sched, env->cfg);
   if (service == NULL)
     {
       GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
@@ -1696,13 +1696,13 @@ libgnunet_plugin_transport_tcp_init (void *cls)
   aport = 0;
   if ((GNUNET_OK !=
        GNUNET_CONFIGURATION_get_value_number (env->cfg,
-                                              "tcp",
+                                              "transport-tcp",
                                               "PORT",
                                               &bport)) ||
       (bport > 65535) ||
       ((GNUNET_OK ==
         GNUNET_CONFIGURATION_get_value_number (env->cfg,
-                                               "tcp",
+                                               "transport-tcp",
                                                "ADVERTISED-PORT",
                                                &aport)) && (aport > 65535)))
     {
@@ -1710,7 +1710,7 @@ libgnunet_plugin_transport_tcp_init (void *cls)
                        "tcp",
                        _
                        ("Require valid port number for service `%s' in configuration!\n"),
-                       "tcp");
+                       "transport-tcp");
       GNUNET_SERVICE_stop (service);
       return NULL;
     }
index 0fa611350548bb1b82917e04fddb29dc27191bc7..518f0d09de3ae6dad7e895726615981a5a816c0f 100644 (file)
@@ -14,7 +14,7 @@ PORT = 2366
 [statistics]
 PORT = 2367
 
-[tcp]
+[transport-tcp]
 PORT = 2368
 
 [peerinfo]
index dcc0ab4cf7a7173450fa3d990e2cfaf3946c7518..46d7ceec9cd662b071e5219ea9aabcf479cade25 100644 (file)
@@ -15,7 +15,7 @@ PORT = 12366
 [statistics]
 PORT = 12367
 
-[tcp]
+[transport-tcp]
 PORT = 12368
 
 [peerinfo]
index 8567c6ac830b28bd0ea12c737bed836c001e74fd..f980fbe1bebe473d36bb6a3d479caec9e3593bd0 100644 (file)
@@ -15,7 +15,7 @@ PORT = 22366
 [statistics]
 PORT = 22367
 
-[tcp]
+[transport-tcp]
 PORT = 22368
 
 [peerinfo]
index df6e5df8a88bdaf1719734e7ea7ce429ebc36f24..a7e4a08658ea948f11d83ea9ca3c40702679a625 100644 (file)
@@ -981,16 +981,19 @@ GNUNET_DISK_file_open (const char *fn, int flags, ...)
   char *expfn;
   struct GNUNET_IO_Handle *ret;
 #ifdef MINGW
-  DWORD access, disp;
+  DWORD access;
+  DWORD disp;
   HANDLE h;
 #else
-  int oflags, mode;
+  int oflags;
+  int mode;
   int fd;
 #endif
 
   expfn = GNUNET_STRINGS_filename_expand (fn);
 
 #ifndef MINGW
+  mode = 0;
   oflags = 0;
   if (GNUNET_DISK_OPEN_READWRITE == (flags & GNUNET_DISK_OPEN_READWRITE))
     oflags = O_RDWR; /* note: O_RDWR is NOT always O_RDONLY | O_WRONLY */
@@ -1020,7 +1023,6 @@ GNUNET_DISK_file_open (const char *fn, int flags, ...)
       perm = va_arg (arg, int);
       va_end (arg);
 
-      mode = 0;
       if (perm & GNUNET_DISK_PERM_USER_READ)
         mode |= S_IRUSR;
       if (perm & GNUNET_DISK_PERM_USER_WRITE)