#! /bin/sh
-# From configure.ac Revision: 1.4 .
+# From configure.ac Revision: 1.5 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for GRAS 0.0.040304.
#
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS HTML_DIR PKG_CONFIG ENABLE_GTK_DOC_TRUE ENABLE_GTK_DOC_FALSE GTK_DOC_USE_LIBTOOL_TRUE GTK_DOC_USE_LIBTOOL_FALSE ACI_CACHE_PROG aci_module_desc_XML aci_pkg_config_XML HAVE_XML CFLAGS_XML LIBS_XML aci_module_desc_SimGrid aci_pkg_prefix_SimGrid aci_pkg_inc_SimGrid aci_pkg_lib_SimGrid aci_pkg_extra_SimGrid HAVE_SimGrid CFLAGS_SimGrid LIBS_SimGrid MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT cflags_set BASH WARNING LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS HTML_DIR PKG_CONFIG ENABLE_GTK_DOC_TRUE ENABLE_GTK_DOC_FALSE GTK_DOC_USE_LIBTOOL_TRUE GTK_DOC_USE_LIBTOOL_FALSE ACI_CACHE_PROG aci_module_desc_XML aci_pkg_config_XML HAVE_XML CFLAGS_XML LIBS_XML aci_module_desc_SimGrid aci_pkg_prefix_SimGrid aci_pkg_inc_SimGrid aci_pkg_lib_SimGrid aci_pkg_extra_SimGrid HAVE_SimGrid CFLAGS_SimGrid LIBS_SimGrid MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT cflags_set BASH WARNING LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
build static libraries [default=yes]
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
- --disable-dependency-tracking Speeds up one-time builds
- --enable-dependency-tracking Do not reject slow dependency extractors
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
--disable-libtool-lock avoid locking (might break parallel builds)
--enable-gtk-doc use gtk-doc to build documentation default=no
- --enable-maintainer-mode enable make rules and dependencies not useful
- (and sometimes confusing) to the casual installer
+ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer
--enable-compile-warnings=no/minimum/yes Turn on compiler warnings.
--enable-iso-c Try to warn if code is not ISO C
ac_config_headers="$ac_config_headers src/gras_config.h"
-am__api_version="1.7"
+am__api_version="1.8"
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
rm conftest.sed
-
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
fi
+if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ # Keeping the `.' argument allows $(mkdir_p) to be used without
+ # argument. Indeed, we sometimes output rules like
+ # $(mkdir_p) $(somedir)
+ # where $(somedir) is conditionally defined.
+ # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more
+ # expensive solution, as it forces Make to start a sub-shell.)
+ mkdir_p='mkdir -p -- .'
+else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ for d in ./-p ./--version;
+ do
+ test -d $d && rmdir $d
+ done
+ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+ if test -f "$ac_aux_dir/mkinstalldirs"; then
+ mkdir_p='$(mkinstalldirs)'
+ else
+ mkdir_p='$(install_sh) -d'
+ fi
+fi
+
for ac_prog in gawk mawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
fi
rmdir .tst 2>/dev/null
- # test to see if srcdir already configured
+# test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" &&
test -f $srcdir/config.status; then
{ { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
- : > sub/conftst$i.h
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 3661 "configure"' > conftest.$ac_ext
+ echo '#line 3687 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
- : > sub/conftst$i.h
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
# Provide some information about the compiler.
-echo "$as_me:5218:" \
+echo "$as_me:5246:" \
"checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6250: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6278: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6254: \$? = $ac_status" >&5
+ echo "$as_me:6282: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6483: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6511: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6487: \$? = $ac_status" >&5
+ echo "$as_me:6515: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6543: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6571: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:6547: \$? = $ac_status" >&5
+ echo "$as_me:6575: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 8718 "configure"
+#line 8746 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 8816 "configure"
+#line 8844 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:10993: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11021: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:10997: \$? = $ac_status" >&5
+ echo "$as_me:11025: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:11053: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11081: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:11057: \$? = $ac_status" >&5
+ echo "$as_me:11085: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 12407 "configure"
+#line 12435 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 12505 "configure"
+#line 12533 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13332: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13360: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:13336: \$? = $ac_status" >&5
+ echo "$as_me:13364: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13392: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13420: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:13396: \$? = $ac_status" >&5
+ echo "$as_me:13424: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15424: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15452: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15428: \$? = $ac_status" >&5
+ echo "$as_me:15456: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15657: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15685: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15661: \$? = $ac_status" >&5
+ echo "$as_me:15689: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15717: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15745: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:15721: \$? = $ac_status" >&5
+ echo "$as_me:15749: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 17892 "configure"
+#line 17920 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 17990 "configure"
+#line 18018 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
- : > sub/conftst$i.h
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
WARNING="This file is generated, do not edit"
- ac_config_files="$ac_config_files Makefile src/Makefile src/include/Makefile src/include/modules/Makefile src/base/Makefile src/base/Tests/Makefile src/base/Tests/gs_example src/base/Tests/run_tests src/modules/Makefile src/examples/Makefile src/examples/ping/Makefile src/examples/bandwidth/Makefile src/examples/saturate/Makefile src/examples/alnem/Makefile doc/Makefile"
+ ac_config_files="$ac_config_files Makefile src/Makefile src/include/Makefile src/include/modules/Makefile src/base/Makefile src/base/Tests/Makefile src/base/Tests/run_tests src/base/Tests/gs_example src/base/Tests/trp_tcp_usage src/base/Tests/trp_file_usage src/modules/Makefile src/examples/Makefile src/examples/ping/Makefile src/examples/bandwidth/Makefile src/examples/saturate/Makefile src/examples/alnem/Makefile doc/Makefile"
cat >confcache <<\_ACEOF
"src/include/modules/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/include/modules/Makefile" ;;
"src/base/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/base/Makefile" ;;
"src/base/Tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/base/Tests/Makefile" ;;
- "src/base/Tests/gs_example" ) CONFIG_FILES="$CONFIG_FILES src/base/Tests/gs_example" ;;
"src/base/Tests/run_tests" ) CONFIG_FILES="$CONFIG_FILES src/base/Tests/run_tests" ;;
+ "src/base/Tests/gs_example" ) CONFIG_FILES="$CONFIG_FILES src/base/Tests/gs_example" ;;
+ "src/base/Tests/trp_tcp_usage" ) CONFIG_FILES="$CONFIG_FILES src/base/Tests/trp_tcp_usage" ;;
+ "src/base/Tests/trp_file_usage" ) CONFIG_FILES="$CONFIG_FILES src/base/Tests/trp_file_usage" ;;
"src/modules/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/modules/Makefile" ;;
"src/examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/examples/Makefile" ;;
"src/examples/ping/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/examples/ping/Makefile" ;;
s,@STRIP@,$STRIP,;t t
s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
+s,@mkdir_p@,$mkdir_p,;t t
s,@AWK@,$AWK,;t t
s,@SET_MAKE@,$SET_MAKE,;t t
s,@am__leading_dot@,$am__leading_dot,;t t
# Run the commands associated with the file.
case $ac_file in
Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
- test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
- test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+ test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+ test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+ test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
+ test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
src/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
- test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
- test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+ test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+ test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+ test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
+ test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
src/include/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
- test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
- test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+ test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+ test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+ test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
+ test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
src/include/modules/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
- test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
- test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+ test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+ test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+ test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
+ test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
src/base/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
- test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
- test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+ test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+ test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+ test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
+ test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
src/base/Tests/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
- test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
- test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
- src/base/Tests/gs_example ) ( cd src/include ; test -e gras || ln -s . gras )
- test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
- test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+ test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+ test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+ test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
+ test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
src/base/Tests/run_tests ) ( cd src/include ; test -e gras || ln -s . gras )
- test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
- test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+ test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+ test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+ test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
+ test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+ src/base/Tests/gs_example ) ( cd src/include ; test -e gras || ln -s . gras )
+ test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+ test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+ test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
+ test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+ src/base/Tests/trp_tcp_usage ) ( cd src/include ; test -e gras || ln -s . gras )
+ test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+ test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+ test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
+ test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+ src/base/Tests/trp_file_usage ) ( cd src/include ; test -e gras || ln -s . gras )
+ test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+ test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+ test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
+ test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
src/modules/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
- test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
- test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+ test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+ test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+ test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
+ test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
src/examples/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
- test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
- test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+ test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+ test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+ test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
+ test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
src/examples/ping/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
- test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
- test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+ test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+ test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+ test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
+ test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
src/examples/bandwidth/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
- test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
- test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+ test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+ test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+ test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
+ test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
src/examples/saturate/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
- test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
- test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+ test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+ test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+ test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
+ test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
src/examples/alnem/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
- test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
- test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+ test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+ test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+ test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
+ test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
doc/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
- test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
- test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+ test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+ test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+ test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
+ test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
esac
done
_ACEOF
grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
# Extract the definition of DEP_FILES from the Makefile without
# running `make'.
- DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
# When using ansi2knr, U may be empty or an underscore; expand it
- U=`sed -n -e '/^U = / s///p' < "$mf"`
+ U=`sed -n 's/^U = //p' < "$mf"`
test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
# We invoke sed twice because it is the simplest approach to
# changing $(DEPDIR) to its actual value in the expansion.
- for file in `sed -n -e '
+ for file in `sed -n '
/^DEP_FILES = .*\\\\$/ {
s/^DEP_FILES = //
:loop
src/include/modules/Makefile
src/base/Makefile
src/base/Tests/Makefile
- src/base/Tests/gs_example
src/base/Tests/run_tests
+ src/base/Tests/gs_example
+ src/base/Tests/trp_tcp_usage
+ src/base/Tests/trp_file_usage
src/modules/Makefile
src/examples/Makefile
src/examples/ping/Makefile
src/examples/alnem/Makefile
doc/Makefile
],[( cd src/include ; test -e gras || ln -s . gras )
- test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
- test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests])
+ test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+ test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+ test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
+ test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests])
AC_OUTPUT
</para>
+@name:
@desc:
@howmany:
-@dst:
+@code:
@Returns:
<!-- # Unused Parameters # -->
-@name:
-@code:
+@dst:
<!-- ##### FUNCTION gras_datadesc_parse ##### -->
</para>
-@def:
-@dst:
-@Returns:
-<!-- # Unused Parameters # -->
@name:
@Cdefinition:
@code:
+@Returns:
+<!-- # Unused Parameters # -->
+@def:
+@dst:
<!-- ##### MACRO gras_datadesc_declare_array ##### -->
@host:
@Param2:
-@sock:
+@bufSize:
+@dst:
@Returns:
+<!-- # Unused Parameters # -->
+@sock:
<!-- ##### FUNCTION gras_socket_server ##### -->
</para>
-@sock:
-@Returns:
-
-
-<!-- ##### FUNCTION gras_socket_peer_name ##### -->
-<para>
-
-</para>
-
@sd:
+<!-- # Unused Parameters # -->
+@sock:
@Returns:
@ud:
+<!-- ##### FUNCTION gras_datadesc_cmp ##### -->
+<para>
+
+</para>
+
+@d1:
+@d2:
+@Returns:
+@dd1:
+@c1:
+@dd2:
+@c2:
+
<!-- ##### FUNCTION gras_datadesc_copy_data ##### -->
<para>
@sock:
@Returns:
+<!-- ##### FUNCTION gras_socket_peer_name ##### -->
+<para>
+
+</para>
+
+@sd:
+@Returns:
+
<!-- ##### FUNCTION gras_unlock ##### -->
<para>
@size:
-<!-- ##### FUNCTION gras_datadesc_cmp ##### -->
-<para>
-
-</para>
-
-@d1:
-@d2:
-@Returns:
-<!-- # Unused Parameters # -->
-@dd1:
-@c1:
-@dd2:
-@c2:
-
-
<!-- ##### MACRO SIMPLE_TYPE_COUNT ##### -->
<para>
--- /dev/null
+/* $Id$ */
+
+/* gras/cond.h - public interface to conditional execution */
+/* (specific parts for SG or RL) */
+
+/* Authors: Martin Quinson */
+/* Copyright (C) 2003,2004 da GRAS posse. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef GRAS_COND_H
+#define GRAS_COND_H
+
+#include <stddef.h> /* offsetof() */
+#include <sys/types.h> /* size_t */
+#include <stdarg.h>
+
+
+/*! C++ users need love */
+#ifndef BEGIN_DECL
+# ifdef __cplusplus
+# define BEGIN_DECL extern "C" {
+# else
+# define BEGIN_DECL
+# endif
+#endif
+
+/*! C++ users need love */
+#ifndef END_DECL
+# ifdef __cplusplus
+# define END_DECL }
+# else
+# define END_DECL
+# endif
+#endif
+/* End of cruft for C++ */
+
+BEGIN_DECL
+
+/**
+ * gras_if_RL:
+ *
+ * Returns true only if the program runs on real life
+ */
+int gras_if_RL(void);
+
+/**
+ * gras_if_SG:
+ *
+ * Returns true only if the program runs within the simulator
+ */
+int gras_if_SG(void);
+
+END_DECL
+
+#endif /* GRAS_COND_H */
+
const char *
gras_get_my_fqdn(void);
-/**
- * gras_time:
- *
- * Get the time in number of second since the Epoch.
- * (00:00:00 UTC, January 1, 1970 in Real Life, and begining of simulation in SG)
- */
-double gras_time(void);
-
-/**
- * gras_sleep:
- * @sec: number of seconds to sleep
- * @usec: number of microseconds to sleep
- *
- * sleeps for the given amount of seconds plus the given amount of microseconds.
- */
-void gras_sleep(unsigned long sec, unsigned long usec);
END_DECL
#include <gras/config.h>
-#include <gras/core.h>
+#include <gras/core.h> /* FIXME: killme */
#include <gras/process.h>
+#include <gras/virtu.h>
+#include <gras/cond.h>
#include <gras/transport.h>
typedef int (*gras_module_finalize_fct_t)(void);
void gras_init(int argc,char **argv);
-void gras_finalize(void);
+void gras_init_defaultlog(int argc,char **argv, const char *defaultlog);
+void gras_exit(void);
#endif /* _GRAS_MODULE_H */
gras_error_t gras_socket_client(const char *host,
unsigned short port,
- unsigned int bufSize,
/* OUT */ gras_socket_t **dst);
gras_error_t gras_socket_server(unsigned short port,
- unsigned int bufSize,
/* OUT */ gras_socket_t **dst);
-void gras_socket_close(gras_socket_t *sd);
-
+void gras_socket_close(gras_socket_t **sd);
+
+
+/* debuging functions */
+gras_error_t gras_socket_client_from_file(const char*path,
+ /* OUT */ gras_socket_t **dst);
+gras_error_t gras_socket_server_from_file(const char*path,
+ /* OUT */ gras_socket_t **dst);
+
#endif /* GRAS_TRANSPORT_H */
--- /dev/null
+/* $Id$ */
+
+/* gras/virtu.h - public interface to virtualization (cross-OS portability) */
+
+/* Authors: Martin Quinson */
+/* Copyright (C) 2003,2004 da GRAS posse. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef GRAS_VIRTU_H
+#define GRAS_VIRTU_H
+
+#include <stddef.h> /* offsetof() */
+#include <sys/types.h> /* size_t */
+#include <stdarg.h>
+
+
+/*! C++ users need love */
+#ifndef BEGIN_DECL
+# ifdef __cplusplus
+# define BEGIN_DECL extern "C" {
+# else
+# define BEGIN_DECL
+# endif
+#endif
+
+/*! C++ users need love */
+#ifndef END_DECL
+# ifdef __cplusplus
+# define END_DECL }
+# else
+# define END_DECL
+# endif
+#endif
+/* End of cruft for C++ */
+
+BEGIN_DECL
+
+/**
+ * gras_time:
+ *
+ * Get the time in number of second since the Epoch.
+ * (00:00:00 UTC, January 1, 1970 in Real Life, and begining of simulation in SG)
+ */
+double gras_time(void);
+
+/**
+ * gras_sleep:
+ * @sec: number of seconds to sleep
+ * @usec: number of microseconds to sleep
+ *
+ * sleeps for the given amount of seconds plus the given amount of microseconds.
+ */
+void gras_sleep(unsigned long sec, unsigned long usec);
+
+END_DECL
+
+#endif /* GRAS_VIRTU_H */
+
#!/bin/sh
-#
# install - install a program, script, or datafile
-#
+
+scriptversion=2004-02-15.20
+
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
-
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
-
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
-transformbasename=""
-transform_arg=""
+transformbasename=
+transform_arg=
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
+chowncmd=
+chgrpcmd=
+stripcmd=
rmcmd="$rmprog -f"
mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd=$cpprog
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd=$stripprog
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
+src=
+dst=
+dir_arg=
+
+usage="Usage: $0 [OPTION]... SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 -d DIRECTORIES...
+
+In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default.
+In the second, create the directory path DIR.
+
+Options:
+-b=TRANSFORMBASENAME
+-c copy source (using $cpprog) instead of moving (using $mvprog).
+-d create directories instead of installing files.
+-g GROUP $chgrp installed files to GROUP.
+-m MODE $chmod installed files to MODE.
+-o USER $chown installed files to USER.
+-s strip installed files (using $stripprog).
+-t=TRANSFORM
+--help display this help and exit.
+--version display version info and exit.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+ case $1 in
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ -c) instcmd=$cpprog
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ --help) echo "$usage"; exit 0;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd=$stripprog
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ --version) echo "$0 $scriptversion"; exit 0;;
+
+ *) # When -d is used, all remaining arguments are directories to create.
+ test -n "$dir_arg" && break
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dstarg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dstarg"
+ shift # fnord
+ fi
+ shift # arg
+ dstarg=$arg
+ done
+ break;;
+ esac
done
-if [ x"$src" = x ]
-then
- echo "$0: no input file specified" >&2
- exit 1
-else
- :
+if test -z "$1"; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call `install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
fi
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d "$dst" ]; then
- instcmd=:
- chmodcmd=""
- else
- instcmd=$mkdirprog
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f "$src" ] || [ -d "$src" ]
- then
- :
- else
- echo "$0: $src does not exist" >&2
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "$0: no destination specified" >&2
- exit 1
- else
- :
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d "$dst" ]
- then
- dst=$dst/`basename "$src"`
- else
- :
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
- '
-IFS="${IFS-$defaultIFS}"
-
-oIFS=$IFS
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS=$oIFS
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp=$pathcomp$1
- shift
-
- if [ ! -d "$pathcomp" ] ;
- then
- $mkdirprog "$pathcomp"
- else
- :
- fi
+for src
+do
+ # Protect names starting with `-'.
+ case $src in
+ -*) src=./$src ;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ src=
+
+ if test -d "$dst"; then
+ instcmd=:
+ chmodcmd=
+ else
+ instcmd=$mkdirprog
+ fi
+ else
+ # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dstarg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+
+ dst=$dstarg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst ;;
+ esac
- pathcomp=$pathcomp/
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ dst=$dst/`basename "$src"`
+ fi
+ fi
+
+ # This sed command emulates the dirname command.
+ dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+ # Make sure that the destination directory exists.
+
+ # Skip lots of stat calls in the usual case.
+ if test ! -d "$dstdir"; then
+ defaultIFS='
+ '
+ IFS="${IFS-$defaultIFS}"
+
+ oIFS=$IFS
+ # Some sh's can't handle IFS=/ for some reason.
+ IFS='%'
+ set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+ IFS=$oIFS
+
+ pathcomp=
+
+ while test $# -ne 0 ; do
+ pathcomp=$pathcomp$1
+ shift
+ if test ! -d "$pathcomp"; then
+ $mkdirprog "$pathcomp" || lasterr=$?
+ # mkdir can fail with a `File exist' error in case several
+ # install-sh are creating the directory concurrently. This
+ # is OK.
+ test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; }
+ fi
+ pathcomp=$pathcomp/
+ done
+ fi
+
+ if test -n "$dir_arg"; then
+ $doit $instcmd "$dst" \
+ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+ else
+ # If we're going to rename the final executable, determine the name now.
+ if test -z "$transformarg"; then
+ dstfile=`basename "$dst"`
+ else
+ dstfile=`basename "$dst" $transformbasename \
+ | sed $transformarg`$transformbasename
+ fi
+
+ # don't allow the sed command to completely eliminate the filename.
+ test -z "$dstfile" && dstfile=`basename "$dst"`
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
+ trap '(exit $?); exit' 1 2 13 15
+
+ # Move or copy the file name to the temp name
+ $doit $instcmd "$src" "$dsttmp" &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $instcmd $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+ # Now remove or move aside any old file at destination location. We
+ # try this two ways since rm can't unlink itself on some systems and
+ # the destination file might be busy for other reasons. In this case,
+ # the final cleanup might fail but the new file should still install
+ # successfully.
+ {
+ if test -f "$dstdir/$dstfile"; then
+ $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+ || {
+ echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+ (exit 1); exit
+ }
+ else
+ :
+ fi
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+ fi || { (exit 1); exit; }
done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd "$dst" &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename "$dst"`
- else
- dstfile=`basename "$dst" $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename "$dst"`
- else
- :
- fi
-
-# Make a couple of temp file names in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
- rmtmp=$dstdir/#rm.$$#
-
-# Trap to clean up temp files at exit.
-
- trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
- trap '(exit $?); exit' 1 2 13 15
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd "$src" "$dsttmp" &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
-
-# Now remove or move aside any old file at destination location. We try this
-# two ways since rm can't unlink itself on some systems and the destination
-# file might be busy for other reasons. In this case, the final cleanup
-# might fail but the new file should still install successfully.
-
-{
- if [ -f "$dstdir/$dstfile" ]
- then
- $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
- $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
- {
- echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
- (exit 1); exit
- }
- else
- :
- fi
-} &&
-
-# Now rename the file to the real destination.
-
- $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
-
-fi &&
# The final little trick to "correctly" pass the exit status to the exit trap.
-
{
- (exit 0); exit
+ (exit 0); exit
}
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
-.deps .libs Makefile Makefile.in dict_usage dict_crash dynar_int dynar_double dynar_string
+.deps .libs Makefile Makefile.in
+cscope.files cscope.out
lib_LIBRARIES= libgrasrl.a libgrassg.a
-noinst_LIBRARIES=libgrasutils.a
-
# Core/dict_multi.c
# Common/gras.c Common/gras_datadesc.c Common/gras_msg.c
# Messaging/messaging.c
COMMON_S=\
\
- Core/module.c \
+ Core/module.c Core/core_interface.h \
Core/log.c Core/log_default_appender.c Core/error.c \
Core/dynar.c \
Core/dict.c Core/dict_elm.c Core/dict_cursor.c \
Core/config.c \
\
Transport/transport.c Transport/transport_private.h \
- Transport/transport_plugin_tcp.c \
- Transport/transport_plugin_sg.c \
- \
+ Transport/transport_plugin_file.c \
+ Transport/transport_plugin_tcp.c \
+ Transport/transport_plugin_sg.c \
\
DataDesc/ddt_create.c DataDesc/ddt_declare.c \
DataDesc/ddt_remote.c DataDesc/ddt_use.c \
DataDesc/cbps.c DataDesc/datadesc.c \
DataDesc/datadesc_interface.h DataDesc/datadesc_private.h
-
+
# DataDesc/datadesc.c \
# DataDesc/tools.c \
# DataDesc/categories.h \
DataDesc/parse.yy.c: DataDesc/parse.yy.l
flex -o$@ -Pgras_ddt_ $^
-libgrasutils_a_SOURCES = $(COMMON_S)
-#Tests/gras_dummy.c
-
libgrasrl_a_SOURCES= $(COMMON_S) \
Transport/rl_transport.c \
- Virtu/rl_process.c Virtu/rl_time.c
+ Virtu/rl_process.c Virtu/rl_time.c Virtu/rl_conditional.c
libgrassg_a_SOURCES= $(COMMON_S) \
Transport/sg_transport.c \
- Virtu/sg_process.c Virtu/sg_time.c
+ Virtu/sg_process.c Virtu/sg_time.c Virtu/sg_conditional.c
# RL/gras_rl.c RL/gras_rl.h FIXME
-
-# $(foreach file,\
-# exp_smooth forc median mse_forc protocol \
-# dnsutil fbuff forecast_api last_value run_mean timeouts, \
-# $(top_srcdir)/src/nws_portability/build-@host@/obj/$(file).o)
-
-
-
GRAS_LOG_DEFAULT_CATEGORY(transport);
-gras_error_t
-gras_socket_server(unsigned short port,
- unsigned int bufSize,
- /* OUT */ gras_socket_t **dst) {
-
- gras_error_t errcode;
- gras_trp_plugin_t *tcp;
-
- TRY(gras_trp_plugin_get_by_name("TCP",&tcp));
- TRY( tcp->socket_server(tcp, port, bufSize, dst));
-
- (*dst)->incoming = 1;
- (*dst)->accepting = 1;
-
- TRY(gras_dynar_push(_gras_trp_sockets,dst));
-
- return no_error;
-}
-
-gras_error_t
-gras_socket_client(const char *host,
- unsigned short port,
- unsigned int bufSize,
- /* OUT */ gras_socket_t **dst) {
-
- gras_error_t errcode;
- gras_trp_plugin_t *tcp;
-
- TRY(gras_trp_plugin_get_by_name("TCP",&tcp));
- TRY( (*tcp->socket_client)(tcp, host, port, bufSize, dst));
-
- (*dst)->incoming = 0;
- (*dst)->accepting = 0;
-
- return no_error;
-}
-
/**
* gras_trp_select:
/* construct the set of socket to ear from */
FD_ZERO(&FDS);
gras_dynar_foreach(_gras_trp_sockets,cursor,sock_iter) {
- if (max_fds < sock_iter->sd)
- max_fds = sock_iter->sd;
- FD_SET(sock_iter->sd, &FDS);
+ if (sock_iter->incoming) {
+ if (max_fds < sock_iter->sd)
+ max_fds = sock_iter->sd;
+ FD_SET(sock_iter->sd, &FDS);
+ } else {
+ DEBUG1("Not considering socket %d for select",sock_iter->sd);
+ }
}
/* we cannot have more than FD_SETSIZE sockets */
p_tout = NULL;
}
+ DEBUG1("Selecting over %d socket(s)", max_fds-1);
ready = select(max_fds, &FDS, NULL, NULL, p_tout);
if (ready == -1) {
switch (errno) {
TRY(sock_iter->plugin->socket_accept(sock_iter,&accepted));
TRY(gras_dynar_push(_gras_trp_sockets,&accepted));
} else {
+#if 0
+ FIXME: this fails of files. quite logical
/* Make sure the socket is still alive by reading the first byte */
char lookahead;
int recvd;
if (recvd < 0) {
WARNING2("socket %d failed: %s", sock_iter->sd, strerror(errno));
/* done with this socket */
- gras_socket_close(sock_iter);
+ gras_socket_close(&sock_iter);
cursor--;
} else if (recvd == 0) {
/* Connection reset (=closed) by peer. */
DEBUG1("Connection %d reset by peer", sock_iter->sd);
- gras_socket_close(sock_iter);
+ gras_socket_close(&sock_iter);
cursor--;
} else {
+#endif
/* Got a suited socket ! */
*dst = sock_iter;
return no_error;
+#if 0
}
+#endif
}
/* TCP */
TRY(gras_trp_tcp_init(&plug));
- TRY(gras_dict_insert(_gras_trp_plugins,plug->name, plug, gras_trp_plugin_free));
+ TRY(gras_dict_insert(_gras_trp_plugins,
+ plug->name, plug, gras_trp_plugin_free));
+
+ /* FILE */
+ TRY(gras_trp_file_init(&plug));
+ TRY(gras_dict_insert(_gras_trp_plugins,
+ plug->name, plug, gras_trp_plugin_free));
return no_error;
}
}
}
-void gras_socket_close(gras_socket_t *sock) {
+
+/**
+ * gras_trp_socket_new:
+ *
+ * Malloc a new socket, and initialize it with defaults
+ */
+gras_error_t gras_trp_socket_new(int incoming,
+ gras_socket_t **dst) {
+
+ gras_socket_t *sock;
+
+ if (! (sock=malloc(sizeof(gras_socket_t))) )
+ RAISE_MALLOC;
+
+ sock->plugin = NULL;
+ sock->sd = -1;
+
+ sock->incoming = incoming? 1:0;
+ sock->outgoing = incoming? 0:1;
+ sock->accepting = incoming? 1:0;
+ DEBUG3("in=%c out=%c accept=%c",
+ sock->incoming?'y':'n',
+ sock->outgoing?'y':'n',
+ sock->accepting?'y':'n');
+
+ sock->port = -1;
+ sock->peer_port = -1;
+ sock->peer_name = NULL;
+
+ *dst = sock;
+ return no_error;
+}
+
+
+/**
+ * gras_socket_server:
+ *
+ * Opens a server socket and make it ready to be listened to.
+ * In real life, you'll get a TCP socket.
+ */
+gras_error_t
+gras_socket_server(unsigned short port,
+ /* OUT */ gras_socket_t **dst) {
+
+ gras_error_t errcode;
+ gras_trp_plugin_t *trp;
+ gras_socket_t *sock;
+
+ *dst = NULL;
+
+ TRY(gras_trp_plugin_get_by_name(gras_if_RL() ? "TCP" : "SG",
+ &trp));
+
+ /* defaults settings */
+ TRY(gras_trp_socket_new(1,&sock));
+ sock->plugin= trp;
+ sock->port=port;
+
+ /* Call plugin socket creation function */
+ errcode = trp->socket_server(trp, port, sock);
+ if (errcode != no_error) {
+ free(sock);
+ return errcode;
+ }
+
+ *dst = sock;
+ /* Register this socket */
+ errcode = gras_dynar_push(_gras_trp_sockets,dst);
+ if (errcode != no_error) {
+ free(sock);
+ *dst = NULL;
+ return errcode;
+ }
+
+ return no_error;
+}
+
+/**
+ * gras_socket_client:
+ *
+ * Opens a client socket to a remote host.
+ * In real life, you'll get a TCP socket.
+ */
+gras_error_t
+gras_socket_client(const char *host,
+ unsigned short port,
+ /* OUT */ gras_socket_t **dst) {
+
+ gras_error_t errcode;
+ gras_trp_plugin_t *trp;
+ gras_socket_t *sock;
+
+ *dst = NULL;
+
+ TRY(gras_trp_plugin_get_by_name(gras_if_RL() ? "TCP" : "SG",
+ &trp));
+
+ /* defaults settings */
+ TRY(gras_trp_socket_new(0,&sock));
+ sock->plugin= trp;
+ sock->peer_port = port;
+ sock->peer_name = strdup(host?host:"localhost");
+
+ /* plugin-specific */
+ errcode= (* trp->socket_client)(trp,
+ host ? host : "localhost", port,
+ sock);
+ if (errcode != no_error) {
+ free(sock);
+ return errcode;
+ }
+
+ /* register socket */
+ *dst = sock;
+ errcode = gras_dynar_push(_gras_trp_sockets,dst);
+ if (errcode != no_error) {
+ free(sock);
+ *dst = NULL;
+ return errcode;
+ }
+
+ return no_error;
+}
+
+void gras_socket_close(gras_socket_t **sock) {
gras_socket_t *sock_iter;
int cursor;
/* FIXME: Issue an event when the socket is closed */
- if (sock) {
+ if (sock && *sock) {
gras_dynar_foreach(_gras_trp_sockets,cursor,sock_iter) {
- if (sock == sock_iter) {
+ if (*sock == sock_iter) {
gras_dynar_cursor_rm(_gras_trp_sockets,&cursor);
- if (sock->plugin->socket_close)
- (*sock->plugin->socket_close)(sock);
+ if ( (*sock)->plugin->socket_close)
+ (* (*sock)->plugin->socket_close)(*sock);
/* free the memory */
- free(sock);
+ free(*sock);
+ *sock=NULL;
return;
}
}
gras_trp_chunk_send(gras_socket_t *sd,
char *data,
size_t size) {
+ gras_assert1(sd->outgoing,
+ "Socket not suited for data send (outgoing=%c)",
+ sd->outgoing?'y':'n');
+ gras_assert1(sd->plugin->chunk_send,
+ "No function chunk_send on transport plugin %s",
+ sd->plugin->name);
return (*sd->plugin->chunk_send)(sd,data,size);
}
/**
*
* Receive a bunch of bytes from a socket
*/
-gras_error_t gras_trp_chunk_recv(gras_socket_t *sd,
- char *data,
- size_t size) {
- return (*sd->plugin->chunk_recv)(sd,data,size);
+gras_error_t
+gras_trp_chunk_recv(gras_socket_t *sd,
+ char *data,
+ size_t size) {
+ gras_assert0(sd->incoming,
+ "Socket not suited for data receive");
+ gras_assert1(sd->plugin->chunk_recv,
+ "No function chunk_recv on transport plugin %s",
+ sd->plugin->name);
+ return (sd->plugin->chunk_recv)(sd,data,size);
}
#ifndef GRAS_TRP_INTERFACE_H
#define GRAS_TRP_INTERFACE_H
-#include "gras_private.h"
-
/***
*** Main user functions
***/
struct gras_trp_plugin_ {
char *name;
+ /* dst pointers are created and initialized with default values
+ before call to socket_client/server*/
gras_error_t (*socket_client)(gras_trp_plugin_t *self,
const char *host,
unsigned short port,
- unsigned int bufSize,
- /* OUT */ gras_socket_t **dst);
+ /* OUT */ gras_socket_t *dst);
gras_error_t (*socket_server)(gras_trp_plugin_t *self,
unsigned short port,
- unsigned int bufSize,
- /* OUT */ gras_socket_t **dst);
+ /* OUT */ gras_socket_t *dst);
+
gras_error_t (*socket_accept)(gras_socket_t *sock,
/* OUT */gras_socket_t **dst);
--- /dev/null
+/* $Id$ */
+
+/* File transport - send/receive a bunch of bytes from a file */
+
+/* Authors: Martin Quinson */
+/* Copyright (C) 2004 Martin Quinson. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "gras_private.h"
+#include "transport_private.h"
+
+GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(trp_file,transport);
+
+typedef struct {
+ int buffsize;
+} gras_trp_tcp_sock_specific_t;
+
+/***
+ *** Prototypes
+ ***/
+void gras_trp_file_close(gras_socket_t *sd);
+
+gras_error_t gras_trp_file_chunk_send(gras_socket_t *sd,
+ char *data,
+ size_t size);
+
+gras_error_t gras_trp_file_chunk_recv(gras_socket_t *sd,
+ char *data,
+ size_t size);
+
+void gras_trp_file_free_specific(void *s);
+
+/***
+ *** Specific plugin part
+ ***/
+
+typedef struct {
+ fd_set incoming_socks;
+} gras_trp_file_specific_t;
+
+/***
+ *** Specific socket part
+ ***/
+
+
+/***
+ *** Code
+ ***/
+gras_error_t
+gras_trp_file_init(gras_trp_plugin_t **dst) {
+
+ gras_trp_plugin_t *res=malloc(sizeof(gras_trp_plugin_t));
+ gras_trp_file_specific_t *specif = malloc(sizeof(gras_trp_file_specific_t));
+ if (!res || !specif)
+ RAISE_MALLOC;
+
+ FD_ZERO(&(specif->incoming_socks));
+
+ res->name = strdup("file");
+ res->socket_client = NULL;
+ res->socket_server = NULL;
+ res->socket_accept = NULL;
+ res->socket_close = gras_trp_file_close;
+
+ res->chunk_send = gras_trp_file_chunk_send;
+ res->chunk_recv = gras_trp_file_chunk_recv;
+
+ res->specific = (void*)specif;
+ res->free_specific = gras_trp_file_free_specific;
+
+ *dst = res;
+ return no_error;
+}
+
+void gras_trp_file_free_specific(void *s) {
+ gras_trp_file_specific_t *specific = s;
+ free(specific);
+}
+
+/**
+ * gras_socket_client_from_file:
+ *
+ * Create a client socket from a file path.
+ *
+ * This only possible in RL, and is mainly for debugging.
+ */
+gras_error_t
+gras_socket_client_from_file(const char*path,
+ /* OUT */ gras_socket_t **dst) {
+ gras_error_t errcode;
+ gras_trp_plugin_t *trp;
+
+ gras_assert0(gras_if_RL(),
+ "Cannot use file as socket in the simulator");
+
+ TRY(gras_trp_socket_new(0,dst));
+
+ TRY(gras_trp_plugin_get_by_name("file",&trp));
+ (*dst)->plugin=trp;
+
+ DEBUG3("in=%c out=%c accept=%c",
+ (*dst)->incoming?'y':'n',
+ (*dst)->outgoing?'y':'n',
+ (*dst)->accepting?'y':'n');
+
+ if (strcmp("-", path)) {
+ (*dst)->sd = open(path, O_RDONLY );
+
+ if ( (*dst)->sd < 0) {
+ RAISE2(system_error,
+ "Cannot create a client socket from file %s: %s",
+ path, strerror(errno));
+ }
+ } else {
+ (*dst)->sd = 1; /* stdout */
+ }
+
+ DEBUG4("sd=%d in=%c out=%c accept=%c",
+ (*dst)->sd,
+ (*dst)->incoming?'y':'n',
+ (*dst)->outgoing?'y':'n',
+ (*dst)->accepting?'y':'n');
+ /* register socket */
+ errcode = gras_dynar_push(_gras_trp_sockets,dst);
+ if (errcode != no_error) {
+ free(*dst);
+ *dst = NULL;
+ return errcode;
+ }
+
+ return no_error;
+}
+
+/**
+ * gras_socket_server_from_file:
+ *
+ * Create a server socket from a file path.
+ *
+ * This only possible in RL, and is mainly for debugging.
+ */
+gras_error_t
+gras_socket_server_from_file(const char*path,
+ /* OUT */ gras_socket_t **dst) {
+ gras_error_t errcode;
+ gras_trp_plugin_t *trp;
+
+ gras_assert0(gras_if_RL(),
+ "Cannot use file as socket in the simulator");
+
+ TRY(gras_trp_socket_new(1,dst));
+
+ TRY(gras_trp_plugin_get_by_name("file",&trp));
+ (*dst)->plugin=trp;
+
+
+ if (strcmp("-", path)) {
+ (*dst)->sd = open(path, O_WRONLY );
+
+ if ( (*dst)->sd < 0) {
+ RAISE2(system_error,
+ "Cannot create a server socket from file %s: %s",
+ path, strerror(errno));
+ }
+ } else {
+ (*dst)->sd = 0; /* stdin */
+ }
+
+ DEBUG4("sd=%d in=%c out=%c accept=%c",
+ (*dst)->sd,
+ (*dst)->incoming?'y':'n',
+ (*dst)->outgoing?'y':'n',
+ (*dst)->accepting?'y':'n');
+
+ /* register socket */
+ errcode = gras_dynar_push(_gras_trp_sockets,dst);
+ if (errcode != no_error) {
+ free(*dst);
+ *dst = NULL;
+ return errcode;
+ }
+
+ return no_error;
+}
+
+void gras_trp_file_close(gras_socket_t *sock){
+ gras_trp_file_specific_t *specific;
+
+ if (!sock) return; /* close only once */
+ specific=sock->plugin->specific;
+
+ if (sock->sd == 0) {
+ DEBUG0("Do not close stdin");
+ } else if (sock->sd == 1) {
+ DEBUG0("Do not close stdout");
+ } else {
+ DEBUG1("close file connection %d\n", sock->sd);
+
+ /* forget about the socket */
+ FD_CLR(sock->sd, &(specific->incoming_socks));
+
+ /* close the socket */
+ if(close(sock->sd) < 0) {
+ WARNING2("error while closing file %d: %s\n",
+ sock->sd, strerror(errno));
+ }
+ }
+}
+
+/**
+ * gras_trp_file_chunk_send:
+ *
+ * Send data on a file pseudo-socket
+ */
+gras_error_t
+gras_trp_file_chunk_send(gras_socket_t *sock,
+ char *data,
+ size_t size) {
+
+ gras_assert0(size >= 0, "Cannot send a negative amount of data");
+
+ while (size) {
+ int status = 0;
+
+ status = write(sock->sd, data, (size_t)size);
+ DEBUG3("write(%d, %p, %ld);\n", sock->sd, data, size);
+
+ if (status == -1) {
+ RAISE4(system_error,"write(%d,%p,%d) failed: %s",
+ sock->sd, data, (int)size,
+ strerror(errno));
+ }
+
+ if (status) {
+ size -= status;
+ data += status;
+ } else {
+ RAISE0(system_error,"file descriptor closed");
+ }
+ }
+
+ return no_error;
+}
+/**
+ * gras_trp_file_chunk_recv:
+ *
+ * Receive data on a file pseudo-socket.
+ */
+gras_error_t
+gras_trp_file_chunk_recv(gras_socket_t *sock,
+ char *data,
+ size_t size) {
+
+ /* TCP sockets are in duplex mode, don't check direction */
+ gras_assert0(sock, "Cannot recv on an NULL socket");
+ gras_assert0(size >= 0, "Cannot receive a negative amount of data");
+
+ while (size) {
+ int status = 0;
+
+ status = read(sock->sd, data, (size_t)size);
+ DEBUG3("read(%d, %p, %ld);\n", sock->sd, data, size);
+
+ if (status == -1) {
+ RAISE4(system_error,"read(%d,%p,%d) failed: %s",
+ sock->sd, data, (int)size,
+ strerror(errno));
+ }
+
+ if (status) {
+ size -= status;
+ data += status;
+ } else {
+ RAISE0(system_error,"file descriptor closed");
+ }
+ }
+
+ return no_error;
+}
+
gras_error_t gras_trp_sg_socket_client(const char *host,
unsigned short port,
int raw,
- unsigned int bufSize,
/* OUT */ gras_socket_t **dst);
gras_error_t gras_trp_sg_socket_server(unsigned short port,
int raw,
- unsigned int bufSize,
/* OUT */ gras_socket_t **dst);
void gras_trp_sg_socket_close(gras_socket_t **sd);
gras_error_t gras_trp_sg_select(double timeOut,
gras_error_t gras_trp_sg_socket_client(const char *host,
unsigned short port,
int raw,
- unsigned int bufSize,
/* OUT */ gras_socket_t **dst){
RAISE_UNIMPLEMENTED;
}
gras_error_t gras_trp_sg_socket_server(unsigned short port,
int raw,
- unsigned int bufSize,
/* OUT */ gras_socket_t **dst){
RAISE_UNIMPLEMENTED;
}
#include <sys/wait.h> /* waitpid() */
#include <sys/socket.h> /* getpeername() socket() */
#include <stdlib.h>
-
+#include <string.h> /* memset */
#include "gras_private.h"
#include "transport_private.h"
gras_error_t gras_trp_tcp_socket_client(gras_trp_plugin_t *self,
const char *host,
unsigned short port,
- unsigned int bufSize,
- /* OUT */ gras_socket_t **dst);
+ /* OUT */ gras_socket_t *sock);
gras_error_t gras_trp_tcp_socket_server(gras_trp_plugin_t *self,
unsigned short port,
- unsigned int bufSize,
- /* OUT */ gras_socket_t **dst);
+ /* OUT */ gras_socket_t *sock);
gras_error_t gras_trp_tcp_socket_accept(gras_socket_t *sock,
gras_socket_t **dst);
void gras_trp_tcp_socket_close(gras_socket_t *sd);
-gras_error_t gras_trp_tcp_bloc_send(gras_socket_t *sd,
- char *data,
- size_t size);
+gras_error_t gras_trp_tcp_chunk_send(gras_socket_t *sd,
+ char *data,
+ size_t size);
-gras_error_t gras_trp_tcp_bloc_recv(gras_socket_t *sd,
- char *data,
- size_t size);
+gras_error_t gras_trp_tcp_chunk_recv(gras_socket_t *sd,
+ char *data,
+ size_t size);
void gras_trp_tcp_free_specific(void *s);
FD_ZERO(&(tcp->incoming_socks));
+ res->name = strdup("TCP");
res->socket_client = gras_trp_tcp_socket_client;
res->socket_server = gras_trp_tcp_socket_server;
res->socket_accept = gras_trp_tcp_socket_accept;
res->socket_close = gras_trp_tcp_socket_close;
+ res->chunk_send = gras_trp_tcp_chunk_send;
+ res->chunk_recv = gras_trp_tcp_chunk_recv;
+
res->specific = (void*)tcp;
res->free_specific = gras_trp_tcp_free_specific;
gras_error_t gras_trp_tcp_socket_client(gras_trp_plugin_t *self,
const char *host,
unsigned short port,
- unsigned int bufSize,
- /* OUT */ gras_socket_t **dst){
-
- int addrCount;
- IPAddress addresses[10];
- int i;
- int sd;
+ /* OUT */ gras_socket_t *sock){
- if (!(*sock=malloc(sizeof(gras_socket_t))))
- RAISE_MALLOC;
+ struct sockaddr_in addr;
+ struct hostent *he;
+ struct in_addr *haddr;
+
+ sock->incoming = 1; /* TCP sockets are duplex'ed */
+
+ sock->sd = socket (AF_INET, SOCK_STREAM, 0);
- (*sock)->peer_addr=NULL;
+ if (sock->sd < 0) {
+ RAISE1(system_error,
+ "Failed to create socket: %s",
+ strerror (errno));
+ }
- if (!(addrCount = IPAddressValues(host, addresses, 10))) {
+ he = gethostbyname (host);
+ if (he == NULL) {
RAISE2(system_error,
- "tcp address retrieval of '%s' failed: %s",
- host,strerror(errno));
+ "Failed to lookup hostname %s: %s",
+ host, strerror (errno));
}
- for(i = 0; i < addrCount && i<10 ; i++) {
- if(CallAddr(addresses[i], port, &sd, -1)) {
- (*sock)->sock = sd;
- (*sock)->port = port;
- return no_error;
- }
+ haddr = ((struct in_addr *) (he->h_addr_list)[0]);
+
+ memset(&addr, 0, sizeof(struct sockaddr_in));
+ memcpy (&addr.sin_addr, haddr, sizeof(struct in_addr));
+ addr.sin_family = AF_INET;
+ addr.sin_port = htons (port);
+
+ if (connect (sock->sd, (struct sockaddr*) &addr, sizeof (addr)) < 0) {
+ close(sock->sd);
+ RAISE3(system_error,
+ "Failed to connect socket to %s:%d (%s)",
+ host, port, strerror (errno));
}
- free(*sock);
- RAISE2(system_error,"Something wicked happenned while connecting to %s:%d",
- host,port);
+
+ return no_error;
}
/**
* gras_trp_tcp_socket_server:
*
- * Open a socket used to receive messages. bufSize is in ko.
+ * Open a socket used to receive messages.
*/
gras_error_t gras_trp_tcp_socket_server(gras_trp_plugin_t *self,
unsigned short port,
- unsigned int bufSize,
- /* OUT */ gras_socket_t **dst){
- int size = bufSize * 1024;
+ /* OUT */ gras_socket_t *sock){
+// int size = bufSize * 1024;
int on = 1;
- int sd = -1;
struct sockaddr_in server;
- gras_socket_t *res;
gras_trp_tcp_specific_t *data=(gras_trp_tcp_specific_t*)self -> specific;
- res=malloc(sizeof(gras_socket_t));
- if (!res)
- RAISE_MALLOC;
+ sock->outgoing = 1; /* TCP => duplex mode */
server.sin_port = htons((u_short)port);
server.sin_addr.s_addr = INADDR_ANY;
server.sin_family = AF_INET;
- if((sd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- free(res);
+ if((sock->sd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
RAISE1(system_error,"socket allocation failed: %s", strerror(errno));
}
- (void)setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on));
+ (void)setsockopt(sock->sd, SOL_SOCKET, SO_REUSEADDR,
+ (char *)&on, sizeof(on));
+ /*
(void)setsockopt(sd, SOL_SOCKET, SO_RCVBUF, (char *)&size, sizeof(size));
(void)setsockopt(sd, SOL_SOCKET, SO_SNDBUF, (char *)&size, sizeof(size));
- if (bind(sd, (struct sockaddr *)&server, sizeof(server)) == -1) {
- free(res);
- close(sd);
+ */
+ if (bind(sock->sd, (struct sockaddr *)&server, sizeof(server)) == -1) {
+ close(sock->sd);
RAISE2(system_error,"Cannot bind to port %d: %s",port, strerror(errno));
}
- if (listen(sd, 5) != -1) {
- free(res);
- close(sd);
+ if (listen(sock->sd, 5) < 0) {
+ close(sock->sd);
RAISE2(system_error,"Cannot listen to port %d: %s",port,strerror(errno));
}
- FD_SET(sd, &(data->incoming_socks));
+ FD_SET(sock->sd, &(data->incoming_socks));
- *dst=res;
- res->plugin = self;
- res->incoming = 1;
- res->sd = sd;
- res->port=port;
- res->peer_port=-1;
- res->peer_name=NULL;
-
- DEBUG2("Openned a server socket on port %d (sock %d)",port,sd);
+ DEBUG2("Openned a server socket on port %d (sock %d)",port,sock->sd);
return no_error;
}
tmp_errno = errno;
if(sd == -1) {
- gras_socket_close(sock);
+ gras_socket_close(&sock);
RAISE1(system_error,
"Accept failed (%s). Droping server socket.", strerror(tmp_errno));
} else {
WARNING0("setsockopt failed, cannot condition the accepted socket");
}
+ /* FIXME: bufSize removed until we can have optionsets
i = ((gras_trp_tcp_sock_specific_t*)sock->specific)->buffsize;
if (setsockopt(sd, SOL_SOCKET, SO_RCVBUF, (char *)&i, s)
|| setsockopt(sd, SOL_SOCKET, SO_SNDBUF, (char *)&i, s)) {
WARNING0("setsockopt failed, cannot set buffsize");
}
-
- res->plugin = sock->plugin;
- res->incoming = 1;
- res->sd = sd;
- res->port= -1;
- res->peer_port= peer_in.sin_port;
-
+ */
+
+ res->plugin = sock->plugin;
+ res->incoming = sock->incoming;
+ res->outgoing = sock->outgoing;
+ res->accepting = 0;
+ res->sd = sd;
+ res->port = -1;
+ res->peer_port = peer_in.sin_port;
+
+ /* FIXME: Lock to protect inet_ntoa */
if (((struct sockaddr *)&peer_in)->sa_family != AF_INET) {
res->peer_name = strdup("unknown");
} else {
tmp = inet_ntoa(addrAsInAddr);
if (tmp != NULL) {
- res->peer_name = strdup(inet_ntoa(addrAsInAddr));
+ res->peer_name = strdup(tmp);
} else {
res->peer_name = strdup("unknown");
}
}
} */
+ /* forget about the socket */
+ FD_CLR(sock->sd, &(tcp->incoming_socks));
+
/* close the socket */
if(close(sock->sd) < 0) {
- WARNING3("error while closing tcp socket %d: %d (%s)\n", sock->sd, errno, strerror(errno));
+ WARNING3("error while closing tcp socket %d: %d (%s)\n",
+ sock->sd, errno, strerror(errno));
}
-
- /* forget about it */
- FD_CLR(sock->sd, &(tcp->incoming_socks));
-
}
/**
char *data,
size_t size) {
- /* gras_assert0(sock && !sock->incoming,
- "Asked to send stuff on an incomming socket");*/
+ /* TCP sockets are in duplex mode, don't check direction */
gras_assert0(size >= 0, "Cannot send a negative amount of data");
while (size) {
gras_trp_tcp_chunk_recv(gras_socket_t *sock,
char *data,
size_t size) {
- gras_assert0(sock && !sock->incoming,
- "Ascked to receive stuff on an outcomming socket");
+
+ /* TCP sockets are in duplex mode, don't check direction */
+ gras_assert0(sock, "Cannot recv on an NULL socket");
gras_assert0(size >= 0, "Cannot receive a negative amount of data");
while (size) {
struct s_gras_socket {
gras_trp_plugin_t *plugin;
+
+ int incoming :1; /* true if we can read from this sock */
+ int outgoing :1; /* true if we can write on this sock */
+ int accepting :1; /* true if master incoming sock in tcp */
- int incoming; /* true if incoming (server) sock, false if client sock */
- int accepting; /* true if master incoming sock in tcp */
-
- int sd;
+ int sd;
int port; /* port on this side */
int peer_port; /* port on the other side */
char *peer_name; /* hostname of the other side */
void *specific; /* plugin specific data */
};
+gras_error_t gras_trp_socket_new(int incomming,
+ gras_socket_t **dst);
-/* TCP driver */
+/* The drivers */
gras_error_t gras_trp_tcp_init(gras_trp_plugin_t **dst);
-
-/* SG driver */
+gras_error_t gras_trp_file_init(gras_trp_plugin_t **dst);
gras_error_t gras_trp_sg_init (gras_trp_plugin_t **dst);
--- /dev/null
+/* $Id$ */
+
+/* rl_conditional - conditional execution (real life) */
+
+/* Authors: Martin Quinson */
+/* Copyright (C) 2003,2004 da GRAS posse. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "Virtu/virtu_rl.h"
+
+int gras_if_RL(void) {
+ return 1;
+}
+
+int gras_if_SG(void) {
+ return 0;
+}
--- /dev/null
+/* $Id$ */
+
+/* rl_conditional - conditional execution (simulation) */
+
+/* Authors: Martin Quinson */
+/* Copyright (C) 2003,2004 da GRAS posse. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "Virtu/virtu_rl.h"
+
+int gras_if_RL(void) {
+ return 0;
+}
+
+int gras_if_SG(void) {
+ return 1;
+}
#include "gras/core.h"
#include "gras/process.h"
+#include "gras/virtu.h"
+#include "gras/cond.h"
#include "gras/transport.h"
#include "Transport/transport_interface.h"
--- /dev/null
+/* $Id$ */
+
+/* core - very basic functionnalities of GRAS (logs, data container, ...) */
+
+/* module's public interface exported within GRAS, but not to end user. */
+
+/* Authors: Martin Quinson */
+/* Copyright (C) 2004 Martin Quinson. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef GRAS_CORE_INTERFACE_H
+#define GRAS_CORE_INTERFACE_H
+
+/* Modules definitions */
+void gras_log_exit(void);
+
+#endif /* GRAS_CORE_INTERFACE_H */
/* This program is free software; you can redistribute it and/or modify it
under the terms of the license (GNU LGPL) which comes with this package. */
+#include "Core/core_interface.h"
#include "gras_private.h"
#include <stdarg.h>
#include <assert.h>
cat->appender = app;
}
-void gras_log_finalize(void);
-void gras_log_finalize(void) {
+void gras_log_exit(void) {
gras_dynar_free(gras_log_settings);
}
GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(module,GRAS);
-extern void gras_log_finalize(void);
+extern void gras_log_exit(void);
struct gras_module_ {
gras_dynar_t *deps;
gras_module_finalize_fct_t finalize;
};
+void
+gras_init(int argc, char **argv) {
+ gras_init_defaultlog(argc, argv, NULL);
+}
/**
- * gras_init:
+ * gras_init_defaultlog:
* @argc:
* @argv:
*
* Initialize the gras mecanisms.
*/
void
-gras_init(int argc,char **argv) {
+gras_init_defaultlog(int argc,char **argv, const char *defaultlog) {
int i;
char *opt;
gras_error_t errcode;
+ int found=0;
INFO0("Initialize GRAS");
+
+ /** Set logs and init log submodule */
for (i=1; i<argc; i++) {
if (!strncmp(argv[i],"--gras-log=",strlen("--gras-log="))) {
+ found = 1;
opt=strchr(argv[i],'=');
opt++;
TRYFAIL(gras_log_control_set(opt));
}
}
+ if (!found && defaultlog) {
+ TRYFAIL(gras_log_control_set(defaultlog));
+ }
+
+ /** init other submodules */
+ gras_trp_init();
}
/**
- * gras_finalize:
+ * gras_exit:
* @argc:
* @argv:
*
* Finalize the gras mecanisms.
*/
void
-gras_finalize(){
- gras_log_finalize();
+gras_exit(){
+ gras_trp_exit();
+ gras_log_exit();
}
config_usage
set_usage
gs_example gs_example_receive gs_example_send
+trp_file_client trp_file_server trp_file_usage
+trp_tcp_client trp_tcp_server trp_tcp_usage
INCLUDES = -I$(top_srcdir)/src/include
AM_CFLAGS=-g -Wno-unused-function
-AM_LDFLAGS=-g
CLEANFILES = *~ test a.out *.o
DISTCLEANFILES=Makefile.in *~
# Test stuff
-noinst_PROGRAMS = \
+core_tests = \
dynar_int dynar_double dynar_string \
dict_usage dict_crash \
set_usage \
log_usage \
- config_usage
-
-# gs_example_send gs_example_receive
-
+ config_usage
# multidict_crash
+RL_tests = \
+ trp_tcp_client trp_tcp_server \
+ trp_file_client trp_file_server
+# gs_example_send gs_example_receive
-noinst_SCRIPTS = run_tests gs_example
+SG_tests =
-log_usage_LDADD= $(top_srcdir)/src/base/libgrasutils.a test_utils.o
+noinst_PROGRAMS = $(core_tests) $(RL_tests) $(SG_tests)
+noinst_SCRIPTS = run_tests gs_example trp_tcp_usage
+TESTS=run_tests
-dynar_int_LDADD= $(top_srcdir)/src/base/libgrasutils.a test_utils.o
-dynar_double_LDADD= $(top_srcdir)/src/base/libgrasutils.a test_utils.o
-dynar_string_LDADD= $(top_srcdir)/src/base/libgrasutils.a test_utils.o
+test: $(noinst_PROGRAMS) $(noinst_SCRIPTS)
+ ./run_tests
-dict_usage_LDADD= $(top_srcdir)/src/base/libgrasutils.a test_utils.o
-dict_crash_LDADD= $(top_srcdir)/src/base/libgrasutils.a test_utils.o
-#multidict_crash_LDADD= $(top_srcdir)/src/base/libgrasutils.a test_utils.o
-set_usage_LDADD= $(top_srcdir)/src/base/libgrasutils.a test_utils.o
+# LDADD_UTILS is still a separate var to distinguish core tester from RL tester
+LDADD_UTILS=$(top_srcdir)/src/base/libgrasrl.a
+LDADD_RL= $(top_srcdir)/src/base/libgrasrl.a
-config_usage_LDADD= $(top_srcdir)/src/base/libgrasutils.a test_utils.o
+log_usage_LDADD= $(LDADD_UTILS)
+dynar_int_LDADD= $(LDADD_UTILS)
+dynar_double_LDADD= $(LDADD_UTILS)
+dynar_string_LDADD= $(LDADD_UTILS)
-#gs_example_send_LDADD= $(top_srcdir)/src/base/libgrasutils.a test_utils.o
-#gs_example_receive_LDADD= $(top_srcdir)/src/base/libgrasutils.a test_utils.o
+dict_usage_LDADD= $(LDADD_UTILS)
+dict_crash_LDADD= $(LDADD_UTILS)
+#multidict_crash_LDADD= $(LDADD_UTILS)
-TESTS=run_tests
+set_usage_LDADD= $(LDADD_UTILS)
+
+config_usage_LDADD= $(LDADD_UTILS)
+
+trp_tcp_client_LDADD= $(LDADD_RL)
+trp_tcp_server_LDADD= $(LDADD_RL)
+trp_file_client_LDADD= $(LDADD_RL)
+trp_file_server_LDADD= $(LDADD_RL)
+
+#gs_example_send_LDADD= $(LDADD_UTILS)
+#gs_example_receive_LDADD= $(LDADD_UTILS)
-test: $(noinst_PROGRAMS)
- ./run_tests
+++ /dev/null
-#include <string.h>
-#include <stdio.h>
-#include <gras.h>
-
-void parse_log_opt(int argc, char **argv,const char *deft);
-
-void parse_log_opt(int argc, char **argv,const char *deft) {
- char *opt;
- gras_error_t errcode;
-
- if (argc > 1 && !strncmp(argv[1],"--gras-log=",strlen("--gras-log="))) {
- opt=strchr(argv[1],'=');
- opt++;
- TRYFAIL(gras_log_control_set(opt));
- } else {
- TRYFAIL(gras_log_control_set(deft));
- }
-}
-
--- /dev/null
+/* $Id$ */
+
+/* trp_tcp_client: Client of a test case for the tcp transport. */
+
+/* Authors: Martin Quinson */
+/* Copyright (C) 2003 the OURAGAN project. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include <stdio.h>
+#include <gras.h>
+#include "../Transport/transport_interface.h"
+
+//GRAS_LOG_NEW_DEFAULT_CATEGORY(test);
+
+int main(int argc,char *argv[]) {
+ gras_socket_t * sock;
+ gras_error_t errcode;
+ char data_send[256];
+
+ gras_init_defaultlog(argc,argv,"trp.thresh=debug");
+
+ fprintf(stderr,"===[CLIENT]=== Contact the server\n");
+ TRYFAIL(gras_socket_client_from_file("-",&sock));
+
+ sprintf(data_send,"Hello, I am a little test data to send.");
+ fprintf(stderr,"===[CLIENT]=== Send data\n");
+ TRYFAIL(gras_trp_chunk_send(sock,data_send, sizeof(data_send)));
+
+ fprintf(stderr,"===[CLIENT]=== Exiting successfully\n");
+ gras_socket_close(&sock);
+ return 0;
+}
--- /dev/null
+/* $Id$ */
+
+/* trp_tcp_server: Server of a test case for the tcp transport. */
+
+/* Authors: Martin Quinson */
+/* Copyright (C) 2003 the OURAGAN project. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include <stdio.h>
+#include <gras.h>
+#include "../Transport/transport_interface.h"
+
+//GRAS_LOG_NEW_DEFAULT_CATEGORY(test);
+
+int main(int argc,char *argv[]) {
+ gras_socket_t *sock, *conn;
+ gras_error_t errcode;
+ char data_recv[256];
+
+ gras_init_defaultlog(argc,argv,"trp.thresh=debug");
+
+ fprintf(stderr,"===[SERVER]=== Create the socket\n");
+ TRYFAIL(gras_socket_server_from_file("-",&sock));
+
+ fprintf(stderr,"===[SERVER]=== Waiting for incomming connexions\n");
+ TRYFAIL(gras_trp_select(60,&conn));
+
+ fprintf(stderr,"===[SERVER]=== Contacted ! Waiting for the data\n");
+ TRYFAIL(gras_trp_chunk_recv(conn,data_recv, sizeof(data_recv)));
+ fprintf(stderr,"===[SERVER]=== Got '%s'.\n", data_recv);
+
+ fprintf(stderr,"===[SERVER]=== Exiting successfully\n");
+ gras_socket_close(&sock);
+
+ return 0;
+}
--- /dev/null
+#! @BASH@ -e
+
+./trp_file_client $@ | ./trp_file_server $@
+
--- /dev/null
+/* $Id$ */
+
+/* trp_tcp_client: Client of a test case for the tcp transport. */
+
+/* Authors: Martin Quinson */
+/* Copyright (C) 2003 the OURAGAN project. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include <stdio.h>
+#include <gras.h>
+#include "../Transport/transport_interface.h"
+
+//GRAS_LOG_NEW_DEFAULT_CATEGORY(test);
+
+int main(int argc,char *argv[]) {
+ gras_socket_t * sock;
+ gras_error_t errcode;
+ char data_send[256];
+ char data_recv[256];
+
+ gras_init_defaultlog(argc,argv,"trp.thresh=debug");
+
+ fprintf(stderr,"===[CLIENT]=== Contact the server\n");
+ TRYFAIL(gras_socket_client(NULL,55555,&sock));
+
+ sprintf(data_send,"Hello, I am a little test data to send.");
+ fprintf(stderr,"===[CLIENT]=== Send data\n");
+ TRYFAIL(gras_trp_chunk_send(sock,data_send, sizeof(data_send)));
+ fprintf(stderr,"===[CLIENT]=== Waiting for the ACK\n");
+ TRYFAIL(gras_trp_chunk_recv(sock,data_recv, sizeof(data_recv)));
+
+ if (strcmp(data_send, data_recv)) {
+ fprintf(stderr, "===[CLIENT]=== String sent != string received\n");
+ exit(1);
+ }
+ fprintf(stderr,"===[CLIENT]=== Got a valid ACK\n");
+
+ fprintf(stderr,"===[CLIENT]=== Exiting successfully\n");
+ gras_socket_close(&sock);
+ return 0;
+}
--- /dev/null
+/* $Id$ */
+
+/* trp_tcp_server: Server of a test case for the tcp transport. */
+
+/* Authors: Martin Quinson */
+/* Copyright (C) 2003 the OURAGAN project. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include <stdio.h>
+#include <gras.h>
+#include "../Transport/transport_interface.h"
+
+//GRAS_LOG_NEW_DEFAULT_CATEGORY(test);
+
+int main(int argc,char *argv[]) {
+ gras_socket_t *sock, *conn;
+ gras_error_t errcode;
+ char data_recv[256];
+
+ gras_init_defaultlog(argc,argv,"trp.thresh=debug");
+
+ fprintf(stderr,"===[SERVER]=== Create the socket\n");
+ TRYFAIL(gras_socket_server(55555,&sock));
+
+ fprintf(stderr,"===[SERVER]=== Waiting for incomming connexions\n");
+ TRYFAIL(gras_trp_select(60,&conn));
+
+ fprintf(stderr,"===[SERVER]=== Contacted ! Waiting for the data\n");
+ TRYFAIL(gras_trp_chunk_recv(conn,data_recv, sizeof(data_recv)));
+ fprintf(stderr,"===[SERVER]=== Got '%s'. Send it back.\n", data_recv);
+ TRYFAIL(gras_trp_chunk_send(conn,data_recv, sizeof(data_recv)));
+ gras_socket_close(&conn);
+
+ fprintf(stderr,"===[SERVER]=== Exiting successfully\n");
+ gras_socket_close(&sock);
+
+ return 0;
+}
--- /dev/null
+#! @BASH@ -e
+
+./trp_tcp_server $@ &
+sleep 1
+./trp_tcp_client $@
+
return 1;
}
-void parse_log_opt(int argc, char **argv,const char *deft);
-
int main(int argc, char **argv) {
gras_error_t errcode;
gras_cfg_t *set;
int ival;
- parse_log_opt(argc,argv,"config.thresh=debug root.thresh=info");
+ gras_init_defaultlog(argc,argv,"config.thresh=debug root.thresh=info");
fprintf(stderr,"==== Alloc and free a config set.\n");
set=make_set();
return no_error;
}
-void parse_log_opt(int argc, char **argv, const char *deft);
-
int main(int argc,char **argv) {
gras_error_t errcode;
gras_dict_t *head=NULL;
char *key;
void *data;
- parse_log_opt(argc,argv,"dict.thresh=verbose");
+ gras_init_defaultlog(argc,argv,"dict.thresh=verbose");
srand((unsigned int)time(NULL));
printf("Dictionnary: CRASH test:\n");
return no_error;
}
-void parse_log_opt(int argc, char **argv,const char *deft);
-
int main(int argc,char **argv) {
gras_error_t errcode;
gras_dict_t *head=NULL;
char *data;
- parse_log_opt(argc,argv,"dict.thresh=verbose");
+ gras_init_defaultlog(argc,argv,"dict.thresh=verbose");
printf("\nGeneric dictionnary: USAGE test:\n");
TRYFAIL(traverse(head));
gras_dict_free(&head);
- gras_finalize();
- return 0;
TRYCATCH(debuged_remove(head,"12345"),mismatch_error);
TRYFAIL(traverse(head));
printf(" - Free the dictionnary twice\n");
gras_dict_free(&head);
gras_dict_free(&head);
+ gras_exit();
return 0;
}
#include <stdio.h>
#include <gras.h>
-void parse_log_opt(int argc, char **argv,const char *deft);
-
int main(int argc,char *argv[]) {
gras_dynar_t *d;
gras_error_t errcode;
int cpt,cursor;
double d1,d2;
- parse_log_opt(argc,argv,"dynar.thresh=debug");
+ gras_init_defaultlog(argc,argv,"dynar.thresh=debug");
fprintf(stderr,"==== Traverse the empty dynar\n");
TRYFAIL(gras_dynar_new(&d,sizeof(int),NULL));
}
gras_dynar_free(d);
- gras_finalize();
+ gras_exit();
return 0;
}
#define NB_ELEM 5000
GRAS_LOG_NEW_DEFAULT_CATEGORY(test);
-void parse_log_opt(int argc, char **argv, const char *def);
-
int main(int argc,char *argv[]) {
gras_dynar_t *d;
gras_error_t errcode;
int i,cpt,cursor;
- parse_log_opt(argc,argv,"dynar.thresh=debug");
+ gras_init_defaultlog(argc,argv,"dynar.thresh=debug");
fprintf(stderr,"==== Traverse the empty dynar\n");
TRYFAIL(gras_dynar_new(&d,sizeof(int),NULL));
free(*(void**)d);
}
-void parse_log_opt(int argc, char **argv,const char *deft);
-
int main(int argc,char *argv[]) {
gras_dynar_t *d;
gras_error_t errcode;
char buf[1024];
char *s1,*s2;
- parse_log_opt(argc,argv,"dynar.thresh=debug");
+ gras_init_defaultlog(argc,argv,"dynar.thresh=debug");
fprintf(stderr,"==== Traverse the empty dynar\n");
TRYFAIL(gras_dynar_new(&d,sizeof(char *),&free_string));
GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(Test, Top);
GRAS_LOG_NEW_CATEGORY(Top);
-void parse_log_opt(int argc, char **argv,const char *deft);
-
int main(int argc, char **argv) {
- parse_log_opt(argc,argv,"root.thresh=debug log.thresh=debug");
+ gras_init_defaultlog(argc,argv,"root.thresh=debug log.thresh=debug");
DEBUG1("val=%d", 1);
WARNING1("val=%d", 2);
CDEBUG2(Top, "val=%d%s", 3, "!");
CRITICAL6("false alarm%s%s%s%s%s%s", "","","","","","!");
- gras_finalize();
+ gras_exit();
return 0;
}
return no_error;
}
-void parse_log_opt(int argc, char **argv,const char *deft);
-
int main(int argc,char **argv) {
gras_error_t errcode;
gras_set_t *set=NULL;
my_elem_t *elm;
- parse_log_opt(argc,argv,"set.thresh=verbose");
+ gras_init_defaultlog(argc,argv,"set.thresh=verbose");
printf("\nData set: USAGE test:\n");