echo \`$0\'" command line, or rerun aci_configurator and save the new ones."
echo
else
- configure_args="--enable-maintainer-mode"
+ configure_args="--enable-maintainer-mode --enable-gtk-doc"
echo "**Warning**: I am going to run \`configure' with no arguments."
echo "If you wish to pass any to it, please specify them on the"
echo \`$0\'" command line."
#! /bin/sh
-# From configure.ac Revision: 1.3 .
+# From configure.ac Revision: 1.4 .
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for GRAS 0.0.040205.
+# Generated by GNU Autoconf 2.59 for GRAS 0.0.040304.
#
# Report bugs to <martin.quinson@ens-lyon.fr>.
#
# Identity of this package.
PACKAGE_NAME='GRAS'
PACKAGE_TARNAME='gras'
-PACKAGE_VERSION='0.0.040205'
-PACKAGE_STRING='GRAS 0.0.040205'
+PACKAGE_VERSION='0.0.040304'
+PACKAGE_STRING='GRAS 0.0.040304'
PACKAGE_BUGREPORT='martin.quinson@ens-lyon.fr'
ac_unique_file="src/include/gras.h"
-ac_subdirs_all="$ac_subdirs_all src/nws_portability"
# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
# 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 subdirs 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 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.
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures GRAS 0.0.040205 to adapt to many kinds of systems.
+\`configure' configures GRAS 0.0.040304 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of GRAS 0.0.040205:";;
+ short | recursive ) echo "Configuration of GRAS 0.0.040304:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-GRAS configure 0.0.040205
+GRAS configure 0.0.040304
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by GRAS $as_me 0.0.040205, which was
+It was created by GRAS $as_me 0.0.040304, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
+
ac_aux_dir=
ac_config_sub="$SHELL $ac_aux_dir/config.sub"
ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
-
-
-subdirs="$subdirs src/nws_portability"
-
-
# Make sure we can run config.sub.
$ac_config_sub sun4 >/dev/null 2>&1 ||
{ { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
# Define the identity of the package.
PACKAGE='gras'
- VERSION='0.0.040205'
+ VERSION='0.0.040304'
cat >>confdefs.h <<_ACEOF
lt_cv_deplibs_check_method=pass_all
;;
-netbsd*)
+netbsd* | knetbsd*-gnu)
if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
else
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 3666 "configure"' > conftest.$ac_ext
+ echo '#line 3661 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
# Provide some information about the compiler.
-echo "$as_me:5223:" \
+echo "$as_me:5218:" \
"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:6255: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6250: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6259: \$? = $ac_status" >&5
+ echo "$as_me:6254: \$? = $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:6488: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6483: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6492: \$? = $ac_status" >&5
+ echo "$as_me:6487: \$? = $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
mkdir out
printf "$lt_simple_compile_test_code" > conftest.$ac_ext
- # According to Tom Tromey, Ian Lance Taylor reported there are C compilers
- # that will create temporary files in the current directory regardless of
- # the output directory. Thus, making CWD read-only will cause this test
- # to fail, enabling locking or at least warning the user not to do parallel
- # builds.
- chmod -w .
-
lt_compiler_flag="-o out/conftest2.$ac_objext"
# Insert the option either (1) after the last *FLAGS variable, or
# (2) before a word containing "conftest.", or (3) at the end.
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6555: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6543: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:6559: \$? = $ac_status" >&5
+ echo "$as_me:6547: \$? = $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
fi
;;
- netbsd*)
+ netbsd* | knetbsd*-gnu)
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
wlarc=
link_all_deplibs=yes
;;
- netbsd*)
+ netbsd* | knetbsd*-gnu)
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
else
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
dynamic_linker='NetBSD (a.out) ld.so'
else
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
dynamic_linker='NetBSD ld.elf_so'
fi
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 8730 "configure"
+#line 8718 "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 8828 "configure"
+#line 8816 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
;;
esac
;;
- netbsd*)
+ netbsd* | knetbsd*-gnu)
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
wlarc=
;;
esac
;;
- netbsd*)
+ netbsd* | knetbsd*-gnu)
;;
osf3* | osf4* | osf5*)
case $cc_basename in
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:11005: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:10993: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:11009: \$? = $ac_status" >&5
+ echo "$as_me:10997: \$? = $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
mkdir out
printf "$lt_simple_compile_test_code" > conftest.$ac_ext
- # According to Tom Tromey, Ian Lance Taylor reported there are C compilers
- # that will create temporary files in the current directory regardless of
- # the output directory. Thus, making CWD read-only will cause this test
- # to fail, enabling locking or at least warning the user not to do parallel
- # builds.
- chmod -w .
-
lt_compiler_flag="-o out/conftest2.$ac_objext"
# Insert the option either (1) after the last *FLAGS variable, or
# (2) before a word containing "conftest.", or (3) at the end.
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:11072: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11053: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:11076: \$? = $ac_status" >&5
+ echo "$as_me:11057: \$? = $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
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
dynamic_linker='NetBSD (a.out) ld.so'
else
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
dynamic_linker='NetBSD ld.elf_so'
fi
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 12426 "configure"
+#line 12407 "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 12524 "configure"
+#line 12505 "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:13351: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13332: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:13355: \$? = $ac_status" >&5
+ echo "$as_me:13336: \$? = $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
mkdir out
printf "$lt_simple_compile_test_code" > conftest.$ac_ext
- # According to Tom Tromey, Ian Lance Taylor reported there are C compilers
- # that will create temporary files in the current directory regardless of
- # the output directory. Thus, making CWD read-only will cause this test
- # to fail, enabling locking or at least warning the user not to do parallel
- # builds.
- chmod -w .
-
lt_compiler_flag="-o out/conftest2.$ac_objext"
# Insert the option either (1) after the last *FLAGS variable, or
# (2) before a word containing "conftest.", or (3) at the end.
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13418: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13392: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:13422: \$? = $ac_status" >&5
+ echo "$as_me:13396: \$? = $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
fi
;;
- netbsd*)
+ netbsd* | knetbsd*-gnu)
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
wlarc=
link_all_deplibs_F77=yes
;;
- netbsd*)
+ netbsd* | knetbsd*-gnu)
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
else
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
dynamic_linker='NetBSD (a.out) ld.so'
else
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
dynamic_linker='NetBSD ld.elf_so'
fi
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15450: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15424: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15454: \$? = $ac_status" >&5
+ echo "$as_me:15428: \$? = $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:15683: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15657: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15687: \$? = $ac_status" >&5
+ echo "$as_me:15661: \$? = $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
mkdir out
printf "$lt_simple_compile_test_code" > conftest.$ac_ext
- # According to Tom Tromey, Ian Lance Taylor reported there are C compilers
- # that will create temporary files in the current directory regardless of
- # the output directory. Thus, making CWD read-only will cause this test
- # to fail, enabling locking or at least warning the user not to do parallel
- # builds.
- chmod -w .
-
lt_compiler_flag="-o out/conftest2.$ac_objext"
# Insert the option either (1) after the last *FLAGS variable, or
# (2) before a word containing "conftest.", or (3) at the end.
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15750: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15717: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:15754: \$? = $ac_status" >&5
+ echo "$as_me:15721: \$? = $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
fi
;;
- netbsd*)
+ netbsd* | knetbsd*-gnu)
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
wlarc=
link_all_deplibs_GCJ=yes
;;
- netbsd*)
+ netbsd* | knetbsd*-gnu)
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
else
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
dynamic_linker='NetBSD (a.out) ld.so'
else
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
dynamic_linker='NetBSD ld.elf_so'
fi
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 17925 "configure"
+#line 17892 "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 18023 "configure"
+#line 17990 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
-for ac_func in memset strchr strerror
+
+for ac_func in memset strchr strerror usleep
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
} >&5
cat >&5 <<_CSEOF
-This file was extended by GRAS $as_me 0.0.040205, which was
+This file was extended by GRAS $as_me 0.0.040304, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-GRAS config.status 0.0.040205
+GRAS config.status 0.0.040304
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
s,@ECHO_N@,$ECHO_N,;t t
s,@ECHO_T@,$ECHO_T,;t t
s,@LIBS@,$LIBS,;t t
-s,@subdirs@,$subdirs,;t t
s,@build@,$build,;t t
s,@build_cpu@,$build_cpu,;t t
s,@build_vendor@,$build_vendor,;t t
$ac_cs_success || { (exit 1); exit 1; }
fi
-#
-# CONFIG_SUBDIRS section.
-#
-if test "$no_recursion" != yes; then
-
- # Remove --cache-file and --srcdir arguments so they do not pile up.
- ac_sub_configure_args=
- ac_prev=
- for ac_arg in $ac_configure_args; do
- if test -n "$ac_prev"; then
- ac_prev=
- continue
- fi
- case $ac_arg in
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
- | --c=*)
- ;;
- --config-cache | -C)
- ;;
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- ;;
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- ;;
- *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
- esac
- done
-
- # Always prepend --prefix to ensure using the same prefix
- # in subdir configurations.
- ac_sub_configure_args="--prefix=$prefix $ac_sub_configure_args"
-
- ac_popdir=`pwd`
- for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue
-
- # Do not complain, so a configure script can configure whichever
- # parts of a large source tree are present.
- test -d $srcdir/$ac_dir || continue
-
- { echo "$as_me:$LINENO: configuring in $ac_dir" >&5
-echo "$as_me: configuring in $ac_dir" >&6;}
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
- ac_builddir=.
-
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
-
-case $srcdir in
- .) # No --srcdir option. We are building in place.
- ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
-
-
- cd $ac_dir
-
- # Check for guested configure; otherwise get Cygnus style configure.
- if test -f $ac_srcdir/configure.gnu; then
- ac_sub_configure="$SHELL '$ac_srcdir/configure.gnu'"
- elif test -f $ac_srcdir/configure; then
- ac_sub_configure="$SHELL '$ac_srcdir/configure'"
- elif test -f $ac_srcdir/configure.in; then
- ac_sub_configure=$ac_configure
- else
- { echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5
-echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;}
- ac_sub_configure=
- fi
-
- # The recursion is here.
- if test -n "$ac_sub_configure"; then
- # Make the cache file name correct relative to the subdirectory.
- case $cache_file in
- [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;;
- *) # Relative path.
- ac_sub_cache_file=$ac_top_builddir$cache_file ;;
- esac
-
- { echo "$as_me:$LINENO: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5
-echo "$as_me: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;}
- # The eval makes quoting arguments work.
- eval $ac_sub_configure $ac_sub_configure_args \
- --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir ||
- { { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5
-echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;}
- { (exit 1); exit 1; }; }
- fi
-
- cd "$ac_popdir"
- done
-fi
-
echo "
+++ /dev/null
-/* gs_interface.h */
-#ifndef GS_INTERFACE_H
-#define GS_INTERFACE_H
-
-/* Mask internal structures to users */
-typedef struct s_gs_type_bag gras_type_bag_t;
-typedef struct s_gs_connection gras_connection_t;
-typedef struct s_gs_type gras_type_t;
-typedef struct s_gs_message gras_message_t;
-typedef struct s_gs_net_driver gras_net_driver_t;
-typedef struct s_gs_message_instance gras_message_instance_t;
-typedef struct s_gs_type_driver gras_type_driver_t;
-
-
-/* public functions */
-void
-gs_init(int argc,
- char **argv);
-
-void
-gs_purge_cmd_line(int *argc,
- char **argv);
-
-void
-gs_exit(void);
-
-/* -- */
-
-gras_type_t *
-gs_type_new_unsigned_integer_elemental(gras_type_bag_t *p_bag,
- gras_connection_t *p_connection,
- const char *name,
- long int size);
-
-gras_type_t *
-gs_type_new_signed_integer_elemental(gras_type_bag_t *p_bag,
- gras_connection_t *p_connection,
- const char *name,
- long int size);
-
-gras_type_t *
-gs_type_new_floating_point_elemental(gras_type_bag_t *p_bag,
- gras_connection_t *p_connection,
- const char *name,
- long int size);
-
-gras_type_t *
-gs_type_new_struct(gras_type_bag_t *p_bag,
- gras_connection_t *p_connection,
- const char *name);
-
-void
-gs_type_struct_append_field(gras_type_t *p_struct_type,
- const char *name,
- gras_type_t *p_field_type);
-
-gras_type_t *
-gs_type_new_union(gras_type_bag_t *p_bag,
- gras_connection_t *p_connection,
- const char *name,
-
- int (*field_callback)(void *vars,
- gras_type_t *p_type,
- void *data));
-
-void
-gs_type_union_append_field(gras_type_t *p_union_type,
- const char *name,
- gras_type_t *p_field_type);
-
-gras_type_t *
-gs_type_new_ref(gras_type_bag_t *p_bag,
- gras_connection_t *p_connection,
- const char *name,
- gras_type_t *p_referenced_type);
-
-gras_type_t *
-gs_type_new_array(gras_type_bag_t *p_bag,
- gras_connection_t *p_connection,
- const char *name,
- long int size,
- gras_type_t *p_array_element_type);
-
-gras_type_t *
-gs_type_new_ignored(gras_type_bag_t *p_bag,
- gras_connection_t *p_connection,
- const char *name,
- long int size,
- long int alignment,
- void *default_value);
-
-/* -- */
-
-gras_type_t *
-gs_type_new_unsigned_integer_elemental_with_callback(gras_type_bag_t *p_bag,
- gras_connection_t *p_connection,
- const char *name,
- long int size,
-
- void (*callback)(void *vars,
- gras_type_t *p_type,
- void *data));
-
-gras_type_t *
-gs_type_new_signed_integer_elemental_with_callback(gras_type_bag_t *p_bag,
- gras_connection_t *p_connection,
- const char *name,
- long int size,
-
- void (*callback)(void *vars,
- gras_type_t *p_type,
- void *data));
-
-gras_type_t *
-gs_type_new_floating_point_elemental_with_callback(gras_type_bag_t *p_bag,
- gras_connection_t *p_connection,
- const char *name,
- long int size,
-
- void (*callback)(void *vars,
- gras_type_t *p_type,
- void *data));
-
-gras_type_t *
-gs_type_new_struct_with_callback(gras_type_bag_t *p_bag,
- gras_connection_t *p_connection,
- const char *name,
-
- void (*before_callback)(void *vars,
- gras_type_t *p_type,
- void *data),
-
- void (*after_callback)(void *vars,
- gras_type_t *p_type,
- void *data));
-
-void
-gs_type_struct_append_field_with_callback(gras_type_t *p_struct_type,
- const char *name,
- gras_type_t *p_field_type,
-
- void (*before_callback)(void *vars,
- gras_type_t *p_type,
- void *data),
-
- void (*after_callback)(void *vars,
- gras_type_t *p_type,
- void *data));
-
-
-gras_type_t *
-gs_type_new_union_with_callback(gras_type_bag_t *p_bag,
- gras_connection_t *p_connection,
- const char *name,
-
- int (*field_callback)(void *vars,
- gras_type_t *p_type,
- void *data),
-
- void (*after_callback)(void *vars,
- gras_type_t *p_type,
- void *data));
-
-void
-gs_type_union_append_field_with_callback(gras_type_t *p_union_type,
- const char *name,
- gras_type_t *p_field_type,
-
- void (*before_callback)(void *vars,
- gras_type_t *p_type,
- void *data),
-
- void (*after_callback)(void *vars,
- gras_type_t *p_type,
- void *data));
-
-gras_type_t *
-gs_type_new_ref_with_callback(gras_type_bag_t *p_bag,
- gras_connection_t *p_connection,
- const char *name,
- gras_type_t *p_referenced_type,
-
- int (*type_callback)(void *vars,
- gras_type_t *p_type,
- void *data),
-
- void (*after_callback)(void *vars,
- gras_type_t *p_type,
- void *data));
-
-gras_type_t *
-gs_type_new_array_with_callback(gras_type_bag_t *p_bag,
- gras_connection_t *p_connection,
- const char *name,
- long int size,
- gras_type_t *p_array_element_type,
-
- long int (*size_callback)(void *vars,
- gras_type_t *p_type,
- void *data),
-
- void (*after_callback)(void *vars,
- gras_type_t *p_type,
- void *data));
-
-gras_type_t *
-gs_type_new_ignored_with_callback(gras_type_bag_t *p_bag,
- gras_connection_t *p_connection,
- const char *name,
- long int size,
- long int alignment,
- void *default_value,
- void (*callback)(void *vars,
- gras_type_t *p_type,
- void *data));
-
-/* Automatic parsing of datatypes */
-gras_type_t *
-_gs_type_parse(gras_type_bag_t *p_bag,
- const char *definition);
-
-#define GRAS_DEFINE_TYPE(name,def) \
- static const char * _gs_this_type_symbol_does_not_exist__##name=#def; def
-
-#define gras_type_symbol_parse(bag,name) \
- _gs_type_parse(bag, _gs_this_type_symbol_does_not_exist__##name)
-
-#define gs_type_get_by_symbol(bag,name) \
- (bag->bag_ops->get_type_by_name(bag, NULL, #name) ? \
- bag->bag_ops->get_type_by_name(bag, NULL, #name) : \
- gras_type_symbol_parse(bag, name) \
- )
-
-/* -- */
-
-void
-gs_bootstrap_incoming_connection(gras_type_bag_t *p_bag,
- gras_connection_t *p_cnx);
-
-void
-gs_bootstrap_type_bag(gras_type_bag_t *p_bag);
-
-
-void
-gs_bootstrap_outgoing_connection(gras_type_bag_t *p_bag,
- gras_connection_t *p_cnx);
-
-/* -- */
-
-gras_message_t *
-gs_message_new(gras_type_bag_t *p_bag,
- gras_connection_t *p_connection,
- const char *name);
-
-
-void
-gs_message_append_new_sequence(gras_message_t *p_message,
- gras_type_t *p_type);
-
-gras_message_instance_t *
-gs_message_init_send_by_ref(gras_type_bag_t *p_bag,
- gras_connection_t *p_connection,
- gras_message_t *p_message);
-
-gras_message_instance_t *
-gs_message_init_send_by_name(gras_type_bag_t *p_bag,
- gras_connection_t *p_connection,
- const char *name);
-
-gras_message_instance_t *
-gs_message_init_send_by_code(gras_type_bag_t *p_bag,
- gras_connection_t *p_connection,
- int code);
-
-
-void
-gs_message_send_next_sequence_ext(void *vars,
- gras_message_instance_t *p_message_instance,
- void *data);
-
-void
-gs_message_send_next_sequence(gras_message_instance_t *p_message_instance,
- void *data);
-
-void *
-gs_message_receive_next_sequence(gras_message_instance_t *p_message_instance);
-
-gras_message_instance_t *
-gs_message_init_receive(gras_type_bag_t *p_bag,
- gras_connection_t *p_cnx);
-
-/* -- */
-
-void *
-gs_vars_alloc(void);
-
-void
-gs_vars_free(void *p_vars);
-
-void
-gs_vars_enter(void *p_vars);
-
-void
-gs_vars_leave(void *p_vars);
-
-void
-gs_vars_push(void *p_vars,
- gras_type_t *p_type,
- const char *name,
- void *data);
-
-void *
-gs_vars_get(void *p_vars,
- const char *name,
- gras_type_t **pp_type);
-
-void
-gs_vars_set(void *p_vars,
- gras_type_t *p_type,
- const char *name,
- void *data);
-
-void *
-gs_vars_pop(void *p_vars,
- const char *name,
- gras_type_t **pp_type);
-
-/* -- */
-
-void
-gs_net_drivers_init(void);
-
-gras_net_driver_t *
-gs_net_driver_init(const char *name);
-
-void
-gs_net_driver_exit(gras_net_driver_t *p_net_driver);
-
-gras_connection_t *
-gs_net_connection_connect(gras_net_driver_t *p_net_driver,
- void *arg);
-
-gras_connection_t *
-gs_net_connection_accept(gras_net_driver_t *p_net_driver,
- void *arg);
-
-void
-gs_net_connection_close(gras_connection_t *p_connection);
-
-/* -- */
-
-void
-gs_type_drivers_init(void);
-
-gras_type_driver_t *
-gs_type_driver_init(const char *name);
-
-void
-gs_type_driver_exit(gras_type_driver_t *p_type_driver);
-
-
-gras_type_bag_t *
-gs_type_bag_alloc(gras_type_driver_t *p_driver);
-
-void
-gs_type_bag_free(gras_type_bag_t *p_bag);
-
-/* -- */
-
-void *
-gs_memdup(const void * const ptr,
- const size_t length);
-
-
-#endif /* GS_INTERFACE_H */
BEGIN_DECL
-/**
- * Basic types we can embeed in DataDescriptors.
- */
-typedef enum
- {CHAR_TYPE, DOUBLE_TYPE, FLOAT_TYPE, INT_TYPE, LONG_TYPE, SHORT_TYPE,
- UNSIGNED_INT_TYPE, UNSIGNED_LONG_TYPE, UNSIGNED_SHORT_TYPE, STRUCT_TYPE}
- DataTypes;
-#define SIMPLE_TYPE_COUNT 9
-
-/*! \brief Describe a collection of data.
- *
-** A description of a collection of #type# data. #repetitions# is used only
-** for arrays; it contains the number of elements. #offset# is used only for
-** struct members in host format; it contains the offset of the member from the
-** beginning of the struct, taking into account internal padding added by the
-** compiler for alignment purposes. #members#, #length#, and #tailPadding# are
-** used only for STRUCT_TYPE data; the #length#-long array #members# describes
-** the members of the nested struct, and #tailPadding# indicates how many
-** padding bytes the compiler adds to the end of the structure.
-*/
-
-typedef struct DataDescriptorStruct {
- DataTypes type;
- size_t repetitions;
- size_t offset;
- /*@null@*/ struct DataDescriptorStruct *members;
- size_t length;
- size_t tailPadding;
-} DataDescriptor;
-/** DataDescriptor for an array */
-#define SIMPLE_DATA(type,repetitions) \
- {type, repetitions, 0, NULL, 0, 0}
-/** DataDescriptor for an structure member */
-#define SIMPLE_MEMBER(type,repetitions,offset) \
- {type, repetitions, offset, NULL, 0, 0}
-/** DataDescriptor for padding bytes */
-#define PAD_BYTES(structType,lastMember,memberType,repetitions) \
- sizeof(structType) - offsetof(structType, lastMember) - \
- sizeof(memberType) * repetitions
-
-/*
-gras_error_t gras_datadesc_parse(const char *def,
- gras_datadesc__t **dst);
-gras_error_t gras_datadesc_from_nws(const DataDescriptor *desc,
- size_t howmany,
- gras_datadesc_t **dst);
-gras_error_t gras_datadesc_sizeof_host(gras_datadesc_t *desc,
- size_t *dst);
-gras_error_t gras_datadesc_sizeof_network(gras_datadesc_t *desc,
- size_t *dst);
-*/
typedef struct s_gras_datadesc_type gras_datadesc_type_t;
+/***********************************************
+ **** Search and retrieve declared datatype ****
+ ***********************************************/
+long int gras_datadesc_get_id_from_name(const char *name);
+
+/*********************************************
+ **** DataDesc callback persistent states ****
+ *********************************************/
+typedef struct s_gras_dd_cbps gras_dd_cbps_t;
+
+void *
+gras_dd_cbps_pop (gras_dd_cbps_t *ps,
+ const char *name,
+ gras_datadesc_type_t **ddt);
+void
+gras_dd_cbps_push(gras_dd_cbps_t *ps,
+ const char *name,
+ void *data,
+ gras_datadesc_type_t *ddt);
+void
+gras_dd_cbps_set (gras_dd_cbps_t *ps,
+ const char *name,
+ void *data,
+ gras_datadesc_type_t *ddt);
+
+void *
+gras_dd_cbps_get (gras_dd_cbps_t *ps,
+ const char *name,
+ gras_datadesc_type_t **ddt);
+
+void
+gras_dd_cbps_block_begin(gras_dd_cbps_t *ps);
+void
+gras_dd_cbps_block_end(gras_dd_cbps_t *ps);
+
+
+/******************************************
+ **** Declare datadescription manually ****
+ ******************************************/
+
typedef void (*gras_datadesc_type_cb_void_t)(void *vars,
gras_datadesc_type_t *p_type,
void *data);
gras_datadesc_type_cb_void_t post,
long int *code);
+/****************************
+ **** Parse C statements ****
+ ****************************/
+gras_error_t
+gras_datadesc_parse(const char *name,
+ const char *Cdefinition,
+ long int *code);
+#define GRAS_DEFINE_TYPE(name,def) \
+ static const char * _gras_this_type_symbol_does_not_exist__##name=#def; def
+
+#define gras_type_symbol_parse(bag,name) \
+ _gs_type_parse(bag, _gs_this_type_symbol_does_not_exist__##name)
+
+#define gs_type_get_by_symbol(bag,name) \
+ (bag->bag_ops->get_type_by_name(bag, NULL, #name) ? \
+ bag->bag_ops->get_type_by_name(bag, NULL, #name) : \
+ gras_type_symbol_parse(bag, name) \
+ )
+
+/*****************************
+ **** NWS datadescription ****
+ *****************************/
-/* Use the datadescriptions */
-int
-gras_datadesc_type_cmp(const gras_datadesc_type_t *d1,
- const gras_datadesc_type_t *d2);
+/**
+ * Basic types we can embeed in DataDescriptors.
+ */
+typedef enum
+ {CHAR_TYPE, DOUBLE_TYPE, FLOAT_TYPE, INT_TYPE, LONG_TYPE, SHORT_TYPE,
+ UNSIGNED_INT_TYPE, UNSIGNED_LONG_TYPE, UNSIGNED_SHORT_TYPE, STRUCT_TYPE}
+ DataTypes;
+#define SIMPLE_TYPE_COUNT 9
+/*! \brief Describe a collection of data.
+ *
+** A description of a collection of #type# data. #repetitions# is used only
+** for arrays; it contains the number of elements. #offset# is used only for
+** struct members in host format; it contains the offset of the member from the
+** beginning of the struct, taking into account internal padding added by the
+** compiler for alignment purposes. #members#, #length#, and #tailPadding# are
+** used only for STRUCT_TYPE data; the #length#-long array #members# describes
+** the members of the nested struct, and #tailPadding# indicates how many
+** padding bytes the compiler adds to the end of the structure.
+*/
-gras_error_t
-gras_datadesc_cpy(gras_datadesc_type_t *type, void *src, void **dst);
+typedef struct DataDescriptorStruct {
+ DataTypes type;
+ size_t repetitions;
+ size_t offset;
+ /*@null@*/ struct DataDescriptorStruct *members;
+ size_t length;
+ size_t tailPadding;
+} DataDescriptor;
+/** DataDescriptor for an array */
+#define SIMPLE_DATA(type,repetitions) \
+ {type, repetitions, 0, NULL, 0, 0}
+/** DataDescriptor for an structure member */
+#define SIMPLE_MEMBER(type,repetitions,offset) \
+ {type, repetitions, offset, NULL, 0, 0}
+/** DataDescriptor for padding bytes */
+#define PAD_BYTES(structType,lastMember,memberType,repetitions) \
+ sizeof(structType) - offsetof(structType, lastMember) - \
+ sizeof(memberType) * repetitions
+
+gras_error_t
+gras_datadesc_from_nws(const char *name,
+ const DataDescriptor *desc,
+ size_t howmany,
+ long int *code);
END_DECL
+++ /dev/null
-/* $Id$ */
-
-/* gras/datadesc.h - Describing the data you want to exchange */
-
-/* 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. */
-
-#ifndef GRAS_DATADESC_SIMPLE_H
-#define GRAS_DATADESC_SIMPLE_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
-
-/****
- **** The NWS type and constructors
- ****/
-
-typedef enum
- {CHAR_TYPE, DOUBLE_TYPE, FLOAT_TYPE, INT_TYPE, LONG_TYPE, SHORT_TYPE,
- UNSIGNED_INT_TYPE, UNSIGNED_LONG_TYPE, UNSIGNED_SHORT_TYPE, STRUCT_TYPE}
- DataTypes;
-#define SIMPLE_TYPE_COUNT 9
-
-typedef struct DataDescriptorStruct {
- DataTypes type;
- size_t repetitions;
- size_t offset;
- struct DataDescriptorStruct *members;
- size_t length;
- size_t tailPadding;
-} DataDescriptor;
-#ifndef NULL
-#define NULL 0
-#endif
-#define SIMPLE_DATA(type,repetitions) {type, repetitions, 0, NULL, 0, 0}
-#define SIMPLE_MEMBER(type,repetitions,offset) \
- {type, repetitions, offset, NULL, 0, 0}
-#define PAD_BYTES(structType,lastMember,memberType,repetitions) \
- sizeof(structType) - offsetof(structType, lastMember) - \
- sizeof(memberType) * repetitions
-
-/****
- **** Gras (opaque) type, constructors and functions
- ****/
-
-typedef struct gras_datadesc_ gras_datadesc_t;
-
-/* constructors, memory management */
-gras_error_t gras_datadesc_parse(const char *def,
- gras_datadesc_t **dst);
-gras_error_t gras_datadesc_from_nws(const DataDescriptor *desc,
- size_t howmany,
- gras_datadesc_t **dst);
-
-gras_error_t gras_datadesc_cpy(gras_datadesc_t *src,
- gras_datadesc_t **dst);
-void gras_datadesc_free(gras_datadesc_t **dd);
-
-/* basic functionnalities */
-int gras_datadesc_cmp(const gras_datadesc_t *d1,
- const gras_datadesc_t *d2);
-
-gras_error_t gras_datadesc_sizeof_host(gras_datadesc_t *desc,
- size_t *dst);
-gras_error_t gras_datadesc_sizeof_network(gras_datadesc_t *desc,
- size_t *dst);
-
-/* high level function needed in SG */
-gras_error_t gras_datadesc_data_cpy(const gras_datadesc_t *dd,
- const void *src,
- void **dst);
-
-/* high level functions needed in RL */
-gras_error_t gras_datadesc_convert_recv(const gras_datadesc_t *dd,
- gras_trp_plugin_t *trp,
- void **dst);
-gras_error_t gras_datadesc_convert_send(const gras_datadesc_t *dd,
- gras_trp_plugin_t *trp,
- void *src);
-
-END_DECL
-
-#endif /* GRAS_DATADESC_SIMPLE_H */
-
+++ /dev/null
-/* gs_type_bag.h */
-#ifndef GS_TYPE_BAG_H
-#define GS_TYPE_BAG_H
-
-/* used structs */
-struct s_gs_type_bag;
-struct s_gs_type_driver;
-
-struct s_gs_type_bag_ops {
-
- void
- (*_init) (struct s_gs_type_bag *p_type_bag);
-
- void
- (*_exit) (struct s_gs_type_bag *p_type_bag);
-
-
- void
- (*register_incoming_connection) (struct s_gs_type_bag *p_type_bag,
- struct s_gs_connection *p_connection);
-
- void
- (*register_outgoing_connection) (struct s_gs_type_bag *p_type_bag,
- struct s_gs_connection *p_connection);
-
-
- void
- (*store_type) (struct s_gs_type_bag *p_type_bag,
- struct s_gs_connection *p_connection,
- struct s_gs_type *p_type);
-
- void
- (*store_incoming_type) (struct s_gs_type_bag *p_type_bag,
- struct s_gs_connection *p_connection,
- struct s_gs_type *p_type);
-
- struct s_gs_type *
- (*get_type_by_name) (struct s_gs_type_bag *p_type_bag,
- struct s_gs_connection *p_connection,
- const char *name);
-
- struct s_gs_type *
- (*get_type_by_code) (struct s_gs_type_bag *p_type_bag,
- struct s_gs_connection *p_connection,
- int code);
-
- void
- (*mark_type) (struct s_gs_type_bag *p_type_bag,
- struct s_gs_connection *p_connection,
- const char *name);
-
- int
- (*check_type_mark) (struct s_gs_type_bag *p_type_bag,
- struct s_gs_connection *p_connection,
- const char *name);
-
-
- void
- (*store_message) (struct s_gs_type_bag *p_type_bag,
- struct s_gs_connection *p_connection,
- struct s_gs_message *p_message);
-
- void
- (*store_incoming_message) (struct s_gs_type_bag *p_type_bag,
- struct s_gs_connection *p_connection,
- struct s_gs_message *p_message);
-
- struct s_gs_message *
- (*get_message_by_name) (struct s_gs_type_bag *p_type_bag,
- struct s_gs_connection *p_connection,
- const char *name);
-
- struct s_gs_message *
- (*get_message_by_code) (struct s_gs_type_bag *p_type_bag,
- struct s_gs_connection *p_connection,
- int code);
-
- void
- (*mark_message) (struct s_gs_type_bag *p_type_bag,
- struct s_gs_connection *p_connection,
- const char *name);
-
- int
- (*check_message_mark) (struct s_gs_type_bag *p_type_bag,
- struct s_gs_connection *p_connection,
- const char *name);
-
-};
-
-struct s_gs_type_bag {
- struct s_gs_type_bag_ops *bag_ops;
- struct s_gs_type_driver *p_type_driver;
- void *specific;
-};
-
-
-#endif /* GS_TYPE_BAG_H */
#ifndef GRAS_H
#define GRAS_H
-/* Oli's macro */
-#ifndef GS_FAILURE_CONTEXT
-# define GS_FAILURE_CONTEXT
-#endif /* GS_FAILURE_CONTEXT */
-
-#define GS_FAILURE(str) \
- (fprintf(stderr, "FAILURE: %s(%s:%d)" GS_FAILURE_CONTEXT "%s\n", __func__, __FILE__, __LINE__, (str)), \
- abort())
-
#define max(a, b) (((a) > (b))?(a):(b))
#define min(a, b) (((a) < (b))?(a):(b))
#define TRUE 1
#define FALSE 0
-/* end of Oli's cruft */
-
#include <gras/error.h>
#include <gras/log.h>
#include <gras/transport.h>
#include <gras/datadesc.h>
-//#include <gras/datadesc_simple.h>
-#include <gras/socket.h>
#include <gras/messages.h>
-#include <gras/data_description.h>
-#include <gras/dd_type_bag.h>
-
#include <gras/modules/base.h>
#include <gras/modules/bandwidth.h>
*/
typedef struct {
/* public */
- gras_sock_t *sock; /** the socket on which the message was received (to answer) */
+ gras_socket_t *sock; /** the socket on which the message was received (to answer) */
/* private */
gras_msgheader_t *header;
* Create a new message, and send it on the network through the given socket.
*/
gras_error_t
-gras_msg_new_and_send(gras_sock_t *sd,
+gras_msg_new_and_send(gras_socket_t *sd,
gras_msgid_t msgId,
int seqCount,
...);
*/
gras_error_t
-gras_msg_send(gras_sock_t *sd,
+gras_msg_send(gras_socket_t *sd,
gras_msg_t *msg,
e_gras_free_directive_t freeDirective);
* on localhost's stderr.
*/
void
-grasRepportError (gras_sock_t *sock, gras_msgid_t id, int SeqCount,
+grasRepportError (gras_socket_t *sock, gras_msgid_t id, int SeqCount,
const char *severeError,
gras_error_t errcode, const char* format,...);
+++ /dev/null
-/* $Id$ */
-
-/* gras/socket.h - handling sockets in GRAS */
-
-/* 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. */
-
-
-#ifndef GRAS_SOCK_H
-#define GRAS_SOCK_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
-
-/****************************************************************************/
-/* Openning/Maintaining/Closing connexions */
-/****************************************************************************/
-/** Number of channel opened at most on a given host within SimGrid */
-#define MAX_CHANNEL 10
-
-/*! Type of a communication socket */
-typedef struct gras_sock_s gras_sock_t;
-
-/**
- * gras_sock_client_open:
- * @host: name of the host we want to connect to
- * @Param2: port on which we want to connect on this host
- * @sock: Newly created socket
- * @Returns: an errcode
- *
- * Attempts to establish a connection to the server listening to host:port
- */
-gras_error_t
-gras_sock_client_open(const char *host, short port,
- /* OUT */ gras_sock_t **sock);
-
-/**
- * gras_sock_server_open:
- * @Param1: starting port
- * @Param2: ending port
- * @sock: Newly create socket
- * @Returns: an errcode
- *
- * Attempts to bind to any port between #startingPort# and #endingPort#,
- * inclusive.
- *
- * You can get the port on which you connected using grasSockGetPort().
- */
-gras_error_t
-gras_sock_server_open(unsigned short startingPort,
- unsigned short endingPort,
- /* OUT */ gras_sock_t **sock);
-
-/**
- * gras_sock_close:
- * @sock: The socket to close.
- * @Returns: an errcode
- *
- * Tears down a socket.
- */
-gras_error_t gras_sock_close(gras_sock_t *sock);
-
-
-/****************************************************************************/
-/* Converting DNS name <-> IP */
-/****************************************************************************/
-/**
- * gras_sock_get_peer_name:
- * @sd:
- * @Returns: the DNS name of the host connected to #sd#, or descriptive text if
- * #sd# is not an inter-host connection: returns NULL in case of error
- *
- * The value returned should not be freed.
- */
-char *
-gras_sock_get_peer_name(gras_sock_t *sd);
-
-/**
- * gras_sock_get_peer_port:
- * @sd:
- * @Returns: the port number on the other side of socket sd. -1 is returned
- * if pipes or unknown
- */
-unsigned short
-gras_sock_get_peer_port(gras_sock_t *sd);
-
-/**
- * gras_sock_get_peer_addr:
- * @sd:
- * @Returns: the IP address of the other side of this socket.
- *
- * can return NULL (out of memory condition).
- * Do not free the result.
- */
-char *
-gras_sock_get_peer_addr(gras_sock_t *sd);
-
-/**
- * gras_sock_get_my_port:
- * @sd:
- * @Returns: the port number on the this side of socket sd. -1 is returned
- * if pipes or unknown
- */
-unsigned short
-gras_sock_get_my_port(gras_sock_t *sd);
-
-/* **************************************************************************
- * Raw sockets and BW experiments (should be placed in another file)
- * **************************************************************************/
-typedef struct gras_rawsock_s gras_rawsock_t;
-
-/**
- * gras_rawsock_client_open:
- *
- * Establishes a connection to @machine : @port on which the buffer sizes have
- * been set to @bufSize bytes.
- *
- * Those sockets are meant to send raw data without any conversion, for example
- * for bandwidth tests.
- */
-gras_error_t
-gras_rawsock_client_open(const char *host, short port, unsigned int bufSize,
- /* OUT */ gras_rawsock_t **sock);
-
-/**
- * gras_rawsock_server_open:
- *
- * Open a connexion waiting for external input, on which the buffer sizes have
- * been set to @bufSize bytes.
- *
- * Those sockets are meant to send raw data without any conversion, for example
- * for bandwidth tests.
- */
-gras_error_t
-gras_rawsock_server_open(unsigned short startingPort, unsigned short endingPort,
- unsigned int bufSize, /* OUT */ gras_rawsock_t **sock);
-
-/**
- * gras_rawsock_close:
- *
- * Close a raw socket.
- *
- * Those sockets are meant to send raw data without any conversion, for example
- * for bandwidth tests.
- */
-gras_error_t
-gras_rawsock_close(gras_rawsock_t *sock);
-
-/**
- * gras_rawsocket_get_my_port:
- * @sd:
- * @Returns: the port number on the this side of socket sd. -1 is returned
- * if pipes or unknown
- */
-unsigned short
-gras_rawsocket_get_my_port(gras_rawsock_t *sd);
-
-/**
- * gras_rawsocket_get_peer_port:
- * @sd:
- * @Returns: the port number on the other side of socket sd. -1 is returned
- * if pipes or unknown
- */
-unsigned short
-gras_rawsock_get_peer_port(gras_rawsock_t *sd);
-
-/**
- * gras_rawsock_send:
- * @sock: on which raw socket to send the data
- * @expSize: total size of data sent
- * @msgSize: size of each message sent one after the other
- *
- * Send a raw bunch of data, for example for a bandwith test.
- */
-
-gras_error_t
-gras_rawsock_send(gras_rawsock_t *sd, unsigned int expSize, unsigned int msgSize);
-
-/**
- * gras_rawsock_recv:
- * @sock: on which raw socket to read the data
- * @expSize: total size of data received
- * @msgSize: size of each message received one after the other
- * @timeout: time to wait for that data
- *
- * Receive a raw bunch of data, for example for a bandwith test.
- */
-
-gras_error_t
-gras_rawsock_recv(gras_rawsock_t *sd, unsigned int expSize, unsigned int msgSize,
- unsigned int timeout);
-
-
-END_DECL
-
-#endif /* GRAS_SOCK_H */
-
#ifndef GRAS_TRANSPORT_H
#define GRAS_TRANSPORT_H
-/* each plugin implements the socket the way it wants */
-typedef void gras_trp_sock_t;
+typedef struct s_gras_socket gras_socket_t;
/* A plugin type */
typedef struct gras_trp_plugin_ gras_trp_plugin_t;
void gras_trp_exit(void);
-gras_error_t gras_trp_plugin_get_by_name(const char *name,
- gras_trp_plugin_t **dst);
-
-
+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);
+
+
+gras_error_t gras_trp_bloc_send(gras_socket_t *sd,
+ void *data,
+ size_t size);
+gras_error_t gras_trp_bloc_recv(gras_socket_t *sd,
+ void *data,
+ size_t size);
#endif /* GRAS_TRANSPORT_H */
# Constants.
PROGRAM=ltmain.sh
PACKAGE=libtool
-VERSION=1.5.0a
-TIMESTAMP=" (1.1220.2.35 2003/11/12 18:51:58) Debian$Rev: 179 $"
+VERSION=1.5.2
+TIMESTAMP=" (1.1220.2.60 2004/01/25 12:25:08) Debian$Rev: 192 $"
default_mode=
help="Try \`$progname --help' for more information."
no_install=no
objs=
non_pic_objects=
+ precious_files_regex=
prefer_static_libs=no
preload=no
prev=
prev=
continue
;;
+ precious_regex)
+ precious_files_regex="$arg"
+ prev=
+ continue
+ ;;
release)
release="-$arg"
prev=
-o) prev=output ;;
+ -precious-files-regex)
+ prev=precious_regex
+ continue
+ ;;
+
-release)
prev=release
continue
else
$show "extracting exported symbol list from \`$soname'"
save_ifs="$IFS"; IFS='~'
- eval cmds=\"$extract_expsyms_cmds\"
+ cmds=$extract_expsyms_cmds
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd" || exit $?
done
if test -f "$output_objdir/$newlib"; then :; else
$show "generating import library for \`$soname'"
save_ifs="$IFS"; IFS='~'
- eval cmds=\"$old_archive_from_expsyms_cmds\"
+ cmds=$old_archive_from_expsyms_cmds
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd" || exit $?
done
*" $path "*) ;;
*) newlib_search_path="$newlib_search_path $path";;
esac
- path=""
fi
+ path=""
;;
*)
path="-L$path"
*.$objext)
;;
$output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+ if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+ then
+ continue
+ fi
removelist="$removelist $p"
;;
*) ;;
$show "generating symbol list for \`$libname.la'"
export_symbols="$output_objdir/$libname.exp"
$run $rm $export_symbols
- eval cmds=\"$export_symbols_cmds\"
+ cmds=$export_symbols_cmds
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
if len=`expr "X$cmd" : ".*"` &&
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
$show "$cmd"
# Do each of the archive commands.
if test "$module" = yes && test -n "$module_cmds" ; then
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
- eval cmds=\"$module_expsym_cmds\"
+ eval test_cmds=\"$module_expsym_cmds\"
+ cmds=$module_expsym_cmds
else
- eval cmds=\"$module_cmds\"
+ eval test_cmds=\"$module_cmds\"
+ cmds=$module_cmds
fi
else
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
- eval cmds=\"$archive_expsym_cmds\"
+ eval test_cmds=\"$archive_expsym_cmds\"
+ cmds=$archive_expsym_cmds
else
- eval cmds=\"$archive_cmds\"
+ eval test_cmds=\"$archive_cmds\"
+ cmds=$archive_cmds
fi
fi
- if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
+ 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
save_ifs="$IFS"; IFS='~'
for cmd in $concat_cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd" || exit $?
done
# value of $libobjs for piecewise linking.
# Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+ cmds=$module_expsym_cmds
+ else
+ cmds=$module_cmds
+ fi
+ else
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
- eval cmds=\"$archive_expsym_cmds\"
+ cmds=$archive_expsym_cmds
else
- eval cmds=\"$archive_cmds\"
+ cmds=$archive_cmds
+ fi
fi
# Append the command to remove the reloadable object files
# to the just-reset $cmds.
- eval cmds=\"\$cmds~$rm $delfiles\"
+ eval cmds=\"\$cmds~\$rm $delfiles\"
fi
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd" || exit $?
done
reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
output="$obj"
- eval cmds=\"$reload_cmds\"
+ cmds=$reload_cmds
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd" || exit $?
done
# Only do commands if we really have different PIC objects.
reload_objs="$libobjs $reload_conv_objs"
output="$libobj"
- eval cmds=\"$reload_cmds\"
+ cmds=$reload_cmds
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd" || exit $?
done
# Do each command in the archive commands.
if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
- eval cmds=\"$old_archive_from_new_cmds\"
+ cmds=$old_archive_from_new_cmds
else
eval cmds=\"$old_archive_cmds\"
if len=`expr "X$cmds" : ".*"` &&
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
- :
+ cmds=$old_archive_cmds
else
# the command line is too long to link in one step, link in parts
$echo "using piecewise archive linking..."
if test "X$oldobjs" = "X" ; then
eval cmds=\"\$concat_cmds\"
else
- eval cmds=\"\$concat_cmds~$old_archive_cmds\"
+ eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
fi
fi
fi
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
+ eval cmd=\"$cmd\"
IFS="$save_ifs"
$show "$cmd"
$run eval "$cmd" || exit $?
# Do each command in the postinstall commands.
lib="$destdir/$realname"
- eval cmds=\"$postinstall_cmds\"
+ cmds=$postinstall_cmds
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd" || exit $?
done
$show "$install_prog $file $oldlib"
$run eval "$install_prog \$file \$oldlib" || exit $?
- if test -n "$stripme" && test -n "$striplib"; then
+ if test -n "$stripme" && test -n "$old_striplib"; then
$show "$old_striplib $oldlib"
$run eval "$old_striplib $oldlib" || exit $?
fi
# Do each command in the postinstall commands.
- eval cmds=\"$old_postinstall_cmds\"
+ cmds=$old_postinstall_cmds
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd" || exit $?
done
for libdir in $libdirs; do
if test -n "$finish_cmds"; then
# Do each command in the finish commands.
- eval cmds=\"$finish_cmds\"
+ cmds=$finish_cmds
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd" || admincmds="$admincmds
$cmd"
if test "$mode" = uninstall; then
if test -n "$library_names"; then
# Do each command in the postuninstall commands.
- eval cmds=\"$postuninstall_cmds\"
+ cmds=$postuninstall_cmds
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd"
if test "$?" -ne 0 && test "$rmforce" != yes; then
if test -n "$old_library"; then
# Do each command in the old_postuninstall commands.
- eval cmds=\"$old_postuninstall_cmds\"
+ cmds=$old_postuninstall_cmds
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd"
if test "$?" -ne 0 && test "$rmforce" != yes; then
-no-undefined declare that a library does not refer to external symbols
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
-objectlist FILE Use a list of object files found in FILE to specify objects
+ -precious-files-regex REGEX
+ don't remove output files matching REGEX
-release RELEASE specify package release information
-rpath LIBDIR the created library will eventually be installed in LIBDIR
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
+++ /dev/null
-/* $Id$ */
-
-/* grasMsg - Function related to messaging (code shared between RL and SG) */
-
-/* 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 "gras_private.h"
-#include <string.h>
-
-/*@null@*/static gras_msgentry_t *grasMsgList = NULL;
-static unsigned int grasMsgCount = 0;
-
-/**
- * Register a new message type to the system
- */
-
-gras_error_t
-gras_msgtype_register(gras_msgid_t message,
- const char *name,
- int sequence_count,
- ...) {
- gras_msgentry_t *entry=grasMsgEntryGet(message);
- gras_cblist_t *cbl=gras_cb_get(message);
- int i;
- DataDescriptor *dd;
- size_t ddCount;
- va_list ap;
-
- // fprintf(stderr,"Register message '%s' under ID %d. Sequence count=%d\n",
- //name,(int)message,sequence_count);
-
- if (entry) { /* Check that it's the same entry re-registered */
- if (strcmp(name,entry->name)) {
- fprintf(stderr,"Second registration of message %d with another name. (old=%s,new=%s)\n",
- (int)message,entry->name,name);
- return malloc_error;
- }
- if (sequence_count != entry->seqCount) {
- fprintf(stderr,
- "Second registration of message %s with another sequence count. (old=%d,new=%d)\n",
- entry->name,entry->seqCount,sequence_count);
- return mismatch_error;
- }
-
- va_start(ap, sequence_count);
- for (i=0;i<sequence_count;i++) {
- dd=va_arg(ap, DataDescriptor*);
- ddCount=va_arg(ap, size_t);
- if (ddCount != entry->ddCount[i]) {
- fprintf(stderr,
- "Different re-registration of message %s: DataDescriptor count is different in sequence %d (is %d, was %d)\n",
- entry->name, i, ddCount, entry->ddCount[i]);
- return sanity_error;
- }
- if (gras_datadesc_cmp(dd,ddCount, entry->dd[i],ddCount)) {
- fprintf(stderr,
- "Different re-registration of message %s: DataDescriptor of sequence %d is different\n",
- entry->name, i);
- return sanity_error;
- }
- }
- va_end(ap);
-
- } else { /* build a new entry */
- if (grasMsgCount++) {
- grasMsgList = (gras_msgentry_t *)realloc(grasMsgList,sizeof(gras_msgentry_t)*grasMsgCount);
- } else {
- grasMsgList = (gras_msgentry_t *)malloc(sizeof(gras_msgentry_t)*grasMsgCount);
- }
- if (!grasMsgList) {
- fprintf(stderr, "PANIC: memory allocation of %d bytes in gras_msgtype_register() failed (Message table LOST).\n",
- sizeof(gras_msgentry_t)*grasMsgCount);
- grasMsgCount=0;
- return malloc_error;
- }
- entry = &(grasMsgList[grasMsgCount-1]);
-
- entry->id = message;
- if (!(entry->name = strdup(name))) {
- fprintf(stderr, "gras_msgtype_register: memory allocation failed.\n");
- grasMsgCount--;
- return malloc_error;
- }
- entry->seqCount = sequence_count;
- if (sequence_count) {
- if (!(entry->dd = (DataDescriptor**)malloc(sizeof(DataDescriptor*)*sequence_count))) {
- fprintf(stderr, "gras_msgtype_register: memory allocation of %d bytes failed.\n",
- sizeof(DataDescriptor*)*sequence_count);
- free(entry->name);
- grasMsgCount--;
- return malloc_error;
- }
- if (!(entry->ddCount = (size_t*)malloc(sizeof(size_t)*sequence_count))) {
- fprintf(stderr, "gras_msgtype_register: memory allocation of %d bytes failed.\n",
- sizeof(size_t)*sequence_count);
- free(entry->dd);
- free(entry->name);
- grasMsgCount--;
- return malloc_error;
- }
- } else {
- entry->dd=NULL;
- entry->ddCount=NULL;
- }
- va_start(ap, sequence_count);
- for (i=0;i<sequence_count;i++) {
- dd=va_arg(ap, DataDescriptor*);
- ddCount=va_arg(ap, size_t);
-
- entry->ddCount[i]=ddCount;
- if (ddCount) {
- if (!(entry->dd[i] = (DataDescriptor*)malloc(sizeof(DataDescriptor)*ddCount))) {
- fprintf(stderr, "gras_msgtype_register: memory allocation of %d bytes failed.\n",
- sizeof(DataDescriptor)*ddCount);
- for (i--;i>=0;i--) free(entry->dd[i]);
- free(entry->ddCount);
- free(entry->dd);
- free(entry->name);
- grasMsgCount--;
- return malloc_error;
- }
- } else {
- entry->dd[i]=NULL;
- }
- memcpy(entry->dd[i],dd,sizeof(DataDescriptor)*ddCount);
- }
- va_end(ap);
- }
- if (cbl) {
- fprintf(stderr,"Warning, message type %s registered twice on this host\n",
- entry->name);
- } else {
- return gras_cb_create(entry->id);
- }
-
- return no_error;
-}
-
-/*
- * Retrieve the entry associated with a message id
- */
-gras_msgentry_t *
-grasMsgEntryGet(gras_msgid_t id) {
- int i;
-
- for (i=0 ; i<grasMsgCount && grasMsgList[i].id != id ; i++);
- return i==grasMsgCount ? NULL : &grasMsgList[i];
-}
-
-/*
- * Create the appropriate header
- */
-gras_msgheader_t *grasMsgHeaderNew(gras_msgid_t msgId,
- unsigned int dataSize,
- unsigned int seqCount) {
- gras_msgheader_t *res;
- if (!(res=(gras_msgheader_t*)malloc(sizeof(gras_msgheader_t)))) {
- fprintf(stderr,"gras_msg_new(): Malloc error (wanted %d bytes)\n",sizeof(gras_msgheader_t));
- return NULL;
- }
- memset(res->version,0,sizeof(res->version));
- strcpy(res->version,GRASVERSION);
- res->message = msgId;
- res->dataSize = dataSize;
- res->seqCount = seqCount;
-
- return res;
-}
-
-gras_msg_t *gras_msg_new_va(gras_msgid_t msgId,
- e_gras_free_directive_t free_data,
- int seqCount,
- va_list ap) {
- gras_msg_t *res;
- int i;
- unsigned int networkSize=0;
-
- /* malloc the needed room, and sanity check */
- if (!(res=(gras_msg_t*)malloc(sizeof(gras_msg_t)))) {
- fprintf(stderr,"gras_msg_new(): Malloc error (wanted %d bytes)\n",sizeof(gras_msg_t));
- return NULL;
- }
- res->freeDirective=free_data;
-
- if (!(res->entry=grasMsgEntryGet(msgId))) {
- fprintf(stderr,"gras_msg_new(): unknown msg id %d\n",msgId);
- free(res);
- return NULL;
- }
- if (res->entry->seqCount != seqCount) {
- fprintf(stderr,"Damnit: you passed %d sequences to build a %s msg, where %d were expected\n",
- seqCount,res->entry->name,res->entry->seqCount);
- free(res);
- return NULL;
- }
- if (seqCount) {
- if (!(res->dataCount=(unsigned int*)malloc(sizeof(unsigned int)*seqCount))) {
- fprintf(stderr,"gras_msg_new(): Malloc error (wanted %d bytes)\n",
- (sizeof(unsigned int)*seqCount));
- free(res);
- return NULL;
- }
- if (!(res->data=(void**)malloc(sizeof(void*)*seqCount))) {
- fprintf(stderr,"gras_msg_new(): Malloc error (wanted %d bytes)\n",
- (sizeof(void*)*seqCount));
- free(res->dataCount);
- free(res);
- return NULL;
- }
- } else {
- res->dataCount = NULL;
- res->data = NULL;
- }
-
- /* populate the message */
- networkSize += DataSize(headerDescriptor,headerDescriptorCount,NETWORK_FORMAT);
- networkSize += DataSize(countDescriptor,countDescriptorCount,NETWORK_FORMAT) * seqCount;
-
- for (i=0; i<seqCount; i++) {
- res->data[i]=va_arg(ap, void*);
- res->dataCount[i]=va_arg(ap, int);
- if (res->dataCount[i] > 1000) {
- fprintf(stderr,"GRAS WARNING: datacount>1000 in a message. You may want to check the arguments passed to gras_msg_new().\n");
- }
- if (res->dataCount[i] < 0) {
- fprintf(stderr,"GRAS ERROR: datacount<0 in a message. Check the arguments passed to gras_msg_new().\n");
- free(res->dataCount);
- free(res->data);
- free(res);
- return NULL;
- }
-
- networkSize += res->dataCount[i] *
- DataSize(res->entry->dd[i],res->entry->ddCount[i],NETWORK_FORMAT);
- }
-
- /* finish filling the fields */
- if (!(res->header=grasMsgHeaderNew(msgId,networkSize,seqCount))) {
- free(res->data);
- free(res->dataCount);
- free(res);
- return NULL;
- }
- res->sock=NULL;
- return res;
-}
-
-gras_msg_t *gras_msg_new(gras_msgid_t msgId,
- e_gras_free_directive_t free_data,
- int seqCount,
- ...) {
- gras_msg_t *res;
- va_list ap;
-
- va_start(ap, seqCount);
- res=gras_msg_new_va(msgId,free_data,seqCount,ap);
- va_end(ap);
-
- return res;
-}
-
-gras_error_t
-gras_msg_new_and_send(gras_sock_t *sd,
- gras_msgid_t msgId,
- int seqCount,
- ...) {
-
- gras_msg_t *msg;
- va_list ap;
-
- va_start(ap, seqCount);
- msg=gras_msg_new_va(msgId,free_after_use,seqCount,ap);
- va_end(ap);
- if (!msg) return unknown_error;
-
- return gras_msg_send(sd,msg,free_after_use);
-}
-
-
-gras_msg_t *gras_msg_copy(gras_msg_t *msg) {
- gras_msg_t *res;
- int i;
-
- fprintf(stderr,"gras_msg_copy: \n");
-
- /* malloc the needed room, and sanity check */
- if (!(res=(gras_msg_t*)malloc(sizeof(gras_msg_t)))) {
- fprintf(stderr,"gras_msg_new(): Malloc error (wanted %d bytes)\n",sizeof(gras_msg_t));
- return NULL;
- }
- res->freeDirective=free_after_use;
- res->entry=msg->entry;
-
- if (!(res->dataCount=(unsigned int*)malloc(sizeof(unsigned int)*res->entry->seqCount))) {
- fprintf(stderr,"gras_msg_new(): Malloc error (wanted %d bytes)\n",
- (sizeof(unsigned int)*res->entry->seqCount));
- free(res);
- return NULL;
- }
- if (!(res->data=(void**)malloc(sizeof(void*)*res->entry->seqCount))) {
- fprintf(stderr,"gras_msg_new(): Malloc error (wanted %d bytes)\n",
- (sizeof(void*)*res->entry->seqCount));
- free(res->dataCount);
- free(res);
- return NULL;
- }
-
- /* populate the message */
- for (i=0; i<res->entry->seqCount; i++) {
- res->data[i]= gras_datadesc_copy_data(msg->entry->dd[i],msg->entry->ddCount[i],res->data[i]);
- res->dataCount[i]=msg->dataCount[i];
- }
-
- /* finish filling the fields */
- if (!(res->header=grasMsgHeaderNew(msg->header->message,
- msg->header->dataSize,
- msg->header->seqCount))) {
- free(res->data);
- free(res->dataCount);
- free(res);
- return NULL;
- }
- res->sock=msg->sock;
-
- return res;
-}
-
-
-void gras_msg_free(gras_msg_t *msg) {
- int i;
-
- if (!msg) return;
- if (msg->freeDirective == free_after_use)
- for (i=0; i<msg->entry->seqCount; i++)
- free(msg->data[i]);
- gras_sock_close(msg->sock);
- free(msg->header);
- // data isn't copied by MsgNew
- free (msg->data);
- free (msg->dataCount);
- free (msg);
-}
-
-gras_error_t gras_msg_handle(double timeOut) {
- grasProcessData_t *pd=grasProcessDataGet();
- int i;
- gras_error_t errcode;
- gras_msg_t *msg;
- gras_cblist_t *cbl;
-
- if (pd->grasMsgQueueLen) {
- /* handle queued message */
-
- msg = pd->grasMsgQueue[0];
- memmove(pd->grasMsgQueue[0],pd->grasMsgQueue[1],(pd->grasMsgQueueLen-1)*sizeof(gras_msg_t));
- pd->grasMsgQueueLen--;
- if (pd->grasMsgQueueLen == 0) {
- /* size reached 0. Free the queue so that the next enlargement (with malloc) don't leak*/
- free(pd->grasMsgQueue);
- /* if size!=0 don't loose the time to realloc to only gain 4 bytes */
- }
- fprintf(stderr,"%s:%d: gras_msg_handle: The message was queued\n",__FILE__,__LINE__);
- return no_error;
- } else {
- /* receive a message from the net */
- if ((errcode=grasMsgRecv(&msg,timeOut))) {
- if (errcode == timeout_error) {
- return no_error;
- } else {
- fprintf(stderr,"gras_msg_handle: error '%s' while receiving\n",gras_error_name(errcode));
- return errcode;
- }
- }
- }
-
- /*
- fprintf(stderr,"GRAS: Handle an incomming message '%s' (datasize=%d, sd=%p)\n",
- msg->entry->name,msg->header->dataSize,msg->sock);
- */
-
- if (!(cbl=gras_cb_get(msg->entry->id))) {
- fprintf(stderr,"Message %s is not registered on this host.\n",
- msg->entry->name);
- gras_msg_free(msg);
- return mismatch_error;
- }
-
- for (i = cbl->cbCount - 1; i>=0 ; i--) {
- if ((*(cbl->cb[i]))(msg)) {
- // if (cbl->cbTTL[i] > 0 && (!--(cbl->cbTTL[i]))) {
- //fprintf(stderr,"GRAS FIXME: Remove the callback from the queue after use if needed.\n");
- //}
- break;
- }
- }
-
- if (i<0) {
- fprintf(stderr,
- "No callback of msg type %s accepts this message. Discarding it\n",
- msg->entry->name);
- gras_msg_free(msg);
- return mismatch_error;
- }
- return no_error;
-}
-
-gras_error_t
-gras_msg_wait(double timeOut,
- gras_msgid_t id,
- gras_msg_t **message) {
- int i;
- gras_error_t errcode;
- double start,now;
- gras_msgentry_t *entry=grasMsgEntryGet(id);
- grasProcessData_t *pd=grasProcessDataGet();
-
- if (!entry) {
- fprintf(stderr,"gras_msg_wait: message id %d is not registered\n",id);
- return mismatch_error;
- }
-
- *message = NULL;
- start=now=gras_time();
-
- for (i=0;i<pd->grasMsgQueueLen;i++) {
- if (pd->grasMsgQueue[i]->header->message == id) {
- *message = pd->grasMsgQueue[i];
- memmove(pd->grasMsgQueue[i],pd->grasMsgQueue[i+1],(pd->grasMsgQueueLen-i-1)*sizeof(gras_msg_t));
- pd->grasMsgQueueLen--;
- if (pd->grasMsgQueueLen == 0) {
- /* size reached 0. Free the queue so that the next enlargement (with malloc) don't leak*/
- free(pd->grasMsgQueue);
- /* if size!=0 don't loose the time to realloc to only gain 4 bytes */
- }
- fprintf(stderr,"%s:%d: gras_msg_wait: The message was queued\n",__FILE__,__LINE__);
- return no_error;
- }
- }
-
- while (1) {
- if ((errcode=grasMsgRecv(message,timeOut))) {
- if (errcode != timeout_error)
- fprintf(stderr,"gras_msg_wait: error '%s' while receiving\n",gras_error_name(errcode));
- return errcode;
- }
-
- if ((*message)->header->message != id) {
- fprintf(stderr,"gras_msg_wait: Got message %s while waiting for message %s. Queue it.\n",
- (*message)->entry->name,entry->name);
- if (pd->grasMsgQueueLen++) {
- pd->grasMsgQueue = (gras_msg_t **)realloc(pd->grasMsgQueue,
- sizeof(gras_msg_t)*pd->grasMsgQueueLen);
- } else {
- pd->grasMsgQueue = (gras_msg_t **)malloc(sizeof(gras_msg_t)*pd->grasMsgQueueLen);
- }
- if (!pd->grasMsgQueue) {
- fprintf(stderr, "PANIC: memory allocation of %d bytes in gras_msg_wait() failed (Queued messages are LOST).\n",
- sizeof(gras_msg_t)*pd->grasMsgQueueLen);
- pd->grasMsgQueueLen=0;
- return malloc_error;
- }
- pd->grasMsgQueue[pd->grasMsgQueueLen - 1] = *message;
- *message=NULL;
- } else {
- // fprintf(stderr,"Waited for %s successfully\n",(*message)->entry->name);
- return no_error;
- }
- now=gras_time();
- if (now - start + 0.001 < timeOut)
- return timeout_error;
- }
-}
-
-
-gras_error_t
-gras_cb_register(gras_msgid_t message,
- int TTL,
- gras_cb_t cb) {
-
- gras_cblist_t *cbl=gras_cb_get(message);
-
- if (!cbl) {
- fprintf(stderr,"Try to register a callback for an unregistered message id %d\n",message);
- return sanity_error;
- }
- if (cbl->cbCount++) {
- cbl->cb = (gras_cb_t *)realloc(cbl->cb,
- sizeof(gras_cb_t)*cbl->cbCount);
- cbl->cbTTL = (int *)realloc(cbl->cbTTL, sizeof(int)*cbl->cbCount);
- } else {
- cbl->cb = (gras_cb_t *)malloc(sizeof(gras_cb_t)*cbl->cbCount);
- cbl->cbTTL = (int *)malloc( sizeof(int)*cbl->cbCount);
- }
- if (!cbl->cb || !cbl->cbTTL) {
- fprintf(stderr,"gras_cb_register(): Malloc error (All callbacks for msg %d lost)\n",
- message);
- cbl->cb=NULL;
- cbl->cbTTL=NULL; /* Yes, leaking here, but we're dead anyway */
- cbl->cbCount=0;
- return malloc_error;
- }
- cbl->cb [ cbl->cbCount-1 ]=cb;
- cbl->cbTTL[ cbl->cbCount-1 ]=TTL;
-
- return no_error;
-}
#include "DataDesc/datadesc_private.h"
GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(DataDesc,GRAS);
-/* FIXME: make this machine-dependent using a trick such as UserData*/
+/* FIXME: make this host-dependent using a trick such as UserData*/
gras_set_t *gras_datadesc_set_local=NULL;
+
+/* callback for array size when sending strings */
+static int
+_strlen_cb(void *vars,
+ gras_datadesc_type_t *type,
+ void *data) {
+
+ return 1+(long int)strlen(data);
+}
+
+
/**
* gras_datadesc_init:
*
void
gras_datadesc_init(void) {
gras_error_t errcode;
+ gras_datadesc_type_t *ddt; /* What to add */
+ gras_datadesc_type_t *elm; /* element of ddt when needed */
VERB0("Initializing DataDesc");
- errcode = gras_dd_typeset_create(GRAS_THISARCH,&gras_datadesc_set_local);
- gras_assert0(errcode==no_error,
- "Impossible to create the data set containg locally known types");
+ TRYFAIL(gras_set_new(&gras_datadesc_set_local));
+
+ TRYFAIL(gras_ddt_new_scalar("signed char",
+ gras_ddt_scalar_char, e_gras_dd_scalar_encoding_sint,
+ NULL, &ddt));
+ TRYFAIL(gras_ddt_register(ddt));
+
+ TRYFAIL(gras_ddt_new_scalar("unsigned char",
+ gras_ddt_scalar_char, e_gras_dd_scalar_encoding_uint,
+ NULL, &ddt));
+ TRYFAIL(gras_ddt_register(ddt));
+
+
+ TRYFAIL(gras_ddt_new_scalar("signed short int",
+ gras_ddt_scalar_short, e_gras_dd_scalar_encoding_sint,
+ NULL, &ddt));
+ TRYFAIL(gras_ddt_register(ddt));
+
+ TRYFAIL(gras_ddt_new_scalar("unsigned short int",
+ gras_ddt_scalar_short, e_gras_dd_scalar_encoding_uint,
+ NULL, &ddt));
+ TRYFAIL(gras_ddt_register(ddt));
+
+
+ TRYFAIL(gras_ddt_new_scalar("signed int",
+ gras_ddt_scalar_int, e_gras_dd_scalar_encoding_sint,
+ NULL, &ddt));
+ TRYFAIL(gras_ddt_register(ddt));
+
+ TRYFAIL(gras_ddt_new_scalar("unsigned int",
+ gras_ddt_scalar_int, e_gras_dd_scalar_encoding_uint,
+ NULL, &ddt));
+ TRYFAIL(gras_ddt_register(ddt));
+
+
+ TRYFAIL(gras_ddt_new_scalar("signed long int",
+ gras_ddt_scalar_long, e_gras_dd_scalar_encoding_sint,
+ NULL, &ddt));
+ TRYFAIL(gras_ddt_register(ddt));
+
+ TRYFAIL(gras_ddt_new_scalar("unsigned long int",
+ gras_ddt_scalar_long, e_gras_dd_scalar_encoding_uint,
+ NULL, &ddt));
+ TRYFAIL(gras_ddt_register(ddt));
+
+
+ TRYFAIL(gras_ddt_new_scalar("signed long long int",
+ gras_ddt_scalar_long_long, e_gras_dd_scalar_encoding_sint,
+ NULL, &ddt));
+ TRYFAIL(gras_ddt_register(ddt));
+
+ TRYFAIL(gras_ddt_new_scalar("unsigned long long int",
+ gras_ddt_scalar_long_long, e_gras_dd_scalar_encoding_uint,
+ NULL, &ddt));
+ TRYFAIL(gras_ddt_register(ddt));
+
+
+ TRYFAIL(gras_ddt_new_scalar("data pointer",
+ gras_ddt_scalar_pdata, e_gras_dd_scalar_encoding_uint,
+ NULL, &ddt));
+ TRYFAIL(gras_ddt_register(ddt));
+
+ TRYFAIL(gras_ddt_new_scalar("function pointer",
+ gras_ddt_scalar_pfunc, e_gras_dd_scalar_encoding_uint,
+ NULL, &ddt));
+ TRYFAIL(gras_ddt_register(ddt));
+
+
+ TRYFAIL(gras_ddt_new_scalar("float",
+ gras_ddt_scalar_float, e_gras_dd_scalar_encoding_float,
+ NULL, &ddt));
+ TRYFAIL(gras_ddt_register(ddt));
+
+ TRYFAIL(gras_ddt_new_scalar("double",
+ gras_ddt_scalar_float, e_gras_dd_scalar_encoding_float,
+ NULL,&ddt));
+ TRYFAIL(gras_ddt_register(ddt));
+
+ TRYFAIL(gras_ddt_get_by_name("unsigned char",&elm));
+ TRYFAIL(gras_ddt_new_array("string", elm, 0, _strlen_cb, NULL, &ddt));
+ TRYFAIL(gras_ddt_register(ddt));
}
/**
/* $Id$ */
-/* datadesc_interface - declarations visible within GRAS, but not public */
+/* datadesc - describing the data to exchange */
+
+/* module's public interface exported within GRAS, but not to end user. */
/* Authors: Olivier Aumage, Martin Quinson */
/* Copyright (C) 2003, 2004 the GRAS posse. */
void gras_datadesc_init(void);
void gras_datadesc_exit(void);
+/* - main functions - */
+/* compare two data type description */
+int
+gras_datadesc_type_cmp(const gras_datadesc_type_t *d1,
+ const gras_datadesc_type_t *d2);
+
+
+/* Copy a described data in memory */
+gras_error_t
+gras_datadesc_cpy(gras_datadesc_type_t *type, void *src, void **dst);
+
+/* Send stuff */
+gras_error_t
+gras_datadesc_send(gras_socket_t *sock, gras_datadesc_type_t *type, void *src);
+
+/* Receive (and convert) stuff */
+gras_error_t
+gras_datadesc_recv(gras_socket_t *sock, gras_datadesc_type_t *type, void **dst);
+
+
+/* -- */
/* free a given ddt */
void gras_ddt_free(gras_datadesc_type_t **type);
/* declare in the given set, and retrieve afterward */
-gras_error_t gras_ddt_register(gras_set_t *set,
- gras_datadesc_type_t *type);
-gras_error_t gras_ddt_get_by_name(gras_set_t *set,
- const char *name,
+gras_error_t gras_ddt_register(gras_datadesc_type_t *type);
+gras_error_t gras_ddt_get_by_name(const char *name,
+ gras_datadesc_type_t **type);
+gras_error_t gras_ddt_get_by_code(int code,
gras_datadesc_type_t **type);
-
-
-/* create a type set, and bootstrap it by declaring all basic types in it */
-gras_error_t
-gras_dd_typeset_create(int gras_arch,
- gras_set_t **set);
#endif /* GRAS_DATADESC_INTERFACE_H */
/* $Id$ */
-/* datadesc_private - declarations visible only from within datadesc */
+/* datadesc - describing the data to exchange */
+
+/* module's private interface masked even to other parts of GRAS. */
/* Authors: Olivier Aumage, Martin Quinson */
/* Copyright (C) 2003, 2004 the GRAS posse. */
extern gras_set_t *gras_datadesc_set_local;
+/*******************************************
+ * Descriptions of all known architectures *
+ *******************************************/
+
+#define gras_arch_count 1
+typedef enum {
+ gras_ddt_scalar_char = 0,
+ gras_ddt_scalar_short = 1,
+ gras_ddt_scalar_int = 2,
+ gras_ddt_scalar_long = 3,
+ gras_ddt_scalar_long_long = 4,
+
+ gras_ddt_scalar_pdata = 5,
+ gras_ddt_scalar_pfunc = 6,
+
+ gras_ddt_scalar_float = 7,
+ gras_ddt_scalar_double = 8
+} gras_ddt_scalar_type_t;
+
+typedef struct {
+ const char *name;
+
+ int endian;
+
+ int sizeof_scalars[9]; /* char,short,int,long,long_long,
+ pdata,pfunc,
+ float,double */
+} gras_arch_sizes_t;
+
+extern const gras_arch_sizes_t gras_arch_sizes[gras_arch_count];
+
+
/**********************************************************/
/* Actual definitions of the stuff in the type descriptor */
/**********************************************************/
typedef struct s_gras_dd_cat_field {
char *name;
- long int offset; /* only for struct */
+ long int offset[gras_arch_count]; /* only for struct */
int code;
gras_datadesc_type_cb_void_t pre;
gras_datadesc_type_cb_void_t post;
} gras_dd_cat_field_t;
+
void gras_dd_cat_field_free(void *f);
/**
* Specific fields of a struct
*/
typedef struct s_gras_dd_cat_struct {
- gras_dynar_t *fields; /* elm type = gras_dd_cat_struct_field_t */
+ gras_dynar_t *fields; /* elm type = gras_dd_cat_field_t */
} gras_dd_cat_struct_t;
/**
*/
typedef struct s_gras_dd_cat_union {
gras_datadesc_type_cb_int_t field_count;
- gras_dynar_t *fields; /* elm type = gras_dd_cat_union_field_t */
+ gras_dynar_t *fields; /* elm type = gras_dd_cat_field_t */
} gras_dd_cat_union_t;
/**
unsigned int name_len;
/* payload */
- long int size;
+ long int size[gras_arch_count];
- long int alignment;
- long int aligned_size;
+ long int alignment[gras_arch_count];
+ long int aligned_size[gras_arch_count];
enum e_gras_datadesc_type_category category_code;
union u_gras_datadesc_category category;
***************************/
gras_error_t
gras_ddt_new_scalar(const char *name,
- long int size,
+ gras_ddt_scalar_type_t type,
enum e_gras_dd_scalar_encoding encoding,
gras_datadesc_type_cb_void_t cb,
gras_datadesc_type_t **dst);
gras_datadesc_type_t **dst);
+gras_error_t
+gras_ddt_new_parse(const char *name,
+ const char *C_definition,
+ gras_datadesc_type_t **dst);
+gras_error_t
+gras_ddt_new_from_nws(const char *name,
+ const DataDescriptor *desc,
+ size_t howmany,
+ gras_datadesc_type_t **dst);
+
#endif /* GRAS_DATADESC_PRIVATE_H */
* Create a new scalar and give a pointer to it
*/
gras_error_t
-gras_ddt_new_scalar(const char *name,
- long int size,
+gras_ddt_new_scalar(const char *name,
+ gras_ddt_scalar_type_t type,
enum e_gras_dd_scalar_encoding encoding,
gras_datadesc_type_cb_void_t cb,
gras_datadesc_type_t **dst) {
gras_error_t errcode;
gras_datadesc_type_t *res;
+ long int arch;
TRY(gras_ddt_new(name,dst));
res=*dst;
- res->size = size>0 ? size : 0;
-
- if (size>0) {
- long int sz = size;
- long int mask = sz;
+ for (arch = 0; arch < gras_arch_count; arch ++) {
+ long int sz;
+ long int mask;
- /* just in case you wonder, x>>1 == x/2 on all architectures when x>=0 */
+ res->size[arch] = gras_arch_sizes[arch].sizeof_scalars[type];
+
+ sz = res->size[arch];
+ mask = sz;
+
+ /* just in case you wonder, x>>1 == x/2 on all architectures when x>=0 and a size is always>=0 */
/* make sure mask have all the bits under the biggest one of size set to 1
Example: size=000100101 => mask=0000111111 */
while ((sz >>= 1)) {
mask |= sz;
}
-
- if (size & (mask >> 1)) { /* if size have bits to one beside its biggest */
+
+ if (res->size[arch] & (mask >> 1)) { /* if size have bits to one beside its biggest */
/* size is not a power of 2 */
/* alignment= next power of 2 after size */
- res->alignment = (size & ~(mask >> 1)) << 1;
- gras_assert0(res->alignment != 0,
+ res->alignment[arch] = (res->size[arch] & ~(mask >> 1)) << 1;
+ gras_assert0(res->alignment[arch] != 0,
"scalar type too large");
- res->aligned_size = aligned(size, res->alignment);
- gras_assert0 (res->aligned_size >= 0,
+ res->aligned_size[arch] = aligned(res->size[arch], res->alignment[arch]);
+ gras_assert0 (res->aligned_size[arch] >= 0,
"scalar type too large");
} else {
/* size is a power of 2, life is great */
- res->alignment = size;
- res->aligned_size = size;
+ res->alignment[arch] = res->size[arch];
+ res->aligned_size[arch] = res->size[arch];
}
-
- } else {
- res->alignment = 0;
- res->aligned_size = 0;
+
+ /* FIXME size < 0 sometimes?
+ } else {
+ res->alignment = 0;
+ res->aligned_size = 0;
+ }
+ */
}
res->category_code = e_gras_datadesc_type_cat_scalar;
gras_error_t errcode;
gras_datadesc_type_t *res;
+ long int arch;
TRY(gras_ddt_new(name,dst));
res=*dst;
- res->size = 0;
- res->alignment = 0;
- res->aligned_size = 0;
+ for (arch=0; arch<gras_arch_count; arch ++) {
+ res->size[arch] = 0;
+ res->alignment[arch] = 0;
+ res->aligned_size[arch] = 0;
+ }
res->category_code = e_gras_datadesc_type_cat_struct;
TRY(gras_dynar_new(&(res->category.struct_data.fields),
sizeof(gras_dd_cat_field_t*),
gras_error_t errcode;
gras_dd_cat_field_t *field;
+ int arch;
gras_assert0(field_type->size >= 0,
"Cannot add a dynamically sized field in a structure");
RAISE_MALLOC;
field->name = strdup(name);
- field->offset = aligned(struct_type->size, field_type->alignment);
+
+ for (arch=0; arch<gras_arch_count; arch ++) {
+ field->offset[arch] = aligned(struct_type->size[arch], field_type->alignment[arch]);
+ }
field->code = field_type->code;
field->pre = pre;
field->post = post;
TRY(gras_dynar_push(struct_type->category.struct_data.fields, field));
- struct_type->size = field->offset + field_type->size;
- struct_type->alignment = max(struct_type->alignment, field_type->alignment);
- struct_type->aligned_size = aligned(struct_type->size, struct_type->alignment);
+ for (arch=0; arch<gras_arch_count; arch ++) {
+ struct_type->size[arch] = field->offset[arch] + field_type->size[arch];
+ struct_type->alignment[arch] = max(struct_type->alignment[arch], field_type->alignment[arch]);
+ struct_type->aligned_size[arch] = aligned(struct_type->size[arch], struct_type->alignment[arch]);
+ }
return no_error;
}
gras_error_t errcode;
gras_datadesc_type_t *res;
+ int arch;
gras_assert0(field_count,
"Attempt to creat an union without field_count function");
TRY(gras_ddt_new(name,dst));
res=*dst;
- res->size = 0;
- res->alignment = 0;
- res->aligned_size = 0;
+ for (arch=0; arch<gras_arch_count; arch ++) {
+ res->size[arch] = 0;
+ res->alignment[arch] = 0;
+ res->aligned_size[arch] = 0;
+ }
res->category_code = e_gras_datadesc_type_cat_union;
TRY(gras_dynar_new(&(res->category.union_data.fields),
sizeof(gras_dd_cat_field_t*),
gras_error_t errcode;
gras_dd_cat_field_t *field;
+ int arch;
gras_assert0(field_type->size >= 0,
"Cannot add a dynamically sized field in an union");
RAISE_MALLOC;
field->name = strdup(name);
- field->offset = 0; /* that's the purpose of union ;) */
+ for (arch=0; arch<gras_arch_count; arch ++) {
+ field->offset[arch] = 0; /* that's the purpose of union ;) */
+ }
field->code = field_type->code;
field->pre = pre;
field->post = post;
TRY(gras_dynar_push(union_type->category.union_data.fields, field));
- union_type->size = max(union_type->size, field_type->size);
- union_type->alignment = max(union_type->alignment, field_type->alignment);
- union_type->aligned_size = aligned(union_type->size, union_type->alignment);
+ for (arch=0; arch<gras_arch_count; arch ++) {
+ union_type->size[arch] = max(union_type->size[arch], field_type->size[arch]);
+ union_type->alignment[arch] = max(union_type->alignment[arch], field_type->alignment[arch]);
+ union_type->aligned_size[arch] = aligned(union_type->size[arch], union_type->alignment[arch]);
+ }
return no_error;
}
gras_error_t errcode;
gras_datadesc_type_t *res;
+ int arch;
gras_assert0(discriminant || referenced_type,
"Attempt to create a generic reference without discriminant");
res=*dst;
/* FIXME: Size from bootstraping */
- res->size = 0;
- res->alignment = 0;
- res->aligned_size = 0;
+ for (arch=0; arch<gras_arch_count; arch ++) {
+ res->size[arch] = 0;
+ res->alignment[arch] = 0;
+ res->aligned_size[arch] = 0;
+ }
+
res->category_code = e_gras_datadesc_type_cat_ref;
res->category.ref_data.code = referenced_type ? referenced_type->code : -1;
gras_error_t errcode;
gras_datadesc_type_t *res;
+ int arch;
gras_assert0(dynamic_size || fixed_size>0,
"Attempt to create a dynamic array without size discriminant");
TRY(gras_ddt_new(name,dst));
res=*dst;
- if (fixed_size <= 0) {
- res->size = fixed_size;
- } else {
- res->size = fixed_size * element_type->aligned_size;
+ for (arch=0; arch<gras_arch_count; arch ++) {
+ if (fixed_size <= 0) {
+ res->size[arch] = fixed_size; /* make sure it indicates "dynamic" */
+ } else {
+ res->size[arch] = fixed_size * element_type->aligned_size[arch];
+ }
+ res->alignment[arch] = element_type->alignment[arch];
+ res->aligned_size[arch] = fixed_size; /*FIXME: That was so in GS, but looks stupid*/
}
- res->alignment = element_type->alignment;
- res->aligned_size = fixed_size; /*FIXME: That was so in GS, but looks stupid*/
res->category_code = e_gras_datadesc_type_cat_array;
res->category.array_data.code = element_type->code;
long int alignment,
gras_datadesc_type_cb_void_t post,
gras_datadesc_type_t **dst) {
+ RAISE_UNIMPLEMENTED;
+ /*
gras_error_t errcode;
gras_datadesc_type_t *res;
res->size = size;
return no_error;
+ */
+}
+
+/**
+ * gras_ddt_new_parse:
+ *
+ * Create a datadescription from the result of parsing the C type description
+ */
+gras_error_t
+gras_ddt_new_parse(const char *name,
+ const char *C_statement,
+ gras_datadesc_type_t **dst) {
+ RAISE_UNIMPLEMENTED;
+}
+
+
+gras_error_t
+gras_ddt_new_from_nws(const char *name,
+ const DataDescriptor *desc,
+ size_t howmany,
+ gras_datadesc_type_t **dst) {
+ RAISE_UNIMPLEMENTED;
}
/**
gras_error_t errcode;
gras_datadesc_type_t *type;
TRY(gras_ddt_new_struct(name, pre, post, &type));
- TRY(gras_ddt_register(gras_datadesc_set_local, type));
+ TRY(gras_ddt_register(type));
*code = type->code;
return no_error;
}
gras_error_t errcode;
gras_datadesc_type_t *type;
TRY(gras_ddt_new_union(name, field_count, post, &type));
- TRY(gras_ddt_register(gras_datadesc_set_local, type));
+ TRY(gras_ddt_register(type));
*code = type->code;
return no_error;
}
gras_error_t errcode;
gras_datadesc_type_t *type;
TRY(gras_ddt_new_ref(name, referenced_type,discriminant,post, &type));
- TRY(gras_ddt_register(gras_datadesc_set_local, type));
+ TRY(gras_ddt_register(type));
*code = type->code;
return no_error;
}
gras_error_t errcode;
gras_datadesc_type_t *type;
TRY(gras_ddt_new_array(name, element_type, fixed_size, dynamic_size, post, &type));
- TRY(gras_ddt_register(gras_datadesc_set_local, type));
+ TRY(gras_ddt_register(type));
+ *code = type->code;
+ return no_error;
+}
+
+/**
+ * gras_datadesc_parse:
+ *
+ * Parse a C type declaration, and declare locally the corresponding type description
+ */
+gras_error_t
+gras_datadesc_parse(const char *name,
+ const char *definition,
+ long int *code) {
+ gras_error_t errcode;
+ gras_datadesc_type_t *type;
+ TRY(gras_ddt_new_parse(name,definition,&type));
+ TRY(gras_ddt_register( type));
+ *code = type->code;
+ return no_error;
+}
+
+/**
+ * gras_datadesc_parse:
+ *
+ * Parse a NWS type declaration, and declare locally the corresponding type description
+ */
+gras_error_t
+gras_datadesc_from_nws(const char *name,
+ const DataDescriptor *desc,
+ size_t howmany,
+ long int *code) {
+
+ gras_error_t errcode;
+ gras_datadesc_type_t *type;
+ TRY(gras_ddt_new_from_nws(name,desc,howmany,&type));
+ TRY(gras_ddt_register(type));
*code = type->code;
return no_error;
}
#include "DataDesc/datadesc_private.h"
-/* callback for array size when sending strings */
-static int
-_strlen_cb(void *vars,
- gras_datadesc_type_t *type,
- void *data) {
-
- // (void)p_vars; /* FIXME(Oli): Why that? Avoid warning? That's not needed*/
- // (void)p_type;
-
- return 1+(long int)strlen(data);
-}
/***
*** Table of all known architectures.
***/
-typedef struct {
- const char *name;
-
- int endian;
-
- int sizeof_char;
- int sizeof_short;
- int sizeof_int;
- int sizeof_long;
- int sizeof_long_long;
-
- int sizeof_pdata;
- int sizeof_pfunc;
-
- int sizeof_float;
- int sizeof_double;
-} gras_arch_sizes_t;
-
-const gras_arch_sizes_t gras_arch_sizes[] = {
- {"i386", 0, 1,2,4,4,8, 4,4, 4,8}
+const gras_arch_sizes_t gras_arch_sizes[gras_arch_count] = {
+ {"i386", 0, {1,2,4,4,8, 4,4, 4,8}}
};
-const int gras_arch_sizes_count = 1;
-
/**
* gras_free_ddt:
*
- * gime that memory back, dude
+ * gime that memory back, dude. I mean it.
*/
static void gras_free_ddt(void *ddt) {
gras_datadesc_type_t *type= (gras_datadesc_type_t *)ddt;
*
* Add a type to a type set
*/
-gras_error_t gras_ddt_register(gras_set_t *set,
- gras_datadesc_type_t *type) {
- return gras_set_add(set,
+gras_error_t gras_ddt_register(gras_datadesc_type_t *type) {
+ return gras_set_add(gras_datadesc_set_local,
(gras_set_elm_t*)type,
&gras_free_ddt);
*
* Retrieve a type from its name
*/
-gras_error_t gras_ddt_get_by_name(gras_set_t *set,
- const char *name,
+gras_error_t gras_ddt_get_by_name(const char *name,
gras_datadesc_type_t **type) {
- return gras_set_get_by_name(set,name,(gras_set_elm_t**)type);
+ return gras_set_get_by_name(gras_datadesc_set_local,name,(gras_set_elm_t**)type);
}
/**
- * gras_dd_typeset_create:
+ * gras_ddt_get_by_code:
*
- * create a type set, and bootstrap it by declaring all basic types in it
+ * Retrieve a type from its name
*/
-gras_error_t
-gras_dd_typeset_create(int gras_arch,
- gras_set_t **s) {
- gras_error_t errcode;
- gras_datadesc_type_t *ddt; /* What to add */
- gras_datadesc_type_t *elm; /* element of ddt when needed */
- gras_set_t *set; /* result */
-
- if (gras_arch >= gras_arch_sizes_count) {
- RAISE1(mismatch_error, "Remote architecture signature (=%d) unknown locally\n", gras_arch);
- }
-
- TRY(gras_set_new(s));
- set=*s;
-
- TRY(gras_ddt_new_scalar("signed char",
- gras_arch_sizes[gras_arch].sizeof_char,
- e_gras_dd_scalar_encoding_sint,
- NULL,
- &ddt));
- TRY(gras_ddt_register(set,ddt));
-
- TRY(gras_ddt_new_scalar("unsigned char",
- gras_arch_sizes[gras_arch].sizeof_char,
- e_gras_dd_scalar_encoding_uint,
- NULL,
- &ddt));
- TRY(gras_ddt_register(set,ddt));
-
-
- TRY(gras_ddt_new_scalar("signed short int",
- gras_arch_sizes[gras_arch].sizeof_short,
- e_gras_dd_scalar_encoding_sint,
- NULL,
- &ddt));
- TRY(gras_ddt_register(set,ddt));
-
- TRY(gras_ddt_new_scalar("unsigned short int",
- gras_arch_sizes[gras_arch].sizeof_short,
- e_gras_dd_scalar_encoding_uint,
- NULL,
- &ddt));
- TRY(gras_ddt_register(set,ddt));
-
-
- TRY(gras_ddt_new_scalar("signed int",
- gras_arch_sizes[gras_arch].sizeof_int,
- e_gras_dd_scalar_encoding_sint,
- NULL,
- &ddt));
- TRY(gras_ddt_register(set,ddt));
-
- TRY(gras_ddt_new_scalar("unsigned int",
- gras_arch_sizes[gras_arch].sizeof_int,
- e_gras_dd_scalar_encoding_uint,
- NULL,
- &ddt));
- TRY(gras_ddt_register(set,ddt));
-
-
- TRY(gras_ddt_new_scalar("signed long int",
- gras_arch_sizes[gras_arch].sizeof_long,
- e_gras_dd_scalar_encoding_sint,
- NULL,
- &ddt));
- TRY(gras_ddt_register(set,ddt));
-
- TRY(gras_ddt_new_scalar("unsigned long int",
- gras_arch_sizes[gras_arch].sizeof_long,
- e_gras_dd_scalar_encoding_uint,
- NULL,
- &ddt));
- TRY(gras_ddt_register(set,ddt));
-
-
- TRY(gras_ddt_new_scalar("signed long long int",
- gras_arch_sizes[gras_arch].sizeof_long_long,
- e_gras_dd_scalar_encoding_sint,
- NULL,
- &ddt));
- TRY(gras_ddt_register(set,ddt));
-
- TRY(gras_ddt_new_scalar("unsigned long long int",
- gras_arch_sizes[gras_arch].sizeof_long_long,
- e_gras_dd_scalar_encoding_uint,
- NULL,
- &ddt));
- TRY(gras_ddt_register(set,ddt));
-
-
- TRY(gras_ddt_new_scalar("data pointer",
- gras_arch_sizes[gras_arch].sizeof_pdata,
- e_gras_dd_scalar_encoding_uint,
- NULL,
- &ddt));
- TRY(gras_ddt_register(set,ddt));
-
- TRY(gras_ddt_new_scalar("function pointer",
- gras_arch_sizes[gras_arch].sizeof_pfunc,
- e_gras_dd_scalar_encoding_uint,
- NULL,
- &ddt));
- TRY(gras_ddt_register(set,ddt));
-
-
- TRY(gras_ddt_new_scalar("float",
- gras_arch_sizes[gras_arch].sizeof_float,
- e_gras_dd_scalar_encoding_float,
- NULL,
- &ddt));
- TRY(gras_ddt_register(set,ddt));
-
- TRY(gras_ddt_new_scalar("double",
- gras_arch_sizes[gras_arch].sizeof_float,
- e_gras_dd_scalar_encoding_float,
- NULL,
- &ddt));
- TRY(gras_ddt_register(set,ddt));
-
- TRY(gras_ddt_get_by_name(set,"unsigned char",&elm));
- TRY(gras_ddt_new_array("string", elm, 0, _strlen_cb, NULL, &ddt));
- TRY(gras_ddt_register(set,ddt));
-
-
- return no_error;
+gras_error_t gras_ddt_get_by_code(int code,
+ gras_datadesc_type_t **type) {
+ return gras_set_get_by_id(gras_datadesc_set_local,code,(gras_set_elm_t**)type);
}
-
#include "DataDesc/datadesc_private.h"
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(use,DataDesc);
+//GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(use,DataDesc);
+
+/**
+ * gras_datadesc_get_id_from_name:
+ * Returns: -1 in case of error.
+ *
+ * Retrieve the ID of a previously declared datatype from its name.
+ */
+long int
+gras_datadesc_get_id_from_name(const char *name) {
+ gras_error_t errcode;
+ gras_datadesc_type_t *type;
+
+ errcode = gras_ddt_get_by_name(name,&type);
+ if (errcode != no_error)
+ return -1;
+ return type->code;
+}
/**
* gras_datadesc_type_cmp:
* This comparison does not take the set headers into account (name and ID),
* but only the payload (actual type description).
*/
-int gras_datadesc_type_cmp(const gras_datadesc_t *d1,
- const gras_datadesc_t *d2) {
+int gras_datadesc_type_cmp(const gras_datadesc_type_t *d1,
+ const gras_datadesc_type_t *d2) {
int ret,cpt;
- gras_dd_cat_struct_field_t *field1,*field2;
+ gras_dd_cat_field_t *field1,*field2;
+ gras_datadesc_type_t *field_desc_1,*field_desc_2;
- if (!d1 & & d2) return 1;
+ if (!d1 && d2) return 1;
if (!d1 && !d2) return 0;
if ( d1 && !d2) return -1;
if (d1->size != d2->size ) return d1->size > d2->size ? 1 : -1;
if (d1->alignment != d2->alignment) return d1->alignment > d2->alignment ? 1 : -1;
- if (d1->aligned_size != d2->aligned_size) return d1->aligned_siz e > d2->aligned_size ? 1 : -1;
+ if (d1->aligned_size != d2->aligned_size) return d1->aligned_size > d2->aligned_size ? 1 : -1;
if (d1->category_code != d2->category_code) return d1->category_code > d2->category_code ? 1 : -1;
return d1->category.scalar_data.encoding > d2->category.scalar_data.encoding ? 1 : -1 ;
break;
- case e_gras_datadesc_type_cat_struct:
- if (d1->category.struct_data.field_count != d2->category.struct_data.field_count)
- return d1->category.struct_data.field_count > d2->category.struct_data.field_count ? 1 : -1;
-
+ case e_gras_datadesc_type_cat_struct:
if (gras_dynar_length(d1->category.struct_data.fields) !=
gras_dynar_length(d2->category.struct_data.fields))
return gras_dynar_length(d1->category.struct_data.fields) >
gras_dynar_foreach(d1->category.struct_data.fields, cpt, field1) {
gras_dynar_get(d2->category.struct_data.fields, cpt, field2);
- ret = gras_datadesc_type_cmp(field1,field2);
+ gras_ddt_get_by_code(field1->code,&field_desc_1); /* FIXME: errcode ignored */
+ gras_ddt_get_by_code(field2->code,&field_desc_2);
+ ret = gras_datadesc_type_cmp(field_desc_1,field_desc_2);
if (ret)
return ret;
gras_dynar_foreach(d1->category.union_data.fields, cpt, field1) {
gras_dynar_get(d2->category.union_data.fields, cpt, field2);
- ret = gras_datadesc_type_cmp(field1,field2);
+ gras_ddt_get_by_code(field1->code,&field_desc_1); /* FIXME: errcode ignored */
+ gras_ddt_get_by_code(field2->code,&field_desc_2);
+ ret = gras_datadesc_type_cmp(field_desc_1,field_desc_2);
if (ret)
return ret;
}
-gras_error_t gras_datadesc_cpy(gras_datadesc_t *type, void *src, void **dst) {
-
+/**
+ * gras_datadesc_cpy:
+ *
+ * Copy the data pointed by src and described by type to a new location, and store a pointer to it in dst.
+ *
+ */
+gras_error_t gras_datadesc_cpy(gras_datadesc_type_t *type, void *src, void **dst) {
+ RAISE_UNIMPLEMENTED;
+}
+
+/**
+ * gras_datadesc_send:
+ *
+ * Copy the data pointed by src and described by type to the socket
+ *
+ */
+gras_error_t gras_datadesc_send(gras_socket_t *sock, gras_datadesc_type_t *type, void *src) {
+
+ RAISE_UNIMPLEMENTED;
+}
+
+/**
+ * gras_datadesc_recv:
+ *
+ * Get an instance of the datatype described by @type from the @socket, and store a pointer to it in @dst
+ *
+ */
+gras_error_t
+gras_datadesc_recv(gras_socket_t *sock, gras_datadesc_type_t *type, void **dst) {
+ RAISE_UNIMPLEMENTED;
}
SUBDIRS=. Tests
DISTCLEANFILES=Makefile.in
-INCLUDES= -I$(top_srcdir)/src/include -I../nws_portability/Include \
+INCLUDES= -I$(top_srcdir)/src/include \
@CFLAGS_XML@ @CFLAGS_SimGrid@
EXTRA_DIST= \
gras_private.h \
- Core/dict_private.h \
- DataDesc/gs_private.h \
- DataDesc/parse.yy.l
+ Core/dict_private.h
+# DataDesc/parse.yy.l
lib_LIBRARIES= libgrasrl.a libgrassg.a
# Common/gras.c Common/gras_datadesc.c Common/gras_msg.c
# Messaging/messaging.c
# Messaging/datadesc_simple.c
+# Transport/transport_sg.c
COMMON_S=\
\
Core/config.c \
\
Transport/transport.c Transport/transport_private.h \
- Transport/transport_sg.c Transport/transport_tcp.c \
+ Transport/transport_tcp.c \
\
\
- DataDesc/ddt_create.c DataDesc/ddt_declare.c \
- DataDesc/ddt_remote.c \
- DataDesc/datadesc.c DataDesc/datadesc_interface.h \
- DataDesc/datadesc_private.h
+ 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/vars.c
DataDesc/parse.yy.c: DataDesc/parse.yy.l
- flex -o$@ -Pgras_datadesc_parse_ $^
+ flex -o$@ -Pgras_ddt_ $^
-COMMON_L=\
- $(foreach file,\
- diagnostic formatutil strutil osutil, \
- $(top_srcdir)/src/nws_portability/build-@host@/obj/$(file).o)
-
-libgrasutils_a_SOURCES = $(COMMON_S) Tests/gras_dummy.c
-libgrasutils_a_LIBADD = $(COMMON_L)
+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
+libgrassg_a_SOURCES= $(COMMON_S) \
+ Transport/sg_transport.c \
+ Virtu/sg_process.c Virtu/sg_time.c
# RL/gras_rl.c RL/gras_rl.h FIXME
-libgrasrl_a_SOURCES= $(COMMON_S) Messaging/messaging_rl.c
-libgrasrl_a_LIBADD= \
- $(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) \
- $(COMMON_L)
-
-# SG/gras_sg.c SG/gras_sg.h FIXME
-libgrassg_a_SOURCES= $(COMMON_S) Messaging/messaging_sg.c
-libgrassg_a_LIBADD= \
- $(COMMON_L)
+# $(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)
+
--- /dev/null
+/* $Id$ */
+
+/* rl_transport - RL specific functions for transport */
+
+/* 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/socket.h>
+
+#include "Transport/transport_private.h"
+GRAS_LOG_EXTERNAL_CATEGORY(transport);
+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:
+ *
+ * Returns the next socket to service having a message awaiting.
+ *
+ * if timeout<0, we ought to implement the adaptative timeout (FIXME)
+ *
+ * if timeout=0, do not wait for new message, only handle the ones already there.
+ *
+ * if timeout>0 and no message there, wait at most that amount of time before giving up.
+ */
+gras_error_t
+gras_trp_select(double timeout,
+ gras_socket_t **dst) {
+
+ gras_error_t errcode;
+ int done = -1;
+ double wakeup = gras_time() + 1000000*timeout;
+ double now = 0;
+ /* nextToService used to make sure socket with high number do not starve */
+ // static int nextToService = 0;
+ struct timeval tout, *p_tout;
+
+ int max_fds=0; /* first arg of select: number of existing sockets */
+ fd_set FDS;
+ int ready; /* return of select: number of socket ready to be serviced */
+
+ gras_socket_t *sock_iter; /* iterating over all sockets */
+ int cursor; /* iterating over all sockets */
+
+ *dst=NULL;
+ while (done == -1) {
+ if (timeout > 0) { /* did we timeout already? */
+ now = gras_time();
+ if (now == -1 || now >= wakeup) {
+ done = 0; /* didn't find anything */
+ break;
+ }
+ }
+
+ /* 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);
+ }
+
+ /* we cannot have more than FD_SETSIZE sockets */
+ if (++max_fds > FD_SETSIZE) {
+ WARNING0("too many open sockets.");
+ done = 0;
+ break;
+ }
+
+ if (timeout > 0) {
+ /* set the timeout */
+ tout.tv_sec = (unsigned long)((wakeup - now)/1000000);
+ tout.tv_usec = (unsigned long)(wakeup - now) % 1000000;
+ p_tout = &tout;
+ } else if (timeout == 0) {
+ /* polling only */
+ tout.tv_sec = 0;
+ tout.tv_usec = 0;
+ p_tout = &tout;
+ /* we just do one loop around */
+ done = 0;
+ } else {
+ /* no timeout: good luck! */
+ p_tout = NULL;
+ }
+
+ ready = select(max_fds, &FDS, NULL, NULL, p_tout);
+ if (ready == -1) {
+ switch (errno) {
+ case EINTR: /* a signal we don't care about occured. We don't care */
+ continue;
+ case EINVAL: /* invalid value */
+ RAISE3(system_error,"invalid select: nb fds: %d, timeout: %d.%d",
+ max_fds, (int)tout.tv_sec,(int) tout.tv_usec);
+ case ENOMEM:
+ RAISE_MALLOC;
+ default:
+ RAISE2(system_error,"Error during select: %s (%d)",strerror(errno),errno);
+ }
+ RAISE_IMPOSSIBLE;
+ } else if (ready == 0) {
+ continue; /* this was a timeout */
+ }
+
+ gras_dynar_foreach(_gras_trp_sockets,cursor,sock_iter) {
+ if(!FD_ISSET(sock_iter->sd, &FDS)) { /* this socket is not ready */
+ continue;
+ }
+
+ /* Got a socket to serve */
+ ready--;
+
+ if ( sock_iter->accepting
+ && sock_iter->plugin->socket_accept) {
+ /* not a socket but an ear. accept on it and serve next socket */
+ gras_socket_t *accepted;
+
+ TRY(sock_iter->plugin->socket_accept(sock_iter,&accepted));
+ TRY(gras_dynar_push(_gras_trp_sockets,&accepted));
+ } else {
+ /* Make sure the socket is still alive by reading the first byte */
+ char lookahead;
+ int recvd;
+
+ recvd = recv(sock_iter->sd, &lookahead, 1, MSG_PEEK);
+ if (recvd < 0) {
+ WARNING2("socket %d failed: %s", sock_iter->sd, strerror(errno));
+ /* done with this socket */
+ 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);
+ cursor--;
+ } else {
+ /* Got a suited socket ! */
+ *dst = sock_iter;
+ return no_error;
+ }
+ }
+
+
+ /* if we're here, the socket we found wasn't really ready to be served */
+ if (ready == 0) /* exausted all sockets given by select. Request new ones */
+ break;
+ }
+
+ }
+
+ return timeout_error;
+}
--- /dev/null
+/* $Id$ */
+
+/* sg_transport - SG specific functions for transport */
+
+/* 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 "Transport/transport_private.h"
+//GRAS_LOG_EXTERNAL_CATEGORY(transport);
+//GRAS_LOG_DEFAULT_CATEGORY(transport);
+
+/**
+ * gras_trp_select:
+ *
+ * Returns the next socket to service having a message awaiting.
+ *
+ * if timeout<0, we ought to implement the adaptative timeout (FIXME)
+ *
+ * if timeout=0, do not wait for new message, only handle the ones already there.
+ *
+ * if timeout>0 and no message there, wait at most that amount of time before giving up.
+ */
+gras_error_t
+gras_trp_select(double timeout,
+ gras_socket_t **dst) {
+
+ RAISE_UNIMPLEMENTED;
+}
/* $Id$ */
-/* bloc_transport - send/receive a bunch of bytes */
+/* transport - low level communication */
/* 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 "gras_private.h"
-#include "transport.h"
+#include <time.h> /* time() */
+//#include <errno.h>
+
+#include "Transport/transport_private.h"
+
GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(transport,GRAS);
+static gras_dict_t *_gras_trp_plugins; /* All registered plugins */
+static void gras_trp_plugin_free(void *p); /* free one of the plugins */
+
+
+gras_dynar_t *_gras_trp_sockets; /* all existing sockets */
+static void gras_trp_socket_free(void *s); /* free one socket */
+
+static fd_set FDread;
gras_error_t
gras_trp_init(void){
- RAISE_UNIMPLEMENTED;
+ gras_error_t errcode;
+ gras_trp_plugin_t *plug;
+
+ /* make room for all socket ownership descriptions */
+ TRY(gras_dynar_new(&_gras_trp_sockets, sizeof(gras_socket_t*), NULL));
+
+ /* We do not ear for any socket for now */
+ FD_ZERO(&FDread);
+
+ /* make room for all plugins */
+ TRY(gras_dict_new(&_gras_trp_plugins));
+
+ /* TCP */
+ TRY(gras_trp_tcp_init(&plug));
+ TRY(gras_dict_insert(_gras_trp_plugins,plug->name, plug, gras_trp_plugin_free));
+
+ return no_error;
}
void
gras_trp_exit(void){
+ gras_dict_free(&_gras_trp_plugins);
+ gras_dynar_free(_gras_trp_sockets);
+}
- ERROR1("%s not implemented",__FUNCTION__);
- abort();
+
+void gras_trp_plugin_free(void *p) {
+ gras_trp_plugin_t *plug = p;
+
+ if (plug) {
+ if (plug->free_specific && plug->specific)
+ plug->free_specific(plug->specific);
+
+ free(plug->name);
+ free(plug);
+ }
+}
+
+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) {
+ gras_dynar_foreach(_gras_trp_sockets,cursor,sock_iter) {
+ if (sock == sock_iter) {
+ gras_dynar_cursor_rm(_gras_trp_sockets,&cursor);
+ if (sock->plugin->socket_close)
+ (*sock->plugin->socket_close)(sock);
+
+ /* free the memory */
+ free(sock);
+ return;
+ }
+ }
+ WARNING0("Ignoring request to free an unknown socket");
+ }
}
gras_error_t
gras_trp_plugin_get_by_name(const char *name,
gras_trp_plugin_t **dst){
- RAISE_UNIMPLEMENTED;
+ return gras_dict_retrieve(_gras_trp_plugins,name,(void**)dst);
}
+
--- /dev/null
+/* $Id$ */
+
+/* transport - low level communication (send/receive bunches of bytes) */
+
+/* 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_TRP_INTERFACE_H
+#define GRAS_TRP_INTERFACE_H
+
+#include "gras_private.h"
+
+/**
+ * e_gras_trp_plugin:
+ *
+ * Caracterize each possible transport plugin
+ */
+typedef enum e_gras_trp_plugin {
+ e_gras_trp_plugin_undefined = 0,
+
+ e_gras_trp_plugin_tcp
+} gras_trp_plugin_type_t;
+
+
+/* Find which socket needs to be read next */
+gras_error_t
+gras_trp_select(double timeout,
+ gras_socket_t **dst);
+
+/*
+gras_error_t gras_trp_NNN_init(gras_trp_plugin_t **dst);
+*/
+
+/* A plugin type */
+struct gras_trp_plugin_ {
+ char *name;
+
+ gras_error_t (*socket_client)(gras_trp_plugin_t *self,
+ const char *host,
+ unsigned short port,
+ unsigned int bufSize,
+ /* 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);
+ gras_error_t (*socket_accept)(gras_socket_t *sock,
+ /* OUT */gras_socket_t **dst);
+
+
+ /* socket_close() is responsible of telling the OS that the socket is over,
+ but should not free the socket itself (beside the specific part) */
+ void (*socket_close)(gras_socket_t *sd);
+
+
+ gras_error_t (*bloc_send)(gras_socket_t *sd,
+ char *data,
+ size_t size);
+ gras_error_t (*bloc_recv)(gras_socket_t *sd,
+ char *Data,
+ size_t size);
+
+ void *specific;
+ void (*free_specific)(void *);
+};
+
+gras_error_t
+gras_trp_plugin_get_by_name(const char *name,
+ gras_trp_plugin_t **dst);
+
+#endif /* GRAS_TRP_INTERFACE_H */
/* $Id$ */
-/* trp (transport) - send/receive a bunch of bytes */
+/* transport - low level communication (send/receive bunches of bytes) */
-/* This file implements the public interface of this module, exported to the*/
-/* other modules of GRAS, but not to the end user. */
+/* module's private interface masked even to other parts of GRAS. */
/* Authors: Martin Quinson */
/* Copyright (C) 2004 Martin Quinson. */
#define GRAS_TRP_PRIVATE_H
#include "gras_private.h"
-/* A low-level socket type (each plugin implements it the way it prefers */
-//typedef void gras_trp_sock_t;
-
-/* A plugin type */
-struct gras_trp_plugin_ {
- const char *name;
-
- gras_error_t (*init)(void);
- void (*exit)(gras_trp_plugin_t *);
-
- gras_error_t (*socket_client_open)(const char *host,
- unsigned short port,
- int raw,
- unsigned int bufSize,
- /* OUT */ gras_trp_sock_t **dst);
- gras_error_t (*socket_server_open)(unsigned short port,
- int raw,
- unsigned int bufSize,
- /* OUT */ gras_trp_sock_t **dst);
- void (*socket_close)(gras_trp_sock_t **sd);
-
- gras_error_t (*select)(double timeOut,
- gras_trp_sock_t **sd);
+#include "Transport/transport_interface.h"
+
+extern gras_dynar_t *_gras_trp_sockets; /* all existing sockets */
+
+
+/**
+ * s_gras_socket:
+ *
+ * Description of a socket.
+ */
+
+struct s_gras_socket {
+ gras_trp_plugin_t *plugin;
- gras_error_t (*bloc_send)(gras_trp_sock_t *sd,
- void *data,
- size_t size,
- double timeOut);
- gras_error_t (*bloc_recv)(gras_trp_sock_t *sd,
- void *data,
- size_t size,
- double timeOut);
- gras_error_t (*flush)(gras_trp_sock_t *sd);
-
- void *specific;
-};
+ int incoming; /* true if incoming (server) sock, false if client sock */
+ int accepting; /* true if master incoming sock in tcp */
+
+ int sd;
+ int port; /* port on this side */
+ int peer_port; /* port on the other side */
+ char *peer_name; /* hostname of the other side */
-/**********************************************************************
- * Internal stuff to the module. Other modules shouldn't fool with it *
- **********************************************************************/
+ void *specific; /* plugin specific data */
+};
+
/* TCP driver */
-gras_error_t gras_trp_tcp_init(void);
-void gras_trp_tcp_exit(gras_trp_plugin_t *plugin);
-gras_error_t gras_trp_tcp_socket_client(const char *host,
- unsigned short port,
- int raw,
- unsigned int bufSize,
- /* OUT */ gras_trp_sock_t **dst);
-gras_error_t gras_trp_tcp_socket_server(unsigned short port,
- int raw,
- unsigned int bufSize,
- /* OUT */ gras_trp_sock_t **dst);
-void gras_trp_tcp_socket_close(gras_trp_sock_t **sd);
-gras_error_t gras_trp_tcp_select(double timeOut,
- gras_trp_sock_t **sd);
-
-gras_error_t gras_trp_tcp_bloc_send(gras_trp_sock_t *sd,
- void *data,
- size_t size,
- double timeOut);
-
-gras_error_t gras_trp_tcp_bloc_recv(gras_trp_sock_t *sd,
- void *data,
- size_t size,
- double timeOut);
-gras_error_t gras_trp_tcp_flush(gras_trp_sock_t *sd);
+gras_error_t gras_trp_tcp_init(gras_trp_plugin_t **dst);
/* SG driver */
-gras_error_t gras_trp_sg_init(void);
-void gras_trp_sg_exit(gras_trp_plugin_t *plugin);
-gras_error_t gras_trp_sg_socket_client(const char *host,
- unsigned short port,
- int raw,
- unsigned int bufSize,
- /* OUT */ gras_trp_sock_t **dst);
-gras_error_t gras_trp_sg_socket_server(unsigned short port,
- int raw,
- unsigned int bufSize,
- /* OUT */ gras_trp_sock_t **dst);
-void gras_trp_sg_socket_close(gras_trp_sock_t **sd);
-gras_error_t gras_trp_sg_select(double timeOut,
- gras_trp_sock_t **sd);
-
-gras_error_t gras_trp_sg_bloc_send(gras_trp_sock_t *sd,
- void *data,
- size_t size,
- double timeOut);
-
-gras_error_t gras_trp_sg_bloc_recv(gras_trp_sock_t *sd,
- void *data,
- size_t size,
- double timeOut);
-gras_error_t gras_trp_sg_flush(gras_trp_sock_t *sd);
+gras_error_t gras_trp_sg_init (gras_trp_plugin_t **dst);
/* file trp (transport) - send/receive a bunch of bytes in SG realm */
+/* Note that this is only used to debug other parts of GRAS since message */
+/* exchange in SG realm is implemented directly without mimicing real life */
+/* This would be terribly unefficient. */
+
/* Authors: Martin Quinson */
/* Copyright (C) 2004 Martin Quinson. */
GRAS_LOG_EXTERNAL_CATEGORY(transport);
GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(trp_sg,transport);
+
+/***
+ *** Prototypes
+ ***/
+void gras_trp_sg_exit(gras_trp_plugin_t *plugin);
+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_trp_sock_t **sd);
+gras_error_t gras_trp_sg_select(double timeOut,
+ gras_socket_t **sd);
+
+gras_error_t gras_trp_sg_bloc_send(gras_socket_t *sd,
+ void *data,
+ size_t size,
+ double timeOut);
+
+gras_error_t gras_trp_sg_bloc_recv(gras_socket_t *sd,
+ void *data,
+ size_t size,
+ double timeOut);
+gras_error_t gras_trp_sg_flush(gras_socket_t *sd);
+
+/***
+ *** Specific plugin part
+ ***/
typedef struct {
int dummy;
} gras_trp_sg_specific_t;
+/***
+ *** Specific socket part
+ ***/
+
+/***
+ *** Code
+ ***/
+
gras_error_t
gras_trp_sg_init(void) {
/* 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 <unistd.h> /* close() pipe() read() write() */
+#include <signal.h> /* close() pipe() read() write() */
+#include <netinet/in.h> /* sometimes required for #include <arpa/inet.h> */
+#include <netinet/tcp.h> /* TCP_NODELAY */
+#include <arpa/inet.h> /* inet_ntoa() */
+#include <netdb.h> /* getprotobyname() */
+#include <sys/time.h> /* struct timeval */
+#include <errno.h> /* errno */
+#include <sys/wait.h> /* waitpid() */
+#include <sys/socket.h> /* getpeername() socket() */
+#include <stdlib.h>
+
+
#include "gras_private.h"
#include "transport_private.h"
GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(trp_tcp,transport);
typedef struct {
- int dummy;
+ int buffsize;
+} gras_trp_tcp_sock_specific_t;
+
+/***
+ *** Prototypes
+ ***/
+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);
+gras_error_t gras_trp_tcp_socket_server(gras_trp_plugin_t *self,
+ unsigned short port,
+ unsigned int bufSize,
+ /* OUT */ gras_socket_t **dst);
+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_bloc_recv(gras_socket_t *sd,
+ char *data,
+ size_t size);
+
+void gras_trp_tcp_free_specific(void *s);
+
+
+static int TcpProtoNumber(void);
+/***
+ *** Specific plugin part
+ ***/
+
+typedef struct {
+ fd_set incoming_socks;
} gras_trp_tcp_specific_t;
+/***
+ *** Specific socket part
+ ***/
+
+
+/***
+ *** Code
+ ***/
gras_error_t
-gras_trp_tcp_init(void) {
+gras_trp_tcp_init(gras_trp_plugin_t **dst) {
- gras_trp_tcp_specific_t *specific = malloc(sizeof(gras_trp_tcp_specific_t));
- if (!specific)
+ gras_trp_plugin_t *res=malloc(sizeof(gras_trp_plugin_t));
+ gras_trp_tcp_specific_t *tcp = malloc(sizeof(gras_trp_tcp_specific_t));
+ if (!res || !tcp)
RAISE_MALLOC;
+ FD_ZERO(&(tcp->incoming_socks));
+
+ 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->bloc_send = gras_trp_tcp_bloc_send;
+ res->bloc_recv = gras_trp_tcp_bloc_recv;
+
+ res->specific = (void*)tcp;
+ res->free_specific = gras_trp_tcp_free_specific;
+
+ *dst = res;
return no_error;
}
-void
-gras_trp_tcp_exit(gras_trp_plugin_t *plugin) {
- gras_trp_tcp_specific_t *specific = (gras_trp_tcp_specific_t*)plugin->specific;
+void gras_trp_tcp_free_specific(void *s) {
+ gras_trp_tcp_specific_t *specific = s;
free(specific);
}
-gras_error_t gras_trp_tcp_socket_client(const char *host,
+gras_error_t gras_trp_tcp_socket_client(gras_trp_plugin_t *self,
+ const char *host,
unsigned short port,
- int raw,
unsigned int bufSize,
- /* OUT */ gras_trp_sock_t **dst){
+ /* OUT */ gras_socket_t **dst){
+ /*
+ int addrCount;
+ IPAddress addresses[10];
+ int i;
+ int sd;
+
+ if (!(*sock=malloc(sizeof(gras_socket_t)))) {
+ fprintf(stderr,"Malloc error\n");
+ return malloc_error;
+ }
+ (*sock)->peer_addr=NULL;
+
+ if (!(addrCount = IPAddressValues(host, addresses, 10))) {
+ fprintf(stderr,"grasOpenClientSocket: address retrieval of '%s' failed\n",host);
+ return system_error;
+ }
+
+ for(i = 0; i < addrCount && i<10 ; i++) {
+ if(CallAddr(addresses[i], port, &sd, -1)) {
+ (*sock)->sock = sd;
+ (*sock)->port = port;
+ return no_error;
+ }
+ }
+ free(*sock);
+ fprintf(stderr,"grasOpenClientSocket: something wicked happenned while connecting to %s:%d",
+ host,port);
+ return system_error;
+ */
RAISE_UNIMPLEMENTED;
}
-gras_error_t gras_trp_tcp_socket_server(unsigned short port,
- int raw,
+/**
+ * gras_trp_tcp_socket_server:
+ *
+ * Open a socket used to receive messages. bufSize is in ko.
+ */
+gras_error_t gras_trp_tcp_socket_server(gras_trp_plugin_t *self,
+ unsigned short port,
unsigned int bufSize,
- /* OUT */ gras_trp_sock_t **dst){
- RAISE_UNIMPLEMENTED;
-}
+ /* OUT */ gras_socket_t **dst){
+ 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;
+
+ 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);
+ RAISE0(system_error,"socket allocation failed");
+ }
+
+ (void)setsockopt(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);
+ RAISE1(system_error,"Cannot bind to port %d",port);
+ }
+
+ if (listen(sd, 5) != -1) {
+ free(res);
+ close(sd);
+ RAISE1(system_error,"Cannot listen to port %d",port);
+ }
+
+ FD_SET(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;
-void gras_trp_tcp_socket_close(gras_trp_sock_t **sd){
- ERROR1("%s not implemented",__FUNCTION__);
- abort();
+ DEBUG2("Openned a server socket on port %d (sock %d)",port,sd);
+
+ return no_error;
}
-gras_error_t gras_trp_tcp_select(double timeOut,
- gras_trp_sock_t **sd){
- RAISE_UNIMPLEMENTED;
+gras_error_t
+gras_trp_tcp_socket_accept(gras_socket_t *sock,
+ gras_socket_t **dst) {
+ gras_socket_t *res;
+
+ struct sockaddr_in peer_in;
+ socklen_t peer_in_len = sizeof(peer_in);
+
+ int sd;
+ int tmp_errno;
+
+ res=malloc(sizeof(gras_socket_t));
+ if (!res)
+ RAISE_MALLOC;
+
+ sd = accept(sock->sd, (struct sockaddr *)&peer_in, &peer_in_len);
+ tmp_errno = errno;
+
+ if(sd == -1) {
+ gras_socket_close(sock);
+ RAISE1(system_error,
+ "Accept failed (%s). Droping server socket.", strerror(tmp_errno));
+ } else {
+ int i = 1;
+ socklen_t s = sizeof(int);
+
+ if (setsockopt(sd, SOL_SOCKET, SO_KEEPALIVE, (char *)&i, s)
+ || setsockopt(sd, TcpProtoNumber(), TCP_NODELAY, (char *)&i, s)) {
+ WARNING0("setsockopt failed, cannot condition the accepted socket");
+ }
+
+ 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;
+
+ if (((struct sockaddr *)&peer_in)->sa_family != AF_INET) {
+ res->peer_name = strdup("unknown");
+ } else {
+ struct in_addr addrAsInAddr;
+ char *tmp;
+
+ addrAsInAddr.s_addr = peer_in.sin_addr.s_addr;
+
+ tmp = inet_ntoa(addrAsInAddr);
+ if (tmp != NULL) {
+ res->peer_name = strdup(inet_ntoa(addrAsInAddr));
+ } else {
+ res->peer_name = strdup("unknown");
+ }
+ }
+
+ VERB3("accepted socket %d to %s:%d\n", sd, res->peer_name,res->peer_port);
+
+ *dst = res;
+
+ return no_error;
+ }
}
+
+void gras_trp_tcp_socket_close(gras_socket_t *sock){
+ gras_trp_tcp_specific_t *tcp;
-gras_error_t gras_trp_tcp_bloc_send(gras_trp_sock_t *sd,
- void *data,
- size_t size,
- double timeOut){
- RAISE_UNIMPLEMENTED;
+ if (!sock) return; /* close only once */
+ tcp=sock->plugin->specific;
+
+ DEBUG1("close tcp connection %d\n", sock->sd);
+
+ /* FIXME: no pipe in GRAS so far
+ if(!FD_ISSET(sd, &connectedPipes)) {
+ if(shutdown(sd, 2) < 0) {
+ GetNWSLock(&lock);
+ tmp_errno = errno;
+ ReleaseNWSLock(&lock);
+
+ / * The other side may have beaten us to the reset. * /
+ if ((tmp_errno!=ENOTCONN) && (tmp_errno!=ECONNRESET)) {
+ WARN1("CloseSocket: shutdown error %d\n", tmp_errno);
+ }
+ }
+ } */
+
+ /* close the socket */
+ if(close(sock->sd) < 0) {
+ 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));
+
}
-gras_error_t gras_trp_tcp_bloc_recv(gras_trp_sock_t *sd,
- void *data,
- size_t size,
- double timeOut){
- RAISE_UNIMPLEMENTED;
+gras_error_t gras_trp_tcp_bloc_send(gras_socket_t *sock,
+ char *data,
+ size_t size){
+
+ gras_assert0(sock && !sock->incoming, "Ascked to send stuff on an incomming socket");
+ 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_error_t gras_trp_tcp_flush(gras_trp_sock_t *sd){
- RAISE_UNIMPLEMENTED;
+gras_error_t gras_trp_tcp_bloc_recv(gras_socket_t *sock,
+ char *data,
+ size_t size){
+
+ gras_assert0(sock && !sock->incoming, "Ascked to receive stuff on an outcomming 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;
}
+
+/*
+ * Returns the tcp protocol number from the network protocol data base.
+ *
+ * getprotobyname() is not thread safe. We need to lock it.
+ */
+static int TcpProtoNumber(void) {
+ struct protoent *fetchedEntry;
+ static int returnValue = 0;
+
+ if(returnValue == 0) {
+ fetchedEntry = getprotobyname("tcp");
+ gras_assert0(fetchedEntry, "getprotobyname(tcp) gave NULL");
+ returnValue = fetchedEntry->p_proto;
+ }
+
+ return returnValue;
+}
#include <stdlib.h>
#include <string.h>
-/* Oli's macro */
-#ifndef GS_FAILURE_CONTEXT
-# define GS_FAILURE_CONTEXT
-#endif /* FAILURE_CONTEXT */
-
-#define GS_FAILURE(str) \
- (fprintf(stderr, "FAILURE: %s(%s:%d)" GS_FAILURE_CONTEXT "%s\n", __func__, __FILE__, __LINE__, (str)), \
- abort())
-
#define max(a, b) (((a) > (b))?(a):(b))
#define min(a, b) (((a) < (b))?(a):(b))
-/* end of Oli's cruft */
+#define TRUE 1
+#define FALSE 0
#include "gras_config.h"
#include "gras/core.h"
#include "gras/process.h"
+
#include "gras/transport.h"
+#include "Transport/transport_interface.h"
#include "gras/datadesc.h"
-#include "gras/socket.h"
+#include "DataDesc/datadesc_interface.h"
#include "gras/messages.h"
+#include "Messaging/messaging_interface.h"
-#define TRUE 1
-#define FALSE 0
-
-#define ASSERT(cond,msg) do {if (!(cond)) { fprintf(stderr,msg); abort(); }} while(0)
-
-/* **************************************************************************
- * Locking system
- ****************************************************************************/
-/**
- * gras_lock:
- * @Returns: 1 if succesfull 0 otherwise.
- *
- * Get the GRAS lock.
- */
-int
-gras_lock(void);
-
-/**
- * gras_unlock:
- * @Returns: 1 if succesfull 0 otherwise.
- *
- * release the GRAS general lock.
- */
-int
-gras_unlock(void);
-
-/* **************************************************************************
- * Messaging stuff
- * **************************************************************************/
-
-/**
- * gras_cblist_t:
- *
- * The list of callbacks for a given message type on a given host
- */
-typedef struct {
- gras_msgid_t id; /** identificator of this message */
-
- int cbCount; /** number of registered callbacks */
- gras_cb_t *cb; /** callbacks */
- int *cbTTL; /** TTL of each callback (in number of use)*/
-} gras_cblist_t;
-
-/**
- * gras_msgentry_t:
- *
- * An entry in the registered message list.
- */
-
-struct gras_msgentry_s {
- gras_msgid_t id; /** identificator of this message */
- char *name; /** printable name of this message */
-
- int seqCount; /** number of sequence for this message */
- DataDescriptor **dd; /** list of datadescriptor for each sequence */
- size_t *ddCount; /** list of datadescriptor for each sequence */
- unsigned int *networkSize;/** network size of one element in each sequence */
- unsigned int *hostSize; /** host size of one element in each sequence */
-};
-/* **************************************************************************
- * GRAS globals
- * **************************************************************************/
-
-/**
- * gras_hostglobal_t:
- *
- * Globals for a given host.
- */
-typedef struct {
- gras_cblist_t *grasCbList; /** callbacks for registered messages */
- unsigned int grasCbListCount; /** length of previous array */
-} gras_hostglobal_t;
-
-/**
- * gras_msgheader_t:
- *
- * A header sent with messages. #version# is the NWS version and is presently
- * ignored, but it could be used for compatibility. #message# is the actual
- * message. #seqCount# is the number of sequence accompagning this message.
- */
-struct gras_msgheader_s {
- char version[10];
- gras_msgid_t message;
- unsigned int dataSize;
- unsigned int seqCount;
-};
-
-/**
- * gras_process_data_t:
- *
- * Data for each process
- */
-typedef struct {
- /* queue of messages which where received but not wanted in msgWait, and therefore
- temporarly queued until the next msgHandle */
- gras_dynar_t *msg_queue; /* elm type: gras_msg_t */
-
- /* registered callbacks for each message */
- gras_dynar_t *cbl_list; /* elm type: gras_cblist_t */
-
-
- /* The channel we are listening to in SG for formated messages */
- int chan;
- /* The channel we are listening to in SG for raw send/recv */
- int rawChan;
-
- /* globals of the process */
- void *userdata;
-} gras_process_data_t;
-
-
-/*@unused@*/static const DataDescriptor headerDescriptor[] =
- {SIMPLE_MEMBER(CHAR_TYPE, 10, offsetof(gras_msgheader_t, version)),
- SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(gras_msgheader_t, message)),
- SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(gras_msgheader_t, dataSize)),
- SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(gras_msgheader_t, seqCount))};
-#define headerDescriptorCount 4
-
-/*@unused@*/static const DataDescriptor countDescriptor[] =
- {SIMPLE_DATA(UNSIGNED_INT_TYPE,1)};
-#define countDescriptorCount 1
-
-/**
- * GRASVERSION
- *
- * This string is sent in each message to identify the version of the
- * communication protocol used. This may be paranoid, but I feel so right now.
- */
-#define GRASVERSION "0.0.020504"
-
-/**
- * grasMsgEntryGet:
- * @id: msg id to look for
- * @Returns: the entry if found, NULL otherwise
- *
- * Get the entry corresponding to this message id;
- */ /*@observer@*/
-gras_msgentry_t * grasMsgEntryGet(gras_msgid_t id);
-
-/**
- * gras_process_data_get:
- *
- * Get the GRAS globals for this host
- */ /*@observer@*/
-gras_process_data_t *gras_process_data_get(void);
-
-/**
- * gras_cb_get:
- * @id: msg id to look for
- *
- * Get the callback list corresponding to this message id;
- */ /*@observer@*/
-gras_cblist_t * gras_cb_get(gras_msgid_t id);
-
-/**
- * gras_cb_create:
- * @id: the id of the new msg
- *
- * Create a new callback list for a new message id.
- */
-gras_error_t gras_cb_create(gras_msgid_t message);
-
-/**
- * grasMsgHeaderNew:
- * @msgId:
- * @dataSize: total size in network format, including headers and seqcount
- * @seqCount: Number of sequences in this message (to check that everything goes well)
- * @Returns: the created header
- *
- * Create a new header containing the passed values.
- */
-gras_msgheader_t *grasMsgHeaderNew(gras_msgid_t msgId,
- unsigned int dataSize,
- unsigned int seqCount);
-
-/**
- * grasMsgRecv:
- *
- * Receive the next message arriving within the given timeout
- */
-gras_error_t grasMsgRecv(gras_msg_t **msg, double timeout);
-
-/**
- * gras_sock_new:
- *
- * Create an empty socket
- */
-gras_sock_t *gras_sock_new(void);
-
-/**
- * grasSockFree:
- *
- * Frees an old socket
- */
-void grasSockFree(gras_sock_t *s);
-
-
+#include "Virtu/virtu_interface.h"
-/* **************************************************************************
- * Handling DataDescriptors
- * **************************************************************************/
-#if 0
-FIXME: Kill it
-typedef enum {HOST_FORMAT, NETWORK_FORMAT} FormatTypes;
-size_t DataSize(const DataDescriptor *description,
- size_t length,
- FormatTypes format);
-void *gras_datadesc_copy_data(const DataDescriptor *dd, unsigned int c, void *data);
-int gras_datadesc_cmp(/*@null@*/const DataDescriptor *dd1, unsigned int c1,
- /*@null@*/const DataDescriptor *dd2, unsigned int c2);
-void gras_datadesc_dump(/*@null@*/const DataDescriptor *dd, unsigned int c);
-#endif
#endif /* GRAS_PRIVATE_H */