[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3011 - in GNUnet: . src/include src/util src/util/config s
From: |
grothoff |
Subject: |
[GNUnet-SVN] r3011 - in GNUnet: . src/include src/util src/util/config src/util/config/.deps src/util/config/.libs src/util/config_impl src/util/config_impl/.deps src/util/config_impl/.libs src/util/containers src/util/containers/.deps src/util/crypto src/util/crypto/.deps src/util/error src/util/error/.deps src/util/error/.libs src/util/loggers src/util/loggers/.deps src/util/loggers/.libs |
Date: |
Thu, 15 Jun 2006 09:50:22 -0700 (PDT) |
Author: grothoff
Date: 2006-06-15 09:49:28 -0700 (Thu, 15 Jun 2006)
New Revision: 3011
Added:
GNUnet/src/include/gnunet_util_config.h
GNUnet/src/include/gnunet_util_config_impl.h
GNUnet/src/include/gnunet_util_containers.h
GNUnet/src/include/gnunet_util_crypto.h
GNUnet/src/include/gnunet_util_error.h
GNUnet/src/include/gnunet_util_error_loggers.h
GNUnet/src/util/README
GNUnet/src/util/config/
GNUnet/src/util/config/.deps/
GNUnet/src/util/config/.deps/config.Plo
GNUnet/src/util/config/.libs/
GNUnet/src/util/config/.libs/libconfig.a
GNUnet/src/util/config/Makefile
GNUnet/src/util/config/Makefile.am
GNUnet/src/util/config/Makefile.in
GNUnet/src/util/config/config.c
GNUnet/src/util/config_impl/
GNUnet/src/util/config_impl/.deps/
GNUnet/src/util/config_impl/.deps/impl.Plo
GNUnet/src/util/config_impl/.libs/
GNUnet/src/util/config_impl/.libs/libgnunetconfig.lai
GNUnet/src/util/config_impl/.libs/libgnunetconfig.so
GNUnet/src/util/config_impl/.libs/libgnunetconfig.so.0
GNUnet/src/util/config_impl/.libs/libgnunetconfig.so.0.0.0
GNUnet/src/util/config_impl/Makefile
GNUnet/src/util/config_impl/Makefile.am
GNUnet/src/util/config_impl/Makefile.in
GNUnet/src/util/config_impl/configtest.c
GNUnet/src/util/config_impl/impl.c
GNUnet/src/util/containers/
GNUnet/src/util/containers/.deps/
GNUnet/src/util/containers/.deps/bloomfilter.Plo
GNUnet/src/util/containers/.deps/bloomtest.Po
GNUnet/src/util/containers/.deps/hashtable.Plo
GNUnet/src/util/containers/.deps/hashtabletest.Po
GNUnet/src/util/containers/.deps/vector.Plo
GNUnet/src/util/containers/.deps/vectortest.Po
GNUnet/src/util/containers/Makefile
GNUnet/src/util/containers/Makefile.am
GNUnet/src/util/containers/Makefile.in
GNUnet/src/util/containers/bloomfilter.c
GNUnet/src/util/containers/bloomtest.c
GNUnet/src/util/containers/hashtable.c
GNUnet/src/util/containers/hashtabletest.c
GNUnet/src/util/containers/hashtest.c
GNUnet/src/util/containers/vector.c
GNUnet/src/util/containers/vectortest.c
GNUnet/src/util/crypto/
GNUnet/src/util/crypto/.deps/
GNUnet/src/util/crypto/.deps/crc32.Plo
GNUnet/src/util/crypto/.deps/crctest.Po
GNUnet/src/util/crypto/.deps/hashing.Plo
GNUnet/src/util/crypto/.deps/hashingtest.Po
GNUnet/src/util/crypto/.deps/hashtest.Po
GNUnet/src/util/crypto/.deps/hostkey_gcrypt.Plo
GNUnet/src/util/crypto/.deps/hostkeytest.Po
GNUnet/src/util/crypto/.deps/kblockkey.Plo
GNUnet/src/util/crypto/.deps/kblockkey_test.Po
GNUnet/src/util/crypto/.deps/locking_gcrypt.Plo
GNUnet/src/util/crypto/.deps/random.Plo
GNUnet/src/util/crypto/.deps/symcipher_gcrypt.Plo
GNUnet/src/util/crypto/.deps/symciphertest.Po
GNUnet/src/util/crypto/Makefile
GNUnet/src/util/crypto/Makefile.am
GNUnet/src/util/crypto/Makefile.in
GNUnet/src/util/crypto/crc32.c
GNUnet/src/util/crypto/crctest.c
GNUnet/src/util/crypto/hashing.c
GNUnet/src/util/crypto/hashingtest.c
GNUnet/src/util/crypto/hostkey_gcrypt.c
GNUnet/src/util/crypto/hostkeytest.c
GNUnet/src/util/crypto/kblockkey.c
GNUnet/src/util/crypto/kblockkey_test.c
GNUnet/src/util/crypto/locking_gcrypt.c
GNUnet/src/util/crypto/locking_gcrypt.h
GNUnet/src/util/crypto/random.c
GNUnet/src/util/crypto/symcipher_gcrypt.c
GNUnet/src/util/crypto/symciphertest.c
GNUnet/src/util/crypto/weakkeytest.c
GNUnet/src/util/endian.c
GNUnet/src/util/error/
GNUnet/src/util/error/.deps/
GNUnet/src/util/error/.deps/error.Plo
GNUnet/src/util/error/.libs/
GNUnet/src/util/error/.libs/liberror.a
GNUnet/src/util/error/Makefile
GNUnet/src/util/error/Makefile.am
GNUnet/src/util/error/Makefile.in
GNUnet/src/util/error/error.c
GNUnet/src/util/loggers/
GNUnet/src/util/loggers/.deps/
GNUnet/src/util/loggers/.deps/file.Plo
GNUnet/src/util/loggers/.deps/memory.Plo
GNUnet/src/util/loggers/.deps/multiplex.Plo
GNUnet/src/util/loggers/.libs/
GNUnet/src/util/loggers/.libs/libgnunetlogging.lai
GNUnet/src/util/loggers/.libs/libgnunetlogging.so
GNUnet/src/util/loggers/.libs/libgnunetlogging.so.0
GNUnet/src/util/loggers/.libs/libgnunetlogging.so.0.0.0
GNUnet/src/util/loggers/Makefile
GNUnet/src/util/loggers/Makefile.am
GNUnet/src/util/loggers/Makefile.in
GNUnet/src/util/loggers/file.c
GNUnet/src/util/loggers/memory.c
GNUnet/src/util/loggers/smtp.c
Removed:
GNUnet/src/include/gnunet_config.h
GNUnet/src/include/gnunet_config_impl.h
GNUnet/src/include/gnunet_error.h
GNUnet/src/util/bloomfilter.c
GNUnet/src/util/bloomtest.c
GNUnet/src/util/checksum.c
GNUnet/src/util/configtest.c
GNUnet/src/util/configuration.c
GNUnet/src/util/crctest.c
GNUnet/src/util/hashing.c
GNUnet/src/util/hashingtest.c
GNUnet/src/util/hashtable.c
GNUnet/src/util/hashtabletest.c
GNUnet/src/util/hashtest.c
GNUnet/src/util/hostkey_gcrypt.c
GNUnet/src/util/hostkeytest.c
GNUnet/src/util/identitytest.c
GNUnet/src/util/kblockkey.c
GNUnet/src/util/kblockkey_test.c
GNUnet/src/util/locking_gcrypt.c
GNUnet/src/util/locking_gcrypt.h
GNUnet/src/util/logging.c
GNUnet/src/util/random.c
GNUnet/src/util/symcipher_gcrypt.c
GNUnet/src/util/symciphertest.c
GNUnet/src/util/vector.c
GNUnet/src/util/vectortest.c
GNUnet/src/util/weakkeytest.c
Modified:
GNUnet/configure.ac
GNUnet/ltmain.sh
GNUnet/src/include/Makefile.am
GNUnet/src/include/gnunet_util.h
GNUnet/src/util/Makefile.am
GNUnet/src/util/cron.c
GNUnet/src/util/daemon.c
GNUnet/src/util/initialize.c
GNUnet/src/util/string.c
Log:
breaking everything
new error handling
new configuration handling
splitting libgnunetutil into many pieces
and not making everything else match this change
Modified: GNUnet/configure.ac
===================================================================
--- GNUnet/configure.ac 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/configure.ac 2006-06-15 16:49:28 UTC (rev 3011)
@@ -549,11 +549,16 @@
src/applications/traffic/Makefile
src/applications/transport/Makefile
src/applications/vpn/Makefile
-src/config/Makefile
src/setup/Makefile
src/server/Makefile
src/transports/Makefile
src/util/Makefile
+src/util/config/Makefile
+src/util/config_impl/Makefile
+src/util/containers/Makefile
+src/util/crypto/Makefile
+src/util/error/Makefile
+src/util/loggers/Makefile
src/util/win/Makefile
])
AC_OUTPUT
Modified: GNUnet/ltmain.sh
===================================================================
--- GNUnet/ltmain.sh 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/ltmain.sh 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,7 +1,7 @@
# ltmain.sh - Provide generalized library-building support services.
# NOTE: Changing this file will not affect anything until you rerun configure.
#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
# Free Software Foundation, Inc.
# Originally by Gordon Matzigkeit <address@hidden>, 1996
#
@@ -17,7 +17,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -43,14 +43,9 @@
PROGRAM=ltmain.sh
PACKAGE=libtool
-VERSION="1.5.22 Debian 1.5.22-4"
-TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
+VERSION=1.5.6
+TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42) Debian$Rev: 224 $"
-# See if we are running on zsh, and set the options which allow our
-# commands through without removal of \ escapes.
-if test -n "${ZSH_VERSION+set}" ; then
- setopt NO_GLOB_SUBST
-fi
# Check that we have a working $echo.
if test "X$1" = X--no-reexec; then
@@ -88,15 +83,14 @@
Xsed="${SED}"' -e 1s/^X//'
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
# test EBCDIC or ASCII
-case `echo X|tr X '\101'` in
- A) # ASCII based system
- # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
- SP2NL='tr \040 \012'
- NL2SP='tr \015\012 \040\040'
+case `echo A|tr A '\301'` in
+ A) # EBCDIC based system
+ SP2NL="tr '\100' '\n'"
+ NL2SP="tr '\r\n' '\100\100'"
;;
- *) # EBCDIC based system
- SP2NL='tr \100 \n'
- NL2SP='tr \r\n \100\100'
+ *) # Assume ASCII based system
+ SP2NL="tr '\040' '\012'"
+ NL2SP="tr '\015\012' '\040\040'"
;;
esac
@@ -113,9 +107,8 @@
fi
# Make sure IFS has a sensible default
-lt_nl='
-'
-IFS=" $lt_nl"
+: ${IFS="
+"}
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
$echo "$modename: not configured to build any kind of library" 1>&2
@@ -132,8 +125,6 @@
show="$echo"
show_help=
execute_dlfiles=
-duplicate_deps=no
-preserve_args=
lo2o="s/\\.lo\$/.${objext}/"
o2lo="s/\\.${objext}\$/.lo/"
@@ -141,51 +132,13 @@
# Shell function definitions:
# This seems to be the best place for them
-# func_mktempdir [string]
-# Make a temporary directory that won't clash with other running
-# libtool processes, and avoids race conditions if possible. If
-# given, STRING is the basename for that directory.
-func_mktempdir ()
-{
- my_template="${TMPDIR-/tmp}/${1-$progname}"
-
- if test "$run" = ":"; then
- # Return a directory name, but don't create it in dry-run mode
- my_tmpdir="${my_template}-$$"
- else
-
- # If mktemp works, use that first and foremost
- my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
-
- if test ! -d "$my_tmpdir"; then
- # Failing that, at least try and use $RANDOM to avoid a race
- my_tmpdir="${my_template}-${RANDOM-0}$$"
-
- save_mktempdir_umask=`umask`
- umask 0077
- $mkdir "$my_tmpdir"
- umask $save_mktempdir_umask
- fi
-
- # If we're not in dry-run mode, bomb out on failure
- test -d "$my_tmpdir" || {
- $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
- exit $EXIT_FAILURE
- }
- fi
-
- $echo "X$my_tmpdir" | $Xsed
-}
-
-
# func_win32_libid arg
# return the library type of file 'arg'
#
# Need a lot of goo to handle *both* DLLs and import libs
# Has to be a shell function in order to 'eat' the argument
# that is supplied when $file_magic_command is called.
-func_win32_libid ()
-{
+func_win32_libid () {
win32_libid_type="unknown"
win32_fileres=`file -L $1 2>/dev/null`
case $win32_fileres in
@@ -196,11 +149,12 @@
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
$EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
win32_nmres=`eval $NM -f posix -A $1 | \
- $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
- case $win32_nmres in
- import*) win32_libid_type="x86 archive import";;
- *) win32_libid_type="x86 archive static";;
- esac
+ sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
+ if test "X$win32_nmres" = "Ximport" ; then
+ win32_libid_type="x86 archive import"
+ else
+ win32_libid_type="x86 archive static"
+ fi
fi
;;
*DLL*)
@@ -224,8 +178,7 @@
# Only attempt this if the compiler in the base compile
# command doesn't match the default compiler.
# arg is usually of the form 'gcc ...'
-func_infer_tag ()
-{
+func_infer_tag () {
if test -n "$available_tags" && test -z "$tagname"; then
CC_quoted=
for arg in $CC; do
@@ -282,116 +235,12 @@
esac
fi
}
-
-
-# func_extract_an_archive dir oldlib
-func_extract_an_archive ()
-{
- f_ex_an_ar_dir="$1"; shift
- f_ex_an_ar_oldlib="$1"
-
- $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
- $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
- if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "$modename: ERROR: object name conflicts:
$f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
- exit $EXIT_FAILURE
- fi
-}
-
-# func_extract_archives gentop oldlib ...
-func_extract_archives ()
-{
- my_gentop="$1"; shift
- my_oldlibs=${1+"$@"}
- my_oldobjs=""
- my_xlib=""
- my_xabs=""
- my_xdir=""
- my_status=""
-
- $show "${rm}r $my_gentop"
- $run ${rm}r "$my_gentop"
- $show "$mkdir $my_gentop"
- $run $mkdir "$my_gentop"
- my_status=$?
- if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
- exit $my_status
- fi
-
- for my_xlib in $my_oldlibs; do
- # Extract the objects.
- case $my_xlib in
- [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
- *) my_xabs=`pwd`"/$my_xlib" ;;
- esac
- my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
- my_xdir="$my_gentop/$my_xlib"
-
- $show "${rm}r $my_xdir"
- $run ${rm}r "$my_xdir"
- $show "$mkdir $my_xdir"
- $run $mkdir "$my_xdir"
- exit_status=$?
- if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
- exit $exit_status
- fi
- case $host in
- *-darwin*)
- $show "Extracting $my_xabs"
- # Do not bother doing anything if just a dry run
- if test -z "$run"; then
- darwin_orig_dir=`pwd`
- cd $my_xdir || exit $?
- darwin_archive=$my_xabs
- darwin_curdir=`pwd`
- darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
- darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP
Architectures 2>/dev/null`
- if test -n "$darwin_arches"; then
- darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
- darwin_arch=
- $show "$darwin_base_archive has multiple architectures
$darwin_arches"
- for darwin_arch in $darwin_arches ; do
- mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
- lipo -thin $darwin_arch -output
"unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
"${darwin_archive}"
- cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
- func_extract_an_archive "`pwd`" "${darwin_base_archive}"
- cd "$darwin_curdir"
- $rm
"unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
- done # $darwin_arches
- ## Okay now we have a bunch of thin objects, gotta fatten them up :)
- darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name
\*.lo -print| xargs basename | sort -u | $NL2SP`
- darwin_file=
- darwin_files=
- for darwin_file in $darwin_filelist; do
- darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
- lipo -create -output "$darwin_file" $darwin_files
- done # $darwin_filelist
- ${rm}r unfat-$$
- cd "$darwin_orig_dir"
- else
- cd "$darwin_orig_dir"
- func_extract_an_archive "$my_xdir" "$my_xabs"
- fi # $darwin_arches
- fi # $run
- ;;
- *)
- func_extract_an_archive "$my_xdir" "$my_xabs"
- ;;
- esac
- my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name
\*.lo -print | $NL2SP`
- done
- func_extract_archives_result="$my_oldobjs"
-}
# End of Shell function definitions
#####################################
# Darwin sucks
eval std_shrext=\"$shrext_cmds\"
-disable_libs=no
-
# Parse our command line options once, thoroughly.
while test "$#" -gt 0
do
@@ -456,10 +305,10 @@
--version)
$echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
$echo
- $echo "Copyright (C) 2005 Free Software Foundation, Inc."
+ $echo "Copyright (C) 2003 Free Software Foundation, Inc."
$echo "This is free software; see the source for copying conditions.
There is NO"
$echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE."
- exit $?
+ exit $EXIT_SUCCESS
;;
--config)
@@ -468,7 +317,7 @@
for tagname in $taglist; do
${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END
LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
done
- exit $?
+ exit $EXIT_SUCCESS
;;
--debug)
@@ -493,7 +342,7 @@
else
$echo "disable static libraries"
fi
- exit $?
+ exit $EXIT_SUCCESS
;;
--finish) mode="finish" ;;
@@ -508,11 +357,7 @@
preserve_args="$preserve_args $arg"
;;
- --tag)
- prevopt="--tag"
- prev=tag
- preserve_args="$preserve_args --tag"
- ;;
+ --tag) prevopt="--tag" prev=tag ;;
--tag=*)
set tag "$optarg" ${1+"$@"}
shift
@@ -544,18 +389,6 @@
exit $EXIT_FAILURE
fi
-case $disable_libs in
-no)
- ;;
-shared)
- build_libtool_libs=no
- build_old_libs=yes
- ;;
-static)
- build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;;
esac`
- ;;
-esac
-
# If this variable is set in any of the actions, the command in it
# will be execed at the end. This prevents here-documents from being
# left over by shells.
@@ -566,7 +399,7 @@
# Infer the operation mode.
if test -z "$mode"; then
$echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
- $echo "*** Future versions of Libtool will require --mode=MODE be
specified." 1>&2
+ $echo "*** Future versions of Libtool will require -mode=MODE be
specified." 1>&2
case $nonopt in
*cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
mode=link
@@ -632,7 +465,7 @@
for arg
do
- case $arg_mode in
+ case "$arg_mode" in
arg )
# do not "continue". Instead, add this to base_compile
lastarg="$arg"
@@ -714,10 +547,7 @@
case $lastarg in
# Double-quote args containing other shell metacharacters.
# Many Bourne shells cannot handle close brackets correctly
- # in scan sets, and some SunOS ksh mistreat backslash-escaping
- # in scan sets (worked around with variable expansion),
- # and furthermore cannot handle '|' '&' '(' ')' in scan sets
- # at all, so we specify them separately.
+ # in scan sets, so we specify it separately.
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
lastarg="\"$lastarg\""
;;
@@ -791,14 +621,6 @@
esac
done
- qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
- case $qlibobj in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- qlibobj="\"$qlibobj\"" ;;
- esac
- test "X$libobj" != "X$qlibobj" \
- && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
- && $echo "$modename: libobj name \`$libobj' may not contain shell
special characters."
objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
if test "X$xdir" = "X$obj"; then
@@ -871,17 +693,12 @@
$run $rm $removelist
exit $EXIT_FAILURE
fi
- $echo "$srcfile" > "$lockfile"
+ $echo $srcfile > "$lockfile"
fi
if test -n "$fix_srcfile_path"; then
eval srcfile=\"$fix_srcfile_path\"
fi
- qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
- case $qsrcfile in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- qsrcfile="\"$qsrcfile\"" ;;
- esac
$run $rm "$libobj" "${libobj}T"
@@ -903,18 +720,18 @@
fbsd_hideous_sh_bug=$base_compile
if test "$pic_mode" != no; then
- command="$base_compile $qsrcfile $pic_flag"
+ command="$base_compile $srcfile $pic_flag"
else
# Don't build PIC code
- command="$base_compile $qsrcfile"
+ command="$base_compile $srcfile"
fi
if test ! -d "${xdir}$objdir"; then
$show "$mkdir ${xdir}$objdir"
$run $mkdir ${xdir}$objdir
- exit_status=$?
- if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
- exit $exit_status
+ status=$?
+ if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
+ exit $status
fi
fi
@@ -986,9 +803,9 @@
if test "$build_old_libs" = yes; then
if test "$pic_mode" != yes; then
# Don't build PIC code
- command="$base_compile $qsrcfile"
+ command="$base_compile $srcfile"
else
- command="$base_compile $qsrcfile $pic_flag"
+ command="$base_compile $srcfile $pic_flag"
fi
if test "$compiler_c_o" = yes; then
command="$command -o $obj"
@@ -1117,7 +934,6 @@
no_install=no
objs=
non_pic_objects=
- notinst_path= # paths that contain not-installed libtool libraries
precious_files_regex=
prefer_static_libs=no
preload=no
@@ -1146,15 +962,14 @@
if test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static
fi
- prefer_static_libs=yes
else
if test -z "$pic_flag" && test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static
fi
- prefer_static_libs=built
fi
build_libtool_libs=no
build_old_libs=yes
+ prefer_static_libs=yes
break
;;
esac
@@ -1329,11 +1144,6 @@
if test -z "$pic_object" || test "$pic_object" = none ; then
arg="$non_pic_object"
fi
- else
- # If the PIC object exists, use it instead.
- # $xdir was prepended to $pic_object above.
- non_pic_object="$pic_object"
- non_pic_objects="$non_pic_objects $non_pic_object"
fi
else
# Only an error if not doing a dry-run.
@@ -1417,13 +1227,6 @@
prev=
continue
;;
- darwin_framework|darwin_framework_skip)
- test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags
$arg"
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- prev=
- continue
- ;;
*)
eval "$prev=\"\$arg\""
prev=
@@ -1482,18 +1285,6 @@
continue
;;
- -framework|-arch|-isysroot)
- case " $CC " in
- *" ${arg} ${1} "* | *" ${arg} ${1} "*)
- prev=darwin_framework_skip ;;
- *) compiler_flags="$compiler_flags $arg"
- prev=darwin_framework ;;
- esac
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- continue
- ;;
-
-inst-prefix-dir)
prev=inst_prefix
continue
@@ -1520,8 +1311,7 @@
absdir=`cd "$dir" && pwd`
if test -z "$absdir"; then
$echo "$modename: cannot determine absolute directory name of
\`$dir'" 1>&2
- absdir="$dir"
- notinst_path="$notinst_path $dir"
+ exit $EXIT_FAILURE
fi
dir="$absdir"
;;
@@ -1535,15 +1325,10 @@
esac
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$dir:"*) ;;
*) dllsearchpath="$dllsearchpath:$dir";;
esac
- case :$dllsearchpath: in
- *":$testbindir:"*) ;;
- *) dllsearchpath="$dllsearchpath:$testbindir";;
- esac
;;
esac
continue
@@ -1552,15 +1337,15 @@
-l*)
if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
+ *-*-cygwin* | *-*-pw32* | *-*-beos*)
# These systems don't actually have a C or math library (as such)
continue
;;
- *-*-os2*)
+ *-*-mingw* | *-*-os2*)
# These systems don't actually have a C library (as such)
test "X$arg" = "X-lc" && continue
;;
- *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ *-*-openbsd* | *-*-freebsd*)
# Do not include libc due to us having libc/libc_r.
test "X$arg" = "X-lc" && continue
;;
@@ -1568,19 +1353,10 @@
# Rhapsody C and math libraries are in the System framework
deplibs="$deplibs -framework System"
continue
- ;;
- *-*-sco3.2v5* | *-*-sco5v6*)
- # Causes problems with __ctype
- test "X$arg" = "X-lc" && continue
- ;;
- *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
- # Compiler inserts libc in the correct place for threads to work
- test "X$arg" = "X-lc" && continue
- ;;
esac
elif test "X$arg" = "X-lc_r"; then
case $host in
- *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ *-*-openbsd* | *-*-freebsd*)
# Do not include libc_r directly, use -pthread flag.
continue
;;
@@ -1590,20 +1366,8 @@
continue
;;
- # Tru64 UNIX uses -model [arg] to determine the layout of C++
- # classes, name mangling, and exception handling.
- -model)
- compile_command="$compile_command $arg"
- compiler_flags="$compiler_flags $arg"
- finalize_command="$finalize_command $arg"
- prev=xcompiler
- continue
- ;;
-
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
- compiler_flags="$compiler_flags $arg"
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
+ deplibs="$deplibs $arg"
continue
;;
@@ -1612,19 +1376,13 @@
continue
;;
- # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
- # -r[0-9][0-9]* specifies the processor on the SGI compiler
- # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
- # +DA*, +DD* enable 64-bit mode on the HP compiler
- # -q* pass through compiler args for the IBM compiler
- # -m* pass through architecture-specific compiler args for GCC
- # -m*, -t[45]*, -txscale* pass through architecture-specific
- # compiler args for GCC
- # -pg pass through profiling flag for GCC
- # @file GCC response files
- -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
- -t[45]*|-txscale*|@*)
-
+ # gcc -m* arguments should be passed to the linker via $compiler_flags
+ # in order to pass architecture information to the linker
+ # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
+ # but this is not reliable with gcc because gcc may use -mfoo to
+ # select a different linker, different libraries, etc, while
+ # -Wl,-mfoo simply passes -mfoo to the linker.
+ -m*)
# Unknown arguments in both finalize_command and compile_command need
# to be aesthetically quoted because they are evaled later.
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
@@ -1635,7 +1393,9 @@
esac
compile_command="$compile_command $arg"
finalize_command="$finalize_command $arg"
- compiler_flags="$compiler_flags $arg"
+ if test "$with_gcc" = "yes" ; then
+ compiler_flags="$compiler_flags $arg"
+ fi
continue
;;
@@ -1873,11 +1633,6 @@
if test -z "$pic_object" || test "$pic_object" = none ; then
arg="$non_pic_object"
fi
- else
- # If the PIC object exists, use it instead.
- # $xdir was prepended to $pic_object above.
- non_pic_object="$pic_object"
- non_pic_objects="$non_pic_objects $non_pic_object"
fi
else
# Only an error if not doing a dry-run.
@@ -1983,9 +1738,9 @@
if test ! -d "$output_objdir"; then
$show "$mkdir $output_objdir"
$run $mkdir $output_objdir
- exit_status=$?
- if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
- exit $exit_status
+ status=$?
+ if test "$status" -ne 0 && test ! -d "$output_objdir"; then
+ exit $status
fi
fi
@@ -2048,6 +1803,7 @@
newlib_search_path=
need_relink=no # whether we're linking any uninstalled libtool libraries
notinst_deplibs= # not-installed libtool libraries
+ notinst_path= # paths that contain not-installed libtool libraries
case $linkmode in
lib)
passes="conv link"
@@ -2102,7 +1858,7 @@
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
- compiler_flags="$compiler_flags $deplib"
+ deplibs="$deplib $deplibs"
fi
continue
;;
@@ -2221,22 +1977,7 @@
fi
case $linkmode in
lib)
- valid_a_lib=no
- case $deplibs_check_method in
- match_pattern*)
- set dummy $deplibs_check_method
- match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
- if eval $echo \"$deplib\" 2>/dev/null \
- | $SED 10q \
- | $EGREP "$match_pattern_regex" > /dev/null; then
- valid_a_lib=yes
- fi
- ;;
- pass_all)
- valid_a_lib=yes
- ;;
- esac
- if test "$valid_a_lib" != yes; then
+ if test "$deplibs_check_method" != pass_all; then
$echo
$echo "*** Warning: Trying to link with static lib archive
$deplib."
$echo "*** I have the capability to make that library
automatically link in when"
@@ -2286,7 +2027,7 @@
esac # case $deplib
if test "$found" = yes || test -f "$lib"; then :
else
- $echo "$modename: cannot find the library \`$lib' or unhandled
argument \`$deplib'" 1>&2
+ $echo "$modename: cannot find the library \`$lib'" 1>&2
exit $EXIT_FAILURE
fi
@@ -2310,9 +2051,7 @@
# it will not redefine variables installed, or shouldnotlink
installed=yes
shouldnotlink=no
- avoidtemprpath=
-
# Read the .la file
case $lib in
*/* | *\\*) . $lib ;;
@@ -2410,19 +2149,11 @@
dir="$libdir"
absdir="$libdir"
fi
- test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
else
- if test ! -f "$ladir/$objdir/$linklib" && test -f
"$abs_ladir/$linklib"; then
- dir="$ladir"
- absdir="$abs_ladir"
- # Remove this search path later
- notinst_path="$notinst_path $abs_ladir"
- else
- dir="$ladir/$objdir"
- absdir="$abs_ladir/$objdir"
- # Remove this search path later
- notinst_path="$notinst_path $abs_ladir"
- fi
+ dir="$ladir/$objdir"
+ absdir="$abs_ladir/$objdir"
+ # Remove this search path later
+ notinst_path="$notinst_path $abs_ladir"
fi # $installed = yes
name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
@@ -2495,12 +2226,12 @@
if test -n "$library_names" &&
{ test "$prefer_static_libs" = no || test -z "$old_library"; };
then
# We need to hardcode the library path
- if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+ if test -n "$shlibpath_var"; then
# Make sure the rpath contains only unique directories.
case "$temp_rpath " in
*" $dir "*) ;;
*" $absdir "*) ;;
- *) temp_rpath="$temp_rpath $absdir" ;;
+ *) temp_rpath="$temp_rpath $dir" ;;
esac
fi
@@ -2537,12 +2268,8 @@
fi
link_static=no # Whether the deplib will be linked statically
- use_static_libs=$prefer_static_libs
- if test "$use_static_libs" = built && test "$installed" = yes ; then
- use_static_libs=no
- fi
if test -n "$library_names" &&
- { test "$use_static_libs" = no || test -z "$old_library"; }; then
+ { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
if test "$installed" = no; then
notinst_deplibs="$notinst_deplibs $lib"
need_relink=yes
@@ -2655,15 +2382,11 @@
if test "$hardcode_direct" = no; then
add="$dir/$linklib"
case $host in
- *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
- *-*-sysv4*uw2*) add_dir="-L$dir" ;;
- *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
- *-*-unixware7*) add_dir="-L$dir" ;;
+ *-*-sco3.2v5* ) add_dir="-L$dir" ;;
*-*-darwin* )
# if the lib is a module then we can not link against
# it, someone is ignoring the new warnings I added
- if /usr/bin/file -L $add 2> /dev/null |
- $EGREP ": [^:]* bundle" >/dev/null ; then
+ if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle"
>/dev/null ; then
$echo "** Warning, lib $linklib is a module, not a shared
library"
if test -z "$old_library" ; then
$echo
@@ -2694,7 +2417,7 @@
add_dir="-L$dir"
# Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then
- case $libdir in
+ case "$libdir" in
[\\/]*)
add_dir="$add_dir -L$inst_prefix_dir$libdir"
;;
@@ -2767,7 +2490,7 @@
add_dir="-L$libdir"
# Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then
- case $libdir in
+ case "$libdir" in
[\\/]*)
add_dir="$add_dir -L$inst_prefix_dir$libdir"
;;
@@ -2828,6 +2551,8 @@
fi
fi
else
+ convenience="$convenience $dir/$old_library"
+ old_convenience="$old_convenience $dir/$old_library"
deplibs="$dir/$old_library $deplibs"
link_static=yes
fi
@@ -2945,13 +2670,13 @@
*) continue ;;
esac
case " $deplibs " in
- *" $path "*) ;;
- *) deplibs="$path $deplibs" ;;
- esac
- case " $deplibs " in
*" $depdepl "*) ;;
*) deplibs="$depdepl $deplibs" ;;
esac
+ case " $deplibs " in
+ *" $path "*) ;;
+ *) deplibs="$deplibs $path" ;;
+ esac
done
fi # link_all_deplibs != no
fi # linkmode = lib
@@ -3222,7 +2947,7 @@
case $current in
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9])
;;
*)
- $echo "$modename: CURRENT \`$current' must be a nonnegative integer"
1>&2
+ $echo "$modename: CURRENT \`$current' is not a nonnegative integer"
1>&2
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
exit $EXIT_FAILURE
;;
@@ -3231,7 +2956,7 @@
case $revision in
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9])
;;
*)
- $echo "$modename: REVISION \`$revision' must be a nonnegative
integer" 1>&2
+ $echo "$modename: REVISION \`$revision' is not a nonnegative integer"
1>&2
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
exit $EXIT_FAILURE
;;
@@ -3240,7 +2965,7 @@
case $age in
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9])
;;
*)
- $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
+ $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
exit $EXIT_FAILURE
;;
@@ -3266,7 +2991,7 @@
versuffix="$major.$age.$revision"
# Darwin ld doesn't like 0 for these options...
minor_current=`expr $current + 1`
- verstring="${wl}-compatibility_version ${wl}$minor_current
${wl}-current_version ${wl}$minor_current.$revision"
+ verstring="-compatibility_version $minor_current -current_version
$minor_current.$revision"
;;
freebsd-aout)
@@ -3419,9 +3144,9 @@
# Eliminate all temporary directories.
for path in $notinst_path; do
- lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
- deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
- dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path %
%g"`
+ lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
+ deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
+ dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path %
%g'`
done
if test -n "$xrpath"; then
@@ -3472,15 +3197,10 @@
*-*-netbsd*)
# Don't link with libc until the a.out ld.so is fixed.
;;
- *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ *-*-openbsd* | *-*-freebsd*)
# Do not include libc due to us having libc/libc_r.
+ test "X$arg" = "X-lc" && continue
;;
- *-*-sco3.2v5* | *-*-sco5v6*)
- # Causes problems with __ctype
- ;;
- *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
- # Compiler inserts libc in the correct place for threads to work
- ;;
*)
# Add libc to deplibs on all other systems if necessary.
if test "$build_libtool_need_lc" = "yes"; then
@@ -3523,11 +3243,11 @@
int main() { return 0; }
EOF
$rm conftest
- $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
+ $LTCC -o conftest conftest.c $deplibs
if test "$?" -eq 0 ; then
ldd_output=`ldd conftest`
for i in $deplibs; do
- name=`expr $i : '-l\(.*\)'`
+ name="`expr $i : '-l\(.*\)'`"
# If $name is empty we are operating on a -L argument.
if test "$name" != "" && test "$name" -ne "0"; then
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ;
then
@@ -3564,11 +3284,11 @@
# Error occurred in the first compile. Let's try to salvage
# the situation: Compile a separate program for each library.
for i in $deplibs; do
- name=`expr $i : '-l\(.*\)'`
+ name="`expr $i : '-l\(.*\)'`"
# If $name is empty we are operating on a -L argument.
if test "$name" != "" && test "$name" != "0"; then
$rm conftest
- $LTCC $LTCFLAGS -o conftest conftest.c $i
+ $LTCC -o conftest conftest.c $i
# Did it work?
if test "$?" -eq 0 ; then
ldd_output=`ldd conftest`
@@ -3616,7 +3336,7 @@
set dummy $deplibs_check_method
file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
for a_deplib in $deplibs; do
- name=`expr $a_deplib : '-l\(.*\)'`
+ name="`expr $a_deplib : '-l\(.*\)'`"
# If $name is empty we are operating on a -L argument.
if test "$name" != "" && test "$name" != "0"; then
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ;
then
@@ -3685,7 +3405,7 @@
set dummy $deplibs_check_method
match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
for a_deplib in $deplibs; do
- name=`expr $a_deplib : '-l\(.*\)'`
+ name="`expr $a_deplib : '-l\(.*\)'`"
# If $name is empty we are operating on a -L argument.
if test -n "$name" && test "$name" != "0"; then
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ;
then
@@ -3815,35 +3535,6 @@
deplibs=$newdeplibs
fi
-
- # move library search paths that coincide with paths to not yet
- # installed libraries to the beginning of the library search list
- new_libs=
- for path in $notinst_path; do
- case " $new_libs " in
- *" -L$path/$objdir "*) ;;
- *)
- case " $deplibs " in
- *" -L$path/$objdir "*)
- new_libs="$new_libs -L$path/$objdir" ;;
- esac
- ;;
- esac
- done
- for deplib in $deplibs; do
- case $deplib in
- -L*)
- case " $new_libs " in
- *" $deplib "*) ;;
- *) new_libs="$new_libs $deplib" ;;
- esac
- ;;
- *) new_libs="$new_libs $deplib" ;;
- esac
- done
- deplibs="$new_libs"
-
-
# All the library-specific variables (install_libdir is set above).
library_names=
old_library=
@@ -3927,7 +3618,6 @@
fi
lib="$output_objdir/$realname"
- linknames=
for link
do
linknames="$linknames $link"
@@ -3956,9 +3646,6 @@
# The command line is too long to execute in one step.
$show "using reloadable object file for export list..."
skipped_export=:
- # Break out early, otherwise skipped_export may be
- # set to false by a later but shorter cmd.
- break
fi
done
IFS="$save_ifs"
@@ -3992,13 +3679,67 @@
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
else
gentop="$output_objdir/${outputname}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "$mkdir $gentop"
+ $run $mkdir "$gentop"
+ status=$?
+ if test "$status" -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
generated="$generated $gentop"
- func_extract_archives $gentop $convenience
- libobjs="$libobjs $func_extract_archives_result"
+ for xlib in $convenience; do
+ # Extract the objects.
+ case $xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "$mkdir $xdir"
+ $run $mkdir "$xdir"
+ status=$?
+ if test "$status" -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ # We will extract separately just the conflicting names and we
will no
+ # longer touch any unique names. It is faster to leave these
extract
+ # automatically by $AR in one run.
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+ if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "$modename: warning: object name conflicts; renaming
object files" 1>&2
+ $echo "$modename: warning: to ensure that they will not
overwrite" 1>&2
+ $AR t "$xabs" | sort | uniq -cd | while read -r count name
+ do
+ i=1
+ while test "$i" -le "$count"
+ do
+ # Put our $i before any first dot (extension)
+ # Never overwrite any file
+ name_to="$name"
+ while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
+ do
+ name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
+ done
+ $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name'
'$name_to')"
+ $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv
'$name' '$name_to')" || exit $?
+ i=`expr $i + 1`
+ done
+ done
+ fi
+
+ libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name
\*.lo -print | $NL2SP`
+ done
fi
fi
-
+
if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
eval flag=\"$thread_safe_flag_spec\"
linker_flags="$linker_flags $flag"
@@ -4028,8 +3769,7 @@
fi
fi
- if test "X$skipped_export" != "X:" &&
- len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+ if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
:
else
@@ -4048,7 +3788,6 @@
save_libobjs=$libobjs
fi
save_output=$output
- output_la=`$echo "X$output" | $Xsed -e "$basename"`
# Clear the reloadable object creation command queue and
# initialize k to one.
@@ -4058,13 +3797,13 @@
delfiles=
last_robj=
k=1
- output=$output_objdir/$output_la-${k}.$objext
+ output=$output_objdir/$save_output-${k}.$objext
# Loop over the list of objects to be linked.
for obj in $save_libobjs
do
eval test_cmds=\"$reload_cmds $objlist $last_robj\"
if test "X$objlist" = X ||
- { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+ { len=`expr "X$test_cmds" : ".*"` &&
test "$len" -le "$max_cmd_len"; }; then
objlist="$objlist $obj"
else
@@ -4078,9 +3817,9 @@
# the last one created.
eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist
$last_robj\"
fi
- last_robj=$output_objdir/$output_la-${k}.$objext
+ last_robj=$output_objdir/$save_output-${k}.$objext
k=`expr $k + 1`
- output=$output_objdir/$output_la-${k}.$objext
+ output=$output_objdir/$save_output-${k}.$objext
objlist=$obj
len=1
fi
@@ -4100,13 +3839,13 @@
eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
fi
- # Set up a command to remove the reloadable object files
+ # Set up a command to remove the reloadale object files
# after they are used.
i=0
while test "$i" -lt "$k"
do
i=`expr $i + 1`
- delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
+ delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
done
$echo "creating a temporary reloadable object file: $output"
@@ -4154,30 +3893,13 @@
IFS="$save_ifs"
eval cmd=\"$cmd\"
$show "$cmd"
- $run eval "$cmd" || {
- lt_exit=$?
-
- # Restore the uninstalled library and exit
- if test "$mode" = relink; then
- $run eval '(cd $output_objdir && $rm ${realname}T && $mv
${realname}U $realname)'
- fi
-
- exit $lt_exit
- }
+ $run eval "$cmd" || exit $?
done
IFS="$save_ifs"
# Restore the uninstalled library and exit
if test "$mode" = relink; then
$run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname
${realname}T && $mv "$realname"U $realname)' || exit $?
-
- if test -n "$convenience"; then
- if test -z "$whole_archive_flag_spec"; then
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- fi
- fi
-
exit $EXIT_SUCCESS
fi
@@ -4255,10 +3977,64 @@
eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
else
gentop="$output_objdir/${obj}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "$mkdir $gentop"
+ $run $mkdir "$gentop"
+ status=$?
+ if test "$status" -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
generated="$generated $gentop"
- func_extract_archives $gentop $convenience
- reload_conv_objs="$reload_objs $func_extract_archives_result"
+ for xlib in $convenience; do
+ # Extract the objects.
+ case $xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "$mkdir $xdir"
+ $run $mkdir "$xdir"
+ status=$?
+ if test "$status" -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ # We will extract separately just the conflicting names and we will
no
+ # longer touch any unique names. It is faster to leave these extract
+ # automatically by $AR in one run.
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+ if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "$modename: warning: object name conflicts; renaming object
files" 1>&2
+ $echo "$modename: warning: to ensure that they will not
overwrite" 1>&2
+ $AR t "$xabs" | sort | uniq -cd | while read -r count name
+ do
+ i=1
+ while test "$i" -le "$count"
+ do
+ # Put our $i before any first dot (extension)
+ # Never overwrite any file
+ name_to="$name"
+ while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
+ do
+ name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
+ done
+ $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name'
'$name_to')"
+ $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv
'$name' '$name_to')" || exit $?
+ i=`expr $i + 1`
+ done
+ done
+ fi
+
+ reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print
-o -name \*.lo -print | $NL2SP`
+ done
fi
fi
@@ -4359,35 +4135,6 @@
;;
esac
-
- # move library search paths that coincide with paths to not yet
- # installed libraries to the beginning of the library search list
- new_libs=
- for path in $notinst_path; do
- case " $new_libs " in
- *" -L$path/$objdir "*) ;;
- *)
- case " $compile_deplibs " in
- *" -L$path/$objdir "*)
- new_libs="$new_libs -L$path/$objdir" ;;
- esac
- ;;
- esac
- done
- for deplib in $compile_deplibs; do
- case $deplib in
- -L*)
- case " $new_libs " in
- *" $deplib "*) ;;
- *) new_libs="$new_libs $deplib" ;;
- esac
- ;;
- *) new_libs="$new_libs $deplib" ;;
- esac
- done
- compile_deplibs="$new_libs"
-
-
compile_command="$compile_command $compile_deplibs"
finalize_command="$finalize_command $finalize_deplibs"
@@ -4432,15 +4179,10 @@
fi
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$libdir:"*) ;;
*) dllsearchpath="$dllsearchpath:$libdir";;
esac
- case :$dllsearchpath: in
- *":$testbindir:"*) ;;
- *) dllsearchpath="$dllsearchpath:$testbindir";;
- esac
;;
esac
done
@@ -4554,25 +4296,13 @@
# Prepare the list of exported symbols
if test -z "$export_symbols"; then
- export_symbols="$output_objdir/$outputname.exp"
+ export_symbols="$output_objdir/$output.exp"
$run $rm $export_symbols
- $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.*
\(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
- case $host in
- *cygwin* | *mingw* )
- $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
- $run eval 'cat "$export_symbols" >>
"$output_objdir/$outputname.def"'
- ;;
- esac
+ $run eval "${SED} -n -e '/^: @address@hidden/d' -e 's/^.*
\(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
else
- $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e
's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
- $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" >
"$nlist"T'
+ $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e
's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
+ $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" >
"$nlist"T'
$run eval 'mv "$nlist"T "$nlist"'
- case $host in
- *cygwin* | *mingw* )
- $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
- $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
- ;;
- esac
fi
fi
@@ -4623,26 +4353,7 @@
#endif
/* The mapping between symbol names and symbols. */
-"
-
- case $host in
- *cygwin* | *mingw* )
- $echo >> "$output_objdir/$dlsyms" "\
-/* DATA imports from DLLs on WIN32 can't be const, because
- runtime relocations are performed -- see ld's documentation
- on pseudo-relocs */
-struct {
-"
- ;;
- * )
- $echo >> "$output_objdir/$dlsyms" "\
const struct {
-"
- ;;
- esac
-
-
- $echo >> "$output_objdir/$dlsyms" "\
const char *name;
lt_ptr address;
}
@@ -4689,29 +4400,16 @@
esac
# Now compile the dynamic symbol file.
- $show "(cd $output_objdir && $LTCC $LTCFLAGS
-c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
- $run eval '(cd $output_objdir && $LTCC $LTCFLAGS
-c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+ $show "(cd $output_objdir && $LTCC
-c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+ $run eval '(cd $output_objdir && $LTCC
-c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
# Clean up the generated files.
$show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
$run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
# Transform the symbol file into the correct name.
- case $host in
- *cygwin* | *mingw* )
- if test -f "$output_objdir/${outputname}.def" ; then
- compile_command=`$echo "X$compile_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}.def
$output_objdir/${outputname}S.${objext}%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}.def
$output_objdir/${outputname}S.${objext}%"`
- else
- compile_command=`$echo "X$compile_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
- fi
- ;;
- * )
- compile_command=`$echo "X$compile_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
- ;;
- esac
+ compile_command=`$echo "X$compile_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
;;
*)
$echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
@@ -4736,7 +4434,7 @@
# We have no uninstalled library dependencies, so finalize right now.
$show "$link_command"
$run eval "$link_command"
- exit_status=$?
+ status=$?
# Delete the generated files.
if test -n "$dlsyms"; then
@@ -4744,7 +4442,7 @@
$run $rm "$output_objdir/${outputname}S.${objext}"
fi
- exit $exit_status
+ exit $status
fi
if test -n "$shlibpath_var"; then
@@ -4884,12 +4582,10 @@
esac
case $host in
*cygwin* | *mingw* )
- output_name=`basename $output`
- output_path=`dirname $output`
- cwrappersource="$output_path/$objdir/lt-$output_name.c"
- cwrapper="$output_path/$output_name.exe"
- $rm $cwrappersource $cwrapper
- trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+ cwrappersource=`$echo ${objdir}/lt-${output}.c`
+ cwrapper=`$echo ${output}.exe`
+ $rm $cwrappersource $cwrapper
+ trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
cat > $cwrappersource <<EOF
@@ -4914,9 +4610,6 @@
#include <malloc.h>
#include <stdarg.h>
#include <assert.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/stat.h>
#if defined(PATH_MAX)
# define LT_PATHMAX PATH_MAX
@@ -4927,20 +4620,16 @@
#endif
#ifndef DIR_SEPARATOR
-# define DIR_SEPARATOR '/'
-# define PATH_SEPARATOR ':'
+#define DIR_SEPARATOR '/'
#endif
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
defined (__OS2__)
-# define HAVE_DOS_BASED_FILE_SYSTEM
-# ifndef DIR_SEPARATOR_2
-# define DIR_SEPARATOR_2 '\\'
-# endif
-# ifndef PATH_SEPARATOR_2
-# define PATH_SEPARATOR_2 ';'
-# endif
+#define HAVE_DOS_BASED_FILE_SYSTEM
+#ifndef DIR_SEPARATOR_2
+#define DIR_SEPARATOR_2 '\\'
#endif
+#endif
#ifndef DIR_SEPARATOR_2
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
@@ -4949,32 +4638,17 @@
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
#endif /* DIR_SEPARATOR_2 */
-#ifndef PATH_SEPARATOR_2
-# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
-#else /* PATH_SEPARATOR_2 */
-# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
-#endif /* PATH_SEPARATOR_2 */
-
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
#define XFREE(stale) do { \
if (stale) { free ((void *) stale); stale = 0; } \
} while (0)
-/* -DDEBUG is fairly common in CFLAGS. */
-#undef DEBUG
-#if defined DEBUGWRAPPER
-# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
-#else
-# define DEBUG(format, ...)
-#endif
-
const char *program_name = NULL;
void * xmalloc (size_t num);
char * xstrdup (const char *string);
-const char * base_name (const char *name);
-char * find_executable(const char *wrapper);
-int check_executable(const char *path);
+char * basename (const char *name);
+char * fnqualify(const char *path);
char * strendzap(char *str, const char *pat);
void lt_fatal (const char *message, ...);
@@ -4984,51 +4658,29 @@
char **newargz;
int i;
- program_name = (char *) xstrdup (base_name (argv[0]));
- DEBUG("(main) argv[0] : %s\n",argv[0]);
- DEBUG("(main) program_name : %s\n",program_name);
+ program_name = (char *) xstrdup ((char *) basename (argv[0]));
newargz = XMALLOC(char *, argc+2);
EOF
- cat >> $cwrappersource <<EOF
- newargz[0] = (char *) xstrdup("$SHELL");
+ cat >> $cwrappersource <<EOF
+ newargz[0] = "$SHELL";
EOF
- cat >> $cwrappersource <<"EOF"
- newargz[1] = find_executable(argv[0]);
- if (newargz[1] == NULL)
- lt_fatal("Couldn't find %s", argv[0]);
- DEBUG("(main) found exe at : %s\n",newargz[1]);
+ cat >> $cwrappersource <<"EOF"
+ newargz[1] = fnqualify(argv[0]);
/* we know the script has the same name, without the .exe */
/* so make sure newargz[1] doesn't end in .exe */
strendzap(newargz[1],".exe");
for (i = 1; i < argc; i++)
newargz[i+1] = xstrdup(argv[i]);
newargz[argc+1] = NULL;
-
- for (i=0; i<argc+1; i++)
- {
- DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
- ;
- }
-
EOF
- case $host_os in
- mingw*)
- cat >> $cwrappersource <<EOF
- execv("$SHELL",(char const **)newargz);
-EOF
- ;;
- *)
- cat >> $cwrappersource <<EOF
+ cat >> $cwrappersource <<EOF
execv("$SHELL",newargz);
EOF
- ;;
- esac
- cat >> $cwrappersource <<"EOF"
- return 127;
+ cat >> $cwrappersource <<"EOF"
}
void *
@@ -5048,148 +4700,48 @@
;
}
-const char *
-base_name (const char *name)
+char *
+basename (const char *name)
{
const char *base;
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
/* Skip over the disk name in MSDOS pathnames. */
- if (isalpha ((unsigned char)name[0]) && name[1] == ':')
+ if (isalpha (name[0]) && name[1] == ':')
name += 2;
#endif
for (base = name; *name; name++)
if (IS_DIR_SEPARATOR (*name))
base = name + 1;
- return base;
+ return (char *) base;
}
-int
-check_executable(const char * path)
-{
- struct stat st;
-
- DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") :
"NULL!");
- if ((!path) || (!*path))
- return 0;
-
- if ((stat (path, &st) >= 0) &&
- (
- /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
-#if defined (S_IXOTH)
- ((st.st_mode & S_IXOTH) == S_IXOTH) ||
-#endif
-#if defined (S_IXGRP)
- ((st.st_mode & S_IXGRP) == S_IXGRP) ||
-#endif
- ((st.st_mode & S_IXUSR) == S_IXUSR))
- )
- return 1;
- else
- return 0;
-}
-
-/* Searches for the full path of the wrapper. Returns
- newly allocated full path name if found, NULL otherwise */
char *
-find_executable (const char* wrapper)
+fnqualify(const char *path)
{
- int has_slash = 0;
- const char* p;
- const char* p_next;
- /* static buffer for getcwd */
+ size_t size;
+ char *p;
char tmp[LT_PATHMAX + 1];
- int tmp_len;
- char* concat_name;
- DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!")
: "NULL!");
+ assert(path != NULL);
- if ((wrapper == NULL) || (*wrapper == '\0'))
- return NULL;
-
- /* Absolute path? */
+ /* Is it qualified already? */
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
- {
- concat_name = xstrdup (wrapper);
- if (check_executable(concat_name))
- return concat_name;
- XFREE(concat_name);
- }
- else
- {
+ if (isalpha (path[0]) && path[1] == ':')
+ return xstrdup (path);
#endif
- if (IS_DIR_SEPARATOR (wrapper[0]))
- {
- concat_name = xstrdup (wrapper);
- if (check_executable(concat_name))
- return concat_name;
- XFREE(concat_name);
- }
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- }
-#endif
+ if (IS_DIR_SEPARATOR (path[0]))
+ return xstrdup (path);
- for (p = wrapper; *p; p++)
- if (*p == '/')
- {
- has_slash = 1;
- break;
- }
- if (!has_slash)
- {
- /* no slashes; search PATH */
- const char* path = getenv ("PATH");
- if (path != NULL)
- {
- for (p = path; *p; p = p_next)
- {
- const char* q;
- size_t p_len;
- for (q = p; *q; q++)
- if (IS_PATH_SEPARATOR(*q))
- break;
- p_len = q - p;
- p_next = (*q == '\0' ? q : q + 1);
- if (p_len == 0)
- {
- /* empty path: current directory */
- if (getcwd (tmp, LT_PATHMAX) == NULL)
- lt_fatal ("getcwd failed");
- tmp_len = strlen(tmp);
- concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
- memcpy (concat_name, tmp, tmp_len);
- concat_name[tmp_len] = '/';
- strcpy (concat_name + tmp_len + 1, wrapper);
- }
- else
- {
- concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
- memcpy (concat_name, p, p_len);
- concat_name[p_len] = '/';
- strcpy (concat_name + p_len + 1, wrapper);
- }
- if (check_executable(concat_name))
- return concat_name;
- XFREE(concat_name);
- }
- }
- /* not found in PATH; assume curdir */
- }
- /* Relative path | not found in path: prepend cwd */
+ /* prepend the current directory */
+ /* doesn't handle '~' */
if (getcwd (tmp, LT_PATHMAX) == NULL)
lt_fatal ("getcwd failed");
- tmp_len = strlen(tmp);
- concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
- memcpy (concat_name, tmp, tmp_len);
- concat_name[tmp_len] = '/';
- strcpy (concat_name + tmp_len + 1, wrapper);
-
- if (check_executable(concat_name))
- return concat_name;
- XFREE(concat_name);
- return NULL;
+ size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
+ p = XMALLOC(char, size);
+ sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
+ return p;
}
char *
@@ -5233,16 +4785,16 @@
va_end (ap);
}
EOF
- # we should really use a build-platform specific compiler
- # here, but OTOH, the wrappers (shell script and this C one)
- # are only useful if you want to execute the "real" binary.
- # Since the "real" binary is built for $host, then this
- # wrapper might as well be built for $host, too.
- $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
- ;;
- esac
- $rm $output
- trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
+ # we should really use a build-platform specific compiler
+ # here, but OTOH, the wrappers (shell script and this C one)
+ # are only useful if you want to execute the "real" binary.
+ # Since the "real" binary is built for $host, then this
+ # wrapper might as well be built for $host, too.
+ $run $LTCC -s -o $cwrapper $cwrappersource
+ ;;
+ esac
+ $rm $output
+ trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
$echo > $output "\
#! $SHELL
@@ -5263,7 +4815,7 @@
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
relink_command=\"$relink_command\"
@@ -5392,13 +4944,13 @@
# Backslashes separate directories on plain windows
*-*-mingw | *-*-os2*)
$echo >> $output "\
- exec \"\$progdir\\\\\$program\" \${1+\"address@hidden"}
+ exec \$progdir\\\\\$program \${1+\"address@hidden"}
"
;;
*)
$echo >> $output "\
- exec \"\$progdir/\$program\" \${1+\"address@hidden"}
+ exec \$progdir/\$program \${1+\"address@hidden"}
"
;;
esac
@@ -5408,7 +4960,7 @@
fi
else
# The program doesn't exist.
- \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+ \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
\$echo \"This script is just a wrapper for \$program.\" 1>&2
$echo \"See the $PACKAGE documentation for more information.\" 1>&2
exit $EXIT_FAILURE
@@ -5440,73 +4992,71 @@
if test -n "$addlibs"; then
gentop="$output_objdir/${outputname}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "$mkdir $gentop"
+ $run $mkdir "$gentop"
+ status=$?
+ if test "$status" -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
generated="$generated $gentop"
- func_extract_archives $gentop $addlibs
- oldobjs="$oldobjs $func_extract_archives_result"
+ # Add in members from convenience archives.
+ for xlib in $addlibs; do
+ # Extract the objects.
+ case $xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "$mkdir $xdir"
+ $run $mkdir "$xdir"
+ status=$?
+ if test "$status" -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ # We will extract separately just the conflicting names and we will no
+ # longer touch any unique names. It is faster to leave these extract
+ # automatically by $AR in one run.
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+ if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "$modename: warning: object name conflicts; renaming object
files" 1>&2
+ $echo "$modename: warning: to ensure that they will not overwrite"
1>&2
+ $AR t "$xabs" | sort | uniq -cd | while read -r count name
+ do
+ i=1
+ while test "$i" -le "$count"
+ do
+ # Put our $i before any first dot (extension)
+ # Never overwrite any file
+ name_to="$name"
+ while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
+ do
+ name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
+ done
+ $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name'
'$name_to')"
+ $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name'
'$name_to')" || exit $?
+ i=`expr $i + 1`
+ done
+ done
+ fi
+
+ oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name
\*.lo -print | $NL2SP`
+ done
fi
# Do each command in the archive commands.
if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" =
yes; then
cmds=$old_archive_from_new_cmds
else
- # POSIX demands no paths to be encoded in archives. We have
- # to avoid creating archives with duplicate basenames if we
- # might have to extract them afterwards, e.g., when creating a
- # static archive out of a convenience library, or when linking
- # the entirety of a libtool archive into another (currently
- # not supported by libtool).
- if (for obj in $oldobjs
- do
- $echo "X$obj" | $Xsed -e 's%^.*/%%'
- done | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "copying selected object files to avoid basename conflicts..."
-
- if test -z "$gentop"; then
- gentop="$output_objdir/${outputname}x"
- generated="$generated $gentop"
-
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- $show "$mkdir $gentop"
- $run $mkdir "$gentop"
- exit_status=$?
- if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
- exit $exit_status
- fi
- fi
-
- save_oldobjs=$oldobjs
- oldobjs=
- counter=1
- for obj in $save_oldobjs
- do
- objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
- case " $oldobjs " in
- " ") oldobjs=$obj ;;
- *[\ /]"$objbase "*)
- while :; do
- # Make sure we don't pick an alternate name that also
- # overlaps.
- newobj=lt$counter-$objbase
- counter=`expr $counter + 1`
- case " $oldobjs " in
- *[\ /]"$newobj "*) ;;
- *) if test ! -f "$gentop/$newobj"; then break; fi ;;
- esac
- done
- $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
- $run ln "$obj" "$gentop/$newobj" ||
- $run cp "$obj" "$gentop/$newobj"
- oldobjs="$oldobjs $gentop/$newobj"
- ;;
- *) oldobjs="$oldobjs $obj" ;;
- esac
- done
- fi
-
eval cmds=\"$old_archive_cmds\"
if len=`expr "X$cmds" : ".*"` &&
@@ -5520,7 +5070,20 @@
objlist=
concat_cmds=
save_oldobjs=$oldobjs
-
+ # GNU ar 2.10+ was changed to match POSIX; thus no paths are
+ # encoded into archives. This makes 'ar r' malfunction in
+ # this piecewise linking case whenever conflicting object
+ # names appear in distinct ar calls; check, warn and compensate.
+ if (for obj in $save_oldobjs
+ do
+ $echo "X$obj" | $Xsed -e 's%^.*/%%'
+ done | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "$modename: warning: object name conflicts; overriding
AR_FLAGS to 'cq'" 1>&2
+ $echo "$modename: warning: to ensure that POSIX-compatible ar will
work" 1>&2
+ AR_FLAGS=cq
+ fi
# Is there a better way of finding the last object in the list?
for obj in $save_oldobjs
do
@@ -5531,7 +5094,7 @@
oldobjs="$objlist $obj"
objlist="$objlist $obj"
eval test_cmds=\"$old_archive_cmds\"
- if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+ if len=`expr "X$test_cmds" : ".*"` &&
test "$len" -le "$max_cmd_len"; then
:
else
@@ -5728,11 +5291,11 @@
# install_prog (especially on Windows NT).
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
# Allow the use of GNU shtool's install command.
- $echo "X$nonopt" | grep shtool > /dev/null; then
+ $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
# Aesthetically quote it.
arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
arg="\"$arg\""
;;
esac
@@ -5741,14 +5304,14 @@
shift
else
install_prog=
- arg=$nonopt
+ arg="$nonopt"
fi
# The real first argument should be the name of the installation program.
# Aesthetically quote it.
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
arg="\"$arg\""
;;
esac
@@ -5766,31 +5329,28 @@
do
if test -n "$dest"; then
files="$files $dest"
- dest=$arg
+ dest="$arg"
continue
fi
case $arg in
-d) isdir=yes ;;
- -f)
- case " $install_prog " in
- *[\\\ /]cp\ *) ;;
- *) prev=$arg ;;
- esac
- ;;
- -g | -m | -o) prev=$arg ;;
+ -f) prev="-f" ;;
+ -g) prev="-g" ;;
+ -m) prev="-m" ;;
+ -o) prev="-o" ;;
-s)
stripme=" -s"
continue
;;
- -*)
- ;;
+ -*) ;;
+
*)
# If the previous option needed an argument, then skip it.
if test -n "$prev"; then
prev=
else
- dest=$arg
+ dest="$arg"
continue
fi
;;
@@ -5799,7 +5359,7 @@
# Aesthetically quote the argument.
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
arg="\"$arg\""
;;
esac
@@ -5968,14 +5528,11 @@
if test "$#" -gt 0; then
# Delete the old symlinks, and create new ones.
- # Try `ln -sf' first, because the `ln' binary might depend on
- # the symlink we replace! Solaris /bin/ln does not understand -f,
- # so we also need to try rm && ln -s.
for linkname
do
if test "$linkname" != "$realname"; then
- $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm
$linkname && $LN_S $realname $linkname; }; })"
- $run eval "(cd $destdir && { $LN_S -f $realname $linkname || {
$rm $linkname && $LN_S $realname $linkname; }; })"
+ $show "(cd $destdir && $rm $linkname && $LN_S $realname
$linkname)"
+ $run eval "(cd $destdir && $rm $linkname && $LN_S $realname
$linkname)"
fi
done
fi
@@ -5988,16 +5545,7 @@
IFS="$save_ifs"
eval cmd=\"$cmd\"
$show "$cmd"
- $run eval "$cmd" || {
- lt_exit=$?
-
- # Restore the uninstalled library and exit
- if test "$mode" = relink; then
- $run eval '(cd $output_objdir && $rm ${realname}T && $mv
${realname}U $realname)'
- fi
-
- exit $lt_exit
- }
+ $run eval "$cmd" || exit $?
done
IFS="$save_ifs"
fi
@@ -6091,15 +5639,17 @@
notinst_deplibs=
relink_command=
- # Note that it is not necessary on cygwin/mingw to append a dot to
- # foo even if both foo and FILE.exe exist: automatic-append-.exe
- # behavior happens only for exec(3), not for open(2)! Also, sourcing
- # `FILE.' does not work on cygwin managed mounts.
- #
+ # To insure that "foo" is sourced, and not "foo.exe",
+ # finese the cygwin/MSYS system by explicitly sourcing "foo."
+ # which disallows the automatic-append-.exe behavior.
+ case $build in
+ *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
+ *) wrapperdot=${wrapper} ;;
+ esac
# If there is no directory component, then add one.
- case $wrapper in
- */* | *\\*) . ${wrapper} ;;
- *) . ./${wrapper} ;;
+ case $file in
+ */* | *\\*) . ${wrapperdot} ;;
+ *) . ./${wrapperdot} ;;
esac
# Check the variables that should have been set.
@@ -6127,21 +5677,34 @@
done
relink_command=
- # Note that it is not necessary on cygwin/mingw to append a dot to
- # foo even if both foo and FILE.exe exist: automatic-append-.exe
- # behavior happens only for exec(3), not for open(2)! Also, sourcing
- # `FILE.' does not work on cygwin managed mounts.
- #
+ # To insure that "foo" is sourced, and not "foo.exe",
+ # finese the cygwin/MSYS system by explicitly sourcing "foo."
+ # which disallows the automatic-append-.exe behavior.
+ case $build in
+ *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
+ *) wrapperdot=${wrapper} ;;
+ esac
# If there is no directory component, then add one.
- case $wrapper in
- */* | *\\*) . ${wrapper} ;;
- *) . ./${wrapper} ;;
+ case $file in
+ */* | *\\*) . ${wrapperdot} ;;
+ *) . ./${wrapperdot} ;;
esac
outputname=
if test "$fast_install" = no && test -n "$relink_command"; then
if test "$finalize" = yes && test -z "$run"; then
- tmpdir=`func_mktempdir`
+ tmpdir="/tmp"
+ test -n "$TMPDIR" && tmpdir="$TMPDIR"
+ tmpdir="$tmpdir/libtool-$$"
+ save_umask=`umask`
+ umask 0077
+ if $mkdir "$tmpdir"; then
+ umask $save_umask
+ else
+ umask $save_umask
+ $echo "$modename: error: cannot create temporary directory
\`$tmpdir'" 1>&2
+ continue
+ fi
file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
outputname="$tmpdir/$file"
# Replace the output file specification.
@@ -6165,7 +5728,7 @@
fi
# remove .exe since cygwin /usr/bin/install will append another
- # one anyway
+ # one anyways
case $install_prog,$host in
*/usr/bin/install*,*cygwin*)
case $file:$destfile in
@@ -6265,7 +5828,7 @@
# Exit here if they wanted silent mode.
test "$show" = : && exit $EXIT_SUCCESS
- $echo
"X----------------------------------------------------------------------" |
$Xsed
+ $echo
"----------------------------------------------------------------------"
$echo "Libraries have been installed in:"
for libdir in $libdirs; do
$echo " $libdir"
@@ -6298,7 +5861,7 @@
$echo
$echo "See any operating system documentation about shared libraries for"
$echo "more information, such as the ld(1) and ld.so(8) manual pages."
- $echo
"X----------------------------------------------------------------------" |
$Xsed
+ $echo
"----------------------------------------------------------------------"
exit $EXIT_SUCCESS
;;
@@ -6515,17 +6078,9 @@
rmfiles="$rmfiles $objdir/$n"
done
test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+ test "$mode" = clean && rmfiles="$rmfiles $objdir/$name
$objdir/${name}i"
- case "$mode" in
- clean)
- case " $library_names " in
- # " " in the beginning catches empty $dlname
- *" $dlname "*) ;;
- *) rmfiles="$rmfiles $objdir/$dlname" ;;
- esac
- test -n "$libdir" && rmfiles="$rmfiles $objdir/$name
$objdir/${name}i"
- ;;
- uninstall)
+ if test "$mode" = uninstall; then
if test -n "$library_names"; then
# Do each command in the postuninstall commands.
cmds=$postuninstall_cmds
@@ -6558,8 +6113,7 @@
IFS="$save_ifs"
fi
# FIXME: should reinstall the best remaining shared library.
- ;;
- esac
+ fi
fi
;;
@@ -6844,7 +6398,7 @@
$echo
$echo "Try \`$modename --help' for more information about other modes."
-exit $?
+exit $EXIT_SUCCESS
# The TAGs below are defined such that we never get into a situation
# in which we disable both kinds of libraries. Given conflicting
@@ -6858,11 +6412,12 @@
# configuration. But we'll never go from static-only to shared-only.
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
-disable_libs=shared
+build_libtool_libs=no
+build_old_libs=yes
# ### END LIBTOOL TAG CONFIG: disable-shared
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
-disable_libs=static
+build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;;
esac`
# ### END LIBTOOL TAG CONFIG: disable-static
# Local Variables:
Modified: GNUnet/src/include/Makefile.am
===================================================================
--- GNUnet/src/include/Makefile.am 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/include/Makefile.am 2006-06-15 16:49:28 UTC (rev 3011)
@@ -14,8 +14,6 @@
gnunetinclude_HEADERS = \
gnunet_blockstore.h \
gnunet_bootstrap_service.h \
- gnunet_config.h \
- gnunet_config_impl.h \
gnunet_core.h \
gnunet_datastore_service.h \
gnunet_dht.h \
@@ -23,7 +21,6 @@
gnunet_dht_lib.h \
gnunet_dht_service.h \
gnunet_ecrs_lib.h \
- gnunet_error.h \
gnunet_fragmentation_service.h \
gnunet_fs_lib.h \
gnunet_fsui_lib.h \
@@ -43,4 +40,11 @@
gnunet_traffic_service.h \
gnunet_transport.h \
gnunet_transport_service.h \
- gnunet_util.h
+ gnunet_util.h \
+ gnunet_util_config.h \
+ gnunet_util_config_impl.h \
+ gnunet_util_containers.h \
+ gnunet_util_crypto.h \
+ gnunet_util_error.h \
+ gnunet_util_error.h \
+ gnunet_util_error_loggers.h
Deleted: GNUnet/src/include/gnunet_config.h
===================================================================
--- GNUnet/src/include/gnunet_config.h 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/include/gnunet_config.h 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,210 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2006 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 include/gnunet_config.h
- * @brief configuration API
- *
- * @author Christian Grothoff
- */
-
-#ifndef GNUNET_CONFIG_H
-#define GNUNET_CONFIG_H
-
-#include "gnunet_error.h"
-
-#define GNUNET_CONFIG_VERSION 0x00000000
-
-#ifdef __cplusplus
-extern "C" {
-#if 0 /* keep Emacsens' auto-indent happy */
-}
-#endif
-#endif
-
-struct GC_Configuration;
-
-void GC_free(struct GC_Configuration * cfg);
-
-/**
- * Set the context for reporting configuration IO errors
- * (and errors reported by configuration change notification
- * callbacks when reading a new configuration).
- *
- * Note that for setting options a different context can be
- * used (since failing to change an option may have to be reported
- * in a fundamentally different way to the user).
- *
- * @parm ectx maybe NULL, in that case errors will no longer
- * be reported
- */
-void GC_set_error_context(struct GC_Configuration * cfg,
- struct GE_Context * ectx);
-
-/**
- * Parse a configuration file, add all of the options in the
- * file to the configuration environment.
- * @return 0 on success, -1 on error
- */
-int GC_parse_configuration(struct GC_Configuration * cfg,
- const char * filename);
-
-/**
- * Test if there are configuration options that were
- * changed since the last save.
- * @return 0 if clean, 1 if dirty, -1 on error (i.e. last save failed)
- */
-int GC_test_dirty(struct GC_Configuration * cfg);
-
-
-/**
- * Write configuration file.
- * @return 0 on success, -1 on error
- */
-int GC_write_configuration(struct GC_Configuration * cfg,
- const char * filename);
-
-/**
- * Get a configuration value that should be a number.
- * @param min minimal legal value
- * @param max maximal legal value
- * @param default default value (use indicated by return value)
- * @return 0 on success, -1 on error, 1 for default
- */
-int GC_get_configuration_value_number(struct GC_Configuration * cfg,
- const char * section,
- const char * option,
- unsigned long long min,
- unsigned long long max,
- unsigned long long default,
- unsigned long long * number);
-
-
-/**
- * Get a configuration value that should be a string.
- * @param default default value (use indicated by return value;
- * will NOT be aliased, maybe NULL)
- * @param value will be set to a freshly allocated configuration
- * value, or NULL if option is not specified and no default given
- * @return 0 on success, -1 on error, 1 for default
- */
-int GC_get_configuration_value_string(struct GC_Configuration * cfg,
- const char * section,
- const char * option,
- const char * default,
- char ** value);
-
-/**
- * Get a configuration value that should be in a set of
- * predefined strings
- * @param choices NULL-terminated list of legal values
- * @param default default value (use indicated by return value;
- * will NOT be aliased, maybe NULL), must be reference
- * into set given by choices
- * @param value will be set to an entry in the legal list,
- * or NULL if option is not specified and no default given
- * @return 0 on success, -1 on error, 1 for default
- */
-int GC_get_configuration_value_choice(struct GC_Configuration * cfg,
- const char * section,
- const char * option,
- const char ** choices,
- const char * default,
- (const char *)* value);
-
-/**
- * Set a configuration value that should be a number.
- * @return 0 on success, -1 on error (i.e. out of memory,
- * or update refused by registered callback)
- */
-int GC_set_configuration_value_number(struct GC_Configuration * cfg,
- struct GE_Context * ectx
- const char * section,
- const char * option,
- unsigned long long number);
-
-
-/**
- * Set a configuration value that should be a string.
- * @param value
- * @return 0 on success, -1 on error (i.e. out of memory,
- * or update refused by registered callback)
- */
-int GC_set_configuration_value_string(struct GC_Configuration * cfg,
- struct GE_Context * ectx
- const char * section,
- const char * option,
- const char * value);
-
-/**
- * Set a configuration value that should be in a set of
- * predefined strings.
- * @param value
- * @return 0 on success, -1 on error (i.e. out of memory,
- * or update refused by registered callback)
- */
-int GC_set_configuration_value_choice(struct GC_Configuration * cfg,
- struct GE_Context * ectx
- const char * section,
- const char * option,
- const char * choice);
-
-/**
- * Callback function that is called if a configuration option
- * changes. Note that the new value is not explicitly
- * communicated, the client must query it.
- *
- * @param ectx context to log errors to
- * @return 0 if the change is ok, -1 if the change must be
- * refused
- */
-typedef int (*GC_ChangeListener)(void * ctx,
- struct GC_Configuration * cfg,
- struct GE_Context * ectx,
- const char * section,
- const char * option);
-
-/**
- * Attach a callback that is notified whenever a
- * configuration option changes.
- * @return 0 on success, -1 on error
- */
-int GC_attachChangeListener(struct GC_Configuration * cfg,
- GC_ChangeListener callback,
- void * ctx);
-
-/**
- * Attach a callback that is notified whenever a
- * configuration option changes.
- * @return 0 on success, -1 on error, 1 for no such handler registered
- */
-int GC_detachChangeListener(struct GC_Configuration * cfg,
- GC_ChangeListener callback,
- void * ctx);
-
-
-#if 0 /* keep Emacsens' auto-indent happy */
-{
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-#endif
Deleted: GNUnet/src/include/gnunet_config_impl.h
===================================================================
--- GNUnet/src/include/gnunet_config_impl.h 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/include/gnunet_config_impl.h 2006-06-15 16:49:28 UTC (rev
3011)
@@ -1,202 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2006 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 include/gnunet_config_impl.h
- * @brief configuration API
- *
- * @author Christian Grothoff
- */
-
-#ifndef GNUNET_CONFIG_IMPL_H
-#define GNUNET_CONFIG_IMPL_H
-
-#include "gnunet_config.h"
-
-#ifdef __cplusplus
-extern "C" {
-#if 0 /* keep Emacsens' auto-indent happy */
-}
-#endif
-#endif
-
-typedef struct GC_Configuration {
-
- void * internal;
-
- void (*free)(struct GC_Configuration * cfg);
-
- /**
- * Set the context for reporting configuration IO errors
- * (and errors reported by configuration change notification
- * callbacks when reading a new configuration).
- *
- * Note that for setting options a different context can be
- * used (since failing to change an option may have to be reported
- * in a fundamentally different way to the user).
- *
- * @parm ectx maybe NULL, in that case errors will no longer
- * be reported
- */
- void (*set_error_context)(struct GC_Configuration * cfg,
- struct GE_Context * ectx);
-
- /**
- * Parse a configuration file, add all of the options in the
- * file to the configuration environment.
- * @return 0 on success, -1 on error
- */
- int (*parse_configuration)(struct GC_Configuration * cfg,
- const char * filename);
-
- /**
- * Test if there are configuration options that were
- * changed since the last save.
- * @return 0 if clean, 1 if dirty, -1 on error (i.e. last save failed)
- */
- int (*test_dirty)(struct GC_Configuration * cfg);
-
-
- /**
- * Write configuration file.
- * @return 0 on success, -1 on error
- */
- int (*write_configuration)(struct GC_Configuration * cfg,
- const char * filename);
-
- /**
- * Get a configuration value that should be a number.
- * @param min minimal legal value
- * @param max maximal legal value
- * @param default default value (use indicated by return value)
- * @return 0 on success, -1 on error, 1 for default
- */
- int (*get_configuration_value_number)(struct GC_Configuration * cfg,
- const char * section,
- const char * option,
- unsigned long long min,
- unsigned long long max,
- unsigned long long default,
- unsigned long long * number);
-
-
- /**
- * Get a configuration value that should be a string.
- * @param default default value (use indicated by return value;
- * will NOT be aliased, maybe NULL)
- * @param value will be set to a freshly allocated configuration
- * value, or NULL if option is not specified and no default given
- * @return 0 on success, -1 on error, 1 for default
- */
- int (*get_configuration_value_string)(struct GC_Configuration * cfg,
- const char * section,
- const char * option,
- const char * default,
- char ** value);
-
- /**
- * Get a configuration value that should be in a set of
- * predefined strings
- * @param choices NULL-terminated list of legal values
- * @param default default value (use indicated by return value;
- * will NOT be aliased, maybe NULL), must be reference
- * into set given by choices
- * @param value will be set to an entry in the legal list,
- * or NULL if option is not specified and no default given
- * @return 0 on success, -1 on error, 1 for default
- */
- int (*get_configuration_value_choice)(struct GC_Configuration * cfg,
- const char * section,
- const char * option,
- const char ** choices,
- const char * default,
- (const char *)* value);
-
- /**
- * Set a configuration value that should be a number.
- * @return 0 on success, -1 on error (i.e. out of memory,
- * or update refused by registered callback)
- */
- int (*set_configuration_value_number)(struct GC_Configuration * cfg,
- struct GE_Context * ectx
- const char * section,
- const char * option,
- unsigned long long number);
-
-
- /**
- * Set a configuration value that should be a string.
- * @param value
- * @return 0 on success, -1 on error (i.e. out of memory,
- * or update refused by registered callback)
- */
- int (*set_configuration_value_string)(struct GC_Configuration * cfg,
- struct GE_Context * ectx
- const char * section,
- const char * option,
- const char * value);
-
- /**
- * Set a configuration value that should be in a set of
- * predefined strings.
- * @param value
- * @return 0 on success, -1 on error (i.e. out of memory,
- * or update refused by registered callback)
- */
- int (*set_configuration_value_choice)(struct GC_Configuration * cfg,
- struct GE_Context * ectx
- const char * section,
- const char * option,
- const char * choice);
-
- /**
- * Attach a callback that is notified whenever a
- * configuration option changes.
- * @return 0 on success, -1 on error
- */
- int (*attachChangeListener)(struct GC_Configuration * cfg,
- GC_ChangeListener callback,
- void * ctx);
-
- /**
- * Attach a callback that is notified whenever a
- * configuration option changes.
- * @return 0 on success, -1 on error, 1 for no such handler registered
- */
- int (*detachChangeListener)(struct GC_Configuration * cfg,
- GC_ChangeListener callback,
- void * ctx);
-
-} GC_Configuration;
-
-/**
- * Create a GC_Configuration (C implementation).
- */
-GC_Configuration * GC_create_C_impl(void);
-
-
-#if 0 /* keep Emacsens' auto-indent happy */
-{
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-#endif
Deleted: GNUnet/src/include/gnunet_error.h
===================================================================
--- GNUnet/src/include/gnunet_error.h 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/include/gnunet_error.h 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,173 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2006 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 include/gnunet_error.h
- * @brief error handling API
- *
- * @author Christian Grothoff
- */
-
-#ifndef GNUNET_ERROR_H
-#define GNUNET_ERROR_H
-
-#define GNUNET_ERROR_VERSION 0x00000000
-
-#ifdef __cplusplus
-extern "C" {
-#if 0 /* keep Emacsens' auto-indent happy */
-}
-#endif
-#endif
-
-struct GE_Context;
-
-struct GE_Memory;
-
-typedef enum {
- /* type of event */
- GE_DEBUG = 0x00000001, /* DEBUG/CRON/EVERYTHING */
- GE_STATUS = 0x00000002, /* INFO/MESSAGE */
- GE_WARNING = 0x00000004,
- GE_ERROR = 0x00000008,
- GE_FATAL = 0x00000010, /* FATAL/FAILURE/NOTHING */
- GE_EVENTKIND = 0x000000FF, /* bitmask */
-
- /* who should see the message? */
- GE_USER = 0x01000000, /* current user, if possible */
- GE_ADMIN = 0x02000000, /* system administrator */
- GE_USERKIND = 0x0F000000, /* bitmask */
-
- /* how event should be routed */
- GE_REQUEST = 0x20000000, /* display on request only (i.e. low-priority
log, user demands verbose events) */
- GE_BULK = 0x40000000, /* display in bulk output (i.e. log-file, scroll
window, console) */
- GE_IMMEDIATE = 0x80000000, /* display immediately (i.e. pop-up, e-mail) */
- GE_ROUTEKIND = 0xF0000000, /* bitmask */
- GE_ALL = 0xFFFFFFFF,
-} GE_MASK;
-
-
-void GE_LOG(struct GE_Context * ctx,
- GE_KIND kind,
- const char * message,
- ...);
-
-/**
- * Create a context that sends events to two other contexts.
- * Note that the client must stop using ctx1/ctx2 henceforth.
- */
-struct GE_Context * GE_create_context_multiplexer(struct GE_Context * ctx1,
- struct GE_Context * ctx2);
-
-
-/**
- * User-defined handler for Log events.
- */
-typedef void (*GE_LogHandler)(void * ctx,
- GE_MASK kind,
- const char * date,
- const char * msg);
-
-/**
- * Create a log context that calls a callback function
- * for matching events.
- *
- * @param mask which events is this handler willing to process?
- * an event must be non-zero in all 3 GE_MASK categories
- * to be passed to this handler
- */
-struct GE_Context * GE_create_context_callback(GE_MASK mask,
- GE_LogHandler handler,
- void * ctx);
-
-/**
- * Create a logger that writes events to a file.
- *
- * @param mask which events should be logged?
- * @param filename which file should we log to?
- * @param logDate should the context log event dates?
- * @param logrotate after how many seconds should the log
- * files be rotated (use 0 for no rotation)
- */
-struct GE_Context * GE_create_context_logfile(GE_MASK mask,
- const char * filename,
- int logDate,
- unsigned int logrotate);
-
-/**
- * Create a logger that keeps events in memory (to be
- * queried later in bulk).
- */
-struct GE_Context * GE_create_context_memory(GE_MASK mask,
- struct GE_Memory * memory);
-
-/**
- * Free a log context.
- */
-void GE_free_context(GE_Context * ctx);
-
-#if FICTION
-/**
- * @param address e-mail address to send the logs to
- * @param server hostname of SMTP gateway, NULL for using local "mail" command
- * @param port port to use for SMTP
- * @param logDate should the date be each of the log lines?
- * @param bulkSize for GE_BULK messages, how many lines of messages
- * should be accumulated before an e-mail is transmitted?
- */
-struct GE_Context * GE_create_context_email(GE_MASK mask,
- const char * address,
- const char * server,
- unsigned short port,
- int logDate,
- unsigned int bulkSize);
-#endif
-
-/**
- * Create a context to log messages in memory.
- * This is useful if we first need to capture all
- * log messages of an operation to provide the
- * final error in bulk to the client (i.e. as
- * a return value, possibly over the network).
- *
- * @param maxSize the maximum number of messages to keep, 0 for unbounded
- * (if more than maxSize messages are received, message number maxSize
- * will be set to a corresponding warning)
- */
-struct GE_Memory * GE_create_memory(unsigned int maxSize);
-
-/**
- * For all messages stored in the memory, call the handler.
- */
-void GE_poll_memory(struct GE_Memory * memory,
- GE_LogHandler handler,
- void * ctx);
-
-void GE_free_memory(struct GE_Memory * memory);
-
-
-#if 0 /* keep Emacsens' auto-indent happy */
-{
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-#endif
Modified: GNUnet/src/include/gnunet_util.h
===================================================================
--- GNUnet/src/include/gnunet_util.h 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/include/gnunet_util.h 2006-06-15 16:49:28 UTC (rev 3011)
@@ -27,6 +27,15 @@
* @author Gerd Knorr <address@hidden>
* @author Ioana Patrascu
* @author Tzvetan Horozov
+ *
+ * Features:
+ * - threading (semaphore, pthreads, cron)
+ * - basic libc wrappers (malloc, strdup, iconv)
+ * - disk io (filesize, read, write, copy, remove, scan directory)
+ * - network io (client socket, read, write, nonblocking, etc.)
+ * - process management
+ * - lots of other small functions
+ * ??: sort/regroup ??
*/
#ifndef GNUNET_UTIL_H
@@ -47,6 +56,9 @@
unconditionally available... */
#include <stdlib.h>
+/* add error and config prototypes */
+#include "gnunet_util_config.h"
+
#ifdef __cplusplus
extern "C" {
#if 0 /* keep Emacsens' auto-indent happy */
@@ -112,27 +124,6 @@
#define cronYEARS ((cron_t)(365 * cronDAYS))
/**
- * @brief log levels
- */
-typedef enum LOG_Level {
- LOG_NOTHING = 0,
- LOG_FATAL,
- LOG_ERROR,
- LOG_FAILURE,
- LOG_WARNING,
- LOG_MESSAGE,
- LOG_INFO,
- LOG_DEBUG,
- LOG_CRON,
- LOG_EVERYTHING,
-} LOG_Level;
-
-/**
- * @brief length of the sessionkey in bytes (256 BIT sessionkey)
- */
-#define SESSIONKEY_LEN (256/8)
-
-/**
* @brief Default names of the configuration files.
*/
#define DEFAULT_CLIENT_CONFIG_FILE "~/.gnunet/gnunet.conf"
@@ -144,24 +135,6 @@
#define HOME_DAEMON_CONFIG_FILE "~/.gnunet/gnunetd.conf"
#define GNUNET_HOME_DIRECTORY "~/.gnunet/"
-/**
- * @brief Length of RSA encrypted data (2048 bit)
- *
- * We currently do not handle encryption of data
- * that can not be done in a single call to the
- * RSA methods (read: large chunks of data).
- * We should never need that, as we can use
- * the hash for larger pieces of data for signing,
- * and for encryption, we only need to encode sessionkeys!
- */
-#define RSA_ENC_LEN 256
-
-/**
- * Length of an RSA KEY (d,e,len), 2048 bit (=256 octests) key d, 2 byte e
- */
-#define RSA_KEY_LEN 258
-
-
#define HELP_HELP \
{ 'h', "help", NULL, \
gettext_noop("print this help") }
@@ -199,9 +172,11 @@
/* **************** structs ****************** */
/**
- * The private information of an RSA key pair.
+ * @brief 512-bit hashcode
*/
-struct PrivateKey;
+typedef struct {
+ unsigned int bits[512 / 8 / sizeof(unsigned int)]; /* = 16 */
+} HashCode512;
/**
* Header for all Client-Server communications.
@@ -321,11 +296,6 @@
struct CIDR6Network;
/**
- * Callback that performs logging.
- */
-typedef void (*TLogProc)(const char *txt);
-
-/**
* Main method of a thread.
*/
typedef void * (*PThreadMain)(void*);
@@ -338,14 +308,7 @@
} PTHREAD_T;
/**
- * @brief 512-bit hashcode
- */
-typedef struct {
- unsigned int bits[512 / 8 / sizeof(unsigned int)]; /* = 16 */
-} HashCode512;
-
-/**
- * The identity of the host (basically the RIPE160 hashcode of
+ * The identity of the host (basically the SHA-512 hashcode of
* it's public key).
*/
typedef struct {
@@ -353,72 +316,6 @@
} PeerIdentity;
/**
- * @brief 0-terminated ASCII encoding of a HashCode512.
- */
-typedef struct {
- unsigned char encoding[104];
-} EncName;
-
-/**
- * GNUnet mandates a certain format for the encoding
- * of private RSA key information that is provided
- * by the RSA implementations. This format is used
- * to serialize a private RSA key (typically when
- * writing it to disk).
- */
-typedef struct {
- /**
- * Total size of the structure, in bytes, in big-endian!
- */
- unsigned short len;
- unsigned short sizen;/* in big-endian! */
- unsigned short sizee;/* in big-endian! */
- unsigned short sized;/* in big-endian! */
- unsigned short sizep;/* in big-endian! */
- unsigned short sizeq;/* in big-endian! */
- unsigned short sizedmp1;/* in big-endian! */
- unsigned short sizedmq1;/* in big-endian! */
- /* followed by the actual values */
-} PrivateKeyEncoded;
-
-/**
- * @brief an RSA signature
- */
-typedef struct {
- unsigned char sig[RSA_ENC_LEN];
-} Signature;
-
-/**
- * @brief A public key.
- */
-typedef struct {
- /**
- * In big-endian, must be RSA_KEY_LEN+2
- */
- unsigned short len;
- /**
- * Size of n in key; in big-endian!
- */
- unsigned short sizen;
- /**
- * The key itself, contains n followed by e.
- */
- unsigned char key[RSA_KEY_LEN];
- /**
- * Padding (must be 0)
- */
- unsigned short padding;
-} PublicKey;
-
-/**
- * RSA Encrypted data.
- */
-typedef struct {
- unsigned char encoding[RSA_ENC_LEN];
-} RSAEncryptedData;
-
-
-/**
* @brief Structure for MUTual EXclusion (Mutex).
*
* Essentially a wrapper around pthread_mutex_t.
@@ -487,24 +384,6 @@
} GNUNET_TCP_SOCKET;
/**
- * @brief type for session keys
- */
-typedef struct {
- unsigned char key[SESSIONKEY_LEN];
- int crc32; /* checksum! */
-} SESSIONKEY;
-
-/**
- * @brief IV for sym cipher
- *
- * NOTE: must be smaller (!) in size than the
- * HashCode512.
- */
-typedef struct {
- unsigned char iv[SESSIONKEY_LEN/2];
-} INITVECTOR;
-
-/**
* Method to parse the command line. The results
* are to be stored in the configuration module.
* @param argc the number of arguments
@@ -533,73 +412,10 @@
char * description;
} Help;
-/**
- * @brief bloomfilter representation (opaque)
- */
-struct Bloomfilter;
-/**
- * Iterator over all HashCodes stored in a Bloomfilter.
- */
-typedef HashCode512 * (*ElementIterator)(void * arg);
-
-/**
- * @brief a Vector (ordered variable size set of elements), opaque
- */
-struct Vector;
-
-/**
- * @brief a hash table, opaque
- */
-struct HashTable;
-
-
/* **************** Functions and Macros ************* */
/**
- * Compute the CRC32 checksum for the first len
- * bytes of the buffer.
- *
- * @param buf the data over which we're taking the CRC
- * @param len the length of the buffer in bytes
- * @return the resulting CRC32 checksum
- */
-int crc32N(const void * buf, int len);
-
-/**
- * Produce a random value.
- *
- * @param i the upper limit (exclusive) for the random number
- * @return a random value in the interval [0,i[.
- */
-unsigned int randomi(unsigned int i);
-
-/**
- * Random on unsigned 64-bit values. We break them down into signed
- * 32-bit values and reassemble the 64-bit random value bit-wise.
- */
-unsigned long long randomi64(unsigned long long u);
-
-unsigned long long weak_randomi64(unsigned long long u);
-
-/**
- * Get an array with a random permutation of the
- * numbers 0...n-1.
- * @param mode STRONG if the strong (but expensive) PRNG should be used, WEAK
otherwise
- * @param n the size of the array
- * @return the permutation array (allocated from heap)
- */
-int * permute(int mode, int n);
-
-/**
- * Produce a cryptographically weak random value.
- *
- * @param i the upper limit (exclusive) for the random number
- * @return a random value in the interval [0,i[.
- */
-unsigned int weak_randomi(unsigned int i);
-
-/**
* Convert a long-long to host-byte-order.
* @param n the value in network byte order
* @return the same value in host byte order
@@ -624,56 +440,6 @@
const char * charset);
/**
- * Macro for assertions in GNUnet. Use liberally and instead
- * of specific but cryptic error messages that merely refer
- * to the location of the problem but that would be evident
- * by looking at the code instead. Do NOT use this macro if
- * an error message with context information (strerror,
- * filenames, etc.) would be useful.
- *
- * Note that a failed assertion always aborts, so do not use
- * this for errors that can be managed.
- */
-#define GNUNET_ASSERT(cond) do { if (! (cond)) errexit(_("Assertion failed at
%s:%d.\n"), __FILE__, __LINE__); } while(0);
-
-#define GNUNET_ASSERT_FL(cond, f, l) do { if (! (cond)) errexit(_("Assertion
failed at %s:%d.\n"), f, l); } while(0);
-
-
-void registerConfigurationUpdateCallback
-(NotifyConfigurationUpdateCallback cb);
-
-void unregisterConfigurationUpdateCallback
-(NotifyConfigurationUpdateCallback cb);
-
-/**
- * Call all registered configuration update callbacks,
- * the configuration has changed.
- */
-void triggerGlobalConfigurationRefresh(void);
-
-/**
- * @brief Read a specific configuration file. The previous configuration
- * will NOT be discarded if this method is invoked twice.
- * @param fn the file to read
- * @return YES on success, NO otherwise
- */
-int readConfigFile(const char *fn);
-
-/**
- * Read the specified configuration file. The previous
- * configuration will be discarded if this method is
- * invoked twice. The configuration file that is read
- * can be set using setConfigurationString on
- * section "FILES" and option "gnunet.conf".
- *
- * This method should be invoked after the options have
- * been parsed (and eventually the configuration filename
- * default has been overriden) and if gnunetd receives
- * a SIGHUP.
- */
-void readConfiguration(void);
-
-/**
* Expand an expression of the form
* "$FOO/BAR" to "DIRECTORY/BAR" where
* either in the current section or
@@ -683,105 +449,6 @@
char * orig);
/**
- * Obtain a filename from the given section and option. If the
- * filename is not specified, die with the given error message (do not
- * die if errMsg == NULL).
- *
- * @param section from which section, may not be NULL
- * @param option which option, may not be NULL
- *
- * @param errMsg the errormessage, should contain two %s tokens for
- * the section and the option.
- *
- * @return the specified filename (caller must free), or NULL if no
- * filename was specified and errMsg == NULL
- */
-char * getFileName(const char * section,
- const char * option,
- const char * errMsg);
-
-/**
- * Check if a string in the configuration matches a given value. This
- * method should be preferred over getConfigurationString since this
- * method can avoid making a copy of the configuration string that
- * then must be freed by the caller.
- *
- * @param section from which section, may not be NULL
- * @param option which option, may not be NULL
- * @param value the value to compare against
- * @return YES or NO
- */
-int testConfigurationString(const char * section,
- const char * option,
- const char * value);
-
-/**
- * Obtain a string from the configuration.
- * @param section from which section, may not be NULL
- * @param option which option, may not be NULL
- * @return a freshly allocated string, caller must free!
- * Note that the result can be NULL if the option is not set.
- */
-char * getConfigurationString(const char * section,
- const char * option);
-
-/**
- * Obtain an int from the configuration.
- * @param section from which section
- * @param option which option
- * @return 0 if no option is specified
- */
-unsigned int getConfigurationInt(const char * section,
- const char * option);
-
-/**
- * Set an option.
- * @param section from which section, may not be NULL
- * @param option which option, may not be NULL
- * @param value the value to use, may be NULL
- * @return the previous value (or NULL if none),
- * caller must free!
- */
-char * setConfigurationString(const char * section,
- const char * option,
- const char * value);
-
-/**
- * Set an option.
- * @param section from which section, may not be NULL
- * @param option which option, may not be NULL
- * @param value the value to use
- * @return the previous value (or 0 if none)
- */
-unsigned int setConfigurationInt(const char * section,
- const char * option,
- const unsigned int value);
-
-/**
- * Get the command line strings (the ones
- * remaining after getopt-style parsing).
- * @param value the values
- + @return the number of values
- */
-int getConfigurationStringList(char *** value);
-
-/**
- * Set the list of command line options (remainder after getopt style
- * parsing).
- *
- * @param value the values
- + @param count the number of values
- */
-void setConfigurationStringList(char ** value,
- int count);
-
-/**
- * @brief Check if a setting was specified in a .conf file
- * @return YES or NO
- */
-int isConfigurationItemSet(const char *section, const char *option);
-
-/**
* Start the cron jobs.
*/
void startCron(void);
@@ -986,94 +653,9 @@
*/
struct CIDR6Network * parseRoutes6(const char * routeList);
-/* use IFLOG(LOG_XXX, statement(s)) for statements
- that should only be executed if we are at the
- right loglevel */
-#define IFLOG(a,b) {if (getLogLevel() >= a) {b;} }
-
-void LOGHASH(size_t size,
- const void * data);
-
#define PRIP(ip) (unsigned int)(((unsigned int)(ip))>>24), (unsigned
int)((((unsigned)(ip)))>>16 & 255), (unsigned int)((((unsigned int)(ip)))>>8 &
255), (unsigned int)((((unsigned int)(ip))) & 255)
/**
- * Get the current loglevel.
- */
-LOG_Level getLogLevel(void);
-
-/**
- * Return the logfile
- */
-void *getLogfile(void);
-
-/**
- * errexit - log an error message and exit.
- *
- * @param format the string describing the error message
- */
-void errexit(const char *format, ...);
-
-/**
- * Register an additional logging function which gets
- * called whenever GNUnet LOG()s something
- *
- * @param proc the function to register
- */
-void setCustomLogProc(TLogProc proc);
-
-/**
- * Log a message.
- * @param minLogLevel the minimum loglevel that we must be at
- * @param format the format string describing the message
- */
-void LOG(LOG_Level minLogLevel,
- const char * format,
- ...);
-
-#define BREAK() do { breakpoint_(__FILE__,__LINE__); } while(0);
-
-#define BREAK_FL(f, n) do { breakpoint_(f,n); } while(0);
-
-/**
- * Log an error message at log-level 'level' that indicates
- * a failure of the command 'cmd' with the message given
- * by strerror(errno).
- */
-#define LOG_STRERROR(level, cmd) do { LOG(level, _("`%s' failed at %s:%d with
error: %s\n"), cmd, __FILE__, __LINE__, STRERROR(errno)); } while(0);
-
-/**
- * Die with an error message that indicates
- * a failure of the command 'cmd' with the message given
- * by strerror(errno).
- */
-#define DIE_STRERROR(cmd) do { errexit(_("`%s' failed at %s:%d with error:
%s\n"), cmd, __FILE__, __LINE__, STRERROR(errno)); } while(0);
-
-#define DIE_STRERROR_FL(cmd, f, l) do { errexit(_("`%s' failed at %s:%d with
error: %s\n"), cmd, f, l, STRERROR(errno)); } while(0);
-
-/**
- * Log an error message at log-level 'level' that indicates
- * a failure of the command 'cmd' on file 'filename'
- * with the message given by strerror(errno).
- */
-#define LOG_FILE_STRERROR(level, cmd, filename) do { LOG(level, _("`%s' failed
on file `%s' at %s:%d with error: %s\n"), cmd, filename, __FILE__, __LINE__,
STRERROR(errno)); } while(0);
-
-#define LOG_FILE_STRERROR_FL(level, cmd, filename, f, l) do { LOG(level,
_("`%s' failed on file `%s' at %s:%d with error: %s\n"), cmd, filename, f, l,
STRERROR(errno)); } while(0);
-
-/**
- * Die with an error message that indicates
- * a failure of the command 'cmd' on file 'filename'
- * with the message given by strerror(errno).
- */
-#define DIE_FILE_STRERROR(cmd, filename) do { errexit(_("`%s' failed on file
`%s' at %s:%d with error: %s\n"), cmd, filename, __FILE__, __LINE__,
STRERROR(errno)); } while(0);
-
-/**
- * gdb breakpoint
- */
-void breakpoint_(const char * filename,
- const int linenumber);
-
-
-/**
* Allocate memory. Checks the return value, aborts if no more
* memory is available. Don't use xmalloc_ directly. Use the
* MALLOC macro.
@@ -1236,6 +818,12 @@
#define GROW(arr,size,tsize) xgrow_((void**)&arr, sizeof(arr[0]), &size,
tsize, __FILE__, __LINE__)
/**
+ * Append an element to a list (growing the
+ * list by one).
+ */
+#define APPEND(arr,size,element) GROW(arr,size,size+1); arr[size-1] = (element)
+
+/**
* TIME prototype. "man time".
*/
TIME_T TIME(TIME_T * t);
@@ -1264,42 +852,6 @@
*/
char * fileSizeToFancyString(unsigned long long size);
-/**
- * Create a new Session key.
- */
-void makeSessionkey(SESSIONKEY * key);
-
-/**
- * Encrypt a block with the public key of another
- * host that uses the same cyper.
- * @param block the block to encrypt
- * @param len the size of the block
- * @param sessionkey the key used to encrypt
- * @param iv the initialization vector to use, use INITVALUE
- * for streams.
- * @returns the size of the encrypted block, -1 for errors
- */
-int encryptBlock(const void * block,
- unsigned short len,
- const SESSIONKEY * sessionkey,
- const INITVECTOR * iv,
- void * result);
-
-/**
- * Decrypt a given block with the sessionkey.
- * @param sessionkey the key used to decrypt
- * @param block the data to decrypt, encoded as returned by encrypt
- * @param size how big is the block?
- * @param iv the initialization vector to use
- * @param result address to store the result at
- * @return -1 on failure, size of decrypted block on success
- */
-int decryptBlock(const SESSIONKEY * sessionkey,
- const void * block,
- unsigned short size,
- const INITVECTOR * iv,
- void * result);
-
#define SEMAPHORE_NEW(value) semaphore_new_(value, __FILE__, __LINE__)
#define SEMAPHORE_FREE(s) semaphore_free_(s, __FILE__, __LINE__)
#define SEMAPHORE_DOWN(s) semaphore_down_(s, __FILE__, __LINE__)
@@ -1445,228 +997,9 @@
const char * filename,
const int linenumber);
-/**
- * Convert hash to ASCII encoding.
- * @param block the hash code
- * @param result where to store the encoding (EncName can be
- * safely cast to char*, a '\0' termination is set).
- */
-void hash2enc(const HashCode512 * block,
- EncName * result);
-/**
- * Convert ASCII encoding back to hash
- * @param enc the encoding
- * @param result where to store the hash code
- * @return OK on success, SYSERR if result has the wrong encoding
- */
-int enc2hash(const char * enc,
- HashCode512 * result);
/**
- * @brief Convert a weak 64 bit hash into a string
- * @param h the hashcode
- * @param e the string (zero terminated)
- */
-void encWeakHash(unsigned long long h, char e[14]);
-
-/**
- * Compute the distance between 2 hashcodes.
- * The computation must be fast, not involve
- * a.a or a.e (they're used elsewhere), and
- * be somewhat consistent. And of course, the
- * result should be a positive number.
- * @return number between 0 and 65536
- */
-unsigned int distanceHashCode512(const HashCode512 * a,
- const HashCode512 * b);
-
-/**
- * compare two hashcodes.
- */
-int equalsHashCode512(const HashCode512 * a,
- const HashCode512 * b);
-
-/**
- * Hash block of given size.
- * @param block the data to hash, length is given as a second argument
- * @param ret pointer to where to write the hashcode
- */
-void hash(const void * block,
- unsigned int size,
- HashCode512 * ret);
-
-
-/**
- * Compute the hash of an entire file.
- * @return OK on success, SYSERR on error
- */
-int getFileHash(const char * filename,
- HashCode512 * ret);
-
-/**
- * @brief Create a cryptographically weak hashcode from a buffer
- * @param z the buffer to hash
- * @param n the size of z
- * @return the hashcode
- */
-unsigned long long weakHash(const char *z, int n);
-
-/**
- * Check if 2 hosts are the same (returns 1 if yes)
- * @param first the first host
- * @param second the second host
- * @returns 1 if the hosts are the same, 0 otherwise
- */
-int hostIdentityEquals(const PeerIdentity * first,
- const PeerIdentity * second);
-
-void makeRandomId(HashCode512 * result);
-
-/* compute result(delta) = b - a */
-void deltaId(const HashCode512 * a,
- const HashCode512 * b,
- HashCode512 * result);
-
-/* compute result(b) = a + delta */
-void addHashCodes(const HashCode512 * a,
- const HashCode512 * delta,
- HashCode512 * result);
-
-/* compute result = a ^ b */
-void xorHashCodes(const HashCode512 * a,
- const HashCode512 * b,
- HashCode512 * result);
-
-/**
- * Convert a hashcode into a key.
- */
-void hashToKey(const HashCode512 * hc,
- SESSIONKEY * skey,
- INITVECTOR * iv);
-
-/**
- * Obtain a bit from a hashcode.
- * @param code the hash to index bit-wise
- * @param bit index into the hashcode, [0...159]
- * @return Bit \a bit from hashcode \a code, -1 for invalid index
- */
-int getHashCodeBit(const HashCode512 * code,
- unsigned int bit);
-
-/**
- * Compare function for HashCodes, producing a total ordering
- * of all hashcodes.
- * @return 1 if h1 > h2, -1 if h1 < h2 and 0 if h1 == h2.
- */
-int hashCodeCompare(const HashCode512 * h1,
- const HashCode512 * h2);
-
-/**
- * Find out which of the two hash codes is closer to target
- * in the XOR metric (Kademlia).
- * @return -1 if h1 is closer, 1 if h2 is closer and 0 if h1==h2.
- */
-int hashCodeCompareDistance(const HashCode512 * h1,
- const HashCode512 * h2,
- const HashCode512 * target);
-
-/**
- * create a new hostkey. Callee must free return value.
- */
-struct PrivateKey * makePrivateKey(void);
-
-/**
- * Deterministically (!) create a hostkey using only the
- * given HashCode as input to the PRNG.
- */
-struct PrivateKey * makeKblockKey(const HashCode512 * input);
-
-/**
- * Free memory occupied by hostkey
- * @param hostkey pointer to the memory to free
- */
-void freePrivateKey(struct PrivateKey * hostkey);
-
-/**
- * Extract the public key of the host.
- * @param result where to write the result.
- */
-void getPublicKey(const struct PrivateKey * hostkey,
- PublicKey * result);
-
-/**
- * Encode the private key in a format suitable for
- * storing it into a file.
- * @param hostkey the hostkey to use
- * @returns encoding of the private key.
- */
-PrivateKeyEncoded * encodePrivateKey(const struct PrivateKey * hostkey);
-
-/**
- * Decode the private key from the file-format back
- * to the "normal", internal, RSA format.
- * @param encoded the encoded hostkey
- * @returns the decoded hostkey
- */
-struct PrivateKey * decodePrivateKey(const PrivateKeyEncoded * encoding);
-
-/**
- * Encrypt a block with the public key of another host that uses the
- * same cyper.
- *
- * @param block the block to encrypt
- * @param size the size of block
- * @param publicKey the encoded public key used to encrypt
- * @param target where to store the encrypted block
- * @returns SYSERR on error, OK if ok
- */
-int encryptPrivateKey(const void * block,
- unsigned short size,
- const PublicKey * publicKey,
- RSAEncryptedData * target);
-
-/**
- * Decrypt a given block with the hostkey.
- *
- * @param key the key to use
- * @param block the data to decrypt, encoded as returned by encrypt, not
consumed
- * @param result pointer to a location where the result can be stored
- * @param size how many bytes of a result are expected? Must be exact.
- * @returns the size of the decrypted block (that is, size) or -1 on error
- */
-int decryptPrivateKey(const struct PrivateKey * key,
- const RSAEncryptedData * block,
- void * result,
- unsigned short size);
-
-/**
- * Sign a given block.
- *
- * @param block the data to sign, first unsigned short_SIZE bytes give length
- * @param size how many bytes to sign
- * @param result where to write the signature
- * @return SYSERR on error, OK on success
- */
-int sign(const struct PrivateKey * key,
- unsigned short size,
- const void * block,
- Signature * result);
-
-/**
- * Verify signature.
- * @param block the signed data
- * @param len the length of the block
- * @param sig signature
- * @param publicKey public key of the signer
- * @returns OK if ok, SYSERR if invalid
- */
-int verifySig(const void * block,
- unsigned short len,
- const Signature * sig,
- const PublicKey * publicKey);
-
-/**
* Initialize the util module.
* @param argc the number of arguments
* @param argv the command line arguments
@@ -2014,11 +1347,6 @@
*/
int rm_minus_rf(const char * fileName);
-/* use the CLOSE macro... */
-void close_(int fd, const char * filename, int linenumber);
-
-#define closefile(fd) close_(fd, __FILE__, __LINE__)
-
/**
* Stop the application.
* @param signum is ignored
@@ -2061,75 +1389,6 @@
char * optarg);
/**
- * Load a bloom-filter from a file.
- * @param filename the name of the file (or the prefix)
- * @param size the size of the bloom-filter (number of
- * bytes of storage space to use)
- * @param k the number of hash-functions to apply per
- * element (number of bits set per element in the set)
- * @return the bloomfilter
- */
-struct Bloomfilter * loadBloomfilter(const char * filename,
- unsigned int size,
- unsigned int k);
-
-/**
- * Test if an element is in the filter.
- * @param e the element
- * @param bf the filter
- * @return YES if the element is in the filter, NO if not
- */
-int testBloomfilter(struct Bloomfilter * bf,
- const HashCode512 * e);
-
-/**
- * Add an element to the filter
- * @param bf the filter
- * @param e the element
- */
-void addToBloomfilter(struct Bloomfilter * bf,
- const HashCode512 * e);
-
-/**
- * Remove an element from the filter.
- * @param bf the filter
- * @param e the element to remove
- */
-void delFromBloomfilter(struct Bloomfilter * bf,
- const HashCode512 * e);
-
-/**
- * Free the space associcated with a filter
- * in memory, flush to drive if needed (do not
- * free the space on the drive)
- * @param bf the filter
- */
-void freeBloomfilter(struct Bloomfilter * bf);
-
-/**
- * Reset a bloom filter to empty.
- * @param bf the filter
- */
-void resetBloomfilter(struct Bloomfilter * bf);
-
-/**
- * Resize a bloom filter. Note that this operation
- * is pretty costly. Essentially, the bloom filter
- * needs to be completely re-build.
- *
- * @param bf the filter
- * @param iterator an iterator over all elements stored in the BF
- * @param iterator_arg argument to the iterator function
- * @param size the new size for the filter
- * @param k the new number of hash-function to apply per element
- */
-void resizeBloomfilter(struct Bloomfilter * bf,
- ElementIterator iterator,
- void * iterator_arg,
- unsigned int size,
- unsigned int k);
-
-/**
* Depending on doBlock, enable or disable the nonblocking mode
* of socket s.
*
@@ -2226,277 +1485,6 @@
...);
/**
- * A debug function that dumps the vector to stderr.
- */
-void vectorDump(struct Vector *v);
-
-/**
- * @param vss Size of the VectorSegment data area. The "correct" value for this
- * is a bit of a gamble, as it depends on both the operations you
- * perform on the vectors and how much data is stored in them. In
- * general, the more data you store the bigger the segments should be,
- * or otherwise the increased length of the linked list will become a
- * bottleneck for operations that are performed on arbitrary indexes.
- */
-struct Vector * vectorNew(unsigned int vss);
-
-/**
- * Free vector structure including its data segments, but _not_ including the
- * stored void pointers. It is the user's responsibility to empty the vector
- * when necessary to avoid memory leakage.
- */
-void vectorFree(struct Vector * v);
-
-size_t vectorSize(struct Vector * v);
-
-/**
- * Insert a new element in the vector at given index.
- * @return OK on success, SYSERR if the index is out of bounds.
- */
-int vectorInsertAt(struct Vector * v,
- void * object,
- unsigned int index);
-
-/**
- * Insert a new element at the end of the vector.
- */
-void vectorInsertLast(struct Vector * v, void * object);
-
-/**
- * Return the element at given index in the vector or NULL if the index is out
- * of bounds. The iterator is set to point to the returned element.
- */
-void * vectorGetAt(struct Vector * v,
- unsigned int index);
-
-/**
- * Return the first element in the vector, whose index is 0, or NULL if the
- * vector is empty. The iterator of the vector is set to point to the first
- * element.
- */
-void * vectorGetFirst(struct Vector * v);
-
-/**
- * Return the last element in the vector or NULL if the vector is empty. The
- * iterator of the vector is set to point to the last element.
- */
-void * vectorGetLast(struct Vector * v);
-
-/**
- * Return the next element in the vector, as called after vector_get_at() or
- * vector_get_first(). The return value is NULL if there are no more elements
- * in the vector or if the iterator has not been set.
- */
-void * vectorGetNext(struct Vector * v);
-
-/**
- * Return the previous element in the vector, as called after vector_get_at()
- * or vector_get_last(). The return value is NULL if there are no more
- * elements in the vector or if the iterator has not been set.
- */
-void * vectorGetPrevious(struct Vector * v);
-
-/**
- * Delete and return the element at given index. NULL is returned if index is
- * out of bounds.
- */
-void * vectorRemoveAt(struct Vector * v,
- unsigned int index);
-
-/**
- * Delete and return the last element in the vector, or NULL if the vector
- * is empty.
- */
-void * vectorRemoveLast(struct Vector * v);
-
-/**
- * Delete and return given object from the vector, or return NULL if the object
- * is not found.
- */
-void * vectorRemoveObject(struct Vector * v, void * object);
-
-/**
- * Set the given index in the vector. The old value of the index is
- * returned, or NULL if the index is out of bounds.
- */
-void * vectorSetAt(struct Vector * v,
- void * object,
- unsigned int index);
-
-/**
- * Set the index occupied by the given object to point to the new object.
- * The old object is returned, or NULL if it's not found.
- */
-void * vectorSetObject(struct Vector * v,
- void * object,
- void * old_object);
-
-/**
- * Swaps the contents of index1 and index2. Return value is OK
- * on success, SYSERR if either index is out of bounds.
- */
-int vectorSwap(struct Vector * v,
- unsigned int index1,
- unsigned int index2);
-
-/**
- * Return the index of given element or -1 if the element is not found.
- */
-unsigned int vectorIndexOf(struct Vector * v,
- void * object);
-
-/**
- * Return the data stored in the vector as a single dynamically
- * allocated array of (void *), which must be FREEed by the caller.
- * Use the functions get_{at,first,last,next,previous} instead, unless
- * you really need to access everything in the vector as fast as
- * possible.
- */
-void ** vectorElements(struct Vector * v);
-
-/**
- * @brief creates a new HashTable
- * @param numOfBuckets the number of buckets to start the HashTable out with.
- * Must be greater than zero, and should be prime.
- * Ideally, the number of buckets should between 1/5
- * and 1 times the expected number of elements in the
- * HashTable. Values much more or less than this will
- * result in wasted memory or decreased performance
- * respectively. The number of buckets in a HashTable
- * can be re-calculated to an appropriate number by
- * calling the HashTableRehash() function once the
- * HashTable has been populated. The number of buckets
- * in a HashTable may also be re-calculated
- * automatically if the ratio of elements to buckets
- * passes the thresholds set by ht_setIdealRatio().
- * @return a new Hashtable, or NULL on error
- */
-struct HashTable *ht_create(long numOfBuckets);
-
-/**
- * @brief destroys an existing HashTable
- * @param hashTable the HashTable to destroy
- */
-void ht_destroy(struct HashTable *hashTable);
-
-/**
- * @brief checks the existence of a key in a HashTable
- * @param hashTable the HashTable to search
- * @param key the key to search for
- * @return whether or not the specified HashTable contains the
- * specified key
- */
-int ht_containsKey(const struct HashTable *hashTable, const void *key, const
unsigned int keylen);
-
-/**
- * @brief checks the existence of a value in a HashTable
- * @param hashTable the HashTable to search
- * @param value the value to search for
- * @return whether or not the specified HashTable contains the
- * specified value
- */
-int ht_containsValue(const struct HashTable *hashTable, const void *value,
const unsigned int valuelen);
-
-/**
- * @brief adds a key/value pair to a HashTable
- * @param hashTable the HashTable to add to
- * @param key the key to add or whose value to replace
- * @param value the value associated with the key
- * @return 0 if successful, -1 if an error was encountered
- */
-int ht_put(struct HashTable *hashTable, const void *key, const unsigned int
keylen,
- void *value, const unsigned int valuelen);
-
-/**
- * @brief retrieves the value of a key in a HashTable
- * @param hashTable the HashTable to search
- * @param key the key whose value is desired
- * @param value the corresponding value
- * @param valuelen the length of the value
- * @return YES if found, NO otherwise
- */
-int ht_get(const struct HashTable *hashTable, const void *key, const unsigned
int
- keylen, void **value, unsigned int *valuelen);
-
-/**
- * @brief removes a key/value pair from a HashTable
- * @param hashTable the HashTable to remove the key/value pair from
- * @param key the key specifying the key/value pair to be removed
- */
-void ht_remove(struct HashTable *hashTable, const void *key, const unsigned
int keylen);
-
-/**
- * @brief removes all key/value pairs from a HashTable
- * @param hashTable the HashTable to remove all key/value pairs from
- */
-void ht_removeAll(struct HashTable *hashTable);
-
-/**
- * @brief returns the number of elements in a HashTable
- * @param hashTable the HashTable whose size is requested
- * @return the number of key/value pairs that are present in
- * the specified HashTable
- */
-long ht_size(const struct HashTable *hashTable);
-
-/**
- * @brief returns the number of buckets in a HashTable
- * @param hashTable the HashTable whose number of buckets is requested
- * @return the number of buckets that are in the specified
- * HashTable
- */
-long ht_buckets(const struct HashTable *hashTable);
-
-/**
- * @brief reorganizes a HashTable to be more efficient
- * @param hashTable the HashTable to be reorganized
- * @param numOfBuckets the number of buckets to rehash the HashTable to.
- * Should be prime. Ideally, the number of buckets
- * should be between 1/5 and 1 times the expected
- * number of elements in the HashTable. Values much
- * more or less than this will result in wasted memory
- * or decreased performance respectively. If 0 is
- * specified, an appropriate number of buckets is
- * automatically calculated.
- */
-void ht_rehash(struct HashTable *hashTable, long numOfBuckets);
-
-/**
- * @brief sets the ideal element-to-bucket ratio of a HashTable
- * @param hashTable a HashTable
- * @param idealRatio the ideal element-to-bucket ratio. When a rehash
- * occurs (either manually via a call to the
- * HashTableRehash() function or automatically due the
- * the triggering of one of the thresholds below), the
- * number of buckets in the HashTable will be
- * recalculated to be a prime number that achieves (as
- * closely as possible) this ideal ratio. Must be a
- * positive number.
- * @param lowerRehashThreshold the element-to-bucket ratio that is considered
- * unacceptably low (i.e., too few elements per bucket).
- * If the actual ratio falls below this number, a
- * rehash will automatically be performed. Must be
- * lower than the value of idealRatio. If no ratio
- * is considered unacceptably low, a value of 0.0 can
- * be specified.
- * @param upperRehashThreshold the element-to-bucket ratio that is considered
- * unacceptably high (i.e., too many elements per bucket).
- * If the actual ratio rises above this number, a
- * rehash will automatically be performed. Must be
- * higher than idealRatio. However, if no ratio
- * is considered unacceptably high, a value of 0.0 can
- * be specified.
- */
-void ht_setIdealRatio(struct HashTable *hashTable, float idealRatio,
- float lowerRehashThreshold, float upperRehashThreshold);
-
-#define HT_PUT(ht, key, val) ht_put(ht, key, sizeof(key), val, sizeof(val))
-#define HT_GET(ht, key, val, vallen) ht_get(ht, key, sizeof(key), val, vallen)
-#define HT_CONTAINS_KEY(ht, key) ht_containsKey(ht, key, sizeof(key))
-#define HT_CONTAINS_VALUE(ht, value) ht_containsValue(ht, value, sizeof(value))
-#define HT_REMOVE(ht, key) ht_remove(ht, key, sizeof(key))
-
-/**
* open() a file
*/
int fileopen(const char *filename, int oflag, ...);
Added: GNUnet/src/include/gnunet_util_config.h
===================================================================
--- GNUnet/src/include/gnunet_util_config.h 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/include/gnunet_util_config.h 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,209 @@
+/*
+ This file is part of GNUnet.
+ (C) 2006 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 include/gnunet_config.h
+ * @brief configuration API
+ *
+ * @author Christian Grothoff
+ */
+
+#ifndef GNUNET_CONFIG_H
+#define GNUNET_CONFIG_H
+
+#include "gnunet_util_error.h"
+
+#define GNUNET_CONFIG_VERSION 0x00000000
+
+#ifdef __cplusplus
+extern "C" {
+#if 0 /* keep Emacsens' auto-indent happy */
+}
+#endif
+#endif
+
+struct GC_Configuration;
+
+void GC_free(struct GC_Configuration * cfg);
+
+/**
+ * Set the context for reporting configuration IO errors
+ * (and errors reported by configuration change notification
+ * callbacks when reading a new configuration).
+ *
+ * Note that for setting options a different context can be
+ * used (since failing to change an option may have to be reported
+ * in a fundamentally different way to the user).
+ *
+ * @parm ectx maybe NULL, in that case errors will no longer
+ * be reported
+ */
+void GC_set_error_context(struct GC_Configuration * cfg,
+ struct GE_Context * ectx);
+
+/**
+ * Parse a configuration file, add all of the options in the
+ * file to the configuration environment.
+ * @return 0 on success, -1 on error
+ */
+int GC_parse_configuration(struct GC_Configuration * cfg,
+ const char * filename);
+
+/**
+ * Test if there are configuration options that were
+ * changed since the last save.
+ * @return 0 if clean, 1 if dirty, -1 on error (i.e. last save failed)
+ */
+int GC_test_dirty(struct GC_Configuration * cfg);
+
+/**
+ * Write configuration file.
+ * @return 0 on success, -1 on error
+ */
+int GC_write_configuration(struct GC_Configuration * cfg,
+ const char * filename);
+
+/**
+ * Get a configuration value that should be a number.
+ * @param min minimal legal value
+ * @param max maximal legal value
+ * @param default default value (use indicated by return value)
+ * @return 0 on success, -1 on error, 1 for default
+ */
+int GC_get_configuration_value_number(struct GC_Configuration * cfg,
+ const char * section,
+ const char * option,
+ unsigned long long min,
+ unsigned long long max,
+ unsigned long long def,
+ unsigned long long * number);
+
+
+/**
+ * Get a configuration value that should be a string.
+ * @param default default value (use indicated by return value;
+ * will NOT be aliased, maybe NULL)
+ * @param value will be set to a freshly allocated configuration
+ * value, or NULL if option is not specified and no default given
+ * @return 0 on success, -1 on error, 1 for default
+ */
+int GC_get_configuration_value_string(struct GC_Configuration * cfg,
+ const char * section,
+ const char * option,
+ const char * def,
+ char ** value);
+
+/**
+ * Get a configuration value that should be in a set of
+ * predefined strings
+ * @param choices NULL-terminated list of legal values
+ * @param default default value (use indicated by return value;
+ * will NOT be aliased, maybe NULL), must be reference
+ * into set given by choices
+ * @param value will be set to an entry in the legal list,
+ * or NULL if option is not specified and no default given
+ * @return 0 on success, -1 on error, 1 for default
+ */
+int GC_get_configuration_value_choice(struct GC_Configuration * cfg,
+ const char * section,
+ const char * option,
+ const char ** choices,
+ const char * def,
+ const char ** value);
+
+/**
+ * Set a configuration value that should be a number.
+ * @return 0 on success, -1 on error (i.e. out of memory,
+ * or update refused by registered callback)
+ */
+int GC_set_configuration_value_number(struct GC_Configuration * cfg,
+ struct GE_Context * ectx,
+ const char * section,
+ const char * option,
+ unsigned long long number);
+
+
+/**
+ * Set a configuration value that should be a string.
+ * @param value
+ * @return 0 on success, -1 on error (i.e. out of memory,
+ * or update refused by registered callback)
+ */
+int GC_set_configuration_value_string(struct GC_Configuration * cfg,
+ struct GE_Context * ectx,
+ const char * section,
+ const char * option,
+ const char * value);
+
+/**
+ * Set a configuration value that should be in a set of
+ * predefined strings.
+ * @param value
+ * @return 0 on success, -1 on error (i.e. out of memory,
+ * or update refused by registered callback)
+ */
+int GC_set_configuration_value_choice(struct GC_Configuration * cfg,
+ struct GE_Context * ectx,
+ const char * section,
+ const char * option,
+ const char * choice);
+
+/**
+ * Callback function that is called if a configuration option
+ * changes. Note that the new value is not explicitly
+ * communicated, the client must query it.
+ *
+ * @param ectx context to log errors to
+ * @return 0 if the change is ok, -1 if the change must be
+ * refused
+ */
+typedef int (*GC_ChangeListener)(void * ctx,
+ struct GC_Configuration * cfg,
+ struct GE_Context * ectx,
+ const char * section,
+ const char * option);
+
+/**
+ * Attach a callback that is notified whenever a
+ * configuration option changes.
+ * @return 0 on success, -1 on error
+ */
+int GC_attach_change_listener(struct GC_Configuration * cfg,
+ GC_ChangeListener callback,
+ void * ctx);
+
+/**
+ * Attach a callback that is notified whenever a
+ * configuration option changes.
+ * @return 0 on success, -1 on error, 1 for no such handler registered
+ */
+int GC_detach_change_listener(struct GC_Configuration * cfg,
+ GC_ChangeListener callback,
+ void * ctx);
+
+
+#if 0 /* keep Emacsens' auto-indent happy */
+{
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Added: GNUnet/src/include/gnunet_util_config_impl.h
===================================================================
--- GNUnet/src/include/gnunet_util_config_impl.h 2006-06-15 16:42:32 UTC
(rev 3010)
+++ GNUnet/src/include/gnunet_util_config_impl.h 2006-06-15 16:49:28 UTC
(rev 3011)
@@ -0,0 +1,207 @@
+/*
+ This file is part of GNUnet.
+ (C) 2006 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 include/gnunet_config_impl.h
+ * @brief configuration API
+ *
+ * @author Christian Grothoff
+ */
+
+#ifndef GNUNET_UTIL_CONFIG_IMPL_H
+#define GNUNET_UTIL_CONFIG_IMPL_H
+
+#include "gnunet_util_config.h"
+
+#ifdef __cplusplus
+extern "C" {
+#if 0 /* keep Emacsens' auto-indent happy */
+}
+#endif
+#endif
+
+struct GC_ConfigurationData;
+
+typedef struct GC_Configuration {
+
+ /**
+ * Internal configuration data.
+ */
+ struct GC_ConfigurationData * data;
+
+ void (*free)(struct GC_Configuration * cfg);
+
+ /**
+ * Set the context for reporting configuration IO errors
+ * (and errors reported by configuration change notification
+ * callbacks when reading a new configuration).
+ *
+ * Note that for setting options a different context can be
+ * used (since failing to change an option may have to be reported
+ * in a fundamentally different way to the user).
+ *
+ * @parm ectx maybe NULL, in that case errors will no longer
+ * be reported
+ */
+ void (*set_error_context)(struct GC_Configuration * cfg,
+ struct GE_Context * ectx);
+
+ /**
+ * Parse a configuration file, add all of the options in the
+ * file to the configuration environment.
+ * @return 0 on success, -1 on error
+ */
+ int (*parse_configuration)(struct GC_Configuration * cfg,
+ const char * filename);
+
+ /**
+ * Test if there are configuration options that were
+ * changed since the last save.
+ * @return 0 if clean, 1 if dirty, -1 on error (i.e. last save failed)
+ */
+ int (*test_dirty)(struct GC_Configuration * cfg);
+
+
+ /**
+ * Write configuration file.
+ * @return 0 on success, -1 on error
+ */
+ int (*write_configuration)(struct GC_Configuration * cfg,
+ const char * filename);
+
+ /**
+ * Get a configuration value that should be a number.
+ * @param min minimal legal value
+ * @param max maximal legal value
+ * @param def default value (use indicated by return value)
+ * @return 0 on success, -1 on error, 1 for default
+ */
+ int (*get_configuration_value_number)(struct GC_Configuration * cfg,
+ const char * section,
+ const char * option,
+ unsigned long long min,
+ unsigned long long max,
+ unsigned long long def,
+ unsigned long long * number);
+
+
+ /**
+ * Get a configuration value that should be a string.
+ * @param default default value (use indicated by return value;
+ * will NOT be aliased, maybe NULL)
+ * @param value will be set to a freshly allocated configuration
+ * value, or NULL if option is not specified and no default given
+ * @return 0 on success, -1 on error, 1 for default
+ */
+ int (*get_configuration_value_string)(struct GC_Configuration * cfg,
+ const char * section,
+ const char * option,
+ const char * def,
+ char ** value);
+
+ /**
+ * Get a configuration value that should be in a set of
+ * predefined strings
+ * @param choices NULL-terminated list of legal values
+ * @param default default value (use indicated by return value;
+ * will NOT be aliased, maybe NULL), must be reference
+ * into set given by choices
+ * @param value will be set to an entry in the legal list,
+ * or NULL if option is not specified and no default given
+ * @return 0 on success, -1 on error, 1 for default
+ */
+ int (*get_configuration_value_choice)(struct GC_Configuration * cfg,
+ const char * section,
+ const char * option,
+ const char ** choices,
+ const char * def,
+ const char ** value);
+
+ /**
+ * Set a configuration value that should be a number.
+ * @return 0 on success, -1 on error (i.e. out of memory,
+ * or update refused by registered callback)
+ */
+ int (*set_configuration_value_number)(struct GC_Configuration * cfg,
+ struct GE_Context * ectx,
+ const char * section,
+ const char * option,
+ unsigned long long number);
+
+
+ /**
+ * Set a configuration value that should be a string.
+ * @param value
+ * @return 0 on success, -1 on error (i.e. out of memory,
+ * or update refused by registered callback)
+ */
+ int (*set_configuration_value_string)(struct GC_Configuration * cfg,
+ struct GE_Context * ectx,
+ const char * section,
+ const char * option,
+ const char * value);
+
+ /**
+ * Set a configuration value that should be in a set of
+ * predefined strings.
+ * @param value
+ * @return 0 on success, -1 on error (i.e. out of memory,
+ * or update refused by registered callback)
+ */
+ int (*set_configuration_value_choice)(struct GC_Configuration * cfg,
+ struct GE_Context * ectx,
+ const char * section,
+ const char * option,
+ const char * choice);
+
+ /**
+ * Attach a callback that is notified whenever a
+ * configuration option changes.
+ * @return 0 on success, -1 on error
+ */
+ int (*attach_change_listener)(struct GC_Configuration * cfg,
+ GC_ChangeListener callback,
+ void * ctx);
+
+ /**
+ * Attach a callback that is notified whenever a
+ * configuration option changes.
+ * @return 0 on success, -1 on error, 1 for no such handler registered
+ */
+ int (*detach_change_listener)(struct GC_Configuration * cfg,
+ GC_ChangeListener callback,
+ void * ctx);
+
+} GC_Configuration;
+
+/**
+ * Create a GC_Configuration (C implementation).
+ */
+GC_Configuration * GC_create_C_impl(void);
+
+
+#if 0 /* keep Emacsens' auto-indent happy */
+{
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Added: GNUnet/src/include/gnunet_util_containers.h
===================================================================
--- GNUnet/src/include/gnunet_util_containers.h 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/include/gnunet_util_containers.h 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,415 @@
+/*
+ This file is part of GNUnet.
+ (C) 2001, 2002, 2003, 2004, 2005, 2006 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 include/gnunet_util_containers.h
+ * @brief container classes for GNUnet
+ *
+ * @author Christian Grothoff
+ * @author Krista Bennett
+ * @author Gerd Knorr <address@hidden>
+ * @author Ioana Patrascu
+ * @author Tzvetan Horozov
+ */
+
+#ifndef GNUNET_UTIL_CONTAINERS_H
+#define GNUNET_UTIL_CONTAINERS_H
+
+/* add error and config prototypes */
+#include "gnunet_util.h"
+
+#ifdef __cplusplus
+extern "C" {
+#if 0 /* keep Emacsens' auto-indent happy */
+}
+#endif
+#endif
+
+/**
+ * @brief bloomfilter representation (opaque)
+ */
+struct Bloomfilter;
+
+/**
+ * Iterator over all HashCodes stored in a Bloomfilter.
+ */
+typedef HashCode512 * (*ElementIterator)(void * arg);
+
+/**
+ * @brief a Vector (ordered variable size set of elements), opaque
+ */
+struct Vector;
+
+/**
+ * @brief a hash table, opaque
+ */
+struct HashTable;
+
+/**
+ * Load a bloom-filter from a file.
+ * @param filename the name of the file (or the prefix)
+ * @param size the size of the bloom-filter (number of
+ * bytes of storage space to use)
+ * @param k the number of hash-functions to apply per
+ * element (number of bits set per element in the set)
+ * @return the bloomfilter
+ */
+struct Bloomfilter * loadBloomfilter(const char * filename,
+ unsigned int size,
+ unsigned int k);
+
+/**
+ * Test if an element is in the filter.
+ * @param e the element
+ * @param bf the filter
+ * @return YES if the element is in the filter, NO if not
+ */
+int testBloomfilter(struct Bloomfilter * bf,
+ const HashCode512 * e);
+
+/**
+ * Add an element to the filter
+ * @param bf the filter
+ * @param e the element
+ */
+void addToBloomfilter(struct Bloomfilter * bf,
+ const HashCode512 * e);
+
+/**
+ * Remove an element from the filter.
+ * @param bf the filter
+ * @param e the element to remove
+ */
+void delFromBloomfilter(struct Bloomfilter * bf,
+ const HashCode512 * e);
+
+/**
+ * Free the space associcated with a filter
+ * in memory, flush to drive if needed (do not
+ * free the space on the drive)
+ * @param bf the filter
+ */
+void freeBloomfilter(struct Bloomfilter * bf);
+
+/**
+ * Reset a bloom filter to empty.
+ * @param bf the filter
+ */
+void resetBloomfilter(struct Bloomfilter * bf);
+
+/**
+ * Resize a bloom filter. Note that this operation
+ * is pretty costly. Essentially, the bloom filter
+ * needs to be completely re-build.
+ *
+ * @param bf the filter
+ * @param iterator an iterator over all elements stored in the BF
+ * @param iterator_arg argument to the iterator function
+ * @param size the new size for the filter
+ * @param k the new number of hash-function to apply per element
+ */
+void resizeBloomfilter(struct Bloomfilter * bf,
+ ElementIterator iterator,
+ void * iterator_arg,
+ unsigned int size,
+ unsigned int k);
+
+/**
+ * A debug function that dumps the vector to stderr.
+ */
+void vectorDump(struct Vector *v);
+
+/**
+ * @param vss Size of the VectorSegment data area. The "correct" value for this
+ * is a bit of a gamble, as it depends on both the operations you
+ * perform on the vectors and how much data is stored in them. In
+ * general, the more data you store the bigger the segments should be,
+ * or otherwise the increased length of the linked list will become a
+ * bottleneck for operations that are performed on arbitrary indexes.
+ */
+struct Vector * vectorNew(unsigned int vss);
+
+/**
+ * Free vector structure including its data segments, but _not_ including the
+ * stored void pointers. It is the user's responsibility to empty the vector
+ * when necessary to avoid memory leakage.
+ */
+void vectorFree(struct Vector * v);
+
+size_t vectorSize(struct Vector * v);
+
+/**
+ * Insert a new element in the vector at given index.
+ * @return OK on success, SYSERR if the index is out of bounds.
+ */
+int vectorInsertAt(struct Vector * v,
+ void * object,
+ unsigned int index);
+
+/**
+ * Insert a new element at the end of the vector.
+ */
+void vectorInsertLast(struct Vector * v, void * object);
+
+/**
+ * Return the element at given index in the vector or NULL if the index is out
+ * of bounds. The iterator is set to point to the returned element.
+ */
+void * vectorGetAt(struct Vector * v,
+ unsigned int index);
+
+/**
+ * Return the first element in the vector, whose index is 0, or NULL if the
+ * vector is empty. The iterator of the vector is set to point to the first
+ * element.
+ */
+void * vectorGetFirst(struct Vector * v);
+
+/**
+ * Return the last element in the vector or NULL if the vector is empty. The
+ * iterator of the vector is set to point to the last element.
+ */
+void * vectorGetLast(struct Vector * v);
+
+/**
+ * Return the next element in the vector, as called after vector_get_at() or
+ * vector_get_first(). The return value is NULL if there are no more elements
+ * in the vector or if the iterator has not been set.
+ */
+void * vectorGetNext(struct Vector * v);
+
+/**
+ * Return the previous element in the vector, as called after vector_get_at()
+ * or vector_get_last(). The return value is NULL if there are no more
+ * elements in the vector or if the iterator has not been set.
+ */
+void * vectorGetPrevious(struct Vector * v);
+
+/**
+ * Delete and return the element at given index. NULL is returned if index is
+ * out of bounds.
+ */
+void * vectorRemoveAt(struct Vector * v,
+ unsigned int index);
+
+/**
+ * Delete and return the last element in the vector, or NULL if the vector
+ * is empty.
+ */
+void * vectorRemoveLast(struct Vector * v);
+
+/**
+ * Delete and return given object from the vector, or return NULL if the object
+ * is not found.
+ */
+void * vectorRemoveObject(struct Vector * v, void * object);
+
+/**
+ * Set the given index in the vector. The old value of the index is
+ * returned, or NULL if the index is out of bounds.
+ */
+void * vectorSetAt(struct Vector * v,
+ void * object,
+ unsigned int index);
+
+/**
+ * Set the index occupied by the given object to point to the new object.
+ * The old object is returned, or NULL if it's not found.
+ */
+void * vectorSetObject(struct Vector * v,
+ void * object,
+ void * old_object);
+
+/**
+ * Swaps the contents of index1 and index2. Return value is OK
+ * on success, SYSERR if either index is out of bounds.
+ */
+int vectorSwap(struct Vector * v,
+ unsigned int index1,
+ unsigned int index2);
+
+/**
+ * Return the index of given element or -1 if the element is not found.
+ */
+unsigned int vectorIndexOf(struct Vector * v,
+ void * object);
+
+/**
+ * Return the data stored in the vector as a single dynamically
+ * allocated array of (void *), which must be FREEed by the caller.
+ * Use the functions get_{at,first,last,next,previous} instead, unless
+ * you really need to access everything in the vector as fast as
+ * possible.
+ */
+void ** vectorElements(struct Vector * v);
+
+/**
+ * @brief creates a new HashTable
+ * @param numOfBuckets the number of buckets to start the HashTable out with.
+ * Must be greater than zero, and should be prime.
+ * Ideally, the number of buckets should between 1/5
+ * and 1 times the expected number of elements in the
+ * HashTable. Values much more or less than this will
+ * result in wasted memory or decreased performance
+ * respectively. The number of buckets in a HashTable
+ * can be re-calculated to an appropriate number by
+ * calling the HashTableRehash() function once the
+ * HashTable has been populated. The number of buckets
+ * in a HashTable may also be re-calculated
+ * automatically if the ratio of elements to buckets
+ * passes the thresholds set by ht_setIdealRatio().
+ * @return a new Hashtable, or NULL on error
+ */
+struct HashTable *ht_create(long numOfBuckets);
+
+/**
+ * @brief destroys an existing HashTable
+ * @param hashTable the HashTable to destroy
+ */
+void ht_destroy(struct HashTable *hashTable);
+
+/**
+ * @brief checks the existence of a key in a HashTable
+ * @param hashTable the HashTable to search
+ * @param key the key to search for
+ * @return whether or not the specified HashTable contains the
+ * specified key
+ */
+int ht_containsKey(const struct HashTable *hashTable, const void *key, const
unsigned int keylen);
+
+/**
+ * @brief checks the existence of a value in a HashTable
+ * @param hashTable the HashTable to search
+ * @param value the value to search for
+ * @return whether or not the specified HashTable contains the
+ * specified value
+ */
+int ht_containsValue(const struct HashTable *hashTable, const void *value,
const unsigned int valuelen);
+
+/**
+ * @brief adds a key/value pair to a HashTable
+ * @param hashTable the HashTable to add to
+ * @param key the key to add or whose value to replace
+ * @param value the value associated with the key
+ * @return 0 if successful, -1 if an error was encountered
+ */
+int ht_put(struct HashTable *hashTable, const void *key, const unsigned int
keylen,
+ void *value, const unsigned int valuelen);
+
+/**
+ * @brief retrieves the value of a key in a HashTable
+ * @param hashTable the HashTable to search
+ * @param key the key whose value is desired
+ * @param value the corresponding value
+ * @param valuelen the length of the value
+ * @return YES if found, NO otherwise
+ */
+int ht_get(const struct HashTable *hashTable, const void *key, const unsigned
int
+ keylen, void **value, unsigned int *valuelen);
+
+/**
+ * @brief removes a key/value pair from a HashTable
+ * @param hashTable the HashTable to remove the key/value pair from
+ * @param key the key specifying the key/value pair to be removed
+ */
+void ht_remove(struct HashTable *hashTable, const void *key, const unsigned
int keylen);
+
+/**
+ * @brief removes all key/value pairs from a HashTable
+ * @param hashTable the HashTable to remove all key/value pairs from
+ */
+void ht_removeAll(struct HashTable *hashTable);
+
+/**
+ * @brief returns the number of elements in a HashTable
+ * @param hashTable the HashTable whose size is requested
+ * @return the number of key/value pairs that are present in
+ * the specified HashTable
+ */
+long ht_size(const struct HashTable *hashTable);
+
+/**
+ * @brief returns the number of buckets in a HashTable
+ * @param hashTable the HashTable whose number of buckets is requested
+ * @return the number of buckets that are in the specified
+ * HashTable
+ */
+long ht_buckets(const struct HashTable *hashTable);
+
+/**
+ * @brief reorganizes a HashTable to be more efficient
+ * @param hashTable the HashTable to be reorganized
+ * @param numOfBuckets the number of buckets to rehash the HashTable to.
+ * Should be prime. Ideally, the number of buckets
+ * should be between 1/5 and 1 times the expected
+ * number of elements in the HashTable. Values much
+ * more or less than this will result in wasted memory
+ * or decreased performance respectively. If 0 is
+ * specified, an appropriate number of buckets is
+ * automatically calculated.
+ */
+void ht_rehash(struct HashTable *hashTable, long numOfBuckets);
+
+/**
+ * @brief sets the ideal element-to-bucket ratio of a HashTable
+ * @param hashTable a HashTable
+ * @param idealRatio the ideal element-to-bucket ratio. When a rehash
+ * occurs (either manually via a call to the
+ * HashTableRehash() function or automatically due the
+ * the triggering of one of the thresholds below), the
+ * number of buckets in the HashTable will be
+ * recalculated to be a prime number that achieves (as
+ * closely as possible) this ideal ratio. Must be a
+ * positive number.
+ * @param lowerRehashThreshold the element-to-bucket ratio that is considered
+ * unacceptably low (i.e., too few elements per bucket).
+ * If the actual ratio falls below this number, a
+ * rehash will automatically be performed. Must be
+ * lower than the value of idealRatio. If no ratio
+ * is considered unacceptably low, a value of 0.0 can
+ * be specified.
+ * @param upperRehashThreshold the element-to-bucket ratio that is considered
+ * unacceptably high (i.e., too many elements per bucket).
+ * If the actual ratio rises above this number, a
+ * rehash will automatically be performed. Must be
+ * higher than idealRatio. However, if no ratio
+ * is considered unacceptably high, a value of 0.0 can
+ * be specified.
+ */
+void ht_setIdealRatio(struct HashTable *hashTable, float idealRatio,
+ float lowerRehashThreshold, float upperRehashThreshold);
+
+#define HT_PUT(ht, key, val) ht_put(ht, key, sizeof(key), val, sizeof(val))
+#define HT_GET(ht, key, val, vallen) ht_get(ht, key, sizeof(key), val, vallen)
+#define HT_CONTAINS_KEY(ht, key) ht_containsKey(ht, key, sizeof(key))
+#define HT_CONTAINS_VALUE(ht, value) ht_containsValue(ht, value, sizeof(value))
+#define HT_REMOVE(ht, key) ht_remove(ht, key, sizeof(key))
+
+#if 0 /* keep Emacsens' auto-indent happy */
+{
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+
+/* ifndef GNUNET_UTIL_CONTAINERS_H */
+#endif
+/* end of gnunet_util_containers.h */
Added: GNUnet/src/include/gnunet_util_crypto.h
===================================================================
--- GNUnet/src/include/gnunet_util_crypto.h 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/include/gnunet_util_crypto.h 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,443 @@
+/*
+ This file is part of GNUnet.
+ (C) 2001, 2002, 2003, 2004, 2005, 2006 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 include/gnunet_util_crypto.h
+ * @brief cryptographic primitives for GNUnet
+ *
+ * @author Christian Grothoff
+ * @author Krista Bennett
+ * @author Gerd Knorr <address@hidden>
+ * @author Ioana Patrascu
+ * @author Tzvetan Horozov
+ */
+
+#ifndef GNUNET_UTIL_CRYPTO_H
+#define GNUNET_UTIL_CRYPTO_H
+
+#include "gnunet_util_error.h"
+
+#ifdef __cplusplus
+extern "C" {
+#if 0 /* keep Emacsens' auto-indent happy */
+}
+#endif
+#endif
+
+/**
+ * @brief length of the sessionkey in bytes (256 BIT sessionkey)
+ */
+#define SESSIONKEY_LEN (256/8)
+
+/**
+ * @brief Length of RSA encrypted data (2048 bit)
+ *
+ * We currently do not handle encryption of data
+ * that can not be done in a single call to the
+ * RSA methods (read: large chunks of data).
+ * We should never need that, as we can use
+ * the hash for larger pieces of data for signing,
+ * and for encryption, we only need to encode sessionkeys!
+ */
+#define RSA_ENC_LEN 256
+
+/**
+ * Length of an RSA KEY (d,e,len), 2048 bit (=256 octests) key d, 2 byte e
+ */
+#define RSA_KEY_LEN 258
+
+/**
+ * The private information of an RSA key pair.
+ */
+struct PrivateKey;
+
+/**
+ * @brief 0-terminated ASCII encoding of a HashCode512.
+ */
+typedef struct {
+ unsigned char encoding[104];
+} EncName;
+
+/**
+ * GNUnet mandates a certain format for the encoding
+ * of private RSA key information that is provided
+ * by the RSA implementations. This format is used
+ * to serialize a private RSA key (typically when
+ * writing it to disk).
+ */
+typedef struct {
+ /**
+ * Total size of the structure, in bytes, in big-endian!
+ */
+ unsigned short len;
+ unsigned short sizen;/* in big-endian! */
+ unsigned short sizee;/* in big-endian! */
+ unsigned short sized;/* in big-endian! */
+ unsigned short sizep;/* in big-endian! */
+ unsigned short sizeq;/* in big-endian! */
+ unsigned short sizedmp1;/* in big-endian! */
+ unsigned short sizedmq1;/* in big-endian! */
+ /* followed by the actual values */
+} PrivateKeyEncoded;
+
+/**
+ * @brief an RSA signature
+ */
+typedef struct {
+ unsigned char sig[RSA_ENC_LEN];
+} Signature;
+
+/**
+ * @brief A public key.
+ */
+typedef struct {
+ /**
+ * In big-endian, must be RSA_KEY_LEN+2
+ */
+ unsigned short len;
+ /**
+ * Size of n in key; in big-endian!
+ */
+ unsigned short sizen;
+ /**
+ * The key itself, contains n followed by e.
+ */
+ unsigned char key[RSA_KEY_LEN];
+ /**
+ * Padding (must be 0)
+ */
+ unsigned short padding;
+} PublicKey;
+
+/**
+ * RSA Encrypted data.
+ */
+typedef struct {
+ unsigned char encoding[RSA_ENC_LEN];
+} RSAEncryptedData;
+
+/**
+ * @brief type for session keys
+ */
+typedef struct {
+ unsigned char key[SESSIONKEY_LEN];
+ int crc32; /* checksum! */
+} SESSIONKEY;
+
+/**
+ * @brief IV for sym cipher
+ *
+ * NOTE: must be smaller (!) in size than the
+ * HashCode512.
+ */
+typedef struct {
+ unsigned char iv[SESSIONKEY_LEN/2];
+} INITVECTOR;
+
+/* **************** Functions and Macros ************* */
+
+/**
+ * Compute the CRC32 checksum for the first len
+ * bytes of the buffer.
+ *
+ * @param buf the data over which we're taking the CRC
+ * @param len the length of the buffer in bytes
+ * @return the resulting CRC32 checksum
+ */
+int crc32N(const void * buf, int len);
+
+/**
+ * Produce a random value.
+ *
+ * @param i the upper limit (exclusive) for the random number
+ * @return a random value in the interval [0,i[.
+ */
+unsigned int randomi(unsigned int i);
+
+/**
+ * Random on unsigned 64-bit values. We break them down into signed
+ * 32-bit values and reassemble the 64-bit random value bit-wise.
+ */
+unsigned long long randomi64(unsigned long long u);
+
+unsigned long long weak_randomi64(unsigned long long u);
+
+/**
+ * Get an array with a random permutation of the
+ * numbers 0...n-1.
+ * @param mode STRONG if the strong (but expensive) PRNG should be used, WEAK
otherwise
+ * @param n the size of the array
+ * @return the permutation array (allocated from heap)
+ */
+int * permute(int mode, int n);
+
+/**
+ * Produce a cryptographically weak random value.
+ *
+ * @param i the upper limit (exclusive) for the random number
+ * @return a random value in the interval [0,i[.
+ */
+unsigned int weak_randomi(unsigned int i);
+
+/**
+ * Create a new Session key.
+ */
+void makeSessionkey(SESSIONKEY * key);
+
+/**
+ * Encrypt a block with the public key of another
+ * host that uses the same cyper.
+ * @param block the block to encrypt
+ * @param len the size of the block
+ * @param sessionkey the key used to encrypt
+ * @param iv the initialization vector to use, use INITVALUE
+ * for streams.
+ * @returns the size of the encrypted block, -1 for errors
+ */
+int encryptBlock(const void * block,
+ unsigned short len,
+ const SESSIONKEY * sessionkey,
+ const INITVECTOR * iv,
+ void * result);
+
+/**
+ * Decrypt a given block with the sessionkey.
+ * @param sessionkey the key used to decrypt
+ * @param block the data to decrypt, encoded as returned by encrypt
+ * @param size how big is the block?
+ * @param iv the initialization vector to use
+ * @param result address to store the result at
+ * @return -1 on failure, size of decrypted block on success
+ */
+int decryptBlock(const SESSIONKEY * sessionkey,
+ const void * block,
+ unsigned short size,
+ const INITVECTOR * iv,
+ void * result);
+
+/**
+ * Convert hash to ASCII encoding.
+ * @param block the hash code
+ * @param result where to store the encoding (EncName can be
+ * safely cast to char*, a '\0' termination is set).
+ */
+void hash2enc(const HashCode512 * block,
+ EncName * result);
+
+/**
+ * Convert ASCII encoding back to hash
+ * @param enc the encoding
+ * @param result where to store the hash code
+ * @return OK on success, SYSERR if result has the wrong encoding
+ */
+int enc2hash(const char * enc,
+ HashCode512 * result);
+
+/**
+ * Compute the distance between 2 hashcodes.
+ * The computation must be fast, not involve
+ * a.a or a.e (they're used elsewhere), and
+ * be somewhat consistent. And of course, the
+ * result should be a positive number.
+ * @return number between 0 and 65536
+ */
+unsigned int distanceHashCode512(const HashCode512 * a,
+ const HashCode512 * b);
+
+/**
+ * compare two hashcodes.
+ */
+int equalsHashCode512(const HashCode512 * a,
+ const HashCode512 * b);
+
+/**
+ * Hash block of given size.
+ * @param block the data to hash, length is given as a second argument
+ * @param ret pointer to where to write the hashcode
+ */
+void hash(const void * block,
+ unsigned int size,
+ HashCode512 * ret);
+
+
+/**
+ * Compute the hash of an entire file.
+ * @return OK on success, SYSERR on error
+ */
+int getFileHash(struct GE_Context * ectx,
+ const char * filename,
+ HashCode512 * ret);
+
+void makeRandomId(HashCode512 * result);
+
+/* compute result(delta) = b - a */
+void deltaId(const HashCode512 * a,
+ const HashCode512 * b,
+ HashCode512 * result);
+
+/* compute result(b) = a + delta */
+void addHashCodes(const HashCode512 * a,
+ const HashCode512 * delta,
+ HashCode512 * result);
+
+/* compute result = a ^ b */
+void xorHashCodes(const HashCode512 * a,
+ const HashCode512 * b,
+ HashCode512 * result);
+
+/**
+ * Convert a hashcode into a key.
+ */
+void hashToKey(const HashCode512 * hc,
+ SESSIONKEY * skey,
+ INITVECTOR * iv);
+
+/**
+ * Obtain a bit from a hashcode.
+ * @param code the hash to index bit-wise
+ * @param bit index into the hashcode, [0...159]
+ * @return Bit \a bit from hashcode \a code, -1 for invalid index
+ */
+int getHashCodeBit(const HashCode512 * code,
+ unsigned int bit);
+
+/**
+ * Compare function for HashCodes, producing a total ordering
+ * of all hashcodes.
+ * @return 1 if h1 > h2, -1 if h1 < h2 and 0 if h1 == h2.
+ */
+int hashCodeCompare(const HashCode512 * h1,
+ const HashCode512 * h2);
+
+/**
+ * Find out which of the two hash codes is closer to target
+ * in the XOR metric (Kademlia).
+ * @return -1 if h1 is closer, 1 if h2 is closer and 0 if h1==h2.
+ */
+int hashCodeCompareDistance(const HashCode512 * h1,
+ const HashCode512 * h2,
+ const HashCode512 * target);
+
+/**
+ * create a new hostkey. Callee must free return value.
+ */
+struct PrivateKey * makePrivateKey(void);
+
+/**
+ * Deterministically (!) create a hostkey using only the
+ * given HashCode as input to the PRNG.
+ */
+struct PrivateKey * makeKblockKey(const HashCode512 * input);
+
+/**
+ * Free memory occupied by hostkey
+ * @param hostkey pointer to the memory to free
+ */
+void freePrivateKey(struct PrivateKey * hostkey);
+
+/**
+ * Extract the public key of the host.
+ * @param result where to write the result.
+ */
+void getPublicKey(const struct PrivateKey * hostkey,
+ PublicKey * result);
+
+/**
+ * Encode the private key in a format suitable for
+ * storing it into a file.
+ * @param hostkey the hostkey to use
+ * @returns encoding of the private key.
+ */
+PrivateKeyEncoded * encodePrivateKey(const struct PrivateKey * hostkey);
+
+/**
+ * Decode the private key from the file-format back
+ * to the "normal", internal, RSA format.
+ * @param encoded the encoded hostkey
+ * @returns the decoded hostkey
+ */
+struct PrivateKey * decodePrivateKey(const PrivateKeyEncoded * encoding);
+
+/**
+ * Encrypt a block with the public key of another host that uses the
+ * same cyper.
+ *
+ * @param block the block to encrypt
+ * @param size the size of block
+ * @param publicKey the encoded public key used to encrypt
+ * @param target where to store the encrypted block
+ * @returns SYSERR on error, OK if ok
+ */
+int encryptPrivateKey(const void * block,
+ unsigned short size,
+ const PublicKey * publicKey,
+ RSAEncryptedData * target);
+
+/**
+ * Decrypt a given block with the hostkey.
+ *
+ * @param key the key to use
+ * @param block the data to decrypt, encoded as returned by encrypt, not
consumed
+ * @param result pointer to a location where the result can be stored
+ * @param size how many bytes of a result are expected? Must be exact.
+ * @returns the size of the decrypted block (that is, size) or -1 on error
+ */
+int decryptPrivateKey(const struct PrivateKey * key,
+ const RSAEncryptedData * block,
+ void * result,
+ unsigned short size);
+
+/**
+ * Sign a given block.
+ *
+ * @param block the data to sign, first unsigned short_SIZE bytes give length
+ * @param size how many bytes to sign
+ * @param result where to write the signature
+ * @return SYSERR on error, OK on success
+ */
+int sign(const struct PrivateKey * key,
+ unsigned short size,
+ const void * block,
+ Signature * result);
+
+/**
+ * Verify signature.
+ * @param block the signed data
+ * @param len the length of the block
+ * @param sig signature
+ * @param publicKey public key of the signer
+ * @returns OK if ok, SYSERR if invalid
+ */
+int verifySig(const void * block,
+ unsigned short len,
+ const Signature * sig,
+ const PublicKey * publicKey);
+
+#if 0 /* keep Emacsens' auto-indent happy */
+{
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+
+/* ifndef GNUNET_UTIL_CRYPTO_H */
+#endif
+/* end of gnunet_util_crypto.h */
Added: GNUnet/src/include/gnunet_util_error.h
===================================================================
--- GNUnet/src/include/gnunet_util_error.h 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/include/gnunet_util_error.h 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,202 @@
+/*
+ This file is part of GNUnet.
+ (C) 2006 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 include/gnunet_util_error.h
+ * @brief error handling API
+ *
+ * @author Christian Grothoff
+ */
+
+#ifndef GNUNET_UTIL_ERROR_H
+#define GNUNET_UTIL_ERROR_H
+
+#define GNUNET_UTIL_ERROR_VERSION 0x00000000
+
+#ifdef __cplusplus
+extern "C" {
+#if 0 /* keep Emacsens' auto-indent happy */
+}
+#endif
+#endif
+
+/**
+ * Context required to log messages.
+ */
+struct GE_Context;
+
+/**
+ * Classes of log messages.
+ */
+typedef enum {
+ GE_NOTHING = 0x00000000,
+ /* type of event */
+ GE_DEBUG = 0x00000001, /* DEBUG/CRON/EVERYTHING */
+ GE_STATUS = 0x00000002, /* INFO/MESSAGE */
+ GE_WARNING = 0x00000004,
+ GE_ERROR = 0x00000008,
+ GE_FATAL = 0x00000010, /* FATAL/FAILURE/NOTHING */
+ GE_EVENTKIND = 0x000000FF, /* bitmask */
+
+ /* who should see the message? */
+ GE_USER = 0x01000000, /* current user, if possible */
+ GE_ADMIN = 0x02000000, /* system administrator */
+ GE_DEVELOPER = 0x04000000, /* GNUnet developers (bug!) */
+ GE_USERKIND = 0x0F000000, /* bitmask */
+
+ /* how event should be routed */
+ GE_REQUEST = 0x20000000, /* display on request only (i.e. low-priority
log, user demands verbose events) */
+ GE_BULK = 0x40000000, /* display in bulk output (i.e. log-file, scroll
window, console) */
+ GE_IMMEDIATE = 0x80000000, /* display immediately (i.e. pop-up, e-mail) */
+ GE_ROUTEKIND = 0xF0000000, /* bitmask */
+ GE_ALL = 0xFFFFFFFF,
+ GE_INVALID = 0x08000000, /* unused bit */
+} GE_KIND;
+
+void GE_LOG(struct GE_Context * ctx,
+ GE_KIND kind,
+ const char * message,
+ ...);
+
+void GE_setDefaultContext(struct GE_Context * ctx);
+
+/**
+ * User-defined handler for Log events.
+ */
+typedef void (*GE_LogHandler)(void * ctx,
+ GE_KIND kind,
+ const char * date,
+ const char * msg);
+
+/**
+ * User-defined method to free handler context.
+ */
+typedef void (*GE_CtxFree)(void * ctx);
+
+/**
+ * Create a log context that calls a callback function
+ * for matching events.
+ *
+ * @param mask which events is this handler willing to process?
+ * an event must be non-zero in all 3 GE_MASK categories
+ * to be passed to this handler
+ * @param liberator callback to free ctx, maybe NULL
+ */
+struct GE_Context *
+GE_create_context_callback(GE_KIND mask,
+ GE_LogHandler handler,
+ void * ctx,
+ GE_CtxFree liberator);
+
+/**
+ * Free a log context.
+ */
+void GE_free_context(struct GE_Context * ctx);
+
+/**
+ * Does the given event match the mask?
+ * @param have the event type
+ * @param mask the filter mask
+ */
+int GE_applies(GE_KIND have,
+ GE_KIND mask);
+
+/**
+ * Would an event of this kind be possibly
+ * processed by the logger?
+ * @param ctx the logger
+ * @param have the kind of event
+ */
+int GE_isLogged(struct GE_Context * ctx,
+ GE_KIND kind);
+
+/**
+ * Convert a textual description of a loglevel
+ * to the respective GE_KIND.
+ * @returns GE_INVALID if log does not parse
+ */
+GE_KIND GE_getKIND(const char * log);
+
+/**
+ * Convert KIND to String
+ */
+const char * GE_kindToString(GE_KIND kind);
+
+/**
+ * Create a context that sends events to two other contexts.
+ * Note that the client must stop using ctx1/ctx2 henceforth.
+ */
+struct GE_Context *
+GE_create_context_multiplexer(struct GE_Context * ctx1,
+ struct GE_Context * ctx2);
+
+/**
+ * If this context would log an event of the given kind,
+ * execute statement "a".
+ */
+#define IF_GELOG(ctx, kind, a) do { if (GE_isLogged(ctx, kind) { a; } }
while(0);
+
+#define GE_ASSERT(ctx, cond) do { if (! (cond)) { GE_LOG(ctx, GE_DEVELOPER |
GE_USER | GE_FATAL | GE_IMMEDIATE, _("Assertion failed at %s:%d in %s.\n"),
__FILE__, __LINE__, __FUNCTION__); abort(); } } while(0);
+
+#define GE_ASSERT_FLF(ctx, cond, file, line, function) do { if (! (cond)) {
GE_LOG(_(ctx, GE_DEVELOPER | GE_USER | GE_FATAL | GE_IMMEDIATE, "Assertion
failed at %s:%d in %s.\n"), file, line, function); abort(); } } while(0);
+
+#define GE_BREAK(ctx, cond) do { if (! (cond)) { GE_LOG(ctx, GE_DEVELOPER |
GE_USER | GE_FATAL | GE_IMMEDIATE, _("Assertion failed at %s:%d in %s.\n"),
__FILE__, __LINE__, __FUNCTION__); } } while(0);
+
+#define GE_BREAK_FLF(ctx, cond, file, line, function) do { if (! (cond)) {
GE_LOG(ctx, GE_DEVELOPER | GE_USER | GE_FATAL | GE_IMMEDIATE, _("Assertion
failed at %s:%d in %s.\n"), file, line, function); } } while(0);
+
+/**
+ * Log an error message at log-level 'level' that indicates
+ * a failure of the command 'cmd' with the message given
+ * by strerror(errno).
+ */
+#define GE_LOG_STRERROR(ctx, level, cmd) do { GE_LOG(ctx, level, _("`%s'
failed at %s:%d in %s with error: %s\n"), cmd, __FILE__, __LINE__,
__FUNCTION__, STRERROR(errno)); } while(0);
+
+/**
+ * Log an error message at log-level 'level' that indicates
+ * a failure of the command 'cmd' with the message given
+ * by strerror(errno).
+ */
+#define GE_DIE_STRERROR(ctx, level, cmd) do { GE_LOG(ctx, level, _("`%s'
failed at %s:%d in %s with error: %s\n"), cmd, __FILE__, __LINE__,
__FUNCTION__, STRERROR(errno)); abort(); } while(0);
+
+/**
+ * Log an error message at log-level 'level' that indicates
+ * a failure of the command 'cmd' with the message given
+ * by strerror(errno).
+ */
+#define GE_LOG_STRERROR_FLF(ctx, level, cmd, file, line, function) do {
GE_LOG(ctx, level, _("`%s' failed at %s:%d in %s with error: %s\n"), cmd, file,
line, function, STRERROR(errno)); } while(0);
+
+/**
+ * Log an error message at log-level 'level' that indicates
+ * a failure of the command 'cmd' with the message given
+ * by strerror(errno).
+ */
+#define GE_LOG_STRERROR_FILE(ctx, level, cmd, filename) do { GE_LOG(ctx,
level, _("`%s' failed on file `%s' at %s:%d in %s with error: %s\n"), cmd,
filename,__FILE__, __LINE__, __FUNCTION__, STRERROR(errno)); } while(0);
+
+
+
+
+#if 0 /* keep Emacsens' auto-indent happy */
+{
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Added: GNUnet/src/include/gnunet_util_error_loggers.h
===================================================================
--- GNUnet/src/include/gnunet_util_error_loggers.h 2006-06-15 16:42:32 UTC
(rev 3010)
+++ GNUnet/src/include/gnunet_util_error_loggers.h 2006-06-15 16:49:28 UTC
(rev 3011)
@@ -0,0 +1,131 @@
+/*
+ This file is part of GNUnet.
+ (C) 2006 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 include/gnunet_util_error_loggers.h
+ * @brief error handling, code that provides loggers
+ *
+ * @author Christian Grothoff
+ */
+
+#ifndef GNUNET_UTIL_ERROR_LOGGERS_H
+#define GNUNET_UTIL_ERROR_LOGGERS_H
+
+#ifdef __cplusplus
+extern "C" {
+#if 0 /* keep Emacsens' auto-indent happy */
+}
+#endif
+#endif
+
+#include "gnunet_util_error.h"
+
+struct GE_Memory;
+
+
+/**
+ * Create a logger that writes events to a file.
+ *
+ * @param ectx where to log errors in the logger
+ * @param mask which events should be logged?
+ * @param filename which file should we log to?
+ * @param logDate should the context log event dates?
+ * @param logrotate should logs be rotated (if so, this
+ * value specifies after how many days logs should be deleted)
+ * (use 0 for no rotation)
+ */
+struct GE_Context *
+GE_create_context_logfile(struct GE_Context * ectx,
+ GE_KIND mask,
+ const char * filename,
+ int logDate,
+ int logrotate);
+
+
+/**
+ * Create a logger that writes events to stderr
+ *
+ * @param mask which events should be logged?
+ */
+struct GE_Context *
+GE_create_context_stderr(int logDate,
+ GE_KIND mask);
+
+/**
+ * Create a logger that keeps events in memory (to be
+ * queried later in bulk).
+ */
+struct GE_Context *
+GE_create_context_memory(GE_KIND mask,
+ struct GE_Memory * memory);
+
+#if FICTION
+/**
+ * @param ectx where to log errors in the logger
+ * @param address e-mail address to send the logs to
+ * @param server hostname of SMTP gateway, NULL for using local "mail" command
+ * @param port port to use for SMTP
+ * @param logDate should the date be each of the log lines?
+ * @param bulkSize for GE_BULK messages, how many lines of messages
+ * should be accumulated before an e-mail is transmitted?
+ */
+struct GE_Context *
+GE_create_context_email(struct GE_Context * ectx,
+ GE_KIND mask,
+ const char * address,
+ const char * server,
+ unsigned short port,
+ int logDate,
+ unsigned int bulkSize);
+#endif
+
+/**
+ * Create a context to log messages in memory.
+ * This is useful if we first need to capture all
+ * log messages of an operation to provide the
+ * final error in bulk to the client (i.e. as
+ * a return value, possibly over the network).
+ *
+ * @param maxSize the maximum number of messages to keep, 0 for unbounded
+ * (if more than maxSize messages are received, message number maxSize
+ * will be set to a corresponding warning)
+ */
+struct GE_Memory *
+GE_create_memory(unsigned int maxSize);
+
+/**
+ * For all messages stored in the memory, call the handler.
+ * Also clears the memory.
+ */
+void GE_poll_memory(struct GE_Memory * memory,
+ GE_LogHandler handler,
+ void * ctx);
+
+void GE_free_memory(struct GE_Memory * memory);
+
+
+#if 0 /* keep Emacsens' auto-indent happy */
+{
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Modified: GNUnet/src/util/Makefile.am
===================================================================
--- GNUnet/src/util/Makefile.am 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/Makefile.am 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,3 +1,5 @@
+SUBDIRS = $(WINSUBDIRS) $(CYGSUBDIRS) error config . config_impl loggers
crypto containers
+
INCLUDES = -I$(top_srcdir)/src/include
plugindir = $(libdir)/GNUnet
@@ -31,11 +33,10 @@
lib_LTLIBRARIES = libgnunetutil.la
-AM_CPPFLAGS = $(LIBGCRYPT_CFLAGS)
+libgnunetutil_la_LIBADD = $(GCLIBADD) $(CYGLIBADD) $(WINLIBADD) \
+ error/liberror.la \
+ config/libconfig.la
-libgnunetutil_la_LIBADD = $(GCLIBADD) $(CYGLIBADD) $(WINLIBADD)
-SUBDIRS = $(WINSUBDIRS) $(CYGSUBDIRS) .
-
EXTRA_DIST = \
testconfig.conf \
check.conf
@@ -45,38 +46,26 @@
-version-info 1:0:0
libgnunetutil_la_SOURCES = \
- bloomfilter.c \
- checksum.c \
- configuration.c \
cron.c \
daemon.c \
dso.c \
+ endian.c \
getopt.c \
- hashing.c \
- hashtable.c \
- hostkey_gcrypt.c \
initialize.c \
io.c \
ipcheck.c \
- kblockkey.c \
- locking_gcrypt.c \
- locking_gcrypt.h \
- logging.c \
osconfig.c \
printhelp.c \
port.c \
- random.c \
semaphore.c \
shutdown.c \
state.c \
statuscalls.c \
storage.c \
string.c \
- symcipher_gcrypt.c \
tcp_return.c \
tcpio.c \
timer.c \
- vector.c \
xmalloc.c
################################
@@ -84,26 +73,15 @@
################################
check_PROGRAMS = \
- bloomtest \
- crctest \
crontest \
- configtest \
daemontest \
- hashtabletest \
- hashtest \
- hashingtest \
- hostkeytest \
- kblockkey_test \
semaphoretest \
shutdowntest \
statetest \
statuscallstest \
storagetest \
- symciphertest \
tcpiotest \
timertest \
- vectortest \
- weakkeytest \
xmalloctest
TESTS = $(check_PROGRAMS)
@@ -133,56 +111,16 @@
timertest_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la
-hashtabletest_SOURCES = \
- hashtabletest.c
-hashtabletest_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la
-
-hashingtest_SOURCES = \
- hashingtest.c
-hashingtest_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la
-
tcpiotest_SOURCES = \
tcpiotest.c
tcpiotest_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la
-vectortest_SOURCES = \
- vectortest.c
-vectortest_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la
-
-crctest_SOURCES = \
- crctest.c
-crctest_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la
-
-kblockkey_test_SOURCES = \
- kblockkey_test.c
-kblockkey_test_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la
-
-configtest_SOURCES = \
- configtest.c
-configtest_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la
-
crontest_SOURCES = \
crontest.c
crontest_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la
-hostkeytest_SOURCES = \
- hostkeytest.c
-hostkeytest_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la
-
-hashtest_SOURCES = \
- hashtest.c
-hashtest_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la
-
storagetest_SOURCES = \
storagetest.c
storagetest_LDADD = \
@@ -193,22 +131,9 @@
statuscallstest_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la
-symciphertest_SOURCES = \
- symciphertest.c
-symciphertest_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la
-
semaphoretest_SOURCES = \
semaphoretest.c
semaphoretest_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la
-weakkeytest_SOURCES = \
- weakkeytest.c
-weakkeytest_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la
-bloomtest_SOURCES = \
- bloomtest.c
-bloomtest_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la
Added: GNUnet/src/util/README
===================================================================
--- GNUnet/src/util/README 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/README 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,22 @@
+Util is now structured as follows:
+
+util/error: basic error handling functions (lowest layer)
+util/win: win32 portability (lowest layer)
+util/config: configuration handling (depends on error)
+util: main utility library (depends on util/error, util/win and util/config)
+ => these are linked into gnunetutil.so
+util/loggers: specific logging implementations (depends on gnunetutil.so)
+ => linked to gnunetutil_logging.so
+util/config_impl: implementation of config API (depends on gnunetutil.so)
+ => linked to gnunetutil_config.so
+util/crypto: implementation of crypto API (depends on gnunetutil.so)
+ => linked to gnunetutil_crypto.so
+util/containers: implementation of bloomfilter/vector/hashset (depends on
gnunetutil.so)
+ => linked to gnunetutil_containers.so (also requires
libgnunetutil_crypto)
+
+Most GNUnet libraries and plugins will only need to (directly) link
+against gnunetutil.so. Some may also require crypto or containers.
+Applications will usually additionally link against gnunetlogging.so
+and gnunetconfig.so which during startup will be used to provide
+concrete configuration and error handling implementations.
+
Deleted: GNUnet/src/util/bloomfilter.c
===================================================================
--- GNUnet/src/util/bloomfilter.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/bloomfilter.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,573 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2001, 2002, 2003, 2004 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 util/bloomfilter.c
- * @brief data structure used to reduce disk accesses.
- *
- * The idea basically: Create a signature for each element in the
- * database. Add those signatures to a bit array. When doing a lookup,
- * check if the bit array matches the signature of the requested
- * element. If yes, address the disk, otherwise return 'not found'.
- *
- * A property of the bloom filter is that sometimes we will have
- * a match even if the element is not on the disk (then we do
- * an unnecessary disk access), but what's most important is that
- * we never get a single "false negative".
- *
- * To be able to delete entries from the bloom filter, we maintain
- * a 4 bit counter in the file on the drive (we still use only one
- * bit in memory).
- *
- * @author Igor Wronsky
- * @author Christian Grothoff
- */
-
-#include "gnunet_util.h"
-#include "platform.h"
-
-typedef struct Bloomfilter {
- /** The bit counter file on disk */
- int fd;
- /** How many bits we set for each stored element */
- unsigned int addressesPerElement;
- /** The actual bloomfilter bit array */
- char * bitArray;
- /** Size of bitArray in bytes */
- unsigned int bitArraySize;
- /** Concurrency control */
- Mutex lock;
-} Bloomfilter;
-
-
-/**
- * Sets a bit active in the bitArray. Increment bit-specific
- * usage counter on disk only if below 4bit max (==15).
- *
- * @param bitArray memory area to set the bit in
- * @param bitIdx which bit to set
- */
-static void setBit(char * bitArray,
- unsigned int bitIdx) {
- unsigned int arraySlot;
- unsigned int targetBit;
-
- arraySlot = bitIdx / 8;
- targetBit = (1L << (bitIdx % 8));
- bitArray[arraySlot] |= targetBit;
-}
-
-/**
- * Clears a bit from bitArray. Bit is cleared from the array
- * only if the respective usage counter on the disk hits/is zero.
- *
- * @param bitArray memory area to set the bit in
- * @param bitIdx which bit to unset
- */
-static void clearBit(char * bitArray,
- unsigned int bitIdx) {
- unsigned int slot;
- unsigned int targetBit;
-
- slot = bitIdx / 8;
- targetBit = (1L << (bitIdx % 8));
- bitArray[slot] = bitArray[slot] & (~targetBit);
-}
-
-/**
- * Checks if a bit is active in the bitArray
- *
- * @param bitArray memory area to set the bit in
- * @param bitIdx which bit to test
- * @return YES if the bit is set, NO if not.
- */
-static int testBit(char * bitArray,
- unsigned int bitIdx) {
- unsigned int slot;
- unsigned int targetBit;
-
- slot = bitIdx / 8;
- targetBit = (1L << (bitIdx % 8));
- if (bitArray[slot] & targetBit)
- return YES;
- else
- return NO;
-}
-
-/**
- * Sets a bit active in the bitArray and increments
- * bit-specific usage counter on disk (but only if
- * the counter was below 4 bit max (==15)).
- *
- * @param bitArray memory area to set the bit in
- * @param bitIdx which bit to test
- * @param fd A file to keep the 4 bit address usage counters in
- */
-static void incrementBit(char * bitArray,
- unsigned int bitIdx,
- int fd) {
- unsigned int fileSlot;
- unsigned char value;
- unsigned int high;
- unsigned int low;
- unsigned int targetLoc;
-
- setBit(bitArray, bitIdx);
- /* Update the counter file on disk */
- GNUNET_ASSERT(fd != -1);
- fileSlot = bitIdx / 2;
- targetLoc = bitIdx % 2;
-
- if (fileSlot != (unsigned int) lseek(fd, fileSlot, SEEK_SET))
- DIE_STRERROR("lseek");
- value = 0;
- READ(fd,
- &value,
- 1);
-
- low = value & 0xF;
- high = (value & (~0xF)) >> 4;
-
- if (targetLoc == 0) {
- if (low < 0xF)
- low++;
- } else {
- if (high < 0xF)
- high++;
- }
- value = ((high<<4) | low);
- if (fileSlot != (unsigned int) lseek(fd, fileSlot, SEEK_SET))
- DIE_STRERROR("lseek");
- if (1 != WRITE(fd, &value, 1))
- DIE_STRERROR("write");
-}
-
-/**
- * Clears a bit from bitArray if the respective usage
- * counter on the disk hits/is zero.
- *
- * @param bitArray memory area to set the bit in
- * @param bitIdx which bit to test
- * @param fd A file to keep the 4bit address usage counters in
- */
-static void decrementBit(char * bitArray,
- unsigned int bitIdx,
- int fd) {
- unsigned int fileSlot;
- unsigned char value;
- unsigned int high;
- unsigned int low;
- unsigned int targetLoc;
-
- GNUNET_ASSERT(fd != -1);
- /* Each char slot in the counter file holds two 4 bit counters */
- fileSlot = bitIdx / 2;
- targetLoc = bitIdx % 2;
-
- lseek(fd, fileSlot, SEEK_SET);
- value = 0;
- READ(fd, &value, 1);
-
- low = value & 0xF;
- high = (value & 0xF0) >> 4;
-
- /* decrement, but once we have reached the max, never go back! */
- if (targetLoc == 0) {
- if ( (low > 0) && (low < 0xF) )
- low--;
- if (low == 0) {
- clearBit(bitArray, bitIdx);
- }
- } else {
- if ( (high > 0) && (high < 0xF) )
- high--;
- if (high == 0) {
- clearBit(bitArray, bitIdx);
- }
- }
- value = ((high<<4) | low);
- lseek(fd, fileSlot, SEEK_SET);
- if (1 != WRITE(fd, &value, 1))
- DIE_STRERROR("write");
-}
-
-#define BUFFSIZE 65536
-
-/**
- * Creates a file filled with zeroes
- *
- * @param fd the file handle
- * @param size the size of the file
- * @return OK if created ok, SYSERR otherwise
- */
-static int makeEmptyFile(int fd,
- unsigned int size) {
- char * buffer;
- unsigned int bytesleft=size;
- int res = 0;
-
- if (fd == -1)
- return SYSERR;
- buffer = (char*)MALLOC(BUFFSIZE);
- memset(buffer, 0, BUFFSIZE);
- lseek(fd, 0, SEEK_SET);
-
- while (bytesleft > 0) {
- if (bytesleft>BUFFSIZE) {
- res = WRITE(fd, buffer, BUFFSIZE);
- bytesleft -= BUFFSIZE;
- } else {
- res = WRITE(fd, buffer, bytesleft);
- bytesleft = 0;
- }
- if(res == -1) {
- LOG_STRERROR(LOG_WARNING, "write");
- FREE(buffer);
- return SYSERR;
- }
- }
- FREE(buffer);
- return OK;
-}
-
-/* ************** Bloomfilter hash iterator ********* */
-
-/**
- * Iterator (callback) method to be called by the
- * bloomfilter iterator on each bit that is to be
- * set or tested for the key.
- *
- * @param bf the filter to manipulate
- * @param bit the current bit
- * @param additional context specific argument
- */
-typedef void (*BitIterator)(Bloomfilter * bf,
- unsigned int bit,
- void * arg);
-
-/**
- * Call an iterator for each bit that the bloomfilter
- * must test or set for this element.
- *
- * @param bf the filter
- * @param callback the method to call
- * @param arg extra argument to callback
- * @param key the key for which we iterate over the BF bits
- */
-static void iterateBits(Bloomfilter * bf,
- BitIterator callback,
- void * arg,
- const HashCode512 * key) {
- HashCode512 tmp[2];
- int bitCount;
- int round;
- unsigned int slot=0;
-
- bitCount = bf->addressesPerElement;
- memcpy(&tmp[0],
- key,
- sizeof(HashCode512));
- round = 0;
- while (bitCount > 0) {
- while (slot < (sizeof(HashCode512)/sizeof(unsigned int))) {
- callback(bf,
- (((unsigned int*)&tmp[round&1])[slot]) &
((bf->bitArraySize*8)-1),
- arg);
- slot++;
- bitCount--;
- if (bitCount == 0)
- break;
- }
- if (bitCount > 0) {
- hash(&tmp[round & 1],
- sizeof(HashCode512),
- &tmp[(round+1) & 1]);
- round++;
- slot = 0;
- }
- }
-}
-
-/**
- * Callback: increment bit
- *
- * @param bf the filter to manipulate
- * @param bit the bit to increment
- * @param arg not used
- */
-static void incrementBitCallback(Bloomfilter * bf,
- unsigned int bit,
- void * arg) {
- incrementBit(bf->bitArray,
- bit,
- bf->fd);
-}
-
-/**
- * Callback: decrement bit
- *
- * @param bf the filter to manipulate
- * @param bit the bit to decrement
- * @param arg not used
- */
-static void decrementBitCallback(Bloomfilter * bf,
- unsigned int bit,
- void * arg) {
- decrementBit(bf->bitArray,
- bit,
- bf->fd);
-}
-
-/**
- * Callback: test if all bits are set
- *
- * @param bf the filter
- * @param bit the bit to test
- * @param arg pointer set to NO if bit is not set
- */
-static void testBitCallback(const Bloomfilter * bf,
- unsigned int bit,
- int * arg) {
- if (NO == testBit(bf->bitArray,
- bit))
- *arg = NO;
-}
-
-/* *********************** INTERFACE **************** */
-
-/**
- * Load a bloom-filter from a file.
- *
- * @param filename the name of the file (or the prefix)
- * @param size the size of the bloom-filter (number of
- * bytes of storage space to use)
- * @param k the number of hash-functions to apply per
- * element (number of bits set per element in the set)
- * @return the bloomfilter
- */
-Bloomfilter * loadBloomfilter(const char * filename,
- unsigned int size,
- unsigned int k) {
- Bloomfilter * bf;
- char * rbuff;
- unsigned int pos;
- int i;
- unsigned int ui;
-
- if ( (filename == NULL) ||
- (k==0) ||
- (size==0) )
- return NULL;
- if (size < BUFFSIZE)
- size = BUFFSIZE;
- ui = 1;
- while (ui < size)
- ui*=2;
- size = ui; /* make sure it's a power of 2 */
-
- bf = (Bloomfilter *) MALLOC(sizeof(Bloomfilter));
-
- /* Try to open a bloomfilter file */
-#ifndef _MSC_VER
- bf->fd = fileopen(filename, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
-#else
- bf->fd = fileopen(filename, O_WRONLY|O_CREAT, S_IREAD|S_IWRITE);
-#endif
- if (-1 == bf->fd) {
- LOG_FILE_STRERROR(LOG_FAILURE, "open", filename);
- FREE(bf);
- return NULL;
- }
-
- /* Alloc block */
- MUTEX_CREATE_RECURSIVE(&bf->lock);
- bf->bitArray
- = (char *) xmalloc_unchecked_(size, __FILE__, __LINE__);
- bf->bitArraySize = size;
- bf->addressesPerElement = k;
- memset(bf->bitArray,
- 0,
- bf->bitArraySize);
-
- /* Read from the file what bits we can */
- rbuff = (char*)MALLOC(BUFFSIZE);
- pos = 0;
- while (pos < size*8) {
- int res;
-
- res = READ(bf->fd,
- rbuff,
- BUFFSIZE);
- if (res == 0)
- break; /* is ok! we just did not use that many bits yet */
- for (i=0;i<res;i++) {
- if ( (rbuff[i] & 0x0F) != 0)
- setBit(bf->bitArray,
- pos + i*2);
- if ( (rbuff[i] & 0xF0) != 0)
- setBit(bf->bitArray,
- pos + i*2 + 1);
- }
- if (res < BUFFSIZE)
- break;
- pos += BUFFSIZE * 2; /* 2 bits per byte in the buffer */
- }
- FREE(rbuff);
- return bf;
-}
-
-/**
- * Free the space associated with a filter
- * in memory, flush to drive if needed (do not
- * free the space on the drive)
- *
- * @param bf the filter
- */
-void freeBloomfilter(Bloomfilter * bf) {
- if (NULL == bf)
- return;
- MUTEX_DESTROY(&bf->lock);
- closefile(bf->fd);
- FREE(bf->bitArray);
- FREE(bf);
-}
-
-/**
- * Reset a bloom filter to empty. Clears the file on disk.
- *
- * @param bf the filter
- */
-void resetBloomfilter(Bloomfilter * bf) {
- if (NULL == bf)
- return;
-
- MUTEX_LOCK(&bf->lock);
- memset(bf->bitArray,
- 0,
- bf->bitArraySize);
- makeEmptyFile(bf->fd,
- bf->bitArraySize * 4);
- MUTEX_UNLOCK(&bf->lock);
-}
-
-
-/**
- * Test if an element is in the filter.
- *
- * @param e the element
- * @param bf the filter
- * @return YES if the element is in the filter, NO if not
- */
-int testBloomfilter(Bloomfilter * bf,
- const HashCode512 * e) {
- int res;
-
- if (NULL == bf)
- return YES;
- MUTEX_LOCK(&bf->lock);
- res = YES;
- iterateBits(bf,
- (BitIterator)&testBitCallback,
- &res,
- e);
- MUTEX_UNLOCK(&bf->lock);
- return res;
-}
-
-/**
- * Add an element to the filter
- *
- * @param bf the filter
- * @param e the element
- */
-void addToBloomfilter(Bloomfilter * bf,
- const HashCode512 * e) {
-
- if (NULL == bf)
- return;
- MUTEX_LOCK(&bf->lock);
- iterateBits(bf,
- &incrementBitCallback,
- NULL,
- e);
- MUTEX_UNLOCK(&bf->lock);
-}
-
-/**
- * Remove an element from the filter.
- *
- * @param bf the filter
- * @param e the element to remove
- */
-void delFromBloomfilter(Bloomfilter * bf,
- const HashCode512 * e) {
- if(NULL == bf)
- return;
- MUTEX_LOCK(&bf->lock);
- iterateBits(bf,
- &decrementBitCallback,
- NULL,
- e);
- MUTEX_UNLOCK(&bf->lock);
-}
-
-/**
- * Resize a bloom filter. Note that this operation
- * is pretty costly. Essentially, the bloom filter
- * needs to be completely re-build.
- *
- * @param bf the filter
- * @param iterator an iterator over all elements stored in the BF
- * @param iterator_arg argument to the iterator function
- * @param size the new size for the filter
- * @param k the new number of hash-function to apply per element
- */
-void resizeBloomfilter(Bloomfilter * bf,
- ElementIterator iterator,
- void * iterator_arg,
- unsigned int size,
- unsigned int k) {
- HashCode512 * e;
- unsigned int i;
-
- MUTEX_LOCK(&bf->lock);
- FREE(bf->bitArray);
- i = 1;
- while (i < size)
- i*=2;
- size = i; /* make sure it's a power of 2 */
-
- bf->bitArraySize = size;
- bf->bitArray = (char*)MALLOC(size);
- memset(bf->bitArray,
- 0,
- bf->bitArraySize);
- makeEmptyFile(bf->fd,
- bf->bitArraySize * 4);
- e = iterator(iterator_arg);
- while (e != NULL) {
- addToBloomfilter(bf,
- e);
- FREE(e);
- e = iterator(iterator_arg);
- }
- MUTEX_UNLOCK(&bf->lock);
-}
-
-/* ******************** end of bloomfilter.c *********** */
Deleted: GNUnet/src/util/bloomtest.c
===================================================================
--- GNUnet/src/util/bloomtest.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/bloomtest.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,128 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2004 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 test/bloomtest.c
- * @brief Testcase for the bloomfilter.
- * @author Igor Wronsky
- */
-
-#include "gnunet_util.h"
-#include "platform.h"
-
-#define K 4
-#define SIZE 65536
-
-/**
- * Generate a random hashcode.
- */
-static void nextHC(HashCode512 * hc) {
- makeRandomId(hc);
-}
-
-int main(int argc, char *argv[]) {
- struct Bloomfilter *bf;
- HashCode512 tmp;
- int i;
- int ok;
- int falseok;
-
- initUtil(argc, argv, NULL);
- srand(1);
- UNLINK("/tmp/bloomtest.dat");
- bf = loadBloomfilter("/tmp/bloomtest.dat", SIZE, K);
-
- for(i=0;i<200;i++) {
- nextHC(&tmp);
- addToBloomfilter(bf, &tmp);
- }
- srand(1);
- ok=0;
- for(i=0;i<200;i++) {
- nextHC(&tmp);
- if (testBloomfilter(bf, &tmp) == YES)
- ok++;
- }
- if (ok != 200) {
- printf(" Got %d elements out of"
- "200 expected after insertion.\n",
- ok);
- doneUtil();
- return -1;
- }
- freeBloomfilter(bf);
-
-
- bf=loadBloomfilter("/tmp/bloomtest.dat", SIZE, K);
-
- srand(1);
- ok=0;
- for(i=0;i<200;i++) {
- nextHC(&tmp);
- if (testBloomfilter(bf, &tmp) == YES)
- ok++;
- }
- if (ok != 200) {
- printf(" Got %d elements out of 200"
- "expected after reloading.\n",
- ok);
- doneUtil();
- return -1;
- }
-
- srand(1);
- for(i=0;i<100;i++) {
- nextHC(&tmp);
- delFromBloomfilter(bf, &tmp);
- }
-
- srand(1);
-
- ok=0;
- for(i=0;i<200;i++) {
- nextHC(&tmp);
- if(testBloomfilter(bf, &tmp) == YES)
- ok++;
- }
-
- if (ok != 100) {
- printf(" Expected 100 elements in filter"
- " after adding 200 and deleting 100, got %d\n",
- ok);
- doneUtil();
- return -1;
- }
-
- srand(3);
-
- falseok=0;
- for(i=0;i<1000;i++) {
- nextHC(&tmp);
- if(testBloomfilter(bf, &tmp) == YES)
- falseok++;
- }
-
- freeBloomfilter(bf);
-
- UNLINK("/tmp/bloomtest.dat");
- doneUtil();
- return(0);
-}
-
-
Deleted: GNUnet/src/util/checksum.c
===================================================================
--- GNUnet/src/util/checksum.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/checksum.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,192 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2001, 2002, 2003, 2004 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.
-
- For the actual CRC code:
- Copyright abandoned; this code is in the public domain.
- Provided to GNUnet by address@hidden
-*/
-
-/**
- * @file util/checksum.c
- * @brief implementation of CRC32 and various helper methods
- * @author Christian Grothoff
- */
-
-#include "platform.h"
-#include "gnunet_util.h"
-#include <iconv.h>
-
-/* Avoid wasting space on 8-byte longs. */
-#if UINT_MAX >= 0xffffffff
- typedef unsigned int uLong;
-#elif ULONG_MAX >= 0xffffffff
- typedef unsigned long uLong;
-#else
- #error This compiler is not ANSI-compliant!
-#endif
-
-#define Z_NULL 0
-
-
-#define POLYNOMIAL (uLong)0xedb88320
-static uLong crc_table[256];
-
-/*
- * This routine writes each crc_table entry exactly once,
- * with the ccorrect final value. Thus, it is safe to call
- * even on a table that someone else is using concurrently.
- */
-static void make_crc_table() {
- unsigned int i, j;
- uLong h = 1;
- crc_table[0] = 0;
- for (i = 128; i; i >>= 1) {
- h = (h >> 1) ^ ((h & 1) ? POLYNOMIAL : 0);
- /* h is now crc_table[i] */
- for (j = 0; j < 256; j += 2*i)
- crc_table[i+j] = crc_table[j] ^ h;
- }
-}
-
-/*
- * This computes the standard preset and inverted CRC, as used
- * by most networking standards. Start by passing in an initial
- * chaining value of 0, and then pass in the return value from the
- * previous crc32() call. The final return value is the CRC.
- * Note that this is a little-endian CRC, which is best used with
- * data transmitted lsbit-first, and it should, itself, be appended
- * to data in little-endian byte and bit order to preserve the
- * property of detecting all burst errors of length 32 bits or less.
- */
-static uLong crc32(uLong crc,
- const char *buf,
- size_t len) {
- if (crc_table[255] == 0)
- make_crc_table();
- crc ^= 0xffffffff;
- while (len--)
- crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
- return crc ^ 0xffffffff;
-}
-
-
-/**
- * Compute the CRC32 checksum for the first len bytes of the buffer.
- *
- * @param buf the data over which we're taking the CRC
- * @param len the length of the buffer
- * @return the resulting CRC32 checksum
- */
-int crc32N(const void * buf, int len) {
- uLong crc;
- crc = crc32(0L, Z_NULL, 0);
- crc = crc32(crc, (char*)buf, len);
- return crc;
-}
-
-/* **************** endian conversion helpers ************* */
-
-/**
- * This method does not really belong here, but where else to put
- * it...
- */
-unsigned long long ntohll(unsigned long long n) {
-#if __BYTE_ORDER == __BIG_ENDIAN
- return n;
-#else
- return (((unsigned long long)ntohl(n)) << 32) + ntohl(n >> 32);
-#endif
-}
-
-/**
- * This method does not really belong here, but where else to put
- * it...
- */
-unsigned long long htonll(unsigned long long n) {
-#if __BYTE_ORDER == __BIG_ENDIAN
- return n;
-#else
- return (((unsigned long long)htonl(n)) << 32) + htonl(n >> 32);
-#endif
-}
-
-/* ************* character conversion helpers *********** */
-
-/**
- * Convert the len characters long character sequence
- * given in input that is in the given charset
- * to UTF-8.
- * @return the converted string (0-terminated),
- * if conversion fails, a copy of the orignal
- * string is returned.
- */
-char * convertToUtf8(const char * input,
- size_t len,
- const char * charset) {
- char * ret;
-#if ENABLE_NLS
- size_t tmpSize;
- size_t finSize;
- char * tmp;
- char * itmp;
- iconv_t cd;
-
- cd = iconv_open("UTF-8", charset);
- if (cd == (iconv_t) -1) {
- ret = malloc(len+1);
- memcpy(ret, input, len);
- ret[len] = '\0';
- return ret;
- }
- tmpSize = 3 * len + 4;
- tmp = malloc(tmpSize);
- itmp = tmp;
- finSize = tmpSize;
- if (iconv(cd,
- (char**) &input,
- &len,
- &itmp,
- &finSize) == (size_t)-1) {
- iconv_close(cd);
- free(tmp);
- ret = malloc(len+1);
- memcpy(ret, input, len);
- ret[len] = '\0';
- return ret;
- }
- ret = malloc(tmpSize - finSize + 1);
- memcpy(ret,
- tmp,
- tmpSize - finSize);
- ret[tmpSize - finSize] = '\0';
- free(tmp);
- iconv_close(cd);
- return ret;
-#else
- ret = malloc(len+1);
- memcpy(ret, input, len);
- ret[len] = '\0';
- return ret;
-#endif
-}
-
-
-
-
-/* end of checksum.c */
Added: GNUnet/src/util/config/.deps/config.Plo
===================================================================
--- GNUnet/src/util/config/.deps/config.Plo 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/config/.deps/config.Plo 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,10 @@
+config.lo .libs/config.o: config.c \
+ ../../../src/include/gnunet_util_config_impl.h \
+ ../../../src/include/gnunet_util_config.h \
+ ../../../src/include/gnunet_util_error.h
+
+../../../src/include/gnunet_util_config_impl.h:
+
+../../../src/include/gnunet_util_config.h:
+
+../../../src/include/gnunet_util_error.h:
Added: GNUnet/src/util/config/.libs/libconfig.a
===================================================================
(Binary files differ)
Property changes on: GNUnet/src/util/config/.libs/libconfig.a
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: GNUnet/src/util/config/Makefile
===================================================================
--- GNUnet/src/util/config/Makefile 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/config/Makefile 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,601 @@
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# src/util/config/Makefile. Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 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.
+
+
+
+SOURCES = $(libconfig_la_SOURCES)
+
+srcdir = .
+top_srcdir = ../../..
+
+pkgdatadir = $(datadir)/GNUnet
+pkglibdir = $(libdir)/GNUnet
+pkgincludedir = $(includedir)/GNUnet
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = /usr/bin/install -c
+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 = :
+host_triplet = i686-pc-linux-gnu
+subdir = src/util/config
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-2.0.m4 \
+ $(top_srcdir)/m4/guile.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/libgcrypt.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libconfig_la_LIBADD =
+am_libconfig_la_OBJECTS = config.lo
+libconfig_la_OBJECTS = $(am_libconfig_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+DEP_FILES = ./$(DEPDIR)/config.Plo
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libconfig_la_SOURCES)
+DIST_SOURCES = $(libconfig_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = ${SHELL} /home/grothoff/svn/GNUnet/missing --run aclocal-1.8
+AMDEP_FALSE = #
+AMDEP_TRUE =
+AMTAR = ${SHELL} /home/grothoff/svn/GNUnet/missing --run tar
+AR = ar
+AS = as
+AUTOCONF = ${SHELL} /home/grothoff/svn/GNUnet/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/grothoff/svn/GNUnet/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/grothoff/svn/GNUnet/missing --run automake-1.8
+AWK = gawk
+CC = gcc
+CCDEPMODE = depmode=gcc3
+CFLAGS = -fno-strict-aliasing -Wall -g -Wall
+CONVENIENCE_LTDL_FALSE =
+CONVENIENCE_LTDL_TRUE = #
+CPP = gcc -E
+CPPFLAGS = -I/home/grothoff/include
+CXX = g++
+CXXCPP = g++ -E
+CXXDEPMODE = depmode=gcc3
+CXXFLAGS = -g -O2
+CYGPATH_W = echo
+CYGWIN_FALSE =
+CYGWIN_TRUE = #
+DATADIR = /home/grothoff/share/GNUnet/
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+DLLTOOL = dlltool
+ECHO = echo
+ECHO_C =
+ECHO_N = -n
+ECHO_T =
+EGREP = grep -E
+EXEEXT =
+EXT_LIBS =
+EXT_LIB_PATH = -L/home/grothoff/lib
+F77 =
+FFLAGS =
+GMSGFMT = /usr/bin/msgfmt
+GNUNETGTK_CFLAGS = -DXTHREADS -I/usr/include/libglade-2.0
-I/usr/include/gtk-2.0 -I/usr/include/libxml2 -I/usr/lib/gtk-2.0/include
-I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0
-I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
+GNUNETGTK_LIBS = -lglade-2.0 -lgtk-x11-2.0 -lxml2 -lpthread -lz -lgdk-x11-2.0
-latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0
-lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
+GTK_CFLAGS = -DXTHREADS -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include
-I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0
-I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
+GTK_LIBS = -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm
-lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl
-lglib-2.0
+GUILE = /usr/bin/guile
+GUILE_CONFIG = /usr/bin/guile-config
+GUILE_TOOLS = /usr/bin/guile-tools
+HAVE_CURSES_FALSE = #
+HAVE_CURSES_TRUE =
+HAVE_GTK_FALSE = #
+HAVE_GTK_TRUE =
+HAVE_GUILE_FALSE = #
+HAVE_GUILE_TRUE =
+HAVE_IPV6_FALSE = #
+HAVE_IPV6_TRUE =
+HAVE_MYSQL_FALSE =
+HAVE_MYSQL_TRUE = #
+HAVE_PDCURSES_FALSE =
+HAVE_PDCURSES_TRUE = #
+HAVE_SQLITE_FALSE = #
+HAVE_SQLITE_TRUE =
+HAVE_ZLIB_FALSE = #
+HAVE_ZLIB_TRUE =
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_LTDL_FALSE =
+INSTALL_LTDL_TRUE = #
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
+INTLLIBS =
+LDFLAGS = -L/home/grothoff/lib
+LIBADD_DL = -ldl
+LIBGCRYPT_CFLAGS =
+LIBGCRYPT_CONFIG = /usr/bin/libgcrypt-config
+LIBGCRYPT_LIBS = -lgcrypt -lgpg-error
+LIBICONV = -liconv
+LIBINTL =
+LIBLTDL = -lltdl
+LIBOBJS =
+LIBS = -lm -lnsl -lpthread
+LIBTOOL = $(SHELL) $(top_builddir)/libtool
+LN_S = ln -s
+LOCALEDIR = /home/grothoff/share/locale/
+LTDLINCL =
+LTLIBICONV = -liconv
+LTLIBINTL =
+LTLIBOBJS =
+MAKEINFO = ${SHELL} /home/grothoff/svn/GNUnet/missing --run makeinfo
+MINGW_FALSE =
+MINGW_TRUE = #
+MKINSTALLDIRS = $(top_builddir)/./mkinstalldirs
+MSGFMT = /usr/bin/msgfmt
+MSGMERGE = /usr/bin/msgmerge
+MYSQL_CPPFLAGS =
+MYSQL_LDFLAGS = -L/usr/lib/mysql
+OBJDUMP = objdump
+OBJEXT = o
+PACKAGE = GNUnet
+PACKAGE_BUGREPORT = address@hidden
+PACKAGE_NAME = GNUnet
+PACKAGE_STRING = GNUnet 0.7.0e
+PACKAGE_TARNAME = gnunet
+PACKAGE_VERSION = 0.7.0e
+PATH_SEPARATOR = :
+PKG_CONFIG = /usr/bin/pkg-config
+POSUB = po
+RANLIB = ranlib
+SET_MAKE =
+SHELL = /bin/sh
+SOLARIS_FALSE =
+SOLARIS_TRUE = #
+SQLITE_CPPFLAGS =
+SQLITE_LDFLAGS =
+STRIP = strip
+USE_NLS = yes
+VERSION = 0.7.0e
+XFREEBSD_FALSE =
+XFREEBSD_TRUE = #
+XGETTEXT = /usr/bin/xgettext
+ac_ct_AR = ar
+ac_ct_AS =
+ac_ct_CC = gcc
+ac_ct_CXX = g++
+ac_ct_DLLTOOL =
+ac_ct_F77 =
+ac_ct_OBJDUMP =
+ac_ct_RANLIB = ranlib
+ac_ct_STRIP = strip
+am__fastdepCC_FALSE = #
+am__fastdepCC_TRUE =
+am__fastdepCXX_FALSE = #
+am__fastdepCXX_TRUE =
+am__include = include
+am__leading_dot = .
+am__quote =
+bindir = ${exec_prefix}/bin
+build = i686-pc-linux-gnu
+build_alias =
+build_cpu = i686
+build_os = linux-gnu
+build_vendor = pc
+datadir = ${prefix}/share
+exec_prefix = ${prefix}
+guile_available = /usr/bin/guile
+host = i686-pc-linux-gnu
+host_alias =
+host_cpu = i686
+host_os = linux-gnu
+host_vendor = pc
+includedir = ${prefix}/include
+infodir = ${prefix}/info
+install_sh = /home/grothoff/svn/GNUnet/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localstatedir = ${prefix}/var
+mandir = ${prefix}/man
+mkdir_p = mkdir -p -- .
+oldincludedir = /usr/include
+prefix = /home/grothoff
+program_transform_name = s,x,x,
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+subdirs = libltdl
+sysconfdir = ${prefix}/etc
+target_alias =
+INCLUDES = -I$(top_srcdir)/src/include
+SUBDIRS = .
+noinst_LTLIBRARIES = \
+ libconfig.la
+
+libconfig_la_SOURCES = \
+ config.c
+
+all: all-recursive
+
+.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 \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu
src/util/config/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/util/config/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
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_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
+libconfig.la: $(libconfig_la_OBJECTS) $(libconfig_la_DEPENDENCIES)
+ $(LINK) $(libconfig_la_LDFLAGS) $(libconfig_la_OBJECTS)
$(libconfig_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+include ./$(DEPDIR)/config.Plo
+
+.c.o:
+ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
+# source='$<' object='$@' libtool=no \
+# depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
+# $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c $<
+
+.c.obj:
+ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
`$(CYGPATH_W) '$<'`; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
+# source='$<' object='$@' libtool=no \
+# depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
+# $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
+# source='$<' object='$@' libtool=yes \
+# depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' \
+# $(CCDEPMODE) $(depcomp) \
+# $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags);
\
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS)
ctags); \
+ done
+
+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; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed
"s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || mkdir "$(distdir)/$$subdir" \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="../$(top_distdir)" \
+ distdir="../$(distdir)/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES)
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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:
+ -rm -f $(CONFIG_CLEAN_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-recursive
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ clean-recursive ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-recursive distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am uninstall-info-am
+
+# 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:
Added: GNUnet/src/util/config/Makefile.am
===================================================================
--- GNUnet/src/util/config/Makefile.am 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/config/Makefile.am 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,10 @@
+INCLUDES = -I$(top_srcdir)/src/include
+
+SUBDIRS = .
+
+noinst_LTLIBRARIES = \
+ libconfig.la
+
+libconfig_la_SOURCES = \
+ config.c
+
Added: GNUnet/src/util/config/Makefile.in
===================================================================
--- GNUnet/src/util/config/Makefile.in 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/config/Makefile.in 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,601 @@
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 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.
+
address@hidden@
+
+SOURCES = $(libconfig_la_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+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 = :
+host_triplet = @host@
+subdir = src/util/config
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-2.0.m4 \
+ $(top_srcdir)/m4/guile.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/libgcrypt.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libconfig_la_LIBADD =
+am_libconfig_la_OBJECTS = config.lo
+libconfig_la_OBJECTS = $(am_libconfig_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
address@hidden@DEP_FILES = ./$(DEPDIR)/config.Plo
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libconfig_la_SOURCES)
+DIST_SOURCES = $(libconfig_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONVENIENCE_LTDL_FALSE = @CONVENIENCE_LTDL_FALSE@
+CONVENIENCE_LTDL_TRUE = @CONVENIENCE_LTDL_TRUE@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+CYGWIN_FALSE = @CYGWIN_FALSE@
+CYGWIN_TRUE = @CYGWIN_TRUE@
+DATADIR = @DATADIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+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@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GMSGFMT = @GMSGFMT@
+GNUNETGTK_CFLAGS = @GNUNETGTK_CFLAGS@
+GNUNETGTK_LIBS = @GNUNETGTK_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+GUILE = @GUILE@
+GUILE_CONFIG = @GUILE_CONFIG@
+GUILE_TOOLS = @GUILE_TOOLS@
+HAVE_CURSES_FALSE = @HAVE_CURSES_FALSE@
+HAVE_CURSES_TRUE = @HAVE_CURSES_TRUE@
+HAVE_GTK_FALSE = @HAVE_GTK_FALSE@
+HAVE_GTK_TRUE = @HAVE_GTK_TRUE@
+HAVE_GUILE_FALSE = @HAVE_GUILE_FALSE@
+HAVE_GUILE_TRUE = @HAVE_GUILE_TRUE@
+HAVE_IPV6_FALSE = @HAVE_IPV6_FALSE@
+HAVE_IPV6_TRUE = @HAVE_IPV6_TRUE@
+HAVE_MYSQL_FALSE = @HAVE_MYSQL_FALSE@
+HAVE_MYSQL_TRUE = @HAVE_MYSQL_TRUE@
+HAVE_PDCURSES_FALSE = @HAVE_PDCURSES_FALSE@
+HAVE_PDCURSES_TRUE = @HAVE_PDCURSES_TRUE@
+HAVE_SQLITE_FALSE = @HAVE_SQLITE_FALSE@
+HAVE_SQLITE_TRUE = @HAVE_SQLITE_TRUE@
+HAVE_ZLIB_FALSE = @HAVE_ZLIB_FALSE@
+HAVE_ZLIB_TRUE = @HAVE_ZLIB_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_LTDL_FALSE = @INSTALL_LTDL_FALSE@
+INSTALL_LTDL_TRUE = @INSTALL_LTDL_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+LDFLAGS = @LDFLAGS@
+LIBADD_DL = @LIBADD_DL@
+LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBLTDL = @LIBLTDL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LOCALEDIR = @LOCALEDIR@
+LTDLINCL = @LTDLINCL@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MINGW_FALSE = @MINGW_FALSE@
+MINGW_TRUE = @MINGW_TRUE@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+MSGMERGE = @MSGMERGE@
+MYSQL_CPPFLAGS = @MYSQL_CPPFLAGS@
+MYSQL_LDFLAGS = @MYSQL_LDFLAGS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_FALSE = @SOLARIS_FALSE@
+SOLARIS_TRUE = @SOLARIS_TRUE@
+SQLITE_CPPFLAGS = @SQLITE_CPPFLAGS@
+SQLITE_LDFLAGS = @SQLITE_LDFLAGS@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+XFREEBSD_FALSE = @XFREEBSD_FALSE@
+XFREEBSD_TRUE = @XFREEBSD_TRUE@
+XGETTEXT = @XGETTEXT@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+guile_available = @guile_available@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+subdirs = @subdirs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+INCLUDES = -I$(top_srcdir)/src/include
+SUBDIRS = .
+noinst_LTLIBRARIES = \
+ libconfig.la
+
+libconfig_la_SOURCES = \
+ config.c
+
+all: all-recursive
+
+.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 \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu
src/util/config/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/util/config/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
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_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
+libconfig.la: $(libconfig_la_OBJECTS) $(libconfig_la_DEPENDENCIES)
+ $(LINK) $(libconfig_la_LDFLAGS) $(libconfig_la_OBJECTS)
$(libconfig_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
+
+.c.o:
address@hidden@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
$<; \
address@hidden@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
address@hidden@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no
@AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po'
tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(COMPILE) -c $<
+
+.c.obj:
address@hidden@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
`$(CYGPATH_W) '$<'`; \
address@hidden@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
address@hidden@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no
@AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po'
tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
address@hidden@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
$<; \
address@hidden@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
address@hidden@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes
@AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo'
tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags);
\
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS)
ctags); \
+ done
+
+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; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed
"s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || mkdir "$(distdir)/$$subdir" \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="../$(top_distdir)" \
+ distdir="../$(distdir)/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES)
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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:
+ -rm -f $(CONFIG_CLEAN_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-recursive
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ clean-recursive ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-recursive distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am uninstall-info-am
+
+# 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:
Added: GNUnet/src/util/config/config.c
===================================================================
--- GNUnet/src/util/config/config.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/config/config.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,198 @@
+/*
+ This file is part of GNUnet.
+ (C) 2006 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 src/util/config/config.c
+ * @brief configuration API
+ *
+ * @author Christian Grothoff
+ */
+
+#include "gnunet_util_config_impl.h"
+
+void GC_free(struct GC_Configuration * cfg) {
+ cfg->free(cfg);
+}
+
+/**
+ * Set the context for reporting configuration IO errors
+ * (and errors reported by configuration change notification
+ * callbacks when reading a new configuration).
+ *
+ * Note that for setting options a different context can be
+ * used (since failing to change an option may have to be reported
+ * in a fundamentally different way to the user).
+ *
+ * @parm ectx maybe NULL, in that case errors will no longer
+ * be reported
+ */
+void GC_set_error_context(struct GC_Configuration * cfg,
+ struct GE_Context * ectx) {
+ cfg->set_error_context(cfg, ectx);
+}
+
+/**
+ * Parse a configuration file, add all of the options in the
+ * file to the configuration environment.
+ * @return 0 on success, -1 on error
+ */
+int GC_parse_configuration(struct GC_Configuration * cfg,
+ const char * filename) {
+ return cfg->parse_configuration(cfg, filename);
+}
+
+/**
+ * Test if there are configuration options that were
+ * changed since the last save.
+ * @return 0 if clean, 1 if dirty, -1 on error (i.e. last save failed)
+ */
+int GC_test_dirty(struct GC_Configuration * cfg) {
+ return cfg->test_dirty(cfg);
+}
+
+
+/**
+ * Write configuration file.
+ * @return 0 on success, -1 on error
+ */
+int GC_write_configuration(struct GC_Configuration * cfg,
+ const char * filename) {
+ return cfg->write_configuration(cfg, filename);
+}
+
+/**
+ * Get a configuration value that should be a number.
+ * @param min minimal legal value
+ * @param max maximal legal value
+ * @param def default value (use indicated by return value)
+ * @return 0 on success, -1 on error, 1 for default
+ */
+int GC_get_configuration_value_number(struct GC_Configuration * cfg,
+ const char * section,
+ const char * option,
+ unsigned long long min,
+ unsigned long long max,
+ unsigned long long def,
+ unsigned long long * number) {
+ return cfg->get_configuration_value_number(cfg, section, option, min, max,
def, number);
+}
+
+
+/**
+ * Get a configuration value that should be a string.
+ * @param def default value (use indicated by return value;
+ * will NOT be aliased, maybe NULL)
+ * @param value will be set to a freshly allocated configuration
+ * value, or NULL if option is not specified and no default given
+ * @return 0 on success, -1 on error, 1 for default
+ */
+int GC_get_configuration_value_string(struct GC_Configuration * cfg,
+ const char * section,
+ const char * option,
+ const char * def,
+ char ** value) {
+ return cfg->get_configuration_value_string(cfg, section, option, def, value);
+}
+
+/**
+ * Get a configuration value that should be in a set of
+ * predefined strings
+ * @param choices NULL-terminated list of legal values
+ * @param def default value (use indicated by return value;
+ * will NOT be aliased, maybe NULL), must be reference
+ * into set given by choices
+ * @param value will be set to an entry in the legal list,
+ * or NULL if option is not specified and no default given
+ * @return 0 on success, -1 on error, 1 for default
+ */
+int GC_get_configuration_value_choice(struct GC_Configuration * cfg,
+ const char * section,
+ const char * option,
+ const char ** choices,
+ const char * def,
+ const char ** value) {
+ return cfg->get_configuration_value_choice(cfg, section, option, choices,
def, value);
+}
+
+/**
+ * Set a configuration value that should be a number.
+ * @return 0 on success, -1 on error (i.e. out of memory,
+ * or update refused by registered callback)
+ */
+int GC_set_configuration_value_number(struct GC_Configuration * cfg,
+ struct GE_Context * ectx,
+ const char * section,
+ const char * option,
+ unsigned long long number) {
+ return cfg->set_configuration_value_number(cfg, ectx, section, option,
number);
+}
+
+
+/**
+ * Set a configuration value that should be a string.
+ * @param value
+ * @return 0 on success, -1 on error (i.e. out of memory,
+ * or update refused by registered callback)
+ */
+int GC_set_configuration_value_string(struct GC_Configuration * cfg,
+ struct GE_Context * ectx,
+ const char * section,
+ const char * option,
+ const char * value) {
+ return cfg->set_configuration_value_string(cfg, ectx, section, option,
value);
+}
+
+/**
+ * Set a configuration value that should be in a set of
+ * predefined strings.
+ * @param value
+ * @return 0 on success, -1 on error (i.e. out of memory,
+ * or update refused by registered callback)
+ */
+int GC_set_configuration_value_choice(struct GC_Configuration * cfg,
+ struct GE_Context * ectx,
+ const char * section,
+ const char * option,
+ const char * choice) {
+ return cfg->set_configuration_value_choice(cfg, ectx, section, option,
choice);
+}
+
+/**
+ * Attach a callback that is notified whenever a
+ * configuration option changes.
+ * @return 0 on success, -1 on error
+ */
+int GC_attach_change_listener(struct GC_Configuration * cfg,
+ GC_ChangeListener callback,
+ void * ctx) {
+ return cfg->attach_change_listener(cfg, callback, ctx);
+}
+
+/**
+ * Attach a callback that is notified whenever a
+ * configuration option changes.
+ * @return 0 on success, -1 on error, 1 for no such handler registered
+ */
+int GC_detach_change_listener(struct GC_Configuration * cfg,
+ GC_ChangeListener callback,
+ void * ctx) {
+ return cfg->detach_change_listener(cfg, callback, ctx);
+}
+
Added: GNUnet/src/util/config_impl/.deps/impl.Plo
===================================================================
--- GNUnet/src/util/config_impl/.deps/impl.Plo 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/config_impl/.deps/impl.Plo 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,299 @@
+impl.lo .libs/impl.o: impl.c ../../../src/include/gnunet_config_impl.h \
+ ../../../src/include/gnunet_config.h \
+ ../../../src/include/gnunet_util_error.h \
+ ../../../src/include/gnunet_util.h /usr/include/stdlib.h \
+ /usr/include/features.h /usr/include/sys/cdefs.h \
+ /usr/include/gnu/stubs.h \
+ /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/stddef.h \
+ /usr/include/sys/types.h /usr/include/bits/types.h \
+ /usr/include/bits/wordsize.h /usr/include/bits/typesizes.h \
+ /usr/include/time.h /usr/include/endian.h /usr/include/bits/endian.h \
+ /usr/include/sys/select.h /usr/include/bits/select.h \
+ /usr/include/bits/sigset.h /usr/include/bits/time.h \
+ /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \
+ /usr/include/bits/sched.h /usr/include/alloca.h \
+ ../../../src/include/platform.h ../../../config.h \
+ ../../../src/include/plibc.h /usr/include/pthread.h \
+ /usr/include/sched.h /usr/include/signal.h /usr/include/bits/initspin.h \
+ /usr/include/bits/sigthread.h /usr/include/netdb.h \
+ /usr/include/netinet/in.h /usr/include/stdint.h \
+ /usr/include/bits/wchar.h /usr/include/sys/socket.h \
+ /usr/include/sys/uio.h /usr/include/bits/uio.h \
+ /usr/include/bits/socket.h \
+ /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/limits.h \
+ /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/syslimits.h \
+ /usr/include/limits.h /usr/include/bits/posix1_lim.h \
+ /usr/include/bits/local_lim.h /usr/include/linux/limits.h \
+ /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \
+ /usr/include/asm/socket.h /usr/include/asm/sockios.h \
+ /usr/include/bits/in.h /usr/include/bits/byteswap.h \
+ /usr/include/rpc/netdb.h /usr/include/bits/netdb.h \
+ /usr/include/arpa/inet.h /usr/include/netinet/tcp.h /usr/include/pwd.h \
+ /usr/include/stdio.h /usr/include/sys/ioctl.h \
+ /usr/include/bits/ioctls.h /usr/include/asm/ioctls.h \
+ /usr/include/asm/ioctl.h /usr/include/bits/ioctl-types.h \
+ /usr/include/sys/ttydefaults.h /usr/include/sys/wait.h \
+ /usr/include/bits/signum.h /usr/include/bits/siginfo.h \
+ /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \
+ /usr/include/asm/sigcontext.h /usr/include/linux/compiler.h \
+ /usr/include/bits/sigstack.h /usr/include/sys/resource.h \
+ /usr/include/bits/resource.h /usr/include/bits/waitflags.h \
+ /usr/include/bits/waitstatus.h /usr/include/string.h \
+ /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
+ /usr/include/gconv.h \
+ /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/stdarg.h \
+ /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
+ /usr/include/ltdl.h /usr/include/errno.h /usr/include/bits/errno.h \
+ /usr/include/linux/errno.h /usr/include/asm/errno.h \
+ /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \
+ /usr/include/unistd.h /usr/include/bits/posix_opt.h \
+ /usr/include/bits/confname.h /usr/include/getopt.h \
+ /usr/include/sys/stat.h /usr/include/bits/stat.h /usr/include/dirent.h \
+ /usr/include/bits/dirent.h /usr/include/fcntl.h \
+ /usr/include/bits/fcntl.h /usr/include/math.h \
+ /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h \
+ /usr/include/bits/mathcalls.h /usr/include/sys/param.h \
+ /usr/include/linux/param.h /usr/include/asm/param.h \
+ /usr/include/sys/time.h /usr/include/net/if.h /usr/include/ctype.h \
+ /usr/include/locale.h /usr/include/bits/locale.h \
+ ../../../src/include/gettext.h /usr/include/libintl.h \
+ /usr/include/sys/mman.h /usr/include/bits/mman.h \
+ /usr/include/langinfo.h /usr/include/nl_types.h
+
+../../../src/include/gnunet_config_impl.h:
+
+../../../src/include/gnunet_config.h:
+
+../../../src/include/gnunet_util_error.h:
+
+../../../src/include/gnunet_util.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/features.h:
+
+/usr/include/sys/cdefs.h:
+
+/usr/include/gnu/stubs.h:
+
+/usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/stddef.h:
+
+/usr/include/sys/types.h:
+
+/usr/include/bits/types.h:
+
+/usr/include/bits/wordsize.h:
+
+/usr/include/bits/typesizes.h:
+
+/usr/include/time.h:
+
+/usr/include/endian.h:
+
+/usr/include/bits/endian.h:
+
+/usr/include/sys/select.h:
+
+/usr/include/bits/select.h:
+
+/usr/include/bits/sigset.h:
+
+/usr/include/bits/time.h:
+
+/usr/include/sys/sysmacros.h:
+
+/usr/include/bits/pthreadtypes.h:
+
+/usr/include/bits/sched.h:
+
+/usr/include/alloca.h:
+
+../../../src/include/platform.h:
+
+../../../config.h:
+
+../../../src/include/plibc.h:
+
+/usr/include/pthread.h:
+
+/usr/include/sched.h:
+
+/usr/include/signal.h:
+
+/usr/include/bits/initspin.h:
+
+/usr/include/bits/sigthread.h:
+
+/usr/include/netdb.h:
+
+/usr/include/netinet/in.h:
+
+/usr/include/stdint.h:
+
+/usr/include/bits/wchar.h:
+
+/usr/include/sys/socket.h:
+
+/usr/include/sys/uio.h:
+
+/usr/include/bits/uio.h:
+
+/usr/include/bits/socket.h:
+
+/usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/limits.h:
+
+/usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/syslimits.h:
+
+/usr/include/limits.h:
+
+/usr/include/bits/posix1_lim.h:
+
+/usr/include/bits/local_lim.h:
+
+/usr/include/linux/limits.h:
+
+/usr/include/bits/posix2_lim.h:
+
+/usr/include/bits/sockaddr.h:
+
+/usr/include/asm/socket.h:
+
+/usr/include/asm/sockios.h:
+
+/usr/include/bits/in.h:
+
+/usr/include/bits/byteswap.h:
+
+/usr/include/rpc/netdb.h:
+
+/usr/include/bits/netdb.h:
+
+/usr/include/arpa/inet.h:
+
+/usr/include/netinet/tcp.h:
+
+/usr/include/pwd.h:
+
+/usr/include/stdio.h:
+
+/usr/include/sys/ioctl.h:
+
+/usr/include/bits/ioctls.h:
+
+/usr/include/asm/ioctls.h:
+
+/usr/include/asm/ioctl.h:
+
+/usr/include/bits/ioctl-types.h:
+
+/usr/include/sys/ttydefaults.h:
+
+/usr/include/sys/wait.h:
+
+/usr/include/bits/signum.h:
+
+/usr/include/bits/siginfo.h:
+
+/usr/include/bits/sigaction.h:
+
+/usr/include/bits/sigcontext.h:
+
+/usr/include/asm/sigcontext.h:
+
+/usr/include/linux/compiler.h:
+
+/usr/include/bits/sigstack.h:
+
+/usr/include/sys/resource.h:
+
+/usr/include/bits/resource.h:
+
+/usr/include/bits/waitflags.h:
+
+/usr/include/bits/waitstatus.h:
+
+/usr/include/string.h:
+
+/usr/include/libio.h:
+
+/usr/include/_G_config.h:
+
+/usr/include/wchar.h:
+
+/usr/include/gconv.h:
+
+/usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/stdarg.h:
+
+/usr/include/bits/stdio_lim.h:
+
+/usr/include/bits/sys_errlist.h:
+
+/usr/include/ltdl.h:
+
+/usr/include/errno.h:
+
+/usr/include/bits/errno.h:
+
+/usr/include/linux/errno.h:
+
+/usr/include/asm/errno.h:
+
+/usr/include/asm-generic/errno.h:
+
+/usr/include/asm-generic/errno-base.h:
+
+/usr/include/unistd.h:
+
+/usr/include/bits/posix_opt.h:
+
+/usr/include/bits/confname.h:
+
+/usr/include/getopt.h:
+
+/usr/include/sys/stat.h:
+
+/usr/include/bits/stat.h:
+
+/usr/include/dirent.h:
+
+/usr/include/bits/dirent.h:
+
+/usr/include/fcntl.h:
+
+/usr/include/bits/fcntl.h:
+
+/usr/include/math.h:
+
+/usr/include/bits/huge_val.h:
+
+/usr/include/bits/mathdef.h:
+
+/usr/include/bits/mathcalls.h:
+
+/usr/include/sys/param.h:
+
+/usr/include/linux/param.h:
+
+/usr/include/asm/param.h:
+
+/usr/include/sys/time.h:
+
+/usr/include/net/if.h:
+
+/usr/include/ctype.h:
+
+/usr/include/locale.h:
+
+/usr/include/bits/locale.h:
+
+../../../src/include/gettext.h:
+
+/usr/include/libintl.h:
+
+/usr/include/sys/mman.h:
+
+/usr/include/bits/mman.h:
+
+/usr/include/langinfo.h:
+
+/usr/include/nl_types.h:
Added: GNUnet/src/util/config_impl/.libs/libgnunetconfig.lai
===================================================================
--- GNUnet/src/util/config_impl/.libs/libgnunetconfig.lai 2006-06-15
16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/config_impl/.libs/libgnunetconfig.lai 2006-06-15
16:49:28 UTC (rev 3011)
@@ -0,0 +1,35 @@
+# libgnunetconfig.la - a libtool library file
+# Generated by ltmain.sh - GNU libtool 1.5.6 (1.1220.2.95 2004/04/11 05:50:42)
Debian: 224 $
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='libgnunetconfig.so.0'
+
+# Names of this library.
+library_names='libgnunetconfig.so.0.0.0 libgnunetconfig.so.0
libgnunetconfig.so'
+
+# The name of the static archive.
+old_library=''
+
+# Libraries that this one depends upon.
+dependency_libs=' -L/home/grothoff/lib /home/grothoff/lib/libgnunetutil.la
/usr/lib/libltdl.la /usr/lib/libgcrypt.la /usr/lib/libgpg-error.la
/usr/lib/libgpg-error.la /usr/lib/libgmp.la -ldl -L/home/grothoff//lib -lm
-lnsl -lpthread'
+
+# Version information for libgnunetconfig.
+current=0
+age=0
+revision=0
+
+# Is this an already installed library?
+installed=yes
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=no
+
+# Files to dlopen/dlpreopen
+dlopen=''
+dlpreopen=''
+
+# Directory that this library needs to be installed in:
+libdir='/home/grothoff/lib'
Added: GNUnet/src/util/config_impl/.libs/libgnunetconfig.so
===================================================================
--- GNUnet/src/util/config_impl/.libs/libgnunetconfig.so 2006-06-15
16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/config_impl/.libs/libgnunetconfig.so 2006-06-15
16:49:28 UTC (rev 3011)
@@ -0,0 +1 @@
+link libgnunetconfig.so.0.0.0
\ No newline at end of file
Property changes on: GNUnet/src/util/config_impl/.libs/libgnunetconfig.so
___________________________________________________________________
Name: svn:special
+ *
Added: GNUnet/src/util/config_impl/.libs/libgnunetconfig.so.0
===================================================================
--- GNUnet/src/util/config_impl/.libs/libgnunetconfig.so.0 2006-06-15
16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/config_impl/.libs/libgnunetconfig.so.0 2006-06-15
16:49:28 UTC (rev 3011)
@@ -0,0 +1 @@
+link libgnunetconfig.so.0.0.0
\ No newline at end of file
Property changes on: GNUnet/src/util/config_impl/.libs/libgnunetconfig.so.0
___________________________________________________________________
Name: svn:special
+ *
Added: GNUnet/src/util/config_impl/.libs/libgnunetconfig.so.0.0.0
===================================================================
(Binary files differ)
Property changes on: GNUnet/src/util/config_impl/.libs/libgnunetconfig.so.0.0.0
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: GNUnet/src/util/config_impl/Makefile
===================================================================
--- GNUnet/src/util/config_impl/Makefile 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/config_impl/Makefile 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,630 @@
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# src/util/config_impl/Makefile. Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 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.
+
+
+
+SOURCES = $(libgnunetutil_config_la_SOURCES)
+
+srcdir = .
+top_srcdir = ../../..
+
+pkgdatadir = $(datadir)/GNUnet
+pkglibdir = $(libdir)/GNUnet
+pkgincludedir = $(includedir)/GNUnet
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = /usr/bin/install -c
+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 = :
+host_triplet = i686-pc-linux-gnu
+subdir = src/util/config_impl
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-2.0.m4 \
+ $(top_srcdir)/m4/guile.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/libgcrypt.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(libdir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libgnunetutil_config_la_DEPENDENCIES = \
+ $(top_builddir)/src/util/libgnunetutil.la
+am_libgnunetutil_config_la_OBJECTS = impl.lo
+libgnunetutil_config_la_OBJECTS = \
+ $(am_libgnunetutil_config_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+DEP_FILES = ./$(DEPDIR)/impl.Plo
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libgnunetutil_config_la_SOURCES)
+DIST_SOURCES = $(libgnunetutil_config_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = ${SHELL} /home/grothoff/svn/GNUnet/missing --run aclocal-1.8
+AMDEP_FALSE = #
+AMDEP_TRUE =
+AMTAR = ${SHELL} /home/grothoff/svn/GNUnet/missing --run tar
+AR = ar
+AS = as
+AUTOCONF = ${SHELL} /home/grothoff/svn/GNUnet/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/grothoff/svn/GNUnet/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/grothoff/svn/GNUnet/missing --run automake-1.8
+AWK = gawk
+CC = gcc
+CCDEPMODE = depmode=gcc3
+CFLAGS = -fno-strict-aliasing -Wall -g -Wall
+CONVENIENCE_LTDL_FALSE =
+CONVENIENCE_LTDL_TRUE = #
+CPP = gcc -E
+CPPFLAGS = -I/home/grothoff/include
+CXX = g++
+CXXCPP = g++ -E
+CXXDEPMODE = depmode=gcc3
+CXXFLAGS = -g -O2
+CYGPATH_W = echo
+CYGWIN_FALSE =
+CYGWIN_TRUE = #
+DATADIR = /home/grothoff/share/GNUnet/
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+DLLTOOL = dlltool
+ECHO = echo
+ECHO_C =
+ECHO_N = -n
+ECHO_T =
+EGREP = grep -E
+EXEEXT =
+EXT_LIBS =
+EXT_LIB_PATH = -L/home/grothoff/lib
+F77 =
+FFLAGS =
+GMSGFMT = /usr/bin/msgfmt
+GNUNETGTK_CFLAGS = -DXTHREADS -I/usr/include/libglade-2.0
-I/usr/include/gtk-2.0 -I/usr/include/libxml2 -I/usr/lib/gtk-2.0/include
-I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0
-I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
+GNUNETGTK_LIBS = -lglade-2.0 -lgtk-x11-2.0 -lxml2 -lpthread -lz -lgdk-x11-2.0
-latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0
-lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
+GTK_CFLAGS = -DXTHREADS -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include
-I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0
-I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
+GTK_LIBS = -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm
-lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl
-lglib-2.0
+GUILE = /usr/bin/guile
+GUILE_CONFIG = /usr/bin/guile-config
+GUILE_TOOLS = /usr/bin/guile-tools
+HAVE_CURSES_FALSE = #
+HAVE_CURSES_TRUE =
+HAVE_GTK_FALSE = #
+HAVE_GTK_TRUE =
+HAVE_GUILE_FALSE = #
+HAVE_GUILE_TRUE =
+HAVE_IPV6_FALSE = #
+HAVE_IPV6_TRUE =
+HAVE_MYSQL_FALSE =
+HAVE_MYSQL_TRUE = #
+HAVE_PDCURSES_FALSE =
+HAVE_PDCURSES_TRUE = #
+HAVE_SQLITE_FALSE = #
+HAVE_SQLITE_TRUE =
+HAVE_ZLIB_FALSE = #
+HAVE_ZLIB_TRUE =
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_LTDL_FALSE =
+INSTALL_LTDL_TRUE = #
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
+INTLLIBS =
+LDFLAGS = -L/home/grothoff/lib
+LIBADD_DL = -ldl
+LIBGCRYPT_CFLAGS =
+LIBGCRYPT_CONFIG = /usr/bin/libgcrypt-config
+LIBGCRYPT_LIBS = -lgcrypt -lgpg-error
+LIBICONV = -liconv
+LIBINTL =
+LIBLTDL = -lltdl
+LIBOBJS =
+LIBS = -lm -lnsl -lpthread
+LIBTOOL = $(SHELL) $(top_builddir)/libtool
+LN_S = ln -s
+LOCALEDIR = /home/grothoff/share/locale/
+LTDLINCL =
+LTLIBICONV = -liconv
+LTLIBINTL =
+LTLIBOBJS =
+MAKEINFO = ${SHELL} /home/grothoff/svn/GNUnet/missing --run makeinfo
+MINGW_FALSE =
+MINGW_TRUE = #
+MKINSTALLDIRS = $(top_builddir)/./mkinstalldirs
+MSGFMT = /usr/bin/msgfmt
+MSGMERGE = /usr/bin/msgmerge
+MYSQL_CPPFLAGS =
+MYSQL_LDFLAGS = -L/usr/lib/mysql
+OBJDUMP = objdump
+OBJEXT = o
+PACKAGE = GNUnet
+PACKAGE_BUGREPORT = address@hidden
+PACKAGE_NAME = GNUnet
+PACKAGE_STRING = GNUnet 0.7.0e
+PACKAGE_TARNAME = gnunet
+PACKAGE_VERSION = 0.7.0e
+PATH_SEPARATOR = :
+PKG_CONFIG = /usr/bin/pkg-config
+POSUB = po
+RANLIB = ranlib
+SET_MAKE =
+SHELL = /bin/sh
+SOLARIS_FALSE =
+SOLARIS_TRUE = #
+SQLITE_CPPFLAGS =
+SQLITE_LDFLAGS =
+STRIP = strip
+USE_NLS = yes
+VERSION = 0.7.0e
+XFREEBSD_FALSE =
+XFREEBSD_TRUE = #
+XGETTEXT = /usr/bin/xgettext
+ac_ct_AR = ar
+ac_ct_AS =
+ac_ct_CC = gcc
+ac_ct_CXX = g++
+ac_ct_DLLTOOL =
+ac_ct_F77 =
+ac_ct_OBJDUMP =
+ac_ct_RANLIB = ranlib
+ac_ct_STRIP = strip
+am__fastdepCC_FALSE = #
+am__fastdepCC_TRUE =
+am__fastdepCXX_FALSE = #
+am__fastdepCXX_TRUE =
+am__include = include
+am__leading_dot = .
+am__quote =
+bindir = ${exec_prefix}/bin
+build = i686-pc-linux-gnu
+build_alias =
+build_cpu = i686
+build_os = linux-gnu
+build_vendor = pc
+datadir = ${prefix}/share
+exec_prefix = ${prefix}
+guile_available = /usr/bin/guile
+host = i686-pc-linux-gnu
+host_alias =
+host_cpu = i686
+host_os = linux-gnu
+host_vendor = pc
+includedir = ${prefix}/include
+infodir = ${prefix}/info
+install_sh = /home/grothoff/svn/GNUnet/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localstatedir = ${prefix}/var
+mandir = ${prefix}/man
+mkdir_p = mkdir -p -- .
+oldincludedir = /usr/include
+prefix = /home/grothoff
+program_transform_name = s,x,x,
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+subdirs = libltdl
+sysconfdir = ${prefix}/etc
+target_alias =
+INCLUDES = -I$(top_srcdir)/src/include
+SUBDIRS = .
+lib_LTLIBRARIES = \
+ libgnunetutil_config.la
+
+libgnunetutil_config_la_SOURCES = \
+ impl.c
+
+libgnunetutil_config_la_LIBADD = \
+ $(top_builddir)/src/util/libgnunetutil.la
+
+all: all-recursive
+
+.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 \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu
src/util/config_impl/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/util/config_impl/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
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL)
$(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL)
$(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ 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
+libgnunetutil_config.la: $(libgnunetutil_config_la_OBJECTS)
$(libgnunetutil_config_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libgnunetutil_config_la_LDFLAGS)
$(libgnunetutil_config_la_OBJECTS) $(libgnunetutil_config_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+include ./$(DEPDIR)/impl.Plo
+
+.c.o:
+ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
+# source='$<' object='$@' libtool=no \
+# depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
+# $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c $<
+
+.c.obj:
+ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
`$(CYGPATH_W) '$<'`; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
+# source='$<' object='$@' libtool=no \
+# depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
+# $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
+# source='$<' object='$@' libtool=yes \
+# depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' \
+# $(CCDEPMODE) $(depcomp) \
+# $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags);
\
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS)
ctags); \
+ done
+
+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; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed
"s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || mkdir "$(distdir)/$$subdir" \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="../$(top_distdir)" \
+ distdir="../$(distdir)/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(libdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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:
+ -rm -f $(CONFIG_CLEAN_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-recursive
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libLTLIBRARIES clean-libtool \
+ clean-recursive ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-recursive distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-libLTLIBRARIES install-man \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
+ pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-info-am uninstall-libLTLIBRARIES
+
+# 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:
Added: GNUnet/src/util/config_impl/Makefile.am
===================================================================
--- GNUnet/src/util/config_impl/Makefile.am 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/config_impl/Makefile.am 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,13 @@
+INCLUDES = -I$(top_srcdir)/src/include
+
+SUBDIRS = .
+
+lib_LTLIBRARIES = \
+ libgnunetutil_config.la
+
+libgnunetutil_config_la_SOURCES = \
+ impl.c
+
+libgnunetutil_config_la_LIBADD = \
+ $(top_builddir)/src/util/libgnunetutil.la
+
Added: GNUnet/src/util/config_impl/Makefile.in
===================================================================
--- GNUnet/src/util/config_impl/Makefile.in 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/config_impl/Makefile.in 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,630 @@
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 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.
+
address@hidden@
+
+SOURCES = $(libgnunetutil_config_la_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+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 = :
+host_triplet = @host@
+subdir = src/util/config_impl
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-2.0.m4 \
+ $(top_srcdir)/m4/guile.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/libgcrypt.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(libdir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libgnunetutil_config_la_DEPENDENCIES = \
+ $(top_builddir)/src/util/libgnunetutil.la
+am_libgnunetutil_config_la_OBJECTS = impl.lo
+libgnunetutil_config_la_OBJECTS = \
+ $(am_libgnunetutil_config_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
address@hidden@DEP_FILES = ./$(DEPDIR)/impl.Plo
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libgnunetutil_config_la_SOURCES)
+DIST_SOURCES = $(libgnunetutil_config_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONVENIENCE_LTDL_FALSE = @CONVENIENCE_LTDL_FALSE@
+CONVENIENCE_LTDL_TRUE = @CONVENIENCE_LTDL_TRUE@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+CYGWIN_FALSE = @CYGWIN_FALSE@
+CYGWIN_TRUE = @CYGWIN_TRUE@
+DATADIR = @DATADIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+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@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GMSGFMT = @GMSGFMT@
+GNUNETGTK_CFLAGS = @GNUNETGTK_CFLAGS@
+GNUNETGTK_LIBS = @GNUNETGTK_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+GUILE = @GUILE@
+GUILE_CONFIG = @GUILE_CONFIG@
+GUILE_TOOLS = @GUILE_TOOLS@
+HAVE_CURSES_FALSE = @HAVE_CURSES_FALSE@
+HAVE_CURSES_TRUE = @HAVE_CURSES_TRUE@
+HAVE_GTK_FALSE = @HAVE_GTK_FALSE@
+HAVE_GTK_TRUE = @HAVE_GTK_TRUE@
+HAVE_GUILE_FALSE = @HAVE_GUILE_FALSE@
+HAVE_GUILE_TRUE = @HAVE_GUILE_TRUE@
+HAVE_IPV6_FALSE = @HAVE_IPV6_FALSE@
+HAVE_IPV6_TRUE = @HAVE_IPV6_TRUE@
+HAVE_MYSQL_FALSE = @HAVE_MYSQL_FALSE@
+HAVE_MYSQL_TRUE = @HAVE_MYSQL_TRUE@
+HAVE_PDCURSES_FALSE = @HAVE_PDCURSES_FALSE@
+HAVE_PDCURSES_TRUE = @HAVE_PDCURSES_TRUE@
+HAVE_SQLITE_FALSE = @HAVE_SQLITE_FALSE@
+HAVE_SQLITE_TRUE = @HAVE_SQLITE_TRUE@
+HAVE_ZLIB_FALSE = @HAVE_ZLIB_FALSE@
+HAVE_ZLIB_TRUE = @HAVE_ZLIB_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_LTDL_FALSE = @INSTALL_LTDL_FALSE@
+INSTALL_LTDL_TRUE = @INSTALL_LTDL_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+LDFLAGS = @LDFLAGS@
+LIBADD_DL = @LIBADD_DL@
+LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBLTDL = @LIBLTDL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LOCALEDIR = @LOCALEDIR@
+LTDLINCL = @LTDLINCL@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MINGW_FALSE = @MINGW_FALSE@
+MINGW_TRUE = @MINGW_TRUE@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+MSGMERGE = @MSGMERGE@
+MYSQL_CPPFLAGS = @MYSQL_CPPFLAGS@
+MYSQL_LDFLAGS = @MYSQL_LDFLAGS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_FALSE = @SOLARIS_FALSE@
+SOLARIS_TRUE = @SOLARIS_TRUE@
+SQLITE_CPPFLAGS = @SQLITE_CPPFLAGS@
+SQLITE_LDFLAGS = @SQLITE_LDFLAGS@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+XFREEBSD_FALSE = @XFREEBSD_FALSE@
+XFREEBSD_TRUE = @XFREEBSD_TRUE@
+XGETTEXT = @XGETTEXT@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+guile_available = @guile_available@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+subdirs = @subdirs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+INCLUDES = -I$(top_srcdir)/src/include
+SUBDIRS = .
+lib_LTLIBRARIES = \
+ libgnunetutil_config.la
+
+libgnunetutil_config_la_SOURCES = \
+ impl.c
+
+libgnunetutil_config_la_LIBADD = \
+ $(top_builddir)/src/util/libgnunetutil.la
+
+all: all-recursive
+
+.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 \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu
src/util/config_impl/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/util/config_impl/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
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL)
$(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL)
$(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ 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
+libgnunetutil_config.la: $(libgnunetutil_config_la_OBJECTS)
$(libgnunetutil_config_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libgnunetutil_config_la_LDFLAGS)
$(libgnunetutil_config_la_OBJECTS) $(libgnunetutil_config_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
+
+.c.o:
address@hidden@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
$<; \
address@hidden@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
address@hidden@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no
@AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po'
tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(COMPILE) -c $<
+
+.c.obj:
address@hidden@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
`$(CYGPATH_W) '$<'`; \
address@hidden@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
address@hidden@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no
@AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po'
tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
address@hidden@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
$<; \
address@hidden@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
address@hidden@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes
@AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo'
tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags);
\
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS)
ctags); \
+ done
+
+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; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed
"s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || mkdir "$(distdir)/$$subdir" \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="../$(top_distdir)" \
+ distdir="../$(distdir)/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(libdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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:
+ -rm -f $(CONFIG_CLEAN_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-recursive
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libLTLIBRARIES clean-libtool \
+ clean-recursive ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-recursive distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-libLTLIBRARIES install-man \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
+ pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-info-am uninstall-libLTLIBRARIES
+
+# 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:
Added: GNUnet/src/util/config_impl/configtest.c
===================================================================
--- GNUnet/src/util/config_impl/configtest.c 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/config_impl/configtest.c 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,126 @@
+/**
+ * @file test/configtest.c
+ * @brief Test that the configuration module works.
+ * @author Christian Grothoff
+ */
+
+#include "gnunet_util.h"
+#include "platform.h"
+
+static int testConfig() {
+ char * c;
+ if (NO == testConfigurationString("test",
+ "a",
+ "a")) {
+ printf("[test]-a not mapped to a");
+ return 1;
+ }
+ c = getConfigurationString("test",
+ "b");
+ if (0 != strcmp("b",
+ c)) {
+ printf("[test]-b not mapped to b");
+ return 1;
+ }
+ FREENONNULL(c);
+ if (5 != getConfigurationInt("test",
+ "five")) {
+ printf("[test]-five not mapped to 5");
+ return 1;
+ }
+ FREENONNULL(setConfigurationString("more",
+ "c",
+ "d"));
+ if (NO == testConfigurationString("more",
+ "c",
+ "d")) {
+ printf("[more]-c not re-mapped to d");
+ return 1;
+ }
+ if (42 != getConfigurationInt("more",
+ "five")) {
+ printf("[more]-five not mapped to 42");
+ return 1;
+ }
+ if (NO == testConfigurationString("last",
+ "test",
+ "hello/world")) {
+ printf("string substitution did not work: >>%s<<\n",
+ getConfigurationString("last",
+ "test"));
+ return 1;
+ }
+ if (NO == testConfigurationString("last",
+ "boom",
+ "1 2 3 testing")) {
+ printf("string enclosing with \"'s did not work: >>%s<<\n",
+ getConfigurationString("last",
+ "boom"));
+ return 1;
+ }
+ if (NO == testConfigurationString("last",
+ "trailing",
+ "YES")) {
+ printf("confused with trailing spaces: >>%s<<\n",
+ getConfigurationString("last",
+ "trailing"));
+ }
+ return 0;
+}
+
+/**
+ * Perform option parsing from the command line.
+ */
+static int parseCommandLine(int argc,
+ char * argv[]) {
+ char c;
+
+ while (1) {
+ int option_index = 0;
+ static struct GNoption long_options[] = {
+ { "config", 1, 0, 'c' },
+ { 0,0,0,0 }
+ };
+
+ c = GNgetopt_long(argc,
+ argv,
+ "c:",
+ long_options,
+ &option_index);
+
+ if (c == -1)
+ break; /* No more flags to process */
+
+ switch(c) {
+ case 'c':
+ FREENONNULL(setConfigurationString("FILES",
+ "gnunet.conf",
+ GNoptarg));
+ break;
+ } /* end of parsing commandline */
+ }
+ FREENONNULL(setConfigurationString("GNUNETD",
+ "LOGLEVEL",
+ "NOTHING"));
+ return OK;
+}
+
+int main(int argc, char * argv[]) {
+ int failureCount = 0;
+ char * args[] = {
+ "main",
+ "-c",
+ "testconfig.conf",
+ };
+
+ initUtil(3, args, &parseCommandLine);
+ failureCount += testConfig();
+ doneUtil();
+
+ if (failureCount == 0)
+ return 0;
+ else {
+ printf("\n\n%d TESTS FAILED!\n\n",failureCount);
+ return -1;
+ }
+}
Added: GNUnet/src/util/config_impl/impl.c
===================================================================
--- GNUnet/src/util/config_impl/impl.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/config_impl/impl.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,675 @@
+/*
+ This file is part of GNUnet.
+ (C) 2006 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 src/util/config_impl/impl.c
+ * @brief configuration API implementation
+ * @author Christian Grothoff
+ */
+
+#include "gnunet_config_impl.h"
+#include "gnunet_util.h"
+#include "platform.h"
+
+/**
+ * @brief configuration entry
+ */
+typedef struct GC_Entry {
+
+ /**
+ * key for this entry
+ */
+ char * key;
+
+ /**
+ * current, commited value
+ */
+ char * val;
+
+ /**
+ * non-null during uncommited update
+ */
+ char * dirty_val;
+} GC_Entry;
+
+/**
+ * @brief configuration section
+ */
+typedef struct GC_Section {
+
+ /**
+ * name of the section
+ */
+ char * name;
+
+ /**
+ * number of entries in section
+ */
+ unsigned int size;
+
+ /**
+ * entries in the section
+ */
+ GC_Entry * entries;
+} GC_Section;
+
+/**
+ * @brief GC_ChangeListener and context
+ */
+typedef struct GC_Listener {
+
+ /**
+ * Callback.
+ */
+ GC_ChangeListener listener;
+
+ /**
+ * Context for callback.
+ */
+ void * ctx;
+} GC_Listener;
+
+/**
+ * @brief configuration data
+ */
+typedef struct GC_ConfigurationData {
+
+ /**
+ * Lock to access the data.
+ */
+ Mutex lock;
+
+ /**
+ * Context for logging errors, maybe NULL.
+ */
+ struct GE_Context * ectx;
+
+ /**
+ * Modification indication since last save.
+ * 0 if clean, 1 if dirty, -1 on error (i.e. last save failed)
+ */
+ int dirty;
+
+ /**
+ * How many sections do we have?
+ */
+ unsigned int ssize;
+
+ /**
+ * Array with "ssize" entries.
+ */
+ GC_Section * sections;
+
+ /**
+ * How many listeners do we have?
+ */
+ unsigned int lsize;
+
+ /**
+ * Array with "lsize" entries.
+ */
+ GC_Listener * listeners;
+
+} GC_ConfigurationData;
+
+static void _free(struct GC_Configuration * cfg) {
+ GC_Section * sec;
+ GC_Entry * e;
+ int i;
+ int j;
+
+ for (i=0;i<cfg->data->ssize;i++) {
+ sec = &cfg->data->sections[i];
+ for (j=0;j<sec->size;j++) {
+ e = &sec->entries[j];
+ FREE(e->key);
+ FREE(e->val);
+ GE_ASSERT(cfg->data->ectx,
+ e->dirty_val == NULL);
+ }
+ FREE(sec->name);
+ }
+ GROW(cfg->data->sections,
+ cfg->data->ssize,
+ 0);
+ GE_ASSERT(cfg->data->ectx,
+ cfg->data->listeners == 0);
+ MUTEX_DESTROY(&cfg->data->lock);
+ FREE(cfg->data);
+}
+
+static void _set_error_context(struct GC_Configuration * cfg,
+ struct GE_Context * ectx) {
+ cfg->data->ectx = ectx;
+}
+
+static int
+_parse_configuration(struct GC_Configuration * cfg,
+ const char * filename) {
+ int dirty;
+ char line[256];
+ char tag[64];
+ char value[192];
+ FILE *fp;
+ int nr;
+ int i;
+ int emptyline;
+ int ret;
+ char * section;
+
+ MUTEX_LOCK(&cfg->data->lock);
+ dirty = cfg->data->dirty; /* back up value! */
+ if (NULL == (fp = FOPEN(filename, "r"))) {
+ GE_LOG_STRERROR_FILE(cfg->data->ectx,
+ GE_ERROR | GE_USER | GE_IMMEDIATE | GE_BULK |
GE_REQUEST,
+ "fopen",
+ filename);
+ MUTEX_UNLOCK(&cfg->data->lock);
+ return -1;
+ }
+ ret = 0;
+ section = STRDUP("");
+ memset(line,
+ 0,
+ 256);
+ nr = 0;
+ while (NULL != fgets(line, 255, fp)) {
+ nr++;
+ for (i=0;i<255;i++)
+ if (line[i] == '\t')
+ line[i] = ' ';
+ if (line[0] == '\n' || line[0] == '#' || line[0] == '%' ||
+ line[0] == '\r')
+ continue;
+ emptyline = 1;
+ for (i=0;(i<255 && line[i] != 0);i++)
+ if (line[i] != ' ' && line[i] != '\n' && line[i] != '\r')
+ emptyline = 0;
+ if (emptyline == 1)
+ continue;
+ /* remove tailing whitespace */
+ for (i=strlen(line)-1;(i>=0) && (line[i] == ' ');i--)
+ line[i] = '\0';
+ if (1 == sscanf(line, "@INLINE@ %191[^\n]", value) ) {
+ /* @INLINE@ value */
+ char * expanded = expandFileName(value);
+ if (0 != _parse_configuration(cfg,
+ expanded))
+ ret = -1; /* failed to parse included config */
+ } else if (1 == sscanf(line,
+ "[%99[^]]]",
+ value)) {
+ /* [value] */
+ FREE(section);
+ section = STRDUP(value);
+ } else if (2 == sscanf(line,
+ " %63[^= ] = %191[^\n]",
+ tag,
+ value)) {
+ /* tag = value */
+ /* Strip LF */
+ i = strlen(value) - 1;
+ if (i >= 0 && value[i] == '\r')
+ value[i] = '\0';
+ /* remove quotes */
+ i = 0;
+ if (value[0] == '"') {
+ i = 1;
+ while ( (value[i] != '\0') &&
+ (value[i] != '"') )
+ i++;
+ if (value[i] == '"') {
+ value[i] = '\0';
+ i = 1;
+ } else
+ i = 0;
+ }
+ if (0 != GC_set_configuration_value_string(cfg,
+ cfg->data->ectx,
+ section,
+ tag,
+ &value[i]))
+ ret = -1; /* could not set value */
+ } else {
+ /* parse error */
+ GE_LOG(cfg->data->ectx,
+ GE_ERROR | GE_USER | GE_IMMEDIATE | GE_BULK,
+ _("Syntax error in configuration file `%s' at line %d.\n"),
+ filename, nr);
+ ret = -1;
+ }
+ }
+ if (0 != fclose(fp)) {
+ GE_LOG_STRERROR_FILE(cfg->data->ectx,
+ GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE | GE_BULK
| GE_REQUEST,
+ "fclose",
+ filename);
+ ret = -1;
+ }
+ /* restore dirty flag - anything we set in the meantime
+ came from disk */
+ cfg->data->dirty = dirty;
+ MUTEX_UNLOCK(&cfg->data->lock);
+ FREE(section);
+ return ret;
+}
+
+static int
+_test_dirty(struct GC_Configuration * cfg) {
+ return cfg->data->dirty;
+}
+
+static int
+_write_configuration(struct GC_Configuration * cfg,
+ const char * filename) {
+ GC_ConfigurationData * data;
+ GC_Section * sec;
+ GC_Entry * e;
+ int i;
+ int j;
+ FILE *fp;
+ int error;
+ int ret;
+
+ if (! GC_test_dirty(cfg))
+ return 0; /* success: nothing to do! */
+ if (NULL == (fp = FOPEN(filename, "w")))
+ return -1;
+ data = cfg->data;
+ error = 0;
+ ret = 0;
+ MUTEX_LOCK(&data->lock);
+ for (i=0;i<data->ssize;i++) {
+ sec = &data->sections[i];
+ if (0 > fprintf(fp,
+ "[%s]\n",
+ sec->name)) {
+ error = 1;
+ break;
+ }
+ for (j=0;j<sec->size;j++) {
+ e = &sec->entries[j];
+ GE_ASSERT(data->ectx,
+ e->dirty_val == NULL);
+ if (0 > fprintf(fp,
+ "%s = %s\n",
+ e->key,
+ e->val)) {
+ error = 1;
+ break;
+ }
+ }
+ if (error != 0)
+ break;
+ if (0 > fprintf(fp, "\n")) {
+ error = 1;
+ break;
+ }
+ }
+ if (error != 0)
+ GE_LOG_STRERROR_FILE(data->ectx,
+ GE_ERROR | GE_USER | GE_IMMEDIATE | GE_BULK |
GE_REQUEST,
+ "fprintf",
+ filename);
+ if (0 != fclose(fp)) {
+ GE_LOG_STRERROR_FILE(data->ectx,
+ GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE | GE_BULK
| GE_REQUEST,
+ "fclose",
+ filename);
+ error = 1;
+ }
+ if (error == 0) {
+ ret = 0;
+ data->dirty = 0; /* last write succeeded */
+ } else {
+ ret = -1;
+ data->dirty = -1; /* last write failed */
+ }
+ MUTEX_UNLOCK(&data->lock);
+ return ret;
+}
+
+/**
+ * Call only with lock held!
+ */
+static GC_Section *
+findSection(GC_ConfigurationData * data,
+ const char * section) {
+ int i;
+ for (i=data->ssize-1;i>=0;i--)
+ if (0 == strcmp(section,
+ data->sections[i].name))
+ return &data->sections[i];
+ return NULL;
+}
+
+/**
+ * Call only with lock held!
+ */
+static GC_Entry *
+findEntry(GC_ConfigurationData * data,
+ const char * section,
+ const char * key) {
+ int i;
+ GC_Section * sec;
+
+ sec = findSection(data, section);
+ if (sec == NULL)
+ return NULL;
+ for (i=sec->size-1;i>=0;i--)
+ if (0 == strcmp(key,
+ sec->entries[i].key))
+ return &sec->entries[i];
+ return NULL;
+}
+
+static int
+_get_configuration_value_number(struct GC_Configuration * cfg,
+ const char * section,
+ const char * option,
+ unsigned long long min,
+ unsigned long long max,
+ unsigned long long def,
+ unsigned long long * number) {
+ GC_Entry * e;
+ const char * val;
+ int ret;
+
+ MUTEX_LOCK(&cfg->data->lock);
+ e = findEntry(cfg->data,
+ section,
+ option);
+ if (e != NULL) {
+ val = (e->dirty_val != NULL) ? e->dirty_val : e->val;
+ if (1 == sscanf(val,
+ "%llu",
+ number)) {
+ if ( (*number >= min) &&
+ (*number <= max) ) {
+ ret = 0;
+ } else {
+ GE_LOG(cfg->data->ectx,
+ GE_ERROR | GE_USER | GE_BULK,
+ _("Configuration value '%llu' for '%s' "
+ "in section '%s' is out of legal bounds [%llu,%llu]\n"),
+ *number,
+ option,
+ section,
+ min,
+ max);
+ ret = -1; /* error */
+ }
+ } else {
+ GE_LOG(cfg->data->ectx,
+ GE_ERROR | GE_USER | GE_BULK,
+ _("Configuration value '%s' for '%s'"
+ " in section '%s' should be a number\n"),
+ val,
+ option,
+ section,
+ min,
+ max);
+ ret = -1; /* error */
+ }
+ } else {
+ *number = def;
+ ret = 1; /* default */
+ }
+ MUTEX_UNLOCK(&cfg->data->lock);
+ return ret;
+}
+
+static int
+_get_configuration_value_string(struct GC_Configuration * cfg,
+ const char * section,
+ const char * option,
+ const char * def,
+ char ** value) {
+ GC_Entry * e;
+ const char * val;
+ int ret;
+
+ MUTEX_LOCK(&cfg->data->lock);
+ e = findEntry(cfg->data,
+ section,
+ option);
+ if (e != NULL) {
+ val = (e->dirty_val != NULL) ? e->dirty_val : e->val;
+ *value = STRDUP(val);
+ } else {
+ *value = STRDUP(def);
+ ret = 1; /* default */
+ }
+ MUTEX_UNLOCK(&cfg->data->lock);
+ return ret;
+}
+
+static int
+_get_configuration_value_choice(struct GC_Configuration * cfg,
+ const char * section,
+ const char * option,
+ const char ** choices,
+ const char * def,
+ const char ** value) {
+ GC_Entry * e;
+ const char * val;
+ int i;
+ int ret;
+
+ MUTEX_LOCK(&cfg->data->lock);
+ e = findEntry(cfg->data,
+ section,
+ option);
+ if (e != NULL) {
+ val = (e->dirty_val != NULL) ? e->dirty_val : e->val;
+ i = 0;
+ while (choices[i] != NULL) {
+ if (0 == strcasecmp(choices[i],
+ val))
+ break;
+ i++;
+ }
+ if (choices[i] == NULL) {
+ GE_LOG(cfg->data->ectx,
+ GE_ERROR | GE_USER | GE_BULK,
+ _("Configuration value '%s' for '%s'"
+ " in section '%s' is not in set of legal choices\n"),
+ val,
+ option,
+ section);
+ ret = -1; /* error */
+ } else {
+ *value = choices[i];
+ ret = 0;
+ }
+ } else {
+ *value = def;
+ ret = 1; /* default */
+ }
+ MUTEX_UNLOCK(&cfg->data->lock);
+ return ret;
+}
+
+static int
+_set_configuration_value_string(struct GC_Configuration * cfg,
+ struct GE_Context * ectx,
+ const char * section,
+ const char * option,
+ const char * value) {
+ GC_ConfigurationData * data;
+ GC_Section * sec;
+ GC_Section nsec;
+ GC_Entry * e;
+ GC_Entry ne;
+ int ret;
+ int i;
+
+ data = cfg->data;
+ MUTEX_LOCK(&data->lock);
+ e = findEntry(data, section, option);
+ if (e == NULL) {
+ sec = findSection(data, section);
+ if (sec == NULL) {
+ nsec.name = STRDUP(section);
+ nsec.size = 0;
+ nsec.entries = NULL;
+ APPEND(data->sections,
+ data->ssize,
+ nsec);
+ sec = findSection(data, section);
+ }
+ ne.key = STRDUP(option);
+ ne.val = NULL;
+ ne.dirty_val = NULL;
+ APPEND(sec->entries,
+ sec->size,
+ ne);
+ e = findEntry(data, section, option);
+ }
+ if (e->dirty_val != NULL) {
+ /* recursive update, not allowed! */
+ GE_BREAK(ectx, 0);
+ ret = -1;
+ } else {
+ e->dirty_val = STRDUP(value);
+ i = data->lsize - 1;
+ while (i > 0) {
+ if (0 != data->listeners[i].listener(data->listeners[i].ctx,
+ cfg,
+ ectx,
+ section,
+ option))
+ break; /* update refused */
+ i--;
+ }
+ if (i != 0) {
+ /* update refused, revert! */
+ FREE(e->dirty_val);
+ e->dirty_val = NULL;
+ i++; /* the callback that refused does not need refreshing */
+ while (i < data->lsize) {
+ if (0 != data->listeners[i].listener(data->listeners[i].ctx,
+ cfg,
+ ectx,
+ section,
+ option))
+ GE_ASSERT(ectx, 0); /* refused the refusal!? */
+ i++;
+ }
+ ret = -1; /* error -- update refused */
+ } else {
+ /* all confirmed, commit! */
+ e->val = e->dirty_val;
+ e->dirty_val = NULL;
+ ret = 0;
+ }
+ }
+ MUTEX_UNLOCK(&data->lock);
+ return ret;
+}
+
+static int
+_set_configuration_value_number(struct GC_Configuration * cfg,
+ struct GE_Context * ectx,
+ const char * section,
+ const char * option,
+ unsigned long long number) {
+ char s[64];
+ SNPRINTF(s, 64, "%llu", number);
+ return _set_configuration_value_string(cfg, ectx, section, option, s);
+}
+
+static int
+_set_configuration_value_choice(struct GC_Configuration * cfg,
+ struct GE_Context * ectx,
+ const char * section,
+ const char * option,
+ const char * choice) {
+ return _set_configuration_value_string(cfg, ectx, section, option, choice);
+}
+
+static int
+_attach_change_listener(struct GC_Configuration * cfg,
+ GC_ChangeListener callback,
+ void * ctx) {
+ GC_Listener l;
+
+ MUTEX_LOCK(&cfg->data->lock);
+ l.listener = callback;
+ l.ctx = ctx;
+ APPEND(cfg->data->listeners,
+ cfg->data->lsize,
+ l);
+ MUTEX_UNLOCK(&cfg->data->lock);
+ return -1;
+}
+
+static int
+_detach_change_listener(struct GC_Configuration * cfg,
+ GC_ChangeListener callback,
+ void * ctx) {
+ int i;
+ GC_Listener * l;
+
+ MUTEX_LOCK(&cfg->data->lock);
+ for (i=cfg->data->lsize-1;i>=0;i--) {
+ l = &cfg->data->listeners[i];
+ if ( (l->listener == callback) &&
+ (l->ctx == ctx) ) {
+ cfg->data->listeners[i]
+ = cfg->data->listeners[cfg->data->lsize];
+ GROW(cfg->data->listeners,
+ cfg->data->lsize,
+ cfg->data->lsize-1);
+ MUTEX_UNLOCK(&cfg->data->lock);
+ return 0;
+ }
+ }
+ MUTEX_UNLOCK(&cfg->data->lock);
+ return -1;
+}
+
+/**
+ * Create a GC_Configuration (C implementation).
+ */
+GC_Configuration *
+GC_create_C_impl() {
+ GC_Configuration * ret;
+
+ ret = MALLOC(sizeof(GC_Configuration));
+ ret->data = MALLOC(sizeof(GC_ConfigurationData));
+ memset(ret->data, 0, sizeof(GC_ConfigurationData));
+ MUTEX_CREATE_RECURSIVE(&ret->data->lock);
+ ret->free = &_free;
+ ret->set_error_context = &_set_error_context;
+ ret->parse_configuration = &_parse_configuration;
+ ret->test_dirty = &_test_dirty;
+ ret->write_configuration = &_write_configuration;
+ ret->get_configuration_value_number = &_get_configuration_value_number;
+ ret->get_configuration_value_string = &_get_configuration_value_string;
+ ret->get_configuration_value_choice = &_get_configuration_value_choice;
+ ret->set_configuration_value_number = &_set_configuration_value_number;
+ ret->set_configuration_value_string = &_set_configuration_value_string;
+ ret->set_configuration_value_choice = &_set_configuration_value_choice;
+ ret->attach_change_listener = &_attach_change_listener;
+ ret->detach_change_listener = &_detach_change_listener;
+ return ret;
+}
+
Deleted: GNUnet/src/util/configtest.c
===================================================================
--- GNUnet/src/util/configtest.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/configtest.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,126 +0,0 @@
-/**
- * @file test/configtest.c
- * @brief Test that the configuration module works.
- * @author Christian Grothoff
- */
-
-#include "gnunet_util.h"
-#include "platform.h"
-
-static int testConfig() {
- char * c;
- if (NO == testConfigurationString("test",
- "a",
- "a")) {
- printf("[test]-a not mapped to a");
- return 1;
- }
- c = getConfigurationString("test",
- "b");
- if (0 != strcmp("b",
- c)) {
- printf("[test]-b not mapped to b");
- return 1;
- }
- FREENONNULL(c);
- if (5 != getConfigurationInt("test",
- "five")) {
- printf("[test]-five not mapped to 5");
- return 1;
- }
- FREENONNULL(setConfigurationString("more",
- "c",
- "d"));
- if (NO == testConfigurationString("more",
- "c",
- "d")) {
- printf("[more]-c not re-mapped to d");
- return 1;
- }
- if (42 != getConfigurationInt("more",
- "five")) {
- printf("[more]-five not mapped to 42");
- return 1;
- }
- if (NO == testConfigurationString("last",
- "test",
- "hello/world")) {
- printf("string substitution did not work: >>%s<<\n",
- getConfigurationString("last",
- "test"));
- return 1;
- }
- if (NO == testConfigurationString("last",
- "boom",
- "1 2 3 testing")) {
- printf("string enclosing with \"'s did not work: >>%s<<\n",
- getConfigurationString("last",
- "boom"));
- return 1;
- }
- if (NO == testConfigurationString("last",
- "trailing",
- "YES")) {
- printf("confused with trailing spaces: >>%s<<\n",
- getConfigurationString("last",
- "trailing"));
- }
- return 0;
-}
-
-/**
- * Perform option parsing from the command line.
- */
-static int parseCommandLine(int argc,
- char * argv[]) {
- char c;
-
- while (1) {
- int option_index = 0;
- static struct GNoption long_options[] = {
- { "config", 1, 0, 'c' },
- { 0,0,0,0 }
- };
-
- c = GNgetopt_long(argc,
- argv,
- "c:",
- long_options,
- &option_index);
-
- if (c == -1)
- break; /* No more flags to process */
-
- switch(c) {
- case 'c':
- FREENONNULL(setConfigurationString("FILES",
- "gnunet.conf",
- GNoptarg));
- break;
- } /* end of parsing commandline */
- }
- FREENONNULL(setConfigurationString("GNUNETD",
- "LOGLEVEL",
- "NOTHING"));
- return OK;
-}
-
-int main(int argc, char * argv[]) {
- int failureCount = 0;
- char * args[] = {
- "main",
- "-c",
- "testconfig.conf",
- };
-
- initUtil(3, args, &parseCommandLine);
- failureCount += testConfig();
- doneUtil();
-
- if (failureCount == 0)
- return 0;
- else {
- printf("\n\n%d TESTS FAILED!\n\n",failureCount);
- return -1;
- }
-}
Deleted: GNUnet/src/util/configuration.c
===================================================================
--- GNUnet/src/util/configuration.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/configuration.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,945 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2001, 2002, 2003, 2004, 2005 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 util/configuration.c
- * @brief high-level configuration managment (with command-line overrides)
- * @author Christian Grothoff
- * @author Gerd Knorr <address@hidden>
- *
- * Configuration file parsing, taken from xawtv (GPL).
- *
- * This file provides code to parse a configuration file and access
- * the data stored in it. It also provides methods to override options
- * which can be used to add command-line options to the configuration
- * API.
- */
-
-#include "gnunet_util.h"
-#include "platform.h"
-
-struct CFG_ENTRIES {
- unsigned int ent_count;
- char **ent_names;
- char **ent_values;
-};
-
-struct CFG_SECTIONS {
- unsigned int sec_count;
- char **sec_names;
- struct CFG_ENTRIES **sec_entries;
-};
-
-static struct CFG_SECTIONS * c = NULL;
-
-#define ALLOC_SIZE 16
-
-
-static struct CFG_SECTIONS * cfg_init_sections(void) {
- struct CFG_SECTIONS *c;
- c = MALLOC(sizeof(struct CFG_SECTIONS));
- memset(c,
- 0,
- sizeof(struct CFG_SECTIONS));
- c->sec_names = MALLOC(ALLOC_SIZE*sizeof(char*));
- c->sec_entries = MALLOC(ALLOC_SIZE*sizeof(struct CFG_ENTRIES*));
- return c;
-}
-
-static struct CFG_ENTRIES * cfg_init_entries() {
- struct CFG_ENTRIES *e;
- e = MALLOC(sizeof(struct CFG_ENTRIES));
- memset(e,
- 0,
- sizeof(struct CFG_ENTRIES));
- e->ent_names = MALLOC(ALLOC_SIZE*sizeof(char*));
- e->ent_values = MALLOC(ALLOC_SIZE*sizeof(char*));
- return e;
-}
-
-static struct CFG_ENTRIES * cfg_find_section(struct CFG_SECTIONS *c,
- const char * name) {
- struct CFG_ENTRIES * e;
- unsigned int i;
-
- for (i=0; i<c->sec_count; i++)
- if (0 == strcasecmp(c->sec_names[i], name))
- return c->sec_entries[i];
-
- /* 404 not found => create a new one */
- if ((c->sec_count % ALLOC_SIZE) == (ALLOC_SIZE-1)) {
- i = c->sec_count+1;
- GROW(c->sec_names,
- i,
- i+ALLOC_SIZE);
- i = c->sec_count+1;
- GROW(c->sec_entries,
- i,
- i+ALLOC_SIZE);
- }
- e = cfg_init_entries();
- c->sec_names[c->sec_count] = STRDUP(name);
- c->sec_entries[c->sec_count] = e;
- c->sec_count++;
- return e;
-}
-
-static void cfg_set_entry(struct CFG_ENTRIES * e,
- const char * name,
- const char * value) {
- unsigned int i;
-
- for (i=0; i<e->ent_count; i++)
- if (0 == strcasecmp(e->ent_names[i],
- name))
- break;
- if (i == e->ent_count) {
- /* 404 not found => create a new one */
- if ((e->ent_count % ALLOC_SIZE) == (ALLOC_SIZE-1)) {
- /* not enough space, grow first */
- i = e->ent_count+1;
- GROW(e->ent_names,
- i,
- i+ALLOC_SIZE);
- i = e->ent_count+1;
- GROW(e->ent_values,
- i,
- i+ALLOC_SIZE);
- }
- i = e->ent_count;
- e->ent_count++;
- } else {
- /* free old values, will be replaced! */
- FREENONNULL(e->ent_names[i]);
- FREENONNULL(e->ent_values[i]);
- }
- e->ent_names[i] = STRDUP(name);
- if (value && *value)
- e->ent_values[i] = STRDUP(value);
- else
- e->ent_values[i] = NULL;
-}
-
-static int cfg_parse_file(const char *filename) {
- struct CFG_ENTRIES * e = NULL;
- char line[256];
- char tag[64];
- char value[192];
- FILE *fp;
- int nr;
- int i;
- int emptyline;
-
- if (NULL == c)
- c = cfg_init_sections();
- if (NULL == (fp = FOPEN(filename,"r")))
- return -1;
-
- memset(line,
- 0,
- 256);
-
- nr = 0;
- while (NULL != fgets(line,255,fp)) {
- nr++;
- for (i=0;i<255;i++) {
- if (line[i] == '\t')
- line[i] = ' ';
- }
- emptyline=1;
- for (i=0;(i<255 && line[i] != 0);i++) {
- if (line[i] != ' ' && line[i] != '\n' && line[i] != '\r')
- emptyline=0;
- }
- if (emptyline == 1)
- continue;
- if (line[0] == '\n' || line[0] == '#' || line[0] == '%' ||
- line[0] == '\r')
- continue;
- for (i=strlen(line)-2 ;
- (i>=0) && (line[i] == ' ' || line[i] == '\t' ) ;
- i--)
- line[i] = 0;
- if (1 == sscanf(line, "@INLINE@ %191[^\n]", value) ) {
- char * expanded = expandFileName(value);
- LOG(LOG_DEBUG,
- _("inlining configration file `%s'\n"),
- expanded);
- if (cfg_parse_file(expanded) != 0)
- LOG(LOG_WARNING,
- _("Could not parse configuration file `%s'.\n"),
- value);
- } else if (1 == sscanf(line,"[%99[^]]]", value)) {
- /* [section] */
- e = cfg_find_section(c,value);
- } else if (2 == sscanf(line," %63[^= ] = %191[^\n]",tag,value)) {
- /* foo = bar */
- if (NULL == e) /* no section defined so far: put in "global" section
(change by CG) */
- e = cfg_find_section(c, "");
- i=0;
- if (value[0] == '"') {
- i=1;
- while ( (value[i] != '\0') &&
- (value[i] != '"') )
- i++;
- if (value[i] == '"') {
- value[i] = '\0';
- i=1;
- } else
- i=0;
- }
-#ifdef MINGW
- {
- int i2;
-
- /* Strip LF */
- i2 = strlen(value) - 1;
- if (i2 >= 0 && value[i2] == '\r')
- value[i2] = 0;
- }
-#endif
- cfg_set_entry(e, tag, &value[i]);
-
- } else {
- /* Huh ? */
- LOG(LOG_ERROR,
- _("Syntax error in configuration file `%s' at line %d.\n"),
- filename, nr);
- }
- }
- fclose(fp);
- return 0;
-}
-
-/* ------------------------------------------------------------------------ */
-
-static char * cfg_get_str(const char * sec,
- const char * ent) {
- struct CFG_ENTRIES * e = NULL;
- int i;
-
- if (c)
- for (i = 0; i < c->sec_count; i++)
- if (0 == strcasecmp(c->sec_names[i],sec))
- e = c->sec_entries[i];
- if (NULL == e)
- return NULL;
- for (i = 0; i < e->ent_count; i++)
- if (0 == strcasecmp(e->ent_names[i],ent)) {
- return e->ent_values[i];
- }
- return NULL;
-}
-
-/**
- * @brief Checks if a setting exists
- * @return YES or NO
- */
-static int cfg_exists(const char *sec,
- const char *ent)
-{
- struct CFG_ENTRIES *e = NULL;
- int i;
-
- if(c)
- for(i = 0; i < c->sec_count; i++)
- if(0 == strcasecmp(c->sec_names[i], sec))
- e = c->sec_entries[i];
-
- if(NULL == e)
- return NO;
-
- for(i = 0; i < e->ent_count; i++)
- if(0 == strcasecmp(e->ent_names[i], ent))
- return YES;
-
- return NO;
-}
-
-static int cfg_get_signed_int(const char *sec,
- const char *ent) {
- char *val;
-
- val = cfg_get_str(sec, ent);
- if (NULL == val)
- return 0;
- return atoi(val);
-}
-
-static void doneParseConfig() {
- int i;
- int j;
-
- if (c == NULL)
- return;
- for (i=0;i<c->sec_count;i++) {
- if (c->sec_entries[i] != NULL) {
- for (j=0;j<c->sec_entries[i]->ent_count;j++) {
- FREENONNULL(c->sec_entries[i]->ent_names[j]);
- FREENONNULL(c->sec_entries[i]->ent_values[j]);
- }
- FREENONNULL(c->sec_entries[i]->ent_names);
- FREENONNULL(c->sec_entries[i]->ent_values);
- }
- FREENONNULL(c->sec_entries[i]);
- FREENONNULL(c->sec_names[i]);
- }
- FREENONNULL(c->sec_entries);
- FREENONNULL(c->sec_names);
- FREENONNULL(c);
- c = NULL;
-}
-
-
-
-/**
- * Type for user-defined configuration entries.
- */
-typedef struct UserConfStruct {
- char * section;
- char * option;
- char * stringValue;
- unsigned int intValue;
- struct UserConfStruct * next;
-} UserConf;
-
-/**
- * GNUnet configuration (OpenSSL datastructure)
- */
-static int parseConfigInit = NO;
-
-/**
- * The filename of the config (for re-reading!)
- */
-static char * configuration_filename = NULL;
-
-/**
- * Lock to access configuration (we may receive an
- * update signal at any time!)
- */
-static Mutex configLock;
-
-/**
- * List of run-time options (not in the configuration
- * file, but for example from the command line).
- */
-static UserConf * userconfig = NULL;
-
-/**
- * The command line strings (rest)
- */
-static char ** values;
-static int valuesCount;
-
-/**
- * Expand an expression of the form
- * "$FOO/BAR" to "DIRECTORY/BAR" where
- * either in the current section or
- * globally FOO is set to DIRECTORY.
- */
-char * expandDollar(const char * section,
- char * orig) {
- int i;
- char * prefix;
- char * result;
-
- i=0;
- while ( (orig[i] != '/') &&
- (orig[i] != '\\') &&
- (orig[i] != '\0') )
- i++;
- if (orig[i] == '\0')
- return orig;
- orig[i] = '\0';
- prefix = getConfigurationString(section,
- &orig[1]);
- if (prefix == NULL)
- prefix = getConfigurationString("GNUNETD", &orig[1]);
- if (prefix == NULL)
- prefix = getConfigurationString("GNUNET", &orig[1]);
- if (prefix == NULL)
- prefix = getConfigurationString("", &orig[1]);
- if (prefix == NULL) {
- const char * env = getenv(&orig[1]);
- if (env != NULL)
- prefix = STRDUP(env);
- }
- if (prefix == NULL) {
- orig[i] = DIR_SEPARATOR;
- return orig;
- }
- result = MALLOC(strlen(prefix) +
- strlen(&orig[i+1]) + 2);
- strcpy(result, prefix);
- strcat(result, DIR_SEPARATOR_STR);
- strcat(result, &orig[i+1]);
- FREE(prefix);
- FREE(orig);
- return result;
-}
-
-/**
- * Obtain a filename from the given section and option. If the
- * filename is not specified, die with the given error message (do not
- * die if errMsg == NULL).
- *
- * @param section from which section, may not be NULL
- * @param option which option, may not be NULL
- *
- * @param errMsg the errormessage, should contain two %s tokens for
- * the section and the option.
- *
- * @return the specified filename (caller must free), or NULL if no
- * filename was specified and errMsg == NULL
- */
-char * getFileName(const char * section,
- const char * option,
- const char * errMsg) {
- char * fn;
- char * fnExpand;
-
- fn = getConfigurationString(section,
- option);
- if (fn == NULL) {
- if (errMsg == NULL)
- return NULL;
- else
- errexit(errMsg,
- section,
- option);
- }
- fnExpand = expandFileName(fn);
- FREE(fn);
- return fnExpand;
-}
-
-/**
- * @brief Read a specific configuration file. The previous configuration
- * will NOT be discarded if this method is invoked twice.
- * @param fn the file to read
- * @return YES on success, NO otherwise
- */
-int readConfigFile(const char *fn) {
- if (0 != cfg_parse_file(fn))
- return NO;
-
- parseConfigInit = YES;
-
- setConfigurationString("Meta", "DATADIR", DATADIR);
-
- return YES;
-}
-
-/**
- * Read the configuration file. The previous configuration will be
- * discarded if this method is invoked twice.
- */
-void readConfiguration() {
- /* getFileName aquires the mutex, so we better do this first */
- char * cfgName;
- char * expCfgName;
- char * eName = NULL;
-
- cfgName = getConfigurationString("FILES",
- "gnunet.conf");
- if (cfgName == NULL) {
- if (testConfigurationString("GNUNETD",
- "_MAGIC_",
- "YES")) {
- eName = expandFileName(HOME_DAEMON_CONFIG_FILE);
- expCfgName = getenv("GNUNETD_CONFIG");
- if (expCfgName == NULL) {
- /* pick default, but try to pick it so
- that we can write there (if it does not
- exist) */
- expCfgName = DEFAULT_DAEMON_CONFIG_FILE;
- if (ACCESS(expCfgName, R_OK)) {
- expCfgName = VAR_DAEMON_CONFIG_FILE;
- if (ACCESS(expCfgName, R_OK)) {
- expCfgName = eName;
- if (ACCESS(expCfgName, R_OK)) {
- if (0 == ACCESS(DEFAULT_DAEMON_CONFIG_FILE, W_OK))
- expCfgName = DEFAULT_DAEMON_CONFIG_FILE;
- if (0 == ACCESS(VAR_DAEMON_CONFIG_FILE, W_OK))
- expCfgName = VAR_DAEMON_CONFIG_FILE;
- if (0 == ACCESS(eName, W_OK))
- expCfgName = eName;
- }
- }
- }
- }
- } else {
- eName = expandFileName(DEFAULT_CLIENT_CONFIG_FILE);
- expCfgName = getenv("GNUNET_CONFIG");
- if (expCfgName == NULL)
- expCfgName = eName;
- }
- expCfgName = expandFileName(expCfgName);
- setConfigurationString("FILES",
- "gnunet.conf",
- expCfgName);
- } else {
- expCfgName = expandFileName(cfgName);
- }
- FREENONNULL(eName);
- if (0 == assertIsFile(expCfgName)) {
- char * c;
- int p;
-
- /* create directory (~/.gnunet/) */
- c = STRDUP(expCfgName);
- p = strlen(c);
- while ( (p > 0) && (c[p] != '/') )
- p--;
- c[p] = '\0';
- mkdirp(c);
- FREE(c);
- /* try generating a configuration file */
- LOG(LOG_WARNING,
- _("Configuration file `%s' not found. Run gnunet-setup!\n"),
- expCfgName);
- if (! testConfigurationString("GNUNETD",
- "_MAGIC_",
- "YES"))
-#ifdef WINDOWS
- MessageBox(0, _("Configuration file not found. Please run GNUnet Setup "
- "(Client Configuration) first."), _("Error"), MB_ICONSTOP | MB_OK);
-#else
- errexit(_("Configuration file `%s' not found. Run gnunet-setup!\n"),
- expCfgName);
-#endif
- else
- errexit(_("Configuration file `%s' not found. Run `gnunet-setup
-d'!\n"),
- expCfgName);
- }
- if (0 == assertIsFile(expCfgName))
- errexit(_("Cannot open configuration file `%s'.\n"),
- expCfgName);
- FREENONNULL(cfgName);
-
- FREENONNULL(setConfigurationString("FILES",
- "gnunet.conf",
- expCfgName));
- MUTEX_LOCK(&configLock);
- FREENONNULL(configuration_filename);
- configuration_filename = expCfgName;
-
- if (parseConfigInit == YES) {
- doneParseConfig();
- parseConfigInit = NO;
- }
- if (!readConfigFile(configuration_filename))
- errexit("Failed to parse configuration file `%s'.\n",
- configuration_filename);
-
- MUTEX_UNLOCK(&configLock);
-}
-
-static NotifyConfigurationUpdateCallback * cbl = NULL;
-static unsigned int cbCnt = 0;
-
-/**
- * Register a callback that is called when the configuration
- * changes. The API guarantees that the call is made either
- * as a cron-job or while cron is suspended, so it is safe
- * to edit (delete) cron jobs in the callback.
- */
-void registerConfigurationUpdateCallback(NotifyConfigurationUpdateCallback cb)
{
- MUTEX_LOCK(&configLock);
- GROW(cbl,
- cbCnt,
- cbCnt+1);
- cbl[cbCnt-1] = cb;
- MUTEX_UNLOCK(&configLock);
-}
-
-void unregisterConfigurationUpdateCallback(NotifyConfigurationUpdateCallback
cb) {
- int i;
-
- MUTEX_LOCK(&configLock);
- for (i=0;i<cbCnt;i++)
- if (cbl[i] == cb)
- break;
- GNUNET_ASSERT(i<cbCnt);
- cbl[i] = cbl[cbCnt-1];
- GROW(cbl,
- cbCnt,
- cbCnt-1);
- MUTEX_UNLOCK(&configLock);
-}
-
-static void triggerConfigRefreshHelper(void * arg) {
- int i;
- MUTEX_LOCK(&configLock);
- for (i=0;i<cbCnt;i++)
- cbl[i]();
- MUTEX_UNLOCK(&configLock);
-}
-
-void triggerGlobalConfigurationRefresh() {
- /* guarantee (!) that this is ALWAYS done
- inside of a cron-job! */
- addCronJob(&triggerConfigRefreshHelper,
- 0, 0, NULL);
-}
-
-/**
- * This method must be called first! It reads
- * the config file and makes everything else
- * possible.
- */
-void initConfiguration() {
- MUTEX_CREATE_RECURSIVE(&configLock);
-}
-
-/**
- * This method may be called at last to clean up.
- * Afterwards everything but initConfiguration will result
- * in errors...
- */
-void doneConfiguration() {
- parseConfigInit = NO;
- doneParseConfig();
- FREENONNULL(configuration_filename);
- configuration_filename = NULL;
- MUTEX_DESTROY(&configLock);
- while (userconfig != NULL) {
- UserConf * tmp = userconfig;
- userconfig = userconfig->next;
- FREENONNULL(tmp->section);
- FREENONNULL(tmp->option);
- FREENONNULL(tmp->stringValue);
- FREE(tmp);
- }
-}
-
-
-/**
- * Obtain a string from the configuration.
- * @param section from which section, may not be NULL
- * @param option which option, may not be NULL
- * @return a freshly allocated string, caller must free!
- * Note that the result can be NULL if the option is not set.
- */
-char * getConfigurationString(const char * section,
- const char * option) {
- UserConf * pos;
- char * retval;
-
- GNUNET_ASSERT( (section != NULL) && (option != NULL) );
- MUTEX_LOCK(&configLock);
- pos = userconfig;
- while (pos != NULL) {
- if ( (strcmp(section, pos->section) == 0) &&
- (strcmp(option, pos->option) == 0) ) {
- if (pos->stringValue != NULL)
- retval = STRDUP(pos->stringValue);
- else
- retval = NULL;
- MUTEX_UNLOCK(&configLock);
- if (retval != NULL)
- if (retval[0] == '$') {
- retval = expandDollar(section,
- retval);
- }
- return retval;
- }
- pos = pos->next;
- }
- retval = NULL;
- if (parseConfigInit == YES)
- retval = cfg_get_str(section, option);
- if (retval != NULL)
- retval = STRDUP(retval);
- MUTEX_UNLOCK(&configLock);
- if (retval != NULL)
- if (retval[0] == '$')
- retval = expandDollar(section, retval);
- return retval;
-}
-
-/**
- * @brief Check if a setting was specified in a .conf file
- * @return YES or NO
- */
-int isConfigurationItemSet(const char *section, const char *option)
-{
- UserConf *pos;
- int found = NO;
-
- GNUNET_ASSERT((section != NULL) && (option != NULL));
- MUTEX_LOCK(&configLock);
- pos = userconfig;
- while(pos != NULL) {
- if((strcmp(section, pos->section) == 0) &&
- (strcmp(option, pos->option) == 0)) {
- found = YES;
- break;
- }
- pos = pos->next;
- }
-
- if (! found && parseConfigInit == YES)
- found = cfg_exists(section, option);
-
- MUTEX_UNLOCK(&configLock);
-
- return found;
-}
-
-/**
- * Check if a string in the configuration matches a given value. This
- * method should be preferred over getConfigurationString since this
- * method can avoid making a copy of the configuration string that
- * then must be freed by the caller.
- *
- * @param section from which section, may not be NULL
- * @param option which option, may not be NULL
- * @param value the value to compare against
- * @return YES or NO
- */
-int testConfigurationString(const char * section,
- const char * option,
- const char * value) {
- char * c;
-
- GNUNET_ASSERT( (section != NULL) && (option != NULL) );
- c = getConfigurationString(section, option);
- if (c == NULL) {
- if (value == NULL)
- return YES;
- else
- return NO;
- } else {
- int ret;
- if (value == NULL) {
- FREE(c);
- return NO;
- }
- if (0 == strcmp(c, value))
- ret = YES;
- else
- ret = NO;
- FREE(c);
- return ret;
- }
-}
-
-/**
- * Obtain an int from the configuration.
- *
- * @param section from which section, may not be NULL
- * @param option which option, may not be NULL
- * @return 0 if no option is specified
- */
-unsigned int getConfigurationInt(const char * section,
- const char * option) {
- UserConf * pos;
- unsigned int retval;
-
- GNUNET_ASSERT( (section != NULL) && (option != NULL) );
- MUTEX_LOCK(&configLock);
- pos = userconfig;
- while (pos != NULL) {
- if ( (strcmp(section, pos->section) == 0) &&
- (strcmp(option, pos->option) == 0) ) {
- retval = pos->intValue;
- MUTEX_UNLOCK(&configLock);
- return retval;
- }
- pos = pos->next;
- }
- retval = 0;
- if (parseConfigInit == YES)
- retval = cfg_get_signed_int(section, option);
- MUTEX_UNLOCK(&configLock);
- return retval;
-}
-
-/**
- * Set an option.
- * @param section from which section, may not be NULL
- * @param option which option, may not be NULL
- * @param value the value to use, may be NULL
- * @return the previous value (or NULL if none),
- * caller must free!
- */
-char * setConfigurationString(const char * section,
- const char * option,
- const char * value) {
- UserConf * pos;
- UserConf * prev;
- char * res;
-
- GNUNET_ASSERT( (section != NULL) && (option != NULL) );
- MUTEX_LOCK(&configLock);
- prev = NULL;
- pos = userconfig;
- while (pos != NULL) {
- if ( (strcmp(section, pos->section) == 0) &&
- (strcmp(option, pos->option) == 0) ) {
- res = pos->stringValue;
- if (value != NULL)
- pos->stringValue = STRDUP(value);
- else
- pos->stringValue = NULL;
- MUTEX_UNLOCK(&configLock);
- return res;
- }
- prev = pos;
- pos = pos->next;
- }
- if (prev == NULL) {
- userconfig = MALLOC(sizeof(UserConf));
- pos = userconfig;
- } else {
- prev->next = MALLOC(sizeof(UserConf));
- pos = prev->next;
- }
- pos->section = STRDUP(section);
- pos->option = STRDUP(option);
- if (value != NULL)
- pos->stringValue = STRDUP(value);
- else
- pos->stringValue = NULL;
- pos->intValue = 0;
- pos->next = NULL;
- res = NULL;
- if (parseConfigInit == YES) {
- res = cfg_get_str(section, option);
- if (res != NULL)
- res = STRDUP(res);
- }
- MUTEX_UNLOCK(&configLock);
- return res;
-}
-
-/**
- * Set an option.
- * @param section from which section, may not be NULL
- * @param option which option, may not be NULL
- * @param value the value to use
- * @return the previous value (or 0 if none)
- */
-unsigned int setConfigurationInt(const char * section,
- const char * option,
- const unsigned int value) {
- UserConf * pos;
- UserConf * prev;
- unsigned int res;
-
- GNUNET_ASSERT( (section != NULL) && (option != NULL) );
- MUTEX_LOCK(&configLock);
- prev = NULL;
- pos = userconfig;
- while (pos != NULL) {
- if ( (strcmp(section, pos->section) == 0) &&
- (strcmp(option, pos->option) == 0) ) {
- res = pos->intValue;
- pos->intValue = value;
- MUTEX_UNLOCK(&configLock);
- return res;
- }
- prev = pos;
- pos = pos->next;
- }
- if (prev == NULL) {
- userconfig = MALLOC(sizeof(UserConf));
- pos = userconfig;
- } else {
- prev->next = MALLOC(sizeof(UserConf));
- pos = prev->next;
- }
- pos->section = STRDUP(section);
- pos->option = STRDUP(option);
- pos->stringValue = NULL;
- pos->intValue = value;
- pos->next = NULL;
- res = 0;
- if (parseConfigInit == YES)
- res = cfg_get_signed_int(section, option);
- MUTEX_UNLOCK(&configLock);
- return res;
-}
-
-/**
- * Get the command line strings (the ones remaining after getopt-style
- * parsing).
- *
- * @param value the values
- + @return the number of values
- */
-int getConfigurationStringList(char *** value) {
- char ** cpy;
- int i;
-
- cpy = MALLOC(sizeof(char*) * valuesCount);
- for (i=0;i<valuesCount;i++)
- cpy[i] = STRDUP(values[i]);
- *value = cpy;
- return valuesCount;
-}
-
-/**
- * Set the list of command line options (remainder after getopt style
- * parsing).
- *
- * @param value the values
- + @param count the number of values
- */
-void setConfigurationStringList(char ** value,
- int count) {
- values = value;
- valuesCount = count;
-}
-
-/**
- * Get the IP address of the given host.
- * @return OK on success, SYSERR on error
- */
-int GN_getHostByName(const char * hostname,
- IPaddr * ip) {
- struct hostent * he;
-
- /* slight hack: re-use config lock */
- MUTEX_LOCK(&configLock);
- he = GETHOSTBYNAME(hostname);
- if (he == NULL) {
- LOG(LOG_ERROR,
- _("Could not find IP of host `%s': %s\n"),
- hostname,
- hstrerror(h_errno));
- MUTEX_UNLOCK(&configLock);
- return SYSERR;
- }
- if (he->h_addrtype != AF_INET) {
- BREAK();
- MUTEX_UNLOCK(&configLock);
- return SYSERR;
- }
- memcpy(ip,
- &((struct in_addr*)he->h_addr_list[0])->s_addr,
- sizeof(struct in_addr));
- MUTEX_UNLOCK(&configLock);
- return OK;
-}
-
-
-
-/* end of configuration.c */
Added: GNUnet/src/util/containers/.deps/bloomfilter.Plo
===================================================================
--- GNUnet/src/util/containers/.deps/bloomfilter.Plo 2006-06-15 16:42:32 UTC
(rev 3010)
+++ GNUnet/src/util/containers/.deps/bloomfilter.Plo 2006-06-15 16:49:28 UTC
(rev 3011)
@@ -0,0 +1 @@
+# dummy
Added: GNUnet/src/util/containers/.deps/bloomtest.Po
===================================================================
--- GNUnet/src/util/containers/.deps/bloomtest.Po 2006-06-15 16:42:32 UTC
(rev 3010)
+++ GNUnet/src/util/containers/.deps/bloomtest.Po 2006-06-15 16:49:28 UTC
(rev 3011)
@@ -0,0 +1 @@
+# dummy
Added: GNUnet/src/util/containers/.deps/hashtable.Plo
===================================================================
--- GNUnet/src/util/containers/.deps/hashtable.Plo 2006-06-15 16:42:32 UTC
(rev 3010)
+++ GNUnet/src/util/containers/.deps/hashtable.Plo 2006-06-15 16:49:28 UTC
(rev 3011)
@@ -0,0 +1 @@
+# dummy
Added: GNUnet/src/util/containers/.deps/hashtabletest.Po
===================================================================
--- GNUnet/src/util/containers/.deps/hashtabletest.Po 2006-06-15 16:42:32 UTC
(rev 3010)
+++ GNUnet/src/util/containers/.deps/hashtabletest.Po 2006-06-15 16:49:28 UTC
(rev 3011)
@@ -0,0 +1 @@
+# dummy
Added: GNUnet/src/util/containers/.deps/vector.Plo
===================================================================
--- GNUnet/src/util/containers/.deps/vector.Plo 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/containers/.deps/vector.Plo 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1 @@
+# dummy
Added: GNUnet/src/util/containers/.deps/vectortest.Po
===================================================================
--- GNUnet/src/util/containers/.deps/vectortest.Po 2006-06-15 16:42:32 UTC
(rev 3010)
+++ GNUnet/src/util/containers/.deps/vectortest.Po 2006-06-15 16:49:28 UTC
(rev 3011)
@@ -0,0 +1 @@
+# dummy
Added: GNUnet/src/util/containers/Makefile
===================================================================
--- GNUnet/src/util/containers/Makefile 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/containers/Makefile 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,776 @@
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# src/util/containers/Makefile. Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 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.
+
+
+
+SOURCES = $(libgnunetutil_containers_la_SOURCES) $(bloomtest_SOURCES)
$(hashtabletest_SOURCES) $(vectortest_SOURCES)
+
+srcdir = .
+top_srcdir = ../../..
+
+pkgdatadir = $(datadir)/GNUnet
+pkglibdir = $(libdir)/GNUnet
+pkgincludedir = $(includedir)/GNUnet
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = /usr/bin/install -c
+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 = :
+host_triplet = i686-pc-linux-gnu
+check_PROGRAMS = bloomtest$(EXEEXT) hashtabletest$(EXEEXT) \
+ vectortest$(EXEEXT)
+subdir = src/util/containers
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-2.0.m4 \
+ $(top_srcdir)/m4/guile.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/libgcrypt.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(libdir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libgnunetutil_containers_la_DEPENDENCIES = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+am_libgnunetutil_containers_la_OBJECTS = bloomfilter.lo hashtable.lo \
+ vector.lo
+libgnunetutil_containers_la_OBJECTS = \
+ $(am_libgnunetutil_containers_la_OBJECTS)
+am_bloomtest_OBJECTS = bloomtest.$(OBJEXT)
+bloomtest_OBJECTS = $(am_bloomtest_OBJECTS)
+bloomtest_DEPENDENCIES = $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_containers.la
+am_hashtabletest_OBJECTS = hashtabletest.$(OBJEXT)
+hashtabletest_OBJECTS = $(am_hashtabletest_OBJECTS)
+hashtabletest_DEPENDENCIES = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_containers.la
+am_vectortest_OBJECTS = vectortest.$(OBJEXT)
+vectortest_OBJECTS = $(am_vectortest_OBJECTS)
+vectortest_DEPENDENCIES = $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_containers.la
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+DEP_FILES = ./$(DEPDIR)/bloomfilter.Plo \
+ ./$(DEPDIR)/bloomtest.Po ./$(DEPDIR)/hashtable.Plo \
+ ./$(DEPDIR)/hashtabletest.Po \
+ ./$(DEPDIR)/vector.Plo ./$(DEPDIR)/vectortest.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libgnunetutil_containers_la_SOURCES) $(bloomtest_SOURCES) \
+ $(hashtabletest_SOURCES) $(vectortest_SOURCES)
+DIST_SOURCES = $(libgnunetutil_containers_la_SOURCES) \
+ $(bloomtest_SOURCES) $(hashtabletest_SOURCES) \
+ $(vectortest_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = ${SHELL} /home/grothoff/svn/GNUnet/missing --run aclocal-1.8
+AMDEP_FALSE = #
+AMDEP_TRUE =
+AMTAR = ${SHELL} /home/grothoff/svn/GNUnet/missing --run tar
+AR = ar
+AS = as
+AUTOCONF = ${SHELL} /home/grothoff/svn/GNUnet/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/grothoff/svn/GNUnet/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/grothoff/svn/GNUnet/missing --run automake-1.8
+AWK = gawk
+CC = gcc
+CCDEPMODE = depmode=gcc3
+CFLAGS = -fno-strict-aliasing -Wall -g -Wall
+CONVENIENCE_LTDL_FALSE =
+CONVENIENCE_LTDL_TRUE = #
+CPP = gcc -E
+CPPFLAGS = -I/home/grothoff/include
+CXX = g++
+CXXCPP = g++ -E
+CXXDEPMODE = depmode=gcc3
+CXXFLAGS = -g -O2
+CYGPATH_W = echo
+CYGWIN_FALSE =
+CYGWIN_TRUE = #
+DATADIR = /home/grothoff/share/GNUnet/
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+DLLTOOL = dlltool
+ECHO = echo
+ECHO_C =
+ECHO_N = -n
+ECHO_T =
+EGREP = grep -E
+EXEEXT =
+EXT_LIBS =
+EXT_LIB_PATH = -L/home/grothoff/lib
+F77 =
+FFLAGS =
+GMSGFMT = /usr/bin/msgfmt
+GNUNETGTK_CFLAGS = -DXTHREADS -I/usr/include/libglade-2.0
-I/usr/include/gtk-2.0 -I/usr/include/libxml2 -I/usr/lib/gtk-2.0/include
-I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0
-I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
+GNUNETGTK_LIBS = -lglade-2.0 -lgtk-x11-2.0 -lxml2 -lpthread -lz -lgdk-x11-2.0
-latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0
-lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
+GTK_CFLAGS = -DXTHREADS -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include
-I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0
-I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
+GTK_LIBS = -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm
-lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl
-lglib-2.0
+GUILE = /usr/bin/guile
+GUILE_CONFIG = /usr/bin/guile-config
+GUILE_TOOLS = /usr/bin/guile-tools
+HAVE_CURSES_FALSE = #
+HAVE_CURSES_TRUE =
+HAVE_GTK_FALSE = #
+HAVE_GTK_TRUE =
+HAVE_GUILE_FALSE = #
+HAVE_GUILE_TRUE =
+HAVE_IPV6_FALSE = #
+HAVE_IPV6_TRUE =
+HAVE_MYSQL_FALSE =
+HAVE_MYSQL_TRUE = #
+HAVE_PDCURSES_FALSE =
+HAVE_PDCURSES_TRUE = #
+HAVE_SQLITE_FALSE = #
+HAVE_SQLITE_TRUE =
+HAVE_ZLIB_FALSE = #
+HAVE_ZLIB_TRUE =
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_LTDL_FALSE =
+INSTALL_LTDL_TRUE = #
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
+INTLLIBS =
+LDFLAGS = -L/home/grothoff/lib
+LIBADD_DL = -ldl
+LIBGCRYPT_CFLAGS =
+LIBGCRYPT_CONFIG = /usr/bin/libgcrypt-config
+LIBGCRYPT_LIBS = -lgcrypt -lgpg-error
+LIBICONV = -liconv
+LIBINTL =
+LIBLTDL = -lltdl
+LIBOBJS =
+LIBS = -lm -lnsl -lpthread
+LIBTOOL = $(SHELL) $(top_builddir)/libtool
+LN_S = ln -s
+LOCALEDIR = /home/grothoff/share/locale/
+LTDLINCL =
+LTLIBICONV = -liconv
+LTLIBINTL =
+LTLIBOBJS =
+MAKEINFO = ${SHELL} /home/grothoff/svn/GNUnet/missing --run makeinfo
+MINGW_FALSE =
+MINGW_TRUE = #
+MKINSTALLDIRS = $(top_builddir)/./mkinstalldirs
+MSGFMT = /usr/bin/msgfmt
+MSGMERGE = /usr/bin/msgmerge
+MYSQL_CPPFLAGS =
+MYSQL_LDFLAGS = -L/usr/lib/mysql
+OBJDUMP = objdump
+OBJEXT = o
+PACKAGE = GNUnet
+PACKAGE_BUGREPORT = address@hidden
+PACKAGE_NAME = GNUnet
+PACKAGE_STRING = GNUnet 0.7.0e
+PACKAGE_TARNAME = gnunet
+PACKAGE_VERSION = 0.7.0e
+PATH_SEPARATOR = :
+PKG_CONFIG = /usr/bin/pkg-config
+POSUB = po
+RANLIB = ranlib
+SET_MAKE =
+SHELL = /bin/sh
+SOLARIS_FALSE =
+SOLARIS_TRUE = #
+SQLITE_CPPFLAGS =
+SQLITE_LDFLAGS =
+STRIP = strip
+USE_NLS = yes
+VERSION = 0.7.0e
+XFREEBSD_FALSE =
+XFREEBSD_TRUE = #
+XGETTEXT = /usr/bin/xgettext
+ac_ct_AR = ar
+ac_ct_AS =
+ac_ct_CC = gcc
+ac_ct_CXX = g++
+ac_ct_DLLTOOL =
+ac_ct_F77 =
+ac_ct_OBJDUMP =
+ac_ct_RANLIB = ranlib
+ac_ct_STRIP = strip
+am__fastdepCC_FALSE = #
+am__fastdepCC_TRUE =
+am__fastdepCXX_FALSE = #
+am__fastdepCXX_TRUE =
+am__include = include
+am__leading_dot = .
+am__quote =
+bindir = ${exec_prefix}/bin
+build = i686-pc-linux-gnu
+build_alias =
+build_cpu = i686
+build_os = linux-gnu
+build_vendor = pc
+datadir = ${prefix}/share
+exec_prefix = ${prefix}
+guile_available = /usr/bin/guile
+host = i686-pc-linux-gnu
+host_alias =
+host_cpu = i686
+host_os = linux-gnu
+host_vendor = pc
+includedir = ${prefix}/include
+infodir = ${prefix}/info
+install_sh = /home/grothoff/svn/GNUnet/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localstatedir = ${prefix}/var
+mandir = ${prefix}/man
+mkdir_p = mkdir -p -- .
+oldincludedir = /usr/include
+prefix = /home/grothoff
+program_transform_name = s,x,x,
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+subdirs = libltdl
+sysconfdir = ${prefix}/etc
+target_alias =
+SUBDIRS = .
+INCLUDES = -I$(top_srcdir)/src/include
+lib_LTLIBRARIES = libgnunetutil_containers.la
+libgnunetutil_containers_la_LIBADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+libgnunetutil_containers_la_LDFLAGS = \
+ -version-info 0:0:0
+
+libgnunetutil_containers_la_SOURCES = \
+ bloomfilter.c \
+ hashtable.c \
+ vector.c
+
+TESTS = $(check_PROGRAMS)
+bloomtest_SOURCES = \
+ bloomtest.c
+
+bloomtest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_containers.la
+
+hashtabletest_SOURCES = \
+ hashtabletest.c
+
+hashtabletest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_containers.la
+
+vectortest_SOURCES = \
+ vectortest.c
+
+vectortest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_containers.la
+
+all: all-recursive
+
+.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 \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu
src/util/containers/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/util/containers/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
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL)
$(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL)
$(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ 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
+libgnunetutil_containers.la: $(libgnunetutil_containers_la_OBJECTS)
$(libgnunetutil_containers_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libgnunetutil_containers_la_LDFLAGS)
$(libgnunetutil_containers_la_OBJECTS) $(libgnunetutil_containers_la_LIBADD)
$(LIBS)
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+bloomtest$(EXEEXT): $(bloomtest_OBJECTS) $(bloomtest_DEPENDENCIES)
+ @rm -f bloomtest$(EXEEXT)
+ $(LINK) $(bloomtest_LDFLAGS) $(bloomtest_OBJECTS) $(bloomtest_LDADD)
$(LIBS)
+hashtabletest$(EXEEXT): $(hashtabletest_OBJECTS) $(hashtabletest_DEPENDENCIES)
+ @rm -f hashtabletest$(EXEEXT)
+ $(LINK) $(hashtabletest_LDFLAGS) $(hashtabletest_OBJECTS)
$(hashtabletest_LDADD) $(LIBS)
+vectortest$(EXEEXT): $(vectortest_OBJECTS) $(vectortest_DEPENDENCIES)
+ @rm -f vectortest$(EXEEXT)
+ $(LINK) $(vectortest_LDFLAGS) $(vectortest_OBJECTS) $(vectortest_LDADD)
$(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+include ./$(DEPDIR)/bloomfilter.Plo
+include ./$(DEPDIR)/bloomtest.Po
+include ./$(DEPDIR)/hashtable.Plo
+include ./$(DEPDIR)/hashtabletest.Po
+include ./$(DEPDIR)/vector.Plo
+include ./$(DEPDIR)/vectortest.Po
+
+.c.o:
+ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
+# source='$<' object='$@' libtool=no \
+# depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
+# $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c $<
+
+.c.obj:
+ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
`$(CYGPATH_W) '$<'`; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
+# source='$<' object='$@' libtool=no \
+# depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
+# $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
+# source='$<' object='$@' libtool=yes \
+# depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' \
+# $(CCDEPMODE) $(depcomp) \
+# $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags);
\
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS)
ctags); \
+ done
+
+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; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && 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)'; \
+ 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`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *" $$tst "*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ 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 \
+ banner="$$failed of $$all tests did not behave as expected
($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ 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`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed
"s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || mkdir "$(distdir)/$$subdir" \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="../$(top_distdir)" \
+ distdir="../$(distdir)/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(libdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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:
+ -rm -f $(CONFIG_CLEAN_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-recursive
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \
+ clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-TESTS \
+ check-am clean clean-checkPROGRAMS clean-generic \
+ clean-libLTLIBRARIES clean-libtool clean-recursive ctags \
+ ctags-recursive distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-recursive distclean-tags distdir \
+ dvi dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-libLTLIBRARIES \
+ install-man install-strip installcheck installcheck-am \
+ installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am uninstall-info-am \
+ uninstall-libLTLIBRARIES
+
+# 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:
Added: GNUnet/src/util/containers/Makefile.am
===================================================================
--- GNUnet/src/util/containers/Makefile.am 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/containers/Makefile.am 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,43 @@
+SUBDIRS = .
+
+INCLUDES = -I$(top_srcdir)/src/include
+
+lib_LTLIBRARIES = libgnunetutil_containers.la
+
+libgnunetutil_containers_la_LIBADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+libgnunetutil_containers_la_LDFLAGS = \
+ -version-info 0:0:0
+
+libgnunetutil_containers_la_SOURCES = \
+ bloomfilter.c \
+ hashtable.c \
+ vector.c
+
+check_PROGRAMS = \
+ bloomtest \
+ hashtabletest \
+ vectortest
+
+TESTS = $(check_PROGRAMS)
+
+bloomtest_SOURCES = \
+ bloomtest.c
+bloomtest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_containers.la
+
+hashtabletest_SOURCES = \
+ hashtabletest.c
+hashtabletest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_containers.la
+
+vectortest_SOURCES = \
+ vectortest.c
+vectortest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_containers.la
+
Added: GNUnet/src/util/containers/Makefile.in
===================================================================
--- GNUnet/src/util/containers/Makefile.in 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/containers/Makefile.in 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,776 @@
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 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.
+
address@hidden@
+
+SOURCES = $(libgnunetutil_containers_la_SOURCES) $(bloomtest_SOURCES)
$(hashtabletest_SOURCES) $(vectortest_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+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 = :
+host_triplet = @host@
+check_PROGRAMS = bloomtest$(EXEEXT) hashtabletest$(EXEEXT) \
+ vectortest$(EXEEXT)
+subdir = src/util/containers
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-2.0.m4 \
+ $(top_srcdir)/m4/guile.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/libgcrypt.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(libdir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libgnunetutil_containers_la_DEPENDENCIES = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+am_libgnunetutil_containers_la_OBJECTS = bloomfilter.lo hashtable.lo \
+ vector.lo
+libgnunetutil_containers_la_OBJECTS = \
+ $(am_libgnunetutil_containers_la_OBJECTS)
+am_bloomtest_OBJECTS = bloomtest.$(OBJEXT)
+bloomtest_OBJECTS = $(am_bloomtest_OBJECTS)
+bloomtest_DEPENDENCIES = $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_containers.la
+am_hashtabletest_OBJECTS = hashtabletest.$(OBJEXT)
+hashtabletest_OBJECTS = $(am_hashtabletest_OBJECTS)
+hashtabletest_DEPENDENCIES = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_containers.la
+am_vectortest_OBJECTS = vectortest.$(OBJEXT)
+vectortest_OBJECTS = $(am_vectortest_OBJECTS)
+vectortest_DEPENDENCIES = $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_containers.la
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
address@hidden@DEP_FILES = ./$(DEPDIR)/bloomfilter.Plo \
address@hidden@ ./$(DEPDIR)/bloomtest.Po ./$(DEPDIR)/hashtable.Plo \
address@hidden@ ./$(DEPDIR)/hashtabletest.Po \
address@hidden@ ./$(DEPDIR)/vector.Plo ./$(DEPDIR)/vectortest.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libgnunetutil_containers_la_SOURCES) $(bloomtest_SOURCES) \
+ $(hashtabletest_SOURCES) $(vectortest_SOURCES)
+DIST_SOURCES = $(libgnunetutil_containers_la_SOURCES) \
+ $(bloomtest_SOURCES) $(hashtabletest_SOURCES) \
+ $(vectortest_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONVENIENCE_LTDL_FALSE = @CONVENIENCE_LTDL_FALSE@
+CONVENIENCE_LTDL_TRUE = @CONVENIENCE_LTDL_TRUE@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+CYGWIN_FALSE = @CYGWIN_FALSE@
+CYGWIN_TRUE = @CYGWIN_TRUE@
+DATADIR = @DATADIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+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@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GMSGFMT = @GMSGFMT@
+GNUNETGTK_CFLAGS = @GNUNETGTK_CFLAGS@
+GNUNETGTK_LIBS = @GNUNETGTK_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+GUILE = @GUILE@
+GUILE_CONFIG = @GUILE_CONFIG@
+GUILE_TOOLS = @GUILE_TOOLS@
+HAVE_CURSES_FALSE = @HAVE_CURSES_FALSE@
+HAVE_CURSES_TRUE = @HAVE_CURSES_TRUE@
+HAVE_GTK_FALSE = @HAVE_GTK_FALSE@
+HAVE_GTK_TRUE = @HAVE_GTK_TRUE@
+HAVE_GUILE_FALSE = @HAVE_GUILE_FALSE@
+HAVE_GUILE_TRUE = @HAVE_GUILE_TRUE@
+HAVE_IPV6_FALSE = @HAVE_IPV6_FALSE@
+HAVE_IPV6_TRUE = @HAVE_IPV6_TRUE@
+HAVE_MYSQL_FALSE = @HAVE_MYSQL_FALSE@
+HAVE_MYSQL_TRUE = @HAVE_MYSQL_TRUE@
+HAVE_PDCURSES_FALSE = @HAVE_PDCURSES_FALSE@
+HAVE_PDCURSES_TRUE = @HAVE_PDCURSES_TRUE@
+HAVE_SQLITE_FALSE = @HAVE_SQLITE_FALSE@
+HAVE_SQLITE_TRUE = @HAVE_SQLITE_TRUE@
+HAVE_ZLIB_FALSE = @HAVE_ZLIB_FALSE@
+HAVE_ZLIB_TRUE = @HAVE_ZLIB_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_LTDL_FALSE = @INSTALL_LTDL_FALSE@
+INSTALL_LTDL_TRUE = @INSTALL_LTDL_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+LDFLAGS = @LDFLAGS@
+LIBADD_DL = @LIBADD_DL@
+LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBLTDL = @LIBLTDL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LOCALEDIR = @LOCALEDIR@
+LTDLINCL = @LTDLINCL@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MINGW_FALSE = @MINGW_FALSE@
+MINGW_TRUE = @MINGW_TRUE@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+MSGMERGE = @MSGMERGE@
+MYSQL_CPPFLAGS = @MYSQL_CPPFLAGS@
+MYSQL_LDFLAGS = @MYSQL_LDFLAGS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_FALSE = @SOLARIS_FALSE@
+SOLARIS_TRUE = @SOLARIS_TRUE@
+SQLITE_CPPFLAGS = @SQLITE_CPPFLAGS@
+SQLITE_LDFLAGS = @SQLITE_LDFLAGS@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+XFREEBSD_FALSE = @XFREEBSD_FALSE@
+XFREEBSD_TRUE = @XFREEBSD_TRUE@
+XGETTEXT = @XGETTEXT@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+guile_available = @guile_available@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+subdirs = @subdirs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+SUBDIRS = .
+INCLUDES = -I$(top_srcdir)/src/include
+lib_LTLIBRARIES = libgnunetutil_containers.la
+libgnunetutil_containers_la_LIBADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+libgnunetutil_containers_la_LDFLAGS = \
+ -version-info 0:0:0
+
+libgnunetutil_containers_la_SOURCES = \
+ bloomfilter.c \
+ hashtable.c \
+ vector.c
+
+TESTS = $(check_PROGRAMS)
+bloomtest_SOURCES = \
+ bloomtest.c
+
+bloomtest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_containers.la
+
+hashtabletest_SOURCES = \
+ hashtabletest.c
+
+hashtabletest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_containers.la
+
+vectortest_SOURCES = \
+ vectortest.c
+
+vectortest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_containers.la
+
+all: all-recursive
+
+.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 \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu
src/util/containers/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/util/containers/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
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL)
$(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL)
$(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ 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
+libgnunetutil_containers.la: $(libgnunetutil_containers_la_OBJECTS)
$(libgnunetutil_containers_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libgnunetutil_containers_la_LDFLAGS)
$(libgnunetutil_containers_la_OBJECTS) $(libgnunetutil_containers_la_LIBADD)
$(LIBS)
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+bloomtest$(EXEEXT): $(bloomtest_OBJECTS) $(bloomtest_DEPENDENCIES)
+ @rm -f bloomtest$(EXEEXT)
+ $(LINK) $(bloomtest_LDFLAGS) $(bloomtest_OBJECTS) $(bloomtest_LDADD)
$(LIBS)
+hashtabletest$(EXEEXT): $(hashtabletest_OBJECTS) $(hashtabletest_DEPENDENCIES)
+ @rm -f hashtabletest$(EXEEXT)
+ $(LINK) $(hashtabletest_LDFLAGS) $(hashtabletest_OBJECTS)
$(hashtabletest_LDADD) $(LIBS)
+vectortest$(EXEEXT): $(vectortest_OBJECTS) $(vectortest_DEPENDENCIES)
+ @rm -f vectortest$(EXEEXT)
+ $(LINK) $(vectortest_LDFLAGS) $(vectortest_OBJECTS) $(vectortest_LDADD)
$(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
+
+.c.o:
address@hidden@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
$<; \
address@hidden@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
address@hidden@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no
@AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po'
tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(COMPILE) -c $<
+
+.c.obj:
address@hidden@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
`$(CYGPATH_W) '$<'`; \
address@hidden@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
address@hidden@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no
@AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po'
tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
address@hidden@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
$<; \
address@hidden@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
address@hidden@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes
@AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo'
tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags);
\
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS)
ctags); \
+ done
+
+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; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && 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)'; \
+ 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`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *" $$tst "*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ 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 \
+ banner="$$failed of $$all tests did not behave as expected
($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ 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`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed
"s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || mkdir "$(distdir)/$$subdir" \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="../$(top_distdir)" \
+ distdir="../$(distdir)/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(libdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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:
+ -rm -f $(CONFIG_CLEAN_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-recursive
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \
+ clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-TESTS \
+ check-am clean clean-checkPROGRAMS clean-generic \
+ clean-libLTLIBRARIES clean-libtool clean-recursive ctags \
+ ctags-recursive distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-recursive distclean-tags distdir \
+ dvi dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-libLTLIBRARIES \
+ install-man install-strip installcheck installcheck-am \
+ installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am uninstall-info-am \
+ uninstall-libLTLIBRARIES
+
+# 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:
Added: GNUnet/src/util/containers/bloomfilter.c
===================================================================
--- GNUnet/src/util/containers/bloomfilter.c 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/containers/bloomfilter.c 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,573 @@
+/*
+ This file is part of GNUnet.
+ (C) 2001, 2002, 2003, 2004 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 util/bloomfilter.c
+ * @brief data structure used to reduce disk accesses.
+ *
+ * The idea basically: Create a signature for each element in the
+ * database. Add those signatures to a bit array. When doing a lookup,
+ * check if the bit array matches the signature of the requested
+ * element. If yes, address the disk, otherwise return 'not found'.
+ *
+ * A property of the bloom filter is that sometimes we will have
+ * a match even if the element is not on the disk (then we do
+ * an unnecessary disk access), but what's most important is that
+ * we never get a single "false negative".
+ *
+ * To be able to delete entries from the bloom filter, we maintain
+ * a 4 bit counter in the file on the drive (we still use only one
+ * bit in memory).
+ *
+ * @author Igor Wronsky
+ * @author Christian Grothoff
+ */
+
+#include "gnunet_util.h"
+#include "platform.h"
+
+typedef struct Bloomfilter {
+ /** The bit counter file on disk */
+ int fd;
+ /** How many bits we set for each stored element */
+ unsigned int addressesPerElement;
+ /** The actual bloomfilter bit array */
+ char * bitArray;
+ /** Size of bitArray in bytes */
+ unsigned int bitArraySize;
+ /** Concurrency control */
+ Mutex lock;
+} Bloomfilter;
+
+
+/**
+ * Sets a bit active in the bitArray. Increment bit-specific
+ * usage counter on disk only if below 4bit max (==15).
+ *
+ * @param bitArray memory area to set the bit in
+ * @param bitIdx which bit to set
+ */
+static void setBit(char * bitArray,
+ unsigned int bitIdx) {
+ unsigned int arraySlot;
+ unsigned int targetBit;
+
+ arraySlot = bitIdx / 8;
+ targetBit = (1L << (bitIdx % 8));
+ bitArray[arraySlot] |= targetBit;
+}
+
+/**
+ * Clears a bit from bitArray. Bit is cleared from the array
+ * only if the respective usage counter on the disk hits/is zero.
+ *
+ * @param bitArray memory area to set the bit in
+ * @param bitIdx which bit to unset
+ */
+static void clearBit(char * bitArray,
+ unsigned int bitIdx) {
+ unsigned int slot;
+ unsigned int targetBit;
+
+ slot = bitIdx / 8;
+ targetBit = (1L << (bitIdx % 8));
+ bitArray[slot] = bitArray[slot] & (~targetBit);
+}
+
+/**
+ * Checks if a bit is active in the bitArray
+ *
+ * @param bitArray memory area to set the bit in
+ * @param bitIdx which bit to test
+ * @return YES if the bit is set, NO if not.
+ */
+static int testBit(char * bitArray,
+ unsigned int bitIdx) {
+ unsigned int slot;
+ unsigned int targetBit;
+
+ slot = bitIdx / 8;
+ targetBit = (1L << (bitIdx % 8));
+ if (bitArray[slot] & targetBit)
+ return YES;
+ else
+ return NO;
+}
+
+/**
+ * Sets a bit active in the bitArray and increments
+ * bit-specific usage counter on disk (but only if
+ * the counter was below 4 bit max (==15)).
+ *
+ * @param bitArray memory area to set the bit in
+ * @param bitIdx which bit to test
+ * @param fd A file to keep the 4 bit address usage counters in
+ */
+static void incrementBit(char * bitArray,
+ unsigned int bitIdx,
+ int fd) {
+ unsigned int fileSlot;
+ unsigned char value;
+ unsigned int high;
+ unsigned int low;
+ unsigned int targetLoc;
+
+ setBit(bitArray, bitIdx);
+ /* Update the counter file on disk */
+ GNUNET_ASSERT(fd != -1);
+ fileSlot = bitIdx / 2;
+ targetLoc = bitIdx % 2;
+
+ if (fileSlot != (unsigned int) lseek(fd, fileSlot, SEEK_SET))
+ DIE_STRERROR("lseek");
+ value = 0;
+ READ(fd,
+ &value,
+ 1);
+
+ low = value & 0xF;
+ high = (value & (~0xF)) >> 4;
+
+ if (targetLoc == 0) {
+ if (low < 0xF)
+ low++;
+ } else {
+ if (high < 0xF)
+ high++;
+ }
+ value = ((high<<4) | low);
+ if (fileSlot != (unsigned int) lseek(fd, fileSlot, SEEK_SET))
+ DIE_STRERROR("lseek");
+ if (1 != WRITE(fd, &value, 1))
+ DIE_STRERROR("write");
+}
+
+/**
+ * Clears a bit from bitArray if the respective usage
+ * counter on the disk hits/is zero.
+ *
+ * @param bitArray memory area to set the bit in
+ * @param bitIdx which bit to test
+ * @param fd A file to keep the 4bit address usage counters in
+ */
+static void decrementBit(char * bitArray,
+ unsigned int bitIdx,
+ int fd) {
+ unsigned int fileSlot;
+ unsigned char value;
+ unsigned int high;
+ unsigned int low;
+ unsigned int targetLoc;
+
+ GNUNET_ASSERT(fd != -1);
+ /* Each char slot in the counter file holds two 4 bit counters */
+ fileSlot = bitIdx / 2;
+ targetLoc = bitIdx % 2;
+
+ lseek(fd, fileSlot, SEEK_SET);
+ value = 0;
+ READ(fd, &value, 1);
+
+ low = value & 0xF;
+ high = (value & 0xF0) >> 4;
+
+ /* decrement, but once we have reached the max, never go back! */
+ if (targetLoc == 0) {
+ if ( (low > 0) && (low < 0xF) )
+ low--;
+ if (low == 0) {
+ clearBit(bitArray, bitIdx);
+ }
+ } else {
+ if ( (high > 0) && (high < 0xF) )
+ high--;
+ if (high == 0) {
+ clearBit(bitArray, bitIdx);
+ }
+ }
+ value = ((high<<4) | low);
+ lseek(fd, fileSlot, SEEK_SET);
+ if (1 != WRITE(fd, &value, 1))
+ DIE_STRERROR("write");
+}
+
+#define BUFFSIZE 65536
+
+/**
+ * Creates a file filled with zeroes
+ *
+ * @param fd the file handle
+ * @param size the size of the file
+ * @return OK if created ok, SYSERR otherwise
+ */
+static int makeEmptyFile(int fd,
+ unsigned int size) {
+ char * buffer;
+ unsigned int bytesleft=size;
+ int res = 0;
+
+ if (fd == -1)
+ return SYSERR;
+ buffer = (char*)MALLOC(BUFFSIZE);
+ memset(buffer, 0, BUFFSIZE);
+ lseek(fd, 0, SEEK_SET);
+
+ while (bytesleft > 0) {
+ if (bytesleft>BUFFSIZE) {
+ res = WRITE(fd, buffer, BUFFSIZE);
+ bytesleft -= BUFFSIZE;
+ } else {
+ res = WRITE(fd, buffer, bytesleft);
+ bytesleft = 0;
+ }
+ if(res == -1) {
+ LOG_STRERROR(LOG_WARNING, "write");
+ FREE(buffer);
+ return SYSERR;
+ }
+ }
+ FREE(buffer);
+ return OK;
+}
+
+/* ************** Bloomfilter hash iterator ********* */
+
+/**
+ * Iterator (callback) method to be called by the
+ * bloomfilter iterator on each bit that is to be
+ * set or tested for the key.
+ *
+ * @param bf the filter to manipulate
+ * @param bit the current bit
+ * @param additional context specific argument
+ */
+typedef void (*BitIterator)(Bloomfilter * bf,
+ unsigned int bit,
+ void * arg);
+
+/**
+ * Call an iterator for each bit that the bloomfilter
+ * must test or set for this element.
+ *
+ * @param bf the filter
+ * @param callback the method to call
+ * @param arg extra argument to callback
+ * @param key the key for which we iterate over the BF bits
+ */
+static void iterateBits(Bloomfilter * bf,
+ BitIterator callback,
+ void * arg,
+ const HashCode512 * key) {
+ HashCode512 tmp[2];
+ int bitCount;
+ int round;
+ unsigned int slot=0;
+
+ bitCount = bf->addressesPerElement;
+ memcpy(&tmp[0],
+ key,
+ sizeof(HashCode512));
+ round = 0;
+ while (bitCount > 0) {
+ while (slot < (sizeof(HashCode512)/sizeof(unsigned int))) {
+ callback(bf,
+ (((unsigned int*)&tmp[round&1])[slot]) &
((bf->bitArraySize*8)-1),
+ arg);
+ slot++;
+ bitCount--;
+ if (bitCount == 0)
+ break;
+ }
+ if (bitCount > 0) {
+ hash(&tmp[round & 1],
+ sizeof(HashCode512),
+ &tmp[(round+1) & 1]);
+ round++;
+ slot = 0;
+ }
+ }
+}
+
+/**
+ * Callback: increment bit
+ *
+ * @param bf the filter to manipulate
+ * @param bit the bit to increment
+ * @param arg not used
+ */
+static void incrementBitCallback(Bloomfilter * bf,
+ unsigned int bit,
+ void * arg) {
+ incrementBit(bf->bitArray,
+ bit,
+ bf->fd);
+}
+
+/**
+ * Callback: decrement bit
+ *
+ * @param bf the filter to manipulate
+ * @param bit the bit to decrement
+ * @param arg not used
+ */
+static void decrementBitCallback(Bloomfilter * bf,
+ unsigned int bit,
+ void * arg) {
+ decrementBit(bf->bitArray,
+ bit,
+ bf->fd);
+}
+
+/**
+ * Callback: test if all bits are set
+ *
+ * @param bf the filter
+ * @param bit the bit to test
+ * @param arg pointer set to NO if bit is not set
+ */
+static void testBitCallback(const Bloomfilter * bf,
+ unsigned int bit,
+ int * arg) {
+ if (NO == testBit(bf->bitArray,
+ bit))
+ *arg = NO;
+}
+
+/* *********************** INTERFACE **************** */
+
+/**
+ * Load a bloom-filter from a file.
+ *
+ * @param filename the name of the file (or the prefix)
+ * @param size the size of the bloom-filter (number of
+ * bytes of storage space to use)
+ * @param k the number of hash-functions to apply per
+ * element (number of bits set per element in the set)
+ * @return the bloomfilter
+ */
+Bloomfilter * loadBloomfilter(const char * filename,
+ unsigned int size,
+ unsigned int k) {
+ Bloomfilter * bf;
+ char * rbuff;
+ unsigned int pos;
+ int i;
+ unsigned int ui;
+
+ if ( (filename == NULL) ||
+ (k==0) ||
+ (size==0) )
+ return NULL;
+ if (size < BUFFSIZE)
+ size = BUFFSIZE;
+ ui = 1;
+ while (ui < size)
+ ui*=2;
+ size = ui; /* make sure it's a power of 2 */
+
+ bf = (Bloomfilter *) MALLOC(sizeof(Bloomfilter));
+
+ /* Try to open a bloomfilter file */
+#ifndef _MSC_VER
+ bf->fd = fileopen(filename, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
+#else
+ bf->fd = fileopen(filename, O_WRONLY|O_CREAT, S_IREAD|S_IWRITE);
+#endif
+ if (-1 == bf->fd) {
+ LOG_FILE_STRERROR(LOG_FAILURE, "open", filename);
+ FREE(bf);
+ return NULL;
+ }
+
+ /* Alloc block */
+ MUTEX_CREATE_RECURSIVE(&bf->lock);
+ bf->bitArray
+ = (char *) xmalloc_unchecked_(size, __FILE__, __LINE__);
+ bf->bitArraySize = size;
+ bf->addressesPerElement = k;
+ memset(bf->bitArray,
+ 0,
+ bf->bitArraySize);
+
+ /* Read from the file what bits we can */
+ rbuff = (char*)MALLOC(BUFFSIZE);
+ pos = 0;
+ while (pos < size*8) {
+ int res;
+
+ res = READ(bf->fd,
+ rbuff,
+ BUFFSIZE);
+ if (res == 0)
+ break; /* is ok! we just did not use that many bits yet */
+ for (i=0;i<res;i++) {
+ if ( (rbuff[i] & 0x0F) != 0)
+ setBit(bf->bitArray,
+ pos + i*2);
+ if ( (rbuff[i] & 0xF0) != 0)
+ setBit(bf->bitArray,
+ pos + i*2 + 1);
+ }
+ if (res < BUFFSIZE)
+ break;
+ pos += BUFFSIZE * 2; /* 2 bits per byte in the buffer */
+ }
+ FREE(rbuff);
+ return bf;
+}
+
+/**
+ * Free the space associated with a filter
+ * in memory, flush to drive if needed (do not
+ * free the space on the drive)
+ *
+ * @param bf the filter
+ */
+void freeBloomfilter(Bloomfilter * bf) {
+ if (NULL == bf)
+ return;
+ MUTEX_DESTROY(&bf->lock);
+ closefile(bf->fd);
+ FREE(bf->bitArray);
+ FREE(bf);
+}
+
+/**
+ * Reset a bloom filter to empty. Clears the file on disk.
+ *
+ * @param bf the filter
+ */
+void resetBloomfilter(Bloomfilter * bf) {
+ if (NULL == bf)
+ return;
+
+ MUTEX_LOCK(&bf->lock);
+ memset(bf->bitArray,
+ 0,
+ bf->bitArraySize);
+ makeEmptyFile(bf->fd,
+ bf->bitArraySize * 4);
+ MUTEX_UNLOCK(&bf->lock);
+}
+
+
+/**
+ * Test if an element is in the filter.
+ *
+ * @param e the element
+ * @param bf the filter
+ * @return YES if the element is in the filter, NO if not
+ */
+int testBloomfilter(Bloomfilter * bf,
+ const HashCode512 * e) {
+ int res;
+
+ if (NULL == bf)
+ return YES;
+ MUTEX_LOCK(&bf->lock);
+ res = YES;
+ iterateBits(bf,
+ (BitIterator)&testBitCallback,
+ &res,
+ e);
+ MUTEX_UNLOCK(&bf->lock);
+ return res;
+}
+
+/**
+ * Add an element to the filter
+ *
+ * @param bf the filter
+ * @param e the element
+ */
+void addToBloomfilter(Bloomfilter * bf,
+ const HashCode512 * e) {
+
+ if (NULL == bf)
+ return;
+ MUTEX_LOCK(&bf->lock);
+ iterateBits(bf,
+ &incrementBitCallback,
+ NULL,
+ e);
+ MUTEX_UNLOCK(&bf->lock);
+}
+
+/**
+ * Remove an element from the filter.
+ *
+ * @param bf the filter
+ * @param e the element to remove
+ */
+void delFromBloomfilter(Bloomfilter * bf,
+ const HashCode512 * e) {
+ if(NULL == bf)
+ return;
+ MUTEX_LOCK(&bf->lock);
+ iterateBits(bf,
+ &decrementBitCallback,
+ NULL,
+ e);
+ MUTEX_UNLOCK(&bf->lock);
+}
+
+/**
+ * Resize a bloom filter. Note that this operation
+ * is pretty costly. Essentially, the bloom filter
+ * needs to be completely re-build.
+ *
+ * @param bf the filter
+ * @param iterator an iterator over all elements stored in the BF
+ * @param iterator_arg argument to the iterator function
+ * @param size the new size for the filter
+ * @param k the new number of hash-function to apply per element
+ */
+void resizeBloomfilter(Bloomfilter * bf,
+ ElementIterator iterator,
+ void * iterator_arg,
+ unsigned int size,
+ unsigned int k) {
+ HashCode512 * e;
+ unsigned int i;
+
+ MUTEX_LOCK(&bf->lock);
+ FREE(bf->bitArray);
+ i = 1;
+ while (i < size)
+ i*=2;
+ size = i; /* make sure it's a power of 2 */
+
+ bf->bitArraySize = size;
+ bf->bitArray = (char*)MALLOC(size);
+ memset(bf->bitArray,
+ 0,
+ bf->bitArraySize);
+ makeEmptyFile(bf->fd,
+ bf->bitArraySize * 4);
+ e = iterator(iterator_arg);
+ while (e != NULL) {
+ addToBloomfilter(bf,
+ e);
+ FREE(e);
+ e = iterator(iterator_arg);
+ }
+ MUTEX_UNLOCK(&bf->lock);
+}
+
+/* ******************** end of bloomfilter.c *********** */
Added: GNUnet/src/util/containers/bloomtest.c
===================================================================
--- GNUnet/src/util/containers/bloomtest.c 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/containers/bloomtest.c 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,128 @@
+/*
+ This file is part of GNUnet.
+ (C) 2004 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 test/bloomtest.c
+ * @brief Testcase for the bloomfilter.
+ * @author Igor Wronsky
+ */
+
+#include "gnunet_util.h"
+#include "platform.h"
+
+#define K 4
+#define SIZE 65536
+
+/**
+ * Generate a random hashcode.
+ */
+static void nextHC(HashCode512 * hc) {
+ makeRandomId(hc);
+}
+
+int main(int argc, char *argv[]) {
+ struct Bloomfilter *bf;
+ HashCode512 tmp;
+ int i;
+ int ok;
+ int falseok;
+
+ initUtil(argc, argv, NULL);
+ srand(1);
+ UNLINK("/tmp/bloomtest.dat");
+ bf = loadBloomfilter("/tmp/bloomtest.dat", SIZE, K);
+
+ for(i=0;i<200;i++) {
+ nextHC(&tmp);
+ addToBloomfilter(bf, &tmp);
+ }
+ srand(1);
+ ok=0;
+ for(i=0;i<200;i++) {
+ nextHC(&tmp);
+ if (testBloomfilter(bf, &tmp) == YES)
+ ok++;
+ }
+ if (ok != 200) {
+ printf(" Got %d elements out of"
+ "200 expected after insertion.\n",
+ ok);
+ doneUtil();
+ return -1;
+ }
+ freeBloomfilter(bf);
+
+
+ bf=loadBloomfilter("/tmp/bloomtest.dat", SIZE, K);
+
+ srand(1);
+ ok=0;
+ for(i=0;i<200;i++) {
+ nextHC(&tmp);
+ if (testBloomfilter(bf, &tmp) == YES)
+ ok++;
+ }
+ if (ok != 200) {
+ printf(" Got %d elements out of 200"
+ "expected after reloading.\n",
+ ok);
+ doneUtil();
+ return -1;
+ }
+
+ srand(1);
+ for(i=0;i<100;i++) {
+ nextHC(&tmp);
+ delFromBloomfilter(bf, &tmp);
+ }
+
+ srand(1);
+
+ ok=0;
+ for(i=0;i<200;i++) {
+ nextHC(&tmp);
+ if(testBloomfilter(bf, &tmp) == YES)
+ ok++;
+ }
+
+ if (ok != 100) {
+ printf(" Expected 100 elements in filter"
+ " after adding 200 and deleting 100, got %d\n",
+ ok);
+ doneUtil();
+ return -1;
+ }
+
+ srand(3);
+
+ falseok=0;
+ for(i=0;i<1000;i++) {
+ nextHC(&tmp);
+ if(testBloomfilter(bf, &tmp) == YES)
+ falseok++;
+ }
+
+ freeBloomfilter(bf);
+
+ UNLINK("/tmp/bloomtest.dat");
+ doneUtil();
+ return(0);
+}
+
+
Added: GNUnet/src/util/containers/hashtable.c
===================================================================
--- GNUnet/src/util/containers/hashtable.c 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/containers/hashtable.c 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,462 @@
+/*
+ This file is part of GNUnet.
+ (C) 2006 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.
+
+ Based on http://www.pomakis.com/hashtable/hashtable.c which is public
+ domain
+*/
+
+/**
+ * @brief Hashtable implementation
+ * @author Keith Pomakis
+ * @author Nils Durner
+ * @file util/hashtable.c
+ */
+
+#include "gnunet_util.h"
+#include "platform.h"
+
+typedef struct KeyValuePair {
+ void *key;
+ unsigned long keylen;
+ void *value;
+ unsigned long valuelen;
+ struct KeyValuePair *next;
+} KeyValuePair;
+
+typedef struct HashTable {
+ long numOfBuckets;
+ long numOfElements;
+ KeyValuePair **bucketArray;
+ float idealRatio;
+ float lowerRehashThreshold;
+ float upperRehashThreshold;
+} HashTable;
+
+/**
+ * @brief Create a cryptographically weak hashcode from a buffer
+ * @param z the buffer to hash
+ * @param n the size of z
+ * @return the hashcode
+ */
+static unsigned long long weakHash(const char *z, int n){
+ unsigned long long h = 0;
+ while(n > 0) {
+ h = (h << 3) ^ h ^ (unsigned char) *z++;
+ n--;
+ }
+ return h;
+}
+
+
+static int isProbablePrime(long oddNumber) {
+ long i;
+
+ for (i=3; i<51; i+=2)
+ if (oddNumber == i)
+ return 1;
+ else if (oddNumber%i == 0)
+ return 0;
+
+ return 1; /* maybe */
+}
+
+static long calculateIdealNumOfBuckets(const struct HashTable *hashTable) {
+ long idealNumOfBuckets = hashTable->numOfElements / hashTable->idealRatio;
+ if (idealNumOfBuckets < 5)
+ idealNumOfBuckets = 5;
+ else
+ idealNumOfBuckets |= 0x01; /* make it an odd number */
+ while (!isProbablePrime(idealNumOfBuckets))
+ idealNumOfBuckets += 2;
+
+ return idealNumOfBuckets;
+}
+
+
+/**
+ * @brief creates a new HashTable
+ * @param numOfBuckets the number of buckets to start the HashTable out with.
+ * Must be greater than zero, and should be prime.
+ * Ideally, the number of buckets should between 1/5
+ * and 1 times the expected number of elements in the
+ * HashTable. Values much more or less than this will
+ * result in wasted memory or decreased performance
+ * respectively. The number of buckets in a HashTable
+ * can be re-calculated to an appropriate number by
+ * calling the HashTableRehash() function once the
+ * HashTable has been populated. The number of buckets
+ * in a HashTable may also be re-calculated
+ * automatically if the ratio of elements to buckets
+ * passes the thresholds set by ht_setIdealRatio().
+ * @return a new Hashtable, or NULL on error
+ */
+struct HashTable *ht_create(long numOfBuckets) {
+ struct HashTable *hashTable;
+ int i;
+
+ if (numOfBuckets <= 0)
+ return NULL;
+
+ hashTable = (struct HashTable *) MALLOC(sizeof(struct HashTable));
+ if (hashTable == NULL)
+ return NULL;
+
+ hashTable->bucketArray = (KeyValuePair **)
+ MALLOC(numOfBuckets * sizeof(KeyValuePair *));
+ if (hashTable->bucketArray == NULL) {
+ FREE(hashTable);
+ return NULL;
+ }
+
+ hashTable->numOfBuckets = numOfBuckets;
+ hashTable->numOfElements = 0;
+
+ for (i=0; i<numOfBuckets; i++)
+ hashTable->bucketArray[i] = NULL;
+
+ hashTable->idealRatio = 3.0;
+ hashTable->lowerRehashThreshold = 0.0;
+ hashTable->upperRehashThreshold = 15.0;
+
+ return hashTable;
+}
+
+/**
+ * @brief destroys an existing HashTable
+ * @param hashTable the HashTable to destroy
+ */
+void ht_destroy(struct HashTable *hashTable) {
+ int i;
+
+ for (i=0; i < hashTable->numOfBuckets; i++) {
+ KeyValuePair *pair = hashTable->bucketArray[i];
+ while (pair != NULL) {
+ KeyValuePair *nextPair = pair->next;
+ FREE(pair->key);
+ FREE(pair->value);
+ FREE(pair);
+ pair = nextPair;
+ }
+ }
+
+ FREE(hashTable->bucketArray);
+ FREE(hashTable);
+}
+
+/**
+ * @brief checks the existence of a key in a HashTable
+ * @param hashTable the HashTable to search
+ * @param key the key to search for
+ * @return whether or not the specified HashTable contains the
+ * specified key
+ */
+int ht_containsKey(const struct HashTable *hashTable,
+ const void *key,
+ const unsigned int keylen) {
+ void *ret;
+ unsigned int retlen;
+
+ return ht_get(hashTable, key, keylen, &ret, &retlen);
+}
+
+/**
+ * @brief checks the existence of a value in a HashTable
+ * @param hashTable the HashTable to search
+ * @param value the value to search for
+ * @return whether or not the specified HashTable contains the
+ * specified value
+ */
+int ht_containsValue(const struct HashTable *hashTable,
+ const void *value,
+ const unsigned int valuelen) {
+ int i;
+
+ for (i=0; i<hashTable->numOfBuckets; i++) {
+ KeyValuePair *pair = hashTable->bucketArray[i];
+ while (pair != NULL) {
+ if ( (pair->valuelen == valuelen) &&
+ (memcmp(value, pair->value, valuelen) == 0) )
+ return 1;
+ pair = pair->next;
+ }
+ }
+
+ return 0;
+}
+
+/**
+ * @brief adds a key/value pair to a HashTable
+ * @param hashTable the HashTable to add to
+ * @param key the key to add or whose value to replace
+ * @param value the value associated with the key
+ * @return YES if successful, NO if an error was encountered
+ */
+int ht_put(struct HashTable *hashTable,
+ const void *key,
+ const unsigned int keylen,
+ void *value,
+ const unsigned int valuelen) {
+ long hashValue;
+ KeyValuePair *pair;
+
+ if (key == NULL || value == NULL)
+ return NO;
+
+ hashValue = weakHash(key, keylen) % hashTable->numOfBuckets;
+ pair = hashTable->bucketArray[hashValue];
+
+ while (pair != NULL && pair->keylen != keylen &&
+ memcmp(key, pair->key, keylen) != 0)
+ pair = pair->next;
+
+ if (pair) {
+ pair->key = REALLOC(pair->key, keylen);
+ memcpy(pair->key, key, keylen);
+ pair->keylen = keylen;
+
+ pair->key = REALLOC(value, valuelen);
+ memcpy(pair->value, value, valuelen);
+ pair->valuelen = valuelen;
+ }
+ else {
+ KeyValuePair *newPair = MALLOC(sizeof(KeyValuePair));
+ if (newPair == NULL)
+ return NO;
+ else {
+ newPair->key = MALLOC(keylen);
+ memcpy(newPair->key, key, keylen);
+ newPair->keylen = keylen;
+ newPair->value = MALLOC(valuelen);
+ memcpy(newPair->value, value, valuelen);
+ newPair->valuelen = valuelen;
+ newPair->next = hashTable->bucketArray[hashValue];
+ hashTable->bucketArray[hashValue] = newPair;
+ hashTable->numOfElements++;
+
+ if (hashTable->upperRehashThreshold > hashTable->idealRatio) {
+ float elementToBucketRatio = (float) hashTable->numOfElements /
+ (float) hashTable->numOfBuckets;
+ if (elementToBucketRatio > hashTable->upperRehashThreshold)
+ ht_rehash(hashTable, 0);
+ }
+ }
+ }
+
+ return YES;
+}
+
+/**
+ * @brief retrieves the value of a key in a HashTable
+ * @param hashTable the HashTable to search
+ * @param key the key whose value is desired
+ * @param value the corresponding value
+ * @param valuelen the length of the value
+ * @return YES if found, NO otherwise
+ */
+int ht_get(const struct HashTable *hashTable,
+ const void *key,
+ const unsigned int keylen,
+ void **value,
+ unsigned int *valuelen) {
+ long hashValue = weakHash(key, keylen) % hashTable->numOfBuckets;
+ KeyValuePair *pair = hashTable->bucketArray[hashValue];
+
+ while (pair != NULL && keylen != pair->keylen && memcmp(key, pair->key,
keylen) != 0)
+ pair = pair->next;
+
+ if (pair != NULL)
+ {
+ *value = pair->value;
+ *valuelen = pair->valuelen;
+ }
+
+ return pair != NULL;
+}
+
+/**
+ * @brief removes a key/value pair from a HashTable
+ * @param hashTable the HashTable to remove the key/value pair from
+ * @param key the key specifying the key/value pair to be removed
+ */
+void ht_remove(struct HashTable *hashTable,
+ const void *key,
+ const unsigned int keylen) {
+ long hashValue = weakHash(key, keylen) % hashTable->numOfBuckets;
+ KeyValuePair *pair = hashTable->bucketArray[hashValue];
+ KeyValuePair *previousPair = NULL;
+
+ while (pair != NULL && pair->keylen != keylen &&
+ memcmp(pair->key, key, keylen) != 0) {
+ previousPair = pair;
+ pair = pair->next;
+ }
+
+ if (pair != NULL) {
+ FREE(pair->key);
+ FREE(pair->value);
+ if (previousPair != NULL)
+ previousPair->next = pair->next;
+ else
+ hashTable->bucketArray[hashValue] = pair->next;
+ FREE(pair);
+ hashTable->numOfElements--;
+
+ if (hashTable->lowerRehashThreshold > 0.0) {
+ float elementToBucketRatio = (float) hashTable->numOfElements /
+ (float) hashTable->numOfBuckets;
+ if (elementToBucketRatio < hashTable->lowerRehashThreshold)
+ ht_rehash(hashTable, 0);
+ }
+ }
+}
+
+/**
+ * @brief removes all key/value pairs from a HashTable
+ * @param hashTable the HashTable to remove all key/value pairs from
+ */
+void ht_removeAll(struct HashTable *hashTable) {
+ int i;
+
+ for (i=0; i<hashTable->numOfBuckets; i++) {
+ KeyValuePair *pair = hashTable->bucketArray[i];
+ while (pair != NULL) {
+ KeyValuePair *nextPair = pair->next;
+ FREE(pair->key);
+ FREE(pair->value);
+ FREE(pair);
+ pair = nextPair;
+ }
+ hashTable->bucketArray[i] = NULL;
+ }
+
+ hashTable->numOfElements = 0;
+ ht_rehash(hashTable, 5);
+}
+
+/**
+ * @brief returns the number of elements in a HashTable
+ * @param hashTable the HashTable whose size is requested
+ * @return the number of key/value pairs that are present in
+ * the specified HashTable
+ */
+long ht_size(const struct HashTable *hashTable) {
+ return hashTable->numOfElements;
+}
+
+/**
+ * @brief returns the number of buckets in a HashTable
+ * @param hashTable the HashTable whose number of buckets is requested
+ * @return the number of buckets that are in the specified
+ * HashTable
+ */
+long ht_buckets(const struct HashTable *hashTable) {
+ return hashTable->numOfBuckets;
+}
+
+/**
+ * @brief reorganizes a HashTable to be more efficient
+ * @param hashTable the HashTable to be reorganized
+ * @param numOfBuckets the number of buckets to rehash the HashTable to.
+ * Should be prime. Ideally, the number of buckets
+ * should be between 1/5 and 1 times the expected
+ * number of elements in the HashTable. Values much
+ * more or less than this will result in wasted memory
+ * or decreased performance respectively. If 0 is
+ * specified, an appropriate number of buckets is
+ * automatically calculated.
+ */
+void ht_rehash(struct HashTable *hashTable, long numOfBuckets) {
+ KeyValuePair **newBucketArray;
+ int i;
+
+ if (numOfBuckets == 0)
+ numOfBuckets = calculateIdealNumOfBuckets(hashTable);
+
+ if (numOfBuckets == hashTable->numOfBuckets)
+ return; /* already the right size! */
+
+ newBucketArray = (KeyValuePair **)
+ MALLOC(numOfBuckets * sizeof(KeyValuePair *));
+ if (newBucketArray == NULL) {
+ /* Couldn't allocate memory for the new array. This isn't a fatal
+ * error; we just can't perform the rehash. */
+ return;
+ }
+
+ for (i=0; i<numOfBuckets; i++)
+ newBucketArray[i] = NULL;
+
+ for (i=0; i<hashTable->numOfBuckets; i++) {
+ KeyValuePair *pair = hashTable->bucketArray[i];
+ while (pair != NULL) {
+ KeyValuePair *nextPair = pair->next;
+ long hashValue = weakHash(pair->key, pair->keylen) % numOfBuckets;
+ pair->next = newBucketArray[hashValue];
+ newBucketArray[hashValue] = pair;
+ pair = nextPair;
+ }
+ }
+
+ FREE(hashTable->bucketArray);
+ hashTable->bucketArray = newBucketArray;
+ hashTable->numOfBuckets = numOfBuckets;
+}
+
+/**
+ * @brief sets the ideal element-to-bucket ratio of a HashTable
+ * @param hashTable a HashTable
+ * @param idealRatio the ideal element-to-bucket ratio. When a rehash
+ * occurs (either manually via a call to the
+ * HashTableRehash() function or automatically due the
+ * the triggering of one of the thresholds below), the
+ * number of buckets in the HashTable will be
+ * recalculated to be a prime number that achieves (as
+ * closely as possible) this ideal ratio. Must be a
+ * positive number.
+ * @param lowerRehashThreshold the element-to-bucket ratio that is considered
+ * unacceptably low (i.e., too few elements per bucket).
+ * If the actual ratio falls below this number, a
+ * rehash will automatically be performed. Must be
+ * lower than the value of idealRatio. If no ratio
+ * is considered unacceptably low, a value of 0.0 can
+ * be specified.
+ * @param upperRehashThreshold the element-to-bucket ratio that is considered
+ * unacceptably high (i.e., too many elements per bucket).
+ * If the actual ratio rises above this number, a
+ * rehash will automatically be performed. Must be
+ * higher than idealRatio. However, if no ratio
+ * is considered unacceptably high, a value of 0.0 can
+ * be specified.
+ */
+void ht_setIdealRatio(struct HashTable *hashTable,
+ float idealRatio,
+ float lowerRehashThreshold,
+ float upperRehashThreshold) {
+
+ if (idealRatio <= 0.0 || lowerRehashThreshold >= idealRatio ||
+ (upperRehashThreshold != 0.0 || upperRehashThreshold <= idealRatio))
+ return;
+
+ hashTable->idealRatio = idealRatio;
+ hashTable->lowerRehashThreshold = lowerRehashThreshold;
+ hashTable->upperRehashThreshold = upperRehashThreshold;
+}
+
+
+/* end of hashtable.c */
Added: GNUnet/src/util/containers/hashtabletest.c
===================================================================
--- GNUnet/src/util/containers/hashtabletest.c 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/containers/hashtabletest.c 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,146 @@
+/*
+ This file is part of GNUnet.
+ (C) 2006 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 util/hashtabletest.c
+ * @brief testcase for util/hashtable.c
+ * @author Nils Durner
+ */
+
+#include "gnunet_util.h"
+#include "platform.h"
+
+static int testHT()
+{
+ struct HashTable *ht = ht_create(10);
+ void *val;
+ unsigned int vallen;
+
+ if (HT_PUT(ht, "Sweden", "Stockholm") != YES ||
+ HT_PUT(ht, "Germany", "Berlin") != YES ||
+ HT_PUT(ht, "France", "Paris") != YES ||
+ HT_PUT(ht, "Spain", "Madrid") != YES ||
+ HT_PUT(ht, "Italy", "Rome") != YES ||
+ HT_PUT(ht, "USA", "Washington") != YES)
+ {
+ puts("ht_put failed\n");
+ return 1;
+ }
+
+ if (HT_CONTAINS_KEY(ht, "France") != YES ||
+ HT_CONTAINS_KEY(ht, "Iceland") != NO)
+ {
+ puts("ht_contains_key failed!\n");
+ return 1;
+ }
+
+ if (HT_CONTAINS_VALUE(ht, "Paris") != YES ||
+ HT_CONTAINS_VALUE(ht, "London") != NO)
+ {
+ puts("ht_contains_value failed!\n");
+ return 1;
+ }
+
+ if (HT_GET(ht, "USA", &val, &vallen) != YES)
+ {
+ puts("ht_get failed!\n");
+ return 1;
+ }
+
+ if (strcmp((char *) val, "Washington") != 0)
+ {
+ puts("ht_get result invalid!\n");
+ return 1;
+ }
+
+ HT_REMOVE(ht, "Spain");
+ if (HT_CONTAINS_KEY(ht, "Spain") != NO)
+ {
+ puts("ht_remove failed!\n");
+ return 1;
+ }
+
+ if (ht_size(ht) != 5)
+ {
+ puts("ht_size failed!\n");
+ return 1;
+ }
+
+ ht_removeAll(ht);
+ if (ht_size(ht) != 0)
+ {
+ puts("ht_size#2 failed!\n");
+ return 1;
+ }
+
+ ht_destroy(ht);
+
+ return 0;
+}
+
+
+/**
+ * Perform option parsing from the command line.
+ */
+static int parseCommandLine(int argc,
+ char * argv[]) {
+ char c;
+
+ while (1) {
+ int option_index = 0;
+ static struct GNoption long_options[] = {
+ { "loglevel",1, 0, 'L' },
+ { "config", 1, 0, 'c' },
+ { 0,0,0,0 }
+ };
+
+ c = GNgetopt_long(argc,
+ argv,
+ "c:L:",
+ long_options,
+ &option_index);
+
+ if (c == -1)
+ break; /* No more flags to process */
+
+ switch(c) {
+ case 'L':
+ FREENONNULL(setConfigurationString("GNUNET",
+ "LOGLEVEL",
+ GNoptarg));
+ break;
+ case 'c':
+ FREENONNULL(setConfigurationString("FILES",
+ "gnunet.conf",
+ GNoptarg));
+ break;
+ } /* end of parsing commandline */
+ }
+ return OK;
+}
+
+int main(int argc, char * argv[]){
+ int ret = 0;
+
+ initUtil(argc, argv, &parseCommandLine);
+ ret = testHT();
+ doneUtil();
+
+ return ret;
+}
Added: GNUnet/src/util/containers/hashtest.c
===================================================================
--- GNUnet/src/util/containers/hashtest.c 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/containers/hashtest.c 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,51 @@
+/**
+ * @file test/hashtest.c
+ * @brief testcase for util/hashing.c
+ */
+
+#include "gnunet_util.h"
+#include "platform.h"
+
+/**
+ * Perform option parsing from the command line.
+ */
+static int parseCommandLine(int argc,
+ char * argv[]) {
+ return OK;
+}
+
+int main(int argc, char * argv[]){
+ HashCode512 hc;
+
+ initUtil(argc, argv, &parseCommandLine);
+ hash("TEST", 4, &hc);
+ if ( (hc.bits[0] != ntohl(2080019878)) ||
+ (hc.bits[1] != ntohl(-2003678137)) ||
+ (hc.bits[2] != ntohl(-942529663)) ||
+ (hc.bits[3] != ntohl(-234043098)) ||
+ (hc.bits[4] != ntohl(-182141268)) ) {
+ printf("Hash of TEST wrong (%d, %d, %d, %d, %d).\n",
+ ntohl(hc.bits[0]),
+ ntohl(hc.bits[1]),
+ ntohl(hc.bits[2]),
+ ntohl(hc.bits[3]),
+ ntohl(hc.bits[4]));
+ return -1;
+ }
+ hash(NULL, 0, &hc);
+ if ( (hc.bits[0] != ntohl(-813440715)) ||
+ (hc.bits[1] != ntohl(2129639613)) ||
+ (hc.bits[2] != ntohl(-246142896)) ||
+ (hc.bits[3] != ntohl(-697466873)) ||
+ (hc.bits[4] != ntohl(-702487547)) ) {
+ printf("Hash of nothing (0-size) wrong (%d, %d, %d, %d, %d).\n",
+ ntohl(hc.bits[0]),
+ ntohl(hc.bits[1]),
+ ntohl(hc.bits[2]),
+ ntohl(hc.bits[3]),
+ ntohl(hc.bits[4]));
+ return -1;
+ }
+ doneUtil();
+ return 0;
+}
Added: GNUnet/src/util/containers/vector.c
===================================================================
--- GNUnet/src/util/containers/vector.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/containers/vector.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,641 @@
+/*
+ This file is part of GNUnet
+
+ 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 util/vector.c
+ * @brief Implementation of a dynamic array
+ * @author Antti Salonen, Christian Grothoff
+ * @version vector.c,v 1.3 2004/05/02 20:22:52 aksalone Exp
+ *
+ * An implementation of a dynamic array of objects. Like an array, the
+ * vector's elements are indexed, but it is also possible to
+ * dynamically resize the vector by inserting and removing elements at
+ * any location. The vector is implemented as a double-linked list of
+ * arrays, each with a static maximum length. When one array fills up,
+ * it's splitted into two half-full arrays, and so forth. With
+ * functions {insert,get,remove}_last the vector can also be used as a
+ * fairly efficient stack. The functions
+ * get_{at,first,last,next,previous} allow traversing the vector in an
+ * efficient manner, each function call taking more or less constant
+ * time. Vector_get_next and Vector_get_first may only be called after
+ * a call to one of vector_get_{first,last,at}, which set the vector's
+ * iterator. All functions that modify the vector's contents unset the
+ * iterator.
+ */
+
+#include "platform.h"
+#include "gnunet_util.h"
+
+typedef struct Vector {
+ unsigned int VECTOR_SEGMENT_SIZE;
+ struct vector_segment_t * segmentsHead;
+ struct vector_segment_t * segmentsTail;
+ struct vector_segment_t * iteratorSegment;
+ unsigned int iteratorIndex;
+ size_t size;
+} Vector;
+
+
+typedef struct vector_segment_t {
+ void ** data; /* always of size VECTOR_SEGMENT_SIZE */
+ struct vector_segment_t *next;
+ struct vector_segment_t *previous;
+ size_t size;
+} VectorSegment;
+
+/**
+ * A debug function that traverses the linked list and prints the
+ * sizes of the segments. This currently isn't used.
+ */
+void vectorDump(Vector *v) {
+ VectorSegment *vs;
+ int n;
+ unsigned int sum = 0;
+
+ for (vs = v->segmentsHead; vs; vs = vs->next) {
+ fprintf(stderr,
+ "Segment-size: %3llu / %llu [%llu...%llu]: ",
+ (unsigned long long) vs->size,
+ (unsigned long long) v->VECTOR_SEGMENT_SIZE,
+ (unsigned long long) sum,
+ (unsigned long long) (sum + vs->size - 1));
+ for (n=0;n<vs->size;n++) {
+ fprintf(stderr,
+ "%p, ",
+ vs->data[n]);
+ }
+ fprintf(stderr, "\n");
+ sum += vs->size;
+ }
+ fprintf(stderr,
+ "Vector size: %u\n",
+ sum);
+}
+
+/**
+ * Remove and return the element at given index in the segment's array. The
+ * trailing pointers in the array, if any, are moved backwards to fill the gap.
+ */
+static void *vectorSegmentRemoveAtIndex(VectorSegment *vs,
+ int index) {
+ void *rvalue = vs->data[index];
+
+ while (index < vs->size) {
+ vs->data[index] = vs->data[index + 1];
+ index++;
+ }
+ return rvalue;
+}
+
+
+/**
+ * Split the full segment vs into two half-full segments.
+ */
+static void vectorSegmentSplit(Vector *v,
+ VectorSegment *vs) {
+ VectorSegment *oldNext;
+ int moveCount;
+
+ oldNext = vs->next;
+ vs->next = MALLOC(sizeof(VectorSegment));
+ vs->next->data = MALLOC(v->VECTOR_SEGMENT_SIZE * sizeof(void*));
+ vs->next->previous = vs;
+ vs->next->next = oldNext;
+ if (NULL != oldNext)
+ oldNext->previous = vs->next;
+ else
+ v->segmentsTail = vs->next;
+ moveCount = vs->size / 2;
+ memcpy(vs->next->data,
+ vs->data + (vs->size - moveCount),
+ moveCount * sizeof (void *));
+ vs->next->size = moveCount;
+ vs->size -= moveCount;
+}
+
+/**
+ * Joins the given segment with the following segment. The first segment _must_
+ * be empty enough to store the data of both segments.
+ */
+static void vectorSegmentJoin(Vector *v,
+ VectorSegment *vs) {
+ VectorSegment *oldNext = vs->next->next;
+
+ memcpy(vs->data + vs->size,
+ vs->next->data,
+ vs->next->size * sizeof (void *));
+ vs->size += vs->next->size;
+ FREE(vs->next->data);
+ FREE(vs->next);
+ vs->next = oldNext;
+ if (oldNext != NULL)
+ vs->next->previous = vs;
+ else
+ v->segmentsTail = vs;
+}
+
+/**
+ * Free an empty segment, _unless_ it is the only segment.
+ */
+static void vectorSegmentRemove(Vector *v,
+ VectorSegment *vs) {
+ if ( (vs->previous == NULL) &&
+ (vs->next == NULL) )
+ return;
+ if (vs->previous != NULL)
+ vs->previous->next = vs->next;
+ else
+ v->segmentsHead = vs->next;
+ if (vs->next != NULL)
+ vs->next->previous = vs->previous;
+ else
+ v->segmentsTail = vs->previous;
+ FREE(vs->data);
+ FREE(vs);
+}
+
+
+/**
+ * Search for given index in the vector v. When the index is found, its
+ * segment and relative index are written to parameters vs and segment_index.
+ * If possible, an unused index at the end of a segment is returned, as this
+ * is also a requirement for adding data in an empty vector.
+ */
+static int vectorFindNewIndex(Vector * v,
+ unsigned int index,
+ VectorSegment **vs) {
+ VectorSegment *segment;
+ int segmentStartIndex;
+
+ if (index > v->size) {
+ *vs = NULL;
+ return -1;
+ }
+ if (index <= v->size / 2) { /* empty vector included */
+ segment = v->segmentsHead;
+ segmentStartIndex = 0;
+ while (index > segmentStartIndex + segment->size) {
+ segmentStartIndex += segment->size;
+ segment = segment->next;
+ }
+ } else { /* reverse */
+ segment = v->segmentsTail;
+ segmentStartIndex = v->size - segment->size;
+ while (index <= segmentStartIndex) {
+ segment = segment->previous;
+ segmentStartIndex -= segment->size;
+ }
+ }
+ *vs = segment;
+ return index - segmentStartIndex;
+}
+
+
+/**
+ * Find the segment and segmentIndex of the element
+ * with the given index.
+ */
+static int vectorFindIndex(Vector *v,
+ unsigned int index,
+ VectorSegment **vs) {
+ VectorSegment *segment;
+ int segmentStartIndex;
+
+ if (index >= v->size) {
+ *vs = NULL;
+ return -1;
+ }
+ if (index < v->size / 2) {
+ segment = v->segmentsHead;
+ segmentStartIndex = 0;
+ while (index >= segmentStartIndex + segment->size) {
+ segmentStartIndex += segment->size;
+ segment = segment->next;
+ }
+ } else {
+ segment = v->segmentsTail;
+ segmentStartIndex = v->size - segment->size;
+ while (index < segmentStartIndex) {
+ segment = segment->previous;
+ segmentStartIndex -= segment->size;
+ }
+ }
+ *vs = segment;
+ return index - segmentStartIndex;
+}
+
+
+/*
+ * Traverse the vector looking for a given object. When found, set the pointer
+ * pointed to by vs to point to the object's segment and the integer pointed
+ * to by segmentIndex to the object's index in the segment. If the object is
+ * not found, *vs is set to NULL.
+ */
+static void vectorFindObject(Vector *v,
+ void *object,
+ VectorSegment **vs,
+ int *segmentIndex) {
+ VectorSegment *segment;
+ int i;
+
+ segment = v->segmentsHead;
+ while (NULL != segment) {
+ for (i=0;i<segment->size;i++) {
+ if (segment->data[i] == object) {
+ *vs = segment;
+ *segmentIndex = i;
+ return;
+ }
+ }
+ segment = segment->next;
+ }
+ *vs = NULL;
+}
+
+
+/**
+ * Allocate a new vector structure with a single empty data segment.
+ */
+Vector * vectorNew(unsigned int vss) {
+ Vector *rvalue;
+
+ if (vss < 2)
+ return NULL; /* invalid! */
+ rvalue = MALLOC(sizeof (Vector));
+ rvalue->VECTOR_SEGMENT_SIZE = vss;
+ rvalue->size = 0;
+ rvalue->segmentsHead = MALLOC(sizeof(VectorSegment));
+ rvalue->segmentsHead->data = MALLOC(sizeof(void*)*vss);
+ rvalue->segmentsTail = rvalue->segmentsHead;
+ rvalue->segmentsHead->next = NULL;
+ rvalue->segmentsHead->previous = NULL;
+ rvalue->segmentsHead->size = 0;
+ rvalue->iteratorSegment = NULL;
+ rvalue->iteratorIndex = 0;
+ return rvalue;
+}
+
+/**
+ * Free vector structure including its data segments, but _not_ including the
+ * stored void pointers. It is the user's responsibility to empty the vector
+ * when necessary to avoid memory leakage.
+ */
+void vectorFree(Vector *v) {
+ VectorSegment * vs;
+ VectorSegment * vsNext;
+
+ vs = v->segmentsHead;
+ while (vs != NULL) {
+ vsNext = vs->next;
+ FREE(vs->data);
+ FREE(vs);
+ vs = vsNext;
+ }
+ FREE(v);
+}
+
+/**
+ * Return the size of the vector.
+ */
+size_t vectorSize(Vector *v) {
+ return v->size;
+}
+
+/**
+ * Insert a new element in the vector at given index. The return value is
+ * OK on success, SYSERR if the index is out of bounds.
+ */
+int vectorInsertAt(Vector *v,
+ void *object,
+ unsigned int index) {
+ VectorSegment *segment;
+ int segmentIndex;
+ int i;
+
+ if (index > v->size)
+ return SYSERR;
+ v->iteratorSegment = NULL;
+ segmentIndex = vectorFindNewIndex(v, index, &segment);
+ if (segmentIndex == -1)
+ return SYSERR;
+ for (i = segment->size; i > segmentIndex; i--)
+ segment->data[i] = segment->data[i - 1];
+ segment->data[segmentIndex] = object;
+ v->size++;
+ segment->size++;
+ if (segment->size == v->VECTOR_SEGMENT_SIZE)
+ vectorSegmentSplit(v, segment);
+ return OK;
+}
+
+/**
+ * Insert a new element at the end of the vector.
+ */
+void vectorInsertLast(Vector *v, void *object) {
+ v->iteratorSegment = NULL;
+ v->segmentsTail->data[v->segmentsTail->size++] = object;
+ if (v->segmentsTail->size == v->VECTOR_SEGMENT_SIZE)
+ vectorSegmentSplit(v, v->segmentsTail);
+ v->size++;
+}
+
+/**
+ * Return the element at given index in the vector or NULL if the index is out
+ * of bounds. The iterator is set to point to the returned element.
+ */
+void * vectorGetAt(Vector *v,
+ unsigned int index) {
+ int ret;
+ if ( (index < 0) || (index >= v->size) )
+ return NULL;
+ ret = vectorFindIndex(v,
+ index,
+ &v->iteratorSegment);
+ if (ret == -1)
+ return NULL;
+ v->iteratorIndex = ret;
+ return v->iteratorSegment->data[ret];
+}
+
+/**
+ * Return the first element in the vector, whose index is 0, or NULL if the
+ * vector is empty. The iterator of the vector is set to point to the first
+ * element.
+ */
+void * vectorGetFirst(Vector *v) {
+ if (v->size == 0)
+ return NULL;
+ v->iteratorSegment = v->segmentsHead;
+ v->iteratorIndex = 0;
+ return v->iteratorSegment->data[0];
+}
+
+/**
+ * Return the last element in the vector or NULL if the vector is
+ * empty. The iterator of the vector is set to the last element.
+ */
+void * vectorGetLast(Vector *v) {
+ if (v->size == 0)
+ return NULL;
+ v->iteratorSegment = v->segmentsTail;
+ v->iteratorIndex = v->segmentsTail->size-1;
+ return v->segmentsTail->data[v->iteratorIndex];
+}
+
+/**
+ * Return the next element in the vector, as called after vector_get_at() or
+ * vector_get_first(). The return value is NULL if there are no more elements
+ * in the vector or if the iterator has not been set.
+ */
+void * vectorGetNext(Vector *v) {
+ if (v->iteratorSegment == NULL)
+ return NULL;
+ if (++v->iteratorIndex >= v->iteratorSegment->size) {
+ if (v->iteratorSegment == v->segmentsTail) {
+ v->iteratorSegment = NULL;
+ return NULL;
+ } else {
+ v->iteratorSegment = v->iteratorSegment->next;
+ v->iteratorIndex = 0;
+ }
+ }
+ return v->iteratorSegment->data[v->iteratorIndex];
+}
+
+/**
+ * Return the previous element in the vector, as called after vector_get_at()
+ * or vector_get_last(). The return value is NULL if there are no more
+ * elements in the vector or if the iterator has not been set.
+ */
+void * vectorGetPrevious(Vector * v) {
+ if (v->iteratorSegment == NULL)
+ return NULL;
+ if (--v->iteratorIndex == -1) {
+ if (v->iteratorSegment == v->segmentsHead) {
+ v->iteratorSegment = 0;
+ return NULL;
+ } else {
+ v->iteratorSegment = v->iteratorSegment->previous;
+ v->iteratorIndex = v->iteratorSegment->size - 1;
+ }
+ }
+ return v->iteratorSegment->data[v->iteratorIndex];
+}
+
+/**
+ * Delete and return the element at given index. NULL is returned if index is
+ * out of bounds.
+ */
+void * vectorRemoveAt(Vector *v,
+ unsigned int index) {
+ VectorSegment * segment;
+ int segmentIndex;
+ void *rvalue;
+
+ if (index >= v->size)
+ return NULL;
+ v->iteratorSegment = NULL;
+ segmentIndex = vectorFindIndex(v, index, &segment);
+ if (segmentIndex == -1)
+ return NULL;
+ rvalue = vectorSegmentRemoveAtIndex(segment,
+ segmentIndex);
+ /* If the segment ends empty remove it, otherwise
+ try to join it with its neighbors. */
+ if (--segment->size == 0)
+ vectorSegmentRemove(v, segment);
+ else if (segment->next &&
+ segment->size + segment->next->size < v->VECTOR_SEGMENT_SIZE)
+ vectorSegmentJoin(v, segment);
+ else if (segment->previous &&
+ segment->size + segment->previous->size < v->VECTOR_SEGMENT_SIZE)
+ vectorSegmentJoin(v, segment->previous);
+ v->size--;
+ return rvalue;
+}
+
+/**
+ * Delete and return the last element in the vector, or NULL if the vector
+ * is empty.
+ */
+void *vectorRemoveLast (Vector *v) {
+ void *rvalue;
+
+ if (v->size == 0)
+ return NULL;
+ v->iteratorSegment = NULL;
+ rvalue = v->segmentsTail->data[v->segmentsTail->size - 1];
+ /* If the segment ends empty remove it, otherwise join it if necessary. */
+ if (--v->segmentsTail->size == 0)
+ vectorSegmentRemove(v, v->segmentsTail);
+ else if ( (v->segmentsTail->previous != NULL) &&
+ (v->segmentsTail->size + v->segmentsTail->previous->size
+ < v->VECTOR_SEGMENT_SIZE) )
+ vectorSegmentJoin (v, v->segmentsTail->previous);
+ v->size--;
+ return rvalue;
+}
+
+/**
+ * Delete and return given object from the vector, or return NULL if the object
+ * is not found.
+ */
+void * vectorRemoveObject(Vector *v, void *object) {
+ VectorSegment *segment;
+ int segmentIndex;
+ void * rvalue;
+
+ v->iteratorSegment = NULL;
+ vectorFindObject(v, object, &segment, &segmentIndex);
+ if (segment == NULL)
+ return NULL;
+ rvalue = vectorSegmentRemoveAtIndex(segment, segmentIndex);
+ /* If the segment ends empty remove it, otherwise join it if necessary. */
+ if (--segment->size == 0)
+ vectorSegmentRemove (v, segment);
+ else if ( (segment->next != NULL) &&
+ (segment->size + segment->next->size < v->VECTOR_SEGMENT_SIZE) )
+ vectorSegmentJoin (v, segment);
+ else if ( (segment->previous != NULL) &&
+ (segment->size + segment->previous->size < v->VECTOR_SEGMENT_SIZE) )
+ vectorSegmentJoin (v, segment->previous);
+ v->size--;
+ return rvalue;
+}
+
+/**
+ * Set the given index in the vector. The old value of the index is
+ * returned, or NULL if the index is out of bounds.
+ */
+void *vectorSetAt (Vector *v,
+ void *object,
+ unsigned int index) {
+ VectorSegment *segment;
+ int segmentIndex;
+ void *rvalue;
+
+ if (index >= v->size)
+ return NULL;
+ v->iteratorSegment = NULL;
+ segmentIndex = vectorFindIndex(v, index, &segment);
+ if (segmentIndex == -1)
+ return NULL;
+ rvalue = segment->data[segmentIndex];
+ segment->data[segmentIndex] = object;
+ return rvalue;
+}
+
+
+/**
+ * Set the index occupied by the given object to point to the new object.
+ * The old object is returned, or NULL if it's not found.
+ */
+void *vectorSetObject(Vector *v,
+ void *object,
+ void *oldObject) {
+ VectorSegment *segment;
+ int segmentIndex;
+ void *rvalue;
+
+ v->iteratorSegment = NULL;
+ vectorFindObject (v, oldObject, &segment, &segmentIndex);
+ if (segment == NULL)
+ return NULL;
+ rvalue = segment->data[segmentIndex];
+ segment->data[segmentIndex] = object;
+ return rvalue;
+}
+
+
+/**
+ * Swaps the contents of index1 and index2. Return value is OK
+ * on success, SYSERR if either index is out of bounds.
+ */
+int vectorSwap(Vector *v,
+ unsigned int index1,
+ unsigned int index2) {
+ VectorSegment * segment1;
+ VectorSegment * segment2;
+ int segmentIndex1;
+ int segmentIndex2;
+ void *temp;
+
+ if ( (index1 >= v->size) ||
+ (index2 >= v->size) )
+ return SYSERR;
+ v->iteratorSegment= NULL;
+ segmentIndex1 = vectorFindIndex(v, index1, &segment1);
+ segmentIndex2 = vectorFindIndex(v, index2, &segment2);
+ if( (segmentIndex1 == -1) ||
+ (segmentIndex2 == -1) )
+ return SYSERR;
+ temp = segment1->data[segmentIndex1];
+ segment1->data[segmentIndex1] = segment2->data[segmentIndex2];
+ segment2->data[segmentIndex2] = temp;
+ return OK;
+}
+
+/**
+ * Return the index of given element or -1 if the element is not found.
+ */
+unsigned int vectorIndexOf(Vector *v,
+ void *object) {
+ VectorSegment * segment;
+ unsigned int i;
+ unsigned int segmentStartIndex;
+
+ segmentStartIndex = 0;
+ segment = v->segmentsHead;
+ while (NULL != segment) {
+ for (i = 0; i < segment->size; i++)
+ if (segment->data[i] == object)
+ return segmentStartIndex + i;
+ segmentStartIndex += segment->size;
+ segment = segment->next;
+ }
+ return (unsigned int) -1;
+}
+
+
+/*
+ * Return the data stored in the vector as a single dynamically allocated
+ * array of (void *), which must be free(3)d by the user. Use the functions
+ * get_{at,first,last,next,previous} instead, unless you really need to access
+ * everything in the vector as fast as possible.
+ */
+void ** vectorElements (Vector *v) {
+ void **rvalue;
+ VectorSegment *vs;
+ size_t i = 0;
+
+ rvalue = xmalloc_unchecked_(v->size * sizeof (void *),
+ __FILE__,
+ __LINE__);
+ for (vs = v->segmentsHead; vs; vs = vs->next) {
+ memcpy (rvalue + i,
+ vs->data,
+ vs->size * sizeof (void *));
+ i += vs->size;
+ }
+ return rvalue;
+}
+
+
+
+/* end of vector.c */
Added: GNUnet/src/util/containers/vectortest.c
===================================================================
--- GNUnet/src/util/containers/vectortest.c 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/containers/vectortest.c 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,144 @@
+/*
+ This file is part of GNUnet
+
+ 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.
+*/
+
+/**
+ * This is a testcase for the vector, waiting to be extended.
+ */
+
+#include "platform.h"
+#include "gnunet_util.h"
+
+#define DUMP(v) fprintf(stderr, "At %d: \n", __LINE__); vectorDump(v);
+
+static int test(int size) {
+ struct Vector * v;
+
+ v = vectorNew(size);
+ if (0 != vectorSize(v))
+ { DUMP(v); return 1; }
+ if (OK != vectorInsertAt(v, "first", 0))
+ { DUMP(v); return 1; }
+ if (OK == vectorInsertAt(v, "not", 2))
+ { DUMP(v); return 1; }
+ if (OK != vectorInsertAt(v, "zero", 0))
+ { DUMP(v); return 1; }
+ if (OK != vectorInsertAt(v, "second", 2))
+ { DUMP(v); return 1; }
+ vectorInsertLast(v, "third");
+ if (4 != vectorSize(v))
+ { DUMP(v); return 1; }
+ if (0 != strcmp(vectorGetAt(v, 1), "first"))
+ { DUMP(v); return 1; }
+ if (0 != strcmp(vectorGetAt(v, 3), "third"))
+ { DUMP(v); return 1; }
+ if (0 != strcmp(vectorGetAt(v, 0), "zero"))
+ { DUMP(v); return 1; }
+ if (0 != strcmp(vectorGetFirst(v), "zero"))
+ { DUMP(v); return 1; }
+ if (0 != strcmp(vectorGetLast(v), "third"))
+ { DUMP(v); return 1; }
+ if (0 != strcmp(vectorRemoveAt(v, 1), "first"))
+ { DUMP(v); return 1; }
+ if (0 != strcmp(vectorGetAt(v, 1), "second"))
+ { DUMP(v); return 1; }
+ if (NULL != vectorRemoveAt(v, 3))
+ { DUMP(v); return 1; }
+ if (3 != vectorSize(v))
+ { DUMP(v); return 1; }
+ if (0 != strcmp(vectorRemoveAt(v, 1), "second"))
+ { DUMP(v); return 1; }
+ if (0 != strcmp(vectorRemoveObject(v, "third"), "third"))
+ { DUMP(v); return 1; }
+ if (NULL != vectorRemoveObject(v, "third"))
+ { DUMP(v); return 1; }
+ if (0 != strcmp(vectorRemoveLast(v), "zero"))
+ { DUMP(v); return 1; }
+ if (0 != vectorSize(v))
+ { DUMP(v); return 1; }
+ if (NULL != vectorRemoveLast(v))
+ { DUMP(v); return 1; }
+ if (0 != vectorSize(v))
+ { DUMP(v); return 1; }
+ vectorFree(v);
+ return 0;
+}
+
+static int test2(int size) {
+ long i;
+ struct Vector * v;
+
+ v = vectorNew(size);
+
+ for (i=0;i<500;i++)
+ if (OK != vectorInsertAt(v, (void*)i, 0))
+ { DUMP(v); return 1; }
+ if (500 != vectorSize(v))
+ { DUMP(v); return 1; }
+ for (i=0;i<500;i++)
+ if (499 - i != (long) vectorGetAt(v, i))
+ { DUMP(v); return 1; }
+ if (499 != (long) vectorGetFirst(v))
+ { DUMP(v); return 1; }
+ for (i=498;i>=0;i--)
+ if (i != (long) vectorGetNext(v))
+ { DUMP(v); return 1; }
+
+ if (499 != (long) vectorGetFirst(v))
+ { DUMP(v); return 1; }
+ for (i=498;i>=250;i--)
+ if (i != (long) vectorGetNext(v))
+ { DUMP(v); return 1; }
+ for (i=251;i<499;i++)
+ if (i != (long) vectorGetPrevious(v))
+ { DUMP(v); return 1; }
+
+ vectorFree(v);
+ return 0;
+}
+
+
+int main(int argc,
+ char * argv[]) {
+ if (NULL != vectorNew(0))
+ { printf("At %d\n", __LINE__); return 1; }
+ if (NULL != vectorNew(1))
+ { printf("At %d\n", __LINE__); return 1; }
+ if (test(2) != 0)
+ { printf("At %d\n", __LINE__); return 1; }
+ if (test(3) != 0)
+ { printf("At %d\n", __LINE__); return 1; }
+ if (test(4) != 0)
+ { printf("At %d\n", __LINE__); return 1; }
+ if (test(128) != 0)
+ { printf("At %d\n", __LINE__); return 1; }
+ if (test(65536) != 0)
+ { printf("At %d\n", __LINE__); return 1; }
+ if (test(2*65536) != 0)
+ { printf("At %d\n", __LINE__); return 1; }
+
+ if (test2(2) != 0)
+ { printf("At %d\n", __LINE__); return 1; }
+ if (test2(3) != 0)
+ { printf("At %d\n", __LINE__); return 1; }
+ if (test2(4) != 0)
+ { printf("At %d\n", __LINE__); return 1; }
+ if (test2(128) != 0)
+ { printf("At %d\n", __LINE__); return 1; }
+ return 0;
+}
Deleted: GNUnet/src/util/crctest.c
===================================================================
--- GNUnet/src/util/crctest.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/crctest.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,22 +0,0 @@
-/**
- * @file util/crctest.c
- * @brief testcase for util/checksum.c
- */
-
-#include "gnunet_util.h"
-
-static int expected[] = {
--1223996378, 929797997, -1048047323, 1791081351, -425765913, 2138425902,
82584863, 1939615314, 1806463044, -1505003452, 1878277636, -997353517,
201238705, 1723258694, -1107452366, -344562561, -1102247383, 1973035265,
715213337, -1886586005, 2021214515, -1387332962, 593019378, -571088044,
1412577760, 412164558, -1626111170, 1556494863, -289796528, -850404775,
2066714587, -911838105, -1426027382, 499684507, -835420055, 1817119454,
-1221795958, 1516966784, -1038806877, -2115880691, 532627620, 1984437415,
-396341583, -1345366324, -590766745, -1801923449, 1752427988, -386896390,
453906317, 1552589433, -858925718, 1160445643, -740188079, -486609040,
1102529269, -515846212, -1614217202, 1572162207, 943558923, -467330358,
-1870764193, 1477005328, -793029208, -888983175, -696956020, 842706021,
1642390067, -805889494, 1284862057, 1562545388, 2091626273, 1852404553,
-2076508101, 370903003, 1186422975, 1936085227, 769358463, 180401058,
2032612572, -105461719, -1119935472, 617249831, 1169304728, 1771205256,
-2042554284, 653270859, -918610713, 336081663, -913685370, 1962213744,
-505406126, -838622649, -1141518710, 893143582, -1330296611, 122119483,
1111564496, 688811976, 1016241049, -1803438473, 359630107, 1034798954,
-581359286, 1590946527, -389997034, 2020318460, 1695967527, -464069727,
-862641495, -1405012109, -771244841, 738226150, -1035328134, -933945474,
1254965774, 1661863830, -884127998, 1800460481, 814702567, -1214068102,
-541120421, 1898656429, -236825530, 1505866267, 1252462132, -981007520,
1502096471, -2134644056, 483221797, 1276403836, 541133290, -1234093967,
350748780, 257941070, 1030457090, 434988890, -1098135432, -1000556640,
-577128022, 644806294, -787536281, -1288346343, 998079404, 1259353935,
955771631, -958377466, 1746756252, 451579658, 1913409243, -952026299,
-1556035958, -830279881, 834744289, -1878491428, 700000962, -1027245802,
1393574384, -1260409147, -841420884, 892132797, 1494730226, -1649181766,
1651097838, -1041807403, -1916675721, -1324525963, 157405899, -655788033,
-1943555237, -79747022, 339721623, -138341083, 1111902411, -435322914,
-533294200, -190220608, -1718346014, -1631301894, 1706265243, 745533899,
1351941230, 1803009594, -1218191958, 1467751062, 84368433, -711251880,
1699423788, -768792716, 846639904, 2103267723, -2095288070, -440571408,
-362144485, 2020468971, 352105963, -849211036, -1272592429, 1743440467,
2020667861, -1649992312, 172682343, 816705364, -1990206923, 902689869,
-298510060, 164207498, 190378213, 242531543, 113383268, 304810777, -1081099373,
819221134, -1100982926, -855941239, 1091308887, -934548124, 520508733,
-1381763773, -491593287, -2143492665, 700894653, -2049034808, -160942046,
-2009323577, 1464245054, 1584746011, -768646852, -993282698, 1265838699,
-1873820824, 575704373, -986682955, 1270688416, 88587481, -1723991633,
-409928242, 866669946, -483811323, -181759253, -963525431, -1686612238,
-1663460076, -1128449775, -1368922329, 122318131, 795862385, 528576131,
-19927090, 1369299478, 1285665642, -738964611, 1328292127, 552041252,
-1431494354, -1205275362, 42768297, -1329537238, -449177266, 943925221,
987016465, -945138414, -270064876, 1650366626, -369252552, 582030210,
-1229235374, 147901387, -517510506, -1609742888, -1086838308, 1391998445,
-313975512, -613392078, 855706229, 1475706341, -1112105406, 2032001400,
1565777625, 2030937777, 435522421, 1823527907, -691390605, -827253664,
1057171580, -314146639, -630099999, -1347514552, 478716232, -1533658804,
-1425371979, 761987780, 1560243817, -1945893959, 1205759225, -959343783,
-576742354, -154125407, -1158108776, 1183788580, 1354198127, -1534207721,
-823991517, -170534462, -912524170, 1858513573, 467072185, 2091040157,
-1765027018, -1659401643, -1173890143, -1912754057, -84568053, 2010781784,
-921970156, 944508352, -922040609, 1055102010, 1018688871, -1186761311,
-2012263648, 1311654161, 277659086, 2029602288, 1127061510, 1029452642,
285677123, -188521091, -641039012, 653836416, -805916340, -1644860596,
1352872213, 691634876, -1477113308, -748430369, 1030697363, -2007864449,
-1196662616, 1313997192, 177342476, -566676450, -1118618118, 1697953104,
344671484, -1489783116, -889507873, 1259591310, -716567168, 2116447062,
324368527, 1789366816, 1558930442, 1950250221, -785460151, 1174714258,
-430047304, -859487565, -580633932, 607732845, -1128150220, 1544355315,
1460298016, -1771194297, 1215703690, 277231808, -416020628, -418936577,
-1724839216, 404731389, 1058730508, -1508366681, 229883053, -572310243,
1883189553, 931286849, 1659300867, -94236383, -241524462, 548020458,
-302406981, 579986475, 73468197, -984957614, 1554382245, 2084807492,
-1456802798, -1105192593, 629440327, -16313961, -2102585261, 1873675206,
161035128, 1497033351, 1990150811, -499405222, 304019482, 41935663, -805987182,
-571699268, 1748462913, 2096239823, -116359807, -1871127553, -1074832534,
-1558866192, 231353861, 2122854560, -2102323721, -281462361, -343403210,
-673268171, 1776058383, 1581561150, 2059580579, 768848632, 1347190372,
-1701705879, 245282007, -563267886, -592558289, 1662399958, 1390406821,
-1522485580, -706446863, 2069516289, -301855859, -778346387, -1454093198,
1249083752, -1760506745, 262193320, 630751125, -1495939124, -29980580,
-1989626563, 659039376, -329477132, -1003507166, -1322549020, 358606508,
-2052572059, 1848014133, 1826958586, -1004948862, -1775370541, 2134177912,
-1739214473, 1892700918, 926629675, -1042761322, 2020075900, 606370962,
-1256609305, 117577265, -586848924, 191368285, 1653535275, -1329269701,
-375879127, -1089901406, 1206489978, 534223924, -1042752982, -1178316881,
-445594741, -1501682065, -1598136839, -467688289, 750784023, 1781080461,
1729380226, 16906088, 862168532, -2037752683, 1455274138, -1491220107,
1058323960, 1711530558, 1355062750, 227640096, 396568027, -173579098,
-408975801, -993618329, -1470751562, 371076647, 209563718, 2015405719,
-723460281, -1423934420, -2089643958, 353260489, 2084264341, -792676687,
701391030, -1440658244, 1479321011, 1907822880, 1232524257, -256712289,
401077577, 621808069, 868263613, 1244930119, 2020996902, 117483907, 1341376744,
-1936988014, -445200547, -843751811, -435291191, 1041695743, 476132726,
-1226874735, -1436046747, -297047422, 1739645396, 1948680937, -718144374,
1141983978, 1673650568, -197244350, 1604464002, 1424069853, -485626505,
1708710014, -849136541, 1573778103, 530360999, 1777767203, 1376958336,
-1088364352, 1826167753, 742735448, -1386211659, -1991323164, -444115655,
-443055378, -1586901006, -1741686587, 1925818034, -2118916824, 803890920,
-1481793154, 992278937, 1302616410, 444517030, 1393144770, -2025632978,
1902300505, -1683582981, 800654133, 873850324, -619580878, -2002070410,
-2024936385, 1978986634, 2012024264, 675768872, 389435615, -867217540,
231209167, -303917385, 1445676969, -1385982721, 1310476490, 580273453,
-160600202, -1330895874, 487110497, 1124384798, 227637416, -1829783306,
1014818058, -1336870683, -1042199518, -468525587, -1186267363, -472843891,
1215617600, -2056648329, -873216891, 156780951, -1883246047, -842549253,
-717684332, 760531638, 1074787431, 786267513, 814031289, -561255343,
-110302255, -1837376592, 989669060, -81350614, 546038730, 222899882,
1298746805, 1791615733, 1565630269, 1516024174, 421691479, 1860326051,
-1973359550, 1854393443, -1401468528, -158562295, 1509929255, -124024738,
-462937489, 259890715, -1515121317, -289511197, -913738664, 698079062,
-1631229382, -507275144, 1897739663, -1118192766, -1687033399, 61405556,
-1913606579, -473308896, -259107170, -576944609, -1689355510, 322156799,
545090192, 127425176, -1815211748, -2070235628, -1172529316, 599259550,
-910906653, 1797380363, -938649427, 142991392, 504559631, 1208867355,
-807699247, -616021271, -254935281, -57151221, -1095534993, 1998380318,
1772459584, 713271407, -1197898266, 808881935, -308133481, -1314455137,
284321772, -743117625, -1622364240, -1667535152, 118713606, 1053615347,
-2072876023, -178189072, -828319551, 2047304928, -1311435786, -1970672907,
-747972100, 86806159, -436088421, 1464645587, 735840899, 32600466, -190473426,
-735703440, 482872155, 475662392, -713681085, 1424078728, -150668609,
-1137197868, -1682762563, -48035649, 1143959866, -1542015129, 284920371,
-1587695586, -625236551, -753893357, -433976266, -1329796037, -1636712478,
1686783454, 27839146, 1748631474, -879528256, 2057796026, 773734654, 112269667,
-2011541314, 1517797297, -1943171794, 268166111, -1037010413, -1945824504,
-1672323792, 306260758, -692968628, -701704965, -462980996, 939188824,
553289792, 1790245000, 2093793129, -658085781, -186055037, -2130433650,
-1013235433, 1190870089, -2126586963, -1509655742, -1291895256, -1427857845,
309538950, 388316741, 259659733, -1895092434, 110126220, -170175575,
-419430224, -696234084, -832170948, -353431720, -797675726, -1644136054,
715163272, -1305904349, -145786463, -99586244, -695450446, -871327102,
-725496060, 952863853, -688441983, -1729929460, -103732092, 1059054528,
568873585, -982665223, -128672783, 2099418320, 1508239336, -2089480835,
-390935727, 664306522, -1607364342, -163246802, -1121295140, -128375779,
-615694409, -2079391797, 760542037, 677761593, -750117849, -1060525080,
2128437080, 525250908, 1987657172, 2032530557, -2011247936, 1942775263,
1681562788, 688229491, -803856505, 684707948, 1308988965, 1455480037,
790659611, 1557968784, -383203149, -361510986, -742575828, 558837193,
-1214977424, 1253274105, -119513513, -993964385, -33438767, -177452803,
1186928041, -2073533871, 1188528559, 1896514695, 1200128512, 1930588755,
-1914141443, 1534656032, -1192989829, -1848274656, -220848455, 1001806509,
1298797392, 1533031884, -1912322446, 1705583815, 1568094347, -1397640627,
807828512, -1852996497, -1529733505, -1575634185, -1280270160, -1567624159,
-1861904922, 1276738579, 1163432999, 626879833, 316942006, -1871138342,
1341039701, 1595907877, 1950911580, 1634717748, 1071476055, -809354290,
-1161553341, -2081621710, -2085557943, 19360224, 322135580, -698485151,
1267663094, -233890834, -126361189, -1426257522, 1094007921, 500179855,
-283548002, -1678987343, 1946999943, 1489410849, 2089571262, 1430799093,
1961848046, -99462663, -552833264, 1168700661, -1783882181, 2089196401,
1092839657, 914488673, 80263859, -2140947098, -726384741, -1022448237,
2113887675, 1485770846, -112922517, 1995461466, 774613726, 944068011,
1521975359, 289086919, -386920759, -1960513175, 358460021, -238698524,
-1913640563, -1000324864, 1731755224, -1271586254, -1917469655, 2134162829,
-828097534, -1089292503, -1514835999, 1682931514, -482307169, 2110243841,
115744834, -2038340170, 65889188, -539445712, -1713206408, -1842396726,
-1659545588, -909558923, 860164922, 1328713040, 1044007120, -2103807103,
-1073990344, -1312783785, -884980824, -705318011, -1263408788, -2032228692,
-1732844111, -1813827156, 1462566279, 1179250845, 1732421772, 604429013,
-92284336, -1192166516, 304654351, 1998552034, -1802461575, -1802704071,
-1704833934, -976264396, 1005840702, 2108843914, 1363909309, 843040834,
-1039625241, 1285007226, 91610001, 418426329, 678422358, -945360697,
-440008081, -1053091357, 425719777, -1372778676, 591912153, 1229089037,
-56663158, 2140251400, 830257037, 763914157, 175610373, -2105655963,
-1040826150, 1174443038, 339290593, 346618443, -180504100, -1363190515,
210620018, 1028894425, 573529714, 698460117, 136999397, 1015621712,
-1401813739, -297990684, -1820934845, -1299093313, 1299361369, -366522415,
91527707, 1113466178, -956229484, 22204763, -1394374195, -1912666711,
-1453789804, 1613408399, -169509567, 1350520309, 540761213, -2086682848,
1095131491, -812787911, 1860108594, -1121378737, -1667252487, -486084366,
166519760, 1609891237, 728218405, 291075010, 646168382, 108462277, -1616661910,
1016600360, 2099958568, 27934736, 183821196, 13660496, -805589719, 936068730,
-439037934, 1414622584, 215845485, -1352304469, -1817427526, -1318710977,
-110207199, 228524335, 1704746590, 998293651, -1521016702, -641956531,
-2089808167, 2094404052, -1446381065, -662186492, 1670154584, 9637833,
493925511, 660047318, 1197537103, 1696017374, -204994399, -1104145601,
-852330465, -1936369658, -829716674, -1255255217, 1264013799, 1642611772,
-652520861, 777247164, 2028895987, -1424241853, -54367829, -1940161761,
-1802831079, -449405299, 838242661, -323055438, 794295411, -136989378,
-446686673, -421252799, -16777216,
-};
-
-int main(int argc, char * argv[]){
- char buf[1024];
- int i;
-
- for (i=0;i<1024;i++)
- buf[i] = (char)i;
- for (i=0;i<1024;i++)
- if (expected[i] != crc32N(&buf[i], 1024-i))
- return 1;
- return 0;
-}
Modified: GNUnet/src/util/cron.c
===================================================================
--- GNUnet/src/util/cron.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/cron.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- (C) 2001, 2002 Christian Grothoff (and other contributing authors)
+ (C) 2001, 2002, 2003, 2004, 2005, 2006 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
@@ -166,8 +166,9 @@
static void noJob(void * unused) {
#if DEBUG_CRON
- LOG(LOG_CRON,
- "In noJob.\n");
+ GE_LOG(NULL,
+ GE_STATUS | GE_DEVELOPER | GE_BULK,
+ "In noJob.\n");
#endif
}
@@ -178,8 +179,9 @@
void * unused;
#if DEBUG_CRON
- LOG(LOG_INFO,
- _("Stopping cron\n"));
+ GE_LOG(NULL,
+ GE_STATUS | GE_DEVELOPER | GE_BULK,
+ "Stopping cron\n");
#endif
cron_shutdown = YES;
addCronJob(&noJob, 0, 0, NULL);
@@ -188,8 +190,9 @@
cron_signal = NULL;
PTHREAD_JOIN(&cron_handle, &unused);
#if DEBUG_CRON
- LOG(LOG_INFO,
- _("Cron stopped\n"));
+ GE_LOG(NULL,
+ GE_STATUS | GE_DEVELOPER | GE_BULK,
+ "Cron stopped\n");
#endif
}
@@ -223,8 +226,8 @@
void suspendCron() {
Semaphore * blockSignal;
- GNUNET_ASSERT(cron_shutdown == NO);
- GNUNET_ASSERT(NO == PTHREAD_SELF_TEST(&cron_handle));
+ GE_ASSERT(NULL, cron_shutdown == NO);
+ GE_ASSERT(NULL, NO == PTHREAD_SELF_TEST(&cron_handle));
MUTEX_LOCK(&inBlockLock_);
inBlock++;
if (inBlock == 1) {
@@ -250,7 +253,7 @@
* Resume running cron-jobs.
*/
void resumeCron() {
- GNUNET_ASSERT(inBlock > 0);
+ GE_ASSERT(NULL, inBlock > 0);
SEMAPHORE_UP(cron_signal_up);
}
@@ -286,12 +289,13 @@
jobId = firstUsed_;
while (jobId != -1) {
tab = &deltaList_[jobId];
- LOG(LOG_CRON,
- "%3u: delta %8lld CU --- method %p --- repeat %8u CU\n",
- jobId,
- tab->delta - now,
- (int)tab->method,
- tab->deltaRepeat);
+ GE_LOG(NULL,
+ GE_STATUS | GE_DEVELOPER | GE_BULK,
+ "%3u: delta %8lld CU --- method %p --- repeat %8u CU\n",
+ jobId,
+ tab->delta - now,
+ (int)tab->method,
+ tab->deltaRepeat);
jobId = tab->next;
}
MUTEX_UNLOCK(&deltaListLock_);
@@ -319,10 +323,11 @@
int jobId;
#if DEBUG_CRON
- LOG(LOG_CRON,
- "Advancing job %p-%p\n",
- method,
- data);
+ GE_LOG(NULL,
+ GE_STATUS | GE_DEVELOPER | GE_BULK,
+ "Advancing job %p-%p\n",
+ method,
+ data);
#endif
MUTEX_LOCK(&deltaListLock_);
jobId = firstUsed_;
@@ -331,10 +336,10 @@
if ( (method != runningJob_) ||
(data != runningData_) ||
(deltaRepeat != runningRepeat_) ) {
- BREAK();
- LOG(LOG_WARNING,
- _("`%s' called with cron job not in queue, adding. This may not be
what you want.\n"),
- __FUNCTION__);
+ GE_LOG(NULL,
+ GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK,
+ _("`%s' called with cron job not in queue, adding. This may not
be what you want.\n"),
+ __FUNCTION__);
addCronJob(method,
0,
deltaRepeat,
@@ -397,11 +402,12 @@
int current;
#if DEBUG_CRON
- LOG(LOG_CRON,
- "Adding job %p-%p to fire in %d CU\n",
- method,
- data,
- delta);
+ GE_LOG(NULL,
+ GE_STATUS | GE_DEVELOPER | GE_BULK,
+ "Adding job %p-%p to fire in %d CU\n",
+ method,
+ data,
+ delta);
#endif
MUTEX_LOCK(&deltaListLock_);
@@ -505,29 +511,32 @@
/* re-insert */
if (repeat > 0) {
#if DEBUG_CRON
- LOG(LOG_CRON,
- "adding periodic job %p-%p to run again in %u\n",
- method,
- data,
- repeat);
+ GE_LOG(NULL,
+ GE_STATUS | GE_DEVELOPER | GE_BULK,
+ "adding periodic job %p-%p to run again in %u\n",
+ method,
+ data,
+ repeat);
#endif
addCronJob(method, repeat, repeat, data);
}
/* run */
#if DEBUG_CRON
- LOG(LOG_CRON,
- "running job %p-%p\n",
- method,
- data);
+ GE_LOG(NULL,
+ GE_STATUS | GE_DEVELOPER | GE_BULK,
+ "running job %p-%p\n",
+ method,
+ data);
#endif
method(data);
MUTEX_LOCK(&deltaListLock_);
runningJob_ = NULL;
#if DEBUG_CRON
- LOG(LOG_CRON,
- "job %p-%p done\n",
- method,
- data);
+ GE_LOG(NULL,
+ GE_STATUS | GE_DEVELOPER | GE_BULK,
+ "job %p-%p done\n",
+ method,
+ data);
#endif
}
@@ -556,8 +565,9 @@
#endif
runJob();
#if DEBUG_CRON
- LOG(LOG_CRON,
- "job run, new table is\n");
+ GE_LOG(NULL,
+ GE_STATUS | GE_DEVELOPER | GE_BULK,
+ "job run, new table is\n");
printCronTab();
#endif
} else
@@ -566,29 +576,32 @@
MUTEX_UNLOCK(&deltaListLock_);
next = next - now; /* how long to sleep */
#if DEBUG_CRON
- LOG(LOG_CRON,
- "Sleeping at %llu for %llu CU (%llu s, %llu CU)\n",
- now,
- next,
- next / cronSECONDS,
- next);
+ GE_LOG(NULL,
+ GE_STATUS | GE_DEVELOPER | GE_BULK,
+ "Sleeping at %llu for %llu CU (%llu s, %llu CU)\n",
+ now,
+ next,
+ next / cronSECONDS,
+ next);
#endif
if (next > MAXSLEEP)
next = MAXSLEEP;
if (cron_shutdown == NO)
gnunet_util_sleep(next);
#if DEBUG_CRON
- LOG(LOG_CRON,
- "woke up at %llu - %lld CS late\n",
- cronTime(NULL),
- cronTime(NULL)-(now+next));
+ GE_LOG(NULL,
+ GE_STATUS | GE_DEVELOPER | GE_BULK,
+ "woke up at %llu - %lld CS late\n",
+ cronTime(NULL),
+ cronTime(NULL)-(now+next));
#endif
}
SEMAPHORE_UP(cron_signal);
#if DEBUG_CRON
- LOG(LOG_CRON,
- "Cron thread exits.\n");
- printCronTab();
+ GE_LOG(NULL,
+ GE_STATUS | GE_DEVELOPER | GE_BULK,
+ "Cron thread exits.\n");
+ printCronTab();
#endif
return NULL;
}
@@ -616,16 +629,18 @@
* Start the cron jobs.
*/
void startCron() {
- GNUNET_ASSERT(cron_signal == NULL);
+ GE_ASSERT(NULL, cron_signal == NULL);
cron_shutdown = NO;
cron_signal = SEMAPHORE_NEW(0);
+ /* large stack, we don't know for sure
+ what the cron jobs may be doing */
if (0 != PTHREAD_CREATE(&cron_handle,
&cron,
NULL,
256 * 1024))
- DIE_STRERROR("pthread_create");
- /* large stack, we don't know for sure
- what the cron jobs may be doing */
+ GE_DIE_STRERROR(NULL,
+ GE_FATAL | GE_ADMIN | GE_USER | GE_BULK,
+ "pthread_create");
}
@@ -643,17 +658,18 @@
* @return the number of jobs removed
*/
int delCronJob(CronJob method,
- unsigned int repeat,
- void * data) {
+ unsigned int repeat,
+ void * data) {
UTIL_cron_DeltaListEntry * job;
UTIL_cron_DeltaListEntry * last;
int jobId;
#if DEBUG_CRON
- LOG(LOG_CRON,
- "deleting job %p-%p\n",
- method,
- data);
+ GE_LOG(NULL,
+ GE_STATUS | GE_DEVELOPER | GE_BULK,
+ "deleting job %p-%p\n",
+ method,
+ data);
#endif
MUTEX_LOCK(&deltaListLock_);
jobId = firstUsed_;
Added: GNUnet/src/util/crypto/.deps/crc32.Plo
===================================================================
--- GNUnet/src/util/crypto/.deps/crc32.Plo 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/crypto/.deps/crc32.Plo 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1 @@
+# dummy
Added: GNUnet/src/util/crypto/.deps/crctest.Po
===================================================================
--- GNUnet/src/util/crypto/.deps/crctest.Po 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/crypto/.deps/crctest.Po 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1 @@
+# dummy
Added: GNUnet/src/util/crypto/.deps/hashing.Plo
===================================================================
--- GNUnet/src/util/crypto/.deps/hashing.Plo 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/crypto/.deps/hashing.Plo 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1 @@
+# dummy
Added: GNUnet/src/util/crypto/.deps/hashingtest.Po
===================================================================
--- GNUnet/src/util/crypto/.deps/hashingtest.Po 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/crypto/.deps/hashingtest.Po 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1 @@
+# dummy
Added: GNUnet/src/util/crypto/.deps/hashtest.Po
===================================================================
--- GNUnet/src/util/crypto/.deps/hashtest.Po 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/crypto/.deps/hashtest.Po 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1 @@
+# dummy
Added: GNUnet/src/util/crypto/.deps/hostkey_gcrypt.Plo
===================================================================
--- GNUnet/src/util/crypto/.deps/hostkey_gcrypt.Plo 2006-06-15 16:42:32 UTC
(rev 3010)
+++ GNUnet/src/util/crypto/.deps/hostkey_gcrypt.Plo 2006-06-15 16:49:28 UTC
(rev 3011)
@@ -0,0 +1 @@
+# dummy
Added: GNUnet/src/util/crypto/.deps/hostkeytest.Po
===================================================================
--- GNUnet/src/util/crypto/.deps/hostkeytest.Po 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/crypto/.deps/hostkeytest.Po 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1 @@
+# dummy
Added: GNUnet/src/util/crypto/.deps/kblockkey.Plo
===================================================================
--- GNUnet/src/util/crypto/.deps/kblockkey.Plo 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/crypto/.deps/kblockkey.Plo 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1 @@
+# dummy
Added: GNUnet/src/util/crypto/.deps/kblockkey_test.Po
===================================================================
--- GNUnet/src/util/crypto/.deps/kblockkey_test.Po 2006-06-15 16:42:32 UTC
(rev 3010)
+++ GNUnet/src/util/crypto/.deps/kblockkey_test.Po 2006-06-15 16:49:28 UTC
(rev 3011)
@@ -0,0 +1 @@
+# dummy
Added: GNUnet/src/util/crypto/.deps/locking_gcrypt.Plo
===================================================================
--- GNUnet/src/util/crypto/.deps/locking_gcrypt.Plo 2006-06-15 16:42:32 UTC
(rev 3010)
+++ GNUnet/src/util/crypto/.deps/locking_gcrypt.Plo 2006-06-15 16:49:28 UTC
(rev 3011)
@@ -0,0 +1 @@
+# dummy
Added: GNUnet/src/util/crypto/.deps/random.Plo
===================================================================
--- GNUnet/src/util/crypto/.deps/random.Plo 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/crypto/.deps/random.Plo 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1 @@
+# dummy
Added: GNUnet/src/util/crypto/.deps/symcipher_gcrypt.Plo
===================================================================
--- GNUnet/src/util/crypto/.deps/symcipher_gcrypt.Plo 2006-06-15 16:42:32 UTC
(rev 3010)
+++ GNUnet/src/util/crypto/.deps/symcipher_gcrypt.Plo 2006-06-15 16:49:28 UTC
(rev 3011)
@@ -0,0 +1 @@
+# dummy
Added: GNUnet/src/util/crypto/.deps/symciphertest.Po
===================================================================
--- GNUnet/src/util/crypto/.deps/symciphertest.Po 2006-06-15 16:42:32 UTC
(rev 3010)
+++ GNUnet/src/util/crypto/.deps/symciphertest.Po 2006-06-15 16:49:28 UTC
(rev 3011)
@@ -0,0 +1 @@
+# dummy
Added: GNUnet/src/util/crypto/Makefile
===================================================================
--- GNUnet/src/util/crypto/Makefile 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/crypto/Makefile 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,846 @@
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# src/util/crypto/Makefile. Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 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.
+
+
+
+SOURCES = $(libgnunetutil_crypto_la_SOURCES) $(crctest_SOURCES)
$(hashingtest_SOURCES) $(hashtest_SOURCES) $(hostkeytest_SOURCES)
$(kblockkey_test_SOURCES) $(symciphertest_SOURCES)
+
+srcdir = .
+top_srcdir = ../../..
+
+pkgdatadir = $(datadir)/GNUnet
+pkglibdir = $(libdir)/GNUnet
+pkgincludedir = $(includedir)/GNUnet
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = /usr/bin/install -c
+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 = :
+host_triplet = i686-pc-linux-gnu
+check_PROGRAMS = crctest$(EXEEXT) hashtest$(EXEEXT) \
+ hashingtest$(EXEEXT) hostkeytest$(EXEEXT) \
+ kblockkey_test$(EXEEXT) symciphertest$(EXEEXT)
+subdir = src/util/crypto
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-2.0.m4 \
+ $(top_srcdir)/m4/guile.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/libgcrypt.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(libdir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libgnunetutil_crypto_la_DEPENDENCIES = \
+ $(top_builddir)/src/util/libgnunetutil.la
+am_libgnunetutil_crypto_la_OBJECTS = crc32.lo hashing.lo \
+ hostkey_gcrypt.lo kblockkey.lo locking_gcrypt.lo random.lo \
+ symcipher_gcrypt.lo
+libgnunetutil_crypto_la_OBJECTS = \
+ $(am_libgnunetutil_crypto_la_OBJECTS)
+am_crctest_OBJECTS = crctest.$(OBJEXT)
+crctest_OBJECTS = $(am_crctest_OBJECTS)
+crctest_DEPENDENCIES = $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+am_hashingtest_OBJECTS = hashingtest.$(OBJEXT)
+hashingtest_OBJECTS = $(am_hashingtest_OBJECTS)
+hashingtest_DEPENDENCIES = $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+am_hashtest_OBJECTS = hashtest.$(OBJEXT)
+hashtest_OBJECTS = $(am_hashtest_OBJECTS)
+hashtest_DEPENDENCIES = $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+am_hostkeytest_OBJECTS = hostkeytest.$(OBJEXT)
+hostkeytest_OBJECTS = $(am_hostkeytest_OBJECTS)
+hostkeytest_DEPENDENCIES = $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+am_kblockkey_test_OBJECTS = kblockkey_test.$(OBJEXT)
+kblockkey_test_OBJECTS = $(am_kblockkey_test_OBJECTS)
+kblockkey_test_DEPENDENCIES = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+am_symciphertest_OBJECTS = symciphertest.$(OBJEXT)
+symciphertest_OBJECTS = $(am_symciphertest_OBJECTS)
+symciphertest_DEPENDENCIES = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+DEP_FILES = ./$(DEPDIR)/crc32.Plo ./$(DEPDIR)/crctest.Po \
+ ./$(DEPDIR)/hashing.Plo ./$(DEPDIR)/hashingtest.Po \
+ ./$(DEPDIR)/hashtest.Po \
+ ./$(DEPDIR)/hostkey_gcrypt.Plo \
+ ./$(DEPDIR)/hostkeytest.Po \
+ ./$(DEPDIR)/kblockkey.Plo \
+ ./$(DEPDIR)/kblockkey_test.Po \
+ ./$(DEPDIR)/locking_gcrypt.Plo \
+ ./$(DEPDIR)/random.Plo \
+ ./$(DEPDIR)/symcipher_gcrypt.Plo \
+ ./$(DEPDIR)/symciphertest.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libgnunetutil_crypto_la_SOURCES) $(crctest_SOURCES) \
+ $(hashingtest_SOURCES) $(hashtest_SOURCES) \
+ $(hostkeytest_SOURCES) $(kblockkey_test_SOURCES) \
+ $(symciphertest_SOURCES)
+DIST_SOURCES = $(libgnunetutil_crypto_la_SOURCES) $(crctest_SOURCES) \
+ $(hashingtest_SOURCES) $(hashtest_SOURCES) \
+ $(hostkeytest_SOURCES) $(kblockkey_test_SOURCES) \
+ $(symciphertest_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = ${SHELL} /home/grothoff/svn/GNUnet/missing --run aclocal-1.8
+AMDEP_FALSE = #
+AMDEP_TRUE =
+AMTAR = ${SHELL} /home/grothoff/svn/GNUnet/missing --run tar
+AR = ar
+AS = as
+AUTOCONF = ${SHELL} /home/grothoff/svn/GNUnet/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/grothoff/svn/GNUnet/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/grothoff/svn/GNUnet/missing --run automake-1.8
+AWK = gawk
+CC = gcc
+CCDEPMODE = depmode=gcc3
+CFLAGS = -fno-strict-aliasing -Wall -g -Wall
+CONVENIENCE_LTDL_FALSE =
+CONVENIENCE_LTDL_TRUE = #
+CPP = gcc -E
+CPPFLAGS = -I/home/grothoff/include
+CXX = g++
+CXXCPP = g++ -E
+CXXDEPMODE = depmode=gcc3
+CXXFLAGS = -g -O2
+CYGPATH_W = echo
+CYGWIN_FALSE =
+CYGWIN_TRUE = #
+DATADIR = /home/grothoff/share/GNUnet/
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+DLLTOOL = dlltool
+ECHO = echo
+ECHO_C =
+ECHO_N = -n
+ECHO_T =
+EGREP = grep -E
+EXEEXT =
+EXT_LIBS =
+EXT_LIB_PATH = -L/home/grothoff/lib
+F77 =
+FFLAGS =
+GMSGFMT = /usr/bin/msgfmt
+GNUNETGTK_CFLAGS = -DXTHREADS -I/usr/include/libglade-2.0
-I/usr/include/gtk-2.0 -I/usr/include/libxml2 -I/usr/lib/gtk-2.0/include
-I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0
-I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
+GNUNETGTK_LIBS = -lglade-2.0 -lgtk-x11-2.0 -lxml2 -lpthread -lz -lgdk-x11-2.0
-latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0
-lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
+GTK_CFLAGS = -DXTHREADS -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include
-I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0
-I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
+GTK_LIBS = -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm
-lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl
-lglib-2.0
+GUILE = /usr/bin/guile
+GUILE_CONFIG = /usr/bin/guile-config
+GUILE_TOOLS = /usr/bin/guile-tools
+HAVE_CURSES_FALSE = #
+HAVE_CURSES_TRUE =
+HAVE_GTK_FALSE = #
+HAVE_GTK_TRUE =
+HAVE_GUILE_FALSE = #
+HAVE_GUILE_TRUE =
+HAVE_IPV6_FALSE = #
+HAVE_IPV6_TRUE =
+HAVE_MYSQL_FALSE =
+HAVE_MYSQL_TRUE = #
+HAVE_PDCURSES_FALSE =
+HAVE_PDCURSES_TRUE = #
+HAVE_SQLITE_FALSE = #
+HAVE_SQLITE_TRUE =
+HAVE_ZLIB_FALSE = #
+HAVE_ZLIB_TRUE =
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_LTDL_FALSE =
+INSTALL_LTDL_TRUE = #
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
+INTLLIBS =
+LDFLAGS = -L/home/grothoff/lib
+LIBADD_DL = -ldl
+LIBGCRYPT_CFLAGS =
+LIBGCRYPT_CONFIG = /usr/bin/libgcrypt-config
+LIBGCRYPT_LIBS = -lgcrypt -lgpg-error
+LIBICONV = -liconv
+LIBINTL =
+LIBLTDL = -lltdl
+LIBOBJS =
+LIBS = -lm -lnsl -lpthread
+LIBTOOL = $(SHELL) $(top_builddir)/libtool
+LN_S = ln -s
+LOCALEDIR = /home/grothoff/share/locale/
+LTDLINCL =
+LTLIBICONV = -liconv
+LTLIBINTL =
+LTLIBOBJS =
+MAKEINFO = ${SHELL} /home/grothoff/svn/GNUnet/missing --run makeinfo
+MINGW_FALSE =
+MINGW_TRUE = #
+MKINSTALLDIRS = $(top_builddir)/./mkinstalldirs
+MSGFMT = /usr/bin/msgfmt
+MSGMERGE = /usr/bin/msgmerge
+MYSQL_CPPFLAGS =
+MYSQL_LDFLAGS = -L/usr/lib/mysql
+OBJDUMP = objdump
+OBJEXT = o
+PACKAGE = GNUnet
+PACKAGE_BUGREPORT = address@hidden
+PACKAGE_NAME = GNUnet
+PACKAGE_STRING = GNUnet 0.7.0e
+PACKAGE_TARNAME = gnunet
+PACKAGE_VERSION = 0.7.0e
+PATH_SEPARATOR = :
+PKG_CONFIG = /usr/bin/pkg-config
+POSUB = po
+RANLIB = ranlib
+SET_MAKE =
+SHELL = /bin/sh
+SOLARIS_FALSE =
+SOLARIS_TRUE = #
+SQLITE_CPPFLAGS =
+SQLITE_LDFLAGS =
+STRIP = strip
+USE_NLS = yes
+VERSION = 0.7.0e
+XFREEBSD_FALSE =
+XFREEBSD_TRUE = #
+XGETTEXT = /usr/bin/xgettext
+ac_ct_AR = ar
+ac_ct_AS =
+ac_ct_CC = gcc
+ac_ct_CXX = g++
+ac_ct_DLLTOOL =
+ac_ct_F77 =
+ac_ct_OBJDUMP =
+ac_ct_RANLIB = ranlib
+ac_ct_STRIP = strip
+am__fastdepCC_FALSE = #
+am__fastdepCC_TRUE =
+am__fastdepCXX_FALSE = #
+am__fastdepCXX_TRUE =
+am__include = include
+am__leading_dot = .
+am__quote =
+bindir = ${exec_prefix}/bin
+build = i686-pc-linux-gnu
+build_alias =
+build_cpu = i686
+build_os = linux-gnu
+build_vendor = pc
+datadir = ${prefix}/share
+exec_prefix = ${prefix}
+guile_available = /usr/bin/guile
+host = i686-pc-linux-gnu
+host_alias =
+host_cpu = i686
+host_os = linux-gnu
+host_vendor = pc
+includedir = ${prefix}/include
+infodir = ${prefix}/info
+install_sh = /home/grothoff/svn/GNUnet/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localstatedir = ${prefix}/var
+mandir = ${prefix}/man
+mkdir_p = mkdir -p -- .
+oldincludedir = /usr/include
+prefix = /home/grothoff
+program_transform_name = s,x,x,
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+subdirs = libltdl
+sysconfdir = ${prefix}/etc
+target_alias =
+SUBDIRS = .
+INCLUDES = -I$(top_srcdir)/src/include
+lib_LTLIBRARIES = libgnunetutil_crypto.la
+AM_CPPFLAGS = $(LIBGCRYPT_CFLAGS)
+libgnunetutil_crypto_la_LIBADD = \
+ $(GCLIBADD) \
+ $(top_builddir)/src/util/libgnunetutil.la
+
+libgnunetutil_crypto_la_SOURCES = \
+ crc32.c \
+ hashing.c \
+ hostkey_gcrypt.c \
+ kblockkey.c \
+ locking_gcrypt.c locking_gcrypt.h \
+ random.c \
+ symcipher_gcrypt.c
+
+TESTS = $(check_PROGRAMS)
+hashingtest_SOURCES = \
+ hashingtest.c
+
+hashingtest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+crctest_SOURCES = \
+ crctest.c
+
+crctest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+kblockkey_test_SOURCES = \
+ kblockkey_test.c
+
+kblockkey_test_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+hostkeytest_SOURCES = \
+ hostkeytest.c
+
+hostkeytest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+hashtest_SOURCES = \
+ hashtest.c
+
+hashtest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+symciphertest_SOURCES = \
+ symciphertest.c
+
+symciphertest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+weakkeytest_SOURCES = \
+ weakkeytest.c
+
+weakkeytest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+all: all-recursive
+
+.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 \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu
src/util/crypto/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/util/crypto/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
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL)
$(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL)
$(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ 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
+libgnunetutil_crypto.la: $(libgnunetutil_crypto_la_OBJECTS)
$(libgnunetutil_crypto_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libgnunetutil_crypto_la_LDFLAGS)
$(libgnunetutil_crypto_la_OBJECTS) $(libgnunetutil_crypto_la_LIBADD) $(LIBS)
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+crctest$(EXEEXT): $(crctest_OBJECTS) $(crctest_DEPENDENCIES)
+ @rm -f crctest$(EXEEXT)
+ $(LINK) $(crctest_LDFLAGS) $(crctest_OBJECTS) $(crctest_LDADD) $(LIBS)
+hashingtest$(EXEEXT): $(hashingtest_OBJECTS) $(hashingtest_DEPENDENCIES)
+ @rm -f hashingtest$(EXEEXT)
+ $(LINK) $(hashingtest_LDFLAGS) $(hashingtest_OBJECTS)
$(hashingtest_LDADD) $(LIBS)
+hashtest$(EXEEXT): $(hashtest_OBJECTS) $(hashtest_DEPENDENCIES)
+ @rm -f hashtest$(EXEEXT)
+ $(LINK) $(hashtest_LDFLAGS) $(hashtest_OBJECTS) $(hashtest_LDADD)
$(LIBS)
+hostkeytest$(EXEEXT): $(hostkeytest_OBJECTS) $(hostkeytest_DEPENDENCIES)
+ @rm -f hostkeytest$(EXEEXT)
+ $(LINK) $(hostkeytest_LDFLAGS) $(hostkeytest_OBJECTS)
$(hostkeytest_LDADD) $(LIBS)
+kblockkey_test$(EXEEXT): $(kblockkey_test_OBJECTS)
$(kblockkey_test_DEPENDENCIES)
+ @rm -f kblockkey_test$(EXEEXT)
+ $(LINK) $(kblockkey_test_LDFLAGS) $(kblockkey_test_OBJECTS)
$(kblockkey_test_LDADD) $(LIBS)
+symciphertest$(EXEEXT): $(symciphertest_OBJECTS) $(symciphertest_DEPENDENCIES)
+ @rm -f symciphertest$(EXEEXT)
+ $(LINK) $(symciphertest_LDFLAGS) $(symciphertest_OBJECTS)
$(symciphertest_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+include ./$(DEPDIR)/crc32.Plo
+include ./$(DEPDIR)/crctest.Po
+include ./$(DEPDIR)/hashing.Plo
+include ./$(DEPDIR)/hashingtest.Po
+include ./$(DEPDIR)/hashtest.Po
+include ./$(DEPDIR)/hostkey_gcrypt.Plo
+include ./$(DEPDIR)/hostkeytest.Po
+include ./$(DEPDIR)/kblockkey.Plo
+include ./$(DEPDIR)/kblockkey_test.Po
+include ./$(DEPDIR)/locking_gcrypt.Plo
+include ./$(DEPDIR)/random.Plo
+include ./$(DEPDIR)/symcipher_gcrypt.Plo
+include ./$(DEPDIR)/symciphertest.Po
+
+.c.o:
+ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
+# source='$<' object='$@' libtool=no \
+# depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
+# $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c $<
+
+.c.obj:
+ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
`$(CYGPATH_W) '$<'`; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
+# source='$<' object='$@' libtool=no \
+# depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
+# $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
+# source='$<' object='$@' libtool=yes \
+# depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' \
+# $(CCDEPMODE) $(depcomp) \
+# $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags);
\
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS)
ctags); \
+ done
+
+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; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && 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)'; \
+ 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`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *" $$tst "*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ 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 \
+ banner="$$failed of $$all tests did not behave as expected
($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ 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`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed
"s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || mkdir "$(distdir)/$$subdir" \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="../$(top_distdir)" \
+ distdir="../$(distdir)/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(libdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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:
+ -rm -f $(CONFIG_CLEAN_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-recursive
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \
+ clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-TESTS \
+ check-am clean clean-checkPROGRAMS clean-generic \
+ clean-libLTLIBRARIES clean-libtool clean-recursive ctags \
+ ctags-recursive distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-recursive distclean-tags distdir \
+ dvi dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-libLTLIBRARIES \
+ install-man install-strip installcheck installcheck-am \
+ installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am uninstall-info-am \
+ uninstall-libLTLIBRARIES
+
+# 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:
Added: GNUnet/src/util/crypto/Makefile.am
===================================================================
--- GNUnet/src/util/crypto/Makefile.am 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/crypto/Makefile.am 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,74 @@
+SUBDIRS = .
+
+INCLUDES = -I$(top_srcdir)/src/include
+
+lib_LTLIBRARIES = libgnunetutil_crypto.la
+
+AM_CPPFLAGS = $(LIBGCRYPT_CFLAGS)
+
+libgnunetutil_crypto_la_LIBADD = \
+ $(GCLIBADD) \
+ $(top_builddir)/src/util/libgnunetutil.la
+
+libgnunetutil_crypto_la_SOURCES = \
+ crc32.c \
+ hashing.c \
+ hostkey_gcrypt.c \
+ kblockkey.c \
+ locking_gcrypt.c locking_gcrypt.h \
+ random.c \
+ symcipher_gcrypt.c
+
+check_PROGRAMS = \
+ crctest \
+ hashtest \
+ hashingtest \
+ hostkeytest \
+ kblockkey_test \
+ symciphertest \
+ weakkeytest
+
+TESTS = $(check_PROGRAMS)
+
+hashingtest_SOURCES = \
+ hashingtest.c
+hashingtest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+crctest_SOURCES = \
+ crctest.c
+crctest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+kblockkey_test_SOURCES = \
+ kblockkey_test.c
+kblockkey_test_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+hostkeytest_SOURCES = \
+ hostkeytest.c
+hostkeytest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+hashtest_SOURCES = \
+ hashtest.c
+hashtest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+symciphertest_SOURCES = \
+ symciphertest.c
+symciphertest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+weakkeytest_SOURCES = \
+ weakkeytest.c
+weakkeytest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
Added: GNUnet/src/util/crypto/Makefile.in
===================================================================
--- GNUnet/src/util/crypto/Makefile.in 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/crypto/Makefile.in 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,846 @@
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 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.
+
address@hidden@
+
+SOURCES = $(libgnunetutil_crypto_la_SOURCES) $(crctest_SOURCES)
$(hashingtest_SOURCES) $(hashtest_SOURCES) $(hostkeytest_SOURCES)
$(kblockkey_test_SOURCES) $(symciphertest_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+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 = :
+host_triplet = @host@
+check_PROGRAMS = crctest$(EXEEXT) hashtest$(EXEEXT) \
+ hashingtest$(EXEEXT) hostkeytest$(EXEEXT) \
+ kblockkey_test$(EXEEXT) symciphertest$(EXEEXT)
+subdir = src/util/crypto
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-2.0.m4 \
+ $(top_srcdir)/m4/guile.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/libgcrypt.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(libdir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libgnunetutil_crypto_la_DEPENDENCIES = \
+ $(top_builddir)/src/util/libgnunetutil.la
+am_libgnunetutil_crypto_la_OBJECTS = crc32.lo hashing.lo \
+ hostkey_gcrypt.lo kblockkey.lo locking_gcrypt.lo random.lo \
+ symcipher_gcrypt.lo
+libgnunetutil_crypto_la_OBJECTS = \
+ $(am_libgnunetutil_crypto_la_OBJECTS)
+am_crctest_OBJECTS = crctest.$(OBJEXT)
+crctest_OBJECTS = $(am_crctest_OBJECTS)
+crctest_DEPENDENCIES = $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+am_hashingtest_OBJECTS = hashingtest.$(OBJEXT)
+hashingtest_OBJECTS = $(am_hashingtest_OBJECTS)
+hashingtest_DEPENDENCIES = $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+am_hashtest_OBJECTS = hashtest.$(OBJEXT)
+hashtest_OBJECTS = $(am_hashtest_OBJECTS)
+hashtest_DEPENDENCIES = $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+am_hostkeytest_OBJECTS = hostkeytest.$(OBJEXT)
+hostkeytest_OBJECTS = $(am_hostkeytest_OBJECTS)
+hostkeytest_DEPENDENCIES = $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+am_kblockkey_test_OBJECTS = kblockkey_test.$(OBJEXT)
+kblockkey_test_OBJECTS = $(am_kblockkey_test_OBJECTS)
+kblockkey_test_DEPENDENCIES = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+am_symciphertest_OBJECTS = symciphertest.$(OBJEXT)
+symciphertest_OBJECTS = $(am_symciphertest_OBJECTS)
+symciphertest_DEPENDENCIES = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
address@hidden@DEP_FILES = ./$(DEPDIR)/crc32.Plo ./$(DEPDIR)/crctest.Po \
address@hidden@ ./$(DEPDIR)/hashing.Plo ./$(DEPDIR)/hashingtest.Po \
address@hidden@ ./$(DEPDIR)/hashtest.Po \
address@hidden@ ./$(DEPDIR)/hostkey_gcrypt.Plo \
address@hidden@ ./$(DEPDIR)/hostkeytest.Po \
address@hidden@ ./$(DEPDIR)/kblockkey.Plo \
address@hidden@ ./$(DEPDIR)/kblockkey_test.Po \
address@hidden@ ./$(DEPDIR)/locking_gcrypt.Plo \
address@hidden@ ./$(DEPDIR)/random.Plo \
address@hidden@ ./$(DEPDIR)/symcipher_gcrypt.Plo \
address@hidden@ ./$(DEPDIR)/symciphertest.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libgnunetutil_crypto_la_SOURCES) $(crctest_SOURCES) \
+ $(hashingtest_SOURCES) $(hashtest_SOURCES) \
+ $(hostkeytest_SOURCES) $(kblockkey_test_SOURCES) \
+ $(symciphertest_SOURCES)
+DIST_SOURCES = $(libgnunetutil_crypto_la_SOURCES) $(crctest_SOURCES) \
+ $(hashingtest_SOURCES) $(hashtest_SOURCES) \
+ $(hostkeytest_SOURCES) $(kblockkey_test_SOURCES) \
+ $(symciphertest_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONVENIENCE_LTDL_FALSE = @CONVENIENCE_LTDL_FALSE@
+CONVENIENCE_LTDL_TRUE = @CONVENIENCE_LTDL_TRUE@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+CYGWIN_FALSE = @CYGWIN_FALSE@
+CYGWIN_TRUE = @CYGWIN_TRUE@
+DATADIR = @DATADIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+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@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GMSGFMT = @GMSGFMT@
+GNUNETGTK_CFLAGS = @GNUNETGTK_CFLAGS@
+GNUNETGTK_LIBS = @GNUNETGTK_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+GUILE = @GUILE@
+GUILE_CONFIG = @GUILE_CONFIG@
+GUILE_TOOLS = @GUILE_TOOLS@
+HAVE_CURSES_FALSE = @HAVE_CURSES_FALSE@
+HAVE_CURSES_TRUE = @HAVE_CURSES_TRUE@
+HAVE_GTK_FALSE = @HAVE_GTK_FALSE@
+HAVE_GTK_TRUE = @HAVE_GTK_TRUE@
+HAVE_GUILE_FALSE = @HAVE_GUILE_FALSE@
+HAVE_GUILE_TRUE = @HAVE_GUILE_TRUE@
+HAVE_IPV6_FALSE = @HAVE_IPV6_FALSE@
+HAVE_IPV6_TRUE = @HAVE_IPV6_TRUE@
+HAVE_MYSQL_FALSE = @HAVE_MYSQL_FALSE@
+HAVE_MYSQL_TRUE = @HAVE_MYSQL_TRUE@
+HAVE_PDCURSES_FALSE = @HAVE_PDCURSES_FALSE@
+HAVE_PDCURSES_TRUE = @HAVE_PDCURSES_TRUE@
+HAVE_SQLITE_FALSE = @HAVE_SQLITE_FALSE@
+HAVE_SQLITE_TRUE = @HAVE_SQLITE_TRUE@
+HAVE_ZLIB_FALSE = @HAVE_ZLIB_FALSE@
+HAVE_ZLIB_TRUE = @HAVE_ZLIB_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_LTDL_FALSE = @INSTALL_LTDL_FALSE@
+INSTALL_LTDL_TRUE = @INSTALL_LTDL_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+LDFLAGS = @LDFLAGS@
+LIBADD_DL = @LIBADD_DL@
+LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBLTDL = @LIBLTDL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LOCALEDIR = @LOCALEDIR@
+LTDLINCL = @LTDLINCL@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MINGW_FALSE = @MINGW_FALSE@
+MINGW_TRUE = @MINGW_TRUE@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+MSGMERGE = @MSGMERGE@
+MYSQL_CPPFLAGS = @MYSQL_CPPFLAGS@
+MYSQL_LDFLAGS = @MYSQL_LDFLAGS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_FALSE = @SOLARIS_FALSE@
+SOLARIS_TRUE = @SOLARIS_TRUE@
+SQLITE_CPPFLAGS = @SQLITE_CPPFLAGS@
+SQLITE_LDFLAGS = @SQLITE_LDFLAGS@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+XFREEBSD_FALSE = @XFREEBSD_FALSE@
+XFREEBSD_TRUE = @XFREEBSD_TRUE@
+XGETTEXT = @XGETTEXT@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+guile_available = @guile_available@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+subdirs = @subdirs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+SUBDIRS = .
+INCLUDES = -I$(top_srcdir)/src/include
+lib_LTLIBRARIES = libgnunetutil_crypto.la
+AM_CPPFLAGS = $(LIBGCRYPT_CFLAGS)
+libgnunetutil_crypto_la_LIBADD = \
+ $(GCLIBADD) \
+ $(top_builddir)/src/util/libgnunetutil.la
+
+libgnunetutil_crypto_la_SOURCES = \
+ crc32.c \
+ hashing.c \
+ hostkey_gcrypt.c \
+ kblockkey.c \
+ locking_gcrypt.c locking_gcrypt.h \
+ random.c \
+ symcipher_gcrypt.c
+
+TESTS = $(check_PROGRAMS)
+hashingtest_SOURCES = \
+ hashingtest.c
+
+hashingtest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+crctest_SOURCES = \
+ crctest.c
+
+crctest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+kblockkey_test_SOURCES = \
+ kblockkey_test.c
+
+kblockkey_test_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+hostkeytest_SOURCES = \
+ hostkeytest.c
+
+hostkeytest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+hashtest_SOURCES = \
+ hashtest.c
+
+hashtest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+symciphertest_SOURCES = \
+ symciphertest.c
+
+symciphertest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+weakkeytest_SOURCES = \
+ weakkeytest.c
+
+weakkeytest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/libgnunetutil_crypto.la
+
+all: all-recursive
+
+.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 \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu
src/util/crypto/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/util/crypto/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
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL)
$(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL)
$(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ 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
+libgnunetutil_crypto.la: $(libgnunetutil_crypto_la_OBJECTS)
$(libgnunetutil_crypto_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libgnunetutil_crypto_la_LDFLAGS)
$(libgnunetutil_crypto_la_OBJECTS) $(libgnunetutil_crypto_la_LIBADD) $(LIBS)
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+crctest$(EXEEXT): $(crctest_OBJECTS) $(crctest_DEPENDENCIES)
+ @rm -f crctest$(EXEEXT)
+ $(LINK) $(crctest_LDFLAGS) $(crctest_OBJECTS) $(crctest_LDADD) $(LIBS)
+hashingtest$(EXEEXT): $(hashingtest_OBJECTS) $(hashingtest_DEPENDENCIES)
+ @rm -f hashingtest$(EXEEXT)
+ $(LINK) $(hashingtest_LDFLAGS) $(hashingtest_OBJECTS)
$(hashingtest_LDADD) $(LIBS)
+hashtest$(EXEEXT): $(hashtest_OBJECTS) $(hashtest_DEPENDENCIES)
+ @rm -f hashtest$(EXEEXT)
+ $(LINK) $(hashtest_LDFLAGS) $(hashtest_OBJECTS) $(hashtest_LDADD)
$(LIBS)
+hostkeytest$(EXEEXT): $(hostkeytest_OBJECTS) $(hostkeytest_DEPENDENCIES)
+ @rm -f hostkeytest$(EXEEXT)
+ $(LINK) $(hostkeytest_LDFLAGS) $(hostkeytest_OBJECTS)
$(hostkeytest_LDADD) $(LIBS)
+kblockkey_test$(EXEEXT): $(kblockkey_test_OBJECTS)
$(kblockkey_test_DEPENDENCIES)
+ @rm -f kblockkey_test$(EXEEXT)
+ $(LINK) $(kblockkey_test_LDFLAGS) $(kblockkey_test_OBJECTS)
$(kblockkey_test_LDADD) $(LIBS)
+symciphertest$(EXEEXT): $(symciphertest_OBJECTS) $(symciphertest_DEPENDENCIES)
+ @rm -f symciphertest$(EXEEXT)
+ $(LINK) $(symciphertest_LDFLAGS) $(symciphertest_OBJECTS)
$(symciphertest_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
+
+.c.o:
address@hidden@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
$<; \
address@hidden@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
address@hidden@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no
@AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po'
tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(COMPILE) -c $<
+
+.c.obj:
address@hidden@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
`$(CYGPATH_W) '$<'`; \
address@hidden@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
address@hidden@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no
@AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po'
tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
address@hidden@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
$<; \
address@hidden@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
address@hidden@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes
@AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo'
tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags);
\
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS)
ctags); \
+ done
+
+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; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && 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)'; \
+ 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`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *" $$tst "*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ 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 \
+ banner="$$failed of $$all tests did not behave as expected
($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ 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`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed
"s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || mkdir "$(distdir)/$$subdir" \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="../$(top_distdir)" \
+ distdir="../$(distdir)/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(libdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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:
+ -rm -f $(CONFIG_CLEAN_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-recursive
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \
+ clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-TESTS \
+ check-am clean clean-checkPROGRAMS clean-generic \
+ clean-libLTLIBRARIES clean-libtool clean-recursive ctags \
+ ctags-recursive distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-recursive distclean-tags distdir \
+ dvi dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-libLTLIBRARIES \
+ install-man install-strip installcheck installcheck-am \
+ installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am uninstall-info-am \
+ uninstall-libLTLIBRARIES
+
+# 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:
Added: GNUnet/src/util/crypto/crc32.c
===================================================================
--- GNUnet/src/util/crypto/crc32.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/crypto/crc32.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,102 @@
+/*
+ This file is part of GNUnet.
+ (C) 2001, 2002, 2003, 2004, 2006 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.
+
+ For the actual CRC code:
+ Copyright abandoned; this code is in the public domain.
+ Provided to GNUnet by address@hidden
+*/
+
+/**
+ * @file util/crypto/crc32.c
+ * @brief implementation of CRC32
+ * @author Christian Grothoff
+ */
+
+#include "platform.h"
+#include "gnunet_util_error.h"
+#include "gnunet_util_crypto.h"
+
+/* Avoid wasting space on 8-byte longs. */
+#if UINT_MAX >= 0xffffffff
+ typedef unsigned int uLong;
+#elif ULONG_MAX >= 0xffffffff
+ typedef unsigned long uLong;
+#else
+ #error This compiler is not ANSI-compliant!
+#endif
+
+#define Z_NULL 0
+
+
+#define POLYNOMIAL (uLong)0xedb88320
+static uLong crc_table[256];
+
+/*
+ * This routine writes each crc_table entry exactly once,
+ * with the ccorrect final value. Thus, it is safe to call
+ * even on a table that someone else is using concurrently.
+ */
+void __attribute__ ((constructor)) crc32_init(void) {
+ unsigned int i, j;
+ uLong h = 1;
+ crc_table[0] = 0;
+ for (i = 128; i; i >>= 1) {
+ h = (h >> 1) ^ ((h & 1) ? POLYNOMIAL : 0);
+ /* h is now crc_table[i] */
+ for (j = 0; j < 256; j += 2*i)
+ crc_table[i+j] = crc_table[j] ^ h;
+ }
+}
+
+/*
+ * This computes the standard preset and inverted CRC, as used
+ * by most networking standards. Start by passing in an initial
+ * chaining value of 0, and then pass in the return value from the
+ * previous crc32() call. The final return value is the CRC.
+ * Note that this is a little-endian CRC, which is best used with
+ * data transmitted lsbit-first, and it should, itself, be appended
+ * to data in little-endian byte and bit order to preserve the
+ * property of detecting all burst errors of length 32 bits or less.
+ */
+static uLong crc32(uLong crc,
+ const char *buf,
+ size_t len) {
+ GE_ASSERT(NULL, crc_table[255] != 0);
+ crc ^= 0xffffffff;
+ while (len--)
+ crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
+ return crc ^ 0xffffffff;
+}
+
+
+/**
+ * Compute the CRC32 checksum for the first len bytes of the buffer.
+ *
+ * @param buf the data over which we're taking the CRC
+ * @param len the length of the buffer
+ * @return the resulting CRC32 checksum
+ */
+int crc32N(const void * buf, int len) {
+ uLong crc;
+ crc = crc32(0L, Z_NULL, 0);
+ crc = crc32(crc, (char*)buf, len);
+ return crc;
+}
+
+/* end of crc32.c */
Added: GNUnet/src/util/crypto/crctest.c
===================================================================
--- GNUnet/src/util/crypto/crctest.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/crypto/crctest.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,22 @@
+/**
+ * @file util/crytpo/crctest.c
+ * @brief testcase for util/crypto/crc32.c
+ */
+
+#include "gnunet_util.h"
+
+static int expected[] = {
+-1223996378, 929797997, -1048047323, 1791081351, -425765913, 2138425902,
82584863, 1939615314, 1806463044, -1505003452, 1878277636, -997353517,
201238705, 1723258694, -1107452366, -344562561, -1102247383, 1973035265,
715213337, -1886586005, 2021214515, -1387332962, 593019378, -571088044,
1412577760, 412164558, -1626111170, 1556494863, -289796528, -850404775,
2066714587, -911838105, -1426027382, 499684507, -835420055, 1817119454,
-1221795958, 1516966784, -1038806877, -2115880691, 532627620, 1984437415,
-396341583, -1345366324, -590766745, -1801923449, 1752427988, -386896390,
453906317, 1552589433, -858925718, 1160445643, -740188079, -486609040,
1102529269, -515846212, -1614217202, 1572162207, 943558923, -467330358,
-1870764193, 1477005328, -793029208, -888983175, -696956020, 842706021,
1642390067, -805889494, 1284862057, 1562545388, 2091626273, 1852404553,
-2076508101, 370903003, 1186422975, 1936085227, 769358463, 180401058,
2032612572, -105461719, -1119935472, 617249831, 1169304728, 1771205256,
-2042554284, 653270859, -918610713, 336081663, -913685370, 1962213744,
-505406126, -838622649, -1141518710, 893143582, -1330296611, 122119483,
1111564496, 688811976, 1016241049, -1803438473, 359630107, 1034798954,
-581359286, 1590946527, -389997034, 2020318460, 1695967527, -464069727,
-862641495, -1405012109, -771244841, 738226150, -1035328134, -933945474,
1254965774, 1661863830, -884127998, 1800460481, 814702567, -1214068102,
-541120421, 1898656429, -236825530, 1505866267, 1252462132, -981007520,
1502096471, -2134644056, 483221797, 1276403836, 541133290, -1234093967,
350748780, 257941070, 1030457090, 434988890, -1098135432, -1000556640,
-577128022, 644806294, -787536281, -1288346343, 998079404, 1259353935,
955771631, -958377466, 1746756252, 451579658, 1913409243, -952026299,
-1556035958, -830279881, 834744289, -1878491428, 700000962, -1027245802,
1393574384, -1260409147, -841420884, 892132797, 1494730226, -1649181766,
1651097838, -1041807403, -1916675721, -1324525963, 157405899, -655788033,
-1943555237, -79747022, 339721623, -138341083, 1111902411, -435322914,
-533294200, -190220608, -1718346014, -1631301894, 1706265243, 745533899,
1351941230, 1803009594, -1218191958, 1467751062, 84368433, -711251880,
1699423788, -768792716, 846639904, 2103267723, -2095288070, -440571408,
-362144485, 2020468971, 352105963, -849211036, -1272592429, 1743440467,
2020667861, -1649992312, 172682343, 816705364, -1990206923, 902689869,
-298510060, 164207498, 190378213, 242531543, 113383268, 304810777, -1081099373,
819221134, -1100982926, -855941239, 1091308887, -934548124, 520508733,
-1381763773, -491593287, -2143492665, 700894653, -2049034808, -160942046,
-2009323577, 1464245054, 1584746011, -768646852, -993282698, 1265838699,
-1873820824, 575704373, -986682955, 1270688416, 88587481, -1723991633,
-409928242, 866669946, -483811323, -181759253, -963525431, -1686612238,
-1663460076, -1128449775, -1368922329, 122318131, 795862385, 528576131,
-19927090, 1369299478, 1285665642, -738964611, 1328292127, 552041252,
-1431494354, -1205275362, 42768297, -1329537238, -449177266, 943925221,
987016465, -945138414, -270064876, 1650366626, -369252552, 582030210,
-1229235374, 147901387, -517510506, -1609742888, -1086838308, 1391998445,
-313975512, -613392078, 855706229, 1475706341, -1112105406, 2032001400,
1565777625, 2030937777, 435522421, 1823527907, -691390605, -827253664,
1057171580, -314146639, -630099999, -1347514552, 478716232, -1533658804,
-1425371979, 761987780, 1560243817, -1945893959, 1205759225, -959343783,
-576742354, -154125407, -1158108776, 1183788580, 1354198127, -1534207721,
-823991517, -170534462, -912524170, 1858513573, 467072185, 2091040157,
-1765027018, -1659401643, -1173890143, -1912754057, -84568053, 2010781784,
-921970156, 944508352, -922040609, 1055102010, 1018688871, -1186761311,
-2012263648, 1311654161, 277659086, 2029602288, 1127061510, 1029452642,
285677123, -188521091, -641039012, 653836416, -805916340, -1644860596,
1352872213, 691634876, -1477113308, -748430369, 1030697363, -2007864449,
-1196662616, 1313997192, 177342476, -566676450, -1118618118, 1697953104,
344671484, -1489783116, -889507873, 1259591310, -716567168, 2116447062,
324368527, 1789366816, 1558930442, 1950250221, -785460151, 1174714258,
-430047304, -859487565, -580633932, 607732845, -1128150220, 1544355315,
1460298016, -1771194297, 1215703690, 277231808, -416020628, -418936577,
-1724839216, 404731389, 1058730508, -1508366681, 229883053, -572310243,
1883189553, 931286849, 1659300867, -94236383, -241524462, 548020458,
-302406981, 579986475, 73468197, -984957614, 1554382245, 2084807492,
-1456802798, -1105192593, 629440327, -16313961, -2102585261, 1873675206,
161035128, 1497033351, 1990150811, -499405222, 304019482, 41935663, -805987182,
-571699268, 1748462913, 2096239823, -116359807, -1871127553, -1074832534,
-1558866192, 231353861, 2122854560, -2102323721, -281462361, -343403210,
-673268171, 1776058383, 1581561150, 2059580579, 768848632, 1347190372,
-1701705879, 245282007, -563267886, -592558289, 1662399958, 1390406821,
-1522485580, -706446863, 2069516289, -301855859, -778346387, -1454093198,
1249083752, -1760506745, 262193320, 630751125, -1495939124, -29980580,
-1989626563, 659039376, -329477132, -1003507166, -1322549020, 358606508,
-2052572059, 1848014133, 1826958586, -1004948862, -1775370541, 2134177912,
-1739214473, 1892700918, 926629675, -1042761322, 2020075900, 606370962,
-1256609305, 117577265, -586848924, 191368285, 1653535275, -1329269701,
-375879127, -1089901406, 1206489978, 534223924, -1042752982, -1178316881,
-445594741, -1501682065, -1598136839, -467688289, 750784023, 1781080461,
1729380226, 16906088, 862168532, -2037752683, 1455274138, -1491220107,
1058323960, 1711530558, 1355062750, 227640096, 396568027, -173579098,
-408975801, -993618329, -1470751562, 371076647, 209563718, 2015405719,
-723460281, -1423934420, -2089643958, 353260489, 2084264341, -792676687,
701391030, -1440658244, 1479321011, 1907822880, 1232524257, -256712289,
401077577, 621808069, 868263613, 1244930119, 2020996902, 117483907, 1341376744,
-1936988014, -445200547, -843751811, -435291191, 1041695743, 476132726,
-1226874735, -1436046747, -297047422, 1739645396, 1948680937, -718144374,
1141983978, 1673650568, -197244350, 1604464002, 1424069853, -485626505,
1708710014, -849136541, 1573778103, 530360999, 1777767203, 1376958336,
-1088364352, 1826167753, 742735448, -1386211659, -1991323164, -444115655,
-443055378, -1586901006, -1741686587, 1925818034, -2118916824, 803890920,
-1481793154, 992278937, 1302616410, 444517030, 1393144770, -2025632978,
1902300505, -1683582981, 800654133, 873850324, -619580878, -2002070410,
-2024936385, 1978986634, 2012024264, 675768872, 389435615, -867217540,
231209167, -303917385, 1445676969, -1385982721, 1310476490, 580273453,
-160600202, -1330895874, 487110497, 1124384798, 227637416, -1829783306,
1014818058, -1336870683, -1042199518, -468525587, -1186267363, -472843891,
1215617600, -2056648329, -873216891, 156780951, -1883246047, -842549253,
-717684332, 760531638, 1074787431, 786267513, 814031289, -561255343,
-110302255, -1837376592, 989669060, -81350614, 546038730, 222899882,
1298746805, 1791615733, 1565630269, 1516024174, 421691479, 1860326051,
-1973359550, 1854393443, -1401468528, -158562295, 1509929255, -124024738,
-462937489, 259890715, -1515121317, -289511197, -913738664, 698079062,
-1631229382, -507275144, 1897739663, -1118192766, -1687033399, 61405556,
-1913606579, -473308896, -259107170, -576944609, -1689355510, 322156799,
545090192, 127425176, -1815211748, -2070235628, -1172529316, 599259550,
-910906653, 1797380363, -938649427, 142991392, 504559631, 1208867355,
-807699247, -616021271, -254935281, -57151221, -1095534993, 1998380318,
1772459584, 713271407, -1197898266, 808881935, -308133481, -1314455137,
284321772, -743117625, -1622364240, -1667535152, 118713606, 1053615347,
-2072876023, -178189072, -828319551, 2047304928, -1311435786, -1970672907,
-747972100, 86806159, -436088421, 1464645587, 735840899, 32600466, -190473426,
-735703440, 482872155, 475662392, -713681085, 1424078728, -150668609,
-1137197868, -1682762563, -48035649, 1143959866, -1542015129, 284920371,
-1587695586, -625236551, -753893357, -433976266, -1329796037, -1636712478,
1686783454, 27839146, 1748631474, -879528256, 2057796026, 773734654, 112269667,
-2011541314, 1517797297, -1943171794, 268166111, -1037010413, -1945824504,
-1672323792, 306260758, -692968628, -701704965, -462980996, 939188824,
553289792, 1790245000, 2093793129, -658085781, -186055037, -2130433650,
-1013235433, 1190870089, -2126586963, -1509655742, -1291895256, -1427857845,
309538950, 388316741, 259659733, -1895092434, 110126220, -170175575,
-419430224, -696234084, -832170948, -353431720, -797675726, -1644136054,
715163272, -1305904349, -145786463, -99586244, -695450446, -871327102,
-725496060, 952863853, -688441983, -1729929460, -103732092, 1059054528,
568873585, -982665223, -128672783, 2099418320, 1508239336, -2089480835,
-390935727, 664306522, -1607364342, -163246802, -1121295140, -128375779,
-615694409, -2079391797, 760542037, 677761593, -750117849, -1060525080,
2128437080, 525250908, 1987657172, 2032530557, -2011247936, 1942775263,
1681562788, 688229491, -803856505, 684707948, 1308988965, 1455480037,
790659611, 1557968784, -383203149, -361510986, -742575828, 558837193,
-1214977424, 1253274105, -119513513, -993964385, -33438767, -177452803,
1186928041, -2073533871, 1188528559, 1896514695, 1200128512, 1930588755,
-1914141443, 1534656032, -1192989829, -1848274656, -220848455, 1001806509,
1298797392, 1533031884, -1912322446, 1705583815, 1568094347, -1397640627,
807828512, -1852996497, -1529733505, -1575634185, -1280270160, -1567624159,
-1861904922, 1276738579, 1163432999, 626879833, 316942006, -1871138342,
1341039701, 1595907877, 1950911580, 1634717748, 1071476055, -809354290,
-1161553341, -2081621710, -2085557943, 19360224, 322135580, -698485151,
1267663094, -233890834, -126361189, -1426257522, 1094007921, 500179855,
-283548002, -1678987343, 1946999943, 1489410849, 2089571262, 1430799093,
1961848046, -99462663, -552833264, 1168700661, -1783882181, 2089196401,
1092839657, 914488673, 80263859, -2140947098, -726384741, -1022448237,
2113887675, 1485770846, -112922517, 1995461466, 774613726, 944068011,
1521975359, 289086919, -386920759, -1960513175, 358460021, -238698524,
-1913640563, -1000324864, 1731755224, -1271586254, -1917469655, 2134162829,
-828097534, -1089292503, -1514835999, 1682931514, -482307169, 2110243841,
115744834, -2038340170, 65889188, -539445712, -1713206408, -1842396726,
-1659545588, -909558923, 860164922, 1328713040, 1044007120, -2103807103,
-1073990344, -1312783785, -884980824, -705318011, -1263408788, -2032228692,
-1732844111, -1813827156, 1462566279, 1179250845, 1732421772, 604429013,
-92284336, -1192166516, 304654351, 1998552034, -1802461575, -1802704071,
-1704833934, -976264396, 1005840702, 2108843914, 1363909309, 843040834,
-1039625241, 1285007226, 91610001, 418426329, 678422358, -945360697,
-440008081, -1053091357, 425719777, -1372778676, 591912153, 1229089037,
-56663158, 2140251400, 830257037, 763914157, 175610373, -2105655963,
-1040826150, 1174443038, 339290593, 346618443, -180504100, -1363190515,
210620018, 1028894425, 573529714, 698460117, 136999397, 1015621712,
-1401813739, -297990684, -1820934845, -1299093313, 1299361369, -366522415,
91527707, 1113466178, -956229484, 22204763, -1394374195, -1912666711,
-1453789804, 1613408399, -169509567, 1350520309, 540761213, -2086682848,
1095131491, -812787911, 1860108594, -1121378737, -1667252487, -486084366,
166519760, 1609891237, 728218405, 291075010, 646168382, 108462277, -1616661910,
1016600360, 2099958568, 27934736, 183821196, 13660496, -805589719, 936068730,
-439037934, 1414622584, 215845485, -1352304469, -1817427526, -1318710977,
-110207199, 228524335, 1704746590, 998293651, -1521016702, -641956531,
-2089808167, 2094404052, -1446381065, -662186492, 1670154584, 9637833,
493925511, 660047318, 1197537103, 1696017374, -204994399, -1104145601,
-852330465, -1936369658, -829716674, -1255255217, 1264013799, 1642611772,
-652520861, 777247164, 2028895987, -1424241853, -54367829, -1940161761,
-1802831079, -449405299, 838242661, -323055438, 794295411, -136989378,
-446686673, -421252799, -16777216,
+};
+
+int main(int argc, char * argv[]){
+ char buf[1024];
+ int i;
+
+ for (i=0;i<1024;i++)
+ buf[i] = (char)i;
+ for (i=0;i<1024;i++)
+ if (expected[i] != crc32N(&buf[i], 1024-i))
+ return 1;
+ return 0;
+}
Added: GNUnet/src/util/crypto/hashing.c
===================================================================
--- GNUnet/src/util/crypto/hashing.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/crypto/hashing.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,620 @@
+/*
+ This file is part of GNUnet.
+ (C) 2001, 2002, 2003, 2004, 2005, 2006 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.
+
+ SHA-512 code by Jean-Luc Cooke <address@hidden>
+
+ Copyright (c) Jean-Luc Cooke <address@hidden>
+ Copyright (c) Andrew McDonald <address@hidden>
+ Copyright (c) 2003 Kyle McMartin <address@hidden>
+*/
+
+/**
+ * @file util/crypto/hashing.c
+ * @brief SHA-512 hash related functions
+ * @author Christian Grothoff
+ */
+
+#include "platform.h"
+#include "gnunet_util_crypto.h"
+
+#define SHA512_DIGEST_SIZE 64
+#define SHA512_HMAC_BLOCK_SIZE 128
+
+struct sha512_ctx {
+ unsigned long long state[8];
+ unsigned int count[4];
+ unsigned char buf[128];
+};
+
+static unsigned long long Ch(unsigned long long x,
+ unsigned long long y,
+ unsigned long long z) {
+ return z ^ (x & (y ^ z));
+}
+
+static unsigned long long Maj(unsigned long long x,
+ unsigned long long y,
+ unsigned long long z) {
+ return (x & y) | (z & (x | y));
+}
+
+static unsigned long long RORu64(unsigned long long x,
+ unsigned long long y) {
+ return (x >> y) | (x << (64 - y));
+}
+
+const unsigned long long sha512_K[80] = {
+ 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, 0xb5c0fbcfec4d3b2fULL,
+ 0xe9b5dba58189dbbcULL, 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL,
+ 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL, 0xd807aa98a3030242ULL,
+ 0x12835b0145706fbeULL, 0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL,
+ 0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL, 0x9bdc06a725c71235ULL,
+ 0xc19bf174cf692694ULL, 0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL,
+ 0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL, 0x2de92c6f592b0275ULL,
+ 0x4a7484aa6ea6e483ULL, 0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL,
+ 0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL, 0xb00327c898fb213fULL,
+ 0xbf597fc7beef0ee4ULL, 0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL,
+ 0x06ca6351e003826fULL, 0x142929670a0e6e70ULL, 0x27b70a8546d22ffcULL,
+ 0x2e1b21385c26c926ULL, 0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL,
+ 0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL, 0x81c2c92e47edaee6ULL,
+ 0x92722c851482353bULL, 0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL,
+ 0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL, 0xd192e819d6ef5218ULL,
+ 0xd69906245565a910ULL, 0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL,
+ 0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL, 0x2748774cdf8eeb99ULL,
+ 0x34b0bcb5e19b48a8ULL, 0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL,
+ 0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL, 0x748f82ee5defb2fcULL,
+ 0x78a5636f43172f60ULL, 0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL,
+ 0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL, 0xbef9a3f7b2c67915ULL,
+ 0xc67178f2e372532bULL, 0xca273eceea26619cULL, 0xd186b8c721c0c207ULL,
+ 0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL, 0x06f067aa72176fbaULL,
+ 0x0a637dc5a2c898a6ULL, 0x113f9804bef90daeULL, 0x1b710b35131c471bULL,
+ 0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, 0x3c9ebe0a15c9bebcULL,
+ 0x431d67c49c100d4cULL, 0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL,
+ 0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL,
+};
+
+#define e0(x) (RORu64(x,28) ^ RORu64(x,34) ^ RORu64(x,39))
+#define e1(x) (RORu64(x,14) ^ RORu64(x,18) ^ RORu64(x,41))
+#define s0(x) (RORu64(x, 1) ^ RORu64(x, 8) ^ (x >> 7))
+#define s1(x) (RORu64(x,19) ^ RORu64(x,61) ^ (x >> 6))
+
+/* H* initial state for SHA-512 */
+#define H0 0x6a09e667f3bcc908ULL
+#define H1 0xbb67ae8584caa73bULL
+#define H2 0x3c6ef372fe94f82bULL
+#define H3 0xa54ff53a5f1d36f1ULL
+#define H4 0x510e527fade682d1ULL
+#define H5 0x9b05688c2b3e6c1fULL
+#define H6 0x1f83d9abfb41bd6bULL
+#define H7 0x5be0cd19137e2179ULL
+
+/* H'* initial state for SHA-384 */
+#define HP0 0xcbbb9d5dc1059ed8ULL
+#define HP1 0x629a292a367cd507ULL
+#define HP2 0x9159015a3070dd17ULL
+#define HP3 0x152fecd8f70e5939ULL
+#define HP4 0x67332667ffc00b31ULL
+#define HP5 0x8eb44a8768581511ULL
+#define HP6 0xdb0c2e0d64f98fa7ULL
+#define HP7 0x47b5481dbefa4fa4ULL
+
+static void LOAD_OP(int I, unsigned long long *W, const unsigned char *input) {
+ unsigned long long t1 = input[(8*I) ] & 0xff;
+ t1 <<= 8;
+ t1 |= input[(8*I)+1] & 0xff;
+ t1 <<= 8;
+ t1 |= input[(8*I)+2] & 0xff;
+ t1 <<= 8;
+ t1 |= input[(8*I)+3] & 0xff;
+ t1 <<= 8;
+ t1 |= input[(8*I)+4] & 0xff;
+ t1 <<= 8;
+ t1 |= input[(8*I)+5] & 0xff;
+ t1 <<= 8;
+ t1 |= input[(8*I)+6] & 0xff;
+ t1 <<= 8;
+ t1 |= input[(8*I)+7] & 0xff;
+ W[I] = t1;
+}
+
+static void BLEND_OP(int I, unsigned long long *W) {
+ W[I] = s1(W[I-2]) + W[I-7] + s0(W[I-15]) + W[I-16];
+}
+
+static void
+sha512_transform(unsigned long long *state,
+ const unsigned char *input) {
+ unsigned long long a, b, c, d, e, f, g, h, t1, t2;
+ unsigned long long W[80];
+
+ int i;
+
+ /* load the input */
+ for (i = 0; i < 16; i++)
+ LOAD_OP(i, W, input);
+
+ for (i = 16; i < 80; i++) {
+ BLEND_OP(i, W);
+ }
+
+ /* load the state into our registers */
+ a=state[0]; b=state[1]; c=state[2]; d=state[3];
+ e=state[4]; f=state[5]; g=state[6]; h=state[7];
+
+ /* now iterate */
+ for (i=0; i<80; i+=8) {
+ t1 = h + e1(e) + Ch(e,f,g) + sha512_K[i ] + W[i ];
+ t2 = e0(a) + Maj(a,b,c); d+=t1; h=t1+t2;
+ t1 = g + e1(d) + Ch(d,e,f) + sha512_K[i+1] + W[i+1];
+ t2 = e0(h) + Maj(h,a,b); c+=t1; g=t1+t2;
+ t1 = f + e1(c) + Ch(c,d,e) + sha512_K[i+2] + W[i+2];
+ t2 = e0(g) + Maj(g,h,a); b+=t1; f=t1+t2;
+ t1 = e + e1(b) + Ch(b,c,d) + sha512_K[i+3] + W[i+3];
+ t2 = e0(f) + Maj(f,g,h); a+=t1; e=t1+t2;
+ t1 = d + e1(a) + Ch(a,b,c) + sha512_K[i+4] + W[i+4];
+ t2 = e0(e) + Maj(e,f,g); h+=t1; d=t1+t2;
+ t1 = c + e1(h) + Ch(h,a,b) + sha512_K[i+5] + W[i+5];
+ t2 = e0(d) + Maj(d,e,f); g+=t1; c=t1+t2;
+ t1 = b + e1(g) + Ch(g,h,a) + sha512_K[i+6] + W[i+6];
+ t2 = e0(c) + Maj(c,d,e); f+=t1; b=t1+t2;
+ t1 = a + e1(f) + Ch(f,g,h) + sha512_K[i+7] + W[i+7];
+ t2 = e0(b) + Maj(b,c,d); e+=t1; a=t1+t2;
+ }
+
+ state[0] += a; state[1] += b; state[2] += c; state[3] += d;
+ state[4] += e; state[5] += f; state[6] += g; state[7] += h;
+
+ /* erase our data */
+ a = b = c = d = e = f = g = h = t1 = t2 = 0;
+ memset(W, 0, 80 * sizeof(unsigned long long));
+}
+
+static void
+sha512_init(struct sha512_ctx * sctx) {
+ sctx->state[0] = H0;
+ sctx->state[1] = H1;
+ sctx->state[2] = H2;
+ sctx->state[3] = H3;
+ sctx->state[4] = H4;
+ sctx->state[5] = H5;
+ sctx->state[6] = H6;
+ sctx->state[7] = H7;
+ sctx->count[0] = sctx->count[1] = sctx->count[2] = sctx->count[3] = 0;
+ memset(sctx->buf, 0, sizeof(sctx->buf));
+}
+
+static void
+sha512_update(struct sha512_ctx * sctx,
+ const unsigned char *data,
+ unsigned int len) {
+ unsigned int i, index, part_len;
+
+ /* Compute number of bytes mod 128 */
+ index = (unsigned int)((sctx->count[0] >> 3) & 0x7F);
+
+ /* Update number of bits */
+ if ((sctx->count[0] += (len << 3)) < (len << 3)) {
+ if ((sctx->count[1] += 1) < 1)
+ if ((sctx->count[2] += 1) < 1)
+ sctx->count[3]++;
+ sctx->count[1] += (len >> 29);
+ }
+
+ part_len = 128 - index;
+
+ /* Transform as many times as possible. */
+ if (len >= part_len) {
+ memcpy(&sctx->buf[index], data, part_len);
+ sha512_transform(sctx->state, sctx->buf);
+
+ for (i = part_len; i + 127 < len; i+=128)
+ sha512_transform(sctx->state, &data[i]);
+
+ index = 0;
+ } else {
+ i = 0;
+ }
+
+ /* Buffer remaining input */
+ memcpy(&sctx->buf[index], &data[i], len - i);
+}
+
+static void
+sha512_final(struct sha512_ctx * sctx,
+ unsigned char *hash) {
+ static unsigned char padding[128] = { 0x80, };
+
+ unsigned int t;
+ unsigned long long t2;
+ unsigned char bits[128];
+ unsigned int index, pad_len;
+ int i, j;
+
+ index = pad_len = t = i = j = 0;
+ t2 = 0;
+
+ /* Save number of bits */
+ t = sctx->count[0];
+ bits[15] = t; t>>=8;
+ bits[14] = t; t>>=8;
+ bits[13] = t; t>>=8;
+ bits[12] = t;
+ t = sctx->count[1];
+ bits[11] = t; t>>=8;
+ bits[10] = t; t>>=8;
+ bits[9 ] = t; t>>=8;
+ bits[8 ] = t;
+ t = sctx->count[2];
+ bits[7 ] = t; t>>=8;
+ bits[6 ] = t; t>>=8;
+ bits[5 ] = t; t>>=8;
+ bits[4 ] = t;
+ t = sctx->count[3];
+ bits[3 ] = t; t>>=8;
+ bits[2 ] = t; t>>=8;
+ bits[1 ] = t; t>>=8;
+ bits[0 ] = t;
+
+ /* Pad out to 112 mod 128. */
+ index = (sctx->count[0] >> 3) & 0x7f;
+ pad_len = (index < 112) ? (112 - index) : ((128+112) - index);
+ sha512_update(sctx, padding, pad_len);
+
+ /* Append length (before padding) */
+ sha512_update(sctx, bits, 16);
+
+ /* Store state in digest */
+ for (i = j = 0; i < 8; i++, j += 8) {
+ t2 = sctx->state[i];
+ hash[j+7] = (char)t2 & 0xff; t2>>=8;
+ hash[j+6] = (char)t2 & 0xff; t2>>=8;
+ hash[j+5] = (char)t2 & 0xff; t2>>=8;
+ hash[j+4] = (char)t2 & 0xff; t2>>=8;
+ hash[j+3] = (char)t2 & 0xff; t2>>=8;
+ hash[j+2] = (char)t2 & 0xff; t2>>=8;
+ hash[j+1] = (char)t2 & 0xff; t2>>=8;
+ hash[j ] = (char)t2 & 0xff;
+ }
+
+ /* Zeroize sensitive information. */
+ memset(sctx, 0, sizeof(struct sha512_ctx));
+}
+
+/**
+ * Hash block of given size.
+ *
+ * @param block the data to hash, length is given as a second argument
+ * @param size the length of the data to hash
+ * @param ret pointer to where to write the hashcode
+ */
+void hash(const void * block,
+ unsigned int size,
+ HashCode512 * ret) {
+ struct sha512_ctx ctx;
+
+ sha512_init(&ctx);
+ sha512_update(&ctx, block, size);
+ sha512_final(&ctx, (unsigned char*) ret);
+}
+
+/**
+ * Compute the hash of an entire file. Does NOT load the entire file
+ * into memory but instead processes it in blocks. Very important for
+ * large files.
+ *
+ * @return OK on success, SYSERR on error
+ */
+int getFileHash(struct GE_Context * ectx,
+ const char * filename,
+ HashCode512 * ret) {
+ unsigned char * buf;
+ unsigned long long len;
+ unsigned long long pos;
+ unsigned int delta;
+ int fh;
+ struct sha512_ctx ctx;
+
+ if (OK != getFileSize(ectx,
+ filename,
+ &len))
+ return SYSERR;
+ fh = fileopen(ectx,
+ filename,
+ O_RDONLY | O_LARGEFILE);
+ if (fh == -1) {
+ GE_LOG_STRERROR_FILE(ectx,
+ GE_ERROR | GE_USER | GE_ADMIN | GE_REQUEST,
+ "open",
+ filename);
+ return SYSERR;
+ }
+ sha512_init(&ctx);
+ pos = 0;
+ buf = MALLOC(65536);
+ while (pos < len) {
+ delta = 65536;
+ if (len - pos < delta)
+ delta = len-pos;
+ if (delta != READ(fh,
+ buf,
+ delta)) {
+ GE_LOG_STRERROR_FILE(ectx,
+ GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
+ "read",
+ filename);
+ if (0 != CLOSE(fh))
+ GE_LOG_STRERROR_FILE(ectx,
+ GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
+ "close",
+ filename);
+ FREE(buf);
+ return SYSERR;
+ }
+ sha512_update(&ctx,
+ buf,
+ delta);
+ if (pos + delta > pos)
+ pos += delta;
+ else
+ break;
+ }
+ if (0 != CLOSE(fh))
+ GE_LOG_STRERROR_FILE(ectx,
+ GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
+ "close",
+ filename);
+ sha512_final(&ctx,
+ (unsigned char*) ret);
+ FREE(buf);
+ return OK;
+}
+
+
+/* ***************** binary-ASCII encoding *************** */
+
+/**
+ * 32 characters for encoding (hash => 32 characters)
+ */
+static char * encTable__ = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
+
+static unsigned int getValue__(unsigned char a) {
+ if ( (a >= '0') && (a <= '9') )
+ return a - '0';
+ if ( (a >= 'A') && (a <= 'V') )
+ return (a - 'A' + 10);
+ return -1;
+}
+
+/**
+ * Convert hash to ASCII encoding. The ASCII encoding is rather
+ * GNUnet specific. It was chosen such that it only uses characters
+ * in [0-9A-V], can be produced without complex arithmetics and uses a
+ * small number of characters. The GNUnet encoding uses 102
+ * characters plus a null terminator.
+ *
+ * @param block the hash code
+ * @param result where to store the encoding (EncName can be
+ * safely cast to char*, a '\0' termination is set).
+ */
+void hash2enc(const HashCode512 * block,
+ EncName * result) {
+ unsigned int wpos;
+ unsigned int rpos;
+ unsigned int bits;
+ unsigned int vbit;
+
+ GE_ASSERT(NULL, block != NULL);
+ GE_ASSERT(NULL, result != NULL);
+ vbit = 0;
+ wpos = 0;
+ rpos = 0;
+ bits = 0;
+ while ( (rpos < sizeof(HashCode512)) ||
+ (vbit > 0) ) {
+ if ( (rpos < sizeof(HashCode512)) &&
+ (vbit < 5) ) {
+ bits = (bits << 8) | ((unsigned char*)block)[rpos++]; /* eat 8 more bits
*/
+ vbit += 8;
+ }
+ if (vbit < 5) {
+ bits = bits << (5 - vbit); /* zero-padding */
+ GE_ASSERT(NULL, vbit == 2); /* padding by 3: 512+3 mod 5 == 0 */
+ vbit = 5;
+ }
+ GE_ASSERT(NULL, wpos < sizeof(EncName)-1);
+ result->encoding[wpos++] = encTable__[(bits >> (vbit - 5)) & 31];
+ vbit -= 5;
+ }
+ GE_ASSERT(NULL, wpos == sizeof(EncName)-1);
+ GE_ASSERT(NULL, vbit == 0);
+ result->encoding[wpos] = '\0';
+}
+
+/**
+ * Convert ASCII encoding back to hash
+ *
+ * @param enc the encoding
+ * @param result where to store the hash code
+ * @return OK on success, SYSERR if result has the wrong encoding
+ */
+int enc2hash(const char * enc,
+ HashCode512 * result) {
+ unsigned int rpos;
+ unsigned int wpos;
+ unsigned int bits;
+ unsigned int vbit;
+
+ if (strlen(enc) != sizeof(EncName)-1)
+ return SYSERR;
+
+ vbit = 2; /* padding! */
+ wpos = sizeof(HashCode512);
+ rpos = sizeof(EncName)-1;
+ bits = getValue__(enc[--rpos]) >> 3;
+ while (wpos > 0) {
+ GE_ASSERT(NULL, rpos > 0);
+ bits = (getValue__(enc[--rpos]) << vbit) | bits;
+ vbit += 5;
+ if (vbit >= 8) {
+ ((unsigned char*)result)[--wpos]
+ = (unsigned char) bits;
+ bits = bits >> 8;
+ vbit -= 8;
+ }
+ }
+ GE_ASSERT(NULL, rpos == 0);
+ GE_ASSERT(NULL, vbit == 0);
+ return OK;
+}
+
+/**
+ * Compute the distance between 2 hashcodes. The computation must be
+ * fast, not involve bits[0] or bits[4] (they're used elsewhere), and be
+ * somewhat consistent. And of course, the result should be a positive
+ * number.
+ *
+ * @returns a positive number which is a measure for
+ * hashcode proximity.
+ */
+unsigned int distanceHashCode512(const HashCode512 * a,
+ const HashCode512 * b) {
+ unsigned int x = (a->bits[1] - b->bits[1])>>16;
+ return ((x*x)>>16);
+}
+
+/**
+ * Compare two hashcodes.
+ * @return 1 if they are equal, 0 if not.
+ */
+int equalsHashCode512(const HashCode512 * a,
+ const HashCode512 * b) {
+ return (0 == memcmp(a,b,sizeof(HashCode512)));
+}
+
+void makeRandomId(HashCode512 * result) {
+ int i;
+ for (i=(sizeof(HashCode512)/sizeof(unsigned int))-1;i>=0;i--)
+ result->bits[i] = rand();
+}
+
+void deltaId(const HashCode512 * a,
+ const HashCode512 * b,
+ HashCode512 * result) {
+ int i;
+ for (i=(sizeof(HashCode512)/sizeof(unsigned int))-1;i>=0;i--)
+ result->bits[i] = b->bits[i] - a->bits[i];
+}
+
+void addHashCodes(const HashCode512 * a,
+ const HashCode512 * delta,
+ HashCode512 * result) {
+ int i;
+ for (i=(sizeof(HashCode512)/sizeof(unsigned int))-1;i>=0;i--)
+ result->bits[i] = delta->bits[i] + a->bits[i];
+}
+
+void xorHashCodes(const HashCode512 * a,
+ const HashCode512 * b,
+ HashCode512 * result) {
+ int i;
+ for (i=(sizeof(HashCode512)/sizeof(unsigned int))-1;i>=0;i--)
+ result->bits[i] = a->bits[i] ^ a->bits[i];
+}
+
+/**
+ * Convert a hashcode into a key.
+ */
+void hashToKey(const HashCode512 * hc,
+ SESSIONKEY * skey,
+ INITVECTOR * iv) {
+ GE_ASSERT(NULL,
+ sizeof(HashCode512) >=
+ SESSIONKEY_LEN +
+ sizeof(INITVECTOR));
+ memcpy(skey,
+ hc,
+ SESSIONKEY_LEN);
+ skey->crc32 = htonl(crc32N(skey,
+ SESSIONKEY_LEN));
+ memcpy(iv,
+ &((char *)hc)[SESSIONKEY_LEN],
+ sizeof(INITVECTOR));
+}
+
+/**
+ * Obtain a bit from a hashcode.
+ * @param code the hash to index bit-wise
+ * @param bit index into the hashcode, [0...511]
+ * @return Bit \a bit from hashcode \a code, -1 for invalid index
+ */
+int getHashCodeBit(const HashCode512 * code,
+ unsigned int bit) {
+ if (bit >= 8 * sizeof(HashCode512)) {
+ BREAK();
+ return -1; /* error */
+ }
+ return (((unsigned char*)code)[bit >> 3] & (1 << bit & 7)) > 0;
+}
+
+/**
+ * Compare function for HashCodes, producing a total ordering
+ * of all hashcodes.
+ * @return 1 if h1 > h2, -1 if h1 < h2 and 0 if h1 == h2.
+ */
+int hashCodeCompare(const HashCode512 * h1,
+ const HashCode512 * h2) {
+ unsigned int * i1;
+ unsigned int * i2;
+ int i;
+
+ i1 = (unsigned int*) h1;
+ i2 = (unsigned int*) h2;
+ for (i=(sizeof(HashCode512) / sizeof(unsigned int))-1;i>=0;i--) {
+ if (i1[i] > i2[i])
+ return 1;
+ if (i1[i] < i2[i])
+ return -1;
+ }
+ return 0;
+}
+
+/**
+ * Find out which of the two hash codes is closer to target
+ * in the XOR metric (Kademlia).
+ * @return -1 if h1 is closer, 1 if h2 is closer and 0 if h1==h2.
+ */
+int hashCodeCompareDistance(const HashCode512 * h1,
+ const HashCode512 * h2,
+ const HashCode512 * target) {
+ int i;
+ unsigned int d1;
+ unsigned int d2;
+
+ for (i=sizeof(HashCode512)/sizeof(unsigned int)-1;i>=0;i--) {
+ d1 = ((unsigned int*)h1)[i] ^ ((unsigned int*)target)[i];
+ d2 = ((unsigned int*)h2)[i] ^ ((unsigned int*)target)[i];
+ if (d1 > d2)
+ return 1;
+ else if (d1 < d2)
+ return -1;
+ }
+ return 0;
+}
+
+/* end of hashing.c */
Added: GNUnet/src/util/crypto/hashingtest.c
===================================================================
--- GNUnet/src/util/crypto/hashingtest.c 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/crypto/hashingtest.c 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,51 @@
+/**
+ * Test for hashing.c
+ * @author Christian Grothoff
+ * @file util/hashingtest.c
+ */
+
+#include "platform.h"
+#include "gnunet_util.h"
+#include "locking_gcrypt.h"
+
+static int test(int number) {
+ HashCode512 h1;
+ HashCode512 h2;
+ EncName enc;
+
+ memset(&h1, number, sizeof(HashCode512));
+ hash2enc(&h1, &enc);
+ if (OK != enc2hash((char*)&enc, &h2)) {
+ printf("enc2hash failed!\n");
+ return 1;
+ }
+
+ if (! equalsHashCode512(&h1, &h2)) {
+ return 1;
+ }
+ return 0;
+}
+
+static int testEncoding() {
+ int i;
+ for (i=0;i<255;i++)
+ if (0 != test(i))
+ return 1;
+ return 0;
+}
+
+int main(int argc, char * argv[]) {
+ int failureCount = 0;
+ int i;
+
+ initLockingGcrypt();
+ for (i=0;i<10;i++)
+ failureCount += testEncoding();
+ doneLockingGcrypt();
+ if (failureCount == 0)
+ return 0;
+ else
+ return 1;
+}
+
+/* end of hashingtest.c */
Added: GNUnet/src/util/crypto/hostkey_gcrypt.c
===================================================================
--- GNUnet/src/util/crypto/hostkey_gcrypt.c 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/crypto/hostkey_gcrypt.c 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,1043 @@
+/*
+ This file is part of GNUnet.
+ (C) 2001, 2002, 2003, 2004, 2005 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 util/hostkey_gcrypt.c
+ * @brief public key cryptography (RSA) with libgcrypt
+ * @author Christian Grothoff
+ *
+ * Note that the code locks often needlessly on the gcrypt-locking api.
+ * One would think that simple MPI operations should not require locking
+ * (since only global operations on the random pool must be locked,
+ * strictly speaking). But libgcrypt does sometimes require locking in
+ * unexpected places, so the safe solution is to always lock even if it
+ * is not required. The performance impact is minimal anyway.
+ */
+
+#include "gnunet_util.h"
+#include "gnunet_util_crypto.h"
+#include "locking_gcrypt.h"
+#include "platform.h"
+#include <gcrypt.h>
+
+/**
+ * Use LOG_ERROR for anything that should never happen
+ * (indicates a bug).
+ */
+#define LOG_ERROR (GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK)
+
+/**
+ * The private information of an RSA key pair.
+ */
+struct PrivateKey {
+ gcry_sexp_t sexp;
+};
+
+#define HOSTKEY_LEN 2048
+
+#define EXTRA_CHECKS ALLOW_EXTRA_CHECKS
+
+
+/**
+ * Log an error message at log-level 'level' that indicates
+ * a failure of the command 'cmd' with the message given
+ * by gcry_strerror(rc).
+ */
+#define LOG_GCRY(ectx, level, cmd, rc) do { GE_LOG(ectx, level, _("`%s' failed
at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, gcry_strerror(rc)); }
while(0);
+
+/**
+ * Die with an error message that indicates
+ * a failure of the command 'cmd' with the message given
+ * by gcry_strerror(rc).
+ */
+#define DIE_GCRY(ectx, cmd, rc) do { GE_LOG(ectx, GE_FATAL | GE_USER |
GE_DEVELOPER | GE_IMMEDIATE, _("`%s' failed at %s:%d with error: %s\n"), cmd,
__FILE__, __LINE__, gcry_strerror(rc)); abort(); } while(0);
+
+
+
+/**
+ * If target != size, move target bytes to the
+ * end of the size-sized buffer and zero out the
+ * first target-size bytes.
+ */
+static void adjust(unsigned char * buf,
+ size_t size,
+ size_t target) {
+ if (size < target) {
+ memmove(&buf[target-size],
+ buf,
+ size);
+ memset(buf,
+ 0,
+ target-size);
+ }
+}
+
+/**
+ * This HostKey implementation uses RSA.
+ */
+struct PrivateKey * makePrivateKey() {
+ struct PrivateKey * ret;
+ gcry_sexp_t s_key;
+ gcry_sexp_t s_keyparam;
+ int rc;
+
+ lockGcrypt();
+ rc = gcry_sexp_build(&s_keyparam,
+ NULL,
+ "(genkey(rsa(nbits %d)(rsa-use-e 3:257)))",
+ HOSTKEY_LEN);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_sexp_build",
+ rc);
+ unlockGcrypt();
+ return NULL;
+ }
+ rc = gcry_pk_genkey(&s_key,
+ s_keyparam);
+ gcry_sexp_release(s_keyparam);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_pk_genkey",
+ rc);
+ unlockGcrypt();
+ return NULL;
+ }
+
+#if EXTRA_CHECKS
+ if ((rc=gcry_pk_testkey(s_key))) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_pk_testkey",
+ rc);
+ unlockGcrypt();
+ return NULL;
+ }
+#endif
+ unlockGcrypt();
+ ret = MALLOC(sizeof(struct PrivateKey));
+ ret->sexp = s_key;
+ return ret;
+}
+
+/**
+ * Free memory occupied by hostkey
+ */
+void freePrivateKey(struct PrivateKey * hostkey) {
+ lockGcrypt();
+ gcry_sexp_release(hostkey->sexp);
+ unlockGcrypt();
+ FREE(hostkey);
+}
+
+static int key_from_sexp( gcry_mpi_t *array,
+ gcry_sexp_t sexp,
+ const char *topname,
+ const char *elems ) {
+ gcry_sexp_t list, l2;
+ const char *s;
+ int i, idx;
+
+ lockGcrypt();
+ list = gcry_sexp_find_token( sexp, topname, 0 );
+ if( !list ) {
+ unlockGcrypt();
+ return 1;
+ }
+ l2 = gcry_sexp_cadr( list );
+ gcry_sexp_release ( list );
+ list = l2;
+ if( !list ) {
+ unlockGcrypt();
+ return 2;
+ }
+
+ idx = 0;
+ for(s=elems; *s; s++, idx++ ) {
+ l2 = gcry_sexp_find_token( list, s, 1 );
+ if( !l2 ) {
+ for(i=0; i<idx; i++) {
+ gcry_free( array[i] );
+ array[i] = NULL;
+ }
+ gcry_sexp_release ( list );
+ unlockGcrypt();
+ return 3; /* required parameter not found */
+ }
+ array[idx] = gcry_sexp_nth_mpi( l2, 1, GCRYMPI_FMT_USG );
+ gcry_sexp_release ( l2 );
+ if( !array[idx] ) {
+ for(i=0; i<idx; i++) {
+ gcry_free( array[i] );
+ array[i] = NULL;
+ }
+ gcry_sexp_release ( list );
+ unlockGcrypt();
+ return 4; /* required parameter is invalid */
+ }
+ }
+ gcry_sexp_release ( list );
+ unlockGcrypt();
+ return 0;
+}
+
+/**
+ * Extract the public key of the host.
+ * @param hostkey the hostkey to extract into the result.
+ * @param result where to write the result.
+ */
+void getPublicKey(const struct PrivateKey * hostkey,
+ PublicKey * result) {
+ gcry_mpi_t skey[2];
+ size_t size;
+ int rc;
+
+ lockGcrypt();
+ rc = key_from_sexp(skey,
+ hostkey->sexp,
+ "public-key",
+ "ne");
+ if (rc)
+ rc = key_from_sexp(skey,
+ hostkey->sexp,
+ "private-key",
+ "ne");
+ if (rc)
+ rc = key_from_sexp(skey,
+ hostkey->sexp,
+ "rsa",
+ "ne");
+ if (rc)
+ DIE_GCRY(NULL, "key_from_sexp", rc);
+
+ result->len = htons(sizeof(PublicKey) - sizeof(result->padding));
+ result->sizen = htons(RSA_ENC_LEN);
+ result->padding = 0;
+ size = RSA_ENC_LEN;
+ rc = gcry_mpi_print(GCRYMPI_FMT_USG,
+ &result->key[0],
+ size,
+ &size,
+ skey[0]);
+ if (rc)
+ DIE_GCRY(NULL, "gcry_mpi_print", rc);
+ adjust(&result->key[0], size, RSA_ENC_LEN);
+ size = RSA_KEY_LEN - RSA_ENC_LEN;
+ rc = gcry_mpi_print(GCRYMPI_FMT_USG,
+ &result->key[RSA_ENC_LEN],
+ size,
+ &size,
+ skey[1]);
+ if (rc)
+ DIE_GCRY(NULL, "gcry_mpi_print", rc);
+ adjust(&result->key[RSA_ENC_LEN],
+ size,
+ RSA_KEY_LEN - RSA_ENC_LEN);
+ gcry_mpi_release(skey[0]);
+ gcry_mpi_release(skey[1]);
+ unlockGcrypt();
+}
+
+
+/**
+ * Internal: publicKey => RSA-Key.
+ *
+ * Note that the return type is not actually a private
+ * key but rather an sexpression for the public key!
+ */
+static struct PrivateKey *
+public2PrivateKey(const PublicKey * publicKey) {
+ struct PrivateKey * ret;
+ gcry_sexp_t result;
+ gcry_mpi_t n;
+ gcry_mpi_t e;
+ size_t size;
+ size_t erroff;
+ int rc;
+
+ if ( ( ntohs(publicKey->sizen) != RSA_ENC_LEN ) ||
+ ( ntohs(publicKey->len) != sizeof(PublicKey) -
sizeof(publicKey->padding)) ) {
+ BREAK();
+ return NULL;
+ }
+ size = RSA_ENC_LEN;
+ lockGcrypt();
+ rc = gcry_mpi_scan(&n,
+ GCRYMPI_FMT_USG,
+ &publicKey->key[0],
+ size,
+ &size);
+ if (rc) {
+ LOG_GCRY(NULL, LOG_ERROR, "gcry_mpi_scan", rc);
+ unlockGcrypt();
+ return NULL;
+ }
+ size = RSA_KEY_LEN - RSA_ENC_LEN;
+ rc = gcry_mpi_scan(&e,
+ GCRYMPI_FMT_USG,
+ &publicKey->key[RSA_ENC_LEN],
+ size,
+ &size);
+ if (rc) {
+ LOG_GCRY(NULL, LOG_ERROR, "gcry_mpi_scan", rc);
+ gcry_mpi_release(n);
+ unlockGcrypt();
+ return NULL;
+ }
+ rc = gcry_sexp_build(&result,
+ &erroff,
+ "(public-key(rsa(n %m)(e %m)))",
+ n,
+ e);
+ gcry_mpi_release(n);
+ gcry_mpi_release(e);
+ if (rc) {
+ LOG_GCRY(NULL, LOG_ERROR, "gcry_sexp_build", rc); /* erroff gives more
info */
+ unlockGcrypt();
+ return NULL;
+ }
+ unlockGcrypt();
+ ret = MALLOC(sizeof(struct PrivateKey));
+ ret->sexp = result;
+ return ret;
+}
+
+/**
+ * Encode the private key in a format suitable for
+ * storing it into a file.
+ * @returns encoding of the private key.
+ * The first 4 bytes give the size of the array, as usual.
+ */
+PrivateKeyEncoded *
+encodePrivateKey(const struct PrivateKey * hostkey) {
+ PrivateKeyEncoded * retval;
+ gcry_mpi_t pkv[6];
+ void * pbu[6];
+ size_t sizes[6];
+ int rc;
+ int i;
+ int size;
+
+ lockGcrypt();
+#if EXTRA_CHECKS
+ if (gcry_pk_testkey(hostkey->sexp)) {
+ BREAK();
+ unlockGcrypt();
+ return NULL;
+ }
+#endif
+
+ memset(pkv, 0, sizeof(gcry_mpi_t) * 6);
+ rc = key_from_sexp(pkv,
+ hostkey->sexp,
+ "private-key",
+ "nedpqu");
+ if (rc)
+ rc = key_from_sexp(pkv,
+ hostkey->sexp,
+ "rsa",
+ "nedpqu");
+ if (rc)
+ rc = key_from_sexp(pkv,
+ hostkey->sexp,
+ "private-key",
+ "nedpq");
+ if (rc)
+ rc = key_from_sexp(pkv,
+ hostkey->sexp,
+ "rsa",
+ "nedpq");
+ if (rc)
+ rc = key_from_sexp(pkv,
+ hostkey->sexp,
+ "private-key",
+ "ned");
+ if (rc)
+ rc = key_from_sexp(pkv,
+ hostkey->sexp,
+ "rsa",
+ "ned");
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "key_from_sexp",
+ rc);
+ unlockGcrypt();
+ return NULL;
+ }
+ size = sizeof(PrivateKeyEncoded);
+ for (i=0;i<6;i++) {
+ if (pkv[i] != NULL) {
+ rc = gcry_mpi_aprint(GCRYMPI_FMT_USG,
+ (unsigned char**) &pbu[i],
+ &sizes[i],
+ pkv[i]);
+ size += sizes[i];
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_mpi_aprint",
+ rc);
+ while (i>0)
+ if (pbu[i] != NULL)
+ free(pbu[--i]);
+ for (i=0;i<6;i++)
+ if (pkv[i] != NULL)
+ gcry_mpi_release(pkv[i]);
+ unlockGcrypt();
+ return NULL;
+ }
+ } else {
+ pbu[i] = NULL;
+ sizes[i] = 0;
+ }
+ }
+ GNUNET_ASSERT(size < 65536);
+ retval = MALLOC(size);
+ retval->len = htons(size);
+ i = 0;
+ retval->sizen = htons(sizes[0]);
+ memcpy(&((char*)(&retval[1]))[i],
+ pbu[0],
+ sizes[0]);
+ i += sizes[0];
+ retval->sizee = htons(sizes[1]);
+ memcpy(&((char*)(&retval[1]))[i],
+ pbu[1],
+ sizes[1]);
+ i += sizes[1];
+ retval->sized = htons(sizes[2]);
+ memcpy(&((char*)(&retval[1]))[i],
+ pbu[2],
+ sizes[2]);
+ i += sizes[2];
+ /* swap p and q! */
+ retval->sizep = htons(sizes[4]);
+ memcpy(&((char*)(&retval[1]))[i],
+ pbu[4],
+ sizes[4]);
+ i += sizes[4];
+ retval->sizeq = htons(sizes[3]);
+ memcpy(&((char*)(&retval[1]))[i],
+ pbu[3],
+ sizes[3]);
+ i += sizes[3];
+ retval->sizedmp1 = htons(0);
+ retval->sizedmq1 = htons(0);
+ memcpy(&((char*)(&retval[1]))[i],
+ pbu[5],
+ sizes[5]);
+ for (i=0;i<6;i++) {
+ if (pkv[i] != NULL)
+ gcry_mpi_release(pkv[i]);
+ if (pbu[i] != NULL)
+ free(pbu[i]);
+ }
+ unlockGcrypt();
+ return retval;
+}
+
+/**
+ * Decode the private key from the file-format back
+ * to the "normal", internal format.
+ */
+struct PrivateKey *
+decodePrivateKey(const PrivateKeyEncoded * encoding) {
+ struct PrivateKey * ret;
+ gcry_sexp_t res;
+ gcry_mpi_t n,e,d,p,q,u;
+ int rc;
+ size_t size;
+ int pos;
+
+ pos = 0;
+ size = ntohs(encoding->sizen);
+ lockGcrypt();
+ rc = gcry_mpi_scan(&n,
+ GCRYMPI_FMT_USG,
+ &((const unsigned char*)(&encoding[1]))[pos],
+ size,
+ &size);
+ pos += ntohs(encoding->sizen);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_mpi_scan",
+ rc);
+ unlockGcrypt();
+ return NULL;
+ }
+ size = ntohs(encoding->sizee);
+ rc = gcry_mpi_scan(&e,
+ GCRYMPI_FMT_USG,
+ &((const unsigned char*)(&encoding[1]))[pos],
+ size,
+ &size);
+ pos += ntohs(encoding->sizee);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_mpi_scan",
+ rc);
+ gcry_mpi_release(n);
+ unlockGcrypt();
+ return NULL;
+ }
+ size = ntohs(encoding->sized);
+ rc = gcry_mpi_scan(&d,
+ GCRYMPI_FMT_USG,
+ &((const unsigned char*)(&encoding[1]))[pos],
+ size,
+ &size);
+ pos += ntohs(encoding->sized);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_mpi_scan",
+ rc);
+ gcry_mpi_release(n);
+ gcry_mpi_release(e);
+ unlockGcrypt();
+ return NULL;
+ }
+ /* swap p and q! */
+ size = ntohs(encoding->sizep);
+ if (size > 0) {
+ rc = gcry_mpi_scan(&q,
+ GCRYMPI_FMT_USG,
+ &((const unsigned char*)(&encoding[1]))[pos],
+ size,
+ &size);
+ pos += ntohs(encoding->sizep);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_mpi_scan",
+ rc);
+ gcry_mpi_release(n);
+ gcry_mpi_release(e);
+ gcry_mpi_release(d);
+ unlockGcrypt();
+ return NULL;
+ }
+ } else
+ q = NULL;
+ size = ntohs(encoding->sizeq);
+ if (size > 0) {
+ rc = gcry_mpi_scan(&p,
+ GCRYMPI_FMT_USG,
+ &((const unsigned char*)(&encoding[1]))[pos],
+ size,
+ &size);
+ pos += ntohs(encoding->sizeq);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_mpi_scan",
+ rc);
+ gcry_mpi_release(n);
+ gcry_mpi_release(e);
+ gcry_mpi_release(d);
+ if (q != NULL)
+ gcry_mpi_release(q);
+ unlockGcrypt();
+ return NULL;
+ }
+ } else
+ p = NULL;
+ pos += ntohs(encoding->sizedmp1);
+ pos += ntohs(encoding->sizedmq1);
+ size = ntohs(encoding->len) - sizeof(PrivateKeyEncoded) - pos;
+ if (size > 0) {
+ rc = gcry_mpi_scan(&u,
+ GCRYMPI_FMT_USG,
+ &((const unsigned char*)(&encoding[1]))[pos],
+ size,
+ &size);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_mpi_scan",
+ rc);
+ gcry_mpi_release(n);
+ gcry_mpi_release(e);
+ gcry_mpi_release(d);
+ if (p != NULL)
+ gcry_mpi_release(p);
+ if (q != NULL)
+ gcry_mpi_release(q);
+ unlockGcrypt();
+ return NULL;
+ }
+ } else
+ u = NULL;
+
+ if ( (p != NULL) &&
+ (q != NULL) &&
+ (u != NULL) ) {
+ rc = gcry_sexp_build(&res,
+ &size, /* erroff */
+ "(private-key(rsa(n %m)(e %m)(d %m)(p %m)(q %m)(u
%m)))",
+ n, e, d, p, q, u);
+ } else {
+ if ( (p != NULL) &&
+ (q != NULL) ) {
+ rc = gcry_sexp_build(&res,
+ &size, /* erroff */
+ "(private-key(rsa(n %m)(e %m)(d %m)(p %m)(q %m)))",
+ n, e, d, p, q);
+ } else {
+ rc = gcry_sexp_build(&res,
+ &size, /* erroff */
+ "(private-key(rsa(n %m)(e %m)(d %m)))",
+ n, e, d);
+ }
+ }
+ gcry_mpi_release(n);
+ gcry_mpi_release(e);
+ gcry_mpi_release(d);
+ if (p != NULL)
+ gcry_mpi_release(p);
+ if (q != NULL)
+ gcry_mpi_release(q);
+ if (u != NULL)
+ gcry_mpi_release(u);
+
+ if (rc)
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_sexp_build", rc);
+#if EXTRA_CHECKS
+ if (gcry_pk_testkey(res)) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_pk_testkey", rc);
+ unlockGcrypt();
+ return NULL;
+ }
+#endif
+ ret = MALLOC(sizeof(struct PrivateKey));
+ ret->sexp = res;
+ unlockGcrypt();
+ return ret;
+}
+
+/**
+ * Encrypt a block with the public key of another host that uses the
+ * same cyper.
+ *
+ * @param block the block to encrypt
+ * @param size the size of block
+ * @param publicKey the encoded public key used to encrypt
+ * @param target where to store the encrypted block
+ * @returns SYSERR on error, OK if ok
+ */
+int encryptPrivateKey(const void * block,
+ unsigned short size,
+ const PublicKey * publicKey,
+ RSAEncryptedData * target) {
+ gcry_sexp_t result;
+ gcry_sexp_t data;
+ struct PrivateKey * pubkey;
+ gcry_mpi_t val;
+ gcry_mpi_t rval;
+ size_t isize;
+ size_t erroff;
+ int rc;
+
+ GNUNET_ASSERT(size <= sizeof(HashCode512));
+ pubkey = public2PrivateKey(publicKey);
+ isize = size;
+ lockGcrypt();
+ rc = gcry_mpi_scan(&val,
+ GCRYMPI_FMT_USG,
+ block,
+ isize,
+ &isize);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_mpi_scan", rc);
+ freePrivateKey(pubkey);
+ unlockGcrypt();
+ return SYSERR;
+ }
+ rc = gcry_sexp_build(&data,
+ &erroff,
+ "(data (flags pkcs1)(value %m))",
+ val);
+ gcry_mpi_release(val);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_sexp_build",
+ rc); /* more info in erroff */
+ freePrivateKey(pubkey);
+ unlockGcrypt();
+ return SYSERR;
+ }
+
+ rc = gcry_pk_encrypt(&result, data, pubkey->sexp);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_pk_encrypt",
+ rc);
+ gcry_sexp_release(data);
+ freePrivateKey(pubkey);
+ unlockGcrypt();
+ return SYSERR;
+ }
+ gcry_sexp_release(data);
+ freePrivateKey(pubkey);
+
+ rc = key_from_sexp(&rval,
+ result,
+ "rsa",
+ "a");
+ gcry_sexp_release(result);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "key_from_sexp",
+ rc);
+ unlockGcrypt();
+ return SYSERR;
+ }
+ isize = sizeof(RSAEncryptedData);
+ rc = gcry_mpi_print(GCRYMPI_FMT_USG,
+ (unsigned char*)target,
+ isize,
+ &isize,
+ rval);
+ gcry_mpi_release(rval);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_mpi_print",
+ rc);
+ unlockGcrypt();
+ return SYSERR;
+ }
+ adjust(&target->encoding[0],
+ isize,
+ sizeof(RSAEncryptedData));
+ unlockGcrypt();
+ return OK;
+}
+
+/**
+ * Decrypt a given block with the hostkey.
+ *
+ * @param hostkey the hostkey with which to decrypt this block
+ * @param block the data to decrypt, encoded as returned by encrypt
+ * @param result pointer to a location where the result can be stored
+ * @param max the maximum number of bits to store for the result, if
+ * the decrypted block is bigger, an error is returned
+ * @returns the size of the decrypted block, -1 on error
+ */
+int decryptPrivateKey(const struct PrivateKey * hostkey,
+ const RSAEncryptedData * block,
+ void * result,
+ unsigned short max) {
+ gcry_sexp_t resultsexp;
+ gcry_sexp_t data;
+ size_t erroff;
+ size_t size;
+ gcry_mpi_t val;
+ int rc;
+ unsigned char * endp;
+ unsigned char * tmp;
+
+ lockGcrypt();
+#if EXTRA_CHECKS
+ rc = gcry_pk_testkey(hostkey->sexp);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_pk_testkey",
+ rc);
+ unlockGcrypt();
+ return -1;
+ }
+#endif
+ size = sizeof(RSAEncryptedData);
+ rc = gcry_mpi_scan(&val,
+ GCRYMPI_FMT_USG,
+ &block->encoding[0],
+ size,
+ &size);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_mpi_scan",
+ rc);
+ unlockGcrypt();
+ return SYSERR;
+ }
+ rc = gcry_sexp_build(&data,
+ &erroff,
+ "(enc-val(flags)(rsa(a %m)))",
+ val);
+ gcry_mpi_release(val);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_sexp_build",
+ rc); /* more info in erroff */
+ unlockGcrypt();
+ return SYSERR;
+ }
+ rc = gcry_pk_decrypt(&resultsexp,
+ data,
+ hostkey->sexp);
+ gcry_sexp_release(data);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_pk_decrypt",
+ rc);
+ unlockGcrypt();
+ return SYSERR;
+ }
+
+ /* resultsexp has format "(value %m)" */
+ val = gcry_sexp_nth_mpi(resultsexp, 1, GCRYMPI_FMT_USG);
+ gcry_sexp_release(resultsexp);
+ if (val == NULL) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_sexp_nth_mpi",
+ rc);
+ unlockGcrypt();
+ return SYSERR;
+ }
+ tmp = MALLOC(max + HOSTKEY_LEN/8);
+ size = max+HOSTKEY_LEN/8;
+ rc = gcry_mpi_print(GCRYMPI_FMT_USG,
+ tmp,
+ size,
+ &size,
+ val);
+ gcry_mpi_release(val);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_mpi_print",
+ rc);
+ FREE(tmp);
+ unlockGcrypt();
+ return SYSERR;
+ }
+
+ endp = tmp;
+ endp += (size - max);
+ size = max;
+ memcpy(result,
+ endp,
+ size);
+ FREE(tmp);
+ unlockGcrypt();
+ return size;
+}
+
+/**
+ * Sign a given block.
+ *
+ * @param hostkey the hostkey with which to sign this block
+ * @param size how many bytes to sign
+ * @param block the data to sign
+ * @param sig where to write the signature
+ * @return SYSERR on error, OK on success
+ */
+int sign(const struct PrivateKey * hostkey,
+ unsigned short size,
+ const void * block,
+ Signature * sig) {
+ gcry_sexp_t result;
+ gcry_sexp_t data;
+ size_t ssize;
+ gcry_mpi_t rval;
+ HashCode512 hc;
+ char * buff;
+ int bufSize;
+ int rc;
+
+ hash(block, size, &hc);
+#define FORMATSTRING
"(4:data(5:flags5:pkcs1)(4:hash6:sha51264:0123456789012345678901234567890123456789012345678901234567890123))"
+ bufSize = strlen(FORMATSTRING) + 1;
+ buff = MALLOC(bufSize);
+ memcpy(buff,
+ FORMATSTRING,
+ bufSize);
+ memcpy(&buff[bufSize -
strlen("0123456789012345678901234567890123456789012345678901234567890123))") -
1],
+ &hc,
+ sizeof(HashCode512));
+ lockGcrypt();
+ rc = gcry_sexp_new(&data,
+ buff,
+ bufSize,
+ 0);
+ FREE(buff);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_sexp_new",
+ rc);
+ unlockGcrypt();
+ return SYSERR;
+ }
+ rc = gcry_pk_sign(&result, data, hostkey->sexp);
+ gcry_sexp_release(data);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_pk_sign",
+ rc);
+ unlockGcrypt();
+ return SYSERR;
+ }
+ rc = key_from_sexp(&rval,
+ result,
+ "rsa",
+ "s");
+ gcry_sexp_release(result);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "key_from_sexp",
+ rc);
+ unlockGcrypt();
+ return SYSERR;
+ }
+ ssize = sizeof(Signature);
+ rc = gcry_mpi_print(GCRYMPI_FMT_USG,
+ (unsigned char*)sig,
+ ssize,
+ &ssize,
+ rval);
+ gcry_mpi_release(rval);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_mpi_print",
+ rc);
+ unlockGcrypt();
+ return SYSERR;
+ }
+ adjust(&sig->sig[0],
+ ssize,
+ sizeof(Signature));
+ unlockGcrypt();
+ return OK;
+}
+
+/**
+ * Verify signature.
+ *
+ * @param block the signed data
+ * @param len the length of the block
+ * @param sig signature
+ * @param publicKey public key of the signer
+ * @returns OK if ok, SYSERR if invalid
+ */
+int verifySig(const void * block,
+ unsigned short len,
+ const Signature * sig,
+ const PublicKey * publicKey) {
+ gcry_sexp_t data;
+ gcry_sexp_t sigdata;
+ size_t size;
+ gcry_mpi_t val;
+ struct PrivateKey * hostkey;
+ HashCode512 hc;
+ char * buff;
+ int bufSize;
+ size_t erroff;
+ int rc;
+
+ size = sizeof(Signature);
+ lockGcrypt();
+ rc = gcry_mpi_scan(&val,
+ GCRYMPI_FMT_USG,
+ (const unsigned char*)sig,
+ size,
+ &size);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_mpi_scan",
+ rc);
+ unlockGcrypt();
+ return SYSERR;
+ }
+ rc = gcry_sexp_build(&sigdata,
+ &erroff,
+ "(sig-val(rsa(s %m)))",
+ val);
+ gcry_mpi_release(val);
+ if (rc) {
+ LOG_GCRY(NULL,
+ LOG_ERROR,
+ "gcry_sexp_build",
+ rc);
+ unlockGcrypt();
+ return SYSERR;
+ }
+ hash(block, len, &hc);
+ bufSize = strlen(FORMATSTRING) + 1;
+ buff = MALLOC(bufSize);
+ memcpy(buff,
+ FORMATSTRING,
+ bufSize);
+ memcpy(&buff[strlen(FORMATSTRING) -
+
strlen("0123456789012345678901234567890123456789012345678901234567890123))")],
+ &hc,
+ sizeof(HashCode512));
+ rc = gcry_sexp_new(&data,
+ buff,
+ bufSize,
+ 0);
+ FREE(buff);
+ hostkey = public2PrivateKey(publicKey);
+ rc = gcry_pk_verify(sigdata,
+ data,
+ hostkey->sexp);
+ freePrivateKey(hostkey);
+ gcry_sexp_release(data);
+ gcry_sexp_release(sigdata);
+ if (rc) {
+ GE_LOG(ectx,
+ GE_WARNING | GE_USER | GE_BULK | GE_DEVELOPER,
+ _("RSA signature verification failed at %s:%d: %s\n"),
+ __FILE__, __LINE__,
+ gcry_strerror(rc));
+ unlockGcrypt();
+ return SYSERR;
+ } else {
+ unlockGcrypt();
+ return OK;
+ }
+}
+
+
+/* end of hostkey_gcrypt.c */
Added: GNUnet/src/util/crypto/hostkeytest.c
===================================================================
--- GNUnet/src/util/crypto/hostkeytest.c 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/crypto/hostkeytest.c 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,253 @@
+/**
+ * @file test/hostkeytest.c
+ * @brief testcase for RSA public key crypto (hostkey.h)
+ * @author Christian Grothoff
+ */
+
+#include "gnunet_util.h"
+#include "locking_gcrypt.h"
+#include "platform.h"
+
+#define TESTSTRING "Hello World\0"
+#define MAX_TESTVAL sizeof(SESSIONKEY)
+#define ITER 10
+
+static int testEncryptDecrypt() {
+ struct PrivateKey * hostkey;
+ PublicKey pkey;
+ RSAEncryptedData target;
+ char result[MAX_TESTVAL];
+ int i;
+ TIME_T start;
+ int ok;
+
+ fprintf(stderr, "W");
+ hostkey = makePrivateKey();
+ getPublicKey(hostkey, &pkey);
+
+ ok = 0;
+ TIME(&start);
+ for (i=0;i<ITER;i++) {
+ fprintf(stderr, ".");
+ if (SYSERR == encryptPrivateKey(TESTSTRING,
+ strlen(TESTSTRING)+1,
+ &pkey,
+ &target)) {
+ fprintf(stderr,
+ "encryptPrivateKey returned SYSERR\n");
+ ok++;
+ continue;
+ }
+ if (-1 == decryptPrivateKey(hostkey,
+ &target,
+ result,
+ strlen(TESTSTRING)+1)) {
+ fprintf(stderr,
+ "decryptPrivateKey returned SYSERR\n");
+ ok++;
+ continue;
+
+ }
+ if (strncmp(TESTSTRING, result,
+ strlen(TESTSTRING)) != 0) {
+ printf("%s != %.*s - testEncryptDecrypt failed!\n",
+ TESTSTRING,
+ MAX_TESTVAL,
+ result);
+ ok++;
+ continue;
+ }
+ }
+ printf("%d RSA encrypt/decrypt operations %ds (%d failures)\n",
+ ITER,
+ (int) (TIME(NULL)-start),
+ ok);
+ freePrivateKey(hostkey);
+ if (ok == 0)
+ return OK;
+ else
+ return SYSERR;
+}
+
+
+static int testEncryptDecryptSK() {
+ struct PrivateKey * hostkey;
+ PublicKey pkey;
+ RSAEncryptedData target;
+ SESSIONKEY insk;
+ SESSIONKEY outsk;
+ int i;
+ TIME_T start;
+ int ok;
+
+ fprintf(stderr, "W");
+ hostkey = makePrivateKey();
+ getPublicKey(hostkey, &pkey);
+
+ ok = 0;
+ TIME(&start);
+ for (i=0;i<ITER;i++) {
+ fprintf(stderr, ".");
+ makeSessionkey(&insk);
+ if (SYSERR == encryptPrivateKey(&insk,
+ sizeof(SESSIONKEY),
+ &pkey,
+ &target)) {
+ fprintf(stderr,
+ "encryptPrivateKey returned SYSERR\n");
+ ok++;
+ continue;
+ }
+ if (-1 == decryptPrivateKey(hostkey,
+ &target,
+ &outsk,
+ sizeof(SESSIONKEY))) {
+ fprintf(stderr,
+ "decryptPrivateKey returned SYSERR\n");
+ ok++;
+ continue;
+ }
+ if (0 != memcmp(&insk,
+ &outsk,
+ sizeof(SESSIONKEY))) {
+ printf("testEncryptDecryptSK failed!\n");
+ ok++;
+ continue;
+ }
+ }
+ printf("%d RSA encrypt/decrypt SK operations %ds (%d failures)\n",
+ ITER,
+ (int) (TIME(NULL)-start),
+ ok);
+ freePrivateKey(hostkey);
+ if (ok == 0)
+ return OK;
+ else
+ return SYSERR;
+}
+
+static int testSignVerify() {
+ struct PrivateKey * hostkey;
+ Signature sig;
+ PublicKey pkey;
+ int i;
+ TIME_T start;
+ int ok = OK;
+
+ fprintf(stderr, "W");
+ hostkey = makePrivateKey();
+ getPublicKey(hostkey, &pkey);
+ TIME(&start);
+ for (i=0;i<ITER;i++) {
+ fprintf(stderr, ".");
+ if (SYSERR == sign(hostkey,
+ strlen(TESTSTRING),
+ TESTSTRING,
+ &sig)) {
+ fprintf(stderr,
+ "sign returned SYSERR\n");
+ ok = SYSERR;
+ continue;
+ }
+ if (SYSERR == verifySig(TESTSTRING,
+ strlen(TESTSTRING),
+ &sig,
+ &pkey)) {
+ printf("testSignVerify failed!\n");
+ ok = SYSERR;
+ continue;
+ }
+ }
+ printf("%d RSA sign/verify operations %ds\n",
+ ITER,
+ (int) (TIME(NULL)-start));
+ freePrivateKey(hostkey);
+ return ok;
+}
+
+static int testPrivateKeyEncoding() {
+ struct PrivateKey * hostkey;
+ PrivateKeyEncoded * encoding;
+ PublicKey pkey;
+ RSAEncryptedData target;
+ char result[MAX_TESTVAL];
+ int i;
+ TIME_T start;
+ int ok = OK;
+
+ fprintf(stderr, "W");
+ hostkey = makePrivateKey();
+
+ TIME(&start);
+ for (i=0;i<ITER;i++) {
+ fprintf(stderr, ".");
+ getPublicKey(hostkey, &pkey);
+ if (SYSERR == encryptPrivateKey(TESTSTRING,
+ strlen(TESTSTRING)+1,
+ &pkey,
+ &target)) {
+ fprintf(stderr,
+ "encryptPrivateKey returned SYSERR\n");
+ ok = SYSERR;
+ continue;
+ }
+ encoding = encodePrivateKey(hostkey);
+ freePrivateKey(hostkey);
+ if (encoding == NULL) {
+ fprintf(stderr,
+ "encodePrivateKey returned NULL\n");
+ ok = SYSERR;
+ continue;
+ }
+ hostkey = decodePrivateKey(encoding);
+ FREE(encoding);
+ if (SYSERR == decryptPrivateKey(hostkey,
+ &target,
+ result,
+ strlen(TESTSTRING)+1)) {
+ fprintf(stderr,
+ "decryptPrivateKey returned SYSERR\n");
+ ok = SYSERR;
+ continue;
+ }
+ if (strncmp(TESTSTRING, result,
+ strlen(TESTSTRING)) != 0) {
+ printf("%s != %.*s - testEncryptDecrypt failed!\n",
+ TESTSTRING,
+ (int) strlen(TESTSTRING),
+ result);
+ ok = SYSERR;
+ continue;
+ }
+ }
+ freePrivateKey(hostkey);
+ printf("%d RSA encrypt/encode/decode/decrypt operations %ds\n",
+ ITER,
+ (int) (TIME(NULL)-start));
+ return ok;
+}
+
+void initRAND(); /* hostkey_* */
+
+int main(int argc, char * argv[]) {
+ int failureCount = 0;
+
+ initLockingGcrypt();
+ initRAND();
+ if (OK != testEncryptDecryptSK())
+ failureCount++;
+ if (OK != testEncryptDecrypt())
+ failureCount++;
+ if (OK != testSignVerify())
+ failureCount++;
+ if (OK != testPrivateKeyEncoding())
+ failureCount++;
+ doneLockingGcrypt();
+
+ if (failureCount == 0)
+ return 0;
+ else {
+ printf("\n\n%d TESTS FAILED!\n\n",failureCount);
+ return -1;
+ }
+} /* end of main*/
Added: GNUnet/src/util/crypto/kblockkey.c
===================================================================
--- GNUnet/src/util/crypto/kblockkey.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/crypto/kblockkey.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,572 @@
+/*
+ This file is part of GNUnet.
+ Copyright (C) 1994, 1996, 1998, 2001, 2002, 2003 Free Software
Foundation, Inc.
+ Copyright (C) 2004, 2005 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.
+
+ Note: This code is based on code from libgcrypt
+ The code was adapted for GNUnet to support RSA-key generation
+ based on weak, pseudo-random keys. Do NOT use to generate
+ ordinary RSA keys!
+*/
+
+
+/**
+ * @file util/crypto/kblockkey.c
+ * @brief implementation of RSA-Key generation for KBlocks
+ * (do NOT use for pseudonyms or hostkeys!)
+ * @author Christian Grothoff
+ */
+
+#include "platform.h"
+#include "gnunet_util.h"
+#include "gnunet_util_crypto.h"
+#include <gmp.h>
+
+typedef struct {
+ mpz_t n; /* public modulus */
+ mpz_t e; /* public exponent */
+ mpz_t d; /* exponent */
+ mpz_t p; /* prime p. */
+ mpz_t q; /* prime q. */
+ mpz_t u; /* inverse of p mod q. */
+} KBlock_secret_key;
+
+/* Note: 2 is not included because it can be tested more easily by
+ looking at bit 0. The last entry in this list is marked by a zero */
+static unsigned short small_prime_numbers[] = {
+ 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43,
+ 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101,
+ 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,
+ 157, 163, 167, 173, 179, 181, 191, 193, 197, 199,
+ 211, 223, 227, 229, 233, 239, 241, 251, 257, 263,
+ 269, 271, 277, 281, 283, 293, 307, 311, 313, 317,
+ 331, 337, 347, 349, 353, 359, 367, 373, 379, 383,
+ 389, 397, 401, 409, 419, 421, 431, 433, 439, 443,
+ 449, 457, 461, 463, 467, 479, 487, 491, 499, 503,
+ 509, 521, 523, 541, 547, 557, 563, 569, 571, 577,
+ 587, 593, 599, 601, 607, 613, 617, 619, 631, 641,
+ 643, 647, 653, 659, 661, 673, 677, 683, 691, 701,
+ 709, 719, 727, 733, 739, 743, 751, 757, 761, 769,
+ 773, 787, 797, 809, 811, 821, 823, 827, 829, 839,
+ 853, 857, 859, 863, 877, 881, 883, 887, 907, 911,
+ 919, 929, 937, 941, 947, 953, 967, 971, 977, 983,
+ 991, 997, 1009, 1013, 1019, 1021, 1031, 1033,
+ 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091,
+ 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151,
+ 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213,
+ 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277,
+ 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307,
+ 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399,
+ 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451,
+ 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493,
+ 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559,
+ 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609,
+ 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667,
+ 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733,
+ 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789,
+ 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871,
+ 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931,
+ 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997,
+ 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053,
+ 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111,
+ 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161,
+ 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243,
+ 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297,
+ 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357,
+ 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411,
+ 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473,
+ 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551,
+ 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633,
+ 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687,
+ 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729,
+ 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791,
+ 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851,
+ 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917,
+ 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999,
+ 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061,
+ 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137,
+ 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209,
+ 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271,
+ 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331,
+ 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391,
+ 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467,
+ 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533,
+ 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583,
+ 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643,
+ 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709,
+ 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779,
+ 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851,
+ 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917,
+ 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989,
+ 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049,
+ 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111,
+ 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177,
+ 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243,
+ 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297,
+ 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391,
+ 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457,
+ 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519,
+ 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597,
+ 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657,
+ 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729,
+ 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799,
+ 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889,
+ 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951,
+ 4957, 4967, 4969, 4973, 4987, 4993, 4999,
+ 0
+};
+
+#define DIM(v) (sizeof(v)/sizeof((v)[0]))
+static int no_of_small_prime_numbers = DIM(small_prime_numbers) - 1;
+
+
+static unsigned int get_nbits(mpz_t a) {
+ return mpz_sizeinbase(a, 2);
+}
+
+/**
+ * Count the number of zerobits at the low end of A
+ */
+static unsigned int get_trailing_zeros(mpz_t a) {
+ unsigned int count = 0;
+ unsigned int nbits = get_nbits(a);
+
+ while ( (mpz_tstbit(a, count)) && (count < nbits) )
+ count++;
+ return count;
+}
+
+/**
+ * Set bit N of A. and clear all bits above
+ */
+static void set_highbit(mpz_t a,
+ unsigned int n) {
+ unsigned int nbits;
+
+ nbits = get_nbits(a);
+ while (nbits > n)
+ mpz_clrbit(a, nbits--);
+ mpz_setbit(a, n);
+}
+
+static void mpz_randomize(mpz_t n,
+ unsigned int nbits,
+ HashCode512 * rnd) {
+ HashCode512 * tmp;
+ int cnt;
+ int i;
+
+ cnt = (nbits / sizeof(HashCode512) / 8) + 1;
+ tmp = MALLOC(sizeof(HashCode512) * cnt);
+
+ tmp[0] = *rnd;
+ for (i=0;i<cnt-1;i++) {
+ hash(&tmp[i],
+ sizeof(HashCode512),
+ &tmp[i+1]);
+ }
+ *rnd = tmp[cnt-1];
+ /*
+ printf("RND: ");
+ for (i=0;i<cnt * sizeof(HashCode512);i++)
+ printf("%02x", ((unsigned char*) tmp)[i]);
+ printf("\n");
+ */
+
+ mpz_import(n, cnt * sizeof(HashCode512) / sizeof(unsigned int),
+ 1, sizeof(unsigned int), 1, 0, tmp);
+ FREE(tmp);
+ i = get_nbits(n);
+ while (i > nbits)
+ mpz_clrbit(n, i--);
+}
+
+/**
+ * Return true if n is probably a prime
+ */
+static int is_prime (mpz_t n,
+ int steps,
+ HashCode512 * hc) {
+ mpz_t x;
+ mpz_t y;
+ mpz_t z;
+ mpz_t nminus1;
+ mpz_t a2;
+ mpz_t q;
+ unsigned int i, j, k;
+ int rc = 0;
+ unsigned int nbits;
+
+ mpz_init(x);
+ mpz_init(y);
+ mpz_init(z);
+ mpz_init(nminus1);
+ mpz_init_set_ui(a2, 2);
+ nbits = get_nbits( n );
+ mpz_sub_ui(nminus1, n, 1 );
+
+ /* Find q and k, so that n = 1 + 2^k * q . */
+ mpz_init_set(q, nminus1);
+ k = get_trailing_zeros(q);
+ mpz_tdiv_q_2exp(q, q, k);
+
+ for (i=0 ; i < steps; i++ ) {
+ if( !i ) {
+ mpz_set_ui( x, 2 );
+ } else {
+ mpz_randomize( x, nbits, hc );
+
+ /* Make sure that the number is smaller than the prime and
+ keep the randomness of the high bit. */
+ if (mpz_tstbit(x, nbits-2) ) {
+ set_highbit(x, nbits-2); /* Clear all higher bits. */
+ } else {
+ set_highbit(x, nbits-2 );
+ mpz_clrbit( x, nbits-2 );
+ }
+ GNUNET_ASSERT( mpz_cmp( x, nminus1 ) < 0 && mpz_cmp_ui( x, 1 ) > 0 );
+ }
+ mpz_powm ( y, x, q, n);
+ if ( mpz_cmp_ui(y, 1) && mpz_cmp( y, nminus1 ) ) {
+ for ( j=1; j < k && mpz_cmp( y, nminus1 ); j++ ) {
+ mpz_powm(y, y, a2, n);
+ if( !mpz_cmp_ui( y, 1 ) )
+ goto leave; /* Not a prime. */
+ }
+ if (mpz_cmp( y, nminus1 ) )
+ goto leave; /* Not a prime. */
+ }
+ }
+ rc = 1; /* May be a prime. */
+
+ leave:
+ mpz_clear( x );
+ mpz_clear( y );
+ mpz_clear( z );
+ mpz_clear( nminus1 );
+ mpz_clear( q );
+ mpz_clear( a2 );
+
+ return rc;
+}
+
+static void gen_prime(mpz_t ptest,
+ unsigned int nbits,
+ HashCode512 * hc) {
+ mpz_t prime, pminus1, val_2, val_3, result;
+ int i;
+ unsigned x, step;
+ int *mods;
+ mpz_t tmp;
+
+ GNUNET_ASSERT(nbits >= 16);
+
+ mods = MALLOC(no_of_small_prime_numbers * sizeof(*mods));
+ /* Make nbits fit into mpz_t implementation. */
+ mpz_init_set_ui(val_2, 2);
+ mpz_init_set_ui(val_3, 3);
+ mpz_init(prime);
+ mpz_init(result);
+ mpz_init(pminus1);
+ mpz_init(ptest);
+ while (1) {
+ /* generate a random number */
+ mpz_randomize( prime, nbits, hc );
+ /* Set high order bit to 1, set low order bit to 1. If we are
+ generating a secret prime we are most probably doing that
+ for RSA, to make sure that the modulus does have the
+ requested key size we set the 2 high order bits. */
+ set_highbit (prime, nbits-1);
+ mpz_setbit(prime, nbits-2);
+ mpz_setbit(prime, 0);
+
+ /* Calculate all remainders. */
+ mpz_init(tmp);
+ for (i=0; (x = small_prime_numbers[i]); i++ )
+ mods[i] = mpz_fdiv_r_ui(tmp, prime, x);
+ mpz_clear(tmp);
+ /* Now try some primes starting with prime. */
+ for (step=0; step < 20000; step += 2 ) {
+ /* Check against all the small primes we have in mods. */
+ for (i=0; (x = small_prime_numbers[i]); i++ ) {
+ while ( mods[i] + step >= x )
+ mods[i] -= x;
+ if ( !(mods[i] + step) )
+ break;
+ }
+ if (x)
+ continue; /* Found a multiple of an already known prime. */
+
+ mpz_add_ui( ptest, prime, step );
+ if (! mpz_tstbit( ptest, nbits-2 ))
+ break;
+
+ /* Do a fast Fermat test now. */
+ mpz_sub_ui( pminus1, ptest, 1);
+ mpz_powm( result, val_2, pminus1, ptest );
+ if ( ( !mpz_cmp_ui( result, 1 ) ) &&
+ (is_prime(ptest, 5, hc) ) ) {
+ /* Got it. */
+ mpz_clear(val_2);
+ mpz_clear(val_3);
+ mpz_clear(result);
+ mpz_clear(pminus1);
+ mpz_clear(prime);
+ FREE(mods);
+ return;
+ }
+ }
+ }
+}
+
+/**
+ * Find the greatest common divisor G of A and B.
+ * Return: 1 if this 1, 0 in all other cases
+ */
+static int test_gcd(mpz_t g,
+ mpz_t xa,
+ mpz_t xb) {
+ mpz_t a, b;
+
+ mpz_init_set(a, xa);
+ mpz_init_set(b, xb);
+
+ /* TAOCP Vol II, 4.5.2, Algorithm A */
+ while (mpz_cmp_ui( b, 0 ) ) {
+ mpz_fdiv_r(g, a, b); /* g used as temorary variable */
+ mpz_set(a,b);
+ mpz_set(b,g);
+ }
+ mpz_set(g, a);
+
+ mpz_clear(a);
+ mpz_clear(b);
+ return (0 == mpz_cmp_ui(g, 1));
+}
+
+/**
+ * Generate a key pair with a key of size NBITS.
+ * @param sk where to store the key
+ * @param nbits the number of bits to use
+ * @param hc the HC to use for PRNG (modified!)
+ */
+static void generate_kblock_key(KBlock_secret_key *sk,
+ unsigned int nbits,
+ HashCode512 * hc) {
+ mpz_t t1, t2;
+ mpz_t phi; /* helper: (p-1)(q-1) */
+ mpz_t g;
+ mpz_t f;
+
+ /* make sure that nbits is even so that we generate p, q of equal size */
+ if ( (nbits&1) )
+ nbits++;
+
+ mpz_init_set_ui(sk->e, 257);
+ mpz_init(sk->n);
+ mpz_init(sk->p);
+ mpz_init(sk->q);
+ mpz_init(sk->d);
+ mpz_init(sk->u);
+
+ mpz_init(t1);
+ mpz_init(t2);
+ mpz_init(phi);
+ mpz_init(g);
+ mpz_init(f);
+
+ do {
+ do {
+ mpz_clear(sk->p);
+ mpz_clear(sk->q);
+ gen_prime(sk->p, nbits/2, hc);
+ gen_prime(sk->q, nbits/2, hc);
+
+ if (mpz_cmp (sk->p, sk->q) > 0 ) /* p shall be smaller than q (for calc
of u)*/
+ mpz_swap(sk->p, sk->q);
+ /* calculate the modulus */
+ mpz_mul(sk->n, sk->p, sk->q );
+ } while (get_nbits(sk->n) != nbits);
+
+ /* calculate Euler totient: phi = (p-1)(q-1) */
+ mpz_sub_ui(t1, sk->p, 1 );
+ mpz_sub_ui(t2, sk->q, 1 );
+ mpz_mul(phi, t1, t2 );
+ mpz_gcd(g, t1, t2);
+ mpz_fdiv_q(f, phi, g);
+
+ while (0 == test_gcd(t1, sk->e, phi)) { /* (while gcd is not 1) */
+ mpz_add_ui (sk->e, sk->e, 2);
+ }
+
+ /* calculate the secret key d = e^1 mod phi */
+ } while ( (0 == mpz_invert(sk->d, sk->e, f )) ||
+ (0 == mpz_invert(sk->u, sk->p, sk->q )) );
+
+ mpz_clear(t1);
+ mpz_clear(t2);
+ mpz_clear(phi);
+ mpz_clear(f);
+ mpz_clear(g);
+}
+
+/**
+ * Deterministically (!) create a hostkey using only the
+ * given HashCode as input to the PRNG.
+ */
+static PrivateKeyEncoded *
+makeKblockKeyInternal(const HashCode512 * hc) {
+ KBlock_secret_key sk;
+ HashCode512 hx;
+ void * pbu[6];
+ mpz_t * pkv[6];
+ size_t sizes[6];
+ PrivateKeyEncoded * retval;
+ int i;
+ size_t size;
+
+ hx = *hc;
+ generate_kblock_key(&sk,
+ 1024, /* at least 10x as fast than 2048 bits
+ -- we simply cannot afford 2048 bits
+ even on modern hardware, and especially
+ not since clearly a dictionary attack
+ will still be much cheaper
+ than breaking a 1024 bit RSA key.
+ If an adversary can spend the time to
+ break a 1024 bit RSA key just to forge
+ a signature -- SO BE IT. [ CG, 6/2005 ] */
+ &hx);
+ pkv[0] = &sk.n;
+ pkv[1] = &sk.e;
+ pkv[2] = &sk.d;
+ pkv[3] = &sk.p;
+ pkv[4] = &sk.q;
+ pkv[5] = &sk.u;
+ size = sizeof(PrivateKeyEncoded);
+ for (i=0;i<6;i++) {
+ pbu[i] = mpz_export(NULL,
+ &sizes[i],
+ 1, /* most significant word first */
+ 1, /* unit is bytes */
+ 1, /* big endian */
+ 0, /* nails */
+ *pkv[i]);
+ size += sizes[i];
+ }
+ GE_ASSERT(NULL, size < 65536);
+ retval = MALLOC(size);
+ retval->len = htons(size);
+ i = 0;
+ retval->sizen = htons(sizes[0]);
+ memcpy(&((char*)&retval[1])[i],
+ pbu[0],
+ sizes[0]);
+ i += sizes[0];
+ retval->sizee = htons(sizes[1]);
+ memcpy(&((char*)&retval[1])[i],
+ pbu[1],
+ sizes[1]);
+ i += sizes[1];
+ retval->sized = htons(sizes[2]);
+ memcpy(&((char*)&retval[1])[i],
+ pbu[2],
+ sizes[2]);
+ i += sizes[2];
+ /* swap p and q! */
+ retval->sizep = htons(sizes[4]);
+ memcpy(&((char*)&retval[1])[i],
+ pbu[4],
+ sizes[4]);
+ i += sizes[4];
+ retval->sizeq = htons(sizes[3]);
+ memcpy(&((char*)&retval[1])[i],
+ pbu[3],
+ sizes[3]);
+ i += sizes[3];
+ retval->sizedmp1 = htons(0);
+ retval->sizedmq1 = htons(0);
+ memcpy(&((char*)&retval[1])[i],
+ pbu[5],
+ sizes[5]);
+ for (i=0;i<6;i++) {
+ mpz_clear(*pkv[i]);
+ free(pbu[i]);
+ }
+ return retval;
+}
+
+typedef struct {
+ HashCode512 hc;
+ PrivateKeyEncoded * pke;
+} KBlockKeyCacheLine;
+
+static KBlockKeyCacheLine ** cache;
+static unsigned int cacheSize;
+static Mutex lock;
+
+/**
+ * Deterministically (!) create a hostkey using only the
+ * given HashCode as input to the PRNG.
+ */
+struct PrivateKey * makeKblockKey(const HashCode512 * hc) {
+ struct PrivateKey * ret;
+ KBlockKeyCacheLine * line;
+ int i;
+
+ MUTEX_LOCK(&lock);
+ for (i=0;i<cacheSize;i++) {
+ if (equalsHashCode512(hc,
+ &cache[i]->hc)) {
+ ret = decodePrivateKey(cache[i]->pke);
+ MUTEX_UNLOCK(&lock);
+ return ret;
+ }
+ }
+
+ line
+ = MALLOC(sizeof(KBlockKeyCacheLine));
+ line->hc = *hc;
+ line->pke
+ = makeKblockKeyInternal(hc);
+ GROW(cache,
+ cacheSize,
+ cacheSize+1);
+ cache[cacheSize-1]
+ = line;
+ MUTEX_UNLOCK(&lock);
+ return decodePrivateKey(line->pke);
+}
+
+void __attribute__ ((constructor)) gnunet_crypto_kblock_ltdl_init(void) {
+ MUTEX_CREATE(&lock);
+}
+
+void __attribute__ ((destructor)) gnunet_crypto_kblock_ltdl_fini(void) {
+ int i;
+ for (i=0;i<cacheSize;i++) {
+ FREE(cache[i]->pke);
+ FREE(cache[i]);
+ }
+ GROW(cache,
+ cacheSize,
+ 0);
+ MUTEX_DESTROY(&lock);
+}
+
+/* end of kblockkey.c */
Added: GNUnet/src/util/crypto/kblockkey_test.c
===================================================================
--- GNUnet/src/util/crypto/kblockkey_test.c 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/crypto/kblockkey_test.c 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,272 @@
+/*
+ This file is part of GNUnet.
+ Copyright (C) 2004, 2005 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 util/kblockkey_test.c
+ * @brief testcase for util/kblockkey.c
+ * @author Christian Grothoff
+ */
+
+#include "platform.h"
+#include "gnunet_util.h"
+#include "locking_gcrypt.h"
+
+#define TESTSTRING "Hello World\0"
+#define MAX_TESTVAL 20
+#define UNIQUE_ITER 6
+#define ITER 10
+
+
+static int testMultiKey(const char * word) {
+ HashCode512 in;
+ struct PrivateKey * hostkey;
+ PublicKey pkey;
+ PublicKey pkey1;
+ int i;
+
+ fprintf(stderr,
+ "Testing KBlock key uniqueness (%s) ",
+ word);
+ hash(word, strlen(word), &in);
+ hostkey = makeKblockKey(&in);
+ if (hostkey == NULL) {
+ BREAK();
+ return SYSERR;
+ }
+ getPublicKey(hostkey, &pkey);
+ /*
+ for (i=0;i<sizeof(PublicKey);i++)
+ printf("%02x", ((unsigned char*) &pkey)[i]);
+ printf("\n"); */
+ freePrivateKey(hostkey);
+ for (i=0;i<UNIQUE_ITER;i++) {
+ fprintf(stderr, ".");
+ hostkey = makeKblockKey(&in);
+ if (hostkey == NULL) {
+ BREAK();
+ fprintf(stderr, " ERROR\n");
+ return SYSERR;
+ }
+ getPublicKey(hostkey, &pkey1);
+ freePrivateKey(hostkey);
+ if (0 != memcmp(&pkey, &pkey1,
+ sizeof(PublicKey))) {
+ BREAK();
+ fprintf(stderr, " ERROR\n");
+ return SYSERR;
+ }
+ }
+ fprintf(stderr, " OK\n");
+ return OK;
+}
+
+
+static int testEncryptDecrypt(struct PrivateKey * hostkey) {
+ PublicKey pkey;
+ RSAEncryptedData target;
+ char result[MAX_TESTVAL];
+ int i;
+ TIME_T start;
+ int ok;
+
+ fprintf(stderr, "W");
+ getPublicKey(hostkey, &pkey);
+
+ ok = 0;
+ TIME(&start);
+ for (i=0;i<ITER;i++) {
+ fprintf(stderr, ".");
+ if (SYSERR == encryptPrivateKey(TESTSTRING,
+ strlen(TESTSTRING)+1,
+ &pkey,
+ &target)) {
+ fprintf(stderr,
+ "encryptPrivateKey returned SYSERR\n");
+ ok++;
+ continue;
+ }
+ if (-1 == decryptPrivateKey(hostkey,
+ &target,
+ result,
+ strlen(TESTSTRING)+1)) {
+ fprintf(stderr,
+ "decryptPrivateKey returned SYSERR\n");
+ ok++;
+ continue;
+ }
+ if (strncmp(TESTSTRING, result,
+ strlen(TESTSTRING)) != 0) {
+ printf("%s != %.*s - testEncryptDecrypt failed!\n",
+ TESTSTRING,
+ MAX_TESTVAL,
+ result);
+ ok++;
+ continue;
+ }
+ }
+ printf("%d RSA encrypt/decrypt operations %ds (%d failures)\n",
+ ITER,
+ (int) (TIME(NULL)-start),
+ ok);
+ if (ok == 0)
+ return OK;
+ else
+ return SYSERR;
+}
+
+static int testSignVerify(struct PrivateKey * hostkey) {
+ Signature sig;
+ PublicKey pkey;
+ int i;
+ TIME_T start;
+ int ok = OK;
+
+ fprintf(stderr, "W");
+ getPublicKey(hostkey, &pkey);
+ TIME(&start);
+ for (i=0;i<ITER;i++) {
+ fprintf(stderr, ".");
+ if (SYSERR == sign(hostkey,
+ strlen(TESTSTRING),
+ TESTSTRING, &sig)) {
+ fprintf(stderr,
+ "sign returned SYSERR\n");
+ ok = SYSERR;
+ continue;
+ }
+ if (SYSERR == verifySig(TESTSTRING,
+ strlen(TESTSTRING),
+ &sig,
+ &pkey)) {
+ printf("testSignVerify failed!\n");
+ ok = SYSERR;
+ continue;
+ }
+ }
+ printf("%d RSA sign/verify operations %ds\n",
+ ITER,
+ (int) (TIME(NULL)-start));
+ return ok;
+}
+
+static int testPrivateKeyEncoding(const struct PrivateKey * hostkey) {
+ PrivateKeyEncoded * encoding;
+ struct PrivateKey * hostkey2;
+ PublicKey pkey;
+ RSAEncryptedData target;
+ char result[MAX_TESTVAL];
+ int i;
+ TIME_T start;
+ int ok = OK;
+
+ fprintf(stderr, "W");
+
+ TIME(&start);
+ for (i=0;i<ITER;i++) {
+ fprintf(stderr, ".");
+ getPublicKey(hostkey, &pkey);
+ if (SYSERR == encryptPrivateKey(TESTSTRING,
+ strlen(TESTSTRING)+1,
+ &pkey,
+ &target)) {
+ fprintf(stderr,
+ "encryptPrivateKey returned SYSERR\n");
+ ok = SYSERR;
+ continue;
+ }
+ encoding = encodePrivateKey(hostkey);
+ if (encoding == NULL) {
+ fprintf(stderr,
+ "encodePrivateKey returned NULL\n");
+ ok = SYSERR;
+ continue;
+ }
+ hostkey2 = decodePrivateKey(encoding);
+ FREE(encoding);
+ if (SYSERR == decryptPrivateKey(hostkey2,
+ &target,
+ result,
+ strlen(TESTSTRING)+1)) {
+ fprintf(stderr,
+ "decryptPrivateKey returned SYSERR\n");
+ ok = SYSERR;
+ freePrivateKey(hostkey2);
+ continue;
+ }
+ freePrivateKey(hostkey2);
+ if (strncmp(TESTSTRING, result,
+ strlen(TESTSTRING)) != 0) {
+ printf("%s != %.*s - testEncryptDecrypt failed!\n",
+ TESTSTRING,
+ (int) strlen(TESTSTRING),
+ result);
+ ok = SYSERR;
+ continue;
+ }
+ }
+ printf("%d RSA encrypt/encode/decode/decrypt operations %ds\n",
+ ITER,
+ (int) (TIME(NULL)-start));
+ return ok;
+}
+
+
+void initRAND(void); /* hostkey_* */
+void initKBlockKey(void);
+void doneKBlockKey(void);
+
+int main(int argc, char * argv[]) {
+ int failureCount = 0;
+ HashCode512 in;
+ struct PrivateKey * hostkey;
+
+ initLockingGcrypt();
+ initRAND();
+ initKBlockKey();
+ makeRandomId(&in);
+
+ hostkey = makeKblockKey(&in);
+ if (hostkey == NULL) {
+ printf("\nmakeKblockKey failed!\n");
+ return 1;
+ }
+
+ if (OK != testMultiKey("foo"))
+ failureCount++;
+ if (OK != testMultiKey("bar"))
+ failureCount++;
+ if (OK != testEncryptDecrypt(hostkey))
+ failureCount++;
+ if (OK != testSignVerify(hostkey))
+ failureCount++;
+ if (OK != testPrivateKeyEncoding(hostkey))
+ failureCount++;
+ freePrivateKey(hostkey);
+ doneKBlockKey();
+ doneLockingGcrypt();
+
+ if (failureCount == 0) {
+ return 0;
+ } else {
+ printf("\n\n%d TESTS FAILED!\n\n",
+ failureCount);
+ return -1;
+ }
+}
Added: GNUnet/src/util/crypto/locking_gcrypt.c
===================================================================
--- GNUnet/src/util/crypto/locking_gcrypt.c 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/crypto/locking_gcrypt.c 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,61 @@
+/*
+ This file is part of GNUnet.
+ (C) 2001, 2002, 2003, 2004 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 util/crypto/locking_gcrypt.c
+ * @brief locking for gcrypt
+ * @author Christian Grothoff
+ */
+
+#include "platform.h"
+#include "gnunet_util.h"
+#include "locking_gcrypt.h"
+#include <gcrypt.h>
+
+static Mutex gcrypt_shared_lock;
+
+void lockGcrypt() {
+ MUTEX_LOCK(&gcrypt_shared_lock);
+}
+
+void unlockGcrypt() {
+ MUTEX_UNLOCK(&gcrypt_shared_lock);
+}
+
+void __attribute__ ((constructor)) gnunet_crypto_ltdl_init(void) {
+ MUTEX_CREATE_RECURSIVE(&gcrypt_shared_lock);
+ gcry_control(GCRYCTL_DISABLE_SECMEM, 0);
+ if (! gcry_check_version(GCRYPT_VERSION)) {
+ fprintf(stderr,
+ _("libgcrypt has not the expected version (version %s is
required).\n"),
+ GCRYPT_VERSION);
+ abort();
+ }
+ srand((unsigned int)time(NULL));
+#ifdef gcry_fast_random_poll
+ lockGcrypt();
+ gcry_fast_random_poll ();
+ unlockGcrypt();
+#endif
+}
+
+void __attribute__ ((destructor)) gnunet_crypto_ltdl_fini(void) {
+ MUTEX_DESTROY(&gcrypt_shared_lock);
+}
Added: GNUnet/src/util/crypto/locking_gcrypt.h
===================================================================
--- GNUnet/src/util/crypto/locking_gcrypt.h 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/crypto/locking_gcrypt.h 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,29 @@
+/*
+ This file is part of GNUnet.
+ (C) 2001, 2002, 2003, 2004, 2005 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.
+*/
+
+
+#ifndef LOCKING_GCRYPT_H
+#define LOCKING_GCRYPT_H
+
+void lockGcrypt();
+
+void unlockGcrypt();
+
+#endif
Added: GNUnet/src/util/crypto/random.c
===================================================================
--- GNUnet/src/util/crypto/random.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/crypto/random.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,124 @@
+/*
+ This file is part of GNUnet.
+ (C) 2001, 2002, 2003, 2004, 2005, 2006 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 util/random.c
+ * @brief functions to gather random numbers
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "gnunet_util.h"
+#include "locking_gcrypt.h"
+#include <gcrypt.h>
+
+/**
+ * @return a random value in the interval [0,i[.
+ */
+unsigned int randomi(unsigned int i) {
+#ifdef gcry_fast_random_poll
+ static unsigned int invokeCount;
+#endif
+ unsigned int ret;
+
+ GE_ASSERT(NULL, i > 0);
+ lockGcrypt();
+ /* see http://lists.gnupg.org/pipermail/gcrypt-devel/2004-May/000613.html */
+#ifdef gcry_fast_random_poll
+ if ( (invokeCount++ % 256) == 0)
+ gcry_fast_random_poll();
+#endif
+ ret = rand(); /* in case gcry_randomize fails,
+ we at least get a pseudo-
+ random number this way */
+ gcry_randomize((unsigned char*)&ret,
+ sizeof(unsigned int),
+ GCRY_STRONG_RANDOM);
+ unlockGcrypt();
+ return ret % i;
+}
+
+/**
+ * Get an array with a random permutation of the
+ * numbers 0...n-1.
+ * @param mode STRONG if the strong (but expensive) PRNG should be used, WEAK
otherwise
+ * @param n the size of the array
+ * @return the permutation array (allocated from heap)
+ */
+int * permute(int mode, int n) {
+ int * ret;
+ int i;
+ int tmp;
+ unsigned int x;
+ unsigned int (*prng) (unsigned int u);
+
+ GE_ASSERT(NULL, n > 0);
+ ret = MALLOC(n * sizeof(int));
+ prng = (mode == STRONG) ? randomi : weak_randomi;
+ for (i=0;i<n;i++)
+ ret[i] = i;
+ for (i=0;i<n;i++) {
+ x = prng(n);
+ tmp = ret[x];
+ ret[x] = ret[i];
+ ret[i] = tmp;
+ }
+ return ret;
+}
+
+/**
+ * Random on unsigned 64-bit values.
+ */
+unsigned long long randomi64(unsigned long long u) {
+ unsigned long long ret;
+
+ GE_ASSERT(NULL, u > 0);
+ lockGcrypt();
+ gcry_randomize((unsigned char *) &ret,
+ sizeof(unsigned long long),
+ GCRY_STRONG_RANDOM);
+ unlockGcrypt();
+ return ret % u;
+}
+
+/**
+ * @return a cryptographically weak random value in the interval [0,i[.
+ */
+unsigned int weak_randomi(unsigned int i) {
+ unsigned int ret;
+
+ GE_ASSERT(NULL, i > 0);
+ ret = i * ((double) RANDOM() / RAND_MAX);
+ if (ret >= i)
+ ret = i - 1;
+ return ret;
+}
+
+unsigned long long weak_randomi64(unsigned long long u) {
+ unsigned long long ret;
+
+ GE_ASSERT(u > 0);
+ ret = u * ((double) RANDOM() / RAND_MAX);
+ if (ret >= u)
+ ret = u-1;
+ return ret;
+}
+
+/* end of random.c */
Added: GNUnet/src/util/crypto/symcipher_gcrypt.c
===================================================================
--- GNUnet/src/util/crypto/symcipher_gcrypt.c 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/crypto/symcipher_gcrypt.c 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,228 @@
+/*
+ This file is part of GNUnet.
+ (C) 2001, 2002, 2003, 2004, 2005 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 util/symcipher_gcrypt.c
+ * @brief Symmetric encryption services.
+ * @author Christian Grothoff
+ * @author Ioana Patrascu
+ *
+ * Note that the code locks often needlessly on the gcrypt-locking api.
+ * One would think that simple MPI operations should not require locking
+ * (since only global operations on the random pool must be locked,
+ * strictly speaking). But libgcrypt does sometimes require locking in
+ * unexpected places, so the safe solution is to always lock even if it
+ * is not required. The performance impact is minimal anyway.
+ */
+
+#include "platform.h"
+#include "gnunet_util.h"
+#include "gnunet_util_crypto.h"
+#include "locking_gcrypt.h"
+#include <gcrypt.h>
+
+/**
+ * Log an error message at log-level 'level' that indicates
+ * a failure of the command 'cmd' with the message given
+ * by gcry_strerror(rc).
+ */
+#define LOG_GCRY(ectx, level, cmd, rc) do { GE_LOG(ectx, level, _("`%s' failed
at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, gcry_strerror(rc)); }
while(0);
+
+/**
+ * Die with an error message that indicates
+ * a failure of the command 'cmd' with the message given
+ * by gcry_strerror(rc).
+ */
+#define DIE_GCRY(ectx, cmd, rc) do { GE_LOG(ectx, GE_FATAL | GE_USER |
GE_DEVELOPER | GE_IMMEDIATE, _("`%s' failed at %s:%d with error: %s\n"), cmd,
__FILE__, __LINE__, gcry_strerror(rc)); abort(); } while(0);
+
+
+/**
+ * Create a new SessionKey (for AES-256).
+ */
+void makeSessionkey(SESSIONKEY * key) {
+ lockGcrypt();
+ gcry_randomize(&key->key[0],
+ SESSIONKEY_LEN,
+ GCRY_STRONG_RANDOM);
+ unlockGcrypt();
+ key->crc32 = htonl(crc32N(key, SESSIONKEY_LEN));
+}
+
+/**
+ * Encrypt a block with the public key of another
+ * host that uses the same cyper.
+ * @param block the block to encrypt
+ * @param len the size of the block
+ * @param sessionkey the key used to encrypt
+ * @param iv the initialization vector to use, use INITVALUE
+ * for streams.
+ * @param result the output parameter in which to store the encrypted result
+ * @returns the size of the encrypted block, -1 for errors
+ */
+int encryptBlock(const void * block,
+ unsigned short len,
+ const SESSIONKEY * sessionkey,
+ const INITVECTOR * iv,
+ void * result) {
+ gcry_cipher_hd_t handle;
+ int rc;
+
+ if (sessionkey->crc32 !=
+ htonl(crc32N(sessionkey, SESSIONKEY_LEN))) {
+ GE_BREAK(NULL, 0);
+ return SYSERR;
+ }
+ lockGcrypt();
+ rc = gcry_cipher_open(&handle,
+ GCRY_CIPHER_AES256,
+ GCRY_CIPHER_MODE_CFB,
+ 0);
+ if (rc) {
+ LOG_GCRY(NULL,
+ GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK,
+ "gcry_cipher_open",
+ rc);
+ unlockGcrypt();
+ return -1;
+ }
+ rc = gcry_cipher_setkey(handle,
+ sessionkey,
+ SESSIONKEY_LEN);
+
+ if (rc && ((char)rc != GPG_ERR_WEAK_KEY)) {
+ LOG_GCRY(LOG_FAILURE, "gcry_cipher_setkey", rc);
+ gcry_cipher_close(handle);
+ unlockGcrypt();
+ return -1;
+ }
+ rc = gcry_cipher_setiv(handle,
+ iv,
+ sizeof(INITVECTOR));
+ if (rc && ((char)rc != GPG_ERR_WEAK_KEY)) {
+ LOG_GCRY(NULL,
+ GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK,
+ "gcry_cipher_setiv",
+ rc);
+ gcry_cipher_close(handle);
+ unlockGcrypt();
+ return -1;
+ }
+
+ rc = gcry_cipher_encrypt(handle,
+ result,
+ len,
+ block,
+ len);
+ if (rc) {
+ LOG_GCRY(NULL,
+ GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK,
+ "gcry_cipher_encrypt",
+ rc);
+ gcry_cipher_close(handle);
+ unlockGcrypt();
+ return -1;
+ }
+ gcry_cipher_close(handle);
+ unlockGcrypt();
+ return len;
+}
+
+/**
+ * Decrypt a given block with the sessionkey.
+ * @param sessionkey the key used to decrypt
+ * @param block the data to decrypt, encoded as returned by encrypt
+ * @param size the size of the block to decrypt
+ * @param iv the initialization vector to use, use INITVALUE
+ * for streams.
+ * @param result address to store the result at
+ * @return -1 on failure, size of decrypted block on success
+ */
+int decryptBlock(const SESSIONKEY * sessionkey,
+ const void * block,
+ unsigned short size,
+ const INITVECTOR * iv,
+ void * result) {
+ gcry_cipher_hd_t handle;
+ int rc;
+
+ if (sessionkey->crc32 !=
+ htonl(crc32N(sessionkey, SESSIONKEY_LEN))) {
+ GE_BREAK(NULL, 0);
+ return SYSERR;
+ }
+ lockGcrypt();
+ rc = gcry_cipher_open(&handle,
+ GCRY_CIPHER_AES256,
+ GCRY_CIPHER_MODE_CFB,
+ 0);
+ if (rc) {
+ LOG_GCRY(NULL,
+ GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK,
+ "gcry_cipher_open",
+ rc);
+ unlockGcrypt();
+ return -1;
+ }
+ rc = gcry_cipher_setkey(handle,
+ sessionkey,
+ SESSIONKEY_LEN);
+
+ if (rc && ((char)rc != GPG_ERR_WEAK_KEY)) {
+ LOG_GCRY(NULL,
+ GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK,
+ "gcry_cipher_setkey",
+ rc);
+ gcry_cipher_close(handle);
+ unlockGcrypt();
+ return -1;
+ }
+ rc = gcry_cipher_setiv(handle,
+ iv,
+ sizeof(INITVECTOR));
+
+ if (rc && ((char)rc != GPG_ERR_WEAK_KEY)) {
+ LOG_GCRY(NULL,
+ GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK,
+ "gcry_cipher_setiv",
+ rc);
+ gcry_cipher_close(handle);
+ unlockGcrypt();
+ return -1;
+ }
+ rc = gcry_cipher_decrypt(handle,
+ result,
+ size,
+ block,
+ size);
+ if (rc) {
+ LOG_GCRY(NULL,
+ GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK,
+ "gcry_cipher_decrypt",
+ rc);
+ gcry_cipher_close(handle);
+ unlockGcrypt();
+ return -1;
+ }
+ gcry_cipher_close(handle);
+ unlockGcrypt();
+ return size;
+}
+
+/* end of symcipher_gcrypt.c */
Added: GNUnet/src/util/crypto/symciphertest.c
===================================================================
--- GNUnet/src/util/crypto/symciphertest.c 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/crypto/symciphertest.c 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,129 @@
+/**
+ * SymCipher testcode.
+ * @author Christian Grothoff
+ * @file util/symciphertest.c
+ */
+
+#include "platform.h"
+#include "gnunet_util.h"
+#include "locking_gcrypt.h"
+
+#define TESTSTRING "Hello World!"
+#define INITVALUE "InitializationVectorValue"
+
+static int testSymcipher() {
+ SESSIONKEY key;
+ char result[100];
+ int size;
+ char res[100];
+
+ makeSessionkey(&key);
+ size = encryptBlock(TESTSTRING,
+ strlen(TESTSTRING)+1,
+ &key,
+ (const INITVECTOR*) INITVALUE,
+ result);
+ if (size == -1) {
+ printf("symciphertest failed: encryptBlock returned %d\n",
+ size);
+ return 1;
+ }
+ size = decryptBlock(&key,
+ result,
+ size,
+ (const INITVECTOR*) INITVALUE,
+ res);
+ if (strlen(TESTSTRING)+1
+ != size) {
+ printf("symciphertest failed: decryptBlock returned %d\n",
+ size);
+ return 1;
+ }
+ if (0 != strcmp(res,TESTSTRING)) {
+ printf("symciphertest failed: %s != %s\n",
+ res, TESTSTRING);
+ return 1;
+ } else
+ return 0;
+}
+
+int verifyCrypto()
+{
+ SESSIONKEY key;
+ char *result, *res;
+ int ret;
+
+ unsigned char plain[] = {29, 128, 192, 253, 74, 171, 38, 187, 84, 219, 76,
76, 209, 118, 33, 249, 172, 124, 96, 9, 157, 110, 8, 215, 200, 63, 69, 230,
157, 104, 247, 164};
+ unsigned char raw_key[] = {106, 74, 209, 88, 145, 55, 189, 135, 125, 180,
225, 108, 183, 54, 25, 169, 129, 188, 131, 75, 227, 245, 105, 10, 225, 15, 115,
159, 148, 184, 34, 191};
+ unsigned char encrresult[] = {81, 81, 181, 234, 78, 198, 242, 124, 199, 59,
152, 213, 230, 76, 250, 135, 243, 23, 66, 130, 175, 146, 141, 172, 165, 82,
193, 236, 133, 145, 93, 37};
+
+ result = MALLOC(SESSIONKEY_LEN);
+ res = NULL;
+ ret = 0;
+
+ memcpy(key.key, raw_key, SESSIONKEY_LEN);
+ key.crc32 = htonl(crc32N(&key, SESSIONKEY_LEN));
+
+ if (key.crc32 != 2344502530)
+ {
+ printf("Static key has different CRC\n");
+
+ ret = 1;
+ goto error;
+ }
+
+ encryptBlock(plain,
+ SESSIONKEY_LEN,
+ &key,
+ (const INITVECTOR*) "test",
+ result);
+
+ if (memcmp(encrresult, result, SESSIONKEY_LEN) != 0)
+ {
+ printf("Encrypted result wrong.\n");
+
+ ret = 1;
+ goto error;
+ }
+
+ res = MALLOC(SESSIONKEY_LEN);
+
+ decryptBlock(&key,
+ result,
+ SESSIONKEY_LEN,
+ (const INITVECTOR*) "test",
+ res);
+
+ if (memcmp(res, plain, SESSIONKEY_LEN) != 0)
+ {
+ printf("Decrypted result does not match input.\n");
+
+ ret = 1;
+ }
+
+error:
+
+ FREE(result);
+ FREENONNULL(res);
+
+ return ret;
+}
+
+int main(int argc, char * argv[]) {
+ int failureCount = 0;
+
+ GNUNET_ASSERT(strlen(INITVALUE) > sizeof(INITVECTOR));
+ initLockingGcrypt();
+ failureCount += testSymcipher();
+ failureCount += verifyCrypto();
+ doneLockingGcrypt();
+
+ if (failureCount == 0)
+ return 0;
+ else {
+ printf("%d TESTS FAILED!\n",failureCount);
+ return -1;
+ }
+}
+
+/* end of symciphertest.c */
Added: GNUnet/src/util/crypto/weakkeytest.c
===================================================================
--- GNUnet/src/util/crypto/weakkeytest.c 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/crypto/weakkeytest.c 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,206 @@
+/*
+ This file is part of GNUnet.
+ (C) 2003, 2004, 2005 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.
+
+*/
+
+/**
+ * SymCipher weak key testcode.
+ * @author Krista Bennett
+ * @author Christian Grothoff
+ * @file util/crypto/weakkeytest.c
+ */
+
+#include "platform.h"
+#include "gnunet_util.h"
+#include "locking_gcrypt.h"
+#include <gcrypt.h>
+
+#define MAX_WEAK_KEY_TRIALS 100000
+#define GENERATE_WEAK_KEYS NO
+#define WEAK_KEY_TESTSTRING "I hate weak keys."
+
+static void printWeakKey(SESSIONKEY* key) {
+ int i;
+ for (i = 0; i < SESSIONKEY_LEN; i++) {
+ printf("%x ",
+ (int)(key->key[i]));
+ }
+}
+
+static int testWeakKey() {
+ char result[100];
+ char res[100];
+ int size;
+ SESSIONKEY weak_key;
+ INITVECTOR INITVALUE;
+
+ memset(&INITVALUE, 42, sizeof(INITVECTOR));
+ /* sorry, this is not a weak key -- I don't have
+ any at the moment! */
+ weak_key.key[0]= (char)(0x4c);
+ weak_key.key[1]= (char)(0x31);
+ weak_key.key[2]= (char)(0xc6);
+ weak_key.key[3]= (char)(0x2b);
+ weak_key.key[4]= (char)(0xc1);
+ weak_key.key[5]= (char)(0x5f);
+ weak_key.key[6]= (char)(0x4d);
+ weak_key.key[7]= (char)(0x1f);
+ weak_key.key[8]= (char)(0x31);
+ weak_key.key[9]= (char)(0xaa);
+ weak_key.key[10]= (char)(0x12);
+ weak_key.key[11]= (char)(0x2e);
+ weak_key.key[12]= (char)(0xb7);
+ weak_key.key[13]= (char)(0x82);
+ weak_key.key[14]= (char)(0xc0);
+ weak_key.key[15]= (char)(0xb6);
+ weak_key.key[16]= (char)(0x4d);
+ weak_key.key[17]= (char)(0x1f);
+ weak_key.key[18]= (char)(0x31);
+ weak_key.key[19]= (char)(0xaa);
+ weak_key.key[20]= (char)(0x4c);
+ weak_key.key[21]= (char)(0x31);
+ weak_key.key[22]= (char)(0xc6);
+ weak_key.key[23]= (char)(0x2b);
+ weak_key.key[24]= (char)(0xc1);
+ weak_key.key[25]= (char)(0x5f);
+ weak_key.key[26]= (char)(0x4d);
+ weak_key.key[27]= (char)(0x1f);
+ weak_key.key[28]= (char)(0x31);
+ weak_key.key[29]= (char)(0xaa);
+ weak_key.key[30]= (char)(0xaa);
+ weak_key.key[31]= (char)(0xaa);
+ /* memset(&weak_key, 0, 32); */
+ weak_key.crc32 = htonl(crc32N(&weak_key,
+ SESSIONKEY_LEN));
+
+ size = encryptBlock(WEAK_KEY_TESTSTRING,
+ strlen(WEAK_KEY_TESTSTRING)+1,
+ &weak_key,
+ &INITVALUE,
+ result);
+
+ if (size == -1) {
+ BREAK();
+ return 1;
+ }
+
+ size = decryptBlock(&weak_key,
+ result,
+ size,
+ &INITVALUE,
+ res);
+
+ if ((strlen(WEAK_KEY_TESTSTRING)+1) != size) {
+ BREAK();
+ return 1;
+ }
+ if (0 != strcmp(res,
+ WEAK_KEY_TESTSTRING)) {
+ BREAK();
+ return 1;
+ } else
+ return 0;
+}
+
+static int getWeakKeys() {
+ SESSIONKEY sessionkey;
+ int number_of_weak_keys = 0;
+ int number_of_runs;
+
+ gcry_cipher_hd_t handle;
+ int rc;
+
+ for (number_of_runs = 0; number_of_runs < MAX_WEAK_KEY_TRIALS;
+ number_of_runs++) {
+
+ if (number_of_runs % 1000 == 0)
+ fprintf(stderr, ".");
+ /*printf("Got to run number %d.\n", number_of_runs);*/
+ makeSessionkey(&sessionkey);
+
+ rc = gcry_cipher_open(&handle,
+ GCRY_CIPHER_AES256,
+ GCRY_CIPHER_MODE_CFB,
+ 0);
+
+ if (rc) {
+ printf("testweakkey: gcry_cipher_open failed on trial %d. %s\n",
+ number_of_runs,
+ gcry_strerror(rc));
+ rc = 0;
+ continue;
+ }
+
+ rc = gcry_cipher_setkey(handle,
+ &sessionkey,
+ SESSIONKEY_LEN);
+
+ if ((char)rc == GPG_ERR_WEAK_KEY) {
+ printf("\nWeak key (in hex): ");
+ printWeakKey(&sessionkey);
+ printf("\n");
+ number_of_weak_keys++;
+ }
+ else if (rc) {
+ printf("\nUnexpected error generating keys. Error is %s\n",
+ gcry_strerror(rc));
+ }
+
+ gcry_cipher_close(handle);
+
+ }
+
+ return number_of_weak_keys;
+}
+
+void initRAND();
+
+int main(int argc, char * argv[]) {
+ int weak_keys;
+ int ret;
+
+ if (1)
+ return 0;
+
+ initLockingGcrypt();
+ initRAND();
+
+ if (GENERATE_WEAK_KEYS) {
+ weak_keys = getWeakKeys();
+
+ if (weak_keys == 0) {
+ printf("\nNo weak keys found in %d runs.\n",
+ MAX_WEAK_KEY_TRIALS);
+ }
+ else {
+ printf("\n%d weak keys found in %d runs.\n",
+ weak_keys,
+ MAX_WEAK_KEY_TRIALS);
+ }
+ }
+
+ if (testWeakKey() == 0)
+ ret = 0;
+ else
+ ret = -1;
+ doneLockingGcrypt();
+ return ret;
+}
+
+/* end of weakkeytest.c */
Modified: GNUnet/src/util/daemon.c
===================================================================
--- GNUnet/src/util/daemon.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/daemon.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -43,10 +43,8 @@
int ret;
sock = getClientSocket();
- if(sock == NULL) {
- BREAK();
+ if (sock == NULL)
return SYSERR;
- }
csHdr.size
= htons(sizeof(CS_MESSAGE_HEADER));
@@ -63,7 +61,6 @@
return SYSERR;
}
releaseClientSocket(sock);
-
return OK;
}
@@ -313,26 +310,26 @@
int termProcess(int pid) {
#ifndef MINGW
- return kill(pid, SIGTERM) == 0;
+ return kill(pid, SIGTERM) == 0;
#else
- int ret;
- DWORD dwExitCode = 0;
-
- HANDLE hProc = OpenProcess(1, 0, pid);
- GenerateConsoleCtrlEvent(CTRL_C_EVENT, pid);
-
- WaitForSingleObject(hProc, 3000);
-
- GetExitCodeProcess(hProc, &dwExitCode);
- if(dwExitCode == STILL_ACTIVE) {
- ret = TerminateProcess(hProc, 0);
- }
- else
- ret = 1;
-
- CloseHandle(hProc);
-
- return ret;
+ int ret;
+ DWORD dwExitCode = 0;
+
+ HANDLE hProc = OpenProcess(1, 0, pid);
+ GenerateConsoleCtrlEvent(CTRL_C_EVENT, pid);
+
+ WaitForSingleObject(hProc, 3000);
+
+ GetExitCodeProcess(hProc, &dwExitCode);
+ if(dwExitCode == STILL_ACTIVE) {
+ ret = TerminateProcess(hProc, 0);
+ }
+ else
+ ret = 1;
+
+ CloseHandle(hProc);
+
+ return ret;
#endif
}
Added: GNUnet/src/util/endian.c
===================================================================
--- GNUnet/src/util/endian.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/endian.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,48 @@
+/*
+ This file is part of GNUnet.
+ (C) 2001, 2002, 2003, 2004, 2006 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 util/endian.c
+ * @brief endian conversion helpers
+ * @author Christian Grothoff
+ */
+
+#include "platform.h"
+#include "gnunet_util.h"
+
+unsigned long long ntohll(unsigned long long n) {
+#if __BYTE_ORDER == __BIG_ENDIAN
+ return n;
+#else
+ return (((unsigned long long)ntohl(n)) << 32) + ntohl(n >> 32);
+#endif
+}
+
+unsigned long long htonll(unsigned long long n) {
+#if __BYTE_ORDER == __BIG_ENDIAN
+ return n;
+#else
+ return (((unsigned long long)htonl(n)) << 32) + htonl(n >> 32);
+#endif
+}
+
+
+
+/* end of endian.c */
Added: GNUnet/src/util/error/.deps/error.Plo
===================================================================
--- GNUnet/src/util/error/.deps/error.Plo 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/error/.deps/error.Plo 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,301 @@
+error.lo .libs/error.o: error.c ../../../src/include/gnunet_util_error.h \
+ ../../../src/include/platform.h ../../../config.h \
+ ../../../src/include/plibc.h /usr/include/pthread.h \
+ /usr/include/features.h /usr/include/sys/cdefs.h \
+ /usr/include/gnu/stubs.h /usr/include/sched.h /usr/include/bits/types.h \
+ /usr/include/bits/wordsize.h \
+ /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/stddef.h \
+ /usr/include/bits/typesizes.h /usr/include/time.h \
+ /usr/include/bits/sched.h /usr/include/bits/time.h \
+ /usr/include/xlocale.h /usr/include/signal.h /usr/include/bits/sigset.h \
+ /usr/include/bits/pthreadtypes.h /usr/include/bits/initspin.h \
+ /usr/include/bits/sigthread.h /usr/include/netdb.h \
+ /usr/include/netinet/in.h /usr/include/stdint.h \
+ /usr/include/bits/wchar.h /usr/include/sys/socket.h \
+ /usr/include/sys/uio.h /usr/include/sys/types.h /usr/include/endian.h \
+ /usr/include/bits/endian.h /usr/include/sys/select.h \
+ /usr/include/bits/select.h /usr/include/sys/sysmacros.h \
+ /usr/include/bits/uio.h /usr/include/bits/socket.h \
+ /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/limits.h \
+ /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/syslimits.h \
+ /usr/include/limits.h /usr/include/bits/posix1_lim.h \
+ /usr/include/bits/local_lim.h /usr/include/linux/limits.h \
+ /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \
+ /usr/include/bits/stdio_lim.h /usr/include/bits/sockaddr.h \
+ /usr/include/asm/socket.h /usr/include/asm/sockios.h \
+ /usr/include/bits/in.h /usr/include/bits/byteswap.h \
+ /usr/include/rpc/netdb.h /usr/include/bits/siginfo.h \
+ /usr/include/bits/netdb.h /usr/include/arpa/inet.h \
+ /usr/include/netinet/tcp.h /usr/include/pwd.h /usr/include/stdio.h \
+ /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h \
+ /usr/include/asm/ioctls.h /usr/include/asm/ioctl.h \
+ /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h \
+ /usr/include/sys/wait.h /usr/include/bits/signum.h \
+ /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \
+ /usr/include/asm/sigcontext.h /usr/include/linux/compiler.h \
+ /usr/include/bits/sigstack.h /usr/include/sys/ucontext.h \
+ /usr/include/sys/resource.h /usr/include/bits/resource.h \
+ /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \
+ /usr/include/string.h /usr/include/libio.h /usr/include/_G_config.h \
+ /usr/include/wchar.h /usr/include/gconv.h \
+ /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/stdarg.h \
+ /usr/include/bits/sys_errlist.h /usr/include/stdlib.h \
+ /usr/include/alloca.h /usr/include/ltdl.h /usr/include/errno.h \
+ /usr/include/bits/errno.h /usr/include/linux/errno.h \
+ /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \
+ /usr/include/asm-generic/errno-base.h /usr/include/unistd.h \
+ /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \
+ /usr/include/bits/confname.h /usr/include/getopt.h \
+ /usr/include/sys/stat.h /usr/include/bits/stat.h /usr/include/dirent.h \
+ /usr/include/bits/dirent.h /usr/include/fcntl.h \
+ /usr/include/bits/fcntl.h /usr/include/math.h \
+ /usr/include/bits/huge_val.h /usr/include/bits/nan.h \
+ /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \
+ /usr/include/sys/param.h /usr/include/linux/param.h \
+ /usr/include/asm/param.h /usr/include/sys/time.h /usr/include/net/if.h \
+ /usr/include/ctype.h /usr/include/locale.h /usr/include/bits/locale.h \
+ ../../../src/include/gettext.h /usr/include/libintl.h \
+ /usr/include/sys/mman.h /usr/include/bits/mman.h \
+ /usr/include/langinfo.h /usr/include/nl_types.h
+
+../../../src/include/gnunet_util_error.h:
+
+../../../src/include/platform.h:
+
+../../../config.h:
+
+../../../src/include/plibc.h:
+
+/usr/include/pthread.h:
+
+/usr/include/features.h:
+
+/usr/include/sys/cdefs.h:
+
+/usr/include/gnu/stubs.h:
+
+/usr/include/sched.h:
+
+/usr/include/bits/types.h:
+
+/usr/include/bits/wordsize.h:
+
+/usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/stddef.h:
+
+/usr/include/bits/typesizes.h:
+
+/usr/include/time.h:
+
+/usr/include/bits/sched.h:
+
+/usr/include/bits/time.h:
+
+/usr/include/xlocale.h:
+
+/usr/include/signal.h:
+
+/usr/include/bits/sigset.h:
+
+/usr/include/bits/pthreadtypes.h:
+
+/usr/include/bits/initspin.h:
+
+/usr/include/bits/sigthread.h:
+
+/usr/include/netdb.h:
+
+/usr/include/netinet/in.h:
+
+/usr/include/stdint.h:
+
+/usr/include/bits/wchar.h:
+
+/usr/include/sys/socket.h:
+
+/usr/include/sys/uio.h:
+
+/usr/include/sys/types.h:
+
+/usr/include/endian.h:
+
+/usr/include/bits/endian.h:
+
+/usr/include/sys/select.h:
+
+/usr/include/bits/select.h:
+
+/usr/include/sys/sysmacros.h:
+
+/usr/include/bits/uio.h:
+
+/usr/include/bits/socket.h:
+
+/usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/limits.h:
+
+/usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/syslimits.h:
+
+/usr/include/limits.h:
+
+/usr/include/bits/posix1_lim.h:
+
+/usr/include/bits/local_lim.h:
+
+/usr/include/linux/limits.h:
+
+/usr/include/bits/posix2_lim.h:
+
+/usr/include/bits/xopen_lim.h:
+
+/usr/include/bits/stdio_lim.h:
+
+/usr/include/bits/sockaddr.h:
+
+/usr/include/asm/socket.h:
+
+/usr/include/asm/sockios.h:
+
+/usr/include/bits/in.h:
+
+/usr/include/bits/byteswap.h:
+
+/usr/include/rpc/netdb.h:
+
+/usr/include/bits/siginfo.h:
+
+/usr/include/bits/netdb.h:
+
+/usr/include/arpa/inet.h:
+
+/usr/include/netinet/tcp.h:
+
+/usr/include/pwd.h:
+
+/usr/include/stdio.h:
+
+/usr/include/sys/ioctl.h:
+
+/usr/include/bits/ioctls.h:
+
+/usr/include/asm/ioctls.h:
+
+/usr/include/asm/ioctl.h:
+
+/usr/include/bits/ioctl-types.h:
+
+/usr/include/sys/ttydefaults.h:
+
+/usr/include/sys/wait.h:
+
+/usr/include/bits/signum.h:
+
+/usr/include/bits/sigaction.h:
+
+/usr/include/bits/sigcontext.h:
+
+/usr/include/asm/sigcontext.h:
+
+/usr/include/linux/compiler.h:
+
+/usr/include/bits/sigstack.h:
+
+/usr/include/sys/ucontext.h:
+
+/usr/include/sys/resource.h:
+
+/usr/include/bits/resource.h:
+
+/usr/include/bits/waitflags.h:
+
+/usr/include/bits/waitstatus.h:
+
+/usr/include/string.h:
+
+/usr/include/libio.h:
+
+/usr/include/_G_config.h:
+
+/usr/include/wchar.h:
+
+/usr/include/gconv.h:
+
+/usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/stdarg.h:
+
+/usr/include/bits/sys_errlist.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/alloca.h:
+
+/usr/include/ltdl.h:
+
+/usr/include/errno.h:
+
+/usr/include/bits/errno.h:
+
+/usr/include/linux/errno.h:
+
+/usr/include/asm/errno.h:
+
+/usr/include/asm-generic/errno.h:
+
+/usr/include/asm-generic/errno-base.h:
+
+/usr/include/unistd.h:
+
+/usr/include/bits/posix_opt.h:
+
+/usr/include/bits/environments.h:
+
+/usr/include/bits/confname.h:
+
+/usr/include/getopt.h:
+
+/usr/include/sys/stat.h:
+
+/usr/include/bits/stat.h:
+
+/usr/include/dirent.h:
+
+/usr/include/bits/dirent.h:
+
+/usr/include/fcntl.h:
+
+/usr/include/bits/fcntl.h:
+
+/usr/include/math.h:
+
+/usr/include/bits/huge_val.h:
+
+/usr/include/bits/nan.h:
+
+/usr/include/bits/mathdef.h:
+
+/usr/include/bits/mathcalls.h:
+
+/usr/include/sys/param.h:
+
+/usr/include/linux/param.h:
+
+/usr/include/asm/param.h:
+
+/usr/include/sys/time.h:
+
+/usr/include/net/if.h:
+
+/usr/include/ctype.h:
+
+/usr/include/locale.h:
+
+/usr/include/bits/locale.h:
+
+../../../src/include/gettext.h:
+
+/usr/include/libintl.h:
+
+/usr/include/sys/mman.h:
+
+/usr/include/bits/mman.h:
+
+/usr/include/langinfo.h:
+
+/usr/include/nl_types.h:
Added: GNUnet/src/util/error/.libs/liberror.a
===================================================================
(Binary files differ)
Property changes on: GNUnet/src/util/error/.libs/liberror.a
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: GNUnet/src/util/error/Makefile
===================================================================
--- GNUnet/src/util/error/Makefile 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/error/Makefile 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,601 @@
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# src/util/error/Makefile. Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 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.
+
+
+
+SOURCES = $(liberror_la_SOURCES)
+
+srcdir = .
+top_srcdir = ../../..
+
+pkgdatadir = $(datadir)/GNUnet
+pkglibdir = $(libdir)/GNUnet
+pkgincludedir = $(includedir)/GNUnet
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = /usr/bin/install -c
+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 = :
+host_triplet = i686-pc-linux-gnu
+subdir = src/util/error
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-2.0.m4 \
+ $(top_srcdir)/m4/guile.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/libgcrypt.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+liberror_la_LIBADD =
+am_liberror_la_OBJECTS = error.lo
+liberror_la_OBJECTS = $(am_liberror_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+DEP_FILES = ./$(DEPDIR)/error.Plo
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(liberror_la_SOURCES)
+DIST_SOURCES = $(liberror_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = ${SHELL} /home/grothoff/svn/GNUnet/missing --run aclocal-1.8
+AMDEP_FALSE = #
+AMDEP_TRUE =
+AMTAR = ${SHELL} /home/grothoff/svn/GNUnet/missing --run tar
+AR = ar
+AS = as
+AUTOCONF = ${SHELL} /home/grothoff/svn/GNUnet/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/grothoff/svn/GNUnet/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/grothoff/svn/GNUnet/missing --run automake-1.8
+AWK = gawk
+CC = gcc
+CCDEPMODE = depmode=gcc3
+CFLAGS = -fno-strict-aliasing -Wall -g -Wall
+CONVENIENCE_LTDL_FALSE =
+CONVENIENCE_LTDL_TRUE = #
+CPP = gcc -E
+CPPFLAGS = -I/home/grothoff/include
+CXX = g++
+CXXCPP = g++ -E
+CXXDEPMODE = depmode=gcc3
+CXXFLAGS = -g -O2
+CYGPATH_W = echo
+CYGWIN_FALSE =
+CYGWIN_TRUE = #
+DATADIR = /home/grothoff/share/GNUnet/
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+DLLTOOL = dlltool
+ECHO = echo
+ECHO_C =
+ECHO_N = -n
+ECHO_T =
+EGREP = grep -E
+EXEEXT =
+EXT_LIBS =
+EXT_LIB_PATH = -L/home/grothoff/lib
+F77 =
+FFLAGS =
+GMSGFMT = /usr/bin/msgfmt
+GNUNETGTK_CFLAGS = -DXTHREADS -I/usr/include/libglade-2.0
-I/usr/include/gtk-2.0 -I/usr/include/libxml2 -I/usr/lib/gtk-2.0/include
-I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0
-I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
+GNUNETGTK_LIBS = -lglade-2.0 -lgtk-x11-2.0 -lxml2 -lpthread -lz -lgdk-x11-2.0
-latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0
-lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
+GTK_CFLAGS = -DXTHREADS -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include
-I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0
-I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
+GTK_LIBS = -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm
-lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl
-lglib-2.0
+GUILE = /usr/bin/guile
+GUILE_CONFIG = /usr/bin/guile-config
+GUILE_TOOLS = /usr/bin/guile-tools
+HAVE_CURSES_FALSE = #
+HAVE_CURSES_TRUE =
+HAVE_GTK_FALSE = #
+HAVE_GTK_TRUE =
+HAVE_GUILE_FALSE = #
+HAVE_GUILE_TRUE =
+HAVE_IPV6_FALSE = #
+HAVE_IPV6_TRUE =
+HAVE_MYSQL_FALSE =
+HAVE_MYSQL_TRUE = #
+HAVE_PDCURSES_FALSE =
+HAVE_PDCURSES_TRUE = #
+HAVE_SQLITE_FALSE = #
+HAVE_SQLITE_TRUE =
+HAVE_ZLIB_FALSE = #
+HAVE_ZLIB_TRUE =
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_LTDL_FALSE =
+INSTALL_LTDL_TRUE = #
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
+INTLLIBS =
+LDFLAGS = -L/home/grothoff/lib
+LIBADD_DL = -ldl
+LIBGCRYPT_CFLAGS =
+LIBGCRYPT_CONFIG = /usr/bin/libgcrypt-config
+LIBGCRYPT_LIBS = -lgcrypt -lgpg-error
+LIBICONV = -liconv
+LIBINTL =
+LIBLTDL = -lltdl
+LIBOBJS =
+LIBS = -lm -lnsl -lpthread
+LIBTOOL = $(SHELL) $(top_builddir)/libtool
+LN_S = ln -s
+LOCALEDIR = /home/grothoff/share/locale/
+LTDLINCL =
+LTLIBICONV = -liconv
+LTLIBINTL =
+LTLIBOBJS =
+MAKEINFO = ${SHELL} /home/grothoff/svn/GNUnet/missing --run makeinfo
+MINGW_FALSE =
+MINGW_TRUE = #
+MKINSTALLDIRS = $(top_builddir)/./mkinstalldirs
+MSGFMT = /usr/bin/msgfmt
+MSGMERGE = /usr/bin/msgmerge
+MYSQL_CPPFLAGS =
+MYSQL_LDFLAGS = -L/usr/lib/mysql
+OBJDUMP = objdump
+OBJEXT = o
+PACKAGE = GNUnet
+PACKAGE_BUGREPORT = address@hidden
+PACKAGE_NAME = GNUnet
+PACKAGE_STRING = GNUnet 0.7.0e
+PACKAGE_TARNAME = gnunet
+PACKAGE_VERSION = 0.7.0e
+PATH_SEPARATOR = :
+PKG_CONFIG = /usr/bin/pkg-config
+POSUB = po
+RANLIB = ranlib
+SET_MAKE =
+SHELL = /bin/sh
+SOLARIS_FALSE =
+SOLARIS_TRUE = #
+SQLITE_CPPFLAGS =
+SQLITE_LDFLAGS =
+STRIP = strip
+USE_NLS = yes
+VERSION = 0.7.0e
+XFREEBSD_FALSE =
+XFREEBSD_TRUE = #
+XGETTEXT = /usr/bin/xgettext
+ac_ct_AR = ar
+ac_ct_AS =
+ac_ct_CC = gcc
+ac_ct_CXX = g++
+ac_ct_DLLTOOL =
+ac_ct_F77 =
+ac_ct_OBJDUMP =
+ac_ct_RANLIB = ranlib
+ac_ct_STRIP = strip
+am__fastdepCC_FALSE = #
+am__fastdepCC_TRUE =
+am__fastdepCXX_FALSE = #
+am__fastdepCXX_TRUE =
+am__include = include
+am__leading_dot = .
+am__quote =
+bindir = ${exec_prefix}/bin
+build = i686-pc-linux-gnu
+build_alias =
+build_cpu = i686
+build_os = linux-gnu
+build_vendor = pc
+datadir = ${prefix}/share
+exec_prefix = ${prefix}
+guile_available = /usr/bin/guile
+host = i686-pc-linux-gnu
+host_alias =
+host_cpu = i686
+host_os = linux-gnu
+host_vendor = pc
+includedir = ${prefix}/include
+infodir = ${prefix}/info
+install_sh = /home/grothoff/svn/GNUnet/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localstatedir = ${prefix}/var
+mandir = ${prefix}/man
+mkdir_p = mkdir -p -- .
+oldincludedir = /usr/include
+prefix = /home/grothoff
+program_transform_name = s,x,x,
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+subdirs = libltdl
+sysconfdir = ${prefix}/etc
+target_alias =
+INCLUDES = -I$(top_srcdir)/src/include
+SUBDIRS = .
+noinst_LTLIBRARIES = \
+ liberror.la
+
+liberror_la_SOURCES = \
+ error.c
+
+all: all-recursive
+
+.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 \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/util/error/Makefile';
\
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/util/error/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
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_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
+liberror.la: $(liberror_la_OBJECTS) $(liberror_la_DEPENDENCIES)
+ $(LINK) $(liberror_la_LDFLAGS) $(liberror_la_OBJECTS)
$(liberror_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+include ./$(DEPDIR)/error.Plo
+
+.c.o:
+ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
+# source='$<' object='$@' libtool=no \
+# depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
+# $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c $<
+
+.c.obj:
+ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
`$(CYGPATH_W) '$<'`; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
+# source='$<' object='$@' libtool=no \
+# depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
+# $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
+# source='$<' object='$@' libtool=yes \
+# depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' \
+# $(CCDEPMODE) $(depcomp) \
+# $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags);
\
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS)
ctags); \
+ done
+
+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; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed
"s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || mkdir "$(distdir)/$$subdir" \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="../$(top_distdir)" \
+ distdir="../$(distdir)/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES)
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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:
+ -rm -f $(CONFIG_CLEAN_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-recursive
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ clean-recursive ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-recursive distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am uninstall-info-am
+
+# 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:
Added: GNUnet/src/util/error/Makefile.am
===================================================================
--- GNUnet/src/util/error/Makefile.am 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/error/Makefile.am 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,10 @@
+INCLUDES = -I$(top_srcdir)/src/include
+
+SUBDIRS = .
+
+noinst_LTLIBRARIES = \
+ liberror.la
+
+liberror_la_SOURCES = \
+ error.c
+
Added: GNUnet/src/util/error/Makefile.in
===================================================================
--- GNUnet/src/util/error/Makefile.in 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/error/Makefile.in 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,601 @@
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 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.
+
address@hidden@
+
+SOURCES = $(liberror_la_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+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 = :
+host_triplet = @host@
+subdir = src/util/error
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-2.0.m4 \
+ $(top_srcdir)/m4/guile.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/libgcrypt.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+liberror_la_LIBADD =
+am_liberror_la_OBJECTS = error.lo
+liberror_la_OBJECTS = $(am_liberror_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
address@hidden@DEP_FILES = ./$(DEPDIR)/error.Plo
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(liberror_la_SOURCES)
+DIST_SOURCES = $(liberror_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONVENIENCE_LTDL_FALSE = @CONVENIENCE_LTDL_FALSE@
+CONVENIENCE_LTDL_TRUE = @CONVENIENCE_LTDL_TRUE@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+CYGWIN_FALSE = @CYGWIN_FALSE@
+CYGWIN_TRUE = @CYGWIN_TRUE@
+DATADIR = @DATADIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+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@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GMSGFMT = @GMSGFMT@
+GNUNETGTK_CFLAGS = @GNUNETGTK_CFLAGS@
+GNUNETGTK_LIBS = @GNUNETGTK_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+GUILE = @GUILE@
+GUILE_CONFIG = @GUILE_CONFIG@
+GUILE_TOOLS = @GUILE_TOOLS@
+HAVE_CURSES_FALSE = @HAVE_CURSES_FALSE@
+HAVE_CURSES_TRUE = @HAVE_CURSES_TRUE@
+HAVE_GTK_FALSE = @HAVE_GTK_FALSE@
+HAVE_GTK_TRUE = @HAVE_GTK_TRUE@
+HAVE_GUILE_FALSE = @HAVE_GUILE_FALSE@
+HAVE_GUILE_TRUE = @HAVE_GUILE_TRUE@
+HAVE_IPV6_FALSE = @HAVE_IPV6_FALSE@
+HAVE_IPV6_TRUE = @HAVE_IPV6_TRUE@
+HAVE_MYSQL_FALSE = @HAVE_MYSQL_FALSE@
+HAVE_MYSQL_TRUE = @HAVE_MYSQL_TRUE@
+HAVE_PDCURSES_FALSE = @HAVE_PDCURSES_FALSE@
+HAVE_PDCURSES_TRUE = @HAVE_PDCURSES_TRUE@
+HAVE_SQLITE_FALSE = @HAVE_SQLITE_FALSE@
+HAVE_SQLITE_TRUE = @HAVE_SQLITE_TRUE@
+HAVE_ZLIB_FALSE = @HAVE_ZLIB_FALSE@
+HAVE_ZLIB_TRUE = @HAVE_ZLIB_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_LTDL_FALSE = @INSTALL_LTDL_FALSE@
+INSTALL_LTDL_TRUE = @INSTALL_LTDL_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+LDFLAGS = @LDFLAGS@
+LIBADD_DL = @LIBADD_DL@
+LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBLTDL = @LIBLTDL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LOCALEDIR = @LOCALEDIR@
+LTDLINCL = @LTDLINCL@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MINGW_FALSE = @MINGW_FALSE@
+MINGW_TRUE = @MINGW_TRUE@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+MSGMERGE = @MSGMERGE@
+MYSQL_CPPFLAGS = @MYSQL_CPPFLAGS@
+MYSQL_LDFLAGS = @MYSQL_LDFLAGS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_FALSE = @SOLARIS_FALSE@
+SOLARIS_TRUE = @SOLARIS_TRUE@
+SQLITE_CPPFLAGS = @SQLITE_CPPFLAGS@
+SQLITE_LDFLAGS = @SQLITE_LDFLAGS@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+XFREEBSD_FALSE = @XFREEBSD_FALSE@
+XFREEBSD_TRUE = @XFREEBSD_TRUE@
+XGETTEXT = @XGETTEXT@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+guile_available = @guile_available@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+subdirs = @subdirs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+INCLUDES = -I$(top_srcdir)/src/include
+SUBDIRS = .
+noinst_LTLIBRARIES = \
+ liberror.la
+
+liberror_la_SOURCES = \
+ error.c
+
+all: all-recursive
+
+.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 \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/util/error/Makefile';
\
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/util/error/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
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_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
+liberror.la: $(liberror_la_OBJECTS) $(liberror_la_DEPENDENCIES)
+ $(LINK) $(liberror_la_LDFLAGS) $(liberror_la_OBJECTS)
$(liberror_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
+
+.c.o:
address@hidden@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
$<; \
address@hidden@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
address@hidden@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no
@AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po'
tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(COMPILE) -c $<
+
+.c.obj:
address@hidden@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
`$(CYGPATH_W) '$<'`; \
address@hidden@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
address@hidden@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no
@AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po'
tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
address@hidden@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
$<; \
address@hidden@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
address@hidden@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes
@AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo'
tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags);
\
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS)
ctags); \
+ done
+
+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; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed
"s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || mkdir "$(distdir)/$$subdir" \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="../$(top_distdir)" \
+ distdir="../$(distdir)/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES)
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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:
+ -rm -f $(CONFIG_CLEAN_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-recursive
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ clean-recursive ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-recursive distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am uninstall-info-am
+
+# 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:
Added: GNUnet/src/util/error/error.c
===================================================================
--- GNUnet/src/util/error/error.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/error/error.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,263 @@
+/*
+ This file is part of GNUnet.
+ (C) 2006 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 util/error/error.c
+ * @brief error handling API
+ *
+ * @author Christian Grothoff
+ */
+#include "gnunet_util_error.h"
+#include "platform.h"
+
+/**
+ * Default context for logging errors; used
+ * if NULL is passed to GE_LOG.
+ */
+static struct GE_Context defaultContext;
+
+typedef struct GE_Context {
+ GE_KIND mask;
+ GE_LogHandler handler;
+ void * cls;
+ GE_CtxFree destruct;
+} GE_Context;
+
+/**
+ * Does the given event match the mask?
+ * @param have the event type
+ * @param mask the filter mask
+ */
+int GE_applies(GE_KIND have,
+ GE_KIND mask) {
+ GE_KIND both = mask & have;
+ return ( (both & GE_EVENTKIND) &&
+ (both & GE_USERKIND) &&
+ (both & GE_ROUTEKIND) );
+}
+
+void GE_LOG(struct GE_Context * ctx,
+ GE_KIND kind,
+ const char * message,
+ ...) {
+ char date[64];
+ time_t timetmp;
+ struct tm * tmptr;
+
+ if (ctx == NULL)
+ ctx = defaultContext;
+ if (ctx == NULL)
+ return;
+ if (! GE_applies(kind, ctx->mask))
+ return;
+ time(&timetmp);
+ tmptr = localtime(&timetmp);
+ if (0 != strftime(date,
+ 64,
+ "%b %d %H:%M:%S",
+ tmptr))
+ abort();
+ ctx->handler(ctx->cls,
+ kind,
+ date,
+ message);
+}
+
+/**
+ * Create a log context that calls a callback function
+ * for matching events.
+ *
+ * @param mask which events is this handler willing to process?
+ * an event must be non-zero in all 3 GE_KIND categories
+ * to be passed to this handler
+ */
+struct GE_Context *
+GE_create_context_callback(GE_KIND mask,
+ GE_LogHandler handler,
+ void * ctx,
+ GE_CtxFree liberator) {
+ GE_Context * ret;
+
+ ret = malloc(sizeof(GE_Context));
+ if (ret == NULL)
+ return NULL;
+ ret->mask = mask;
+ ret->handler = handler;
+ ret->cls = ctx;
+ ret->destruct = liberator;
+ return ret;
+}
+
+/**
+ * Free a log context.
+ */
+void GE_free_context(GE_Context * ctx) {
+ if (ctx == NULL)
+ return;
+ if (ctx->destruct != NULL)
+ ctx->destruct(ctx->cls);
+ free(ctx);
+}
+
+/**
+ * Would an event of this kind be possibly
+ * processed by the logger?
+ * @param ctx the logger
+ * @param have the kind of event
+ */
+int GE_isLogged(GE_Context * ctx,
+ GE_KIND kind) {
+ return GE_applies(kind,
+ ctx->mask);
+}
+
+/**
+ * Convert a textual description of a loglevel
+ * to the respective GE_KIND.
+ * @returns GE_INVALID if log does not parse
+ */
+GE_KIND GE_getKIND(const char * log) {
+ if (0 == strcasecmp(log,
+ _("DEBUG")))
+ return GE_DEBUG;
+ if (0 == strcasecmp(log,
+ _("STATUS")))
+ return GE_STATUS;
+ if (0 == strcasecmp(log,
+ _("WARNING")))
+ return GE_WARNING;
+ if (0 == strcasecmp(log,
+ _("ERROR")))
+ return GE_ERROR;
+ if (0 == strcasecmp(log,
+ _("FATAL")))
+ return GE_FATAL;
+ if (0 == strcasecmp(log,
+ _("USER")))
+ return GE_USER;
+ if (0 == strcasecmp(log,
+ _("ADMIN")))
+ return GE_ADMIN;
+ if (0 == strcasecmp(log,
+ _("DEVELOPER")))
+ return GE_DEVELOPER;
+ if (0 == strcasecmp(log,
+ _("REQUEST")))
+ return GE_REQUEST;
+ if (0 == strcasecmp(log,
+ _("BULK")))
+ return GE_BULK;
+ if (0 == strcasecmp(log,
+ _("IMMEDIATE")))
+ return GE_IMMEDIATE;
+ if (0 == strcasecmp(log,
+ _("ALL")))
+ return GE_ALL;
+
+ return GE_INVALID;
+}
+
+/**
+ * Convert KIND to String
+ */
+const char * GE_kindToString(GE_KIND kind) {
+ if ( (kind & GE_DEBUG) > 0)
+ return _("DEBUG");
+ if ( (kind & GE_STATUS) > 0)
+ return _("STATUS");
+ if ( (kind & GE_WARNING) > 0)
+ return _("WARNING");
+ if ( (kind & GE_ERROR) > 0)
+ return _("ERROR");
+ if ( (kind & GE_FATAL) > 0)
+ return _("FATAL");
+ if ( (kind & GE_USER) > 0)
+ return _("USER");
+ if ( (kind & GE_ADMIN) > 0)
+ return _("ADMIN");
+ if ( (kind & GE_DEVELOPER) > 0)
+ return _("DEVELOPER");
+ if ( (kind & GE_REQUEST) > 0)
+ return _("REQUEST");
+ if ( (kind & GE_BULK) > 0)
+ return _("BULK");
+ if ( (kind & GE_IMMEDIATE) > 0)
+ return _("IMMEDIATE");
+ return _("NOTHING");
+}
+
+
+typedef struct {
+ struct GE_Context * c1;
+ struct GE_Context * c2;
+} CPair;
+
+static void multiplexer(void * ctx,
+ GE_KIND kind,
+ const char * date,
+ const char * msg) {
+ CPair * pair = ctx;
+
+ if (GE_applies(kind, pair->c1->mask))
+ pair->c1->handler(pair->c1->cls, kind, date, msg);
+ if (GE_applies(kind, pair->c2->mask))
+ pair->c2->handler(pair->c1->cls, kind, date, msg);
+}
+
+static void pairdestruct(void * ctx) {
+ CPair * pair = ctx;
+
+ GE_free_context(pair->c1);
+ GE_free_context(pair->c2);
+ free(ctx);
+}
+
+/**
+ * Create a context that sends events to two other contexts.
+ * Note that the client must stop using ctx1/ctx2 henceforth.
+ */
+struct GE_Context *
+GE_create_context_multiplexer(struct GE_Context * ctx1,
+ struct GE_Context * ctx2) {
+ CPair * cls;
+ GE_Context * ret;
+
+ cls = malloc(sizeof(CPair));
+ if (cls == NULL)
+ return NULL;
+ cls->c1 = ctx1;
+ cls->c2 = ctx2;
+ ret = malloc(sizeof(GE_Context));
+ if (ret == NULL) {
+ free(cls);
+ return NULL;
+ }
+ ret->cls = cls;
+ ret->handler = &multiplexer;
+ ret->mask = ctx1->mask | ctx2->mask;
+ ret->destruct = &pairdestruct;
+ return ret;
+}
+
+
+void GE_setDefaultContext(struct GE_Context * ctx) {
+ defaultContext = ctx;
+}
+
Deleted: GNUnet/src/util/hashing.c
===================================================================
--- GNUnet/src/util/hashing.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/hashing.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,659 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2001, 2002, 2003, 2004, 2005, 2006 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.
-
- SHA-512 code by Jean-Luc Cooke <address@hidden>
-
- Copyright (c) Jean-Luc Cooke <address@hidden>
- Copyright (c) Andrew McDonald <address@hidden>
- Copyright (c) 2003 Kyle McMartin <address@hidden>
-*/
-
-/**
- * @file util/hashing.c
- * @brief RIPE160MD hash related functions
- * @author Christian Grothoff
- */
-
-#include "platform.h"
-#include "gnunet_util.h"
-
-#define SHA512_DIGEST_SIZE 64
-#define SHA512_HMAC_BLOCK_SIZE 128
-
-struct sha512_ctx {
- unsigned long long state[8];
- unsigned int count[4];
- unsigned char buf[128];
-};
-
-static unsigned long long Ch(unsigned long long x,
- unsigned long long y,
- unsigned long long z) {
- return z ^ (x & (y ^ z));
-}
-
-static unsigned long long Maj(unsigned long long x,
- unsigned long long y,
- unsigned long long z) {
- return (x & y) | (z & (x | y));
-}
-
-static unsigned long long RORu64(unsigned long long x,
- unsigned long long y) {
- return (x >> y) | (x << (64 - y));
-}
-
-const unsigned long long sha512_K[80] = {
- 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, 0xb5c0fbcfec4d3b2fULL,
- 0xe9b5dba58189dbbcULL, 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL,
- 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL, 0xd807aa98a3030242ULL,
- 0x12835b0145706fbeULL, 0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL,
- 0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL, 0x9bdc06a725c71235ULL,
- 0xc19bf174cf692694ULL, 0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL,
- 0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL, 0x2de92c6f592b0275ULL,
- 0x4a7484aa6ea6e483ULL, 0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL,
- 0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL, 0xb00327c898fb213fULL,
- 0xbf597fc7beef0ee4ULL, 0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL,
- 0x06ca6351e003826fULL, 0x142929670a0e6e70ULL, 0x27b70a8546d22ffcULL,
- 0x2e1b21385c26c926ULL, 0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL,
- 0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL, 0x81c2c92e47edaee6ULL,
- 0x92722c851482353bULL, 0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL,
- 0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL, 0xd192e819d6ef5218ULL,
- 0xd69906245565a910ULL, 0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL,
- 0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL, 0x2748774cdf8eeb99ULL,
- 0x34b0bcb5e19b48a8ULL, 0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL,
- 0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL, 0x748f82ee5defb2fcULL,
- 0x78a5636f43172f60ULL, 0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL,
- 0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL, 0xbef9a3f7b2c67915ULL,
- 0xc67178f2e372532bULL, 0xca273eceea26619cULL, 0xd186b8c721c0c207ULL,
- 0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL, 0x06f067aa72176fbaULL,
- 0x0a637dc5a2c898a6ULL, 0x113f9804bef90daeULL, 0x1b710b35131c471bULL,
- 0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, 0x3c9ebe0a15c9bebcULL,
- 0x431d67c49c100d4cULL, 0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL,
- 0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL,
-};
-
-#define e0(x) (RORu64(x,28) ^ RORu64(x,34) ^ RORu64(x,39))
-#define e1(x) (RORu64(x,14) ^ RORu64(x,18) ^ RORu64(x,41))
-#define s0(x) (RORu64(x, 1) ^ RORu64(x, 8) ^ (x >> 7))
-#define s1(x) (RORu64(x,19) ^ RORu64(x,61) ^ (x >> 6))
-
-/* H* initial state for SHA-512 */
-#define H0 0x6a09e667f3bcc908ULL
-#define H1 0xbb67ae8584caa73bULL
-#define H2 0x3c6ef372fe94f82bULL
-#define H3 0xa54ff53a5f1d36f1ULL
-#define H4 0x510e527fade682d1ULL
-#define H5 0x9b05688c2b3e6c1fULL
-#define H6 0x1f83d9abfb41bd6bULL
-#define H7 0x5be0cd19137e2179ULL
-
-/* H'* initial state for SHA-384 */
-#define HP0 0xcbbb9d5dc1059ed8ULL
-#define HP1 0x629a292a367cd507ULL
-#define HP2 0x9159015a3070dd17ULL
-#define HP3 0x152fecd8f70e5939ULL
-#define HP4 0x67332667ffc00b31ULL
-#define HP5 0x8eb44a8768581511ULL
-#define HP6 0xdb0c2e0d64f98fa7ULL
-#define HP7 0x47b5481dbefa4fa4ULL
-
-static void LOAD_OP(int I, unsigned long long *W, const unsigned char *input) {
- unsigned long long t1 = input[(8*I) ] & 0xff;
- t1 <<= 8;
- t1 |= input[(8*I)+1] & 0xff;
- t1 <<= 8;
- t1 |= input[(8*I)+2] & 0xff;
- t1 <<= 8;
- t1 |= input[(8*I)+3] & 0xff;
- t1 <<= 8;
- t1 |= input[(8*I)+4] & 0xff;
- t1 <<= 8;
- t1 |= input[(8*I)+5] & 0xff;
- t1 <<= 8;
- t1 |= input[(8*I)+6] & 0xff;
- t1 <<= 8;
- t1 |= input[(8*I)+7] & 0xff;
- W[I] = t1;
-}
-
-static void BLEND_OP(int I, unsigned long long *W) {
- W[I] = s1(W[I-2]) + W[I-7] + s0(W[I-15]) + W[I-16];
-}
-
-static void
-sha512_transform(unsigned long long *state, const unsigned char *input) {
- unsigned long long a, b, c, d, e, f, g, h, t1, t2;
- unsigned long long W[80];
-
- int i;
-
- /* load the input */
- for (i = 0; i < 16; i++)
- LOAD_OP(i, W, input);
-
- for (i = 16; i < 80; i++) {
- BLEND_OP(i, W);
- }
-
- /* load the state into our registers */
- a=state[0]; b=state[1]; c=state[2]; d=state[3];
- e=state[4]; f=state[5]; g=state[6]; h=state[7];
-
- /* now iterate */
- for (i=0; i<80; i+=8) {
- t1 = h + e1(e) + Ch(e,f,g) + sha512_K[i ] + W[i ];
- t2 = e0(a) + Maj(a,b,c); d+=t1; h=t1+t2;
- t1 = g + e1(d) + Ch(d,e,f) + sha512_K[i+1] + W[i+1];
- t2 = e0(h) + Maj(h,a,b); c+=t1; g=t1+t2;
- t1 = f + e1(c) + Ch(c,d,e) + sha512_K[i+2] + W[i+2];
- t2 = e0(g) + Maj(g,h,a); b+=t1; f=t1+t2;
- t1 = e + e1(b) + Ch(b,c,d) + sha512_K[i+3] + W[i+3];
- t2 = e0(f) + Maj(f,g,h); a+=t1; e=t1+t2;
- t1 = d + e1(a) + Ch(a,b,c) + sha512_K[i+4] + W[i+4];
- t2 = e0(e) + Maj(e,f,g); h+=t1; d=t1+t2;
- t1 = c + e1(h) + Ch(h,a,b) + sha512_K[i+5] + W[i+5];
- t2 = e0(d) + Maj(d,e,f); g+=t1; c=t1+t2;
- t1 = b + e1(g) + Ch(g,h,a) + sha512_K[i+6] + W[i+6];
- t2 = e0(c) + Maj(c,d,e); f+=t1; b=t1+t2;
- t1 = a + e1(f) + Ch(f,g,h) + sha512_K[i+7] + W[i+7];
- t2 = e0(b) + Maj(b,c,d); e+=t1; a=t1+t2;
- }
-
- state[0] += a; state[1] += b; state[2] += c; state[3] += d;
- state[4] += e; state[5] += f; state[6] += g; state[7] += h;
-
- /* erase our data */
- a = b = c = d = e = f = g = h = t1 = t2 = 0;
- memset(W, 0, 80 * sizeof(unsigned long long));
-}
-
-static void
-sha512_init(struct sha512_ctx * sctx) {
- sctx->state[0] = H0;
- sctx->state[1] = H1;
- sctx->state[2] = H2;
- sctx->state[3] = H3;
- sctx->state[4] = H4;
- sctx->state[5] = H5;
- sctx->state[6] = H6;
- sctx->state[7] = H7;
- sctx->count[0] = sctx->count[1] = sctx->count[2] = sctx->count[3] = 0;
- memset(sctx->buf, 0, sizeof(sctx->buf));
-}
-
-static void
-sha512_update(struct sha512_ctx * sctx,
- const unsigned char *data,
- unsigned int len) {
- unsigned int i, index, part_len;
-
- /* Compute number of bytes mod 128 */
- index = (unsigned int)((sctx->count[0] >> 3) & 0x7F);
-
- /* Update number of bits */
- if ((sctx->count[0] += (len << 3)) < (len << 3)) {
- if ((sctx->count[1] += 1) < 1)
- if ((sctx->count[2] += 1) < 1)
- sctx->count[3]++;
- sctx->count[1] += (len >> 29);
- }
-
- part_len = 128 - index;
-
- /* Transform as many times as possible. */
- if (len >= part_len) {
- memcpy(&sctx->buf[index], data, part_len);
- sha512_transform(sctx->state, sctx->buf);
-
- for (i = part_len; i + 127 < len; i+=128)
- sha512_transform(sctx->state, &data[i]);
-
- index = 0;
- } else {
- i = 0;
- }
-
- /* Buffer remaining input */
- memcpy(&sctx->buf[index], &data[i], len - i);
-}
-
-static void
-sha512_final(struct sha512_ctx * sctx,
- unsigned char *hash) {
- static unsigned char padding[128] = { 0x80, };
-
- unsigned int t;
- unsigned long long t2;
- unsigned char bits[128];
- unsigned int index, pad_len;
- int i, j;
-
- index = pad_len = t = i = j = 0;
- t2 = 0;
-
- /* Save number of bits */
- t = sctx->count[0];
- bits[15] = t; t>>=8;
- bits[14] = t; t>>=8;
- bits[13] = t; t>>=8;
- bits[12] = t;
- t = sctx->count[1];
- bits[11] = t; t>>=8;
- bits[10] = t; t>>=8;
- bits[9 ] = t; t>>=8;
- bits[8 ] = t;
- t = sctx->count[2];
- bits[7 ] = t; t>>=8;
- bits[6 ] = t; t>>=8;
- bits[5 ] = t; t>>=8;
- bits[4 ] = t;
- t = sctx->count[3];
- bits[3 ] = t; t>>=8;
- bits[2 ] = t; t>>=8;
- bits[1 ] = t; t>>=8;
- bits[0 ] = t;
-
- /* Pad out to 112 mod 128. */
- index = (sctx->count[0] >> 3) & 0x7f;
- pad_len = (index < 112) ? (112 - index) : ((128+112) - index);
- sha512_update(sctx, padding, pad_len);
-
- /* Append length (before padding) */
- sha512_update(sctx, bits, 16);
-
- /* Store state in digest */
- for (i = j = 0; i < 8; i++, j += 8) {
- t2 = sctx->state[i];
- hash[j+7] = (char)t2 & 0xff; t2>>=8;
- hash[j+6] = (char)t2 & 0xff; t2>>=8;
- hash[j+5] = (char)t2 & 0xff; t2>>=8;
- hash[j+4] = (char)t2 & 0xff; t2>>=8;
- hash[j+3] = (char)t2 & 0xff; t2>>=8;
- hash[j+2] = (char)t2 & 0xff; t2>>=8;
- hash[j+1] = (char)t2 & 0xff; t2>>=8;
- hash[j ] = (char)t2 & 0xff;
- }
-
- /* Zeroize sensitive information. */
- memset(sctx, 0, sizeof(struct sha512_ctx));
-}
-
-/**
- * Hash block of given size.
- *
- * @param block the data to hash, length is given as a second argument
- * @param size the length of the data to hash
- * @param ret pointer to where to write the hashcode
- */
-void hash(const void * block,
- unsigned int size,
- HashCode512 * ret) {
- struct sha512_ctx ctx;
-
- sha512_init(&ctx);
- sha512_update(&ctx, block, size);
- sha512_final(&ctx, (unsigned char*) ret);
-}
-
-/**
- * Compute the hash of an entire file. Does NOT load the entire file
- * into memory but instead processes it in blocks. Very important for
- * large files.
- *
- * @return OK on success, SYSERR on error
- */
-int getFileHash(const char * filename,
- HashCode512 * ret) {
- unsigned char * buf;
- unsigned long long len;
- unsigned long long pos;
- unsigned int delta;
- int fh;
- struct sha512_ctx ctx;
-
- if (OK != getFileSize(filename,
- &len))
- return SYSERR;
- fh = fileopen(filename,
- O_RDONLY | O_LARGEFILE);
- if (fh == -1) {
- LOG_FILE_STRERROR(LOG_ERROR, "open", filename);
- return SYSERR;
- }
- sha512_init(&ctx);
- pos = 0;
- buf = MALLOC(65536);
- while (pos < len) {
- delta = 65536;
- if (len - pos < delta)
- delta = len-pos;
- if (delta != READ(fh,
- buf,
- delta)) {
- LOG(LOG_ERROR, "Error reading from file at position %i\n",
pos);
- closefile(fh);
- FREE(buf);
- return SYSERR;
- }
- sha512_update(&ctx,
- buf,
- delta);
- if (pos + delta > pos)
- pos += delta;
- else
- break;
- }
- closefile(fh);
- sha512_final(&ctx,
- (unsigned char*) ret);
- FREE(buf);
- return OK;
-}
-
-/**
- * @brief Create a cryptographically weak hashcode from a buffer
- * @param z the buffer to hash
- * @param n the size of z
- * @return the hashcode
- */
-unsigned long long weakHash(const char *z, int n){
- unsigned long long h = 0;
- while(n > 0) {
- h = (h << 3) ^ h ^ (unsigned char) *z++;
- n--;
- }
- return h;
-}
-
-/* ***************** binary-ASCII encoding *************** */
-
-/**
- * 32 characters for encoding (hash => 32 characters)
- */
-static char * encTable__ = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
-
-static unsigned int getValue__(unsigned char a) {
- if ( (a >= '0') && (a <= '9') )
- return a - '0';
- if ( (a >= 'A') && (a <= 'V') )
- return (a - 'A' + 10);
- return -1;
-}
-
-/**
- * Convert hash to ASCII encoding. The ASCII encoding is rather
- * GNUnet specific. It was chosen such that it only uses characters
- * in [0-9A-V], can be produced without complex arithmetics and uses a
- * small number of characters. The GNUnet encoding uses 102
- * characters plus a null terminator.
- *
- * @param block the hash code
- * @param result where to store the encoding (EncName can be
- * safely cast to char*, a '\0' termination is set).
- */
-void hash2enc(const HashCode512 * block,
- EncName * result) {
- unsigned int wpos;
- unsigned int rpos;
- unsigned int bits;
- unsigned int vbit;
-
- GNUNET_ASSERT(block != NULL);
- GNUNET_ASSERT(result != NULL);
- vbit = 0;
- wpos = 0;
- rpos = 0;
- bits = 0;
- while ( (rpos < sizeof(HashCode512)) ||
- (vbit > 0) ) {
- if ( (rpos < sizeof(HashCode512)) &&
- (vbit < 5) ) {
- bits = (bits << 8) | ((unsigned char*)block)[rpos++]; /* eat 8 more bits
*/
- vbit += 8;
- }
- if (vbit < 5) {
- bits = bits << (5 - vbit); /* zero-padding */
- GNUNET_ASSERT(vbit == 2); /* padding by 3: 512+3 mod 5 == 0 */
- vbit = 5;
- }
- GNUNET_ASSERT(wpos < sizeof(EncName)-1);
- result->encoding[wpos++] = encTable__[(bits >> (vbit - 5)) & 31];
- vbit -= 5;
- }
- GNUNET_ASSERT(wpos == sizeof(EncName)-1);
- GNUNET_ASSERT(vbit == 0);
- result->encoding[wpos] = '\0';
-}
-
-/**
- * Convert ASCII encoding back to hash
- *
- * @param enc the encoding
- * @param result where to store the hash code
- * @return OK on success, SYSERR if result has the wrong encoding
- */
-int enc2hash(const char * enc,
- HashCode512 * result) {
- unsigned int rpos;
- unsigned int wpos;
- unsigned int bits;
- unsigned int vbit;
-
- if (strlen(enc) != sizeof(EncName)-1)
- return SYSERR;
-
- vbit = 2; /* padding! */
- wpos = sizeof(HashCode512);
- rpos = sizeof(EncName)-1;
- bits = getValue__(enc[--rpos]) >> 3;
- while (wpos > 0) {
- GNUNET_ASSERT(rpos > 0);
- bits = (getValue__(enc[--rpos]) << vbit) | bits;
- vbit += 5;
- if (vbit >= 8) {
- ((unsigned char*)result)[--wpos]
- = (unsigned char) bits;
- bits = bits >> 8;
- vbit -= 8;
- }
- }
- GNUNET_ASSERT(rpos == 0);
- GNUNET_ASSERT(vbit == 0);
- return OK;
-}
-
-/**
- * @brief Convert a weak 64 bit hash into a string
- * @param h the hashcode
- * @param e the string (zero terminated)
- */
-void encWeakHash(unsigned long long h, char e[14]) {
- int i;
-
- for (i = 0; i < 13; i++)
- e[i] = encTable__[(h << (5 * i)) >> 59];
- e[13] = 0;
-}
-
-/**
- * Compute the distance between 2 hashcodes. The computation must be
- * fast, not involve bits[0] or bits[4] (they're used elsewhere), and be
- * somewhat consistent. And of course, the result should be a positive
- * number.
- *
- * @returns a positive number which is a measure for
- * hashcode proximity.
- */
-unsigned int distanceHashCode512(const HashCode512 * a,
- const HashCode512 * b) {
- unsigned int x = (a->bits[1] - b->bits[1])>>16;
- return ((x*x)>>16);
-}
-
-/**
- * Compare two hashcodes.
- * @return 1 if they are equal, 0 if not.
- */
-int equalsHashCode512(const HashCode512 * a,
- const HashCode512 * b) {
- return (0 == memcmp(a,b,sizeof(HashCode512)));
-}
-
-void makeRandomId(HashCode512 * result) {
- int i;
- for (i=(sizeof(HashCode512)/sizeof(unsigned int))-1;i>=0;i--)
- result->bits[i] = rand();
-}
-
-void deltaId(const HashCode512 * a,
- const HashCode512 * b,
- HashCode512 * result) {
- int i;
- for (i=(sizeof(HashCode512)/sizeof(unsigned int))-1;i>=0;i--)
- result->bits[i] = b->bits[i] - a->bits[i];
-}
-
-void addHashCodes(const HashCode512 * a,
- const HashCode512 * delta,
- HashCode512 * result) {
- int i;
- for (i=(sizeof(HashCode512)/sizeof(unsigned int))-1;i>=0;i--)
- result->bits[i] = delta->bits[i] + a->bits[i];
-}
-
-void xorHashCodes(const HashCode512 * a,
- const HashCode512 * b,
- HashCode512 * result) {
- int i;
- for (i=(sizeof(HashCode512)/sizeof(unsigned int))-1;i>=0;i--)
- result->bits[i] = a->bits[i] ^ a->bits[i];
-}
-
-/**
- * Check if two hosts are the same.
- * @return YES if they are equal, otherwise NO
- */
-int hostIdentityEquals(const PeerIdentity * first,
- const PeerIdentity * second) {
- if ( (first == NULL) ||
- (second == NULL) )
- return NO;
- return equalsHashCode512(&first->hashPubKey,
- &second->hashPubKey);
-}
-
-/**
- * Convert a hashcode into a key.
- */
-void hashToKey(const HashCode512 * hc,
- SESSIONKEY * skey,
- INITVECTOR * iv) {
- GNUNET_ASSERT(sizeof(HashCode512) >=
- SESSIONKEY_LEN +
- sizeof(INITVECTOR));
- memcpy(skey,
- hc,
- SESSIONKEY_LEN);
- skey->crc32 = htonl(crc32N(skey,
- SESSIONKEY_LEN));
- memcpy(iv,
- &((char *)hc)[SESSIONKEY_LEN],
- sizeof(INITVECTOR));
-}
-
-/**
- * Obtain a bit from a hashcode.
- * @param code the hash to index bit-wise
- * @param bit index into the hashcode, [0...511]
- * @return Bit \a bit from hashcode \a code, -1 for invalid index
- */
-int getHashCodeBit(const HashCode512 * code,
- unsigned int bit) {
- if (bit >= 8 * sizeof(HashCode512)) {
- BREAK();
- return -1; /* error */
- }
- return (((unsigned char*)code)[bit >> 3] & (1 << bit & 7)) > 0;
-}
-
-/**
- * Compare function for HashCodes, producing a total ordering
- * of all hashcodes.
- * @return 1 if h1 > h2, -1 if h1 < h2 and 0 if h1 == h2.
- */
-int hashCodeCompare(const HashCode512 * h1,
- const HashCode512 * h2) {
- unsigned int * i1;
- unsigned int * i2;
- int i;
-
- i1 = (unsigned int*) h1;
- i2 = (unsigned int*) h2;
- for (i=(sizeof(HashCode512) / sizeof(unsigned int))-1;i>=0;i--) {
- if (i1[i] > i2[i])
- return 1;
- if (i1[i] < i2[i])
- return -1;
- }
- return 0;
-}
-
-/**
- * Find out which of the two hash codes is closer to target
- * in the XOR metric (Kademlia).
- * @return -1 if h1 is closer, 1 if h2 is closer and 0 if h1==h2.
- */
-int hashCodeCompareDistance(const HashCode512 * h1,
- const HashCode512 * h2,
- const HashCode512 * target) {
- int i;
-#if 0
- int diff;
- int b1, b2, bt;
-#endif
- unsigned int d1;
- unsigned int d2;
-
- for (i=sizeof(HashCode512)/sizeof(unsigned int)-1;i>=0;i--) {
- d1 = ((unsigned int*)h1)[i] ^ ((unsigned int*)target)[i];
- d2 = ((unsigned int*)h2)[i] ^ ((unsigned int*)target)[i];
- if (d1 > d2)
- return 1;
- else if (d1 < d2)
- return -1;
- }
-#if 0
- /* Old code: */
- for (i = sizeof(HashCode512) * 8 - 1; i >= 0; --i) {
- b1 = getHashCodeBit(h1, i);
- b2 = getHashCodeBit(h2, i);
- bt = getHashCodeBit(target, i);
- /* Check XOR distance. */
- diff = (b2 ^ bt) - (b1 ^ bt);
- if (diff < 0)
- return -1;
- else if (diff > 0)
- return 1;
- }
-#endif
- return 0;
-}
-
-/* end of hashing.c */
Deleted: GNUnet/src/util/hashingtest.c
===================================================================
--- GNUnet/src/util/hashingtest.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/hashingtest.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,51 +0,0 @@
-/**
- * Test for hashing.c
- * @author Christian Grothoff
- * @file util/hashingtest.c
- */
-
-#include "platform.h"
-#include "gnunet_util.h"
-#include "locking_gcrypt.h"
-
-static int test(int number) {
- HashCode512 h1;
- HashCode512 h2;
- EncName enc;
-
- memset(&h1, number, sizeof(HashCode512));
- hash2enc(&h1, &enc);
- if (OK != enc2hash((char*)&enc, &h2)) {
- printf("enc2hash failed!\n");
- return 1;
- }
-
- if (! equalsHashCode512(&h1, &h2)) {
- return 1;
- }
- return 0;
-}
-
-static int testEncoding() {
- int i;
- for (i=0;i<255;i++)
- if (0 != test(i))
- return 1;
- return 0;
-}
-
-int main(int argc, char * argv[]) {
- int failureCount = 0;
- int i;
-
- initLockingGcrypt();
- for (i=0;i<10;i++)
- failureCount += testEncoding();
- doneLockingGcrypt();
- if (failureCount == 0)
- return 0;
- else
- return 1;
-}
-
-/* end of hashingtest.c */
Deleted: GNUnet/src/util/hashtable.c
===================================================================
--- GNUnet/src/util/hashtable.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/hashtable.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,446 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2006 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.
-
- Based on http://www.pomakis.com/hashtable/hashtable.c which is public
- domain
-*/
-
-/**
- * @brief Hashtable implementation
- * @author Keith Pomakis
- * @author Nils Durner
- * @file util/hashtable.c
- */
-
-#include "gnunet_util.h"
-#include "platform.h"
-
-typedef struct KeyValuePair {
- void *key;
- unsigned long keylen;
- void *value;
- unsigned long valuelen;
- struct KeyValuePair *next;
-} KeyValuePair;
-
-typedef struct HashTable {
- long numOfBuckets;
- long numOfElements;
- KeyValuePair **bucketArray;
- float idealRatio;
- float lowerRehashThreshold;
- float upperRehashThreshold;
-} HashTable;
-
-static int isProbablePrime(long oddNumber) {
- long i;
-
- for (i=3; i<51; i+=2)
- if (oddNumber == i)
- return 1;
- else if (oddNumber%i == 0)
- return 0;
-
- return 1; /* maybe */
-}
-
-static long calculateIdealNumOfBuckets(const struct HashTable *hashTable) {
- long idealNumOfBuckets = hashTable->numOfElements / hashTable->idealRatio;
- if (idealNumOfBuckets < 5)
- idealNumOfBuckets = 5;
- else
- idealNumOfBuckets |= 0x01; /* make it an odd number */
- while (!isProbablePrime(idealNumOfBuckets))
- idealNumOfBuckets += 2;
-
- return idealNumOfBuckets;
-}
-
-
-/**
- * @brief creates a new HashTable
- * @param numOfBuckets the number of buckets to start the HashTable out with.
- * Must be greater than zero, and should be prime.
- * Ideally, the number of buckets should between 1/5
- * and 1 times the expected number of elements in the
- * HashTable. Values much more or less than this will
- * result in wasted memory or decreased performance
- * respectively. The number of buckets in a HashTable
- * can be re-calculated to an appropriate number by
- * calling the HashTableRehash() function once the
- * HashTable has been populated. The number of buckets
- * in a HashTable may also be re-calculated
- * automatically if the ratio of elements to buckets
- * passes the thresholds set by ht_setIdealRatio().
- * @return a new Hashtable, or NULL on error
- */
-struct HashTable *ht_create(long numOfBuckets) {
- struct HashTable *hashTable;
- int i;
-
- if (numOfBuckets <= 0)
- return NULL;
-
- hashTable = (struct HashTable *) MALLOC(sizeof(struct HashTable));
- if (hashTable == NULL)
- return NULL;
-
- hashTable->bucketArray = (KeyValuePair **)
- MALLOC(numOfBuckets * sizeof(KeyValuePair *));
- if (hashTable->bucketArray == NULL) {
- FREE(hashTable);
- return NULL;
- }
-
- hashTable->numOfBuckets = numOfBuckets;
- hashTable->numOfElements = 0;
-
- for (i=0; i<numOfBuckets; i++)
- hashTable->bucketArray[i] = NULL;
-
- hashTable->idealRatio = 3.0;
- hashTable->lowerRehashThreshold = 0.0;
- hashTable->upperRehashThreshold = 15.0;
-
- return hashTable;
-}
-
-/**
- * @brief destroys an existing HashTable
- * @param hashTable the HashTable to destroy
- */
-void ht_destroy(struct HashTable *hashTable) {
- int i;
-
- for (i=0; i < hashTable->numOfBuckets; i++) {
- KeyValuePair *pair = hashTable->bucketArray[i];
- while (pair != NULL) {
- KeyValuePair *nextPair = pair->next;
- FREE(pair->key);
- FREE(pair->value);
- FREE(pair);
- pair = nextPair;
- }
- }
-
- FREE(hashTable->bucketArray);
- FREE(hashTable);
-}
-
-/**
- * @brief checks the existence of a key in a HashTable
- * @param hashTable the HashTable to search
- * @param key the key to search for
- * @return whether or not the specified HashTable contains the
- * specified key
- */
-int ht_containsKey(const struct HashTable *hashTable,
- const void *key,
- const unsigned int keylen) {
- void *ret;
- unsigned int retlen;
-
- return ht_get(hashTable, key, keylen, &ret, &retlen);
-}
-
-/**
- * @brief checks the existence of a value in a HashTable
- * @param hashTable the HashTable to search
- * @param value the value to search for
- * @return whether or not the specified HashTable contains the
- * specified value
- */
-int ht_containsValue(const struct HashTable *hashTable,
- const void *value,
- const unsigned int valuelen) {
- int i;
-
- for (i=0; i<hashTable->numOfBuckets; i++) {
- KeyValuePair *pair = hashTable->bucketArray[i];
- while (pair != NULL) {
- if ( (pair->valuelen == valuelen) &&
- (memcmp(value, pair->value, valuelen) == 0) )
- return 1;
- pair = pair->next;
- }
- }
-
- return 0;
-}
-
-/**
- * @brief adds a key/value pair to a HashTable
- * @param hashTable the HashTable to add to
- * @param key the key to add or whose value to replace
- * @param value the value associated with the key
- * @return YES if successful, NO if an error was encountered
- */
-int ht_put(struct HashTable *hashTable,
- const void *key,
- const unsigned int keylen,
- void *value,
- const unsigned int valuelen) {
- long hashValue;
- KeyValuePair *pair;
-
- if (key == NULL || value == NULL)
- return NO;
-
- hashValue = weakHash(key, keylen) % hashTable->numOfBuckets;
- pair = hashTable->bucketArray[hashValue];
-
- while (pair != NULL && pair->keylen != keylen &&
- memcmp(key, pair->key, keylen) != 0)
- pair = pair->next;
-
- if (pair) {
- pair->key = REALLOC(pair->key, keylen);
- memcpy(pair->key, key, keylen);
- pair->keylen = keylen;
-
- pair->key = REALLOC(value, valuelen);
- memcpy(pair->value, value, valuelen);
- pair->valuelen = valuelen;
- }
- else {
- KeyValuePair *newPair = MALLOC(sizeof(KeyValuePair));
- if (newPair == NULL)
- return NO;
- else {
- newPair->key = MALLOC(keylen);
- memcpy(newPair->key, key, keylen);
- newPair->keylen = keylen;
- newPair->value = MALLOC(valuelen);
- memcpy(newPair->value, value, valuelen);
- newPair->valuelen = valuelen;
- newPair->next = hashTable->bucketArray[hashValue];
- hashTable->bucketArray[hashValue] = newPair;
- hashTable->numOfElements++;
-
- if (hashTable->upperRehashThreshold > hashTable->idealRatio) {
- float elementToBucketRatio = (float) hashTable->numOfElements /
- (float) hashTable->numOfBuckets;
- if (elementToBucketRatio > hashTable->upperRehashThreshold)
- ht_rehash(hashTable, 0);
- }
- }
- }
-
- return YES;
-}
-
-/**
- * @brief retrieves the value of a key in a HashTable
- * @param hashTable the HashTable to search
- * @param key the key whose value is desired
- * @param value the corresponding value
- * @param valuelen the length of the value
- * @return YES if found, NO otherwise
- */
-int ht_get(const struct HashTable *hashTable,
- const void *key,
- const unsigned int keylen,
- void **value,
- unsigned int *valuelen) {
- long hashValue = weakHash(key, keylen) % hashTable->numOfBuckets;
- KeyValuePair *pair = hashTable->bucketArray[hashValue];
-
- while (pair != NULL && keylen != pair->keylen && memcmp(key, pair->key,
keylen) != 0)
- pair = pair->next;
-
- if (pair != NULL)
- {
- *value = pair->value;
- *valuelen = pair->valuelen;
- }
-
- return pair != NULL;
-}
-
-/**
- * @brief removes a key/value pair from a HashTable
- * @param hashTable the HashTable to remove the key/value pair from
- * @param key the key specifying the key/value pair to be removed
- */
-void ht_remove(struct HashTable *hashTable,
- const void *key,
- const unsigned int keylen) {
- long hashValue = weakHash(key, keylen) % hashTable->numOfBuckets;
- KeyValuePair *pair = hashTable->bucketArray[hashValue];
- KeyValuePair *previousPair = NULL;
-
- while (pair != NULL && pair->keylen != keylen &&
- memcmp(pair->key, key, keylen) != 0) {
- previousPair = pair;
- pair = pair->next;
- }
-
- if (pair != NULL) {
- FREE(pair->key);
- FREE(pair->value);
- if (previousPair != NULL)
- previousPair->next = pair->next;
- else
- hashTable->bucketArray[hashValue] = pair->next;
- FREE(pair);
- hashTable->numOfElements--;
-
- if (hashTable->lowerRehashThreshold > 0.0) {
- float elementToBucketRatio = (float) hashTable->numOfElements /
- (float) hashTable->numOfBuckets;
- if (elementToBucketRatio < hashTable->lowerRehashThreshold)
- ht_rehash(hashTable, 0);
- }
- }
-}
-
-/**
- * @brief removes all key/value pairs from a HashTable
- * @param hashTable the HashTable to remove all key/value pairs from
- */
-void ht_removeAll(struct HashTable *hashTable) {
- int i;
-
- for (i=0; i<hashTable->numOfBuckets; i++) {
- KeyValuePair *pair = hashTable->bucketArray[i];
- while (pair != NULL) {
- KeyValuePair *nextPair = pair->next;
- FREE(pair->key);
- FREE(pair->value);
- FREE(pair);
- pair = nextPair;
- }
- hashTable->bucketArray[i] = NULL;
- }
-
- hashTable->numOfElements = 0;
- ht_rehash(hashTable, 5);
-}
-
-/**
- * @brief returns the number of elements in a HashTable
- * @param hashTable the HashTable whose size is requested
- * @return the number of key/value pairs that are present in
- * the specified HashTable
- */
-long ht_size(const struct HashTable *hashTable) {
- return hashTable->numOfElements;
-}
-
-/**
- * @brief returns the number of buckets in a HashTable
- * @param hashTable the HashTable whose number of buckets is requested
- * @return the number of buckets that are in the specified
- * HashTable
- */
-long ht_buckets(const struct HashTable *hashTable) {
- return hashTable->numOfBuckets;
-}
-
-/**
- * @brief reorganizes a HashTable to be more efficient
- * @param hashTable the HashTable to be reorganized
- * @param numOfBuckets the number of buckets to rehash the HashTable to.
- * Should be prime. Ideally, the number of buckets
- * should be between 1/5 and 1 times the expected
- * number of elements in the HashTable. Values much
- * more or less than this will result in wasted memory
- * or decreased performance respectively. If 0 is
- * specified, an appropriate number of buckets is
- * automatically calculated.
- */
-void ht_rehash(struct HashTable *hashTable, long numOfBuckets) {
- KeyValuePair **newBucketArray;
- int i;
-
- if (numOfBuckets == 0)
- numOfBuckets = calculateIdealNumOfBuckets(hashTable);
-
- if (numOfBuckets == hashTable->numOfBuckets)
- return; /* already the right size! */
-
- newBucketArray = (KeyValuePair **)
- MALLOC(numOfBuckets * sizeof(KeyValuePair *));
- if (newBucketArray == NULL) {
- /* Couldn't allocate memory for the new array. This isn't a fatal
- * error; we just can't perform the rehash. */
- return;
- }
-
- for (i=0; i<numOfBuckets; i++)
- newBucketArray[i] = NULL;
-
- for (i=0; i<hashTable->numOfBuckets; i++) {
- KeyValuePair *pair = hashTable->bucketArray[i];
- while (pair != NULL) {
- KeyValuePair *nextPair = pair->next;
- long hashValue = weakHash(pair->key, pair->keylen) % numOfBuckets;
- pair->next = newBucketArray[hashValue];
- newBucketArray[hashValue] = pair;
- pair = nextPair;
- }
- }
-
- FREE(hashTable->bucketArray);
- hashTable->bucketArray = newBucketArray;
- hashTable->numOfBuckets = numOfBuckets;
-}
-
-/**
- * @brief sets the ideal element-to-bucket ratio of a HashTable
- * @param hashTable a HashTable
- * @param idealRatio the ideal element-to-bucket ratio. When a rehash
- * occurs (either manually via a call to the
- * HashTableRehash() function or automatically due the
- * the triggering of one of the thresholds below), the
- * number of buckets in the HashTable will be
- * recalculated to be a prime number that achieves (as
- * closely as possible) this ideal ratio. Must be a
- * positive number.
- * @param lowerRehashThreshold the element-to-bucket ratio that is considered
- * unacceptably low (i.e., too few elements per bucket).
- * If the actual ratio falls below this number, a
- * rehash will automatically be performed. Must be
- * lower than the value of idealRatio. If no ratio
- * is considered unacceptably low, a value of 0.0 can
- * be specified.
- * @param upperRehashThreshold the element-to-bucket ratio that is considered
- * unacceptably high (i.e., too many elements per bucket).
- * If the actual ratio rises above this number, a
- * rehash will automatically be performed. Must be
- * higher than idealRatio. However, if no ratio
- * is considered unacceptably high, a value of 0.0 can
- * be specified.
- */
-void ht_setIdealRatio(struct HashTable *hashTable,
- float idealRatio,
- float lowerRehashThreshold,
- float upperRehashThreshold) {
-
- if (idealRatio <= 0.0 || lowerRehashThreshold >= idealRatio ||
- (upperRehashThreshold != 0.0 || upperRehashThreshold <= idealRatio))
- return;
-
- hashTable->idealRatio = idealRatio;
- hashTable->lowerRehashThreshold = lowerRehashThreshold;
- hashTable->upperRehashThreshold = upperRehashThreshold;
-}
-
-
-/* end of hashtable.c */
Deleted: GNUnet/src/util/hashtabletest.c
===================================================================
--- GNUnet/src/util/hashtabletest.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/hashtabletest.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,146 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2006 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 util/hashtabletest.c
- * @brief testcase for util/hashtable.c
- * @author Nils Durner
- */
-
-#include "gnunet_util.h"
-#include "platform.h"
-
-static int testHT()
-{
- struct HashTable *ht = ht_create(10);
- void *val;
- unsigned int vallen;
-
- if (HT_PUT(ht, "Sweden", "Stockholm") != YES ||
- HT_PUT(ht, "Germany", "Berlin") != YES ||
- HT_PUT(ht, "France", "Paris") != YES ||
- HT_PUT(ht, "Spain", "Madrid") != YES ||
- HT_PUT(ht, "Italy", "Rome") != YES ||
- HT_PUT(ht, "USA", "Washington") != YES)
- {
- puts("ht_put failed\n");
- return 1;
- }
-
- if (HT_CONTAINS_KEY(ht, "France") != YES ||
- HT_CONTAINS_KEY(ht, "Iceland") != NO)
- {
- puts("ht_contains_key failed!\n");
- return 1;
- }
-
- if (HT_CONTAINS_VALUE(ht, "Paris") != YES ||
- HT_CONTAINS_VALUE(ht, "London") != NO)
- {
- puts("ht_contains_value failed!\n");
- return 1;
- }
-
- if (HT_GET(ht, "USA", &val, &vallen) != YES)
- {
- puts("ht_get failed!\n");
- return 1;
- }
-
- if (strcmp((char *) val, "Washington") != 0)
- {
- puts("ht_get result invalid!\n");
- return 1;
- }
-
- HT_REMOVE(ht, "Spain");
- if (HT_CONTAINS_KEY(ht, "Spain") != NO)
- {
- puts("ht_remove failed!\n");
- return 1;
- }
-
- if (ht_size(ht) != 5)
- {
- puts("ht_size failed!\n");
- return 1;
- }
-
- ht_removeAll(ht);
- if (ht_size(ht) != 0)
- {
- puts("ht_size#2 failed!\n");
- return 1;
- }
-
- ht_destroy(ht);
-
- return 0;
-}
-
-
-/**
- * Perform option parsing from the command line.
- */
-static int parseCommandLine(int argc,
- char * argv[]) {
- char c;
-
- while (1) {
- int option_index = 0;
- static struct GNoption long_options[] = {
- { "loglevel",1, 0, 'L' },
- { "config", 1, 0, 'c' },
- { 0,0,0,0 }
- };
-
- c = GNgetopt_long(argc,
- argv,
- "c:L:",
- long_options,
- &option_index);
-
- if (c == -1)
- break; /* No more flags to process */
-
- switch(c) {
- case 'L':
- FREENONNULL(setConfigurationString("GNUNET",
- "LOGLEVEL",
- GNoptarg));
- break;
- case 'c':
- FREENONNULL(setConfigurationString("FILES",
- "gnunet.conf",
- GNoptarg));
- break;
- } /* end of parsing commandline */
- }
- return OK;
-}
-
-int main(int argc, char * argv[]){
- int ret = 0;
-
- initUtil(argc, argv, &parseCommandLine);
- ret = testHT();
- doneUtil();
-
- return ret;
-}
Deleted: GNUnet/src/util/hashtest.c
===================================================================
--- GNUnet/src/util/hashtest.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/hashtest.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,51 +0,0 @@
-/**
- * @file test/hashtest.c
- * @brief testcase for util/hashing.c
- */
-
-#include "gnunet_util.h"
-#include "platform.h"
-
-/**
- * Perform option parsing from the command line.
- */
-static int parseCommandLine(int argc,
- char * argv[]) {
- return OK;
-}
-
-int main(int argc, char * argv[]){
- HashCode512 hc;
-
- initUtil(argc, argv, &parseCommandLine);
- hash("TEST", 4, &hc);
- if ( (hc.bits[0] != ntohl(2080019878)) ||
- (hc.bits[1] != ntohl(-2003678137)) ||
- (hc.bits[2] != ntohl(-942529663)) ||
- (hc.bits[3] != ntohl(-234043098)) ||
- (hc.bits[4] != ntohl(-182141268)) ) {
- printf("Hash of TEST wrong (%d, %d, %d, %d, %d).\n",
- ntohl(hc.bits[0]),
- ntohl(hc.bits[1]),
- ntohl(hc.bits[2]),
- ntohl(hc.bits[3]),
- ntohl(hc.bits[4]));
- return -1;
- }
- hash(NULL, 0, &hc);
- if ( (hc.bits[0] != ntohl(-813440715)) ||
- (hc.bits[1] != ntohl(2129639613)) ||
- (hc.bits[2] != ntohl(-246142896)) ||
- (hc.bits[3] != ntohl(-697466873)) ||
- (hc.bits[4] != ntohl(-702487547)) ) {
- printf("Hash of nothing (0-size) wrong (%d, %d, %d, %d, %d).\n",
- ntohl(hc.bits[0]),
- ntohl(hc.bits[1]),
- ntohl(hc.bits[2]),
- ntohl(hc.bits[3]),
- ntohl(hc.bits[4]));
- return -1;
- }
- doneUtil();
- return 0;
-}
Deleted: GNUnet/src/util/hostkey_gcrypt.c
===================================================================
--- GNUnet/src/util/hostkey_gcrypt.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/hostkey_gcrypt.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,949 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2001, 2002, 2003, 2004, 2005 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 util/hostkey_gcrypt.c
- * @brief public key cryptography (RSA) with libgcrypt
- * @author Christian Grothoff
- *
- * Note that the code locks often needlessly on the gcrypt-locking api.
- * One would think that simple MPI operations should not require locking
- * (since only global operations on the random pool must be locked,
- * strictly speaking). But libgcrypt does sometimes require locking in
- * unexpected places, so the safe solution is to always lock even if it
- * is not required. The performance impact is minimal anyway.
- */
-
-#include "gnunet_util.h"
-#include "platform.h"
-#include "locking_gcrypt.h"
-
-#include <gcrypt.h>
-
-/**
- * The private information of an RSA key pair.
- */
-struct PrivateKey {
- gcry_sexp_t sexp;
-};
-
-#define HOSTKEY_LEN 2048
-
-#define EXTRA_CHECKS ALLOW_EXTRA_CHECKS
-
-
-/**
- * Log an error message at log-level 'level' that indicates
- * a failure of the command 'cmd' with the message given
- * by gcry_strerror(rc).
- */
-#define LOG_GCRY(level, cmd, rc) do { LOG(level, _("`%s' failed at %s:%d with
error: %s\n"), cmd, __FILE__, __LINE__, gcry_strerror(rc)); } while(0);
-
-/**
- * Die with an error message that indicates
- * a failure of the command 'cmd' with the message given
- * by gcry_strerror(rc).
- */
-#define DIE_GCRY(cmd, rc) do { errexit(_("`%s' failed at %s:%d with error:
%s\n"), cmd, __FILE__, __LINE__, gcry_strerror(rc)); } while(0);
-
-
-
-/**
- * If target != size, move target bytes to the
- * end of the size-sized buffer and zero out the
- * first target-size bytes.
- */
-static void adjust(unsigned char * buf,
- size_t size,
- size_t target) {
- if (size < target) {
- memmove(&buf[target-size],
- buf,
- size);
- memset(buf,
- 0,
- target-size);
- }
-}
-
-/**
- * This HostKey implementation uses RSA.
- */
-struct PrivateKey * makePrivateKey() {
- struct PrivateKey * ret;
- gcry_sexp_t s_key;
- gcry_sexp_t s_keyparam;
- int rc;
-
- lockGcrypt();
- rc = gcry_sexp_build(&s_keyparam,
- NULL,
- "(genkey(rsa(nbits %d)(rsa-use-e 3:257)))",
- HOSTKEY_LEN);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_sexp_build", rc);
- unlockGcrypt();
- return NULL;
- }
- rc = gcry_pk_genkey(&s_key,
- s_keyparam);
- gcry_sexp_release(s_keyparam);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_pk_genkey", rc);
- unlockGcrypt();
- return NULL;
- }
-
-#if EXTRA_CHECKS
- if ((rc=gcry_pk_testkey(s_key))) {
- LOG_GCRY(LOG_ERROR, "gcry_pk_testkey", rc);
- unlockGcrypt();
- return NULL;
- }
-#endif
- unlockGcrypt();
- ret = MALLOC(sizeof(struct PrivateKey));
- ret->sexp = s_key;
- return ret;
-}
-
-/**
- * Free memory occupied by hostkey
- */
-void freePrivateKey(struct PrivateKey * hostkey) {
- lockGcrypt();
- gcry_sexp_release(hostkey->sexp);
- unlockGcrypt();
- FREE(hostkey);
-}
-
-static int key_from_sexp( gcry_mpi_t *array,
- gcry_sexp_t sexp,
- const char *topname,
- const char *elems ) {
- gcry_sexp_t list, l2;
- const char *s;
- int i, idx;
-
- lockGcrypt();
- list = gcry_sexp_find_token( sexp, topname, 0 );
- if( !list ) {
- unlockGcrypt();
- return 1;
- }
- l2 = gcry_sexp_cadr( list );
- gcry_sexp_release ( list );
- list = l2;
- if( !list ) {
- unlockGcrypt();
- return 2;
- }
-
- idx = 0;
- for(s=elems; *s; s++, idx++ ) {
- l2 = gcry_sexp_find_token( list, s, 1 );
- if( !l2 ) {
- for(i=0; i<idx; i++) {
- gcry_free( array[i] );
- array[i] = NULL;
- }
- gcry_sexp_release ( list );
- unlockGcrypt();
- return 3; /* required parameter not found */
- }
- array[idx] = gcry_sexp_nth_mpi( l2, 1, GCRYMPI_FMT_USG );
- gcry_sexp_release ( l2 );
- if( !array[idx] ) {
- for(i=0; i<idx; i++) {
- gcry_free( array[i] );
- array[i] = NULL;
- }
- gcry_sexp_release ( list );
- unlockGcrypt();
- return 4; /* required parameter is invalid */
- }
- }
- gcry_sexp_release ( list );
- unlockGcrypt();
- return 0;
-}
-
-/**
- * Extract the public key of the host.
- * @param hostkey the hostkey to extract into the result.
- * @param result where to write the result.
- */
-void getPublicKey(const struct PrivateKey * hostkey,
- PublicKey * result) {
- gcry_mpi_t skey[2];
- size_t size;
- int rc;
-
- lockGcrypt();
- rc = key_from_sexp(skey,
- hostkey->sexp,
- "public-key",
- "ne");
- if (rc)
- rc = key_from_sexp(skey,
- hostkey->sexp,
- "private-key",
- "ne");
- if (rc)
- rc = key_from_sexp(skey,
- hostkey->sexp,
- "rsa",
- "ne");
- if (rc)
- DIE_GCRY("key_from_sexp", rc);
-
- result->len = htons(sizeof(PublicKey) - sizeof(result->padding));
- result->sizen = htons(RSA_ENC_LEN);
- result->padding = 0;
- size = RSA_ENC_LEN;
- rc = gcry_mpi_print(GCRYMPI_FMT_USG,
- &result->key[0],
- size,
- &size,
- skey[0]);
- if (rc)
- DIE_GCRY("gcry_mpi_print", rc);
- adjust(&result->key[0], size, RSA_ENC_LEN);
- size = RSA_KEY_LEN - RSA_ENC_LEN;
- rc = gcry_mpi_print(GCRYMPI_FMT_USG,
- &result->key[RSA_ENC_LEN],
- size,
- &size,
- skey[1]);
- if (rc)
- DIE_GCRY("gcry_mpi_print", rc);
- adjust(&result->key[RSA_ENC_LEN],
- size,
- RSA_KEY_LEN - RSA_ENC_LEN);
- gcry_mpi_release(skey[0]);
- gcry_mpi_release(skey[1]);
- unlockGcrypt();
-}
-
-
-/**
- * Internal: publicKey => RSA-Key.
- *
- * Note that the return type is not actually a private
- * key but rather an sexpression for the public key!
- */
-static struct PrivateKey * public2PrivateKey(const PublicKey * publicKey) {
- struct PrivateKey * ret;
- gcry_sexp_t result;
- gcry_mpi_t n;
- gcry_mpi_t e;
- size_t size;
- size_t erroff;
- int rc;
-
- if ( ( ntohs(publicKey->sizen) != RSA_ENC_LEN ) ||
- ( ntohs(publicKey->len) != sizeof(PublicKey) -
sizeof(publicKey->padding)) ) {
- BREAK();
- return NULL;
- }
- size = RSA_ENC_LEN;
- lockGcrypt();
- rc = gcry_mpi_scan(&n,
- GCRYMPI_FMT_USG,
- &publicKey->key[0],
- size,
- &size);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_mpi_scan", rc);
- unlockGcrypt();
- return NULL;
- }
- size = RSA_KEY_LEN - RSA_ENC_LEN;
- rc = gcry_mpi_scan(&e,
- GCRYMPI_FMT_USG,
- &publicKey->key[RSA_ENC_LEN],
- size,
- &size);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_mpi_scan", rc);
- gcry_mpi_release(n);
- unlockGcrypt();
- return NULL;
- }
- rc = gcry_sexp_build(&result,
- &erroff,
- "(public-key(rsa(n %m)(e %m)))",
- n,
- e);
- gcry_mpi_release(n);
- gcry_mpi_release(e);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_sexp_build", rc); /* erroff gives more info */
- unlockGcrypt();
- return NULL;
- }
- unlockGcrypt();
- ret = MALLOC(sizeof(struct PrivateKey));
- ret->sexp = result;
- return ret;
-}
-
-/**
- * Encode the private key in a format suitable for
- * storing it into a file.
- * @returns encoding of the private key.
- * The first 4 bytes give the size of the array, as usual.
- */
-PrivateKeyEncoded * encodePrivateKey(const struct PrivateKey * hostkey) {
- /* libgcrypt */
-
- PrivateKeyEncoded * retval;
- gcry_mpi_t pkv[6];
- void * pbu[6];
- size_t sizes[6];
- int rc;
- int i;
- int size;
-
- lockGcrypt();
-#if EXTRA_CHECKS
- if (gcry_pk_testkey(hostkey->sexp)) {
- BREAK();
- unlockGcrypt();
- return NULL;
- }
-#endif
-
- memset(pkv, 0, sizeof(gcry_mpi_t) * 6);
- rc = key_from_sexp(pkv,
- hostkey->sexp,
- "private-key",
- "nedpqu");
- if (rc)
- rc = key_from_sexp(pkv,
- hostkey->sexp,
- "rsa",
- "nedpqu");
- if (rc)
- rc = key_from_sexp(pkv,
- hostkey->sexp,
- "private-key",
- "nedpq");
- if (rc)
- rc = key_from_sexp(pkv,
- hostkey->sexp,
- "rsa",
- "nedpq");
- if (rc)
- rc = key_from_sexp(pkv,
- hostkey->sexp,
- "private-key",
- "ned");
- if (rc)
- rc = key_from_sexp(pkv,
- hostkey->sexp,
- "rsa",
- "ned");
- if (rc) {
- LOG_GCRY(LOG_ERROR, "key_from_sexp", rc);
- unlockGcrypt();
- return NULL;
- }
- size = sizeof(PrivateKeyEncoded);
- for (i=0;i<6;i++) {
- if (pkv[i] != NULL) {
- rc = gcry_mpi_aprint(GCRYMPI_FMT_USG,
- (unsigned char**) &pbu[i],
- &sizes[i],
- pkv[i]);
- size += sizes[i];
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_mpi_aprint", rc);
- while (i>0)
- if (pbu[i] != NULL)
- free(pbu[--i]);
- for (i=0;i<6;i++)
- if (pkv[i] != NULL)
- gcry_mpi_release(pkv[i]);
- unlockGcrypt();
- return NULL;
- }
- } else {
- pbu[i] = NULL;
- sizes[i] = 0;
- }
- }
- GNUNET_ASSERT(size < 65536);
- retval = MALLOC(size);
- retval->len = htons(size);
- i = 0;
- retval->sizen = htons(sizes[0]);
- memcpy(&((char*)(&retval[1]))[i],
- pbu[0],
- sizes[0]);
- i += sizes[0];
- retval->sizee = htons(sizes[1]);
- memcpy(&((char*)(&retval[1]))[i],
- pbu[1],
- sizes[1]);
- i += sizes[1];
- retval->sized = htons(sizes[2]);
- memcpy(&((char*)(&retval[1]))[i],
- pbu[2],
- sizes[2]);
- i += sizes[2];
- /* swap p and q! */
- retval->sizep = htons(sizes[4]);
- memcpy(&((char*)(&retval[1]))[i],
- pbu[4],
- sizes[4]);
- i += sizes[4];
- retval->sizeq = htons(sizes[3]);
- memcpy(&((char*)(&retval[1]))[i],
- pbu[3],
- sizes[3]);
- i += sizes[3];
- retval->sizedmp1 = htons(0);
- retval->sizedmq1 = htons(0);
- memcpy(&((char*)(&retval[1]))[i],
- pbu[5],
- sizes[5]);
- for (i=0;i<6;i++) {
- if (pkv[i] != NULL)
- gcry_mpi_release(pkv[i]);
- if (pbu[i] != NULL)
- free(pbu[i]);
- }
- unlockGcrypt();
- return retval;
-}
-
-/**
- * Decode the private key from the file-format back
- * to the "normal", internal format.
- */
-struct PrivateKey * decodePrivateKey(const PrivateKeyEncoded * encoding) {
- struct PrivateKey * ret;
- gcry_sexp_t res;
- gcry_mpi_t n,e,d,p,q,u;
- int rc;
- size_t size;
- int pos;
-
- pos = 0;
- size = ntohs(encoding->sizen);
- lockGcrypt();
- rc = gcry_mpi_scan(&n,
- GCRYMPI_FMT_USG,
- &((const unsigned char*)(&encoding[1]))[pos],
- size,
- &size);
- pos += ntohs(encoding->sizen);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_mpi_scan", rc);
- unlockGcrypt();
- return NULL;
- }
- size = ntohs(encoding->sizee);
- rc = gcry_mpi_scan(&e,
- GCRYMPI_FMT_USG,
- &((const unsigned char*)(&encoding[1]))[pos],
- size,
- &size);
- pos += ntohs(encoding->sizee);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_mpi_scan", rc);
- gcry_mpi_release(n);
- unlockGcrypt();
- return NULL;
- }
- size = ntohs(encoding->sized);
- rc = gcry_mpi_scan(&d,
- GCRYMPI_FMT_USG,
- &((const unsigned char*)(&encoding[1]))[pos],
- size,
- &size);
- pos += ntohs(encoding->sized);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_mpi_scan", rc);
- gcry_mpi_release(n);
- gcry_mpi_release(e);
- unlockGcrypt();
- return NULL;
- }
- /* swap p and q! */
- size = ntohs(encoding->sizep);
- if (size > 0) {
- rc = gcry_mpi_scan(&q,
- GCRYMPI_FMT_USG,
- &((const unsigned char*)(&encoding[1]))[pos],
- size,
- &size);
- pos += ntohs(encoding->sizep);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_mpi_scan", rc);
- gcry_mpi_release(n);
- gcry_mpi_release(e);
- gcry_mpi_release(d);
- unlockGcrypt();
- return NULL;
- }
- } else
- q = NULL;
- size = ntohs(encoding->sizeq);
- if (size > 0) {
- rc = gcry_mpi_scan(&p,
- GCRYMPI_FMT_USG,
- &((const unsigned char*)(&encoding[1]))[pos],
- size,
- &size);
- pos += ntohs(encoding->sizeq);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_mpi_scan", rc);
- gcry_mpi_release(n);
- gcry_mpi_release(e);
- gcry_mpi_release(d);
- if (q != NULL)
- gcry_mpi_release(q);
- unlockGcrypt();
- return NULL;
- }
- } else
- p = NULL;
- pos += ntohs(encoding->sizedmp1);
- pos += ntohs(encoding->sizedmq1);
-
- size = ntohs(encoding->len) - sizeof(PrivateKeyEncoded) - pos;
- if (size > 0) {
- rc = gcry_mpi_scan(&u,
- GCRYMPI_FMT_USG,
- &((const unsigned char*)(&encoding[1]))[pos],
- size,
- &size);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_mpi_scan", rc);
- gcry_mpi_release(n);
- gcry_mpi_release(e);
- gcry_mpi_release(d);
- if (p != NULL)
- gcry_mpi_release(p);
- if (q != NULL)
- gcry_mpi_release(q);
- unlockGcrypt();
- return NULL;
- }
- } else
- u = NULL;
-
- if ( (p != NULL) &&
- (q != NULL) &&
- (u != NULL) ) {
- rc = gcry_sexp_build(&res,
- &size, /* erroff */
- "(private-key(rsa(n %m)(e %m)(d %m)(p %m)(q %m)(u
%m)))",
- n, e, d, p, q, u);
- } else {
- if ( (p != NULL) &&
- (q != NULL) ) {
- rc = gcry_sexp_build(&res,
- &size, /* erroff */
- "(private-key(rsa(n %m)(e %m)(d %m)(p %m)(q %m)))",
- n, e, d, p, q);
- } else {
- rc = gcry_sexp_build(&res,
- &size, /* erroff */
- "(private-key(rsa(n %m)(e %m)(d %m)))",
- n, e, d);
- }
- }
- gcry_mpi_release(n);
- gcry_mpi_release(e);
- gcry_mpi_release(d);
- if (p != NULL)
- gcry_mpi_release(p);
- if (q != NULL)
- gcry_mpi_release(q);
- if (u != NULL)
- gcry_mpi_release(u);
-
- if (rc)
- LOG_GCRY(LOG_ERROR, "gcry_sexp_build", rc);
-#if EXTRA_CHECKS
- if (gcry_pk_testkey(res)) {
- LOG_GCRY(LOG_ERROR, "gcry_pk_testkey", rc);
- unlockGcrypt();
- return NULL;
- }
-#endif
- ret = MALLOC(sizeof(struct PrivateKey));
- ret->sexp = res;
- unlockGcrypt();
- return ret;
-}
-
-/**
- * Encrypt a block with the public key of another host that uses the
- * same cyper.
- *
- * @param block the block to encrypt
- * @param size the size of block
- * @param publicKey the encoded public key used to encrypt
- * @param target where to store the encrypted block
- * @returns SYSERR on error, OK if ok
- */
-int encryptPrivateKey(const void * block,
- unsigned short size,
- const PublicKey * publicKey,
- RSAEncryptedData * target) {
- gcry_sexp_t result;
- gcry_sexp_t data;
- struct PrivateKey * pubkey;
- gcry_mpi_t val;
- gcry_mpi_t rval;
- size_t isize;
- size_t erroff;
- int rc;
-
- GNUNET_ASSERT(size <= sizeof(HashCode512));
- pubkey = public2PrivateKey(publicKey);
- isize = size;
- lockGcrypt();
- rc = gcry_mpi_scan(&val,
- GCRYMPI_FMT_USG,
- block,
- isize,
- &isize);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_mpi_scan", rc);
- freePrivateKey(pubkey);
- unlockGcrypt();
- return SYSERR;
- }
- rc = gcry_sexp_build(&data,
- &erroff,
- "(data (flags pkcs1)(value %m))",
- val);
- gcry_mpi_release(val);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_sexp_build", rc); /* more info in erroff */
- freePrivateKey(pubkey);
- unlockGcrypt();
- return SYSERR;
- }
-
- rc = gcry_pk_encrypt(&result, data, pubkey->sexp);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_pk_encrypt", rc);
- gcry_sexp_release(data);
- freePrivateKey(pubkey);
- unlockGcrypt();
- return SYSERR;
- }
- gcry_sexp_release(data);
- freePrivateKey(pubkey);
-
- rc = key_from_sexp(&rval,
- result,
- "rsa",
- "a");
- gcry_sexp_release(result);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "key_from_sexp", rc);
- unlockGcrypt();
- return SYSERR;
- }
- isize = sizeof(RSAEncryptedData);
- rc = gcry_mpi_print(GCRYMPI_FMT_USG,
- (unsigned char*)target,
- isize,
- &isize,
- rval);
- gcry_mpi_release(rval);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_mpi_print", rc);
- unlockGcrypt();
- return SYSERR;
- }
- adjust(&target->encoding[0],
- isize,
- sizeof(RSAEncryptedData));
- unlockGcrypt();
- return OK;
-}
-
-/**
- * Decrypt a given block with the hostkey.
- *
- * @param hostkey the hostkey with which to decrypt this block
- * @param block the data to decrypt, encoded as returned by encrypt
- * @param result pointer to a location where the result can be stored
- * @param max the maximum number of bits to store for the result, if
- * the decrypted block is bigger, an error is returned
- * @returns the size of the decrypted block, -1 on error
- */
-int decryptPrivateKey(const struct PrivateKey * hostkey,
- const RSAEncryptedData * block,
- void * result,
- unsigned short max) {
- gcry_sexp_t resultsexp;
- gcry_sexp_t data;
- size_t erroff;
- size_t size;
- gcry_mpi_t val;
- int rc;
- unsigned char * endp;
- unsigned char * tmp;
-
- lockGcrypt();
-#if EXTRA_CHECKS
- rc = gcry_pk_testkey(hostkey->sexp);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_pk_testkey", rc);
- unlockGcrypt();
- return -1;
- }
-#endif
- size = sizeof(RSAEncryptedData);
- rc = gcry_mpi_scan(&val,
- GCRYMPI_FMT_USG,
- &block->encoding[0],
- size,
- &size);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_mpi_scan", rc);
- unlockGcrypt();
- return SYSERR;
- }
- rc = gcry_sexp_build(&data,
- &erroff,
- "(enc-val(flags)(rsa(a %m)))",
- val);
- gcry_mpi_release(val);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_sexp_build", rc); /* more info in erroff */
- unlockGcrypt();
- return SYSERR;
- }
- rc = gcry_pk_decrypt(&resultsexp,
- data,
- hostkey->sexp);
- gcry_sexp_release(data);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_pk_decrypt", rc);
- unlockGcrypt();
- return SYSERR;
- }
-
- /* resultsexp has format "(value %m)" */
- val = gcry_sexp_nth_mpi(resultsexp, 1, GCRYMPI_FMT_USG);
- gcry_sexp_release(resultsexp);
- if (val == NULL) {
- LOG_GCRY(LOG_ERROR, "gcry_sexp_nth_mpi", rc);
- unlockGcrypt();
- return SYSERR;
- }
- tmp = MALLOC(max + HOSTKEY_LEN/8);
- size = max+HOSTKEY_LEN/8;
- rc = gcry_mpi_print(GCRYMPI_FMT_USG,
- tmp,
- size,
- &size,
- val);
- gcry_mpi_release(val);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_mpi_print", rc);
- FREE(tmp);
- unlockGcrypt();
- return SYSERR;
- }
-
- endp = tmp;
- endp += (size - max);
- size = max;
- memcpy(result,
- endp,
- size);
- FREE(tmp);
- unlockGcrypt();
- return size;
-}
-
-/**
- * Sign a given block.
- *
- * @param hostkey the hostkey with which to sign this block
- * @param size how many bytes to sign
- * @param block the data to sign
- * @param sig where to write the signature
- * @return SYSERR on error, OK on success
- */
-int sign(const struct PrivateKey * hostkey,
- unsigned short size,
- const void * block,
- Signature * sig) {
- gcry_sexp_t result;
- gcry_sexp_t data;
- size_t ssize;
- gcry_mpi_t rval;
- HashCode512 hc;
- char * buff;
- int bufSize;
- int rc;
-
- hash(block, size, &hc);
-#define FORMATSTRING
"(4:data(5:flags5:pkcs1)(4:hash6:sha51264:0123456789012345678901234567890123456789012345678901234567890123))"
- bufSize = strlen(FORMATSTRING) + 1;
- buff = MALLOC(bufSize);
- memcpy(buff,
- FORMATSTRING,
- bufSize);
- memcpy(&buff[bufSize -
strlen("0123456789012345678901234567890123456789012345678901234567890123))") -
1],
- &hc,
- sizeof(HashCode512));
- lockGcrypt();
- rc = gcry_sexp_new(&data,
- buff,
- bufSize,
- 0);
- FREE(buff);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_sexp_new", rc);
- unlockGcrypt();
- return SYSERR;
- }
- rc = gcry_pk_sign(&result, data, hostkey->sexp);
- gcry_sexp_release(data);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_pk_sign", rc);
- unlockGcrypt();
- return SYSERR;
- }
- rc = key_from_sexp(&rval,
- result,
- "rsa",
- "s");
- gcry_sexp_release(result);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "key_from_sexp", rc);
- unlockGcrypt();
- return SYSERR;
- }
- ssize = sizeof(Signature);
- rc = gcry_mpi_print(GCRYMPI_FMT_USG,
- (unsigned char*)sig,
- ssize,
- &ssize,
- rval);
- gcry_mpi_release(rval);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_mpi_print", rc);
- unlockGcrypt();
- return SYSERR;
- }
- adjust(&sig->sig[0],
- ssize,
- sizeof(Signature));
- unlockGcrypt();
- return OK;
-}
-
-/**
- * Verify signature.
- *
- * @param block the signed data
- * @param len the length of the block
- * @param sig signature
- * @param publicKey public key of the signer
- * @returns OK if ok, SYSERR if invalid
- */
-int verifySig(const void * block,
- unsigned short len,
- const Signature * sig,
- const PublicKey * publicKey) {
- gcry_sexp_t data;
- gcry_sexp_t sigdata;
- size_t size;
- gcry_mpi_t val;
- struct PrivateKey * hostkey;
- HashCode512 hc;
- char * buff;
- int bufSize;
- size_t erroff;
- int rc;
-
- size = sizeof(Signature);
- lockGcrypt();
- rc = gcry_mpi_scan(&val,
- GCRYMPI_FMT_USG,
- (const unsigned char*)sig,
- size,
- &size);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_mpi_scan", rc);
- unlockGcrypt();
- return SYSERR;
- }
- rc = gcry_sexp_build(&sigdata,
- &erroff,
- "(sig-val(rsa(s %m)))",
- val);
- gcry_mpi_release(val);
- if (rc) {
- LOG_GCRY(LOG_ERROR, "gcry_sexp_build", rc);
- unlockGcrypt();
- return SYSERR;
- }
- hash(block, len, &hc);
- bufSize = strlen(FORMATSTRING) + 1;
- buff = MALLOC(bufSize);
- memcpy(buff,
- FORMATSTRING,
- bufSize);
- memcpy(&buff[strlen(FORMATSTRING) -
-
strlen("0123456789012345678901234567890123456789012345678901234567890123))")],
- &hc,
- sizeof(HashCode512));
- rc = gcry_sexp_new(&data,
- buff,
- bufSize,
- 0);
- FREE(buff);
- hostkey = public2PrivateKey(publicKey);
- rc = gcry_pk_verify(sigdata,
- data,
- hostkey->sexp);
- freePrivateKey(hostkey);
- gcry_sexp_release(data);
- gcry_sexp_release(sigdata);
- if (rc) {
- LOG(LOG_WARNING,
- _("RSA signature verification failed at %s:%d: %s\n"),
- __FILE__, __LINE__,
- gcry_strerror(rc));
- unlockGcrypt();
- return SYSERR;
- } else {
- unlockGcrypt();
- return OK;
- }
-}
-
-
-/* end of hostkey_gcrypt.c */
Deleted: GNUnet/src/util/hostkeytest.c
===================================================================
--- GNUnet/src/util/hostkeytest.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/hostkeytest.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,253 +0,0 @@
-/**
- * @file test/hostkeytest.c
- * @brief testcase for RSA public key crypto (hostkey.h)
- * @author Christian Grothoff
- */
-
-#include "gnunet_util.h"
-#include "locking_gcrypt.h"
-#include "platform.h"
-
-#define TESTSTRING "Hello World\0"
-#define MAX_TESTVAL sizeof(SESSIONKEY)
-#define ITER 10
-
-static int testEncryptDecrypt() {
- struct PrivateKey * hostkey;
- PublicKey pkey;
- RSAEncryptedData target;
- char result[MAX_TESTVAL];
- int i;
- TIME_T start;
- int ok;
-
- fprintf(stderr, "W");
- hostkey = makePrivateKey();
- getPublicKey(hostkey, &pkey);
-
- ok = 0;
- TIME(&start);
- for (i=0;i<ITER;i++) {
- fprintf(stderr, ".");
- if (SYSERR == encryptPrivateKey(TESTSTRING,
- strlen(TESTSTRING)+1,
- &pkey,
- &target)) {
- fprintf(stderr,
- "encryptPrivateKey returned SYSERR\n");
- ok++;
- continue;
- }
- if (-1 == decryptPrivateKey(hostkey,
- &target,
- result,
- strlen(TESTSTRING)+1)) {
- fprintf(stderr,
- "decryptPrivateKey returned SYSERR\n");
- ok++;
- continue;
-
- }
- if (strncmp(TESTSTRING, result,
- strlen(TESTSTRING)) != 0) {
- printf("%s != %.*s - testEncryptDecrypt failed!\n",
- TESTSTRING,
- MAX_TESTVAL,
- result);
- ok++;
- continue;
- }
- }
- printf("%d RSA encrypt/decrypt operations %ds (%d failures)\n",
- ITER,
- (int) (TIME(NULL)-start),
- ok);
- freePrivateKey(hostkey);
- if (ok == 0)
- return OK;
- else
- return SYSERR;
-}
-
-
-static int testEncryptDecryptSK() {
- struct PrivateKey * hostkey;
- PublicKey pkey;
- RSAEncryptedData target;
- SESSIONKEY insk;
- SESSIONKEY outsk;
- int i;
- TIME_T start;
- int ok;
-
- fprintf(stderr, "W");
- hostkey = makePrivateKey();
- getPublicKey(hostkey, &pkey);
-
- ok = 0;
- TIME(&start);
- for (i=0;i<ITER;i++) {
- fprintf(stderr, ".");
- makeSessionkey(&insk);
- if (SYSERR == encryptPrivateKey(&insk,
- sizeof(SESSIONKEY),
- &pkey,
- &target)) {
- fprintf(stderr,
- "encryptPrivateKey returned SYSERR\n");
- ok++;
- continue;
- }
- if (-1 == decryptPrivateKey(hostkey,
- &target,
- &outsk,
- sizeof(SESSIONKEY))) {
- fprintf(stderr,
- "decryptPrivateKey returned SYSERR\n");
- ok++;
- continue;
- }
- if (0 != memcmp(&insk,
- &outsk,
- sizeof(SESSIONKEY))) {
- printf("testEncryptDecryptSK failed!\n");
- ok++;
- continue;
- }
- }
- printf("%d RSA encrypt/decrypt SK operations %ds (%d failures)\n",
- ITER,
- (int) (TIME(NULL)-start),
- ok);
- freePrivateKey(hostkey);
- if (ok == 0)
- return OK;
- else
- return SYSERR;
-}
-
-static int testSignVerify() {
- struct PrivateKey * hostkey;
- Signature sig;
- PublicKey pkey;
- int i;
- TIME_T start;
- int ok = OK;
-
- fprintf(stderr, "W");
- hostkey = makePrivateKey();
- getPublicKey(hostkey, &pkey);
- TIME(&start);
- for (i=0;i<ITER;i++) {
- fprintf(stderr, ".");
- if (SYSERR == sign(hostkey,
- strlen(TESTSTRING),
- TESTSTRING,
- &sig)) {
- fprintf(stderr,
- "sign returned SYSERR\n");
- ok = SYSERR;
- continue;
- }
- if (SYSERR == verifySig(TESTSTRING,
- strlen(TESTSTRING),
- &sig,
- &pkey)) {
- printf("testSignVerify failed!\n");
- ok = SYSERR;
- continue;
- }
- }
- printf("%d RSA sign/verify operations %ds\n",
- ITER,
- (int) (TIME(NULL)-start));
- freePrivateKey(hostkey);
- return ok;
-}
-
-static int testPrivateKeyEncoding() {
- struct PrivateKey * hostkey;
- PrivateKeyEncoded * encoding;
- PublicKey pkey;
- RSAEncryptedData target;
- char result[MAX_TESTVAL];
- int i;
- TIME_T start;
- int ok = OK;
-
- fprintf(stderr, "W");
- hostkey = makePrivateKey();
-
- TIME(&start);
- for (i=0;i<ITER;i++) {
- fprintf(stderr, ".");
- getPublicKey(hostkey, &pkey);
- if (SYSERR == encryptPrivateKey(TESTSTRING,
- strlen(TESTSTRING)+1,
- &pkey,
- &target)) {
- fprintf(stderr,
- "encryptPrivateKey returned SYSERR\n");
- ok = SYSERR;
- continue;
- }
- encoding = encodePrivateKey(hostkey);
- freePrivateKey(hostkey);
- if (encoding == NULL) {
- fprintf(stderr,
- "encodePrivateKey returned NULL\n");
- ok = SYSERR;
- continue;
- }
- hostkey = decodePrivateKey(encoding);
- FREE(encoding);
- if (SYSERR == decryptPrivateKey(hostkey,
- &target,
- result,
- strlen(TESTSTRING)+1)) {
- fprintf(stderr,
- "decryptPrivateKey returned SYSERR\n");
- ok = SYSERR;
- continue;
- }
- if (strncmp(TESTSTRING, result,
- strlen(TESTSTRING)) != 0) {
- printf("%s != %.*s - testEncryptDecrypt failed!\n",
- TESTSTRING,
- (int) strlen(TESTSTRING),
- result);
- ok = SYSERR;
- continue;
- }
- }
- freePrivateKey(hostkey);
- printf("%d RSA encrypt/encode/decode/decrypt operations %ds\n",
- ITER,
- (int) (TIME(NULL)-start));
- return ok;
-}
-
-void initRAND(); /* hostkey_* */
-
-int main(int argc, char * argv[]) {
- int failureCount = 0;
-
- initLockingGcrypt();
- initRAND();
- if (OK != testEncryptDecryptSK())
- failureCount++;
- if (OK != testEncryptDecrypt())
- failureCount++;
- if (OK != testSignVerify())
- failureCount++;
- if (OK != testPrivateKeyEncoding())
- failureCount++;
- doneLockingGcrypt();
-
- if (failureCount == 0)
- return 0;
- else {
- printf("\n\n%d TESTS FAILED!\n\n",failureCount);
- return -1;
- }
-} /* end of main*/
Deleted: GNUnet/src/util/identitytest.c
===================================================================
--- GNUnet/src/util/identitytest.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/identitytest.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,71 +0,0 @@
-/**
- * @file test/identitytest.c
- * @brief testcase for util/identity.c
- */
-
-#include "gnunet_util.h"
-
-int initAddress(); /* in identity.c */
-
-static int check() {
- if (initAddress() != OK)
- return 1;
- else
- return 0;
-}
-
-/**
- * Perform option parsing from the command line.
- */
-static int parseCommandLine(int argc,
- char * argv[]) {
- char c;
-
- while (1) {
- int option_index = 0;
- static struct GNoption long_options[] = {
- { "config", 1, 0, 'c' },
- { 0,0,0,0 }
- };
-
- c = GNgetopt_long(argc,
- argv,
- "c:",
- long_options,
- &option_index);
-
- if (c == -1)
- break; /* No more flags to process */
-
- switch(c) {
- case 'c':
- FREENONNULL(setConfigurationString("FILES",
- "gnunet.conf",
- GNoptarg));
- break;
- } /* end of parsing commandline */
- }
- FREENONNULL(setConfigurationString("GNUNETD",
- "LOGFILE",
- NULL));
- FREENONNULL(setConfigurationString("GNUNETD",
- "LOGLEVEL",
- "WARNING"));
- return OK;
-}
-
-int main(int argc,
- char * argv[]){
- int ret;
- initUtil(argc, argv, &parseCommandLine);
-
- ret = check();
- if (ret != 0)
- fprintf(stderr,
- "ERROR %d. Did you configure GNUnet properly?\n",
- ret);
- doneUtil();
- return ret;
-}
-
-/* end of identitytest.c */
Modified: GNUnet/src/util/initialize.c
===================================================================
--- GNUnet/src/util/initialize.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/initialize.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -26,32 +26,7 @@
#include "platform.h"
#include "gnunet_util.h"
-#include "locking_gcrypt.h"
-/* internal prototypes... */
-void initKBlockKey();
-
-void doneKBlockKey();
-
-/**
- * Initialize Random number generator.
- */
-void initRAND();
-
-/**
- * This method must be called first. Typically,
- * the command line is parsed after that and then
- * "readConfiguration" is invoked.
- */
-void initConfiguration();
-
-/**
- * This method may be called at last to clean up.
- * Afterwards everything but initConfiguration will result
- * in errors...
- */
-void doneConfiguration();
-
void initState();
/**
@@ -60,16 +35,6 @@
void doneState();
/**
- * initialize logging module.
- */
-void initLogging();
-
-/**
- * Shutdown the logging module.
- */
-void doneLogging();
-
-/**
* The following method is called in order to initialize the status
* calls routines. After that it is safe to call each of the status
* calls separately
@@ -194,9 +159,6 @@
textdomain("GNUnet");
#endif
gnunet_util_initIO();
- initLockingGcrypt();
- initRAND();
- initKBlockKey();
initConfiguration();
if (argc > 0)
setConfigurationString("MAIN",
@@ -227,13 +189,9 @@
doneState();
LOG(LOG_MESSAGE,
_("Shutdown complete.\n"));
- doneLogging();
- doneConfiguration();
#ifdef MINGW
ShutdownWinEnv();
#endif
- doneKBlockKey();
- doneLockingGcrypt();
gnunet_util_doneIO();
}
Deleted: GNUnet/src/util/kblockkey.c
===================================================================
--- GNUnet/src/util/kblockkey.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/kblockkey.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,571 +0,0 @@
-/*
- This file is part of GNUnet.
- Copyright (C) 1994, 1996, 1998, 2001, 2002, 2003 Free Software
Foundation, Inc.
- Copyright (C) 2004, 2005 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.
-
- Note: This code is based on code from libgcrypt
- The code was adapted for GNUnet to support RSA-key generation
- based on weak, pseudo-random keys. Do NOT use to generate
- ordinary RSA keys!
-*/
-
-
-/**
- * @file util/kblockkey.c
- * @brief implementation of RSA-Key generation for KBlocks
- * (do NOT use for pseudonyms or hostkeys!)
- * @author Christian Grothoff
- */
-
-#include "platform.h"
-#include "gnunet_util.h"
-#include <gmp.h>
-
-typedef struct {
- mpz_t n; /* public modulus */
- mpz_t e; /* public exponent */
- mpz_t d; /* exponent */
- mpz_t p; /* prime p. */
- mpz_t q; /* prime q. */
- mpz_t u; /* inverse of p mod q. */
-} KBlock_secret_key;
-
-/* Note: 2 is not included because it can be tested more easily by
- looking at bit 0. The last entry in this list is marked by a zero */
-static unsigned short small_prime_numbers[] = {
- 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43,
- 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101,
- 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,
- 157, 163, 167, 173, 179, 181, 191, 193, 197, 199,
- 211, 223, 227, 229, 233, 239, 241, 251, 257, 263,
- 269, 271, 277, 281, 283, 293, 307, 311, 313, 317,
- 331, 337, 347, 349, 353, 359, 367, 373, 379, 383,
- 389, 397, 401, 409, 419, 421, 431, 433, 439, 443,
- 449, 457, 461, 463, 467, 479, 487, 491, 499, 503,
- 509, 521, 523, 541, 547, 557, 563, 569, 571, 577,
- 587, 593, 599, 601, 607, 613, 617, 619, 631, 641,
- 643, 647, 653, 659, 661, 673, 677, 683, 691, 701,
- 709, 719, 727, 733, 739, 743, 751, 757, 761, 769,
- 773, 787, 797, 809, 811, 821, 823, 827, 829, 839,
- 853, 857, 859, 863, 877, 881, 883, 887, 907, 911,
- 919, 929, 937, 941, 947, 953, 967, 971, 977, 983,
- 991, 997, 1009, 1013, 1019, 1021, 1031, 1033,
- 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091,
- 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151,
- 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213,
- 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277,
- 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307,
- 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399,
- 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451,
- 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493,
- 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559,
- 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609,
- 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667,
- 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733,
- 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789,
- 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871,
- 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931,
- 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997,
- 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053,
- 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111,
- 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161,
- 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243,
- 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297,
- 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357,
- 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411,
- 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473,
- 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551,
- 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633,
- 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687,
- 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729,
- 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791,
- 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851,
- 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917,
- 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999,
- 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061,
- 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137,
- 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209,
- 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271,
- 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331,
- 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391,
- 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467,
- 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533,
- 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583,
- 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643,
- 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709,
- 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779,
- 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851,
- 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917,
- 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989,
- 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049,
- 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111,
- 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177,
- 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243,
- 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297,
- 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391,
- 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457,
- 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519,
- 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597,
- 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657,
- 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729,
- 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799,
- 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889,
- 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951,
- 4957, 4967, 4969, 4973, 4987, 4993, 4999,
- 0
-};
-
-#define DIM(v) (sizeof(v)/sizeof((v)[0]))
-static int no_of_small_prime_numbers = DIM(small_prime_numbers) - 1;
-
-
-static unsigned int get_nbits(mpz_t a) {
- return mpz_sizeinbase(a, 2);
-}
-
-/**
- * Count the number of zerobits at the low end of A
- */
-static unsigned int get_trailing_zeros(mpz_t a) {
- unsigned int count = 0;
- unsigned int nbits = get_nbits(a);
-
- while ( (mpz_tstbit(a, count)) && (count < nbits) )
- count++;
- return count;
-}
-
-/**
- * Set bit N of A. and clear all bits above
- */
-static void set_highbit(mpz_t a,
- unsigned int n) {
- unsigned int nbits;
-
- nbits = get_nbits(a);
- while (nbits > n)
- mpz_clrbit(a, nbits--);
- mpz_setbit(a, n);
-}
-
-static void mpz_randomize(mpz_t n,
- unsigned int nbits,
- HashCode512 * rnd) {
- HashCode512 * tmp;
- int cnt;
- int i;
-
- cnt = (nbits / sizeof(HashCode512) / 8) + 1;
- tmp = MALLOC(sizeof(HashCode512) * cnt);
-
- tmp[0] = *rnd;
- for (i=0;i<cnt-1;i++) {
- hash(&tmp[i],
- sizeof(HashCode512),
- &tmp[i+1]);
- }
- *rnd = tmp[cnt-1];
- /*
- printf("RND: ");
- for (i=0;i<cnt * sizeof(HashCode512);i++)
- printf("%02x", ((unsigned char*) tmp)[i]);
- printf("\n");
- */
-
- mpz_import(n, cnt * sizeof(HashCode512) / sizeof(unsigned int),
- 1, sizeof(unsigned int), 1, 0, tmp);
- FREE(tmp);
- i = get_nbits(n);
- while (i > nbits)
- mpz_clrbit(n, i--);
-}
-
-/**
- * Return true if n is probably a prime
- */
-static int is_prime (mpz_t n,
- int steps,
- HashCode512 * hc) {
- mpz_t x;
- mpz_t y;
- mpz_t z;
- mpz_t nminus1;
- mpz_t a2;
- mpz_t q;
- unsigned int i, j, k;
- int rc = 0;
- unsigned int nbits;
-
- mpz_init(x);
- mpz_init(y);
- mpz_init(z);
- mpz_init(nminus1);
- mpz_init_set_ui(a2, 2);
- nbits = get_nbits( n );
- mpz_sub_ui(nminus1, n, 1 );
-
- /* Find q and k, so that n = 1 + 2^k * q . */
- mpz_init_set(q, nminus1);
- k = get_trailing_zeros(q);
- mpz_tdiv_q_2exp(q, q, k);
-
- for (i=0 ; i < steps; i++ ) {
- if( !i ) {
- mpz_set_ui( x, 2 );
- } else {
- mpz_randomize( x, nbits, hc );
-
- /* Make sure that the number is smaller than the prime and
- keep the randomness of the high bit. */
- if (mpz_tstbit(x, nbits-2) ) {
- set_highbit(x, nbits-2); /* Clear all higher bits. */
- } else {
- set_highbit(x, nbits-2 );
- mpz_clrbit( x, nbits-2 );
- }
- GNUNET_ASSERT( mpz_cmp( x, nminus1 ) < 0 && mpz_cmp_ui( x, 1 ) > 0 );
- }
- mpz_powm ( y, x, q, n);
- if ( mpz_cmp_ui(y, 1) && mpz_cmp( y, nminus1 ) ) {
- for ( j=1; j < k && mpz_cmp( y, nminus1 ); j++ ) {
- mpz_powm(y, y, a2, n);
- if( !mpz_cmp_ui( y, 1 ) )
- goto leave; /* Not a prime. */
- }
- if (mpz_cmp( y, nminus1 ) )
- goto leave; /* Not a prime. */
- }
- }
- rc = 1; /* May be a prime. */
-
- leave:
- mpz_clear( x );
- mpz_clear( y );
- mpz_clear( z );
- mpz_clear( nminus1 );
- mpz_clear( q );
- mpz_clear( a2 );
-
- return rc;
-}
-
-static void gen_prime(mpz_t ptest,
- unsigned int nbits,
- HashCode512 * hc) {
- mpz_t prime, pminus1, val_2, val_3, result;
- int i;
- unsigned x, step;
- int *mods;
- mpz_t tmp;
-
- GNUNET_ASSERT(nbits >= 16);
-
- mods = MALLOC(no_of_small_prime_numbers * sizeof(*mods));
- /* Make nbits fit into mpz_t implementation. */
- mpz_init_set_ui(val_2, 2);
- mpz_init_set_ui(val_3, 3);
- mpz_init(prime);
- mpz_init(result);
- mpz_init(pminus1);
- mpz_init(ptest);
- while (1) {
- /* generate a random number */
- mpz_randomize( prime, nbits, hc );
- /* Set high order bit to 1, set low order bit to 1. If we are
- generating a secret prime we are most probably doing that
- for RSA, to make sure that the modulus does have the
- requested key size we set the 2 high order bits. */
- set_highbit (prime, nbits-1);
- mpz_setbit(prime, nbits-2);
- mpz_setbit(prime, 0);
-
- /* Calculate all remainders. */
- mpz_init(tmp);
- for (i=0; (x = small_prime_numbers[i]); i++ )
- mods[i] = mpz_fdiv_r_ui(tmp, prime, x);
- mpz_clear(tmp);
- /* Now try some primes starting with prime. */
- for (step=0; step < 20000; step += 2 ) {
- /* Check against all the small primes we have in mods. */
- for (i=0; (x = small_prime_numbers[i]); i++ ) {
- while ( mods[i] + step >= x )
- mods[i] -= x;
- if ( !(mods[i] + step) )
- break;
- }
- if (x)
- continue; /* Found a multiple of an already known prime. */
-
- mpz_add_ui( ptest, prime, step );
- if (! mpz_tstbit( ptest, nbits-2 ))
- break;
-
- /* Do a fast Fermat test now. */
- mpz_sub_ui( pminus1, ptest, 1);
- mpz_powm( result, val_2, pminus1, ptest );
- if ( ( !mpz_cmp_ui( result, 1 ) ) &&
- (is_prime(ptest, 5, hc) ) ) {
- /* Got it. */
- mpz_clear(val_2);
- mpz_clear(val_3);
- mpz_clear(result);
- mpz_clear(pminus1);
- mpz_clear(prime);
- FREE(mods);
- return;
- }
- }
- }
-}
-
-/**
- * Find the greatest common divisor G of A and B.
- * Return: 1 if this 1, 0 in all other cases
- */
-static int test_gcd(mpz_t g,
- mpz_t xa,
- mpz_t xb) {
- mpz_t a, b;
-
- mpz_init_set(a, xa);
- mpz_init_set(b, xb);
-
- /* TAOCP Vol II, 4.5.2, Algorithm A */
- while (mpz_cmp_ui( b, 0 ) ) {
- mpz_fdiv_r(g, a, b); /* g used as temorary variable */
- mpz_set(a,b);
- mpz_set(b,g);
- }
- mpz_set(g, a);
-
- mpz_clear(a);
- mpz_clear(b);
- return (0 == mpz_cmp_ui(g, 1));
-}
-
-/**
- * Generate a key pair with a key of size NBITS.
- * @param sk where to store the key
- * @param nbits the number of bits to use
- * @param hc the HC to use for PRNG (modified!)
- */
-static void generate_kblock_key(KBlock_secret_key *sk,
- unsigned int nbits,
- HashCode512 * hc) {
- mpz_t t1, t2;
- mpz_t phi; /* helper: (p-1)(q-1) */
- mpz_t g;
- mpz_t f;
-
- /* make sure that nbits is even so that we generate p, q of equal size */
- if ( (nbits&1) )
- nbits++;
-
- mpz_init_set_ui(sk->e, 257);
- mpz_init(sk->n);
- mpz_init(sk->p);
- mpz_init(sk->q);
- mpz_init(sk->d);
- mpz_init(sk->u);
-
- mpz_init(t1);
- mpz_init(t2);
- mpz_init(phi);
- mpz_init(g);
- mpz_init(f);
-
- do {
- do {
- mpz_clear(sk->p);
- mpz_clear(sk->q);
- gen_prime(sk->p, nbits/2, hc);
- gen_prime(sk->q, nbits/2, hc);
-
- if (mpz_cmp (sk->p, sk->q) > 0 ) /* p shall be smaller than q (for calc
of u)*/
- mpz_swap(sk->p, sk->q);
- /* calculate the modulus */
- mpz_mul(sk->n, sk->p, sk->q );
- } while (get_nbits(sk->n) != nbits);
-
- /* calculate Euler totient: phi = (p-1)(q-1) */
- mpz_sub_ui(t1, sk->p, 1 );
- mpz_sub_ui(t2, sk->q, 1 );
- mpz_mul(phi, t1, t2 );
- mpz_gcd(g, t1, t2);
- mpz_fdiv_q(f, phi, g);
-
- while (0 == test_gcd(t1, sk->e, phi)) { /* (while gcd is not 1) */
- mpz_add_ui (sk->e, sk->e, 2);
- }
-
- /* calculate the secret key d = e^1 mod phi */
- } while ( (0 == mpz_invert(sk->d, sk->e, f )) ||
- (0 == mpz_invert(sk->u, sk->p, sk->q )) );
-
- mpz_clear(t1);
- mpz_clear(t2);
- mpz_clear(phi);
- mpz_clear(f);
- mpz_clear(g);
-}
-
-/**
- * Deterministically (!) create a hostkey using only the
- * given HashCode as input to the PRNG.
- */
-static PrivateKeyEncoded *
-makeKblockKeyInternal(const HashCode512 * hc) {
- KBlock_secret_key sk;
- HashCode512 hx;
- void * pbu[6];
- mpz_t * pkv[6];
- size_t sizes[6];
- PrivateKeyEncoded * retval;
- int i;
- size_t size;
-
- hx = *hc;
- generate_kblock_key(&sk,
- 1024, /* at least 10x as fast than 2048 bits
- -- we simply cannot afford 2048 bits
- even on modern hardware, and especially
- not since clearly a dictionary attack
- will still be much cheaper
- than breaking a 1024 bit RSA key.
- If an adversary can spend the time to
- break a 1024 bit RSA key just to forge
- a signature -- SO BE IT. [ CG, 6/2005 ] */
- &hx);
- pkv[0] = &sk.n;
- pkv[1] = &sk.e;
- pkv[2] = &sk.d;
- pkv[3] = &sk.p;
- pkv[4] = &sk.q;
- pkv[5] = &sk.u;
- size = sizeof(PrivateKeyEncoded);
- for (i=0;i<6;i++) {
- pbu[i] = mpz_export(NULL,
- &sizes[i],
- 1, /* most significant word first */
- 1, /* unit is bytes */
- 1, /* big endian */
- 0, /* nails */
- *pkv[i]);
- size += sizes[i];
- }
- GNUNET_ASSERT(size < 65536);
- retval = MALLOC(size);
- retval->len = htons(size);
- i = 0;
- retval->sizen = htons(sizes[0]);
- memcpy(&((char*)&retval[1])[i],
- pbu[0],
- sizes[0]);
- i += sizes[0];
- retval->sizee = htons(sizes[1]);
- memcpy(&((char*)&retval[1])[i],
- pbu[1],
- sizes[1]);
- i += sizes[1];
- retval->sized = htons(sizes[2]);
- memcpy(&((char*)&retval[1])[i],
- pbu[2],
- sizes[2]);
- i += sizes[2];
- /* swap p and q! */
- retval->sizep = htons(sizes[4]);
- memcpy(&((char*)&retval[1])[i],
- pbu[4],
- sizes[4]);
- i += sizes[4];
- retval->sizeq = htons(sizes[3]);
- memcpy(&((char*)&retval[1])[i],
- pbu[3],
- sizes[3]);
- i += sizes[3];
- retval->sizedmp1 = htons(0);
- retval->sizedmq1 = htons(0);
- memcpy(&((char*)&retval[1])[i],
- pbu[5],
- sizes[5]);
- for (i=0;i<6;i++) {
- mpz_clear(*pkv[i]);
- free(pbu[i]);
- }
- return retval;
-}
-
-typedef struct {
- HashCode512 hc;
- PrivateKeyEncoded * pke;
-} KBlockKeyCacheLine;
-
-static KBlockKeyCacheLine ** cache;
-static unsigned int cacheSize;
-static Mutex lock;
-
-/**
- * Deterministically (!) create a hostkey using only the
- * given HashCode as input to the PRNG.
- */
-struct PrivateKey * makeKblockKey(const HashCode512 * hc) {
- struct PrivateKey * ret;
- KBlockKeyCacheLine * line;
- int i;
-
- MUTEX_LOCK(&lock);
- for (i=0;i<cacheSize;i++) {
- if (equalsHashCode512(hc,
- &cache[i]->hc)) {
- ret = decodePrivateKey(cache[i]->pke);
- MUTEX_UNLOCK(&lock);
- return ret;
- }
- }
-
- line
- = MALLOC(sizeof(KBlockKeyCacheLine));
- line->hc = *hc;
- line->pke
- = makeKblockKeyInternal(hc);
- GROW(cache,
- cacheSize,
- cacheSize+1);
- cache[cacheSize-1]
- = line;
- MUTEX_UNLOCK(&lock);
- return decodePrivateKey(line->pke);
-}
-
-void initKBlockKey() {
- MUTEX_CREATE(&lock);
-}
-
-void doneKBlockKey() {
- int i;
- for (i=0;i<cacheSize;i++) {
- FREE(cache[i]->pke);
- FREE(cache[i]);
- }
- GROW(cache,
- cacheSize,
- 0);
- MUTEX_DESTROY(&lock);
-}
-
-/* end of kblockkey.c */
Deleted: GNUnet/src/util/kblockkey_test.c
===================================================================
--- GNUnet/src/util/kblockkey_test.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/kblockkey_test.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,272 +0,0 @@
-/*
- This file is part of GNUnet.
- Copyright (C) 2004, 2005 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 util/kblockkey_test.c
- * @brief testcase for util/kblockkey.c
- * @author Christian Grothoff
- */
-
-#include "platform.h"
-#include "gnunet_util.h"
-#include "locking_gcrypt.h"
-
-#define TESTSTRING "Hello World\0"
-#define MAX_TESTVAL 20
-#define UNIQUE_ITER 6
-#define ITER 10
-
-
-static int testMultiKey(const char * word) {
- HashCode512 in;
- struct PrivateKey * hostkey;
- PublicKey pkey;
- PublicKey pkey1;
- int i;
-
- fprintf(stderr,
- "Testing KBlock key uniqueness (%s) ",
- word);
- hash(word, strlen(word), &in);
- hostkey = makeKblockKey(&in);
- if (hostkey == NULL) {
- BREAK();
- return SYSERR;
- }
- getPublicKey(hostkey, &pkey);
- /*
- for (i=0;i<sizeof(PublicKey);i++)
- printf("%02x", ((unsigned char*) &pkey)[i]);
- printf("\n"); */
- freePrivateKey(hostkey);
- for (i=0;i<UNIQUE_ITER;i++) {
- fprintf(stderr, ".");
- hostkey = makeKblockKey(&in);
- if (hostkey == NULL) {
- BREAK();
- fprintf(stderr, " ERROR\n");
- return SYSERR;
- }
- getPublicKey(hostkey, &pkey1);
- freePrivateKey(hostkey);
- if (0 != memcmp(&pkey, &pkey1,
- sizeof(PublicKey))) {
- BREAK();
- fprintf(stderr, " ERROR\n");
- return SYSERR;
- }
- }
- fprintf(stderr, " OK\n");
- return OK;
-}
-
-
-static int testEncryptDecrypt(struct PrivateKey * hostkey) {
- PublicKey pkey;
- RSAEncryptedData target;
- char result[MAX_TESTVAL];
- int i;
- TIME_T start;
- int ok;
-
- fprintf(stderr, "W");
- getPublicKey(hostkey, &pkey);
-
- ok = 0;
- TIME(&start);
- for (i=0;i<ITER;i++) {
- fprintf(stderr, ".");
- if (SYSERR == encryptPrivateKey(TESTSTRING,
- strlen(TESTSTRING)+1,
- &pkey,
- &target)) {
- fprintf(stderr,
- "encryptPrivateKey returned SYSERR\n");
- ok++;
- continue;
- }
- if (-1 == decryptPrivateKey(hostkey,
- &target,
- result,
- strlen(TESTSTRING)+1)) {
- fprintf(stderr,
- "decryptPrivateKey returned SYSERR\n");
- ok++;
- continue;
- }
- if (strncmp(TESTSTRING, result,
- strlen(TESTSTRING)) != 0) {
- printf("%s != %.*s - testEncryptDecrypt failed!\n",
- TESTSTRING,
- MAX_TESTVAL,
- result);
- ok++;
- continue;
- }
- }
- printf("%d RSA encrypt/decrypt operations %ds (%d failures)\n",
- ITER,
- (int) (TIME(NULL)-start),
- ok);
- if (ok == 0)
- return OK;
- else
- return SYSERR;
-}
-
-static int testSignVerify(struct PrivateKey * hostkey) {
- Signature sig;
- PublicKey pkey;
- int i;
- TIME_T start;
- int ok = OK;
-
- fprintf(stderr, "W");
- getPublicKey(hostkey, &pkey);
- TIME(&start);
- for (i=0;i<ITER;i++) {
- fprintf(stderr, ".");
- if (SYSERR == sign(hostkey,
- strlen(TESTSTRING),
- TESTSTRING, &sig)) {
- fprintf(stderr,
- "sign returned SYSERR\n");
- ok = SYSERR;
- continue;
- }
- if (SYSERR == verifySig(TESTSTRING,
- strlen(TESTSTRING),
- &sig,
- &pkey)) {
- printf("testSignVerify failed!\n");
- ok = SYSERR;
- continue;
- }
- }
- printf("%d RSA sign/verify operations %ds\n",
- ITER,
- (int) (TIME(NULL)-start));
- return ok;
-}
-
-static int testPrivateKeyEncoding(const struct PrivateKey * hostkey) {
- PrivateKeyEncoded * encoding;
- struct PrivateKey * hostkey2;
- PublicKey pkey;
- RSAEncryptedData target;
- char result[MAX_TESTVAL];
- int i;
- TIME_T start;
- int ok = OK;
-
- fprintf(stderr, "W");
-
- TIME(&start);
- for (i=0;i<ITER;i++) {
- fprintf(stderr, ".");
- getPublicKey(hostkey, &pkey);
- if (SYSERR == encryptPrivateKey(TESTSTRING,
- strlen(TESTSTRING)+1,
- &pkey,
- &target)) {
- fprintf(stderr,
- "encryptPrivateKey returned SYSERR\n");
- ok = SYSERR;
- continue;
- }
- encoding = encodePrivateKey(hostkey);
- if (encoding == NULL) {
- fprintf(stderr,
- "encodePrivateKey returned NULL\n");
- ok = SYSERR;
- continue;
- }
- hostkey2 = decodePrivateKey(encoding);
- FREE(encoding);
- if (SYSERR == decryptPrivateKey(hostkey2,
- &target,
- result,
- strlen(TESTSTRING)+1)) {
- fprintf(stderr,
- "decryptPrivateKey returned SYSERR\n");
- ok = SYSERR;
- freePrivateKey(hostkey2);
- continue;
- }
- freePrivateKey(hostkey2);
- if (strncmp(TESTSTRING, result,
- strlen(TESTSTRING)) != 0) {
- printf("%s != %.*s - testEncryptDecrypt failed!\n",
- TESTSTRING,
- (int) strlen(TESTSTRING),
- result);
- ok = SYSERR;
- continue;
- }
- }
- printf("%d RSA encrypt/encode/decode/decrypt operations %ds\n",
- ITER,
- (int) (TIME(NULL)-start));
- return ok;
-}
-
-
-void initRAND(void); /* hostkey_* */
-void initKBlockKey(void);
-void doneKBlockKey(void);
-
-int main(int argc, char * argv[]) {
- int failureCount = 0;
- HashCode512 in;
- struct PrivateKey * hostkey;
-
- initLockingGcrypt();
- initRAND();
- initKBlockKey();
- makeRandomId(&in);
-
- hostkey = makeKblockKey(&in);
- if (hostkey == NULL) {
- printf("\nmakeKblockKey failed!\n");
- return 1;
- }
-
- if (OK != testMultiKey("foo"))
- failureCount++;
- if (OK != testMultiKey("bar"))
- failureCount++;
- if (OK != testEncryptDecrypt(hostkey))
- failureCount++;
- if (OK != testSignVerify(hostkey))
- failureCount++;
- if (OK != testPrivateKeyEncoding(hostkey))
- failureCount++;
- freePrivateKey(hostkey);
- doneKBlockKey();
- doneLockingGcrypt();
-
- if (failureCount == 0) {
- return 0;
- } else {
- printf("\n\n%d TESTS FAILED!\n\n",
- failureCount);
- return -1;
- }
-}
Deleted: GNUnet/src/util/locking_gcrypt.c
===================================================================
--- GNUnet/src/util/locking_gcrypt.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/locking_gcrypt.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,46 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2001, 2002, 2003, 2004 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 util/locking_gcrypt.c
- * @brief locking for gcrypt
- * @author Christian Grothoff
- */
-
-#include "platform.h"
-#include "gnunet_util.h"
-
-static Mutex gcrypt_shared_lock;
-
-void lockGcrypt() {
- MUTEX_LOCK(&gcrypt_shared_lock);
-}
-
-void unlockGcrypt() {
- MUTEX_UNLOCK(&gcrypt_shared_lock);
-}
-
-void initLockingGcrypt() {
- MUTEX_CREATE_RECURSIVE(&gcrypt_shared_lock);
-}
-
-void doneLockingGcrypt() {
- MUTEX_DESTROY(&gcrypt_shared_lock);
-}
Deleted: GNUnet/src/util/locking_gcrypt.h
===================================================================
--- GNUnet/src/util/locking_gcrypt.h 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/locking_gcrypt.h 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,33 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2001, 2002, 2003, 2004, 2005 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.
-*/
-
-
-#ifndef LOCKING_GCRYPT_H
-#define LOCKING_GCRYPT_H
-
-void initLockingGcrypt();
-
-void doneLockingGcrypt();
-
-void lockGcrypt();
-
-void unlockGcrypt();
-
-#endif
Added: GNUnet/src/util/loggers/.deps/file.Plo
===================================================================
--- GNUnet/src/util/loggers/.deps/file.Plo 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/loggers/.deps/file.Plo 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,299 @@
+file.lo .libs/file.o: file.c \
+ ../../../src/include/gnunet_util_error_loggers.h \
+ ../../../src/include/gnunet_util_error.h \
+ ../../../src/include/gnunet_util.h /usr/include/stdlib.h \
+ /usr/include/features.h /usr/include/sys/cdefs.h \
+ /usr/include/gnu/stubs.h \
+ /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/stddef.h \
+ /usr/include/sys/types.h /usr/include/bits/types.h \
+ /usr/include/bits/wordsize.h /usr/include/bits/typesizes.h \
+ /usr/include/time.h /usr/include/endian.h /usr/include/bits/endian.h \
+ /usr/include/sys/select.h /usr/include/bits/select.h \
+ /usr/include/bits/sigset.h /usr/include/bits/time.h \
+ /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \
+ /usr/include/bits/sched.h /usr/include/alloca.h \
+ ../../../src/include/gnunet_config.h ../../../src/include/platform.h \
+ ../../../config.h ../../../src/include/plibc.h /usr/include/pthread.h \
+ /usr/include/sched.h /usr/include/signal.h /usr/include/bits/initspin.h \
+ /usr/include/bits/sigthread.h /usr/include/netdb.h \
+ /usr/include/netinet/in.h /usr/include/stdint.h \
+ /usr/include/bits/wchar.h /usr/include/sys/socket.h \
+ /usr/include/sys/uio.h /usr/include/bits/uio.h \
+ /usr/include/bits/socket.h \
+ /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/limits.h \
+ /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/syslimits.h \
+ /usr/include/limits.h /usr/include/bits/posix1_lim.h \
+ /usr/include/bits/local_lim.h /usr/include/linux/limits.h \
+ /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \
+ /usr/include/asm/socket.h /usr/include/asm/sockios.h \
+ /usr/include/bits/in.h /usr/include/bits/byteswap.h \
+ /usr/include/rpc/netdb.h /usr/include/bits/netdb.h \
+ /usr/include/arpa/inet.h /usr/include/netinet/tcp.h /usr/include/pwd.h \
+ /usr/include/stdio.h /usr/include/sys/ioctl.h \
+ /usr/include/bits/ioctls.h /usr/include/asm/ioctls.h \
+ /usr/include/asm/ioctl.h /usr/include/bits/ioctl-types.h \
+ /usr/include/sys/ttydefaults.h /usr/include/sys/wait.h \
+ /usr/include/bits/signum.h /usr/include/bits/siginfo.h \
+ /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \
+ /usr/include/asm/sigcontext.h /usr/include/linux/compiler.h \
+ /usr/include/bits/sigstack.h /usr/include/sys/resource.h \
+ /usr/include/bits/resource.h /usr/include/bits/waitflags.h \
+ /usr/include/bits/waitstatus.h /usr/include/string.h \
+ /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
+ /usr/include/gconv.h \
+ /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/stdarg.h \
+ /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
+ /usr/include/ltdl.h /usr/include/errno.h /usr/include/bits/errno.h \
+ /usr/include/linux/errno.h /usr/include/asm/errno.h \
+ /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \
+ /usr/include/unistd.h /usr/include/bits/posix_opt.h \
+ /usr/include/bits/confname.h /usr/include/getopt.h \
+ /usr/include/sys/stat.h /usr/include/bits/stat.h /usr/include/dirent.h \
+ /usr/include/bits/dirent.h /usr/include/fcntl.h \
+ /usr/include/bits/fcntl.h /usr/include/math.h \
+ /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h \
+ /usr/include/bits/mathcalls.h /usr/include/sys/param.h \
+ /usr/include/linux/param.h /usr/include/asm/param.h \
+ /usr/include/sys/time.h /usr/include/net/if.h /usr/include/ctype.h \
+ /usr/include/locale.h /usr/include/bits/locale.h \
+ ../../../src/include/gettext.h /usr/include/libintl.h \
+ /usr/include/sys/mman.h /usr/include/bits/mman.h \
+ /usr/include/langinfo.h /usr/include/nl_types.h
+
+../../../src/include/gnunet_util_error_loggers.h:
+
+../../../src/include/gnunet_util_error.h:
+
+../../../src/include/gnunet_util.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/features.h:
+
+/usr/include/sys/cdefs.h:
+
+/usr/include/gnu/stubs.h:
+
+/usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/stddef.h:
+
+/usr/include/sys/types.h:
+
+/usr/include/bits/types.h:
+
+/usr/include/bits/wordsize.h:
+
+/usr/include/bits/typesizes.h:
+
+/usr/include/time.h:
+
+/usr/include/endian.h:
+
+/usr/include/bits/endian.h:
+
+/usr/include/sys/select.h:
+
+/usr/include/bits/select.h:
+
+/usr/include/bits/sigset.h:
+
+/usr/include/bits/time.h:
+
+/usr/include/sys/sysmacros.h:
+
+/usr/include/bits/pthreadtypes.h:
+
+/usr/include/bits/sched.h:
+
+/usr/include/alloca.h:
+
+../../../src/include/gnunet_config.h:
+
+../../../src/include/platform.h:
+
+../../../config.h:
+
+../../../src/include/plibc.h:
+
+/usr/include/pthread.h:
+
+/usr/include/sched.h:
+
+/usr/include/signal.h:
+
+/usr/include/bits/initspin.h:
+
+/usr/include/bits/sigthread.h:
+
+/usr/include/netdb.h:
+
+/usr/include/netinet/in.h:
+
+/usr/include/stdint.h:
+
+/usr/include/bits/wchar.h:
+
+/usr/include/sys/socket.h:
+
+/usr/include/sys/uio.h:
+
+/usr/include/bits/uio.h:
+
+/usr/include/bits/socket.h:
+
+/usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/limits.h:
+
+/usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/syslimits.h:
+
+/usr/include/limits.h:
+
+/usr/include/bits/posix1_lim.h:
+
+/usr/include/bits/local_lim.h:
+
+/usr/include/linux/limits.h:
+
+/usr/include/bits/posix2_lim.h:
+
+/usr/include/bits/sockaddr.h:
+
+/usr/include/asm/socket.h:
+
+/usr/include/asm/sockios.h:
+
+/usr/include/bits/in.h:
+
+/usr/include/bits/byteswap.h:
+
+/usr/include/rpc/netdb.h:
+
+/usr/include/bits/netdb.h:
+
+/usr/include/arpa/inet.h:
+
+/usr/include/netinet/tcp.h:
+
+/usr/include/pwd.h:
+
+/usr/include/stdio.h:
+
+/usr/include/sys/ioctl.h:
+
+/usr/include/bits/ioctls.h:
+
+/usr/include/asm/ioctls.h:
+
+/usr/include/asm/ioctl.h:
+
+/usr/include/bits/ioctl-types.h:
+
+/usr/include/sys/ttydefaults.h:
+
+/usr/include/sys/wait.h:
+
+/usr/include/bits/signum.h:
+
+/usr/include/bits/siginfo.h:
+
+/usr/include/bits/sigaction.h:
+
+/usr/include/bits/sigcontext.h:
+
+/usr/include/asm/sigcontext.h:
+
+/usr/include/linux/compiler.h:
+
+/usr/include/bits/sigstack.h:
+
+/usr/include/sys/resource.h:
+
+/usr/include/bits/resource.h:
+
+/usr/include/bits/waitflags.h:
+
+/usr/include/bits/waitstatus.h:
+
+/usr/include/string.h:
+
+/usr/include/libio.h:
+
+/usr/include/_G_config.h:
+
+/usr/include/wchar.h:
+
+/usr/include/gconv.h:
+
+/usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/stdarg.h:
+
+/usr/include/bits/stdio_lim.h:
+
+/usr/include/bits/sys_errlist.h:
+
+/usr/include/ltdl.h:
+
+/usr/include/errno.h:
+
+/usr/include/bits/errno.h:
+
+/usr/include/linux/errno.h:
+
+/usr/include/asm/errno.h:
+
+/usr/include/asm-generic/errno.h:
+
+/usr/include/asm-generic/errno-base.h:
+
+/usr/include/unistd.h:
+
+/usr/include/bits/posix_opt.h:
+
+/usr/include/bits/confname.h:
+
+/usr/include/getopt.h:
+
+/usr/include/sys/stat.h:
+
+/usr/include/bits/stat.h:
+
+/usr/include/dirent.h:
+
+/usr/include/bits/dirent.h:
+
+/usr/include/fcntl.h:
+
+/usr/include/bits/fcntl.h:
+
+/usr/include/math.h:
+
+/usr/include/bits/huge_val.h:
+
+/usr/include/bits/mathdef.h:
+
+/usr/include/bits/mathcalls.h:
+
+/usr/include/sys/param.h:
+
+/usr/include/linux/param.h:
+
+/usr/include/asm/param.h:
+
+/usr/include/sys/time.h:
+
+/usr/include/net/if.h:
+
+/usr/include/ctype.h:
+
+/usr/include/locale.h:
+
+/usr/include/bits/locale.h:
+
+../../../src/include/gettext.h:
+
+/usr/include/libintl.h:
+
+/usr/include/sys/mman.h:
+
+/usr/include/bits/mman.h:
+
+/usr/include/langinfo.h:
+
+/usr/include/nl_types.h:
Added: GNUnet/src/util/loggers/.deps/memory.Plo
===================================================================
--- GNUnet/src/util/loggers/.deps/memory.Plo 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/loggers/.deps/memory.Plo 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1,299 @@
+memory.lo .libs/memory.o: memory.c \
+ ../../../src/include/gnunet_util_error_loggers.h \
+ ../../../src/include/gnunet_util_error.h \
+ ../../../src/include/gnunet_util.h /usr/include/stdlib.h \
+ /usr/include/features.h /usr/include/sys/cdefs.h \
+ /usr/include/gnu/stubs.h \
+ /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/stddef.h \
+ /usr/include/sys/types.h /usr/include/bits/types.h \
+ /usr/include/bits/wordsize.h /usr/include/bits/typesizes.h \
+ /usr/include/time.h /usr/include/endian.h /usr/include/bits/endian.h \
+ /usr/include/sys/select.h /usr/include/bits/select.h \
+ /usr/include/bits/sigset.h /usr/include/bits/time.h \
+ /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \
+ /usr/include/bits/sched.h /usr/include/alloca.h \
+ ../../../src/include/gnunet_config.h ../../../src/include/platform.h \
+ ../../../config.h ../../../src/include/plibc.h /usr/include/pthread.h \
+ /usr/include/sched.h /usr/include/signal.h /usr/include/bits/initspin.h \
+ /usr/include/bits/sigthread.h /usr/include/netdb.h \
+ /usr/include/netinet/in.h /usr/include/stdint.h \
+ /usr/include/bits/wchar.h /usr/include/sys/socket.h \
+ /usr/include/sys/uio.h /usr/include/bits/uio.h \
+ /usr/include/bits/socket.h \
+ /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/limits.h \
+ /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/syslimits.h \
+ /usr/include/limits.h /usr/include/bits/posix1_lim.h \
+ /usr/include/bits/local_lim.h /usr/include/linux/limits.h \
+ /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \
+ /usr/include/asm/socket.h /usr/include/asm/sockios.h \
+ /usr/include/bits/in.h /usr/include/bits/byteswap.h \
+ /usr/include/rpc/netdb.h /usr/include/bits/netdb.h \
+ /usr/include/arpa/inet.h /usr/include/netinet/tcp.h /usr/include/pwd.h \
+ /usr/include/stdio.h /usr/include/sys/ioctl.h \
+ /usr/include/bits/ioctls.h /usr/include/asm/ioctls.h \
+ /usr/include/asm/ioctl.h /usr/include/bits/ioctl-types.h \
+ /usr/include/sys/ttydefaults.h /usr/include/sys/wait.h \
+ /usr/include/bits/signum.h /usr/include/bits/siginfo.h \
+ /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \
+ /usr/include/asm/sigcontext.h /usr/include/linux/compiler.h \
+ /usr/include/bits/sigstack.h /usr/include/sys/resource.h \
+ /usr/include/bits/resource.h /usr/include/bits/waitflags.h \
+ /usr/include/bits/waitstatus.h /usr/include/string.h \
+ /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
+ /usr/include/gconv.h \
+ /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/stdarg.h \
+ /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
+ /usr/include/ltdl.h /usr/include/errno.h /usr/include/bits/errno.h \
+ /usr/include/linux/errno.h /usr/include/asm/errno.h \
+ /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \
+ /usr/include/unistd.h /usr/include/bits/posix_opt.h \
+ /usr/include/bits/confname.h /usr/include/getopt.h \
+ /usr/include/sys/stat.h /usr/include/bits/stat.h /usr/include/dirent.h \
+ /usr/include/bits/dirent.h /usr/include/fcntl.h \
+ /usr/include/bits/fcntl.h /usr/include/math.h \
+ /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h \
+ /usr/include/bits/mathcalls.h /usr/include/sys/param.h \
+ /usr/include/linux/param.h /usr/include/asm/param.h \
+ /usr/include/sys/time.h /usr/include/net/if.h /usr/include/ctype.h \
+ /usr/include/locale.h /usr/include/bits/locale.h \
+ ../../../src/include/gettext.h /usr/include/libintl.h \
+ /usr/include/sys/mman.h /usr/include/bits/mman.h \
+ /usr/include/langinfo.h /usr/include/nl_types.h
+
+../../../src/include/gnunet_util_error_loggers.h:
+
+../../../src/include/gnunet_util_error.h:
+
+../../../src/include/gnunet_util.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/features.h:
+
+/usr/include/sys/cdefs.h:
+
+/usr/include/gnu/stubs.h:
+
+/usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/stddef.h:
+
+/usr/include/sys/types.h:
+
+/usr/include/bits/types.h:
+
+/usr/include/bits/wordsize.h:
+
+/usr/include/bits/typesizes.h:
+
+/usr/include/time.h:
+
+/usr/include/endian.h:
+
+/usr/include/bits/endian.h:
+
+/usr/include/sys/select.h:
+
+/usr/include/bits/select.h:
+
+/usr/include/bits/sigset.h:
+
+/usr/include/bits/time.h:
+
+/usr/include/sys/sysmacros.h:
+
+/usr/include/bits/pthreadtypes.h:
+
+/usr/include/bits/sched.h:
+
+/usr/include/alloca.h:
+
+../../../src/include/gnunet_config.h:
+
+../../../src/include/platform.h:
+
+../../../config.h:
+
+../../../src/include/plibc.h:
+
+/usr/include/pthread.h:
+
+/usr/include/sched.h:
+
+/usr/include/signal.h:
+
+/usr/include/bits/initspin.h:
+
+/usr/include/bits/sigthread.h:
+
+/usr/include/netdb.h:
+
+/usr/include/netinet/in.h:
+
+/usr/include/stdint.h:
+
+/usr/include/bits/wchar.h:
+
+/usr/include/sys/socket.h:
+
+/usr/include/sys/uio.h:
+
+/usr/include/bits/uio.h:
+
+/usr/include/bits/socket.h:
+
+/usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/limits.h:
+
+/usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/syslimits.h:
+
+/usr/include/limits.h:
+
+/usr/include/bits/posix1_lim.h:
+
+/usr/include/bits/local_lim.h:
+
+/usr/include/linux/limits.h:
+
+/usr/include/bits/posix2_lim.h:
+
+/usr/include/bits/sockaddr.h:
+
+/usr/include/asm/socket.h:
+
+/usr/include/asm/sockios.h:
+
+/usr/include/bits/in.h:
+
+/usr/include/bits/byteswap.h:
+
+/usr/include/rpc/netdb.h:
+
+/usr/include/bits/netdb.h:
+
+/usr/include/arpa/inet.h:
+
+/usr/include/netinet/tcp.h:
+
+/usr/include/pwd.h:
+
+/usr/include/stdio.h:
+
+/usr/include/sys/ioctl.h:
+
+/usr/include/bits/ioctls.h:
+
+/usr/include/asm/ioctls.h:
+
+/usr/include/asm/ioctl.h:
+
+/usr/include/bits/ioctl-types.h:
+
+/usr/include/sys/ttydefaults.h:
+
+/usr/include/sys/wait.h:
+
+/usr/include/bits/signum.h:
+
+/usr/include/bits/siginfo.h:
+
+/usr/include/bits/sigaction.h:
+
+/usr/include/bits/sigcontext.h:
+
+/usr/include/asm/sigcontext.h:
+
+/usr/include/linux/compiler.h:
+
+/usr/include/bits/sigstack.h:
+
+/usr/include/sys/resource.h:
+
+/usr/include/bits/resource.h:
+
+/usr/include/bits/waitflags.h:
+
+/usr/include/bits/waitstatus.h:
+
+/usr/include/string.h:
+
+/usr/include/libio.h:
+
+/usr/include/_G_config.h:
+
+/usr/include/wchar.h:
+
+/usr/include/gconv.h:
+
+/usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include/stdarg.h:
+
+/usr/include/bits/stdio_lim.h:
+
+/usr/include/bits/sys_errlist.h:
+
+/usr/include/ltdl.h:
+
+/usr/include/errno.h:
+
+/usr/include/bits/errno.h:
+
+/usr/include/linux/errno.h:
+
+/usr/include/asm/errno.h:
+
+/usr/include/asm-generic/errno.h:
+
+/usr/include/asm-generic/errno-base.h:
+
+/usr/include/unistd.h:
+
+/usr/include/bits/posix_opt.h:
+
+/usr/include/bits/confname.h:
+
+/usr/include/getopt.h:
+
+/usr/include/sys/stat.h:
+
+/usr/include/bits/stat.h:
+
+/usr/include/dirent.h:
+
+/usr/include/bits/dirent.h:
+
+/usr/include/fcntl.h:
+
+/usr/include/bits/fcntl.h:
+
+/usr/include/math.h:
+
+/usr/include/bits/huge_val.h:
+
+/usr/include/bits/mathdef.h:
+
+/usr/include/bits/mathcalls.h:
+
+/usr/include/sys/param.h:
+
+/usr/include/linux/param.h:
+
+/usr/include/asm/param.h:
+
+/usr/include/sys/time.h:
+
+/usr/include/net/if.h:
+
+/usr/include/ctype.h:
+
+/usr/include/locale.h:
+
+/usr/include/bits/locale.h:
+
+../../../src/include/gettext.h:
+
+/usr/include/libintl.h:
+
+/usr/include/sys/mman.h:
+
+/usr/include/bits/mman.h:
+
+/usr/include/langinfo.h:
+
+/usr/include/nl_types.h:
Added: GNUnet/src/util/loggers/.deps/multiplex.Plo
===================================================================
--- GNUnet/src/util/loggers/.deps/multiplex.Plo 2006-06-15 16:42:32 UTC (rev
3010)
+++ GNUnet/src/util/loggers/.deps/multiplex.Plo 2006-06-15 16:49:28 UTC (rev
3011)
@@ -0,0 +1 @@
+# dummy
Added: GNUnet/src/util/loggers/.libs/libgnunetlogging.lai
===================================================================
--- GNUnet/src/util/loggers/.libs/libgnunetlogging.lai 2006-06-15 16:42:32 UTC
(rev 3010)
+++ GNUnet/src/util/loggers/.libs/libgnunetlogging.lai 2006-06-15 16:49:28 UTC
(rev 3011)
@@ -0,0 +1,35 @@
+# libgnunetlogging.la - a libtool library file
+# Generated by ltmain.sh - GNU libtool 1.5.6 (1.1220.2.95 2004/04/11 05:50:42)
Debian: 224 $
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='libgnunetlogging.so.0'
+
+# Names of this library.
+library_names='libgnunetlogging.so.0.0.0 libgnunetlogging.so.0
libgnunetlogging.so'
+
+# The name of the static archive.
+old_library=''
+
+# Libraries that this one depends upon.
+dependency_libs=' -L/home/grothoff/lib /home/grothoff/lib/libgnunetutil.la
/usr/lib/libltdl.la /usr/lib/libgcrypt.la /usr/lib/libgpg-error.la
/usr/lib/libgpg-error.la /usr/lib/libgmp.la -ldl -L/home/grothoff//lib -lm
-lnsl -lpthread'
+
+# Version information for libgnunetlogging.
+current=0
+age=0
+revision=0
+
+# Is this an already installed library?
+installed=yes
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=no
+
+# Files to dlopen/dlpreopen
+dlopen=''
+dlpreopen=''
+
+# Directory that this library needs to be installed in:
+libdir='/home/grothoff/lib'
Added: GNUnet/src/util/loggers/.libs/libgnunetlogging.so
===================================================================
--- GNUnet/src/util/loggers/.libs/libgnunetlogging.so 2006-06-15 16:42:32 UTC
(rev 3010)
+++ GNUnet/src/util/loggers/.libs/libgnunetlogging.so 2006-06-15 16:49:28 UTC
(rev 3011)
@@ -0,0 +1 @@
+link libgnunetlogging.so.0.0.0
\ No newline at end of file
Property changes on: GNUnet/src/util/loggers/.libs/libgnunetlogging.so
___________________________________________________________________
Name: svn:special
+ *
Added: GNUnet/src/util/loggers/.libs/libgnunetlogging.so.0
===================================================================
--- GNUnet/src/util/loggers/.libs/libgnunetlogging.so.0 2006-06-15 16:42:32 UTC
(rev 3010)
+++ GNUnet/src/util/loggers/.libs/libgnunetlogging.so.0 2006-06-15 16:49:28 UTC
(rev 3011)
@@ -0,0 +1 @@
+link libgnunetlogging.so.0.0.0
\ No newline at end of file
Property changes on: GNUnet/src/util/loggers/.libs/libgnunetlogging.so.0
___________________________________________________________________
Name: svn:special
+ *
Added: GNUnet/src/util/loggers/.libs/libgnunetlogging.so.0.0.0
===================================================================
(Binary files differ)
Property changes on: GNUnet/src/util/loggers/.libs/libgnunetlogging.so.0.0.0
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: GNUnet/src/util/loggers/Makefile
===================================================================
--- GNUnet/src/util/loggers/Makefile 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/loggers/Makefile 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,632 @@
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# src/util/loggers/Makefile. Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 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.
+
+
+
+SOURCES = $(libgnunetutil_logging_la_SOURCES)
+
+srcdir = .
+top_srcdir = ../../..
+
+pkgdatadir = $(datadir)/GNUnet
+pkglibdir = $(libdir)/GNUnet
+pkgincludedir = $(includedir)/GNUnet
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = /usr/bin/install -c
+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 = :
+host_triplet = i686-pc-linux-gnu
+subdir = src/util/loggers
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-2.0.m4 \
+ $(top_srcdir)/m4/guile.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/libgcrypt.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(libdir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libgnunetutil_logging_la_DEPENDENCIES = \
+ $(top_builddir)/src/util/libgnunetutil.la
+am_libgnunetutil_logging_la_OBJECTS = file.lo memory.lo
+libgnunetutil_logging_la_OBJECTS = \
+ $(am_libgnunetutil_logging_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+DEP_FILES = ./$(DEPDIR)/file.Plo ./$(DEPDIR)/memory.Plo
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libgnunetutil_logging_la_SOURCES)
+DIST_SOURCES = $(libgnunetutil_logging_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = ${SHELL} /home/grothoff/svn/GNUnet/missing --run aclocal-1.8
+AMDEP_FALSE = #
+AMDEP_TRUE =
+AMTAR = ${SHELL} /home/grothoff/svn/GNUnet/missing --run tar
+AR = ar
+AS = as
+AUTOCONF = ${SHELL} /home/grothoff/svn/GNUnet/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/grothoff/svn/GNUnet/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/grothoff/svn/GNUnet/missing --run automake-1.8
+AWK = gawk
+CC = gcc
+CCDEPMODE = depmode=gcc3
+CFLAGS = -fno-strict-aliasing -Wall -g -Wall
+CONVENIENCE_LTDL_FALSE =
+CONVENIENCE_LTDL_TRUE = #
+CPP = gcc -E
+CPPFLAGS = -I/home/grothoff/include
+CXX = g++
+CXXCPP = g++ -E
+CXXDEPMODE = depmode=gcc3
+CXXFLAGS = -g -O2
+CYGPATH_W = echo
+CYGWIN_FALSE =
+CYGWIN_TRUE = #
+DATADIR = /home/grothoff/share/GNUnet/
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+DLLTOOL = dlltool
+ECHO = echo
+ECHO_C =
+ECHO_N = -n
+ECHO_T =
+EGREP = grep -E
+EXEEXT =
+EXT_LIBS =
+EXT_LIB_PATH = -L/home/grothoff/lib
+F77 =
+FFLAGS =
+GMSGFMT = /usr/bin/msgfmt
+GNUNETGTK_CFLAGS = -DXTHREADS -I/usr/include/libglade-2.0
-I/usr/include/gtk-2.0 -I/usr/include/libxml2 -I/usr/lib/gtk-2.0/include
-I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0
-I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
+GNUNETGTK_LIBS = -lglade-2.0 -lgtk-x11-2.0 -lxml2 -lpthread -lz -lgdk-x11-2.0
-latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0
-lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
+GTK_CFLAGS = -DXTHREADS -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include
-I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0
-I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
+GTK_LIBS = -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm
-lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl
-lglib-2.0
+GUILE = /usr/bin/guile
+GUILE_CONFIG = /usr/bin/guile-config
+GUILE_TOOLS = /usr/bin/guile-tools
+HAVE_CURSES_FALSE = #
+HAVE_CURSES_TRUE =
+HAVE_GTK_FALSE = #
+HAVE_GTK_TRUE =
+HAVE_GUILE_FALSE = #
+HAVE_GUILE_TRUE =
+HAVE_IPV6_FALSE = #
+HAVE_IPV6_TRUE =
+HAVE_MYSQL_FALSE =
+HAVE_MYSQL_TRUE = #
+HAVE_PDCURSES_FALSE =
+HAVE_PDCURSES_TRUE = #
+HAVE_SQLITE_FALSE = #
+HAVE_SQLITE_TRUE =
+HAVE_ZLIB_FALSE = #
+HAVE_ZLIB_TRUE =
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_LTDL_FALSE =
+INSTALL_LTDL_TRUE = #
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
+INTLLIBS =
+LDFLAGS = -L/home/grothoff/lib
+LIBADD_DL = -ldl
+LIBGCRYPT_CFLAGS =
+LIBGCRYPT_CONFIG = /usr/bin/libgcrypt-config
+LIBGCRYPT_LIBS = -lgcrypt -lgpg-error
+LIBICONV = -liconv
+LIBINTL =
+LIBLTDL = -lltdl
+LIBOBJS =
+LIBS = -lm -lnsl -lpthread
+LIBTOOL = $(SHELL) $(top_builddir)/libtool
+LN_S = ln -s
+LOCALEDIR = /home/grothoff/share/locale/
+LTDLINCL =
+LTLIBICONV = -liconv
+LTLIBINTL =
+LTLIBOBJS =
+MAKEINFO = ${SHELL} /home/grothoff/svn/GNUnet/missing --run makeinfo
+MINGW_FALSE =
+MINGW_TRUE = #
+MKINSTALLDIRS = $(top_builddir)/./mkinstalldirs
+MSGFMT = /usr/bin/msgfmt
+MSGMERGE = /usr/bin/msgmerge
+MYSQL_CPPFLAGS =
+MYSQL_LDFLAGS = -L/usr/lib/mysql
+OBJDUMP = objdump
+OBJEXT = o
+PACKAGE = GNUnet
+PACKAGE_BUGREPORT = address@hidden
+PACKAGE_NAME = GNUnet
+PACKAGE_STRING = GNUnet 0.7.0e
+PACKAGE_TARNAME = gnunet
+PACKAGE_VERSION = 0.7.0e
+PATH_SEPARATOR = :
+PKG_CONFIG = /usr/bin/pkg-config
+POSUB = po
+RANLIB = ranlib
+SET_MAKE =
+SHELL = /bin/sh
+SOLARIS_FALSE =
+SOLARIS_TRUE = #
+SQLITE_CPPFLAGS =
+SQLITE_LDFLAGS =
+STRIP = strip
+USE_NLS = yes
+VERSION = 0.7.0e
+XFREEBSD_FALSE =
+XFREEBSD_TRUE = #
+XGETTEXT = /usr/bin/xgettext
+ac_ct_AR = ar
+ac_ct_AS =
+ac_ct_CC = gcc
+ac_ct_CXX = g++
+ac_ct_DLLTOOL =
+ac_ct_F77 =
+ac_ct_OBJDUMP =
+ac_ct_RANLIB = ranlib
+ac_ct_STRIP = strip
+am__fastdepCC_FALSE = #
+am__fastdepCC_TRUE =
+am__fastdepCXX_FALSE = #
+am__fastdepCXX_TRUE =
+am__include = include
+am__leading_dot = .
+am__quote =
+bindir = ${exec_prefix}/bin
+build = i686-pc-linux-gnu
+build_alias =
+build_cpu = i686
+build_os = linux-gnu
+build_vendor = pc
+datadir = ${prefix}/share
+exec_prefix = ${prefix}
+guile_available = /usr/bin/guile
+host = i686-pc-linux-gnu
+host_alias =
+host_cpu = i686
+host_os = linux-gnu
+host_vendor = pc
+includedir = ${prefix}/include
+infodir = ${prefix}/info
+install_sh = /home/grothoff/svn/GNUnet/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localstatedir = ${prefix}/var
+mandir = ${prefix}/man
+mkdir_p = mkdir -p -- .
+oldincludedir = /usr/include
+prefix = /home/grothoff
+program_transform_name = s,x,x,
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+subdirs = libltdl
+sysconfdir = ${prefix}/etc
+target_alias =
+INCLUDES = -I$(top_srcdir)/src/include
+SUBDIRS = .
+lib_LTLIBRARIES = \
+ libgnunetutil_logging.la
+
+libgnunetutil_logging_la_SOURCES = \
+ file.c memory.c
+
+# smtp.c
+libgnunetutil_logging_la_LIBADD = \
+ $(top_builddir)/src/util/libgnunetutil.la
+
+all: all-recursive
+
+.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 \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu
src/util/loggers/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/util/loggers/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
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL)
$(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL)
$(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ 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
+libgnunetutil_logging.la: $(libgnunetutil_logging_la_OBJECTS)
$(libgnunetutil_logging_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libgnunetutil_logging_la_LDFLAGS)
$(libgnunetutil_logging_la_OBJECTS) $(libgnunetutil_logging_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+include ./$(DEPDIR)/file.Plo
+include ./$(DEPDIR)/memory.Plo
+
+.c.o:
+ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
+# source='$<' object='$@' libtool=no \
+# depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
+# $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c $<
+
+.c.obj:
+ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
`$(CYGPATH_W) '$<'`; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
+# source='$<' object='$@' libtool=no \
+# depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
+# $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
+# source='$<' object='$@' libtool=yes \
+# depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' \
+# $(CCDEPMODE) $(depcomp) \
+# $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags);
\
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS)
ctags); \
+ done
+
+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; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed
"s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || mkdir "$(distdir)/$$subdir" \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="../$(top_distdir)" \
+ distdir="../$(distdir)/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(libdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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:
+ -rm -f $(CONFIG_CLEAN_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-recursive
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libLTLIBRARIES clean-libtool \
+ clean-recursive ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-recursive distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-libLTLIBRARIES install-man \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
+ pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-info-am uninstall-libLTLIBRARIES
+
+# 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:
Added: GNUnet/src/util/loggers/Makefile.am
===================================================================
--- GNUnet/src/util/loggers/Makefile.am 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/loggers/Makefile.am 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,14 @@
+INCLUDES = -I$(top_srcdir)/src/include
+
+SUBDIRS = .
+
+lib_LTLIBRARIES = \
+ libgnunetutil_logging.la
+
+libgnunetutil_logging_la_SOURCES = \
+ file.c memory.c
+# smtp.c
+
+libgnunetutil_logging_la_LIBADD = \
+ $(top_builddir)/src/util/libgnunetutil.la
+
Added: GNUnet/src/util/loggers/Makefile.in
===================================================================
--- GNUnet/src/util/loggers/Makefile.in 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/loggers/Makefile.in 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,632 @@
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 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.
+
address@hidden@
+
+SOURCES = $(libgnunetutil_logging_la_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+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 = :
+host_triplet = @host@
+subdir = src/util/loggers
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-2.0.m4 \
+ $(top_srcdir)/m4/guile.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/libgcrypt.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(libdir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libgnunetutil_logging_la_DEPENDENCIES = \
+ $(top_builddir)/src/util/libgnunetutil.la
+am_libgnunetutil_logging_la_OBJECTS = file.lo memory.lo
+libgnunetutil_logging_la_OBJECTS = \
+ $(am_libgnunetutil_logging_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
address@hidden@DEP_FILES = ./$(DEPDIR)/file.Plo ./$(DEPDIR)/memory.Plo
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libgnunetutil_logging_la_SOURCES)
+DIST_SOURCES = $(libgnunetutil_logging_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONVENIENCE_LTDL_FALSE = @CONVENIENCE_LTDL_FALSE@
+CONVENIENCE_LTDL_TRUE = @CONVENIENCE_LTDL_TRUE@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+CYGWIN_FALSE = @CYGWIN_FALSE@
+CYGWIN_TRUE = @CYGWIN_TRUE@
+DATADIR = @DATADIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+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@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GMSGFMT = @GMSGFMT@
+GNUNETGTK_CFLAGS = @GNUNETGTK_CFLAGS@
+GNUNETGTK_LIBS = @GNUNETGTK_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+GUILE = @GUILE@
+GUILE_CONFIG = @GUILE_CONFIG@
+GUILE_TOOLS = @GUILE_TOOLS@
+HAVE_CURSES_FALSE = @HAVE_CURSES_FALSE@
+HAVE_CURSES_TRUE = @HAVE_CURSES_TRUE@
+HAVE_GTK_FALSE = @HAVE_GTK_FALSE@
+HAVE_GTK_TRUE = @HAVE_GTK_TRUE@
+HAVE_GUILE_FALSE = @HAVE_GUILE_FALSE@
+HAVE_GUILE_TRUE = @HAVE_GUILE_TRUE@
+HAVE_IPV6_FALSE = @HAVE_IPV6_FALSE@
+HAVE_IPV6_TRUE = @HAVE_IPV6_TRUE@
+HAVE_MYSQL_FALSE = @HAVE_MYSQL_FALSE@
+HAVE_MYSQL_TRUE = @HAVE_MYSQL_TRUE@
+HAVE_PDCURSES_FALSE = @HAVE_PDCURSES_FALSE@
+HAVE_PDCURSES_TRUE = @HAVE_PDCURSES_TRUE@
+HAVE_SQLITE_FALSE = @HAVE_SQLITE_FALSE@
+HAVE_SQLITE_TRUE = @HAVE_SQLITE_TRUE@
+HAVE_ZLIB_FALSE = @HAVE_ZLIB_FALSE@
+HAVE_ZLIB_TRUE = @HAVE_ZLIB_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_LTDL_FALSE = @INSTALL_LTDL_FALSE@
+INSTALL_LTDL_TRUE = @INSTALL_LTDL_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+LDFLAGS = @LDFLAGS@
+LIBADD_DL = @LIBADD_DL@
+LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBLTDL = @LIBLTDL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LOCALEDIR = @LOCALEDIR@
+LTDLINCL = @LTDLINCL@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MINGW_FALSE = @MINGW_FALSE@
+MINGW_TRUE = @MINGW_TRUE@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+MSGMERGE = @MSGMERGE@
+MYSQL_CPPFLAGS = @MYSQL_CPPFLAGS@
+MYSQL_LDFLAGS = @MYSQL_LDFLAGS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_FALSE = @SOLARIS_FALSE@
+SOLARIS_TRUE = @SOLARIS_TRUE@
+SQLITE_CPPFLAGS = @SQLITE_CPPFLAGS@
+SQLITE_LDFLAGS = @SQLITE_LDFLAGS@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+XFREEBSD_FALSE = @XFREEBSD_FALSE@
+XFREEBSD_TRUE = @XFREEBSD_TRUE@
+XGETTEXT = @XGETTEXT@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+guile_available = @guile_available@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+subdirs = @subdirs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+INCLUDES = -I$(top_srcdir)/src/include
+SUBDIRS = .
+lib_LTLIBRARIES = \
+ libgnunetutil_logging.la
+
+libgnunetutil_logging_la_SOURCES = \
+ file.c memory.c
+
+# smtp.c
+libgnunetutil_logging_la_LIBADD = \
+ $(top_builddir)/src/util/libgnunetutil.la
+
+all: all-recursive
+
+.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 \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu
src/util/loggers/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/util/loggers/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
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL)
$(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL)
$(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ 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
+libgnunetutil_logging.la: $(libgnunetutil_logging_la_OBJECTS)
$(libgnunetutil_logging_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libgnunetutil_logging_la_LDFLAGS)
$(libgnunetutil_logging_la_OBJECTS) $(libgnunetutil_logging_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
+
+.c.o:
address@hidden@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
$<; \
address@hidden@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
address@hidden@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no
@AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po'
tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(COMPILE) -c $<
+
+.c.obj:
address@hidden@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
`$(CYGPATH_W) '$<'`; \
address@hidden@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
address@hidden@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no
@AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po'
tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
address@hidden@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@
$<; \
address@hidden@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f
"$(DEPDIR)/$*.Tpo"; exit 1; fi
address@hidden@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes
@AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo'
tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags);
\
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS)
ctags); \
+ done
+
+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; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed
"s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || mkdir "$(distdir)/$$subdir" \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="../$(top_distdir)" \
+ distdir="../$(distdir)/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(libdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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:
+ -rm -f $(CONFIG_CLEAN_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-recursive
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libLTLIBRARIES clean-libtool \
+ clean-recursive ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-recursive distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-libLTLIBRARIES install-man \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
+ pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-info-am uninstall-libLTLIBRARIES
+
+# 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:
Added: GNUnet/src/util/loggers/file.c
===================================================================
--- GNUnet/src/util/loggers/file.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/loggers/file.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,334 @@
+/*
+ This file is part of GNUnet.
+ (C) 2006 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 src/util/loggers/file.c
+ * @brief logging to files
+ *
+ * @author Christian Grothoff
+ */
+#include "gnunet_util_error_loggers.h"
+#include "gnunet_util.h"
+#include "platform.h"
+#define _XOPEN_SOURCE /* glibc2 needs this */
+#include <time.h>
+
+/**
+ * Context for file logger.
+ */
+typedef struct FileContext {
+
+ /**
+ * Error context for errors
+ */
+ struct GE_Context * ectx;
+
+ /**
+ * File handle used for logging.
+ */
+ FILE * handle;
+
+ /**
+ * Filename that we log to (mostly for printing
+ * error messages) and rotation.
+ */
+ char * filename;
+
+ /**
+ * Base filename (extended for log rotatation).
+ */
+ char * basename;
+
+ /**
+ * Lock.
+ */
+ Mutex lock;
+
+ /**
+ * Should we log the current date with each message?
+ * (0: NO, 1: YES)
+ */
+ int logdate;
+
+ /**
+ * Should log files be rotated? 0: no,
+ * otherwise number of days to keep.
+ */
+ int logrotate;
+
+ /**
+ * Last day of year we logged anything.
+ */
+ int yday;
+
+ /**
+ * When did we start the current logfile?
+ */
+ TIME_T logstart;
+
+} FileContext;
+
+static char *
+getDateFormat() {
+ char * datefmt;
+ char *idx;
+ char c;
+
+#if ENABLE_NLS
+ datefmt = STRDUP(nl_langinfo(D_FMT));
+#else
+ datefmt = STRDUP("%Y-%m-%d");
+#endif
+ /* Remove slashes */
+ idx = datefmt;
+ while ('\0' != (c = *idx)) {
+ if ((c == '\\') || (c == '/'))
+ *idx = '_';
+ idx++;
+ }
+ return datefmt;
+}
+
+/**
+ * Remove file if it is an old log
+ */
+static int
+removeOldLog(const char * fil,
+ const char * dir,
+ void * ptr) {
+ const FileContext * ctx = ptr;
+ struct tm t;
+ char * fullname;
+ const char * logdate;
+ const char * ret;
+ time_t curtime;
+ struct tm lcltime;
+ const char * def;
+ char * datefmt;
+
+ time(&curtime);
+ lcltime = *localtime(&curtime);
+ def = ctx->basename;
+ fullname = MALLOC(strlen(dir) + strlen(fil) + 2);
+ strcpy(fullname, dir);
+ if (dir[strlen(dir)-1] != DIR_SEPARATOR)
+ strcat(fullname, DIR_SEPARATOR_STR);
+ strcat(fullname, fil);
+ if (0 != strncmp(def,
+ fullname,
+ strlen(def))) {
+ FREE(fullname);
+ return OK;
+ }
+ logdate = &fullname[strlen(def)];
+ datefmt = getDateFormat();
+ ret = strptime(logdate, datefmt, &t);
+ FREE(datefmt);
+ if ( (ret == NULL) ||
+ (ret[0] != '\0') ) {
+ FREE(fullname);
+ return OK; /* not a logfile */
+ }
+ if (ctx->logrotate
+ + t.tm_year * 365 + t.tm_yday
+ - lcltime.tm_year * 365 - lcltime.tm_yday
+ <= 0 )
+ UNLINK(fullname); /* TODO: add ctx->fctx */
+ FREE(fullname);
+ return OK;
+}
+
+/**
+ * Get the current day of the year
+ * formatted for appending to the filename.
+ */
+static char *
+getLogFileName(struct GE_Context * fctx,
+ const char * name) {
+ time_t curtime;
+ struct tm lcltime;
+ char * datefmt;
+ char * ret;
+ char date[81];
+ size_t size;
+
+ time(&curtime);
+ lcltime = *localtime(&curtime);
+ datefmt = getDateFormat();
+#ifdef localtime_r
+ localtime_r(&curtime, &lcltime);
+#else
+ lcltime = *localtime(&curtime);
+#endif
+ /* Format current date for filename*/
+ GE_ASSERT(fctx,
+ 0 != strftime(date,
+ 80,
+ datefmt,
+ &lcltime));
+ FREE(datefmt);
+ size = strlen(name) + 82;
+ ret = MALLOC(size);
+ SNPRINTF(ret,
+ size,
+ "%s-%s",
+ name,
+ date);
+ return ret;
+}
+
+static void
+filelogger(void * cls,
+ GE_KIND kind,
+ const char * date,
+ const char * msg) {
+ FileContext * fctx = cls;
+ char * name;
+ int ret;
+
+ MUTEX_LOCK(&fctx->lock);
+ if (fctx->logrotate) {
+ name = getLogFileName(fctx->ectx,
+ fctx->basename);
+ if (0 != strcmp(name,
+ fctx->filename)) {
+ fclose(fctx->handle);
+ fctx->handle = FOPEN(name, "w+");
+ FREE(fctx->filename);
+ fctx->filename = name;
+ scanDirectory(fctx->basename,
+ &removeOldLog,
+ fctx);
+ } else {
+ FREE(name);
+ }
+ }
+ if (fctx->logdate) {
+ ret = fprintf(fctx->handle,
+ "%s: %s %s\n",
+ GE_kindToString(kind & GE_EVENTKIND),
+ date,
+ msg);
+ } else {
+ ret = fprintf(fctx->handle,
+ "%s: %s\n",
+ GE_kindToString(kind & GE_EVENTKIND),
+ msg);
+ }
+ if (ret < 0)
+ GE_LOG_STRERROR(fctx->ectx,
+ GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE | GE_BULK,
+ "fclose");
+
+ fflush(fctx->handle);
+ MUTEX_UNLOCK(&fctx->lock);
+}
+
+static void
+fileclose(void * cls) {
+ FileContext * fctx = cls;
+
+ MUTEX_DESTROY(&fctx->lock);
+ FREENONNULL(fctx->filename);
+ FREENONNULL(fctx->basename);
+ if ( (fctx->handle != stderr) &&
+ (0 != fclose(fctx->handle)) )
+ GE_LOG_STRERROR(fctx->ectx,
+ GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE | GE_BULK,
+ "fclose");
+ FREE(fctx);
+}
+
+/**
+ * Create a logger that writes events to a file.
+ *
+ * @param mask which events should be logged?
+ * @param filename which file should we log to?
+ * @param logDate should the context log event dates?
+ * @param logrotate after how many days should rotated log
+ * files be deleted (use 0 for no rotation)
+ */
+struct GE_Context *
+GE_create_context_logfile(struct GE_Context * ectx,
+ GE_KIND mask,
+ const char * filename,
+ int logDate,
+ int logrotate) {
+ FileContext * fctx;
+ FILE * fd;
+ char * name;
+ TIME_T start;
+
+ TIME(&start);
+ if (logrotate != 0) {
+ name = getLogFileName(NULL,
+ filename);
+ } else {
+ name = STRDUP(filename);
+ }
+ fd = FOPEN(name, "w+");
+ if (fd == NULL) {
+ GE_LOG_STRERROR(ectx,
+ GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE | GE_BULK,
+ "fopen");
+ FREE(name);
+ return NULL; /* ERROR! */
+ }
+ fctx = MALLOC(sizeof(FileContext));
+ fctx->ectx = ectx;
+ fctx->logdate = logDate;
+ fctx->logrotate = logrotate;
+ fctx->handle = fd;
+ fctx->filename = STRDUP(filename);
+ fctx->basename = name;
+ fctx->logstart = start;
+ MUTEX_CREATE_RECURSIVE(&fctx->lock);
+ return GE_create_context_callback(mask,
+ &filelogger,
+ fctx,
+ &fileclose);
+}
+
+
+/**
+ * Create a logger that writes events to stderr
+ *
+ * @param mask which events should be logged?
+ */
+struct GE_Context *
+GE_create_context_stderr(int logDate,
+ GE_KIND mask) {
+ FileContext * fctx;
+
+ fctx = MALLOC(sizeof(FileContext));
+ fctx->ectx = NULL;
+ fctx->logdate = logDate;
+ fctx->logrotate = 0;
+ fctx->handle = stderr;
+ fctx->filename = NULL;
+ fctx->basename = NULL;
+ fctx->logstart = 0;
+ MUTEX_CREATE_RECURSIVE(&fctx->lock);
+ return GE_create_context_callback(mask,
+ &filelogger,
+ fctx,
+ &fileclose);
+
+}
Added: GNUnet/src/util/loggers/memory.c
===================================================================
--- GNUnet/src/util/loggers/memory.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/loggers/memory.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,151 @@
+/*
+ This file is part of GNUnet.
+ (C) 2006 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 src/util/loggers/memory.c
+ * @brief logging to memory
+ *
+ * @author Christian Grothoff
+ */
+#include "gnunet_util_error_loggers.h"
+#include "gnunet_util.h"
+#include "platform.h"
+
+typedef struct GE_Message {
+ char * date;
+ char * msg;
+ GE_KIND mask;
+} GE_Message;
+
+typedef struct GE_Memory {
+ GE_Message * messages;
+ Mutex lock;
+ unsigned int maxSize;
+ unsigned int size;
+ unsigned int pos;
+} GE_Memory;
+
+static void
+memorylogger(void * cls,
+ GE_KIND kind,
+ const char * date,
+ const char * msg) {
+ GE_Memory * ctx = cls;
+ unsigned int max;
+
+ MUTEX_LOCK(&ctx->lock);
+ if (ctx->pos == ctx->size) {
+ if ( (ctx->maxSize != 0) &&
+ (ctx->size == ctx->maxSize) ) {
+ MUTEX_UNLOCK(&ctx->lock);
+ return;
+ }
+ max = ctx->pos * 2 + 16;
+ if ( (ctx->maxSize == 0) &&
+ (max > ctx->maxSize) )
+ max = ctx->maxSize;
+ GROW(ctx->messages,
+ ctx->size,
+ max);
+ }
+ ctx->messages[ctx->pos].date = STRDUP(date);
+ if (ctx->pos == ctx->maxSize-1) {
+ ctx->messages[ctx->pos].msg = STRDUP(_("Out of memory (for logging)"));
+ ctx->messages[ctx->pos].mask = GE_STATUS | GE_USER | GE_BULK;
+ } else {
+ ctx->messages[ctx->pos].msg = STRDUP(msg);
+ ctx->messages[ctx->pos].mask = kind;
+ }
+ ctx->pos++;
+ MUTEX_UNLOCK(&ctx->lock);
+}
+
+/**
+ * Create a logger that keeps events in memory (to be
+ * queried later in bulk).
+ */
+struct GE_Context *
+GE_create_context_memory(GE_KIND mask,
+ struct GE_Memory * memory) {
+ return GE_create_context_callback(mask,
+ &memorylogger,
+ memory,
+ NULL);
+}
+
+/**
+ * Create a context to log messages in memory.
+ * This is useful if we first need to capture all
+ * log messages of an operation to provide the
+ * final error in bulk to the client (i.e. as
+ * a return value, possibly over the network).
+ *
+ * @param maxSize the maximum number of messages to keep, 0 for unbounded
+ * (if more than maxSize messages are received, message number maxSize
+ * will be set to a corresponding warning)
+ */
+struct GE_Memory *
+GE_create_memory(unsigned int maxSize) {
+ GE_Memory * ret;
+
+ ret = MALLOC(sizeof(GE_Memory));
+ ret->maxSize = maxSize;
+ ret->size = 0;
+ ret->pos = 0;
+ ret->messages = NULL;
+ MUTEX_CREATE(&ret->lock);
+ return ret;
+}
+
+/**
+ * For all messages stored in the memory, call the handler.
+ * Also clears the memory.
+ */
+void GE_poll_memory(struct GE_Memory * memory,
+ GE_LogHandler handler,
+ void * ctx) {
+ int i;
+
+ MUTEX_LOCK(&memory->lock);
+ for (i=0;i<memory->pos;i++) {
+ handler(ctx,
+ memory->messages[i].mask,
+ memory->messages[i].date,
+ memory->messages[i].msg);
+ FREE(memory->messages[i].date);
+ FREE(memory->messages[i].msg);
+ }
+ memory->pos = 0;
+ MUTEX_UNLOCK(&memory->lock);
+}
+
+void GE_free_memory(struct GE_Memory * memory) {
+ int i;
+
+ MUTEX_DESTROY(&memory->lock);
+ for (i=memory->pos-1;i>=0;i--) {
+ FREE(memory->messages[i].date);
+ FREE(memory->messages[i].msg);
+ }
+ GROW(memory->messages,
+ memory->size,
+ 0);
+ FREE(memory);
+}
Added: GNUnet/src/util/loggers/smtp.c
===================================================================
--- GNUnet/src/util/loggers/smtp.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/loggers/smtp.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -0,0 +1,48 @@
+/*
+ This file is part of GNUnet.
+ (C) 2006 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 src/util/loggers/smtp.c
+ * @brief logging via email
+ * @author Christian Grothoff
+ */
+#include "gnunet_error_loging.h"
+
+#if FICTION
+/**
+ * @param address e-mail address to send the logs to
+ * @param server hostname of SMTP gateway, NULL for using local "mail" command
+ * @param port port to use for SMTP
+ * @param logDate should the date be each of the log lines?
+ * @param bulkSize for GE_BULK messages, how many lines of messages
+ * should be accumulated before an e-mail is transmitted?
+ */
+struct GE_Context *
+GE_create_context_email(struct GE_Context * ectx,
+ GE_MASK mask,
+ const char * address,
+ const char * server,
+ unsigned short port,
+ int logDate,
+ unsigned int bulkSize) {
+ return NULL;
+}
+
+#endif
Deleted: GNUnet/src/util/logging.c
===================================================================
--- GNUnet/src/util/logging.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/logging.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,527 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2001, 2002, 2004, 2005 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 util/logging.c
- * @brief basic logging mechanism
- * @author Christian Grothoff
- *
- * This file contains basic logging mechanisms, with log-levels,
- * logging to file or stderr and with or without time-prefixing.
- */
-
-#include "platform.h"
-#include "gnunet_util.h"
-#include <time.h>
-
-/**
- * Where to write log information to.
- */
-static FILE * logfile;
-
-/**
- * Current loglevel.
- */
-static LOG_Level loglevel__ = LOG_WARNING;
-
-/**
- * Lock for logging activities.
- */
-static Mutex logMutex;
-
-/**
- * Has the logging module been initialized? If not, logMutex must not
- * be used and logfile is likely NULL. This is there
- * because code may call logging before initialization.
- */
-static int bInited = NO;
-
-/**
- * Callback function for internal logging
- * (i.e. to the user interface)
- */
-static TLogProc customLog;
-
-/**
- * Highest legal log level.
- */
-static LOG_Level maxLogLevel = LOG_EVERYTHING;
-
-/**
- * Day for which the current logfile is
- * opened (tells us when we need to switch
- * to a new file).
- */
-static unsigned int lastlog;
-
-/**
- * How long to keep logs, in days
- */
-static int keepLog;
-
-/**
- * Base value for getting configuration options; either "GNUNETD" or
- * "GNUNET", depending on whether or not the code is used by the
- * deamon or a client.
- */
-static char * base;
-
-/**
- * The different loglevels.
- */
-static char * loglevels[] = {
- gettext_noop("NOTHING"),
- gettext_noop("FATAL"),
- gettext_noop("ERROR"),
- gettext_noop("FAILURE"),
- gettext_noop("WARNING"),
- gettext_noop("MESSAGE"),
- gettext_noop("INFO"),
- gettext_noop("DEBUG"),
- gettext_noop("CRON"),
- gettext_noop("EVERYTHING"),
- NULL,
-};
-
-/**
- * Context for removeOldLog
- */
-struct logfiledef {
- struct tm curtime;
- char * basename;
-};
-
-/**
- * Remove file if it is an old log
- */
-static int removeOldLog(const char * fil,
- const char * dir,
- void * ptr) {
- struct logfiledef * def = ptr;
- struct tm t;
- char * fullname;
- const char * logdate;
- const char * ret;
-
- fullname = MALLOC(strlen(dir) + strlen(fil) + 2);
- strcpy(fullname, dir);
- if (dir[strlen(dir)-1] != DIR_SEPARATOR)
- strcat(fullname, DIR_SEPARATOR_STR);
- strcat(fullname, fil);
- if (0 != strncmp(def->basename,
- fullname,
- strlen(def->basename))) {
- FREE(fullname);
- return OK;
- }
- logdate = &fullname[strlen(def->basename)];
-#if ENABLE_NLS
- {
- char *idx;
- char c;
- char *datefmt = STRDUP(nl_langinfo(D_FMT));
-
- /* Remove slashes */
- idx = datefmt;
- while((c = *idx)) {
- if(c == '\\' || c == '/')
- *idx = '_';
- idx++;
- }
-
- ret = strptime(logdate,
- datefmt,
- &t);
-
- FREE(datefmt);
- }
-#else
- ret = strptime(logdate, "%Y-%m-%d", &t);
-#endif
- if ( (ret == NULL) ||
- (ret[0] != '\0') ) {
- FREE(fullname);
- return OK; /* not a logfile */
- }
-
- if (t.tm_year*365 + t.tm_yday + keepLog
- < def->curtime.tm_year*365 + def->curtime.tm_yday)
- UNLINK(fullname);
-
- FREE(fullname);
- return OK;
-}
-
-/**
- * Open the logfile
- */
-void reopenLogFile() {
- char * logfilename;
-
- logfilename
- = getConfigurationString(base,
- "LOGFILE");
- if (logfilename != NULL) {
- char * fn;
-
- if ( (logfile != stderr) &&
- (logfile != NULL) ) {
- fclose(logfile);
- logfile = NULL;
- }
- fn = expandFileName(logfilename);
- if (keepLog) {
- char * logdir;
- char * end;
- struct logfiledef def;
- char datestr[80];
- time_t curtime;
- const char *datefmt;
- char c;
-
-#if ENABLE_NLS
- datefmt = nl_langinfo(D_FMT);
-#else
- datefmt = "%Y-%m-%d";
-#endif
- time(&curtime);
-#ifdef localtime_r
- localtime_r(&curtime, &def.curtime);
-#else
- def.curtime = *localtime(&curtime);
-#endif
- lastlog = def.curtime.tm_yday;
-
- /* Format current date for filename*/
- fn = (char *) realloc(fn, strlen(fn) + 82);
- strcat(fn, "_");
- def.basename = STRDUP(fn);
- GNUNET_ASSERT(0 != strftime(datestr,
- 80,
- datefmt,
- &def.curtime));
-
- /* Remove slashes */
- end = datestr;
- while((c = *end)) {
- if (c == '\\' || c == '/')
- *end = '_';
- end++;
- }
-
- strcat(fn, datestr);
-
- /* Remove old logs */
- logdir = STRDUP(fn);
- end = logdir + strlen(logdir);
- while (*end != DIR_SEPARATOR)
- end--;
- *end = 0;
- scanDirectory(logdir,
- &removeOldLog,
- &def);
- FREE(def.basename);
- FREE(logdir);
- }
-
- logfile = FOPEN(fn, "a+");
- if (logfile == NULL)
- logfile = stderr;
- FREE(fn);
- FREE(logfilename);
- } else
- logfile = stderr;
-}
-
-/**
- * Return the current logging level
- */
-LOG_Level getLogLevel() {
- return loglevel__;
-}
-
-/**
- * Return the logfile
- */
-void *getLogfile() {
- return logfile;
-}
-
-/**
- * Convert a textual description of a loglevel into an int.
- */
-static LOG_Level getLoglevel(const char * log) {
- int i;
- char * caplog;
-
- GNUNET_ASSERT(log != NULL);
- caplog = strdup(log);
- for (i=strlen(caplog)-1;i>=0;i--)
- caplog[i] = toupper(caplog[i]);
- i = LOG_NOTHING;
- while ( (loglevels[i] != NULL) &&
- (0 != strcmp(caplog, gettext(loglevels[i]))) &&
- (0 != strcmp(caplog, loglevels[i])) )
- i++;
- free(caplog);
- if (loglevels[i] == NULL)
- errexit(_("Invalid LOGLEVEL `%s' specified.\n"),
- log);
- return (LOG_Level) i;
-}
-
-/**
- * Re-read the loggig configuration.
- * Call on SIGHUP if the configuration file has changed.
- */
-static void resetLogging() {
- char * loglevelname;
-
- MUTEX_LOCK(&logMutex);
- if (testConfigurationString("GNUNETD",
- "_MAGIC_",
- "YES"))
- base = "GNUNETD";
- else
- base = "GNUNET";
- loglevelname
- = getConfigurationString(base,
- "LOGLEVEL");
- if (loglevelname == NULL)
- loglevelname = strdup("WARNING");
- loglevel__
- = getLoglevel(loglevelname);
- free(loglevelname);
- keepLog
- = getConfigurationInt(base,
- "KEEPLOG");
- reopenLogFile();
- MUTEX_UNLOCK(&logMutex);
-}
-
-/**
- * Initialize the logging module.
- */
-void initLogging() {
- MUTEX_CREATE_RECURSIVE(&logMutex);
-
- bInited = YES;
- registerConfigurationUpdateCallback(&resetLogging);
- resetLogging();
-}
-
-/**
- * Shutdown the logging module.
- */
-void doneLogging() {
- unregisterConfigurationUpdateCallback(&resetLogging);
- if ( (logfile != NULL) &&
- (logfile != stderr) )
- fclose(logfile);
- logfile = NULL;
- loglevel__ = 0;
- MUTEX_DESTROY(&logMutex);
- bInited = NO;
-}
-
-
-/**
- * Print the current time to logfile without linefeed
- */
-static void printTime() {
- if (logfile !=NULL) {
- char timebuf[64];
- time_t timetmp;
- struct tm * tmptr;
-
- time(&timetmp);
- tmptr = localtime(&timetmp);
- GNUNET_ASSERT(0 != strftime(timebuf,
- 64,
- "%b %d %H:%M:%S ",
- tmptr));
- fputs(timebuf,
- logfile);
- }
-}
-
-/**
- * Something went wrong, add opportunity to stop gdb at this
- * breakpoint and/or report in the logs that this happened.
- *
- * @param filename where in the code did the problem occur
- * @param linenumber where in the code did the problem occur
- */
-void breakpoint_(const char * filename,
- const int linenumber) {
- if (logfile != NULL) {
- printTime();
- FPRINTF(logfile,
- _("Failure at %s:%d.\n"),
- filename,
- linenumber);
- fflush(logfile);
- } else
- FPRINTF(stderr,
- _("Failure at %s:%d.\n"),
- filename,
- linenumber);
-}
-
-/**
- * Register an additional logging function which gets
- * called whenever GNUnet LOG()s something
- *
- * @param proc the function to register
- */
-void setCustomLogProc(TLogProc proc) {
- if (bInited)
- MUTEX_LOCK(&logMutex);
-
- if ( (customLog != NULL) &&
- (proc != NULL) ) {
- BREAK();
- }
- customLog = proc;
-
- if (bInited)
- MUTEX_UNLOCK(&logMutex);
-}
-
-/**
- * Log a debug message
- *
- * @param minLogLevel minimum level at which this message should be logged
- * @param format the string describing the error message
- */
-void LOG(LOG_Level minLogLevel,
- const char *format, ...) {
- va_list args;
- int len;
-
- if (loglevel__ < minLogLevel)
- return;
- if (minLogLevel > maxLogLevel)
- minLogLevel = maxLogLevel;
-
- if (bInited)
- MUTEX_LOCK(&logMutex);
- va_start(args, format);
- if (logfile != NULL) {
- time_t curtime;
- struct tm *lcltime;
-
- time(&curtime);
- lcltime = localtime(&curtime);
-
- if (lcltime->tm_yday != lastlog) {
- reopenLogFile();
- lastlog = lcltime->tm_yday;
- }
-
- printTime();
- if (format[0] == ' ')
- FPRINTF(logfile, "%s:", gettext(loglevels[minLogLevel]));
- else
- FPRINTF(logfile, "%s: ", gettext(loglevels[minLogLevel]));
- len = VFPRINTF(logfile, format, args);
- fflush(logfile);
- } else
- len = VFPRINTF(stderr, format, args);
- va_end(args);
- if (bInited)
- MUTEX_UNLOCK(&logMutex);
- if ( (customLog) &&
- (len >= 0) ) {
- char * txt;
-
- txt = MALLOC(len + 1);
- va_start(args, format);
- if (len != VSNPRINTF(txt, len, format, args))
- BREAK();
- va_end(args);
- customLog(txt);
- FREE(txt);
- }
-}
-
-/**
- * errexit - log an error message and exit.
- *
- * @param format the string describing the error message
- */
-void errexit(const char *format, ...) {
- va_list args;
-
- /* NO locking here, we're supposed to die,
- and we don't want to take chances on that... */
- if (logfile != NULL) {
- va_start(args, format);
- printTime();
- VFPRINTF(logfile, format, args);
- fflush(logfile);
- va_end(args);
- }
- if (logfile != stderr) {
- va_start(args, format);
-#ifdef MINGW
- AllocConsole();
-#endif
- VFPRINTF(stderr, format, args);
- va_end(args);
- }
- abort();
- exit(-1); /* just in case... */
-}
-
-void LOGHASH(size_t size,
- const void * data) {
- HashCode512 hc;
- EncName enc;
- hash(data, size, &hc);
- hash2enc(&hc, &enc);
- LOG(LOG_DEBUG,
- "%u: %s\n",
- size,
- &enc);
-}
-
-
-
-int SNPRINTF(char * buf,
- size_t size,
- const char * format,
- ...) {
- int ret;
- va_list args;
-
- va_start(args, format);
- ret = VSNPRINTF(buf,
- size,
- format,
- args);
- va_end(args);
- GNUNET_ASSERT(ret <= size);
- return ret;
-}
-
-
-
-/* end of logging.c */
Deleted: GNUnet/src/util/random.c
===================================================================
--- GNUnet/src/util/random.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/random.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,140 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2001, 2002, 2003, 2004, 2005 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 util/random.c
- * @brief functions to gather random numbers
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_util.h"
-#include "locking_gcrypt.h"
-#include <gcrypt.h>
-
-/**
- * Initialize Random number generator.
- */
-void initRAND() {
- gcry_control(GCRYCTL_DISABLE_SECMEM, 0);
- if (! gcry_check_version(GCRYPT_VERSION))
- errexit(_("libgcrypt has not the expected version (version %s is
required).\n"),
- GCRYPT_VERSION);
- srand((unsigned int)time(NULL));
- lockGcrypt();
-#ifdef gcry_fast_random_poll
- gcry_fast_random_poll ();
-#endif
- unlockGcrypt();
-}
-
-/**
- * @return a random value in the interval [0,i[.
- */
-unsigned int randomi(unsigned int i) {
- static unsigned int invokeCount;
- unsigned int ret;
-
- lockGcrypt();
- /* see http://lists.gnupg.org/pipermail/gcrypt-devel/2004-May/000613.html */
- if ( (invokeCount++ % 256) == 0) {
-#ifdef gcry_fast_random_poll
- gcry_fast_random_poll ();
-#endif
- }
- GNUNET_ASSERT(i > 0);
- ret = rand();
- gcry_randomize((unsigned char*)&ret,
- sizeof(unsigned int),
- GCRY_STRONG_RANDOM);
- unlockGcrypt();
- ret = ret % i;
- GNUNET_ASSERT((ret >= 0) && (ret < i));
- return ret;
-}
-
-/**
- * Get an array with a random permutation of the
- * numbers 0...n-1.
- * @param mode STRONG if the strong (but expensive) PRNG should be used, WEAK
otherwise
- * @param n the size of the array
- * @return the permutation array (allocated from heap)
- */
-int * permute(int mode, int n) {
- int * ret;
- int i;
- int tmp;
- unsigned int x;
- unsigned int (*prng) (unsigned int u);
-
- GNUNET_ASSERT(n>0);
- ret = (int*)MALLOC(n * sizeof(int));
- prng = (mode == STRONG) ? randomi : weak_randomi;
- for (i=0;i<n;i++)
- ret[i] = i;
- for (i=0;i<n;i++) {
- x = prng(n);
- tmp = ret[x];
- ret[x] = ret[i];
- ret[i] = tmp;
- }
- return ret;
-}
-
-/**
- * Random on unsigned 64-bit values.
- */
-unsigned long long randomi64(unsigned long long u) {
- unsigned long long ret;
-
- GNUNET_ASSERT(u > 0);
- lockGcrypt();
- gcry_randomize((unsigned char *) &ret,
- sizeof(unsigned long long),
- GCRY_STRONG_RANDOM);
- unlockGcrypt();
- return ret % u;
-}
-
-/**
- * @return a cryptographically weak random value in the interval [0,i[.
- */
-unsigned int weak_randomi(unsigned int i) {
- unsigned int ret;
- GNUNET_ASSERT(i > 0);
-
- ret = i * ((double) RANDOM() / RAND_MAX);
-
- if (ret >= i)
- ret = i - 1;
-
- return ret;
-}
-
-unsigned long long weak_randomi64(unsigned long long u) {
- unsigned long long ret;
- GNUNET_ASSERT(u > 0);
- ret = u * ((double) RANDOM() / RAND_MAX);
- if (ret >= u)
- ret = u-1;
- return ret;
-}
-
-/* end of random.c */
Modified: GNUnet/src/util/string.c
===================================================================
--- GNUnet/src/util/string.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/string.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -26,6 +26,7 @@
#include "gnunet_util.h"
#include "platform.h"
+#include <iconv.h>
#if !HAVE_STRLCPY
/**
@@ -123,5 +124,67 @@
return ret;
}
+/* ************* character conversion helpers *********** */
+/**
+ * Convert the len characters long character sequence
+ * given in input that is in the given charset
+ * to UTF-8.
+ * @return the converted string (0-terminated),
+ * if conversion fails, a copy of the orignal
+ * string is returned.
+ */
+char * convertToUtf8(const char * input,
+ size_t len,
+ const char * charset) {
+ char * ret;
+#if ENABLE_NLS
+ size_t tmpSize;
+ size_t finSize;
+ char * tmp;
+ char * itmp;
+ iconv_t cd;
+
+ cd = iconv_open("UTF-8", charset);
+ if (cd == (iconv_t) -1) {
+ ret = malloc(len+1);
+ memcpy(ret, input, len);
+ ret[len] = '\0';
+ return ret;
+ }
+ tmpSize = 3 * len + 4;
+ tmp = malloc(tmpSize);
+ itmp = tmp;
+ finSize = tmpSize;
+ if (iconv(cd,
+ (char**) &input,
+ &len,
+ &itmp,
+ &finSize) == (size_t)-1) {
+ iconv_close(cd);
+ free(tmp);
+ ret = malloc(len+1);
+ memcpy(ret, input, len);
+ ret[len] = '\0';
+ return ret;
+ }
+ ret = malloc(tmpSize - finSize + 1);
+ memcpy(ret,
+ tmp,
+ tmpSize - finSize);
+ ret[tmpSize - finSize] = '\0';
+ free(tmp);
+ iconv_close(cd);
+ return ret;
+#else
+ ret = malloc(len+1);
+ memcpy(ret, input, len);
+ ret[len] = '\0';
+ return ret;
+#endif
+}
+
+
+
+
/* end of string.c */
Deleted: GNUnet/src/util/symcipher_gcrypt.c
===================================================================
--- GNUnet/src/util/symcipher_gcrypt.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/symcipher_gcrypt.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,223 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2001, 2002, 2003, 2004, 2005 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 util/symcipher_gcrypt.c
- * @brief Symmetric encryption services.
- * @author Christian Grothoff
- * @author Ioana Patrascu
- *
- * Note that the code locks often needlessly on the gcrypt-locking api.
- * One would think that simple MPI operations should not require locking
- * (since only global operations on the random pool must be locked,
- * strictly speaking). But libgcrypt does sometimes require locking in
- * unexpected places, so the safe solution is to always lock even if it
- * is not required. The performance impact is minimal anyway.
- */
-
-#include "gnunet_util.h"
-#include "platform.h"
-#include "locking_gcrypt.h"
-#include <gcrypt.h>
-
-#define DEBUG_SYMCIPHER 0
-
-/**
- * Log an error message at log-level 'level' that indicates
- * a failure of the command 'cmd' with the message given
- * by gcry_strerror(rc).
- */
-#define LOG_GCRY(level, cmd, rc) do { LOG(level, _("`%s' failed at %s:%d with
error: %s\n"), cmd, __FILE__, __LINE__, gcry_strerror(rc)); } while(0);
-
-/**
- * Die with an error message that indicates
- * a failure of the command 'cmd' with the message given
- * by gcry_strerror(rc).
- */
-#define DIE_GCRY(cmd, rc) do { errexit(_("`%s' failed at %s:%d with error:
%s\n"), cmd, __FILE__, __LINE__, gcry_strerror(rc)); } while(0);
-
-
-/**
- * Create a new SessionKey (for AES-256).
- */
-void makeSessionkey(SESSIONKEY * key) {
- lockGcrypt();
- gcry_randomize(&key->key[0],
- SESSIONKEY_LEN,
- GCRY_STRONG_RANDOM);
- unlockGcrypt();
- key->crc32 = htonl(crc32N(key, SESSIONKEY_LEN));
-}
-
-/**
- * Encrypt a block with the public key of another
- * host that uses the same cyper.
- * @param block the block to encrypt
- * @param len the size of the block
- * @param sessionkey the key used to encrypt
- * @param iv the initialization vector to use, use INITVALUE
- * for streams.
- * @param result the output parameter in which to store the encrypted result
- * @returns the size of the encrypted block, -1 for errors
- */
-int encryptBlock(const void * block,
- unsigned short len,
- const SESSIONKEY * sessionkey,
- const INITVECTOR * iv,
- void * result) {
- gcry_cipher_hd_t handle;
- int rc;
-
- if (sessionkey->crc32 !=
- htonl(crc32N(sessionkey, SESSIONKEY_LEN))) {
- BREAK();
- return SYSERR;
- }
-#if DEBUG_SYMCIPHER
- LOG(LOG_DEBUG,
- "Encrypting block of %u bytes with key '%x%x'\n",
- len,
- ((unsigned int*)sessionkey)[0],
- ((unsigned int*)sessionkey)[1]);
-#endif
- lockGcrypt();
- rc = gcry_cipher_open(&handle,
- GCRY_CIPHER_AES256,
- GCRY_CIPHER_MODE_CFB,
- 0);
- if (rc) {
- LOG_GCRY(LOG_FAILURE, "gcry_cipher_open", rc);
- unlockGcrypt();
- return -1;
- }
- rc = gcry_cipher_setkey(handle,
- sessionkey,
- SESSIONKEY_LEN);
-
- if (rc && ((char)rc != GPG_ERR_WEAK_KEY)) {
- LOG_GCRY(LOG_FAILURE, "gcry_cipher_setkey", rc);
- gcry_cipher_close(handle);
- unlockGcrypt();
- return -1;
- }
- rc = gcry_cipher_setiv(handle,
- iv,
- sizeof(INITVECTOR));
- if (rc && ((char)rc != GPG_ERR_WEAK_KEY)) {
- LOG_GCRY(LOG_FAILURE, "gcry_cipher_setiv", rc);
- gcry_cipher_close(handle);
- unlockGcrypt();
- return -1;
- }
-
- rc = gcry_cipher_encrypt(handle,
- result,
- len,
- block,
- len);
- if (rc) {
- LOG_GCRY(LOG_FAILURE, "gcry_cipher_encrypt", rc);
- gcry_cipher_close(handle);
- unlockGcrypt();
- return -1;
- }
- gcry_cipher_close(handle);
- unlockGcrypt();
- return len;
-}
-
-/**
- * Decrypt a given block with the sessionkey.
- * @param sessionkey the key used to decrypt
- * @param block the data to decrypt, encoded as returned by encrypt
- * @param size the size of the block to decrypt
- * @param iv the initialization vector to use, use INITVALUE
- * for streams.
- * @param result address to store the result at
- * @return -1 on failure, size of decrypted block on success
- */
-int decryptBlock(const SESSIONKEY * sessionkey,
- const void * block,
- unsigned short size,
- const INITVECTOR * iv,
- void * result) {
- gcry_cipher_hd_t handle;
- int rc;
-
- if (sessionkey->crc32 !=
- htonl(crc32N(sessionkey, SESSIONKEY_LEN))) {
- BREAK();
- return SYSERR;
- }
-#if DEBUG_SYMCIPHER
- LOG(LOG_DEBUG,
- "Decrypting block of %u bytes with key '%x%x'\n",
- size,
- ((unsigned int*)sessionkey)[0],
- ((unsigned int*)sessionkey)[1]);
-#endif
- lockGcrypt();
- rc = gcry_cipher_open(&handle,
- GCRY_CIPHER_AES256,
- GCRY_CIPHER_MODE_CFB,
- 0);
- if (rc) {
- LOG_GCRY(LOG_FAILURE, "gcry_cipher_open", rc);
- unlockGcrypt();
- return -1;
- }
- rc = gcry_cipher_setkey(handle,
- sessionkey,
- SESSIONKEY_LEN);
-
- if (rc && ((char)rc != GPG_ERR_WEAK_KEY)) {
- LOG_GCRY(LOG_FAILURE, "gcry_cipher_setkey", rc);
- gcry_cipher_close(handle);
- unlockGcrypt();
- return -1;
- }
- rc = gcry_cipher_setiv(handle,
- iv,
- sizeof(INITVECTOR));
-
- if (rc && ((char)rc != GPG_ERR_WEAK_KEY)) {
- LOG_GCRY(LOG_FAILURE, "gcry_cipher_setiv", rc);
- gcry_cipher_close(handle);
- unlockGcrypt();
- return -1;
- }
-
- rc = gcry_cipher_decrypt(handle,
- result,
- size,
- block,
- size);
- if (rc) {
- LOG_GCRY(LOG_FAILURE, "gcry_cipher_decrypt", rc);
- gcry_cipher_close(handle);
- unlockGcrypt();
- return -1;
- }
- gcry_cipher_close(handle);
- unlockGcrypt();
- return size;
-}
-
-/* end of symcipher_gcrypt.c */
Deleted: GNUnet/src/util/symciphertest.c
===================================================================
--- GNUnet/src/util/symciphertest.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/symciphertest.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,129 +0,0 @@
-/**
- * SymCipher testcode.
- * @author Christian Grothoff
- * @file util/symciphertest.c
- */
-
-#include "platform.h"
-#include "gnunet_util.h"
-#include "locking_gcrypt.h"
-
-#define TESTSTRING "Hello World!"
-#define INITVALUE "InitializationVectorValue"
-
-static int testSymcipher() {
- SESSIONKEY key;
- char result[100];
- int size;
- char res[100];
-
- makeSessionkey(&key);
- size = encryptBlock(TESTSTRING,
- strlen(TESTSTRING)+1,
- &key,
- (const INITVECTOR*) INITVALUE,
- result);
- if (size == -1) {
- printf("symciphertest failed: encryptBlock returned %d\n",
- size);
- return 1;
- }
- size = decryptBlock(&key,
- result,
- size,
- (const INITVECTOR*) INITVALUE,
- res);
- if (strlen(TESTSTRING)+1
- != size) {
- printf("symciphertest failed: decryptBlock returned %d\n",
- size);
- return 1;
- }
- if (0 != strcmp(res,TESTSTRING)) {
- printf("symciphertest failed: %s != %s\n",
- res, TESTSTRING);
- return 1;
- } else
- return 0;
-}
-
-int verifyCrypto()
-{
- SESSIONKEY key;
- char *result, *res;
- int ret;
-
- unsigned char plain[] = {29, 128, 192, 253, 74, 171, 38, 187, 84, 219, 76,
76, 209, 118, 33, 249, 172, 124, 96, 9, 157, 110, 8, 215, 200, 63, 69, 230,
157, 104, 247, 164};
- unsigned char raw_key[] = {106, 74, 209, 88, 145, 55, 189, 135, 125, 180,
225, 108, 183, 54, 25, 169, 129, 188, 131, 75, 227, 245, 105, 10, 225, 15, 115,
159, 148, 184, 34, 191};
- unsigned char encrresult[] = {81, 81, 181, 234, 78, 198, 242, 124, 199, 59,
152, 213, 230, 76, 250, 135, 243, 23, 66, 130, 175, 146, 141, 172, 165, 82,
193, 236, 133, 145, 93, 37};
-
- result = MALLOC(SESSIONKEY_LEN);
- res = NULL;
- ret = 0;
-
- memcpy(key.key, raw_key, SESSIONKEY_LEN);
- key.crc32 = htonl(crc32N(&key, SESSIONKEY_LEN));
-
- if (key.crc32 != 2344502530)
- {
- printf("Static key has different CRC\n");
-
- ret = 1;
- goto error;
- }
-
- encryptBlock(plain,
- SESSIONKEY_LEN,
- &key,
- (const INITVECTOR*) "test",
- result);
-
- if (memcmp(encrresult, result, SESSIONKEY_LEN) != 0)
- {
- printf("Encrypted result wrong.\n");
-
- ret = 1;
- goto error;
- }
-
- res = MALLOC(SESSIONKEY_LEN);
-
- decryptBlock(&key,
- result,
- SESSIONKEY_LEN,
- (const INITVECTOR*) "test",
- res);
-
- if (memcmp(res, plain, SESSIONKEY_LEN) != 0)
- {
- printf("Decrypted result does not match input.\n");
-
- ret = 1;
- }
-
-error:
-
- FREE(result);
- FREENONNULL(res);
-
- return ret;
-}
-
-int main(int argc, char * argv[]) {
- int failureCount = 0;
-
- GNUNET_ASSERT(strlen(INITVALUE) > sizeof(INITVECTOR));
- initLockingGcrypt();
- failureCount += testSymcipher();
- failureCount += verifyCrypto();
- doneLockingGcrypt();
-
- if (failureCount == 0)
- return 0;
- else {
- printf("%d TESTS FAILED!\n",failureCount);
- return -1;
- }
-}
-
-/* end of symciphertest.c */
Deleted: GNUnet/src/util/vector.c
===================================================================
--- GNUnet/src/util/vector.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/vector.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,641 +0,0 @@
-/*
- This file is part of GNUnet
-
- 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 util/vector.c
- * @brief Implementation of a dynamic array
- * @author Antti Salonen, Christian Grothoff
- * @version vector.c,v 1.3 2004/05/02 20:22:52 aksalone Exp
- *
- * An implementation of a dynamic array of objects. Like an array, the
- * vector's elements are indexed, but it is also possible to
- * dynamically resize the vector by inserting and removing elements at
- * any location. The vector is implemented as a double-linked list of
- * arrays, each with a static maximum length. When one array fills up,
- * it's splitted into two half-full arrays, and so forth. With
- * functions {insert,get,remove}_last the vector can also be used as a
- * fairly efficient stack. The functions
- * get_{at,first,last,next,previous} allow traversing the vector in an
- * efficient manner, each function call taking more or less constant
- * time. Vector_get_next and Vector_get_first may only be called after
- * a call to one of vector_get_{first,last,at}, which set the vector's
- * iterator. All functions that modify the vector's contents unset the
- * iterator.
- */
-
-#include "platform.h"
-#include "gnunet_util.h"
-
-typedef struct Vector {
- unsigned int VECTOR_SEGMENT_SIZE;
- struct vector_segment_t * segmentsHead;
- struct vector_segment_t * segmentsTail;
- struct vector_segment_t * iteratorSegment;
- unsigned int iteratorIndex;
- size_t size;
-} Vector;
-
-
-typedef struct vector_segment_t {
- void ** data; /* always of size VECTOR_SEGMENT_SIZE */
- struct vector_segment_t *next;
- struct vector_segment_t *previous;
- size_t size;
-} VectorSegment;
-
-/**
- * A debug function that traverses the linked list and prints the
- * sizes of the segments. This currently isn't used.
- */
-void vectorDump(Vector *v) {
- VectorSegment *vs;
- int n;
- unsigned int sum = 0;
-
- for (vs = v->segmentsHead; vs; vs = vs->next) {
- fprintf(stderr,
- "Segment-size: %3llu / %llu [%llu...%llu]: ",
- (unsigned long long) vs->size,
- (unsigned long long) v->VECTOR_SEGMENT_SIZE,
- (unsigned long long) sum,
- (unsigned long long) (sum + vs->size - 1));
- for (n=0;n<vs->size;n++) {
- fprintf(stderr,
- "%p, ",
- vs->data[n]);
- }
- fprintf(stderr, "\n");
- sum += vs->size;
- }
- fprintf(stderr,
- "Vector size: %u\n",
- sum);
-}
-
-/**
- * Remove and return the element at given index in the segment's array. The
- * trailing pointers in the array, if any, are moved backwards to fill the gap.
- */
-static void *vectorSegmentRemoveAtIndex(VectorSegment *vs,
- int index) {
- void *rvalue = vs->data[index];
-
- while (index < vs->size) {
- vs->data[index] = vs->data[index + 1];
- index++;
- }
- return rvalue;
-}
-
-
-/**
- * Split the full segment vs into two half-full segments.
- */
-static void vectorSegmentSplit(Vector *v,
- VectorSegment *vs) {
- VectorSegment *oldNext;
- int moveCount;
-
- oldNext = vs->next;
- vs->next = MALLOC(sizeof(VectorSegment));
- vs->next->data = MALLOC(v->VECTOR_SEGMENT_SIZE * sizeof(void*));
- vs->next->previous = vs;
- vs->next->next = oldNext;
- if (NULL != oldNext)
- oldNext->previous = vs->next;
- else
- v->segmentsTail = vs->next;
- moveCount = vs->size / 2;
- memcpy(vs->next->data,
- vs->data + (vs->size - moveCount),
- moveCount * sizeof (void *));
- vs->next->size = moveCount;
- vs->size -= moveCount;
-}
-
-/**
- * Joins the given segment with the following segment. The first segment _must_
- * be empty enough to store the data of both segments.
- */
-static void vectorSegmentJoin(Vector *v,
- VectorSegment *vs) {
- VectorSegment *oldNext = vs->next->next;
-
- memcpy(vs->data + vs->size,
- vs->next->data,
- vs->next->size * sizeof (void *));
- vs->size += vs->next->size;
- FREE(vs->next->data);
- FREE(vs->next);
- vs->next = oldNext;
- if (oldNext != NULL)
- vs->next->previous = vs;
- else
- v->segmentsTail = vs;
-}
-
-/**
- * Free an empty segment, _unless_ it is the only segment.
- */
-static void vectorSegmentRemove(Vector *v,
- VectorSegment *vs) {
- if ( (vs->previous == NULL) &&
- (vs->next == NULL) )
- return;
- if (vs->previous != NULL)
- vs->previous->next = vs->next;
- else
- v->segmentsHead = vs->next;
- if (vs->next != NULL)
- vs->next->previous = vs->previous;
- else
- v->segmentsTail = vs->previous;
- FREE(vs->data);
- FREE(vs);
-}
-
-
-/**
- * Search for given index in the vector v. When the index is found, its
- * segment and relative index are written to parameters vs and segment_index.
- * If possible, an unused index at the end of a segment is returned, as this
- * is also a requirement for adding data in an empty vector.
- */
-static int vectorFindNewIndex(Vector * v,
- unsigned int index,
- VectorSegment **vs) {
- VectorSegment *segment;
- int segmentStartIndex;
-
- if (index > v->size) {
- *vs = NULL;
- return -1;
- }
- if (index <= v->size / 2) { /* empty vector included */
- segment = v->segmentsHead;
- segmentStartIndex = 0;
- while (index > segmentStartIndex + segment->size) {
- segmentStartIndex += segment->size;
- segment = segment->next;
- }
- } else { /* reverse */
- segment = v->segmentsTail;
- segmentStartIndex = v->size - segment->size;
- while (index <= segmentStartIndex) {
- segment = segment->previous;
- segmentStartIndex -= segment->size;
- }
- }
- *vs = segment;
- return index - segmentStartIndex;
-}
-
-
-/**
- * Find the segment and segmentIndex of the element
- * with the given index.
- */
-static int vectorFindIndex(Vector *v,
- unsigned int index,
- VectorSegment **vs) {
- VectorSegment *segment;
- int segmentStartIndex;
-
- if (index >= v->size) {
- *vs = NULL;
- return -1;
- }
- if (index < v->size / 2) {
- segment = v->segmentsHead;
- segmentStartIndex = 0;
- while (index >= segmentStartIndex + segment->size) {
- segmentStartIndex += segment->size;
- segment = segment->next;
- }
- } else {
- segment = v->segmentsTail;
- segmentStartIndex = v->size - segment->size;
- while (index < segmentStartIndex) {
- segment = segment->previous;
- segmentStartIndex -= segment->size;
- }
- }
- *vs = segment;
- return index - segmentStartIndex;
-}
-
-
-/*
- * Traverse the vector looking for a given object. When found, set the pointer
- * pointed to by vs to point to the object's segment and the integer pointed
- * to by segmentIndex to the object's index in the segment. If the object is
- * not found, *vs is set to NULL.
- */
-static void vectorFindObject(Vector *v,
- void *object,
- VectorSegment **vs,
- int *segmentIndex) {
- VectorSegment *segment;
- int i;
-
- segment = v->segmentsHead;
- while (NULL != segment) {
- for (i=0;i<segment->size;i++) {
- if (segment->data[i] == object) {
- *vs = segment;
- *segmentIndex = i;
- return;
- }
- }
- segment = segment->next;
- }
- *vs = NULL;
-}
-
-
-/**
- * Allocate a new vector structure with a single empty data segment.
- */
-Vector * vectorNew(unsigned int vss) {
- Vector *rvalue;
-
- if (vss < 2)
- return NULL; /* invalid! */
- rvalue = MALLOC(sizeof (Vector));
- rvalue->VECTOR_SEGMENT_SIZE = vss;
- rvalue->size = 0;
- rvalue->segmentsHead = MALLOC(sizeof(VectorSegment));
- rvalue->segmentsHead->data = MALLOC(sizeof(void*)*vss);
- rvalue->segmentsTail = rvalue->segmentsHead;
- rvalue->segmentsHead->next = NULL;
- rvalue->segmentsHead->previous = NULL;
- rvalue->segmentsHead->size = 0;
- rvalue->iteratorSegment = NULL;
- rvalue->iteratorIndex = 0;
- return rvalue;
-}
-
-/**
- * Free vector structure including its data segments, but _not_ including the
- * stored void pointers. It is the user's responsibility to empty the vector
- * when necessary to avoid memory leakage.
- */
-void vectorFree(Vector *v) {
- VectorSegment * vs;
- VectorSegment * vsNext;
-
- vs = v->segmentsHead;
- while (vs != NULL) {
- vsNext = vs->next;
- FREE(vs->data);
- FREE(vs);
- vs = vsNext;
- }
- FREE(v);
-}
-
-/**
- * Return the size of the vector.
- */
-size_t vectorSize(Vector *v) {
- return v->size;
-}
-
-/**
- * Insert a new element in the vector at given index. The return value is
- * OK on success, SYSERR if the index is out of bounds.
- */
-int vectorInsertAt(Vector *v,
- void *object,
- unsigned int index) {
- VectorSegment *segment;
- int segmentIndex;
- int i;
-
- if (index > v->size)
- return SYSERR;
- v->iteratorSegment = NULL;
- segmentIndex = vectorFindNewIndex(v, index, &segment);
- if (segmentIndex == -1)
- return SYSERR;
- for (i = segment->size; i > segmentIndex; i--)
- segment->data[i] = segment->data[i - 1];
- segment->data[segmentIndex] = object;
- v->size++;
- segment->size++;
- if (segment->size == v->VECTOR_SEGMENT_SIZE)
- vectorSegmentSplit(v, segment);
- return OK;
-}
-
-/**
- * Insert a new element at the end of the vector.
- */
-void vectorInsertLast(Vector *v, void *object) {
- v->iteratorSegment = NULL;
- v->segmentsTail->data[v->segmentsTail->size++] = object;
- if (v->segmentsTail->size == v->VECTOR_SEGMENT_SIZE)
- vectorSegmentSplit(v, v->segmentsTail);
- v->size++;
-}
-
-/**
- * Return the element at given index in the vector or NULL if the index is out
- * of bounds. The iterator is set to point to the returned element.
- */
-void * vectorGetAt(Vector *v,
- unsigned int index) {
- int ret;
- if ( (index < 0) || (index >= v->size) )
- return NULL;
- ret = vectorFindIndex(v,
- index,
- &v->iteratorSegment);
- if (ret == -1)
- return NULL;
- v->iteratorIndex = ret;
- return v->iteratorSegment->data[ret];
-}
-
-/**
- * Return the first element in the vector, whose index is 0, or NULL if the
- * vector is empty. The iterator of the vector is set to point to the first
- * element.
- */
-void * vectorGetFirst(Vector *v) {
- if (v->size == 0)
- return NULL;
- v->iteratorSegment = v->segmentsHead;
- v->iteratorIndex = 0;
- return v->iteratorSegment->data[0];
-}
-
-/**
- * Return the last element in the vector or NULL if the vector is
- * empty. The iterator of the vector is set to the last element.
- */
-void * vectorGetLast(Vector *v) {
- if (v->size == 0)
- return NULL;
- v->iteratorSegment = v->segmentsTail;
- v->iteratorIndex = v->segmentsTail->size-1;
- return v->segmentsTail->data[v->iteratorIndex];
-}
-
-/**
- * Return the next element in the vector, as called after vector_get_at() or
- * vector_get_first(). The return value is NULL if there are no more elements
- * in the vector or if the iterator has not been set.
- */
-void * vectorGetNext(Vector *v) {
- if (v->iteratorSegment == NULL)
- return NULL;
- if (++v->iteratorIndex >= v->iteratorSegment->size) {
- if (v->iteratorSegment == v->segmentsTail) {
- v->iteratorSegment = NULL;
- return NULL;
- } else {
- v->iteratorSegment = v->iteratorSegment->next;
- v->iteratorIndex = 0;
- }
- }
- return v->iteratorSegment->data[v->iteratorIndex];
-}
-
-/**
- * Return the previous element in the vector, as called after vector_get_at()
- * or vector_get_last(). The return value is NULL if there are no more
- * elements in the vector or if the iterator has not been set.
- */
-void * vectorGetPrevious(Vector * v) {
- if (v->iteratorSegment == NULL)
- return NULL;
- if (--v->iteratorIndex == -1) {
- if (v->iteratorSegment == v->segmentsHead) {
- v->iteratorSegment = 0;
- return NULL;
- } else {
- v->iteratorSegment = v->iteratorSegment->previous;
- v->iteratorIndex = v->iteratorSegment->size - 1;
- }
- }
- return v->iteratorSegment->data[v->iteratorIndex];
-}
-
-/**
- * Delete and return the element at given index. NULL is returned if index is
- * out of bounds.
- */
-void * vectorRemoveAt(Vector *v,
- unsigned int index) {
- VectorSegment * segment;
- int segmentIndex;
- void *rvalue;
-
- if (index >= v->size)
- return NULL;
- v->iteratorSegment = NULL;
- segmentIndex = vectorFindIndex(v, index, &segment);
- if (segmentIndex == -1)
- return NULL;
- rvalue = vectorSegmentRemoveAtIndex(segment,
- segmentIndex);
- /* If the segment ends empty remove it, otherwise
- try to join it with its neighbors. */
- if (--segment->size == 0)
- vectorSegmentRemove(v, segment);
- else if (segment->next &&
- segment->size + segment->next->size < v->VECTOR_SEGMENT_SIZE)
- vectorSegmentJoin(v, segment);
- else if (segment->previous &&
- segment->size + segment->previous->size < v->VECTOR_SEGMENT_SIZE)
- vectorSegmentJoin(v, segment->previous);
- v->size--;
- return rvalue;
-}
-
-/**
- * Delete and return the last element in the vector, or NULL if the vector
- * is empty.
- */
-void *vectorRemoveLast (Vector *v) {
- void *rvalue;
-
- if (v->size == 0)
- return NULL;
- v->iteratorSegment = NULL;
- rvalue = v->segmentsTail->data[v->segmentsTail->size - 1];
- /* If the segment ends empty remove it, otherwise join it if necessary. */
- if (--v->segmentsTail->size == 0)
- vectorSegmentRemove(v, v->segmentsTail);
- else if ( (v->segmentsTail->previous != NULL) &&
- (v->segmentsTail->size + v->segmentsTail->previous->size
- < v->VECTOR_SEGMENT_SIZE) )
- vectorSegmentJoin (v, v->segmentsTail->previous);
- v->size--;
- return rvalue;
-}
-
-/**
- * Delete and return given object from the vector, or return NULL if the object
- * is not found.
- */
-void * vectorRemoveObject(Vector *v, void *object) {
- VectorSegment *segment;
- int segmentIndex;
- void * rvalue;
-
- v->iteratorSegment = NULL;
- vectorFindObject(v, object, &segment, &segmentIndex);
- if (segment == NULL)
- return NULL;
- rvalue = vectorSegmentRemoveAtIndex(segment, segmentIndex);
- /* If the segment ends empty remove it, otherwise join it if necessary. */
- if (--segment->size == 0)
- vectorSegmentRemove (v, segment);
- else if ( (segment->next != NULL) &&
- (segment->size + segment->next->size < v->VECTOR_SEGMENT_SIZE) )
- vectorSegmentJoin (v, segment);
- else if ( (segment->previous != NULL) &&
- (segment->size + segment->previous->size < v->VECTOR_SEGMENT_SIZE) )
- vectorSegmentJoin (v, segment->previous);
- v->size--;
- return rvalue;
-}
-
-/**
- * Set the given index in the vector. The old value of the index is
- * returned, or NULL if the index is out of bounds.
- */
-void *vectorSetAt (Vector *v,
- void *object,
- unsigned int index) {
- VectorSegment *segment;
- int segmentIndex;
- void *rvalue;
-
- if (index >= v->size)
- return NULL;
- v->iteratorSegment = NULL;
- segmentIndex = vectorFindIndex(v, index, &segment);
- if (segmentIndex == -1)
- return NULL;
- rvalue = segment->data[segmentIndex];
- segment->data[segmentIndex] = object;
- return rvalue;
-}
-
-
-/**
- * Set the index occupied by the given object to point to the new object.
- * The old object is returned, or NULL if it's not found.
- */
-void *vectorSetObject(Vector *v,
- void *object,
- void *oldObject) {
- VectorSegment *segment;
- int segmentIndex;
- void *rvalue;
-
- v->iteratorSegment = NULL;
- vectorFindObject (v, oldObject, &segment, &segmentIndex);
- if (segment == NULL)
- return NULL;
- rvalue = segment->data[segmentIndex];
- segment->data[segmentIndex] = object;
- return rvalue;
-}
-
-
-/**
- * Swaps the contents of index1 and index2. Return value is OK
- * on success, SYSERR if either index is out of bounds.
- */
-int vectorSwap(Vector *v,
- unsigned int index1,
- unsigned int index2) {
- VectorSegment * segment1;
- VectorSegment * segment2;
- int segmentIndex1;
- int segmentIndex2;
- void *temp;
-
- if ( (index1 >= v->size) ||
- (index2 >= v->size) )
- return SYSERR;
- v->iteratorSegment= NULL;
- segmentIndex1 = vectorFindIndex(v, index1, &segment1);
- segmentIndex2 = vectorFindIndex(v, index2, &segment2);
- if( (segmentIndex1 == -1) ||
- (segmentIndex2 == -1) )
- return SYSERR;
- temp = segment1->data[segmentIndex1];
- segment1->data[segmentIndex1] = segment2->data[segmentIndex2];
- segment2->data[segmentIndex2] = temp;
- return OK;
-}
-
-/**
- * Return the index of given element or -1 if the element is not found.
- */
-unsigned int vectorIndexOf(Vector *v,
- void *object) {
- VectorSegment * segment;
- unsigned int i;
- unsigned int segmentStartIndex;
-
- segmentStartIndex = 0;
- segment = v->segmentsHead;
- while (NULL != segment) {
- for (i = 0; i < segment->size; i++)
- if (segment->data[i] == object)
- return segmentStartIndex + i;
- segmentStartIndex += segment->size;
- segment = segment->next;
- }
- return (unsigned int) -1;
-}
-
-
-/*
- * Return the data stored in the vector as a single dynamically allocated
- * array of (void *), which must be free(3)d by the user. Use the functions
- * get_{at,first,last,next,previous} instead, unless you really need to access
- * everything in the vector as fast as possible.
- */
-void ** vectorElements (Vector *v) {
- void **rvalue;
- VectorSegment *vs;
- size_t i = 0;
-
- rvalue = xmalloc_unchecked_(v->size * sizeof (void *),
- __FILE__,
- __LINE__);
- for (vs = v->segmentsHead; vs; vs = vs->next) {
- memcpy (rvalue + i,
- vs->data,
- vs->size * sizeof (void *));
- i += vs->size;
- }
- return rvalue;
-}
-
-
-
-/* end of vector.c */
Deleted: GNUnet/src/util/vectortest.c
===================================================================
--- GNUnet/src/util/vectortest.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/vectortest.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,144 +0,0 @@
-/*
- This file is part of GNUnet
-
- 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.
-*/
-
-/**
- * This is a testcase for the vector, waiting to be extended.
- */
-
-#include "platform.h"
-#include "gnunet_util.h"
-
-#define DUMP(v) fprintf(stderr, "At %d: \n", __LINE__); vectorDump(v);
-
-static int test(int size) {
- struct Vector * v;
-
- v = vectorNew(size);
- if (0 != vectorSize(v))
- { DUMP(v); return 1; }
- if (OK != vectorInsertAt(v, "first", 0))
- { DUMP(v); return 1; }
- if (OK == vectorInsertAt(v, "not", 2))
- { DUMP(v); return 1; }
- if (OK != vectorInsertAt(v, "zero", 0))
- { DUMP(v); return 1; }
- if (OK != vectorInsertAt(v, "second", 2))
- { DUMP(v); return 1; }
- vectorInsertLast(v, "third");
- if (4 != vectorSize(v))
- { DUMP(v); return 1; }
- if (0 != strcmp(vectorGetAt(v, 1), "first"))
- { DUMP(v); return 1; }
- if (0 != strcmp(vectorGetAt(v, 3), "third"))
- { DUMP(v); return 1; }
- if (0 != strcmp(vectorGetAt(v, 0), "zero"))
- { DUMP(v); return 1; }
- if (0 != strcmp(vectorGetFirst(v), "zero"))
- { DUMP(v); return 1; }
- if (0 != strcmp(vectorGetLast(v), "third"))
- { DUMP(v); return 1; }
- if (0 != strcmp(vectorRemoveAt(v, 1), "first"))
- { DUMP(v); return 1; }
- if (0 != strcmp(vectorGetAt(v, 1), "second"))
- { DUMP(v); return 1; }
- if (NULL != vectorRemoveAt(v, 3))
- { DUMP(v); return 1; }
- if (3 != vectorSize(v))
- { DUMP(v); return 1; }
- if (0 != strcmp(vectorRemoveAt(v, 1), "second"))
- { DUMP(v); return 1; }
- if (0 != strcmp(vectorRemoveObject(v, "third"), "third"))
- { DUMP(v); return 1; }
- if (NULL != vectorRemoveObject(v, "third"))
- { DUMP(v); return 1; }
- if (0 != strcmp(vectorRemoveLast(v), "zero"))
- { DUMP(v); return 1; }
- if (0 != vectorSize(v))
- { DUMP(v); return 1; }
- if (NULL != vectorRemoveLast(v))
- { DUMP(v); return 1; }
- if (0 != vectorSize(v))
- { DUMP(v); return 1; }
- vectorFree(v);
- return 0;
-}
-
-static int test2(int size) {
- long i;
- struct Vector * v;
-
- v = vectorNew(size);
-
- for (i=0;i<500;i++)
- if (OK != vectorInsertAt(v, (void*)i, 0))
- { DUMP(v); return 1; }
- if (500 != vectorSize(v))
- { DUMP(v); return 1; }
- for (i=0;i<500;i++)
- if (499 - i != (long) vectorGetAt(v, i))
- { DUMP(v); return 1; }
- if (499 != (long) vectorGetFirst(v))
- { DUMP(v); return 1; }
- for (i=498;i>=0;i--)
- if (i != (long) vectorGetNext(v))
- { DUMP(v); return 1; }
-
- if (499 != (long) vectorGetFirst(v))
- { DUMP(v); return 1; }
- for (i=498;i>=250;i--)
- if (i != (long) vectorGetNext(v))
- { DUMP(v); return 1; }
- for (i=251;i<499;i++)
- if (i != (long) vectorGetPrevious(v))
- { DUMP(v); return 1; }
-
- vectorFree(v);
- return 0;
-}
-
-
-int main(int argc,
- char * argv[]) {
- if (NULL != vectorNew(0))
- { printf("At %d\n", __LINE__); return 1; }
- if (NULL != vectorNew(1))
- { printf("At %d\n", __LINE__); return 1; }
- if (test(2) != 0)
- { printf("At %d\n", __LINE__); return 1; }
- if (test(3) != 0)
- { printf("At %d\n", __LINE__); return 1; }
- if (test(4) != 0)
- { printf("At %d\n", __LINE__); return 1; }
- if (test(128) != 0)
- { printf("At %d\n", __LINE__); return 1; }
- if (test(65536) != 0)
- { printf("At %d\n", __LINE__); return 1; }
- if (test(2*65536) != 0)
- { printf("At %d\n", __LINE__); return 1; }
-
- if (test2(2) != 0)
- { printf("At %d\n", __LINE__); return 1; }
- if (test2(3) != 0)
- { printf("At %d\n", __LINE__); return 1; }
- if (test2(4) != 0)
- { printf("At %d\n", __LINE__); return 1; }
- if (test2(128) != 0)
- { printf("At %d\n", __LINE__); return 1; }
- return 0;
-}
Deleted: GNUnet/src/util/weakkeytest.c
===================================================================
--- GNUnet/src/util/weakkeytest.c 2006-06-15 16:42:32 UTC (rev 3010)
+++ GNUnet/src/util/weakkeytest.c 2006-06-15 16:49:28 UTC (rev 3011)
@@ -1,206 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2003, 2004, 2005 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.
-
-*/
-
-/**
- * SymCipher weak key testcode.
- * @author Krista Bennett
- * @author Christian Grothoff
- * @file test/weakkeytest.c
- */
-
-#include "platform.h"
-#include "gnunet_util.h"
-#include "locking_gcrypt.h"
-#include <gcrypt.h>
-
-#define MAX_WEAK_KEY_TRIALS 100000
-#define GENERATE_WEAK_KEYS NO
-#define WEAK_KEY_TESTSTRING "I hate weak keys."
-
-static void printWeakKey(SESSIONKEY* key) {
- int i;
- for (i = 0; i < SESSIONKEY_LEN; i++) {
- printf("%x ",
- (int)(key->key[i]));
- }
-}
-
-static int testWeakKey() {
- char result[100];
- char res[100];
- int size;
- SESSIONKEY weak_key;
- INITVECTOR INITVALUE;
-
- memset(&INITVALUE, 42, sizeof(INITVECTOR));
- /* sorry, this is not a weak key -- I don't have
- any at the moment! */
- weak_key.key[0]= (char)(0x4c);
- weak_key.key[1]= (char)(0x31);
- weak_key.key[2]= (char)(0xc6);
- weak_key.key[3]= (char)(0x2b);
- weak_key.key[4]= (char)(0xc1);
- weak_key.key[5]= (char)(0x5f);
- weak_key.key[6]= (char)(0x4d);
- weak_key.key[7]= (char)(0x1f);
- weak_key.key[8]= (char)(0x31);
- weak_key.key[9]= (char)(0xaa);
- weak_key.key[10]= (char)(0x12);
- weak_key.key[11]= (char)(0x2e);
- weak_key.key[12]= (char)(0xb7);
- weak_key.key[13]= (char)(0x82);
- weak_key.key[14]= (char)(0xc0);
- weak_key.key[15]= (char)(0xb6);
- weak_key.key[16]= (char)(0x4d);
- weak_key.key[17]= (char)(0x1f);
- weak_key.key[18]= (char)(0x31);
- weak_key.key[19]= (char)(0xaa);
- weak_key.key[20]= (char)(0x4c);
- weak_key.key[21]= (char)(0x31);
- weak_key.key[22]= (char)(0xc6);
- weak_key.key[23]= (char)(0x2b);
- weak_key.key[24]= (char)(0xc1);
- weak_key.key[25]= (char)(0x5f);
- weak_key.key[26]= (char)(0x4d);
- weak_key.key[27]= (char)(0x1f);
- weak_key.key[28]= (char)(0x31);
- weak_key.key[29]= (char)(0xaa);
- weak_key.key[30]= (char)(0xaa);
- weak_key.key[31]= (char)(0xaa);
- /* memset(&weak_key, 0, 32); */
- weak_key.crc32 = htonl(crc32N(&weak_key,
- SESSIONKEY_LEN));
-
- size = encryptBlock(WEAK_KEY_TESTSTRING,
- strlen(WEAK_KEY_TESTSTRING)+1,
- &weak_key,
- &INITVALUE,
- result);
-
- if (size == -1) {
- BREAK();
- return 1;
- }
-
- size = decryptBlock(&weak_key,
- result,
- size,
- &INITVALUE,
- res);
-
- if ((strlen(WEAK_KEY_TESTSTRING)+1) != size) {
- BREAK();
- return 1;
- }
- if (0 != strcmp(res,
- WEAK_KEY_TESTSTRING)) {
- BREAK();
- return 1;
- } else
- return 0;
-}
-
-static int getWeakKeys() {
- SESSIONKEY sessionkey;
- int number_of_weak_keys = 0;
- int number_of_runs;
-
- gcry_cipher_hd_t handle;
- int rc;
-
- for (number_of_runs = 0; number_of_runs < MAX_WEAK_KEY_TRIALS;
- number_of_runs++) {
-
- if (number_of_runs % 1000 == 0)
- fprintf(stderr, ".");
- /*printf("Got to run number %d.\n", number_of_runs);*/
- makeSessionkey(&sessionkey);
-
- rc = gcry_cipher_open(&handle,
- GCRY_CIPHER_AES256,
- GCRY_CIPHER_MODE_CFB,
- 0);
-
- if (rc) {
- printf("testweakkey: gcry_cipher_open failed on trial %d. %s\n",
- number_of_runs,
- gcry_strerror(rc));
- rc = 0;
- continue;
- }
-
- rc = gcry_cipher_setkey(handle,
- &sessionkey,
- SESSIONKEY_LEN);
-
- if ((char)rc == GPG_ERR_WEAK_KEY) {
- printf("\nWeak key (in hex): ");
- printWeakKey(&sessionkey);
- printf("\n");
- number_of_weak_keys++;
- }
- else if (rc) {
- printf("\nUnexpected error generating keys. Error is %s\n",
- gcry_strerror(rc));
- }
-
- gcry_cipher_close(handle);
-
- }
-
- return number_of_weak_keys;
-}
-
-void initRAND();
-
-int main(int argc, char * argv[]) {
- int weak_keys;
- int ret;
-
- if (1)
- return 0;
-
- initLockingGcrypt();
- initRAND();
-
- if (GENERATE_WEAK_KEYS) {
- weak_keys = getWeakKeys();
-
- if (weak_keys == 0) {
- printf("\nNo weak keys found in %d runs.\n",
- MAX_WEAK_KEY_TRIALS);
- }
- else {
- printf("\n%d weak keys found in %d runs.\n",
- weak_keys,
- MAX_WEAK_KEY_TRIALS);
- }
- }
-
- if (testWeakKey() == 0)
- ret = 0;
- else
- ret = -1;
- doneLockingGcrypt();
- return ret;
-}
-
-/* end of weakkeytest.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3011 - in GNUnet: . src/include src/util src/util/config src/util/config/.deps src/util/config/.libs src/util/config_impl src/util/config_impl/.deps src/util/config_impl/.libs src/util/containers src/util/containers/.deps src/util/crypto src/util/crypto/.deps src/util/error src/util/error/.deps src/util/error/.libs src/util/loggers src/util/loggers/.deps src/util/loggers/.libs,
grothoff <=