gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r6272 - in GNUnet: . contrib libltdl m4 src/applications sr


From: gnunet
Subject: [GNUnet-SVN] r6272 - in GNUnet: . contrib libltdl m4 src/applications src/applications/hostlist
Date: Tue, 12 Feb 2008 23:54:58 -0700 (MST)

Author: grothoff
Date: 2008-02-12 23:54:57 -0700 (Tue, 12 Feb 2008)
New Revision: 6272

Added:
   GNUnet/src/applications/hostlist/
   GNUnet/src/applications/hostlist/Makefile.am
   GNUnet/src/applications/hostlist/hostlist.c
Modified:
   GNUnet/ChangeLog
   GNUnet/configure.ac
   GNUnet/contrib/config-daemon.scm
   GNUnet/libltdl/aclocal.m4
   GNUnet/libltdl/configure
   GNUnet/libltdl/install-sh
   GNUnet/m4/Makefile.in
   GNUnet/src/applications/Makefile.am
   GNUnet/todo
Log:
hostlist

Modified: GNUnet/ChangeLog
===================================================================
--- GNUnet/ChangeLog    2008-02-13 05:46:57 UTC (rev 6271)
+++ GNUnet/ChangeLog    2008-02-13 06:54:57 UTC (rev 6272)
@@ -1,3 +1,7 @@
+Tue Feb 12 23:54:34 MST 2008
+       First shot at integrated hostlist HTTP server based
+       on libmicrohttpd.
+
 Sat Feb  9 22:06:23 MST 2008
        Minor changes to the ECRS/FSUI APIs for searches
        (no more timeouts and/or max-results).  Clients who

Modified: GNUnet/configure.ac
===================================================================
--- GNUnet/configure.ac 2008-02-13 05:46:57 UTC (rev 6271)
+++ GNUnet/configure.ac 2008-02-13 06:54:57 UTC (rev 6272)
@@ -868,6 +868,7 @@
 src/applications/fs/uritrack/Makefile
 src/applications/fs/tools/Makefile
 src/applications/getoption/Makefile
+src/applications/hostlist/Makefile
 src/applications/identity/Makefile
 src/applications/kvstore_sqlite/Makefile
 src/applications/pingpong/Makefile

Modified: GNUnet/contrib/config-daemon.scm
===================================================================
--- GNUnet/contrib/config-daemon.scm    2008-02-13 05:46:57 UTC (rev 6271)
+++ GNUnet/contrib/config-daemon.scm    2008-02-13 06:54:57 UTC (rev 6272)
@@ -375,6 +375,8 @@
 
 fs: needed for anonymous file sharing. You should always load this module.
 
+hostlist: integrated hostlist HTTP server.  Useful if you want to offer a 
hostlist and running Apache would be overkill.
+
 chat: broadcast chat (demo-application, ALPHA quality).        Required for 
gnunet-chat.  Note that the current implementation of chat is not considered to 
be secure.
 
 tbench: benchmark transport performance.  Required for gnunet-tbench.  Note 
that tbench allows other users to abuse your resources.
@@ -383,7 +385,7 @@
   '()
   #t
   "advertising getoption fs stats traffic"
-  (list "MC" "advertising" "getoption" "fs" "stats" "traffic" "dht" "tracekit" 
"tbench" "vpn" "chat")
+  (list "MC" "advertising" "getoption" "fs" "hostlist" "stats" "traffic" "dht" 
"tracekit" "tbench" "vpn" "chat")
   'always) )
  
 
@@ -461,6 +463,18 @@
  (cons 1 65535)
  'advanced) )
 
+(define (hostlist-port builder)
+ (builder
+ "HOSTLIST"
+ "PORT"
+ (_ "Port for the integrated hostlist HTTP server")
+ (nohelp)
+ '()
+ #t
+ 8080
+ (cons 1 65535)
+ 'hostlist-loaded) )
+
 (define (network-trusted builder)
  (builder
  "NETWORK"
@@ -539,6 +553,7 @@
   (_ "Settings that change the behavior of GNUnet in general")
   (list 
     (network-port builder) 
+    (hostlist-port builder)
     (network-trusted builder) 
     (general-hostlisturl builder)
     (general-hosts builder)
@@ -1455,6 +1470,7 @@
      (http-port-nz (eq? (get-option ctx "HTTP" "PORT") 0) )
      (mysql (string= (get-option ctx "MODULES" "sqstore") "sqstore_mysql") )
      (fs-loaded (list? (member "fs" (string-split (get-option ctx "GNUNETD" 
"APPLICATIONS") #\  ) ) ) )
+     (hostlist-loaded (list? (member "hostlist" (string-split (get-option ctx 
"GNUNETD" "APPLICATIONS") #\  ) ) ) )
      (nat-loaded (list? (member "nat" (string-split (get-option ctx "GNUNETD" 
"TRANSPORTS") #\  ) ) ) )
      (tcp-loaded (list? (member "tcp" (string-split (get-option ctx "GNUNETD" 
"TRANSPORTS") #\  ) ) ) )
      (udp-loaded (list? (member "udp" (string-split (get-option ctx "GNUNETD" 
"TRANSPORTS") #\  ) ) ) )
@@ -1473,6 +1489,7 @@
             ((eq? i 'f2fr)         (change-visible ctx a b f2fr))
             ((eq? i 'mysql)        (change-visible ctx a b mysql))
             ((eq? i 'fs-loaded)    (change-visible ctx a b fs-loaded))
+            ((eq? i 'hostlist-loaded)    (change-visible ctx a b 
hostlist-loaded))
             ((eq? i 'nat-unlimited)(change-visible ctx a b nat-unlimited))
             ((eq? i 'tcp-port-nz)  (change-visible ctx a b tcp-port-nz))
             ((eq? i 'udp-port-nz)  (change-visible ctx a b udp-port-nz))

Modified: GNUnet/libltdl/aclocal.m4
===================================================================
--- GNUnet/libltdl/aclocal.m4   2008-02-13 05:46:57 UTC (rev 6271)
+++ GNUnet/libltdl/aclocal.m4   2008-02-13 06:54:57 UTC (rev 6272)
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.10 -*- Autoconf -*-
+# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006  Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # 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.
@@ -11,12 +11,15 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
-m4_if(m4_PACKAGE_VERSION, [2.61],,
-[m4_fatal([this file was generated for autoconf 2.61.
-You have another version of autoconf.  If you want to use that,
-you should regenerate the build system entirely.], [63])])
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(AC_AUTOCONF_VERSION, [2.61],,
+[m4_warning([this file was generated for autoconf 2.61.
+You have another version of autoconf.  It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically 
`autoreconf'.])])
 
-# Copyright (C) 2002, 2003, 2005, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 2006, 2007  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -31,7 +34,7 @@
 [am__api_version='1.10'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.10], [],
+m4_if([$1], [1.10.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -47,8 +50,10 @@
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.10])dnl
-_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
+[AM_AUTOMAKE_VERSION([1.10.1])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
@@ -320,7 +325,7 @@
   # each Makefile.in and add a new line on top of each file to say so.
   # Grep'ing the whole file is not good either: AIX grep has a line
   # limit of 2048, but all sed's we know have understand at least 4000.
-  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
+  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 
2>&1; then
     dirpart=`AS_DIRNAME("$mf")`
   else
     continue
@@ -380,13 +385,13 @@
 # Do all the work for Automake.                             -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006 Free Software Foundation, Inc.
+# 2005, 2006, 2008 Free Software Foundation, Inc.
 #
 # 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 12
+# serial 13
 
 # This macro actually does too much.  Some checks are only needed if
 # your package does certain things.  But this isn't really a big deal.
@@ -491,16 +496,17 @@
 # our stamp files there.
 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
 [# Compute $1's index in $config_headers.
+_am_arg=$1
 _am_stamp_count=1
 for _am_header in $config_headers :; do
   case $_am_header in
-    $1 | $1:* )
+    $_am_arg | $_am_arg:* )
       break ;;
     * )
       _am_stamp_count=`expr $_am_stamp_count + 1` ;;
   esac
 done
-echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+echo "timestamp for $_am_arg" 
>`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
 # Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
 #
@@ -772,7 +778,7 @@
 
 # _AM_SUBST_NOTMAKE(VARIABLE)
 # ---------------------------
-# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in.
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
 # This macro is traced by Automake.
 AC_DEFUN([_AM_SUBST_NOTMAKE])
 

Modified: GNUnet/libltdl/configure
===================================================================
--- GNUnet/libltdl/configure    2008-02-13 05:46:57 UTC (rev 6271)
+++ GNUnet/libltdl/configure    2008-02-13 06:54:57 UTC (rev 6272)
@@ -23390,21 +23390,22 @@
   fi
   rm -f "$tmp/out12"
 # Compute $ac_file's index in $config_headers.
+_am_arg=$ac_file
 _am_stamp_count=1
 for _am_header in $config_headers :; do
   case $_am_header in
-    $ac_file | $ac_file:* )
+    $_am_arg | $_am_arg:* )
       break ;;
     * )
       _am_stamp_count=`expr $_am_stamp_count + 1` ;;
   esac
 done
-echo "timestamp for $ac_file" >`$as_dirname -- $ac_file ||
-$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X$ac_file : 'X\(//\)[^/]' \| \
-        X$ac_file : 'X\(//\)$' \| \
-        X$ac_file : 'X\(/\)' \| . 2>/dev/null ||
-echo X$ac_file |
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$_am_arg" : 'X\(//\)[^/]' \| \
+        X"$_am_arg" : 'X\(//\)$' \| \
+        X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$_am_arg" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
            s//\1/
            q
@@ -23441,7 +23442,7 @@
   # each Makefile.in and add a new line on top of each file to say so.
   # Grep'ing the whole file is not good either: AIX grep has a line
   # limit of 2048, but all sed's we know have understand at least 4000.
-  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
+  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 
2>&1; then
     dirpart=`$as_dirname -- "$mf" ||
 $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
         X"$mf" : 'X\(//\)[^/]' \| \

Modified: GNUnet/libltdl/install-sh
===================================================================
--- GNUnet/libltdl/install-sh   2008-02-13 05:46:57 UTC (rev 6271)
+++ GNUnet/libltdl/install-sh   2008-02-13 06:54:57 UTC (rev 6272)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2006-10-14.15
+scriptversion=2006-12-25.00
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -48,7 +48,7 @@
 # set DOITPROG to echo to test this script
 
 # Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
+doit=${DOITPROG-}
 if test -z "$doit"; then
   doit_exec=exec
 else
@@ -58,34 +58,49 @@
 # Put in absolute file names if you don't have them in your path;
 # or use environment vars.
 
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
 
-posix_glob=
+posix_glob='?'
+initialize_posix_glob='
+  test "$posix_glob" != "?" || {
+    if (set -f) 2>/dev/null; then
+      posix_glob=
+    else
+      posix_glob=:
+    fi
+  }
+'
+
 posix_mkdir=
 
 # Desired mode of installed file.
 mode=0755
 
+chgrpcmd=
 chmodcmd=$chmodprog
 chowncmd=
-chgrpcmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
 stripcmd=
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
+
 src=
 dst=
 dir_arg=
-dstarg=
+dst_arg=
+
+copy_on_change=false
 no_target_directory=
 
-usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
    or: $0 [OPTION]... SRCFILES... DIRECTORY
    or: $0 [OPTION]... -t DIRECTORY SRCFILES...
    or: $0 [OPTION]... -d DIRECTORIES...
@@ -95,65 +110,55 @@
 In the 4th, create DIRECTORIES.
 
 Options:
--c         (ignored)
--d         create directories instead of installing files.
--g GROUP   $chgrpprog installed files to GROUP.
--m MODE    $chmodprog installed files to MODE.
--o USER    $chownprog installed files to USER.
--s         $stripprog installed files.
--t DIRECTORY  install into DIRECTORY.
--T         report an error if DSTFILE is a directory.
---help     display this help and exit.
---version  display version info and exit.
+     --help     display this help and exit.
+     --version  display version info and exit.
 
+  -c            (ignored)
+  -C            install only if different (preserve the last data modification 
time)
+  -d            create directories instead of installing files.
+  -g GROUP      $chgrpprog installed files to GROUP.
+  -m MODE       $chmodprog installed files to MODE.
+  -o USER       $chownprog installed files to USER.
+  -s            $stripprog installed files.
+  -t DIRECTORY  install into DIRECTORY.
+  -T            report an error if DSTFILE is a directory.
+
 Environment variables override the default commands:
-  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+  RMPROG STRIPPROG
 "
 
 while test $# -ne 0; do
   case $1 in
-    -c) shift
-        continue;;
+    -c) ;;
 
-    -d) dir_arg=true
-        shift
-        continue;;
+    -C) copy_on_change=true;;
 
+    -d) dir_arg=true;;
+
     -g) chgrpcmd="$chgrpprog $2"
-        shift
-        shift
-        continue;;
+       shift;;
 
     --help) echo "$usage"; exit $?;;
 
     -m) mode=$2
-        shift
-        shift
        case $mode in
          *' '* | *'    '* | *'
 '*       | *'*'* | *'?'* | *'['*)
            echo "$0: invalid mode: $mode" >&2
            exit 1;;
        esac
-        continue;;
+       shift;;
 
     -o) chowncmd="$chownprog $2"
-        shift
-        shift
-        continue;;
+       shift;;
 
-    -s) stripcmd=$stripprog
-        shift
-        continue;;
+    -s) stripcmd=$stripprog;;
 
-    -t) dstarg=$2
-       shift
-       shift
-       continue;;
+    -t) dst_arg=$2
+       shift;;
 
-    -T) no_target_directory=true
-       shift
-       continue;;
+    -T) no_target_directory=true;;
 
     --version) echo "$0 $scriptversion"; exit $?;;
 
@@ -165,21 +170,22 @@
 
     *)  break;;
   esac
+  shift
 done
 
-if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
   # When -d is used, all remaining arguments are directories to create.
   # When -t is used, the destination is already specified.
   # Otherwise, the last argument is the destination.  Remove it from 
address@hidden
   for arg
   do
-    if test -n "$dstarg"; then
+    if test -n "$dst_arg"; then
       # $@ is not empty: it contains at least $arg.
-      set fnord "$@" "$dstarg"
+      set fnord "$@" "$dst_arg"
       shift # fnord
     fi
     shift # arg
-    dstarg=$arg
+    dst_arg=$arg
   done
 fi
 
@@ -224,7 +230,7 @@
 do
   # Protect names starting with `-'.
   case $src in
-    -*) src=./$src ;;
+    -*) src=./$src;;
   esac
 
   if test -n "$dir_arg"; then
@@ -242,22 +248,22 @@
       exit 1
     fi
 
-    if test -z "$dstarg"; then
+    if test -z "$dst_arg"; then
       echo "$0: no destination specified." >&2
       exit 1
     fi
 
-    dst=$dstarg
+    dst=$dst_arg
     # Protect names starting with `-'.
     case $dst in
-      -*) dst=./$dst ;;
+      -*) dst=./$dst;;
     esac
 
     # If destination is a directory, append the input filename; won't work
     # if double slashes aren't ignored.
     if test -d "$dst"; then
       if test -n "$no_target_directory"; then
-       echo "$0: $dstarg: Is a directory" >&2
+       echo "$0: $dst_arg: Is a directory" >&2
        exit 1
       fi
       dstdir=$dst
@@ -378,26 +384,19 @@
       # directory the slow way, step by step, checking for races as we go.
 
       case $dstdir in
-       /*) prefix=/ ;;
-       -*) prefix=./ ;;
-       *)  prefix= ;;
+       /*) prefix='/';;
+       -*) prefix='./';;
+       *)  prefix='';;
       esac
 
-      case $posix_glob in
-        '')
-         if (set -f) 2>/dev/null; then
-           posix_glob=true
-         else
-           posix_glob=false
-         fi ;;
-      esac
+      eval "$initialize_posix_glob"
 
       oIFS=$IFS
       IFS=/
-      $posix_glob && set -f
+      $posix_glob set -f
       set fnord $dstdir
       shift
-      $posix_glob && set +f
+      $posix_glob set +f
       IFS=$oIFS
 
       prefixes=
@@ -459,42 +458,55 @@
     # ignore errors from any of these, just make sure not to ignore
     # errors from the above "$doit $cpprog $src $dsttmp" command.
     #
-    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
-      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
-      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
-      && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
 
-    # Now rename the file to the real destination.
-    { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
-      || {
-          # The rename failed, perhaps because mv can't rename something else
-          # to itself, or perhaps because mv is so ancient that it does not
-          # support -f.
+    # If -C, don't bother to copy if it wouldn't change the file.
+    if $copy_on_change &&
+       old=`LC_ALL=C ls -dlL "$dst"    2>/dev/null` &&
+       new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
 
-          # Now remove or move aside any old file at destination location.
-          # We try this two ways since rm can't unlink itself on some
-          # systems and the destination file might be busy for other
-          # reasons.  In this case, the final cleanup might fail but the new
-          # file should still install successfully.
-          {
-            if test -f "$dst"; then
-              $doit $rmcmd -f "$dst" 2>/dev/null \
-              || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
-                    && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
-              || {
-                echo "$0: cannot unlink or rename $dst" >&2
-                (exit 1); exit 1
-              }
-            else
-              :
-            fi
-          } &&
+       eval "$initialize_posix_glob" &&
+       $posix_glob set -f &&
+       set X $old && old=:$2:$4:$5:$6 &&
+       set X $new && new=:$2:$4:$5:$6 &&
+       $posix_glob set +f &&
 
-          # Now rename the file to the real destination.
-          $doit $mvcmd "$dsttmp" "$dst"
-        }
-    } || exit 1
+       test "$old" = "$new" &&
+       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+    then
+      rm -f "$dsttmp"
+    else
+      # Rename the file to the real destination.
+      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
 
+      # The rename failed, perhaps because mv can't rename something else
+      # to itself, or perhaps because mv is so ancient that it does not
+      # support -f.
+      {
+       # Now remove or move aside any old file at destination location.
+       # We try this two ways since rm can't unlink itself on some
+       # systems and the destination file might be busy for other
+       # reasons.  In this case, the final cleanup might fail but the new
+       # file should still install successfully.
+       {
+         test ! -f "$dst" ||
+         $doit $rmcmd -f "$dst" 2>/dev/null ||
+         { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+           { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+         } ||
+         { echo "$0: cannot unlink or rename $dst" >&2
+           (exit 1); exit 1
+         }
+       } &&
+
+       # Now rename the file to the real destination.
+       $doit $mvcmd "$dsttmp" "$dst"
+      }
+    fi || exit 1
+
     trap '' 0
   fi
 done

Modified: GNUnet/m4/Makefile.in
===================================================================
--- GNUnet/m4/Makefile.in       2008-02-13 05:46:57 UTC (rev 6271)
+++ GNUnet/m4/Makefile.in       2008-02-13 06:54:57 UTC (rev 6272)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.

Modified: GNUnet/src/applications/Makefile.am
===================================================================
--- GNUnet/src/applications/Makefile.am 2008-02-13 05:46:57 UTC (rev 6271)
+++ GNUnet/src/applications/Makefile.am 2008-02-13 06:54:57 UTC (rev 6272)
@@ -10,6 +10,10 @@
  VPN_DIR = vpn
 endif
 
+if HAVE_MHD
+ HOSTLIST_DIR = hostlist
+endif
+
 SUBDIRS        = \
  identity \
  bootstrap_http \
@@ -17,6 +21,7 @@
  rpc \
  fragmentation \
  getoption \
+ $(HOSTLIST_DIR) \
  state \
  stats \
  pingpong \

Added: GNUnet/src/applications/hostlist/Makefile.am
===================================================================
--- GNUnet/src/applications/hostlist/Makefile.am                                
(rev 0)
+++ GNUnet/src/applications/hostlist/Makefile.am        2008-02-13 06:54:57 UTC 
(rev 6272)
@@ -0,0 +1,18 @@
+INCLUDES = -I$(top_srcdir)/src/include
+
+plugindir = $(libdir)/GNUnet
+
+LDADD = \
+  $(top_builddir)/src/util/libgnunetutil.la 
+
+plugin_LTLIBRARIES = \
+  libgnunetmodule_hostlist.la
+
+
+libgnunetmodule_hostlist_la_SOURCES = \
+  hostlist.c
+libgnunetmodule_hostlist_la_LIBADD = \
+  $(top_builddir)/src/util/libgnunetutil.la 
+libgnunetmodule_hostlist_la_LDFLAGS = \
+  -export-dynamic -avoid-version -module
+

Added: GNUnet/src/applications/hostlist/hostlist.c
===================================================================
--- GNUnet/src/applications/hostlist/hostlist.c                         (rev 0)
+++ GNUnet/src/applications/hostlist/hostlist.c 2008-02-13 06:54:57 UTC (rev 
6272)
@@ -0,0 +1,209 @@
+/*
+     This file is part of GNUnet.
+     (C) 2008 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 2, 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 applications/hostlist/hostlist.c
+ * @author Christian Grothoff
+ * @brief application to provide an integrated hostlist HTTP server
+ */
+
+#include "platform.h"
+#include <microhttpd.h>
+#include "gnunet_identity_service.h"
+#include "gnunet_stats_service.h"
+
+#define DEBUG_HOSTLIST GNUNET_NO
+
+static struct MHD_Daemon * daemon;
+
+static GNUNET_CoreAPIForPlugins *coreAPI;
+
+static GNUNET_Identity_ServiceAPI *identity;
+
+static GNUNET_Stats_ServiceAPI *stats;
+
+static int stat_request_count;
+
+static int
+accept_policy_callback(void * cls,
+                      const struct sockaddr * addr,
+                      socklen_t addrlen)
+{
+  return MHD_YES; /* accept all */
+}
+
+/**
+ * Context for host processor.
+ */ 
+struct HostSet {
+  /**
+   * Bitmap describing acceptable protocols.
+   */
+  unsigned long long protocols;
+
+  unsigned int size;
+
+  unsigned char * data;
+};
+
+static int
+host_processor (const GNUNET_PeerIdentity * identity,
+               unsigned short protocol,
+               int confirmed, void *data)
+{
+  struct HostSet * results = data;
+  GNUNET_MessageHello * hello;
+  unsigned int old;
+
+  if ( (GNUNET_YES != confirmed) ||
+       ((results->protocols & (1LL << protocol)) == 0) )
+    return GNUNET_OK;
+  hello = identity->identity2Hello(identity,
+                                  protocol,
+                                  GNUNET_NO);
+  if (hello == NULL)
+    return GNUNET_OK;
+  old = results->size;
+  GNUNET_grow(results->data,
+             results->size,
+             results->size + ntohs(hello->header.size));
+  memcpy(&results->data[old],
+        hello,
+        ntohs(hello->header.size));
+  GNUNET_free(hello);
+  return GNUNET_OK;
+}
+
+static int
+access_handler_callback(void *cls,
+                       struct MHD_Connection * connection,
+                       const char *url,
+                       const char *method,
+                       const char *version,
+                       const char *upload_data,
+                       unsigned int *upload_data_size,
+                       void **con_cls)
+{
+  static int dummy;
+  struct MHD_Response * response;
+  struct HostSet results;  
+
+  if (0 != strcmp(method, MHD_HTTP_METHOD_GET))
+    return MHD_NO;
+  if (NULL == *con_cls)
+    {
+      (*con_cls) = &dummy;
+      return MHD_YES; /* send 100 continue */
+    }
+  if (*upload_data_size != 0)
+    return MHD_NO; /* do not support upload data */
+  memset(results, 0, sizeof(struct HostSet));
+  results.protocols = -1; /* for now */
+  identity->forEachHost(GNUNET_get_time(), &host_processor, &results);
+  if (results.size == 0)
+    return MHD_NO; /* no known hosts!? */
+  response = MHD_create_response_from_data(results.size,
+                                          results.data,
+                                          MHD_YES,
+                                          MHD_NO);
+  MHD_queue_response(connection,
+                    MHD_HTTP_OK,
+                    response);
+  MHD_destroy_response(response);  
+  return MHD_NO;
+}
+
+/**
+ * Initialize the hostlist module. This method name must match
+ * the library name (libgnunet_XXX => initialize_XXX).
+ * @return GNUNET_SYSERR on errors
+ */
+int
+initialize_module_hostlist (GNUNET_CoreAPIForPlugins * capi)
+{
+  int ok = GNUNET_OK;
+  unsigned long long port;
+
+  if (-1 == GNUNET_GC_get_configuration_value_number (capi->cfg,
+                                                      "HOSTLIST",
+                                                      "PORT", 0, 65535, 8080,
+                                                      &port))
+    return GNUNET_SYSERR; 
+  identity = capi->request_service ("identity");
+  if (identity == NULL)
+    {
+      GNUNET_GE_BREAK (ectx, 0);
+      return GNUNET_SYSERR;
+    }
+  coreAPI = capi;
+  stats = capi->request_service ("stats");
+  if (stats != NULL)
+    {
+      stat_request_count
+        stats->create (gettext_noop ("# hostlist requests received"));
+    }
+  daemon = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY | MHD_USE_IPv6,
+                           (unsigned short) port,
+                           &accept_policy_callback,
+                           NULL,
+                           &access_handler_callback,
+                           NULL,
+                           MHD_OPTION_CONNECTION_LIMIT, 16,
+                           MHD_OPTION_CONNECTION_PER_IP_CONNECTION_LIMIT, 1,
+                           MHD_OPTION_CONNECTION_TIMEOUT, 16,
+                           MHD_OPTION_CONNECTION_MEMORY_LIMIT, 16 * 1024,
+                           MHD_OPTION_END);
+  if (daemon == NULL)
+    {
+      if (stats != NULL)
+       {
+         coreAPI->release_service (stats);
+         stats = NULL;
+       }
+      coreAPI->release_service (identity);
+      identity = NULL;
+      return GNUNET_SYSERR;
+    }
+  GNUNET_GE_ASSERT (capi->ectx,
+                    0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
+                                                                   capi->ectx,
+                                                                   "ABOUT",
+                                                                   "hostlist",
+                                                                   gettext_noop
+                                                                   
("integrated HTTP hostlist server")));
+  return ok;
+}
+
+void
+done_module_hostlist ()
+{
+  MHD_stop_daemon(daemon);
+  daemon = NULL;
+  if (stats != NULL)
+    {
+      coreAPI->release_service (stats);
+      stats = NULL;
+    }
+  coreAPI->release_service (identity);
+  identity = NULL;
+  coreAPI = NULL;
+}
+
+/* end of hostlist.c */


Property changes on: GNUnet/src/applications/hostlist/hostlist.c
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2008-02-13 05:46:57 UTC (rev 6271)
+++ GNUnet/todo 2008-02-13 06:54:57 UTC (rev 6272)
@@ -5,8 +5,22 @@
 
 0.7.4 [4'08] (aka "fix search"):
 - modify datastore to return diverse subsets of large response sets,
-  except when processing for loopback! [RC]
-- make sure core polls whenever outbound bandwidth is available [RC]
+  except when processing for loopback [RC]
+  IDEA: do pre-pass over result set, count # number; then LIMIT with OFFSET 
+        by RAND(total) for the first result and then wrap around
+        to the beginning if the iterator reaches total.
+        + reasonably fast for arbitrary large result sets
+        - except measureable slowdown (?) for result sets of size 1?)
+        + equal chance to get any result first
+        + no need for threads per multi-result query
+        - non-trivial code required in every sqstore implementation
+        o testable, but not trivial to test fully
+- modify gap.c to NOT do full iteration over result set (current code
+  might take forever; add bound in # replies (prio+1?) and 
+  # iterations (10*(prio+1)?)done!)
+- fix pid-table assertion crash (rare, produced with linear-gap test) [RC]
+- tune GAP query planning code [RC]
+- reenable and test GAP migration code [RC]
 - complete IPv4/IPv6 integration of transports (http is missing!) [RC]
 - integrated hostlist server application using libmicrohttpd [RC]
 - Insert/Index a "shared directory" automatically [Nils]





reply via email to

[Prev in Thread] Current Thread [Next in Thread]