From 5288039c2904e157fa7dc9e10f54cb5e92dd3baf Mon Sep 17 00:00:00 2001 From: smolik Date: Tue, 20 Apr 2004 08:36:14 +0000 Subject: [PATCH] version 0.2.2 (mac, solaris patch) --- ChangleLog | 9 +- configure | 369 +++++++++++++++++++- configure.in | 36 +- orte/contrib/decoder/decode_msg.c | 102 +++--- orte/contrib/shape/richtext.cpp | 2 +- orte/contrib/shape/richtext.h | 2 +- orte/examples/ping/orteping.c | 29 +- orte/examples/spy/ortespy.c | 26 +- orte/include/config.h.in | 21 +- orte/include/defines.h | 3 +- orte/include/defines_api.h | 10 +- orte/include/ew_types.h | 6 +- orte/include/orte_all.h | 41 +-- orte/include/orte_api.h | 4 +- orte/include/orte_config_omk_rtl.h | 9 +- orte/include/orte_config_omk_unix.h | 33 +- orte/include/protos.h | 48 +-- orte/include/rtl/compat.h | 11 - orte/include/typedefs.h | 16 +- orte/include/typedefs_api.h | 16 +- orte/include/typedefs_defines_rtps.h | 16 +- orte/include/ul_listbase.h | 2 + orte/liborte/ORTEAppRecvMetatrafficThread.c | 4 +- orte/liborte/ORTEAppRecvUserdataThread.c | 4 +- orte/liborte/ORTEAppSendThread.c | 15 +- orte/liborte/ORTEDomainApp.c | 19 +- orte/liborte/ORTEDomainMgr.c | 17 +- orte/liborte/ORTEPublication.c | 19 +- orte/liborte/ORTESubscription.c | 2 +- orte/liborte/ORTEThreadUtils.c | 14 +- orte/liborte/RTPSAck.c | 10 +- orte/liborte/RTPSCSTWriter.c | 12 +- orte/liborte/RTPSCSTWriterTimer.c | 20 +- orte/liborte/RTPSGap.c | 14 +- orte/liborte/RTPSHeader.c | 4 +- orte/liborte/RTPSHeardBeat.c | 6 +- orte/liborte/RTPSInfoDST.c | 4 +- orte/liborte/RTPSInfoREPLY.c | 10 +- orte/liborte/RTPSInfoSRC.c | 2 +- orte/liborte/RTPSInfoTS.c | 6 +- orte/liborte/RTPSIssue.c | 12 +- orte/liborte/RTPSPad.c | 2 +- orte/liborte/RTPSVar.c | 6 +- orte/liborte/conv.c | 8 +- orte/liborte/objectUtils.c | 2 +- orte/liborte/parameter.c | 54 +-- orte/liborte/sock.c | 2 +- orte/manager/Makefile.am | 3 + orte/manager/Makefile.in | 14 +- orte/manager/mcvs/Makefile.msc | 6 +- orte/manager/ortemanager.c | 81 ++++- orte/manager/service.c | 213 +++++++++++ readme | 12 +- 53 files changed, 1066 insertions(+), 342 deletions(-) create mode 100644 orte/manager/service.c diff --git a/ChangleLog b/ChangleLog index c9dc5f0..f7ddca7 100644 --- a/ChangleLog +++ b/ChangleLog @@ -1,7 +1,14 @@ +v0.2.2 - 11/04/2004 + +- added support new targets (Solaris, MacOS) +- now ortemanager can be runnig like windows service +- tested on big-endian machines + v0.2.1 - 02/04/2004 -- bug in CDRStream format -> char -> u_int8_t +- bug in CDRStream format -> char -> uint8_t - no fill callBack rutine in subscriber cause SIGSEV +- change types u_intXX_t to uintXX_t v0.2.0 - 08/01/2004 diff --git a/configure b/configure index dbadb36..d11b5ae 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for orte 0.2.1. +# Generated by GNU Autoconf 2.59 for orte 0.2.2. # # Report bugs to . # @@ -269,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='orte' PACKAGE_TARNAME='orte' -PACKAGE_VERSION='0.2.1' -PACKAGE_STRING='orte 0.2.1' +PACKAGE_VERSION='0.2.2' +PACKAGE_STRING='orte 0.2.2' PACKAGE_BUGREPORT='petr.smolik@wo.cz' 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 MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LINUX_DIR LINUX_ARCH LINUX_AFLAGS LINUX_LDFLAGS LINUX_ARFLAGS LINUX_CROSS_COMPILE LINUX_KERNELRELEASE LINUX_CFLAGS LINUX_CC LINUX_LD LINUX_AS LINUX_MODULE_EXT CONFIG_ORTE_KERNEL CONFIG_ORTE_KERNEL_TRUE CONFIG_ORTE_KERNEL_FALSE CONFIG_RTHAL_TRUE CONFIG_RTHAL_FALSE CONFIG_ADEOS_TRUE CONFIG_ADEOS_FALSE RTAI_CFLAGS CONFIG_RTLINUX_TRUE CONFIG_RTLINUX_FALSE RTLINUX_CFLAGS RTLINUX_CC CONFIG_ORTE_RT USE_RTAI_TRUE USE_RTAI_FALSE USE_RTLINUX_TRUE USE_RTLINUX_FALSE CONFIG_ORTE_RT_TRUE CONFIG_ORTE_RT_FALSE ORTE_MAJOR_VERSION ORTE_MINOR_VERSION ORTE_MICRO_VERSION ORTE_VERSION CONFIG_ORTE_WIN_TRUE CONFIG_ORTE_WIN_FALSE CONFIG_ORTE_CYGWIN_TRUE CONFIG_ORTE_CYGWIN_FALSE CONFIG_ORTE_MINGW_TRUE CONFIG_ORTE_MINGW_FALSE CONFIG_ORTE_UNIX_TRUE CONFIG_ORTE_UNIX_FALSE moduledir modulePROGRAMS_INSTALL 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 RANLIB ac_ct_RANLIB CPP EGREP INCLUDES LIBOBJS LTLIBOBJS' @@ -742,7 +742,7 @@ if test "$ac_init_help" = "long"; then # 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 orte 0.2.1 to adapt to many kinds of systems. +\`configure' configures orte 0.2.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -809,7 +809,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of orte 0.2.1:";; + short | recursive ) echo "Configuration of orte 0.2.2:";; esac cat <<\_ACEOF @@ -939,7 +939,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -orte configure 0.2.1 +orte configure 0.2.2 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -953,7 +953,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by orte $as_me 0.2.1, which was +It was created by orte $as_me 0.2.2, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1650,7 +1650,7 @@ fi # Define the identity of the package. PACKAGE=orte - VERSION=0.2.1 + VERSION=0.2.2 cat >>confdefs.h <<_ACEOF @@ -2261,7 +2261,7 @@ fi # Package info ORTE_MAJOR_VERSION=0 ORTE_MINOR_VERSION=2 -ORTE_MICRO_VERSION=1 +ORTE_MICRO_VERSION=2 ORTE_VERSION=$ORTE_MAJOR_VERSION.$ORTE_MINOR_VERSION.$ORTE_MICRO_VERSION @@ -2305,6 +2305,11 @@ cat >>confdefs.h <<\_ACEOF #define CONFIG_ORTE_MINGW 1 _ACEOF + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETPOT_LONG_ORTE 1 +_ACEOF + ;; *) # Assume Unix. @@ -3703,6 +3708,142 @@ _ACEOF fi + +echo "$as_me:$LINENO: checking for main in -lsocket" >&5 +echo $ECHO_N "checking for main in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_socket_main=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_socket_main=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_socket_main" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_main" >&6 +if test $ac_cv_lib_socket_main = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBSOCKET 1 +_ACEOF + + LIBS="-lsocket $LIBS" + +fi + + +echo "$as_me:$LINENO: checking for main in -lnsl" >&5 +echo $ECHO_N "checking for main in -lnsl... $ECHO_C" >&6 +if test "${ac_cv_lib_nsl_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_nsl_main=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_nsl_main=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_main" >&5 +echo "${ECHO_T}$ac_cv_lib_nsl_main" >&6 +if test $ac_cv_lib_nsl_main = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBNSL 1 +_ACEOF + + LIBS="-lnsl $LIBS" + +fi + fi ############################### @@ -4148,13 +4289,135 @@ fi +for ac_header in \ + arpa/inet.h fcntl.h stdio.h netdb.h stdlib.h \ + string.h sys/ioctl.h sys/time.h unistd.h pthread.h \ + sys/types.h sys/sockio.h stdarg.h byteswap.h getopt.h \ + ctype.h signal.h stdint.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -for ac_header in \ - arpa/inet.h fcntl.h stdio.h netdb.h netinet/in.h stdlib.h \ - string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h pthread.h \ - stdarg.h sys/types.h net/if.h byteswap.h getopt.h \ - ctype.h semaphore.h signal.h +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in sys/socket.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef HAVE_SYS_TYPES_H + #include + #endif + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in netinet/in.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 @@ -4168,7 +4431,75 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#ifdef HAVE_SYS_TYPES_H + #include + #endif + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in net/if.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef HAVE_SYS_TYPES_H + #include + #endif + #ifdef HAVE_SYS_SOCKET_H + #include + #endif #include <$ac_header> _ACEOF @@ -4430,9 +4761,8 @@ if test ${USE_RTLINUX} == 'yes' ; then - for ac_header in \ - string.h pthread.h semaphore.h \ + string.h pthread.h \ rtl.h rtl_malloc.h udp.h nic.h time.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` @@ -5099,7 +5429,8 @@ fi if test -z ${CONFIG_ORTE_RT} ; then -for ac_func in strdup gethostbyname + +for ac_func in strdup gethostbyname getopt_long do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -5667,7 +5998,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by orte $as_me 0.2.1, which was +This file was extended by orte $as_me 0.2.2, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5730,7 +6061,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -orte config.status 0.2.1 +orte config.status 0.2.2 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.in b/configure.in index 834f7be..0551ee3 100644 --- a/configure.in +++ b/configure.in @@ -1,12 +1,12 @@ # Process this file with autoconf to produce a configure script. # -# $Id: configure.in,v 1.7 2004/04/03 11:27:21 smolik Exp $ +# $Id: configure.in,v 1.8 2004/04/20 08:36:14 smolik Exp $ # autoconf requirement AC_PREREQ([2.56]) -AC_INIT([orte],[0.2.1],[petr.smolik@wo.cz]) +AC_INIT([orte],[0.2.2],[petr.smolik@wo.cz]) AC_CONFIG_AUX_DIR(admin) #Check for CPU / vendor / OS @@ -23,7 +23,7 @@ DS_LINUX() # Package info ORTE_MAJOR_VERSION=0 ORTE_MINOR_VERSION=2 -ORTE_MICRO_VERSION=1 +ORTE_MICRO_VERSION=2 ORTE_VERSION=$ORTE_MAJOR_VERSION.$ORTE_MINOR_VERSION.$ORTE_MICRO_VERSION AC_SUBST(ORTE_MAJOR_VERSION) AC_SUBST(ORTE_MINOR_VERSION) @@ -51,6 +51,7 @@ case "$target" in MINGW='yes' AC_DEFINE([CONFIG_ORTE_WIN],[1],[Define if is target windows]) AC_DEFINE([CONFIG_ORTE_MINGW],[1],[Define if is target MINGW]) + AC_DEFINE([HAVE_GETPOT_LONG_ORTE],[1],[Define for ORTE getopt_long self implemetation]) ;; *) # Assume Unix. @@ -99,6 +100,8 @@ AC_PROG_RANLIB if test -z ${CONFIG_ORTE_RT} ; then AC_CHECK_LIB([ws2_32], [main]) AC_CHECK_LIB([pthread], [main]) + AC_CHECK_LIB([socket], [main]) + AC_CHECK_LIB([nsl], [main]) fi ############################### @@ -115,10 +118,25 @@ AH_VERBATIM([_GNU_SOURCE],[ if test ${UNIX} == 'yes' -o ${WIN} == 'yes' ; then AC_HEADER_STDC AC_CHECK_HEADERS([\ - arpa/inet.h fcntl.h stdio.h netdb.h netinet/in.h stdlib.h \ - string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h pthread.h \ - stdarg.h sys/types.h net/if.h byteswap.h getopt.h \ - ctype.h semaphore.h signal.h],,,[[]]) + arpa/inet.h fcntl.h stdio.h netdb.h stdlib.h \ + string.h sys/ioctl.h sys/time.h unistd.h pthread.h \ + sys/types.h sys/sockio.h stdarg.h byteswap.h getopt.h \ + ctype.h signal.h stdint.h],,,[[]]) + AC_CHECK_HEADERS([sys/socket.h], [], [], + [#ifdef HAVE_SYS_TYPES_H + #include + #endif]) + AC_CHECK_HEADERS([netinet/in.h], [], [], + [#ifdef HAVE_SYS_TYPES_H + #include + #endif]) + AC_CHECK_HEADERS([net/if.h], [], [], + [#ifdef HAVE_SYS_TYPES_H + #include + #endif + #ifdef HAVE_SYS_SOCKET_H + #include + #endif]) fi # win32 if test ${WIN} == 'yes' ; then @@ -140,7 +158,7 @@ fi # RTLinux if test ${USE_RTLINUX} == 'yes' ; then AC_CHECK_HEADERS([\ - string.h pthread.h semaphore.h \ + string.h pthread.h \ rtl.h rtl_malloc.h udp.h nic.h time.h],,,[[]]) AC_CHECK_HEADERS([nictab.h],,,[ #ifdef HAVE_UDP_H @@ -172,7 +190,7 @@ AC_C_INLINE # Checks for library functions. AC_PROG_GCC_TRADITIONAL if test -z ${CONFIG_ORTE_RT} ; then -AC_CHECK_FUNCS([strdup gethostbyname]) +AC_CHECK_FUNCS([strdup gethostbyname getopt_long]) fi AC_CONFIG_FILES([Makefile diff --git a/orte/contrib/decoder/decode_msg.c b/orte/contrib/decoder/decode_msg.c index 150888e..cbf167d 100644 --- a/orte/contrib/decoder/decode_msg.c +++ b/orte/contrib/decoder/decode_msg.c @@ -11,7 +11,7 @@ /**********************************************************************************/ -void conv_u32(u_int32_t *x,u_int8_t ef) { +void conv_u32(uint32_t *x,uint8_t ef) { #if __BYTE_ORDER == __LITTLE_ENDIAN if(ef) bswap_32(*x); #elif __BYTE_ORDER == __BIG_ENDIAN @@ -22,7 +22,7 @@ void conv_u32(u_int32_t *x,u_int8_t ef) { /**********************************************************************************/ void print_obj(void *obj) { fprintf(ptr_out," ("); - switch (bswap_32(*((u_int32_t*)obj))) { + switch (bswap_32(*((uint32_t*)obj))) { case OID_APP: fprintf(ptr_out,"ManagedApplicaton or Manager"); break; @@ -61,7 +61,7 @@ void print_obj(void *obj) { } /**********************************************************************************/ -void print_app(u_int8_t app) { +void print_app(uint8_t app) { switch (app) { case MANAGEDAPPLICATION: fprintf(ptr_out,"(managed application)\n"); @@ -76,13 +76,13 @@ void print_app(u_int8_t app) { } /**********************************************************************************/ -void decode_parametr_sequence(u_int8_t *msg) { +void decode_parametr_sequence(uint8_t *msg) { NtpTime ts; ProtocolVersion pv; VendorId vid; SequenceNumber sn; - u_int8_t i,j,l; - u_int8_t *k; + uint8_t i,j,l; + uint8_t *k; while(*((ParameterId*)msg)!=PID_SENTINEL) { printf("id%d,len%d\n",*((ParameterId*)msg),*((ParameterLength*)(msg+2))); @@ -110,7 +110,7 @@ void decode_parametr_sequence(u_int8_t *msg) { fprintf(ptr_out," PID_TOPIC :\n"); k=msg+4; //len of message is also in message (first ulong) - l=(*(u_int32_t*)(msg+4))+4; + l=(*(uint32_t*)(msg+4))+4; while(l!=0) { if (l>8) j=8; else j=l; @@ -127,13 +127,13 @@ void decode_parametr_sequence(u_int8_t *msg) { break; case PID_STRENGTH: fprintf(ptr_out," PID_STRENGTH : %u\n", - *(u_int32_t*)(msg+4)); + *(uint32_t*)(msg+4)); break; case PID_TYPE_NAME: fprintf(ptr_out," PID_TYPE_NAME :\n"); k=msg+4; //len of message is also in message (first ulong) - l=(*(u_int32_t*)(msg+4))+4; + l=(*(uint32_t*)(msg+4))+4; while(l!=0) { if (l>8) j=8; else j=l; @@ -176,7 +176,7 @@ void decode_parametr_sequence(u_int8_t *msg) { break; case PID_EXPECTS_ACK: fprintf(ptr_out," PID_EXPECTS_ACK : %u\n", - *(u_int32_t*)(msg+4)); + *(uint32_t*)(msg+4)); break; case PID_USERDATA_MULTICAST_IPADDRESS: fprintf(ptr_out," PID_USERDATA_MULTICAST_IPADDRESS : %u.%u.%u.%u\n", @@ -188,7 +188,7 @@ void decode_parametr_sequence(u_int8_t *msg) { break; case PID_SEND_QUEUE_SIZE: fprintf(ptr_out," PID_SEND_QUEUE_SIZE : %u\n", - *(u_int32_t*)(msg+4)); + *(uint32_t*)(msg+4)); break; case PID_PROTOCOL_VERSION: pv=*((ProtocolVersion*)(msg+4)); @@ -206,15 +206,15 @@ void decode_parametr_sequence(u_int8_t *msg) { break; case PID_RECV_QUEUE_SIZE: fprintf(ptr_out," PID_RECV_QUEUE_SIZE : %u\n", - *(u_int32_t*)(msg+4)); + *(uint32_t*)(msg+4)); break; case PID_RELIABILITY_OFFERED: fprintf(ptr_out," PID_RELIABILITY_OFFERED : %u\n", - *(u_int32_t*)(msg+4)); + *(uint32_t*)(msg+4)); break; case PID_RELIABILITY_REQUESTED: fprintf(ptr_out," PID_RELIABILITY_REQUESTED : %u\n", - *(u_int32_t*)(msg+4)); + *(uint32_t*)(msg+4)); break; default: fprintf(ptr_out," unknow paramerId : %d len : %d\n", @@ -228,7 +228,7 @@ void decode_parametr_sequence(u_int8_t *msg) { /**********************************************************************************/ -int decode_header(u_int8_t *msg, unsigned len, MessageInterpret *mi) { +int decode_header(uint8_t *msg, unsigned len, MessageInterpret *mi) { if (len<16) return -1; /* message is to small */ if (msg[0]!='R') return -2; /* header is invalid */ if (msg[1]!='T') return -2; /* header is invalid */ @@ -243,13 +243,13 @@ int decode_header(u_int8_t *msg, unsigned len, MessageInterpret *mi) { } /**********************************************************************************/ -int decode_submessage(u_int8_t *msg, int ptr, MessageInterpret *mi) { +int decode_submessage(uint8_t *msg, int ptr, MessageInterpret *mi) { IPAddress ipa; Port port; ObjectId roid,woid,oid; SequenceNumber fsn,lsn,wsn; - u_int8_t i,j,l; - u_int8_t *k; + uint8_t i,j,l; + uint8_t *k; HostId hid; AppId aid; int ptr_off; @@ -265,25 +265,25 @@ int decode_submessage(u_int8_t *msg, int ptr, MessageInterpret *mi) { fprintf(ptr_out," p-bit : %d\n",(msg[ptr+1] & 2) ? 1:0); roid=*((ObjectId*)(msg+ptr+4)); fprintf(ptr_out," ObjectId : %d.%d.%d.%02x", - *(u_int8_t*)&roid,*(((u_int8_t*)&roid)+1),*(((u_int8_t*)&roid)+2),*(((u_int8_t*)&roid)+3)); + *(uint8_t*)&roid,*(((uint8_t*)&roid)+1),*(((uint8_t*)&roid)+2),*(((uint8_t*)&roid)+3)); print_obj(&roid); woid=*((ObjectId*)(msg+ptr+8)); fprintf(ptr_out," ObjectId : %d.%d.%d.%02x", - *(u_int8_t*)&woid,*(((u_int8_t*)&woid)+1),*(((u_int8_t*)&woid)+2),*(((u_int8_t*)&woid)+3)); + *(uint8_t*)&woid,*(((uint8_t*)&woid)+1),*(((uint8_t*)&woid)+2),*(((uint8_t*)&woid)+3)); print_obj(&woid); if (msg[ptr+1] & 8) { hid=*((HostId*)(msg+ptr+12)); /* hostId */ aid=*((AppId*)(msg+ptr+16)); /* appId */ fprintf(ptr_out," HostId : %d.%d.%d.%d\n", - *(u_int8_t*)&hid,*(((u_int8_t*)&hid)+1),*(((u_int8_t*)&hid)+2),*(((u_int8_t*)&hid)+3)); + *(uint8_t*)&hid,*(((uint8_t*)&hid)+1),*(((uint8_t*)&hid)+2),*(((uint8_t*)&hid)+3)); fprintf(ptr_out," AppId : %d.%d.%d.%d ", - *(u_int8_t*)&aid,*(((u_int8_t*)&aid)+1),*(((u_int8_t*)&aid)+2),*(((u_int8_t*)&aid)+3)); - print_app(*(((u_int8_t*)&aid)+3)); + *(uint8_t*)&aid,*(((uint8_t*)&aid)+1),*(((uint8_t*)&aid)+2),*(((uint8_t*)&aid)+3)); + print_app(*(((uint8_t*)&aid)+3)); ptr_off=8; } else ptr_off=0; oid=*((ObjectId*)(msg+ptr+12+ptr_off)); fprintf(ptr_out," ObjectId : %d.%d.%d.%02x", - *(u_int8_t*)&oid,*(((u_int8_t*)&oid)+1),*(((u_int8_t*)&oid)+2),*(((u_int8_t*)&oid)+3)); + *(uint8_t*)&oid,*(((uint8_t*)&oid)+1),*(((uint8_t*)&oid)+2),*(((uint8_t*)&oid)+3)); print_obj(&oid); wsn=*((SequenceNumber*)(msg+ptr+16+ptr_off)); fprintf(ptr_out," sequenceNumber : %u\n",wsn.low); @@ -297,10 +297,10 @@ int decode_submessage(u_int8_t *msg, int ptr, MessageInterpret *mi) { fsn=*((SequenceNumber*)(msg+ptr+12)); fprintf(ptr_out," p-bit : %d\n",(msg[ptr+1] & 2) ? 1:0); fprintf(ptr_out," readerObjectId : %d.%d.%d.%02x", - *(u_int8_t*)&roid,*(((u_int8_t*)&roid)+1),*(((u_int8_t*)&roid)+2),*(((u_int8_t*)&roid)+3)); + *(uint8_t*)&roid,*(((uint8_t*)&roid)+1),*(((uint8_t*)&roid)+2),*(((uint8_t*)&roid)+3)); print_obj(&roid); fprintf(ptr_out," writeObjectId : %d.%d.%d.%02x", - *(u_int8_t*)&woid,*(((u_int8_t*)&woid)+1),*(((u_int8_t*)&woid)+2),*(((u_int8_t*)&woid)+3)); + *(uint8_t*)&woid,*(((uint8_t*)&woid)+1),*(((uint8_t*)&woid)+2),*(((uint8_t*)&woid)+3)); print_obj(&woid); fprintf(ptr_out," issueSeqNumber : %u\n",fsn.low); k=msg+ptr+20; @@ -309,7 +309,7 @@ int decode_submessage(u_int8_t *msg, int ptr, MessageInterpret *mi) { } // l=(*(unsigned*)(msg+ptr+2))-(k-(msg+ptr+20)+16); //len of message is also in message (first ulong), internaly defined by RTI !!! - l=(*(u_int32_t*)k)+4; + l=(*(uint32_t*)k)+4; while(l!=0) { if (l>8) j=8; else j=l; @@ -329,13 +329,13 @@ int decode_submessage(u_int8_t *msg, int ptr, MessageInterpret *mi) { roid=*((ObjectId*)(msg+ptr+4));woid=*((ObjectId*)(msg+ptr+8)); fprintf(ptr_out," final-bit : %d\n",(msg[ptr+1] & 2) ? 1:0); fprintf(ptr_out," readerObjectId : %d.%d.%d.%02x", - *(u_int8_t*)&roid,*(((u_int8_t*)&roid)+1),*(((u_int8_t*)&roid)+2),*(((u_int8_t*)&roid)+3)); + *(uint8_t*)&roid,*(((uint8_t*)&roid)+1),*(((uint8_t*)&roid)+2),*(((uint8_t*)&roid)+3)); print_obj(&roid); fprintf(ptr_out," writeObjectId : %d.%d.%d.%02x", - *(u_int8_t*)&woid,*(((u_int8_t*)&woid)+1),*(((u_int8_t*)&woid)+2),*(((u_int8_t*)&woid)+3)); + *(uint8_t*)&woid,*(((uint8_t*)&woid)+1),*(((uint8_t*)&woid)+2),*(((uint8_t*)&woid)+3)); print_obj(&woid); - fprintf(ptr_out," bitmap : %u/%u:",*((u_int32_t*)(msg+ptr+16)), - *((u_int32_t*)(msg+ptr+20))); + fprintf(ptr_out," bitmap : %u/%u:",*((uint32_t*)(msg+ptr+16)), + *((uint32_t*)(msg+ptr+20))); for(i=0;i>=1) fprintf(ptr_out,"%d",(msg[ptr+24+i] & j) ? 1:0); fprintf(ptr_out," "); @@ -350,10 +350,10 @@ int decode_submessage(u_int8_t *msg, int ptr, MessageInterpret *mi) { fsn=*((SequenceNumber*)(msg+ptr+12));lsn=*((SequenceNumber*)(msg+ptr+20)); fprintf(ptr_out," final-bit : %d\n",(msg[ptr+1] & 2) ? 1:0); fprintf(ptr_out," readerObjectId : %d.%d.%d.%02x", - *(u_int8_t*)&roid,*(((u_int8_t*)&roid)+1),*(((u_int8_t*)&roid)+2),*(((u_int8_t*)&roid)+3)); + *(uint8_t*)&roid,*(((uint8_t*)&roid)+1),*(((uint8_t*)&roid)+2),*(((uint8_t*)&roid)+3)); print_obj(&roid); fprintf(ptr_out," writeObjectId : %d.%d.%d.%02x", - *(u_int8_t*)&woid,*(((u_int8_t*)&woid)+1),*(((u_int8_t*)&woid)+2),*(((u_int8_t*)&woid)+3)); + *(uint8_t*)&woid,*(((uint8_t*)&woid)+1),*(((uint8_t*)&woid)+2),*(((uint8_t*)&woid)+3)); print_obj(&woid); fprintf(ptr_out," firstSeqNumber : %u\n",fsn.low); fprintf(ptr_out," lastSeqNumber : %u\n",lsn.low); @@ -364,16 +364,16 @@ int decode_submessage(u_int8_t *msg, int ptr, MessageInterpret *mi) { fsn=*((SequenceNumber*)(msg+ptr+12)); lsn=*((SequenceNumber*)(msg+ptr+20)); fprintf(ptr_out," readerObjectId : %d.%d.%d.%02x", - *(u_int8_t*)&roid,*(((u_int8_t*)&roid)+1),*(((u_int8_t*)&roid)+2),*(((u_int8_t*)&roid)+3)); + *(uint8_t*)&roid,*(((uint8_t*)&roid)+1),*(((uint8_t*)&roid)+2),*(((uint8_t*)&roid)+3)); print_obj(&roid); fprintf(ptr_out," writeObjectId : %d.%d.%d.%02x", - *(u_int8_t*)&woid,*(((u_int8_t*)&woid)+1),*(((u_int8_t*)&woid)+2),*(((u_int8_t*)&woid)+3)); + *(uint8_t*)&woid,*(((uint8_t*)&woid)+1),*(((uint8_t*)&woid)+2),*(((uint8_t*)&woid)+3)); print_obj(&woid); fprintf(ptr_out," firstSeqNumber : %u\n",fsn.low); fprintf(ptr_out," bitmap : %u/%u:",lsn.low, - *((u_int32_t*)(msg+ptr+28))); - for(i=0;i<(*((u_int32_t*)(msg+ptr+28)));i++) { - l=((*(((u_int32_t*)(msg+ptr+32))+i/32)) & (1<<(31-i%32))) ? 1:0; + *((uint32_t*)(msg+ptr+28))); + for(i=0;i<(*((uint32_t*)(msg+ptr+28)));i++) { + l=((*(((uint32_t*)(msg+ptr+32))+i/32)) & (1<<(31-i%32))) ? 1:0; fprintf(ptr_out,"%d",l); } fprintf(ptr_out,"\n"); @@ -392,20 +392,20 @@ int decode_submessage(u_int8_t *msg, int ptr, MessageInterpret *mi) { break; case INFO_REPLY: fprintf(ptr_out," INFO_REPLY\n"); - ipa=*((u_int32_t*)(msg+ptr+4)); /* unicastReplyIPAddress */ - port=*((u_int32_t*)(msg+ptr+8)); /* unicastReplyPort */ + ipa=*((uint32_t*)(msg+ptr+4)); /* unicastReplyIPAddress */ + port=*((uint32_t*)(msg+ptr+8)); /* unicastReplyPort */ fprintf(ptr_out," unicastReplyIPAddress : %d.%d.%d.%d\n", - *(u_int8_t*)&ipa,*(((u_int8_t*)&ipa)+1),*(((u_int8_t*)&ipa)+2),*(((u_int8_t*)&ipa)+3)); + *(uint8_t*)&ipa,*(((uint8_t*)&ipa)+1),*(((uint8_t*)&ipa)+2),*(((uint8_t*)&ipa)+3)); fprintf(ptr_out," unicastReplyPort : %u\n",port); if (ipa!=IPADDRESS_INVALID) { mi->unicastReplyIPAddress=ipa; } mi->unicastReplyPort=port; if ((msg[ptr+1] & 0x02) !=0) { - ipa=*((u_int32_t*)(msg+ptr+12)); /* multicastReplyIPAddress */ - port=*((u_int32_t*)(msg+ptr+16)); /* multicastReplyPort */ + ipa=*((uint32_t*)(msg+ptr+12)); /* multicastReplyIPAddress */ + port=*((uint32_t*)(msg+ptr+16)); /* multicastReplyPort */ fprintf(ptr_out," multicastReplyIPAddress : %d.%d.%d.%d\n", - *(u_int8_t*)&ipa,*(((u_int8_t*)&ipa)+1),*(((u_int8_t*)&ipa)+2),*(((u_int8_t*)&ipa)+3)); + *(uint8_t*)&ipa,*(((uint8_t*)&ipa)+1),*(((uint8_t*)&ipa)+2),*(((uint8_t*)&ipa)+3)); fprintf(ptr_out," multicastReplyPort : %u\n",port); mi->multicastReplyIPAddress=ipa; mi->multicastReplyPort=port; @@ -419,10 +419,10 @@ int decode_submessage(u_int8_t *msg, int ptr, MessageInterpret *mi) { hid=*((HostId*)(msg+ptr+4)); /* hostId */ aid=*((AppId*)(msg+ptr+8)); /* appId */ fprintf(ptr_out," HostId : %d.%d.%d.%d\n", - *(u_int8_t*)&hid,*(((u_int8_t*)&hid)+1),*(((u_int8_t*)&hid)+2),*(((u_int8_t*)&hid)+3)); + *(uint8_t*)&hid,*(((uint8_t*)&hid)+1),*(((uint8_t*)&hid)+2),*(((uint8_t*)&hid)+3)); fprintf(ptr_out," AppId : %d.%d.%d.%d ", - *(u_int8_t*)&aid,*(((u_int8_t*)&aid)+1),*(((u_int8_t*)&aid)+2),*(((u_int8_t*)&aid)+3)); - print_app(*(((u_int8_t*)&aid)+3)); + *(uint8_t*)&aid,*(((uint8_t*)&aid)+1),*(((uint8_t*)&aid)+2),*(((uint8_t*)&aid)+3)); + print_app(*(((uint8_t*)&aid)+3)); break; default: fprintf(ptr_out," undefined submessage code\n"); @@ -434,7 +434,7 @@ int decode_submessage(u_int8_t *msg, int ptr, MessageInterpret *mi) { /**********************************************************************************/ int main(int argc, char * argv[]) { - u_int8_t rtps_msg[16384],rtps_msg_c[3]={0,0,0}; + uint8_t rtps_msg[16384],rtps_msg_c[3]={0,0,0}; unsigned rtps_msg_ptr=0,rtps_msg_len,rtps_submsg_cnt,submsg_len; int err,c,no_lchar=1; MessageInterpret mi; @@ -506,11 +506,11 @@ int main(int argc, char * argv[]) { else { if ((no_lchar>5) && (no_lchar<57)) { /* converted data from */ if ((rtps_msg_c[0]!=0) && (isxdigit(c))) { /* position 6 to 56 */ - rtps_msg_c[1]=(u_int8_t)c; - rtps_msg[rtps_msg_ptr++]=(u_int8_t)strtol(rtps_msg_c,NULL,16); + rtps_msg_c[1]=(uint8_t)c; + rtps_msg[rtps_msg_ptr++]=(uint8_t)strtol(rtps_msg_c,NULL,16); rtps_msg_c[0]=0; } else { - if ((rtps_msg_c[0]==0) && (isxdigit(c))) rtps_msg_c[0]=(u_int8_t)c; + if ((rtps_msg_c[0]==0) && (isxdigit(c))) rtps_msg_c[0]=(uint8_t)c; } } } diff --git a/orte/contrib/shape/richtext.cpp b/orte/contrib/shape/richtext.cpp index 1f8f0c0..aed9983 100644 --- a/orte/contrib/shape/richtext.cpp +++ b/orte/contrib/shape/richtext.cpp @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: richtext.cpp,v 1.4 2004/04/03 11:33:16 smolik Exp $ +** $Id: richtext.cpp,v 1.5 2004/04/20 08:37:21 smolik Exp $ ** ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. ** diff --git a/orte/contrib/shape/richtext.h b/orte/contrib/shape/richtext.h index 00879af..6a8aa88 100644 --- a/orte/contrib/shape/richtext.h +++ b/orte/contrib/shape/richtext.h @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: richtext.h,v 1.3 2004/04/03 11:33:16 smolik Exp $ +** $Id: richtext.h,v 1.4 2004/04/20 08:37:21 smolik Exp $ ** ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. ** diff --git a/orte/examples/ping/orteping.c b/orte/examples/ping/orteping.c index a2dc0d9..84b8116 100644 --- a/orte/examples/ping/orteping.c +++ b/orte/examples/ping/orteping.c @@ -21,17 +21,26 @@ #include #include -#include #ifndef _WIN32 #include #endif #include "orte_api.h" +#ifdef HAVE_CONFIG_H + #ifdef HAVE_GETOPT_H + #include + #endif + #ifdef HAVE_UNISTD_H + #include //getopt.h for DarWin, Solaris, ... + #endif +#else + #include +#endif Boolean quite=ORTE_FALSE; void recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) { - u_int32_t *instance=(u_int32_t*)vinstance; + uint32_t *instance=(uint32_t*)vinstance; switch (info->status) { case NEW_DATA: @@ -46,7 +55,7 @@ recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) void sendCallBack(const ORTESendInfo *info,void *vinstance, void *sendCallBackParam) { - u_int32_t *instance=(u_int32_t*)vinstance; + uint32_t *instance=(uint32_t*)vinstance; switch (info->status) { case NEED_DATA: @@ -60,7 +69,7 @@ sendCallBack(const ORTESendInfo *info,void *vinstance, void *sendCallBackParam) } static void usage(void) { - printf("usage: ORTEPing \n"); + printf("usage: orteping \n"); printf(" -d, --domain working manager domain\n"); printf(" -p, --publisher create publisher Ping,PingData\n"); printf(" -S, --strength strength of publisher <1>\n"); @@ -71,8 +80,8 @@ static void usage(void) { printf(" -E, --expiration expiration time of application\n"); printf(" -m, --minimumSeparation minimumSeparation between two issues\n"); printf(" -v, --verbosity set verbosity level SECTION, up to LEVEL:...\n"); - printf(" examples: ORTEManager -v 51,7:32,5 sections 51 and 32\n"); - printf(" ORTEManager -v ALL,7 all sections up to level 7\n"); + printf(" examples: ORTEManager -v 51.7:32.5 sections 51 and 32\n"); + printf(" ORTEManager -v ALL.7 all sections up to level 7\n"); printf(" -q --quiet \n"); printf(" -l, --logfile set log file name\n"); printf(" -V, --version show version\n"); @@ -80,6 +89,7 @@ static void usage(void) { } int main(int argc,char *argv[]) { +#if defined HAVE_GETOPT_LONG || defined HAVE_GETOPT_LONG_ORTE static struct option long_opts[] = { { "domain",1,0, 'd' }, { "publisher",0,0, 'p' }, @@ -97,6 +107,7 @@ int main(int argc,char *argv[]) { { "help", 0, 0, 'h' }, { 0, 0, 0, 0} }; +#endif ORTEDomain *d; ORTEDomainProp dp; ORTEPublication *p=NULL; @@ -112,8 +123,12 @@ int main(int argc,char *argv[]) { ORTEDomainPropDefaultGet(&dp); NTPTIME_BUILD(minimumSeparation,0); NTPTIME_BUILD(delay,1); //1s - + +#if defined HAVE_GETOPT_LONG || defined HAVE_GETOPT_LONG_ORTE while ((opt = getopt_long(argc, argv, "m:S:d:v:R:E:P:l:D:Vhpsq",&long_opts[0], NULL)) != EOF) { +#else + while ((opt = getopt(argc, argv, "m:S:d:v:R:E:P:l:D:Vhpsq")) != EOF) { +#endif switch (opt) { case 'S': strength=strtol(optarg,NULL,0); diff --git a/orte/examples/spy/ortespy.c b/orte/examples/spy/ortespy.c index 930e649..dcf1f11 100644 --- a/orte/examples/spy/ortespy.c +++ b/orte/examples/spy/ortespy.c @@ -21,12 +21,20 @@ #include #include -#include #ifndef _WIN32 #include #endif #include "orte_api.h" - +#ifdef HAVE_CONFIG_H + #ifdef HAVE_GETOPT_H + #include + #endif + #ifdef HAVE_UNISTD_H + #include //getopt.h for DarWin, Solaris, ... + #endif +#else + #include +#endif #include "string.h" ORTEDomain *d; @@ -70,11 +78,11 @@ subscriptionCallBack(const char *topic, const char *type, void *param) { } static void usage(void) { - printf("usage: ORTESpy \n"); + printf("usage: ortespy \n"); printf(" -d, --domain working manager domain\n"); printf(" -v, --verbosity set verbosity level SECTION, up to LEVEL:...\n"); - printf(" examples: ORTEManager -v 51,7:32,5 sections 51 and 32\n"); - printf(" ORTEManager -v ALL,7 all sections up to level 7\n"); + printf(" examples: ORTEManager -v 51.7:32.5 sections 51 and 32\n"); + printf(" ORTEManager -v ALL.7 all sections up to level 7\n"); printf(" -R, --refresh refresh period in second(s)\n"); printf(" -P, --purge purge time in second(s)\n"); printf(" -e, --expiration expiration time of manager in second(s)\n"); @@ -84,6 +92,7 @@ static void usage(void) { } int main(int argc,char *argv[]) { +#if defined HAVE_GETOPT_LONG || defined HAVE_GETOPT_LONG_ORTE static struct option long_opts[] = { { "domain",1,0, 'd' }, { "verbosity",1,0, 'v' }, @@ -95,6 +104,7 @@ int main(int argc,char *argv[]) { { "help", 0, 0, 'h' }, { 0, 0, 0, 0} }; +#endif ORTEDomainProp dp; int opt,domain=ORTE_DEFAULT_DOMAIN; @@ -102,8 +112,12 @@ int main(int argc,char *argv[]) { ORTEDomainPropDefaultGet(&dp); NTPTIME_BUILD(deadline,3); NTPTIME_BUILD(minimumSeparation,0); - + +#if defined HAVE_GETOPT_LONG || defined HAVE_GETOPT_LONG_ORTE while ((opt = getopt_long(argc, argv, "d:v:R:E:P:l:Vh",&long_opts[0], NULL)) != EOF) { +#else + while ((opt = getopt(argc, argv, "d:v:R:E:P:l:Vh")) != EOF) { +#endif switch (opt) { case 'd': domain=strtol(optarg,NULL,0); diff --git a/orte/include/config.h.in b/orte/include/config.h.in index 76a717a..d24d475 100644 --- a/orte/include/config.h.in +++ b/orte/include/config.h.in @@ -45,9 +45,21 @@ /* Define to 1 if you have the header file. */ #undef HAVE_GETOPT_H +/* Define to 1 if you have the `getopt_long' function. */ +#undef HAVE_GETOPT_LONG + +/* Define for ORTE getopt_long self implemetation */ +#undef HAVE_GETPOT_LONG_ORTE + +/* Define to 1 if you have the `nsl' library (-lnsl). */ +#undef HAVE_LIBNSL + /* Define to 1 if you have the `pthread' library (-lpthread). */ #undef HAVE_LIBPTHREAD +/* Define to 1 if you have the `socket' library (-lsocket). */ +#undef HAVE_LIBSOCKET + /* Define to 1 if you have the `ws2_32' library (-lws2_32). */ #undef HAVE_LIBWS2_32 @@ -102,15 +114,15 @@ /* Define to 1 if you have the header file. */ #undef HAVE_RTNET_H -/* Define to 1 if you have the header file. */ -#undef HAVE_SEMAPHORE_H - /* Define to 1 if you have the header file. */ #undef HAVE_SIGNAL_H /* Define to 1 if you have the header file. */ #undef HAVE_STDARG_H +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + /* Define to 1 if you have the header file. */ #undef HAVE_STDIO_H @@ -129,6 +141,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKIO_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H diff --git a/orte/include/defines.h b/orte/include/defines.h index 09bf368..5ff8bb9 100644 --- a/orte/include/defines.h +++ b/orte/include/defines.h @@ -74,7 +74,8 @@ extern "C" { ////////////////////////////////////////////////////////////////////////////// // conv -#if defined CONFIG_ORTE_WIN || defined _MSC_VER +//#if defined CONFIG_ORTE_WIN || defined _MSC_VER || !define HAVE_BYTESWAP_H +#if !defined HAVE_BYTESWAP_H && !defined HAVE_ASM_BYTEORDER_H /* Swap bytes in 16 bit value. */ #define bswap_16(x) \ ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)) diff --git a/orte/include/defines_api.h b/orte/include/defines_api.h index ce2b325..70c89e1 100644 --- a/orte/include/defines_api.h +++ b/orte/include/defines_api.h @@ -62,7 +62,7 @@ extern "C" { * * res = sn + 1 */ - #define SeqNumberInc(res,sn) { \ +#define SeqNumberInc(res,sn) { \ (res) = (sn); \ if (++(res).low==0) (res).high++; \ } @@ -77,7 +77,7 @@ extern "C" { * * res = sn1 + sn2 */ - #define SeqNumberAdd(res,sn1,sn2) { \ +#define SeqNumberAdd(res,sn1,sn2) { \ (res).low = (sn1).low+(sn2).low; \ (res).high = (sn1).high+(sn2).high; \ if (((res).low < (sn1).low) || \ @@ -177,7 +177,7 @@ extern "C" { * @msec: miliseconds portion of given time */ #define NtpTimeAssembFromMs(time, s, msec) { \ - register u_int32_t ms = msec; \ + register uint32_t ms = msec; \ (time).seconds = s; \ (time).fraction = (ms<<22) + ((ms*393)<<8); \ } @@ -202,7 +202,7 @@ extern "C" { * @usec: microseconds portion of given time */ #define NtpTimeAssembFromUs(time, s, usec) { \ - register u_int32_t us = usec; \ + register uint32_t us = usec; \ (time).seconds = s; \ (time).fraction = (us<<12)+ ((us*99)<<1)+ ((us*15 + ((us*61)>>7))>>4); \ } @@ -214,7 +214,7 @@ extern "C" { * @time: time given in NtpTime structure */ #define NtpTimeDisAssembToUs(s, usec, time) { \ - register u_int32_t NtpTemp = (time).fraction; \ + register uint32_t NtpTemp = (time).fraction; \ s = (time).seconds; \ usec = ((time).fraction - (NtpTemp>>5)-(NtpTemp>>7)-(NtpTemp>>8)- \ (NtpTemp>>9)-(NtpTemp>>10) - (NtpTemp>>12) - \ diff --git a/orte/include/ew_types.h b/orte/include/ew_types.h index 2179244..9d04cd2 100644 --- a/orte/include/ew_types.h +++ b/orte/include/ew_types.h @@ -25,11 +25,11 @@ extern "C" { #endif -#define u_int8_t unsigned char +#define uint8_t unsigned char #define int8_t char -#define u_int16_t unsigned short +#define uint16_t unsigned short #define int16_t short -#define u_int32_t unsigned int +#define uint32_t unsigned int #define int32_t int #ifdef __cplusplus diff --git a/orte/include/orte_all.h b/orte/include/orte_all.h index 6986f34..8112e9c 100644 --- a/orte/include/orte_all.h +++ b/orte/include/orte_all.h @@ -45,9 +45,6 @@ extern "C" { #ifdef HAVE_NETDB_H #include #endif -#ifdef HAVE_NETINET_IN_H - #include -#endif #ifdef HAVE_STDLIB_H #include #endif @@ -57,9 +54,6 @@ extern "C" { #ifdef HAVE_SYS_IOCTL_H #include #endif -#ifdef HAVE_SYS_SOCKET_H - #include -#endif #ifdef HAVE_SYS_TIME_H #include #endif @@ -69,30 +63,39 @@ extern "C" { #ifdef HAVE_PTHREAD_H #include #endif -#ifdef HAVE_STDARG_H - #include -#endif #ifdef HAVE_SYS_TYPES_H #include #endif -#ifdef HAVE_NET_IF_H - #include +#ifdef HAVE_SYS_SOCKIO_H + #include +#endif +#ifdef HAVE_STDARG_H + #include #endif #ifdef HAVE_BYTESWAP_H #include #endif -#ifdef HAVE_CTYPE_H - #include -#endif -#ifdef HAVE_SEMAPHORE_H - #include -#endif #ifdef HAVE_GETOPT_H #include #endif +#ifdef HAVE_CTYPE_H + #include +#endif #ifdef HAVE_SIGNAL_H #include #endif +#ifdef HAVE_STDINT_H + #include +#endif +#ifdef HAVE_SYS_SOCKET_H + #include +#endif +#ifdef HAVE_NETINET_IN_H + #include +#endif +#ifdef HAVE_NET_IF_H + #include +#endif //win32 headers #if defined HAVE_WINSOCK2_H && !HAVE_SYS_SOCKET_H #include @@ -162,7 +165,6 @@ extern "C" { #elif CONFIG_ORTE_MINGW #define SOCK_WIN #include - #include #include #ifndef __GETOPT_H__ //mingw #include @@ -189,12 +191,11 @@ extern "C" { #include #include #include - #include #include #include #include #define ioctl ioctlsocket - #define ORTE_PACKAGE_STRING "orte 0.2.1" + #define ORTE_PACKAGE_STRING "orte 0.2.2" #endif #ifdef __cplusplus diff --git a/orte/include/orte_api.h b/orte/include/orte_api.h index e10b8af..6c14d55 100644 --- a/orte/include/orte_api.h +++ b/orte/include/orte_api.h @@ -33,7 +33,9 @@ extern "C" { #include "orte_config_omk_rtl.h" #endif -#ifdef HAVE_SYS_TYPES_H +#ifdef HAVE_STDINT_H + #include +#elif defined HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_LINUX_TYPES_H diff --git a/orte/include/orte_config_omk_rtl.h b/orte/include/orte_config_omk_rtl.h index 3f8bc14..95a3313 100644 --- a/orte/include/orte_config_omk_rtl.h +++ b/orte/include/orte_config_omk_rtl.h @@ -97,9 +97,6 @@ /* Define to 1 if you have the header file. */ /* #undef HAVE_RTNET_H */ -/* Define to 1 if you have the header file. */ -#define HAVE_SEMAPHORE_H 1 - /* Define to 1 if you have the header file. */ /* #undef HAVE_SIGNAL_H */ @@ -158,19 +155,19 @@ #define ORTE_PACKAGE_NAME "orte" /* Define to the full name and version of this package. */ -#define ORTE_PACKAGE_STRING "orte 0.2.1" +#define ORTE_PACKAGE_STRING "orte 0.2.2" /* Define to the one symbol short name of this package. */ #define ORTE_PACKAGE_TARNAME "orte" /* Define to the version of this package. */ -#define ORTE_PACKAGE_VERSION "0.2.1" +#define ORTE_PACKAGE_VERSION "0.2.2" /* Define to 1 if you have the ANSI C header files. */ /* #undef STDC_HEADERS */ /* Version number of package */ -#define ORTE_VERSION "0.2.1" +#define ORTE_VERSION "0.2.2" /* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ diff --git a/orte/include/orte_config_omk_unix.h b/orte/include/orte_config_omk_unix.h index 2660cfe..7f736ad 100644 --- a/orte/include/orte_config_omk_unix.h +++ b/orte/include/orte_config_omk_unix.h @@ -1,9 +1,15 @@ /* orte/include/config.h. Generated by configure. */ /* orte/include/config.h.in. Generated from configure.in by autoheader. */ +/* Define if is target CYGWIN */ +/* #undef CONFIG_ORTE_CYGWIN */ + /* Define if linux kernel is found */ /* #undef CONFIG_ORTE_KERNEL */ +/* Define if is target MINGW */ +/* #undef CONFIG_ORTE_MINGW */ + /* Define to enable ORTE's RT support */ /* #undef CONFIG_ORTE_RT */ @@ -40,9 +46,21 @@ /* Define to 1 if you have the header file. */ #define HAVE_GETOPT_H 1 +/* Define to 1 if you have the `getopt_long' function. */ +#define HAVE_GETOPT_LONG 1 + +/* Define for ORTE getopt_long self implemetation */ +/* #undef HAVE_GETPOT_LONG_ORTE */ + +/* Define to 1 if you have the `nsl' library (-lnsl). */ +#define HAVE_LIBNSL 1 + /* Define to 1 if you have the `pthread' library (-lpthread). */ #define HAVE_LIBPTHREAD 1 +/* Define to 1 if you have the `socket' library (-lsocket). */ +/* #undef HAVE_LIBSOCKET */ + /* Define to 1 if you have the `ws2_32' library (-lws2_32). */ /* #undef HAVE_LIBWS2_32 */ @@ -97,15 +115,15 @@ /* Define to 1 if you have the header file. */ /* #undef HAVE_RTNET_H */ -/* Define to 1 if you have the header file. */ -#define HAVE_SEMAPHORE_H 1 - /* Define to 1 if you have the header file. */ #define HAVE_SIGNAL_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDARG_H 1 +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + /* Define to 1 if you have the header file. */ #define HAVE_STDIO_H 1 @@ -124,6 +142,9 @@ /* Define to 1 if you have the header file. */ #define HAVE_SYS_SOCKET_H 1 +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SOCKIO_H */ + /* Define to 1 if you have the header file. */ #define HAVE_SYS_TIME_H 1 @@ -158,19 +179,19 @@ #define ORTE_PACKAGE_NAME "orte" /* Define to the full name and version of this package. */ -#define ORTE_PACKAGE_STRING "orte 0.2.1" +#define ORTE_PACKAGE_STRING "orte 0.2.2" /* Define to the one symbol short name of this package. */ #define ORTE_PACKAGE_TARNAME "orte" /* Define to the version of this package. */ -#define ORTE_PACKAGE_VERSION "0.2.1" +#define ORTE_PACKAGE_VERSION "0.2.2" /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Version number of package */ -#define ORTE_VERSION "0.2.1" +#define ORTE_VERSION "0.2.2" /* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ diff --git a/orte/include/protos.h b/orte/include/protos.h index e2bd131..708a26a 100644 --- a/orte/include/protos.h +++ b/orte/include/protos.h @@ -40,7 +40,7 @@ sock_setsockopt(sock_t *sock,int optname,const char *optval, int optlen); extern int sock_getsockopt(sock_t *sock,int optname,char *optval, int *optlen); extern int -sock_bind(sock_t *sock,u_int16_t port); +sock_bind(sock_t *sock,uint16_t port); extern int sock_recvfrom(sock_t *sock, void *buf, int max_len,struct sockaddr_in *des,int des_len); extern int @@ -53,9 +53,9 @@ sock_get_local_interfaces(sock_t *sock,ORTEIFProp *IFProp,char *IFCount); /////////////////////////////////////////////////////////////////////////////// // conv.c extern void -conv_u16(u_int16_t *x,char ef); +conv_u16(uint16_t *x,char ef); extern void -conv_u32(u_int32_t *x,char ef); +conv_u32(uint32_t *x,char ef); extern void conv_sn(SequenceNumber *sn,char ef); extern void @@ -199,10 +199,10 @@ extern int parameterDelete(CSChange *csChange); extern int parameterCodeStreamFromCSChange(CSChange *csChange, - u_int8_t *rtps_msg,u_int32_t max_msg_len); + uint8_t *rtps_msg,uint32_t max_msg_len); extern int -parameterDecodeStreamToCSChange(CSChange *csChange,u_int8_t *rtps_msg, - u_int16_t submsg_len,u_int8_t needByteSwap); +parameterDecodeStreamToCSChange(CSChange *csChange,uint8_t *rtps_msg, + uint16_t submsg_len,uint8_t needByteSwap); extern int parameterUpdateCSChange( CSChange *csChange,AppParams *ap,Boolean Manager); @@ -233,7 +233,7 @@ GAVL_CUST_NODE_INT_DEC(ORTEType, TypeEntry, TypeNode, const char *, /////////////////////////////////////////////////////////////////////////////// // ORTEThreadUtils.c extern void -ORTEDomainWakeUpReceivingThread(ORTEDomain *d,sock_t *sock,u_int16_t port); +ORTEDomainWakeUpReceivingThread(ORTEDomain *d,sock_t *sock,uint16_t port); extern void ORTEDomainWakeUpSendingThread(ObjectEntry *objectEntry); @@ -255,75 +255,75 @@ ORTESendData(ORTEDomain *d,ObjectEntryAID *objectEntryAID,Boolean meta); /////////////////////////////////////////////////////////////////////////////// // RTPSHeader.c extern int16_t -RTPSHeaderCreate(u_int8_t *msg,HostId hid,AppId aid); +RTPSHeaderCreate(uint8_t *msg,HostId hid,AppId aid); extern int16_t -RTPSHeaderCheck(u_int8_t *msg,int32_t len,MessageInterpret *mi); +RTPSHeaderCheck(uint8_t *msg,int32_t len,MessageInterpret *mi); /////////////////////////////////////////////////////////////////////////////// // RTPSPad.c extern void -RTPSPad(u_int8_t *rtps_msg,MessageInterpret *mi); +RTPSPad(uint8_t *rtps_msg,MessageInterpret *mi); /////////////////////////////////////////////////////////////////////////////// // RTPSInfoDST.c extern void -RTPSInfoDST(u_int8_t *rtps_msg,MessageInterpret *mi); +RTPSInfoDST(uint8_t *rtps_msg,MessageInterpret *mi); /////////////////////////////////////////////////////////////////////////////// // RTPSInfoREPLY.c extern void -RTPSInfoREPLY(u_int8_t *rtps_msg,MessageInterpret *mi); +RTPSInfoREPLY(uint8_t *rtps_msg,MessageInterpret *mi); /////////////////////////////////////////////////////////////////////////////// // RTPSInfoREPLY.c extern int32_t -RTPSInfoREPLYCreate(u_int8_t *rtps_msg,u_int32_t max_msg_len, +RTPSInfoREPLYCreate(uint8_t *rtps_msg,uint32_t max_msg_len, IPAddress ipaddress,Port port); extern void -RTPSInfoSRC(u_int8_t *rtps_msg,MessageInterpret *mi); +RTPSInfoSRC(uint8_t *rtps_msg,MessageInterpret *mi); /////////////////////////////////////////////////////////////////////////////// // RTPSInfoTS.c extern int32_t -RTPSInfoTSCreate(u_int8_t *rtps_msg,u_int32_t max_msg_len,NtpTime time); +RTPSInfoTSCreate(uint8_t *rtps_msg,uint32_t max_msg_len,NtpTime time); extern void -RTPSInfoTS(u_int8_t *rtps_msg,MessageInterpret *mi); +RTPSInfoTS(uint8_t *rtps_msg,MessageInterpret *mi); /////////////////////////////////////////////////////////////////////////////// // RTPSVar.c extern void -RTPSVar(ORTEDomain *d,u_int8_t *rtps_msg,MessageInterpret *mi,IPAddress senderIPAddress); +RTPSVar(ORTEDomain *d,uint8_t *rtps_msg,MessageInterpret *mi,IPAddress senderIPAddress); /////////////////////////////////////////////////////////////////////////////// // RTPSAck.c extern int32_t -RTPSAckCreate(u_int8_t *rtps_msg,u_int32_t max_msg_len, +RTPSAckCreate(uint8_t *rtps_msg,uint32_t max_msg_len, SequenceNumber *seqNumber, ObjectId roid,ObjectId woid,Boolean f_bit); extern void -RTPSAck(ORTEDomain *d,u_int8_t *rtps_msg,MessageInterpret *mi,IPAddress senderIPAddress); +RTPSAck(ORTEDomain *d,uint8_t *rtps_msg,MessageInterpret *mi,IPAddress senderIPAddress); /////////////////////////////////////////////////////////////////////////////// // RTPSHeardBeat.c extern int -RTPSHeardBeatCreate(u_int8_t *rtps_msg,u_int32_t max_msg_len, +RTPSHeardBeatCreate(uint8_t *rtps_msg,uint32_t max_msg_len, SequenceNumber *firstSeqNumber,SequenceNumber *lastSeqNumber, ObjectId woid,ObjectId roid,Boolean f_bit); extern void -RTPSHeardBeat(ORTEDomain *d,u_int8_t *rtps_msg,MessageInterpret *mi); +RTPSHeardBeat(ORTEDomain *d,uint8_t *rtps_msg,MessageInterpret *mi); /////////////////////////////////////////////////////////////////////////////// // RTPSGap.c extern void -RTPSGap(ORTEDomain *d,u_int8_t *rtps_msg,MessageInterpret *mi,IPAddress senderIPAddress); +RTPSGap(ORTEDomain *d,uint8_t *rtps_msg,MessageInterpret *mi,IPAddress senderIPAddress); /////////////////////////////////////////////////////////////////////////////// // RTPSIssue.c extern int32_t -RTPSIssueCreateHeader(u_int8_t *rtps_msg,u_int32_t max_msg_len,u_int32_t length, +RTPSIssueCreateHeader(uint8_t *rtps_msg,uint32_t max_msg_len,uint32_t length, ObjectId roid,ObjectId woid,SequenceNumber sn); extern void -RTPSIssue(ORTEDomain *d,u_int8_t *rtps_msg,MessageInterpret *mi,IPAddress senderIPAddress); +RTPSIssue(ORTEDomain *d,uint8_t *rtps_msg,MessageInterpret *mi,IPAddress senderIPAddress); /////////////////////////////////////////////////////////////////////////////// // RTPSUtils.c diff --git a/orte/include/rtl/compat.h b/orte/include/rtl/compat.h index 97ea897..eee56cc 100644 --- a/orte/include/rtl/compat.h +++ b/orte/include/rtl/compat.h @@ -47,15 +47,4 @@ static inline int atoi(const char* nptr) return simple_strtol(nptr, (char **)NULL, 10); } -/*static char inet_ntoa_buf[16]; -static inline char *inet_ntoa(struct in_addr in) { - unsigned char *octet; - - octet = (unsigned char *)&(in.s_addr); - sprintf(inet_ntoa_buf, "%u.%u.%u.%u", octet[0], octet[1], octet[2], octet[3]); - - return inet_ntoa_buf; -} -*/ - #endif /* _COMPAT_H */ diff --git a/orte/include/typedefs.h b/orte/include/typedefs.h index 85c1712..b194b6b 100644 --- a/orte/include/typedefs.h +++ b/orte/include/typedefs.h @@ -37,7 +37,7 @@ typedef struct ObjectEntry ObjectEntry; */ typedef struct sock_t { int fd; - u_int16_t port; + uint16_t port; } sock_t; /** @@ -192,7 +192,9 @@ struct ObjectEntry{ pthread_rwlock_t objRootLock; ul_htim_queue_t htimRoot; //root of tree htimers pthread_rwlock_t htimRootLock; - sem_t htimSendSem; //for wake up + pthread_cond_t htimSendCond; //for wake up + pthread_mutex_t htimSendMutex; + int htimSendCondValue; Boolean htimNeedWakeUp; }; @@ -305,7 +307,9 @@ struct CSTWriter { //only for CSTPublications unsigned int strictReliableCounter; unsigned int bestEffortsCounter; - sem_t semCSChangeDestroyed; + pthread_cond_t condCSChangeDestroyed; //for wake up + pthread_mutex_t mutexCSChangeDestroyed; + int condValueCSChangeDestroyed; }; /** @@ -391,7 +395,7 @@ struct CSTReader { struct CSTPublications { gavl_cust_root_field_t cstWriter; pthread_rwlock_t lock; - u_int32_t counter; + uint32_t counter; }; /** @@ -400,7 +404,7 @@ struct CSTPublications { struct CSTSubscriptions { gavl_cust_root_field_t cstReader; pthread_rwlock_t lock; - u_int32_t counter; + uint32_t counter; }; /** @@ -417,7 +421,7 @@ typedef struct PSEntry { * struct ORTEDomain - */ struct ORTEDomain { - u_int32_t domain; //domain value + uint32_t domain; //domain value GUID_RTPS guid; //guid of self application AppParams *appParams; //self parameters (share from objectEntry) ObjectEntryOID *objectEntryOID;//entry point for self OID diff --git a/orte/include/typedefs_api.h b/orte/include/typedefs_api.h index c4f4adc..fab66ee 100644 --- a/orte/include/typedefs_api.h +++ b/orte/include/typedefs_api.h @@ -115,8 +115,8 @@ typedef struct ORTEMulticastProp { * Struct @ORTECDRStream is used by serialization and deserialization functions. */ typedef struct ORTECDRStream { - u_int8_t *buffer; - u_int8_t *bufferPtr; + uint8_t *buffer; + uint8_t *bufferPtr; Boolean needByteSwap; int length; } ORTECDRStream; @@ -204,10 +204,10 @@ typedef struct ORTEPublProp { TypeChecksum typeChecksum; Boolean expectsAck; NtpTime persistence; - u_int32_t reliabilityOffered; - u_int32_t sendQueueSize; + uint32_t reliabilityOffered; + uint32_t sendQueueSize; int32_t strength; - u_int32_t criticalQueueLevel; + uint32_t criticalQueueLevel; NtpTime HBNornalRate; NtpTime HBCQLRate; unsigned int HBMaxRetries; @@ -230,11 +230,11 @@ typedef struct ORTESubsProp { TypeName typeName; TypeChecksum typeChecksum; NtpTime minimumSeparation; - u_int32_t recvQueueSize; - u_int32_t reliabilityRequested; + uint32_t recvQueueSize; + uint32_t reliabilityRequested; //additional parameters NtpTime deadline; - u_int32_t mode; + uint32_t mode; } ORTESubsProp; /** diff --git a/orte/include/typedefs_defines_rtps.h b/orte/include/typedefs_defines_rtps.h index f50836d..69f810e 100644 --- a/orte/include/typedefs_defines_rtps.h +++ b/orte/include/typedefs_defines_rtps.h @@ -49,7 +49,7 @@ typedef int32_t TypeChecksum; for example: IP address working nodes */ -typedef u_int32_t HostId; +typedef uint32_t HostId; #define HID_UNKNOWN 0x00 /** @@ -58,7 +58,7 @@ typedef u_int32_t HostId; composed from: 3 bytes - instance Id 1 byte - appKind (1 - ManagedApplication, 2 - Manager) */ -typedef u_int32_t AppId; +typedef uint32_t AppId; #define AID_UNKNOWN 0x00 #define MANAGEDAPPLICATION 0x01 #define MANAGER 0x02 @@ -69,7 +69,7 @@ typedef u_int32_t AppId; composed from: 3 bytes - instance Id 1 byte - objKind */ -typedef u_int32_t ObjectId; +typedef uint32_t ObjectId; #define OID_UNKNOWN 0x00000000 #define OID_APP 0x000001C1 @@ -129,18 +129,18 @@ typedef struct { typedef struct { int32_t seconds; /* time in seconds */ - u_int32_t fraction; /* time in seconds / 2^32 */ + uint32_t fraction; /* time in seconds / 2^32 */ } NtpTime; #define NTPTIME_ZERO(t) {t.seconds=0;t.fraction=0;} #define NTPTIME_BUILD(t,s) {t.seconds=s;t.fraction=0;} #define NTPTIME_INFINITE(t) {t.seconds=0xffffffff;t.fraction=0;} -typedef u_int32_t IPAddress; +typedef uint32_t IPAddress; #define IPADDRESS_INVALID 0 -typedef u_int32_t Port; +typedef uint32_t Port; #define PORT_INVALID 0 @@ -206,8 +206,8 @@ typedef struct { #define PID_VALUE_RELIABILITY_BEST_EFFORTS 0x01 #define PID_VALUE_RELIABILITY_STRICT 0x02 -typedef u_int16_t ParameterId; -typedef u_int16_t ParameterLength; +typedef uint16_t ParameterId; +typedef uint16_t ParameterLength; /* State Machines */ typedef enum { diff --git a/orte/include/ul_listbase.h b/orte/include/ul_listbase.h index 0297d99..40d8858 100644 --- a/orte/include/ul_listbase.h +++ b/orte/include/ul_listbase.h @@ -13,6 +13,8 @@ extern "C" { #define LIST_POISON1 ((void *) 0) #define LIST_POISON2 ((void *) 0) +#undef LIST_HEAD + /* * Simple doubly linked list implementation. * diff --git a/orte/liborte/ORTEAppRecvMetatrafficThread.c b/orte/liborte/ORTEAppRecvMetatrafficThread.c index dcc116c..4b08ec5 100644 --- a/orte/liborte/ORTEAppRecvMetatrafficThread.c +++ b/orte/liborte/ORTEAppRecvMetatrafficThread.c @@ -24,7 +24,7 @@ /*****************************************************************************/ void ORTEAppRecvMetatrafficThread(ORTEDomain *d) { struct sockaddr_in des; - u_int16_t submsg_len; + uint16_t submsg_len; MessageInterpret mi; debug(22,10) ("ORTEAppRecvMetatrafficThread: start\n"); @@ -52,7 +52,7 @@ void ORTEAppRecvMetatrafficThread(ORTEDomain *d) { if ((d->mbRecvMetatraffic.cdrStream.bufferPtr- d->mbRecvMetatraffic.cdrStream.buffer+3)<=d->mbRecvMetatraffic.cdrStream.length) { char e_bit=d->mbRecvMetatraffic.cdrStream.bufferPtr[1] & 1; - submsg_len=*(u_int16_t*)&d->mbRecvMetatraffic.cdrStream.bufferPtr[2]; + submsg_len=*(uint16_t*)&d->mbRecvMetatraffic.cdrStream.bufferPtr[2]; conv_u16(&submsg_len,e_bit); // check if length of submessage OK if ((submsg_len+d->mbRecvMetatraffic.cdrStream.bufferPtr- diff --git a/orte/liborte/ORTEAppRecvUserdataThread.c b/orte/liborte/ORTEAppRecvUserdataThread.c index fde682b..167912e 100644 --- a/orte/liborte/ORTEAppRecvUserdataThread.c +++ b/orte/liborte/ORTEAppRecvUserdataThread.c @@ -24,7 +24,7 @@ /*****************************************************************************/ void ORTEAppRecvUserdataThread(ORTEDomain *d) { struct sockaddr_in des; - u_int16_t submsg_len; + uint16_t submsg_len; MessageInterpret mi; debug(23,10) ("ORTEAppRecvUserdataThread: start\n"); @@ -52,7 +52,7 @@ void ORTEAppRecvUserdataThread(ORTEDomain *d) { if ((d->mbRecvUserdata.cdrStream.bufferPtr- d->mbRecvUserdata.cdrStream.buffer+3)<=d->mbRecvUserdata.cdrStream.length) { char e_bit=d->mbRecvUserdata.cdrStream.bufferPtr[1] & 1; - submsg_len=*(u_int16_t*)&d->mbRecvUserdata.cdrStream.bufferPtr[2]; + submsg_len=*(uint16_t*)&d->mbRecvUserdata.cdrStream.bufferPtr[2]; conv_u16(&submsg_len,e_bit); // check if length of submessage OK if ((submsg_len+d->mbRecvUserdata.cdrStream.bufferPtr- diff --git a/orte/liborte/ORTEAppSendThread.c b/orte/liborte/ORTEAppSendThread.c index 8f5ae1a..5ce3b38 100644 --- a/orte/liborte/ORTEAppSendThread.c +++ b/orte/liborte/ORTEAppSendThread.c @@ -36,7 +36,7 @@ void ORTESendData(ORTEDomain *d,ObjectEntryAID *objectEntryAID,Boolean meta) { des.sin_family=AF_INET; des.sin_addr.s_addr = htonl(appParams->unicastIPAddressList[i]); if (meta) { - des.sin_port = htons((u_int16_t)appParams->metatrafficUnicastPort); + des.sin_port = htons((uint16_t)appParams->metatrafficUnicastPort); sock_sendto ( &d->taskSend.sock, d->mbSend.cdrStream.buffer, @@ -44,7 +44,7 @@ void ORTESendData(ORTEDomain *d,ObjectEntryAID *objectEntryAID,Boolean meta) { &des, sizeof(des)); } else { - des.sin_port = htons((u_int16_t)appParams->userdataUnicastPort); + des.sin_port = htons((uint16_t)appParams->userdataUnicastPort); if (d->mbSend.cdrStreamDirect) sock_sendto ( &d->taskSend.sock, @@ -93,9 +93,14 @@ void ORTEAppSendThread(ORTEDomain *d) { if (s<0) s=ms=0; debug(24,4) ("ORTEAppSendThread: sleeping for %lis %lims\n",s,ms); if (!((wtime.tv_sec==0) && (wtime.tv_nsec==0))) { - sem_timedwait( - &d->objectEntry.htimSendSem, - &wtime); + pthread_mutex_lock(&d->objectEntry.htimSendMutex); + if (d->objectEntry.htimSendCondValue==0) { + pthread_cond_timedwait(&d->objectEntry.htimSendCond, + &d->objectEntry.htimSendMutex, + &wtime); + } + d->objectEntry.htimSendCondValue=0; + pthread_mutex_unlock(&d->objectEntry.htimSendMutex); } debug(24,7) ("ORTEAppSendThread: fired\n"); actTime=getActualNtpTime(); diff --git a/orte/liborte/ORTEDomainApp.c b/orte/liborte/ORTEDomainApp.c index 87ec4ae..e244362 100644 --- a/orte/liborte/ORTEDomainApp.c +++ b/orte/liborte/ORTEDomainApp.c @@ -35,7 +35,7 @@ ORTEDomainAppCreate(int domain, ORTEDomainProp *prop, char sIPAddress[MAX_STRING_IPADDRESS_LENGTH]; char sbuff[128]; int i; - u_int16_t port=0; + uint16_t port=0; debug(21,10) ("ORTEDomainAppCreate: start\n"); //Create domainApplication @@ -54,7 +54,9 @@ ORTEDomainAppCreate(int domain, ORTEDomainProp *prop, pthread_rwlock_init(&d->objectEntry.objRootLock,NULL); htimerRoot_init_queue(&d->objectEntry); pthread_rwlock_init(&d->objectEntry.htimRootLock,NULL); - sem_init(&d->objectEntry.htimSendSem, 0, 0); + pthread_cond_init(&d->objectEntry.htimSendCond,NULL); + pthread_mutex_init(&d->objectEntry.htimSendMutex,NULL); + d->objectEntry.htimSendCondValue=0; //publication,subscriptions d->publications.counter=d->subscriptions.counter=0; CSTWriter_init_root_field(&d->publications); @@ -86,7 +88,7 @@ ORTEDomainAppCreate(int domain, ORTEDomainProp *prop, strcat(iflocal,IPAddressToString(d->domainProp.IFProp[i].ipAddress,sIPAddress)); debug(21,2) ("ORTEDomainAppCreate: localIPAddres(es) %s\n",iflocal); } else{ - debug(21,2) ("ORTEDomainAppCreate: no activ interface card\n"); + debug(21,2) ("ORTEDomainAppCreate: no active interface card\n"); } //DomainEvents @@ -98,11 +100,11 @@ ORTEDomainAppCreate(int domain, ORTEDomainProp *prop, //local buffers d->mbRecvMetatraffic.cdrStream.buffer= - (u_int8_t*)MALLOC(d->domainProp.recvBuffSize); + (uint8_t*)MALLOC(d->domainProp.recvBuffSize); d->mbRecvUserdata.cdrStream.buffer= - (u_int8_t*)MALLOC(d->domainProp.recvBuffSize); + (uint8_t*)MALLOC(d->domainProp.recvBuffSize); d->mbSend.cdrStream.buffer= - (u_int8_t*)MALLOC(d->domainProp.sendBuffSize); + (uint8_t*)MALLOC(d->domainProp.sendBuffSize); if ((!d->mbRecvMetatraffic.cdrStream.buffer) || (!d->mbRecvUserdata.cdrStream.buffer) || (!d->mbSend.cdrStream.buffer)) { //no memory @@ -365,8 +367,9 @@ ORTEDomainAppDestroy(ORTEDomain *d) { sock_cleanup(&d->taskRecvUserdata.sock); sock_cleanup(&d->taskSend.sock); - //Semas - sem_destroy(&d->objectEntry.htimSendSem); + //Signals + pthread_cond_destroy(&d->objectEntry.htimSendCond); + pthread_mutex_destroy(&d->objectEntry.htimSendMutex); //rwLocks pthread_rwlock_destroy(&d->objectEntry.objRootLock); diff --git a/orte/liborte/ORTEDomainMgr.c b/orte/liborte/ORTEDomainMgr.c index 4254dc8..26f6a0e 100644 --- a/orte/liborte/ORTEDomainMgr.c +++ b/orte/liborte/ORTEDomainMgr.c @@ -34,7 +34,7 @@ ORTEDomainMgrCreate(int domain, ORTEDomainProp *prop, char sIPAddress[MAX_STRING_IPADDRESS_LENGTH]; char sbuff[128]; int i; - u_int16_t port=0; + uint16_t port=0; debug(29,10) ("ORTEDomainMgrCreate: start\n"); //Create domainApplication @@ -51,7 +51,9 @@ ORTEDomainMgrCreate(int domain, ORTEDomainProp *prop, pthread_rwlock_init(&d->objectEntry.objRootLock,NULL); htimerRoot_init_queue(&d->objectEntry); pthread_rwlock_init(&d->objectEntry.htimRootLock,NULL); - sem_init(&d->objectEntry.htimSendSem, 0, 0); + pthread_cond_init(&d->objectEntry.htimSendCond,NULL); + pthread_mutex_init(&d->objectEntry.htimSendMutex,NULL); + d->objectEntry.htimSendCondValue=0; //create domainProp if (prop!=NULL) { @@ -67,7 +69,7 @@ ORTEDomainMgrCreate(int domain, ORTEDomainProp *prop, strcat(iflocal,IPAddressToString(d->domainProp.IFProp[i].ipAddress,sIPAddress)); debug(29,2) ("ORTEDomainMgrCreate: localIPAddres(es) %s\n",iflocal); } else{ - debug(29,2) ("ORTEDomainMgrCreate: no activ interface card\n"); + debug(29,2) ("ORTEDomainMgrCreate: no active interface card\n"); } //DomainEvents @@ -79,10 +81,10 @@ ORTEDomainMgrCreate(int domain, ORTEDomainProp *prop, //local buffers d->mbRecvMetatraffic.cdrStream.buffer= - (u_int8_t*)MALLOC(d->domainProp.recvBuffSize); + (uint8_t*)MALLOC(d->domainProp.recvBuffSize); d->mbRecvUserdata.cdrStream.buffer=NULL; d->mbSend.cdrStream.buffer= - (u_int8_t*)MALLOC(d->domainProp.sendBuffSize); + (uint8_t*)MALLOC(d->domainProp.sendBuffSize); if ((!d->mbRecvMetatraffic.cdrStream.buffer) || (!d->mbSend.cdrStream.buffer)) { //no memory FREE(d->mbRecvMetatraffic.cdrStream.buffer); @@ -314,8 +316,9 @@ ORTEDomainMgrDestroy(ORTEDomain *d) { sock_cleanup(&d->taskRecvMetatraffic.sock); sock_cleanup(&d->taskSend.sock); - //Semas - sem_destroy(&d->objectEntry.htimSendSem); + //Signals + pthread_cond_destroy(&d->objectEntry.htimSendCond); + pthread_mutex_destroy(&d->objectEntry.htimSendMutex); //rwLocks pthread_rwlock_destroy(&d->objectEntry.objRootLock); diff --git a/orte/liborte/ORTEPublication.c b/orte/liborte/ORTEPublication.c index 98918e4..236037f 100644 --- a/orte/liborte/ORTEPublication.c +++ b/orte/liborte/ORTEPublication.c @@ -188,7 +188,7 @@ int ORTEPublicationWaitForSubscriptions(ORTEPublication *cstWriter,NtpTime wait, unsigned int retries,unsigned int noSubscriptions) { unsigned int rSubscriptions; - u_int32_t sec,ms; + uint32_t sec,ms; if (!cstWriter) return ORTE_BAD_HANDLE; NtpTimeDisAssembToMs(sec,ms,wait); @@ -235,14 +235,21 @@ ORTEPublicationPrepareQueue(ORTEPublication *cstWriter) { if (!CSTWriterTryDestroyBestEffortIssue(cstWriter)) { NtpTime expire,atime=getActualNtpTime(); struct timespec wtime; - //Count max block time + //count max block time NtpTimeAdd(expire,atime,cstWriter->domain->domainProp.baseProp.maxBlockTime); NtpTimeDisAssembToUs(wtime.tv_sec,wtime.tv_nsec,expire); wtime.tv_nsec*=1000; //conver to nano seconds pthread_rwlock_unlock(&cstWriter->lock); - sem_timedwait( - &cstWriter->semCSChangeDestroyed, - &wtime); + //wait till a message will be processed + pthread_mutex_lock(&cstWriter->mutexCSChangeDestroyed); + if (cstWriter->condValueCSChangeDestroyed==0) { + pthread_cond_timedwait(&cstWriter->condCSChangeDestroyed, + &cstWriter->mutexCSChangeDestroyed, + &wtime); + } + cstWriter->condValueCSChangeDestroyed=0; + pthread_mutex_unlock(&cstWriter->mutexCSChangeDestroyed); + pthread_rwlock_wrlock(&cstWriter->lock); pp=(ORTEPublProp*)cstWriter->objectEntryOID->attributes; if (cstWriter->csChangesCounter>=pp->sendQueueSize) { @@ -273,7 +280,7 @@ ORTEPublicationSendLocked(ORTEPublication *cstWriter) { csChange->alive=ORTE_FALSE; csChange->cdrStream.length=RTPS_HEADER_LENGTH+12+ //HEADER+INFO_TS+ISSUE +20+cstWriter->typeRegister->getMaxSize; - csChange->cdrStream.buffer=(u_int8_t*)MALLOC(csChange->cdrStream.length); + csChange->cdrStream.buffer=(uint8_t*)MALLOC(csChange->cdrStream.length); csChange->cdrStream.bufferPtr=csChange->cdrStream.buffer+RTPS_HEADER_LENGTH+12+20; SeqNumberInc(snNext,cstWriter->lastSN); RTPSHeaderCreate(csChange->cdrStream.buffer, diff --git a/orte/liborte/ORTESubscription.c b/orte/liborte/ORTESubscription.c index 0886b64..5f0e041 100644 --- a/orte/liborte/ORTESubscription.c +++ b/orte/liborte/ORTESubscription.c @@ -181,7 +181,7 @@ int ORTESubscriptionWaitForPublications(ORTESubscription *cstReader,NtpTime wait, unsigned int retries,unsigned int noPublications) { unsigned int wPublications; - u_int32_t sec,ms; + uint32_t sec,ms; if (!cstReader) return ORTE_BAD_HANDLE; NtpTimeDisAssembToMs(sec,ms,wait); diff --git a/orte/liborte/ORTEThreadUtils.c b/orte/liborte/ORTEThreadUtils.c index 504ef05..5110fba 100644 --- a/orte/liborte/ORTEThreadUtils.c +++ b/orte/liborte/ORTEThreadUtils.c @@ -23,7 +23,7 @@ /*****************************************************************************/ void -ORTEDomainWakeUpReceivingThread(ORTEDomain *d,sock_t *sock,u_int16_t port) { +ORTEDomainWakeUpReceivingThread(ORTEDomain *d,sock_t *sock,uint16_t port) { struct sockaddr_in des; char sIPAddress[MAX_STRING_IPADDRESS_LENGTH]; int i; @@ -52,11 +52,13 @@ void ORTEDomainWakeUpSendingThread(ObjectEntry *objectEntry) { debug(25,10) ("WakeUpSendingThread : start\n"); if (objectEntry->htimNeedWakeUp) { - int value; - sem_getvalue(&objectEntry->htimSendSem,&value); - debug(25,8) ("WakeUpSendingThread : value:%d\n",value); - if (value<1) - sem_post(&objectEntry->htimSendSem); + pthread_mutex_lock(&objectEntry->htimSendMutex); + if (objectEntry->htimSendCondValue==0) { + debug(25,8) ("WakeUpSendingThread : send wakeup signal\n"); + pthread_cond_signal(&objectEntry->htimSendCond); + objectEntry->htimSendCondValue=1; + } + pthread_mutex_unlock(&objectEntry->htimSendMutex); } } diff --git a/orte/liborte/RTPSAck.c b/orte/liborte/RTPSAck.c index 12ce43e..a6d6133 100644 --- a/orte/liborte/RTPSAck.c +++ b/orte/liborte/RTPSAck.c @@ -23,13 +23,13 @@ /**********************************************************************************/ int32_t -RTPSAckCreate(u_int8_t *rtps_msg,u_int32_t max_msg_len, +RTPSAckCreate(uint8_t *rtps_msg,uint32_t max_msg_len, SequenceNumber *seqNumber, ObjectId roid,ObjectId woid,Boolean f_bit) { SequenceNumber sn_tmp; if (max_msg_len<28) return -1; - rtps_msg[0]=(u_int8_t)ACK; + rtps_msg[0]=(uint8_t)ACK; rtps_msg[1]=ORTE_MY_MBO; if (f_bit) rtps_msg[1]|=2; *((ParameterLength*)(rtps_msg+2))=24; @@ -39,14 +39,14 @@ RTPSAckCreate(u_int8_t *rtps_msg,u_int32_t max_msg_len, *((ObjectId*)(rtps_msg+8))=woid; SeqNumberInc(sn_tmp,*seqNumber); *((SequenceNumber*)(rtps_msg+12))=sn_tmp; - *((u_int32_t*)(rtps_msg+20))=32; - *((u_int32_t*)(rtps_msg+24))=0; + *((uint32_t*)(rtps_msg+20))=32; + *((uint32_t*)(rtps_msg+24))=0; return 28; } /**********************************************************************************/ void -RTPSAck(ORTEDomain *d,u_int8_t *rtps_msg,MessageInterpret *mi,IPAddress senderIPAddress) { +RTPSAck(ORTEDomain *d,uint8_t *rtps_msg,MessageInterpret *mi,IPAddress senderIPAddress) { GUID_RTPS readerGUID; CSTWriter *cstWriter=NULL; CSTRemoteReader *cstRemoteReader; diff --git a/orte/liborte/RTPSCSTWriter.c b/orte/liborte/RTPSCSTWriter.c index b7d6851..f055646 100644 --- a/orte/liborte/RTPSCSTWriter.c +++ b/orte/liborte/RTPSCSTWriter.c @@ -56,7 +56,9 @@ CSTWriterInit(ORTEDomain *d,CSTWriter *cstWriter,ObjectEntryOID *object, cstWriter->domain=d; cstWriter->typeRegister=typeRegister; if ((cstWriter->guid.oid & 0x07)==OID_PUBLICATION) { - sem_init(&cstWriter->semCSChangeDestroyed, 0, 0); + pthread_cond_init(&cstWriter->condCSChangeDestroyed,NULL); + pthread_mutex_init(&cstWriter->mutexCSChangeDestroyed,NULL); + cstWriter->condValueCSChangeDestroyed=0; } //add event for refresh if (NtpTimeCmp(cstWriter->params.refreshPeriod,iNtpTime)!=0) { @@ -95,7 +97,8 @@ CSTWriterDelete(ORTEDomain *d,CSTWriter *cstWriter) { &cstWriter->refreshPeriodTimer, 0); if ((cstWriter->guid.oid & 0x07)==OID_PUBLICATION) { - sem_destroy(&cstWriter->semCSChangeDestroyed); + pthread_cond_destroy(&cstWriter->condCSChangeDestroyed); + pthread_mutex_destroy(&cstWriter->mutexCSChangeDestroyed); } pthread_rwlock_destroy(&cstWriter->lock); debug(51,10) ("CSTWriterDelete: finished\n"); @@ -402,7 +405,10 @@ CSTWriterDestroyCSChangeForReader(CSTRemoteReader *cstRemoteReader, CSTWriterDestroyCSChange(cstRemoteReader->cstWriter->domain, cstRemoteReader->cstWriter,csChange); } - sem_post(&cstRemoteReader->cstWriter->semCSChangeDestroyed); + pthread_mutex_lock(&cstRemoteReader->cstWriter->mutexCSChangeDestroyed); + cstRemoteReader->cstWriter->condValueCSChangeDestroyed=1; + pthread_cond_signal(&cstRemoteReader->cstWriter->condCSChangeDestroyed); + pthread_mutex_unlock(&cstRemoteReader->cstWriter->mutexCSChangeDestroyed); debug(51,5) ("Publication: new queue level (%d)\n", cstRemoteReader->cstWriter->csChangesCounter); } diff --git a/orte/liborte/RTPSCSTWriterTimer.c b/orte/liborte/RTPSCSTWriterTimer.c index d791248..4d2e1ea 100644 --- a/orte/liborte/RTPSCSTWriterTimer.c +++ b/orte/liborte/RTPSCSTWriterTimer.c @@ -330,30 +330,30 @@ CSTWriterSendTimer(ORTEDomain *d,void *vcstRemoteReader) { cstRemoteReader->guid.hid, cstRemoteReader->guid.aid); len=32; - d->mbSend.cdrStream.bufferPtr[0]=(u_int8_t)VAR; + d->mbSend.cdrStream.bufferPtr[0]=(uint8_t)VAR; d->mbSend.cdrStream.bufferPtr[1]=ORTE_MY_MBO; if (csChangeForReader->csChange->alive) d->mbSend.cdrStream.bufferPtr[1]|=4; *((ObjectId*)(d->mbSend.cdrStream.bufferPtr+4))=OID_UNKNOWN; - conv_u32((u_int32_t*)(d->mbSend.cdrStream.bufferPtr+4),0); + conv_u32((uint32_t*)(d->mbSend.cdrStream.bufferPtr+4),0); *((ObjectId*)(d->mbSend.cdrStream.bufferPtr+8))= cstRemoteReader->cstWriter->guid.oid; - conv_u32((u_int32_t*)(d->mbSend.cdrStream.bufferPtr+8),0); + conv_u32((uint32_t*)(d->mbSend.cdrStream.bufferPtr+8),0); if (csChangeForReader->csChange->guid.oid==OID_APP) { d->mbSend.cdrStream.bufferPtr[1]|=8; *((HostId*)(d->mbSend.cdrStream.bufferPtr+12))= csChangeForReader->csChange->guid.hid; - conv_u32((u_int32_t*)(d->mbSend.cdrStream.bufferPtr+12),0); + conv_u32((uint32_t*)(d->mbSend.cdrStream.bufferPtr+12),0); *((AppId*)(d->mbSend.cdrStream.bufferPtr+16))= csChangeForReader->csChange->guid.aid; - conv_u32((u_int32_t*)(d->mbSend.cdrStream.bufferPtr+16),0); + conv_u32((uint32_t*)(d->mbSend.cdrStream.bufferPtr+16),0); } else { len-=8; off=-8; } *((ObjectId*)(d->mbSend.cdrStream.bufferPtr+20+off))= csChangeForReader->csChange->guid.oid; - conv_u32((u_int32_t*)(d->mbSend.cdrStream.bufferPtr+20+off),0); + conv_u32((uint32_t*)(d->mbSend.cdrStream.bufferPtr+20+off),0); *((SequenceNumber*)(d->mbSend.cdrStream.bufferPtr+24+off))= csChangeForReader->csChange->sn; if (!CSChangeAttributes_is_empty(csChangeForReader->csChange)) { @@ -373,13 +373,13 @@ CSTWriterSendTimer(ORTEDomain *d,void *vcstRemoteReader) { cstRemoteReader->guid.hid, cstRemoteReader->guid.aid); len=32; - d->mbSend.cdrStream.bufferPtr[0]=(u_int8_t)GAP; + d->mbSend.cdrStream.bufferPtr[0]=(uint8_t)GAP; d->mbSend.cdrStream.bufferPtr[1]=ORTE_MY_MBO; *((ObjectId*)(d->mbSend.cdrStream.bufferPtr+4))=OID_UNKNOWN; - conv_u32((u_int32_t*)(d->mbSend.cdrStream.bufferPtr+4),0); + conv_u32((uint32_t*)(d->mbSend.cdrStream.bufferPtr+4),0); *((ObjectId*)(d->mbSend.cdrStream.bufferPtr+8))= cstRemoteReader->cstWriter->guid.oid; - conv_u32((u_int32_t*)(d->mbSend.cdrStream.bufferPtr+8),0); + conv_u32((uint32_t*)(d->mbSend.cdrStream.bufferPtr+8),0); *((SequenceNumber*)(d->mbSend.cdrStream.bufferPtr+12))= csChangeForReader->csChange->sn; conv_sn((SequenceNumber*)(d->mbSend.cdrStream.bufferPtr+12),ORTE_MY_MBO); @@ -387,7 +387,7 @@ CSTWriterSendTimer(ORTEDomain *d,void *vcstRemoteReader) { csChangeForReader->csChange->sn, csChangeForReader->csChange->gapSN); conv_sn((SequenceNumber*)(d->mbSend.cdrStream.bufferPtr+20),ORTE_MY_MBO); - *((u_int32_t*)(d->mbSend.cdrStream.bufferPtr+28))=0; //NumBits + *((uint32_t*)(d->mbSend.cdrStream.bufferPtr+28))=0; //NumBits } *((ParameterLength*)(d->mbSend.cdrStream.bufferPtr+2))=len-4; d->mbSend.cdrStream.bufferPtr+=len; diff --git a/orte/liborte/RTPSGap.c b/orte/liborte/RTPSGap.c index 87db602..77ce65d 100644 --- a/orte/liborte/RTPSGap.c +++ b/orte/liborte/RTPSGap.c @@ -24,12 +24,12 @@ /*****************************************************************************/ void RTPSGapAdd(CSTRemoteWriter *cstRemoteWriter,GUID_RTPS *guid,SequenceNumber *fsn, - SequenceNumber *sn,u_int32_t numbits,u_int8_t *bitmaps,Boolean e_bit) { + SequenceNumber *sn,uint32_t numbits,uint8_t *bitmaps,Boolean e_bit) { SequenceNumber lsn,ssn; - u_int32_t i; + uint32_t i; int8_t bit,bit_last=0; CSChange *csChange; - u_int32_t bitmap; + uint32_t bitmap; if (SeqNumberCmp(*sn,cstRemoteWriter->sn)<0) return;//have to be sn>=writer_sn ! if (SeqNumberCmp(*fsn,*sn)==1) return; //cannot be fsn>sn ! @@ -52,7 +52,7 @@ RTPSGapAdd(CSTRemoteWriter *cstRemoteWriter,GUID_RTPS *guid,SequenceNumber *fsn, //second case of GAP sn lsn=ssn=*sn;bit=0; for(i=0;i0) { @@ -96,13 +96,13 @@ RTPSGapAdd(CSTRemoteWriter *cstRemoteWriter,GUID_RTPS *guid,SequenceNumber *fsn, /**********************************************************************************/ void -RTPSGap(ORTEDomain *d,u_int8_t *rtps_msg,MessageInterpret *mi,IPAddress senderIPAddress) { +RTPSGap(ORTEDomain *d,uint8_t *rtps_msg,MessageInterpret *mi,IPAddress senderIPAddress) { CSTReader *cstReader=NULL; CSTRemoteWriter *cstRemoteWriter; GUID_RTPS writerGUID; ObjectId roid,woid; SequenceNumber sn,fsn; - u_int32_t numbits; + uint32_t numbits; int8_t e_bit; e_bit=rtps_msg[1] & 0x01; @@ -114,7 +114,7 @@ RTPSGap(ORTEDomain *d,u_int8_t *rtps_msg,MessageInterpret *mi,IPAddress senderIP conv_sn(&fsn,e_bit); sn=*((SequenceNumber*)(rtps_msg+20)); /* Bitmap - SN */ conv_sn(&sn,e_bit); - numbits=*((u_int32_t*)(rtps_msg+28)); /* numbits */ + numbits=*((uint32_t*)(rtps_msg+28)); /* numbits */ conv_u32(&numbits,e_bit); writerGUID.hid=mi->sourceHostId; writerGUID.aid=mi->sourceAppId; diff --git a/orte/liborte/RTPSHeader.c b/orte/liborte/RTPSHeader.c index 62bed0e..1a035b3 100644 --- a/orte/liborte/RTPSHeader.c +++ b/orte/liborte/RTPSHeader.c @@ -23,7 +23,7 @@ /**********************************************************************************/ int16_t -RTPSHeaderCreate(u_int8_t *msg,HostId hid,AppId aid) { +RTPSHeaderCreate(uint8_t *msg,HostId hid,AppId aid) { msg[0]='R';msg[1]='T'; msg[2]='P'; msg[3]='S'; //Protocol version PROTOCOL_VERSION_1_0((*((ProtocolVersion*)(msg+4)))); @@ -39,7 +39,7 @@ RTPSHeaderCreate(u_int8_t *msg,HostId hid,AppId aid) { } /**********************************************************************************/ int16_t -RTPSHeaderCheck(u_int8_t *msg,int32_t len,MessageInterpret *mi) { +RTPSHeaderCheck(uint8_t *msg,int32_t len,MessageInterpret *mi) { if (len<16) return -1; /* message is too small */ if (msg[0]!='R') return -2; /* header is invalid */ if (msg[1]!='T') return -2; /* header is invalid */ diff --git a/orte/liborte/RTPSHeardBeat.c b/orte/liborte/RTPSHeardBeat.c index 4e40e26..f2baa84 100644 --- a/orte/liborte/RTPSHeardBeat.c +++ b/orte/liborte/RTPSHeardBeat.c @@ -23,11 +23,11 @@ /**********************************************************************************/ int -RTPSHeardBeatCreate(u_int8_t *rtps_msg,u_int32_t max_msg_len, +RTPSHeardBeatCreate(uint8_t *rtps_msg,uint32_t max_msg_len, SequenceNumber *firstSeqNumber,SequenceNumber *lastSeqNumber, ObjectId woid,ObjectId roid,Boolean f_bit) { if (max_msg_len<28) return -1; - rtps_msg[0]=(u_int8_t)HEARTBEAT; + rtps_msg[0]=(uint8_t)HEARTBEAT; rtps_msg[1]=ORTE_MY_MBO; if (f_bit) rtps_msg[1]|=2; *((ParameterLength*)(rtps_msg+2))=24; @@ -91,7 +91,7 @@ HeardBeatProc(CSTReader *cstReader,GUID_RTPS *writerGUID, /**********************************************************************************/ void -RTPSHeardBeat(ORTEDomain *d,u_int8_t *rtps_msg,MessageInterpret *mi) { +RTPSHeardBeat(ORTEDomain *d,uint8_t *rtps_msg,MessageInterpret *mi) { GUID_RTPS writerGUID; ObjectId roid,woid; SequenceNumber fsn,lsn; diff --git a/orte/liborte/RTPSInfoDST.c b/orte/liborte/RTPSInfoDST.c index d7cd8ff..b440e51 100644 --- a/orte/liborte/RTPSInfoDST.c +++ b/orte/liborte/RTPSInfoDST.c @@ -22,14 +22,14 @@ #include "orte.h" /**********************************************************************************/ -void RTPSInfoDST(u_int8_t *rtps_msg,MessageInterpret *mi) { +void RTPSInfoDST(uint8_t *rtps_msg,MessageInterpret *mi) { HostId hid; AppId aid; //parsing hid=*((HostId*)(rtps_msg+4)); /* HostId */ conv_u32(&hid,0); - aid=*((u_int32_t*)(rtps_msg+8)); /* AppId */ + aid=*((uint32_t*)(rtps_msg+8)); /* AppId */ conv_u32(&aid,0); debug(42,3) (" RTPSInfoDST:\n"); diff --git a/orte/liborte/RTPSInfoREPLY.c b/orte/liborte/RTPSInfoREPLY.c index f117f03..19a5900 100644 --- a/orte/liborte/RTPSInfoREPLY.c +++ b/orte/liborte/RTPSInfoREPLY.c @@ -23,11 +23,11 @@ /**********************************************************************************/ int32_t -RTPSInfoREPLYCreate(u_int8_t *rtps_msg,u_int32_t max_msg_len, +RTPSInfoREPLYCreate(uint8_t *rtps_msg,uint32_t max_msg_len, IPAddress ipaddress,Port port) { if (max_msg_len<12) return -1; - rtps_msg[0]=(u_int8_t)INFO_REPLY; + rtps_msg[0]=(uint8_t)INFO_REPLY; rtps_msg[1]=ORTE_MY_MBO; *((ParameterLength*)(rtps_msg+2))=8; *((ObjectId*)(rtps_msg+4))=ipaddress; @@ -37,7 +37,7 @@ RTPSInfoREPLYCreate(u_int8_t *rtps_msg,u_int32_t max_msg_len, /**********************************************************************************/ void -RTPSInfoREPLY(u_int8_t *rtps_msg,MessageInterpret *mi) { +RTPSInfoREPLY(uint8_t *rtps_msg,MessageInterpret *mi) { IPAddress ipa; Port port; int8_t e_bit; @@ -57,9 +57,9 @@ RTPSInfoREPLY(u_int8_t *rtps_msg,MessageInterpret *mi) { } mi->unicastReplyPort=port; if (rtps_msg[1] & 0x02) { - ipa=*((u_int32_t*)(rtps_msg+12)); /* multicastReplyIPAddress */ + ipa=*((uint32_t*)(rtps_msg+12)); /* multicastReplyIPAddress */ conv_u32(&ipa,e_bit); - port=*((u_int32_t*)(rtps_msg+16)); /* multicastReplyPort */ + port=*((uint32_t*)(rtps_msg+16)); /* multicastReplyPort */ conv_u32(&port,e_bit); mi->multicastReplyIPAddress=ipa; mi->multicastReplyPort=port; diff --git a/orte/liborte/RTPSInfoSRC.c b/orte/liborte/RTPSInfoSRC.c index 7f6b66f..e3e0fbd 100644 --- a/orte/liborte/RTPSInfoSRC.c +++ b/orte/liborte/RTPSInfoSRC.c @@ -22,7 +22,7 @@ #include "orte.h" /**********************************************************************************/ -void RTPSInfoSRC(u_int8_t *rtps_msg,MessageInterpret *mi) { +void RTPSInfoSRC(uint8_t *rtps_msg,MessageInterpret *mi) { IPAddress ipa; ProtocolVersion protocol; VendorId vid; diff --git a/orte/liborte/RTPSInfoTS.c b/orte/liborte/RTPSInfoTS.c index d8023c7..6562e54 100644 --- a/orte/liborte/RTPSInfoTS.c +++ b/orte/liborte/RTPSInfoTS.c @@ -23,9 +23,9 @@ /**********************************************************************************/ int32_t -RTPSInfoTSCreate(u_int8_t *rtps_msg,u_int32_t max_msg_len,NtpTime time) { +RTPSInfoTSCreate(uint8_t *rtps_msg,uint32_t max_msg_len,NtpTime time) { if (max_msg_len<12) return -1; - rtps_msg[0]=(u_int8_t)INFO_TS; + rtps_msg[0]=(uint8_t)INFO_TS; rtps_msg[1]=ORTE_MY_MBO; //I-bit = 0 *((ParameterLength*)(rtps_msg+2))=8; *((NtpTime*)(rtps_msg+4))=time; @@ -34,7 +34,7 @@ RTPSInfoTSCreate(u_int8_t *rtps_msg,u_int32_t max_msg_len,NtpTime time) { /**********************************************************************************/ void -RTPSInfoTS(u_int8_t *rtps_msg,MessageInterpret *mi) { +RTPSInfoTS(uint8_t *rtps_msg,MessageInterpret *mi) { int8_t e_bit=rtps_msg[1] & 0x01; char buff[MAX_STRING_NTPTIME_LENGTH]; diff --git a/orte/liborte/RTPSIssue.c b/orte/liborte/RTPSIssue.c index be025cf..bf120d1 100644 --- a/orte/liborte/RTPSIssue.c +++ b/orte/liborte/RTPSIssue.c @@ -22,13 +22,13 @@ #include "orte.h" /**********************************************************************************/ int32_t -RTPSIssueCreateHeader(u_int8_t *rtps_msg,u_int32_t max_msg_len,u_int32_t length, +RTPSIssueCreateHeader(uint8_t *rtps_msg,uint32_t max_msg_len,uint32_t length, ObjectId roid,ObjectId woid,SequenceNumber sn) { if (max_msg_len<20) return -1; - rtps_msg[0]=(u_int8_t)ISSUE; + rtps_msg[0]=(uint8_t)ISSUE; rtps_msg[1]=ORTE_MY_MBO; - *((ParameterLength*)(rtps_msg+2))=(u_int16_t)length; + *((ParameterLength*)(rtps_msg+2))=(uint16_t)length; conv_u32(&roid,0); *((ObjectId*)(rtps_msg+4))=roid; conv_u32(&woid,0); @@ -39,19 +39,19 @@ RTPSIssueCreateHeader(u_int8_t *rtps_msg,u_int32_t max_msg_len,u_int32_t length, /**********************************************************************************/ void -RTPSIssue(ORTEDomain *d,u_int8_t *rtps_msg,MessageInterpret *mi,IPAddress senderIPAddress) { +RTPSIssue(ORTEDomain *d,uint8_t *rtps_msg,MessageInterpret *mi,IPAddress senderIPAddress) { GUID_RTPS guid,writerGUID; ObjectId roid,woid; SequenceNumber sn,sn_tmp; int8_t e_bit,p_bit; - u_int16_t submsg_len; + uint16_t submsg_len; CSTReader *cstReader; CSTRemoteWriter *cstRemoteWriter; CSChange *csChange=NULL; e_bit=rtps_msg[1] & 0x01; p_bit=(rtps_msg[1] & 0x02)>>1; - submsg_len=*((u_int16_t*)(rtps_msg+2)); + submsg_len=*((uint16_t*)(rtps_msg+2)); conv_u16(&submsg_len,e_bit); roid=*((ObjectId*)(rtps_msg+4)); /* readerObjectId */ conv_u32(&roid,0); diff --git a/orte/liborte/RTPSPad.c b/orte/liborte/RTPSPad.c index 9647131..145b39e 100644 --- a/orte/liborte/RTPSPad.c +++ b/orte/liborte/RTPSPad.c @@ -22,7 +22,7 @@ #include "orte.h" /**********************************************************************************/ -void RTPSPad(u_int8_t *rtps_msg,MessageInterpret *mi) { +void RTPSPad(uint8_t *rtps_msg,MessageInterpret *mi) { //nothing to do debug(41,3) (" RTPSInfoPAD:\n"); diff --git a/orte/liborte/RTPSVar.c b/orte/liborte/RTPSVar.c index 974b116..900a3a0 100644 --- a/orte/liborte/RTPSVar.c +++ b/orte/liborte/RTPSVar.c @@ -26,12 +26,12 @@ void NewSubscriber(ORTEDomain *d,ObjectEntryOID *os); /**********************************************************************************/ void -RTPSVar(ORTEDomain *d,u_int8_t *rtps_msg,MessageInterpret *mi,IPAddress senderIPAddress) { +RTPSVar(ORTEDomain *d,uint8_t *rtps_msg,MessageInterpret *mi,IPAddress senderIPAddress) { GUID_RTPS objectGUID,writerGUID; ObjectId roid,woid; SequenceNumber sn; int8_t e_bit,p_bit,a_bit; - u_int16_t submsg_len; + uint16_t submsg_len; CSTReader *cstReader=NULL; CSTRemoteWriter *cstRemoteWriter=NULL; CSTRemoteReader *cstRemoteReader=NULL; @@ -42,7 +42,7 @@ RTPSVar(ORTEDomain *d,u_int8_t *rtps_msg,MessageInterpret *mi,IPAddress senderIP e_bit=rtps_msg[1] & 0x01; p_bit=(rtps_msg[1] & 0x02)>>1; a_bit=(rtps_msg[1] & 0x04)>>2; - submsg_len=*((u_int16_t*)(rtps_msg+2)); + submsg_len=*((uint16_t*)(rtps_msg+2)); conv_u16(&submsg_len,e_bit); roid=*((ObjectId*)(rtps_msg+4)); /* readerObjectId */ conv_u32(&roid,0); diff --git a/orte/liborte/conv.c b/orte/liborte/conv.c index 5f53fce..b5ace8f 100644 --- a/orte/liborte/conv.c +++ b/orte/liborte/conv.c @@ -27,7 +27,7 @@ #include "orte.h" /**********************************************************************************/ -void conv_u16(u_int16_t *x,char ef) { +void conv_u16(uint16_t *x,char ef) { #if WORDS_BIGENDIAN if(ef) *x=bswap_16(*x); #else @@ -36,7 +36,7 @@ void conv_u16(u_int16_t *x,char ef) { } /**********************************************************************************/ -void conv_u32(u_int32_t *x,char ef) { +void conv_u32(uint32_t *x,char ef) { #if WORDS_BIGENDIAN if(ef) *x=bswap_32(*x); #else @@ -93,8 +93,8 @@ getStringPart(char *string,char divChar,int *iterator,char *buff) { *dcp=0; //temporary end of string strcpy(buff,cp); *dcp=tcp; //restore value - if (dcp[0]!=0) (*iterator)=dcp-cp+1;//next value - else (*iterator)=dcp-cp; + if (dcp[0]!=0) (*iterator)+=dcp-cp+1;//next value + else (*iterator)=len; return 1; } return 0; diff --git a/orte/liborte/objectUtils.c b/orte/liborte/objectUtils.c index de262ee..8d8dc96 100644 --- a/orte/liborte/objectUtils.c +++ b/orte/liborte/objectUtils.c @@ -194,7 +194,7 @@ generateEvent(ORTEDomain *d,GUID_RTPS *guid,void *params,Boolean live) { Boolean getTypeApp(ORTEDomain *d,AppParams *ap,IPAddress senderIPAddress) { Boolean result=ORTE_FALSE; - u_int16_t i,j,k; + uint16_t i,j,k; //test if the app is MOM for (i=0;iappParams->managerKeyCount;i++) { diff --git a/orte/liborte/parameter.c b/orte/liborte/parameter.c index 06515ea..25be103 100644 --- a/orte/liborte/parameter.c +++ b/orte/liborte/parameter.c @@ -43,14 +43,14 @@ parameterDelete(CSChange *csChange) { /*****************************************************************************/ int parameterCodeStreamFromCSChange(CSChange *csChange, - u_int8_t *rtps_msg,u_int32_t max_msg_len) { + uint8_t *rtps_msg,uint32_t max_msg_len) { ParameterSequence *ps; int result=0; ul_list_for_each(CSChangeAttributes, csChange, ps) { - if (max_msg_len<(u_int32_t)(4+ps->parameterLength)) return -1; //no memory for copy + if (max_msg_len<(uint32_t)(4+ps->parameterLength)) return -1; //no memory for copy *((ParameterId*)rtps_msg)=ps->parameterID; *((ParameterLength*)(rtps_msg+2))=ps->parameterLength; if (ps->parameterLength>MAX_PARAMETER_LOCAL_LENGTH) { @@ -67,13 +67,13 @@ parameterCodeStreamFromCSChange(CSChange *csChange, /*****************************************************************************/ int -parameterDecodeStreamToCSChange(CSChange *csChange,u_int8_t *rtps_msg, - u_int16_t submsg_len,u_int8_t e_bit) { +parameterDecodeStreamToCSChange(CSChange *csChange,uint8_t *rtps_msg, + uint16_t submsg_len,uint8_t e_bit) { ParameterId parameterId; ParameterLength parameterLength; ParameterSequence *ps; - u_int16_t counter=0; - u_int8_t *rtps_msg_it=rtps_msg; + uint16_t counter=0; + uint8_t *rtps_msg_it=rtps_msg; CSChangeAttributes_init_head(csChange); //count number of parameters @@ -117,8 +117,8 @@ parameterDecodeStreamToCSChange(CSChange *csChange,u_int8_t *rtps_msg, case PID_RELIABILITY_OFFERED: case PID_RELIABILITY_REQUESTED: case PID_MANAGER_KEY: - *(u_int32_t*)ps->parameterLocal=*((u_int32_t*)(rtps_msg_it+4)); - conv_u32((u_int32_t*)ps->parameterLocal,e_bit); + *(uint32_t*)ps->parameterLocal=*((uint32_t*)(rtps_msg_it+4)); + conv_u32((uint32_t*)ps->parameterLocal,e_bit); break; //IPAddress case PID_MATATRAFFIC_MULTICAST_IPADDRESS: @@ -255,7 +255,7 @@ parameterUpdateCSChange( for (i=0;imanagerKeyCount;i++) { ps->parameterID=PID_MANAGER_KEY; ps->parameterLength=4; - *(u_int32_t*)ps->parameterLocal=ap->managerKeyList[i]; + *(uint32_t*)ps->parameterLocal=ap->managerKeyList[i]; ps->parameter=NULL; CSChangeAttributes_insert(csChange,ps); ps++; @@ -286,21 +286,21 @@ parameterUpdateCSChangeFromPublication(CSChange *csChange,ORTEPublProp *pp) { /* reliabitityOffered */ ps->parameterID=PID_RELIABILITY_OFFERED; ps->parameterLength=4; - *(u_int32_t*)ps->parameterLocal=pp->reliabilityOffered; + *(uint32_t*)ps->parameterLocal=pp->reliabilityOffered; ps->parameter=NULL; CSChangeAttributes_insert(csChange,ps); ps++; /* sendQueueSize */ ps->parameterID=PID_SEND_QUEUE_SIZE; ps->parameterLength=4; - *(u_int32_t*)ps->parameterLocal=pp->sendQueueSize; + *(uint32_t*)ps->parameterLocal=pp->sendQueueSize; ps->parameter=NULL; CSChangeAttributes_insert(csChange,ps); ps++; /* strength */ ps->parameterID=PID_STRENGTH; ps->parameterLength=4; - *(u_int32_t*)ps->parameterLocal=pp->strength; + *(uint32_t*)ps->parameterLocal=pp->strength; ps->parameter=NULL; CSChangeAttributes_insert(csChange,ps); ps++; @@ -308,16 +308,16 @@ parameterUpdateCSChangeFromPublication(CSChange *csChange,ORTEPublProp *pp) { ps->parameterID=PID_TOPIC; len=strlen(pp->topic); ps->parameter=(int8_t*)MALLOC(len+8); - *(u_int32_t*)ps->parameter=len+1; + *(uint32_t*)ps->parameter=len+1; strncpy((4+ps->parameter),pp->topic,len); - *(u_int32_t*)(ps->parameter+len+4)=0; + *(uint32_t*)(ps->parameter+len+4)=0; ps->parameterLength=len+8; CSChangeAttributes_insert(csChange,ps); ps++; /* typeCheckSum */ ps->parameterID=PID_TYPE_CHECKSUM; ps->parameterLength=4; - *(u_int32_t*)ps->parameterLocal=pp->typeChecksum; + *(uint32_t*)ps->parameterLocal=pp->typeChecksum; ps->parameter=NULL; CSChangeAttributes_insert(csChange,ps); ps++; @@ -325,9 +325,9 @@ parameterUpdateCSChangeFromPublication(CSChange *csChange,ORTEPublProp *pp) { ps->parameterID=PID_TYPE_NAME; len=strlen(pp->typeName); ps->parameter=(int8_t*)MALLOC(len+8); - *(u_int32_t*)ps->parameter=len+1; + *(uint32_t*)ps->parameter=len+1; strncpy((4+ps->parameter),pp->typeName,len); - *(u_int32_t*)(ps->parameter+len+4)=0; + *(uint32_t*)(ps->parameter+len+4)=0; ps->parameterLength=len+8; CSChangeAttributes_insert(csChange,ps); ps++; @@ -357,14 +357,14 @@ parameterUpdateCSChangeFromSubscription(CSChange *csChange,ORTESubsProp *sp) { /* receive queue size*/ ps->parameterID=PID_RECV_QUEUE_SIZE; ps->parameterLength=4; - *(u_int32_t*)ps->parameterLocal=sp->recvQueueSize; + *(uint32_t*)ps->parameterLocal=sp->recvQueueSize; ps->parameter=NULL; CSChangeAttributes_insert(csChange,ps); ps++; /* reliabitityRequested */ ps->parameterID=PID_RELIABILITY_REQUESTED; ps->parameterLength=4; - *(u_int32_t*)ps->parameterLocal=sp->reliabilityRequested; + *(uint32_t*)ps->parameterLocal=sp->reliabilityRequested; ps->parameter=NULL; CSChangeAttributes_insert(csChange,ps); ps++; @@ -372,16 +372,16 @@ parameterUpdateCSChangeFromSubscription(CSChange *csChange,ORTESubsProp *sp) { ps->parameterID=PID_TOPIC; len=strlen(sp->topic); ps->parameter=(int8_t*)MALLOC(len+8); - *(u_int32_t*)ps->parameter=len+1; + *(uint32_t*)ps->parameter=len+1; strncpy((4+ps->parameter),sp->topic,len); - *(u_int32_t*)(ps->parameter+len+4)=0; + *(uint32_t*)(ps->parameter+len+4)=0; ps->parameterLength=len+8; CSChangeAttributes_insert(csChange,ps); ps++; /* typeCheckSum */ ps->parameterID=PID_TYPE_CHECKSUM; ps->parameterLength=4; - *(u_int32_t*)ps->parameterLocal=sp->typeChecksum; + *(uint32_t*)ps->parameterLocal=sp->typeChecksum; ps->parameter=NULL; CSChangeAttributes_insert(csChange,ps); ps++; @@ -389,9 +389,9 @@ parameterUpdateCSChangeFromSubscription(CSChange *csChange,ORTESubsProp *sp) { ps->parameterID=PID_TYPE_NAME; len=strlen(sp->typeName); ps->parameter=(int8_t*)MALLOC(len+8); - *(u_int32_t*)ps->parameter=len+1; + *(uint32_t*)ps->parameter=len+1; strncpy((4+ps->parameter),sp->typeName,len); - *(u_int32_t*)(ps->parameter+len+4)=0; + *(uint32_t*)(ps->parameter+len+4)=0; ps->parameterLength=len+8; CSChangeAttributes_insert(csChange,ps); ps++; @@ -420,7 +420,7 @@ parameterUpdateApplication(CSChange *csChange,AppParams *ap) { break; case PID_MANAGER_KEY: ap->managerKeyList[ap->managerKeyCount]= - *(u_int32_t*)ps->parameterLocal; + *(uint32_t*)ps->parameterLocal; ap->managerKeyCount++; break; case PID_MATATRAFFIC_MULTICAST_IPADDRESS: @@ -508,10 +508,10 @@ parameterUpdateSubscription(CSChange *csChange,ORTESubsProp *sp) { sp->minimumSeparation=*(NtpTime*)&ps->parameterLocal; break; case PID_RECV_QUEUE_SIZE: - sp->recvQueueSize=*(u_int32_t*)&ps->parameterLocal; + sp->recvQueueSize=*(uint32_t*)&ps->parameterLocal; break; case PID_RELIABILITY_REQUESTED: - sp->reliabilityRequested=*(u_int32_t*)&ps->parameterLocal; + sp->reliabilityRequested=*(uint32_t*)&ps->parameterLocal; break; case PID_TOPIC: if (ps->parameterLength>MAX_PARAMETER_LOCAL_LENGTH) diff --git a/orte/liborte/sock.c b/orte/liborte/sock.c index 720e993..a54229d 100644 --- a/orte/liborte/sock.c +++ b/orte/liborte/sock.c @@ -84,7 +84,7 @@ sock_getsockopt(sock_t *sock,int optname,char *optval, int *optlen) { /*********************************************************************/ int -sock_bind(sock_t *sock,u_int16_t port) { +sock_bind(sock_t *sock,uint16_t port) { struct sockaddr_in name; int size; diff --git a/orte/manager/Makefile.am b/orte/manager/Makefile.am index 8176fb3..46bb39d 100644 --- a/orte/manager/Makefile.am +++ b/orte/manager/Makefile.am @@ -6,6 +6,9 @@ if CONFIG_ORTE_RT else bin_PROGRAMS = ortemanager ortemanager_SOURCES = ortemanager.c +if CONFIG_ORTE_WIN + ortemanager_SOURCES += service.c +endif if CONFIG_ORTE_MINGW win_libs= $(top_srcdir)/orte/contrib/win_pthread/libpthreadGC.a endif diff --git a/orte/manager/Makefile.in b/orte/manager/Makefile.in index b6f088e..c479ed3 100644 --- a/orte/manager/Makefile.in +++ b/orte/manager/Makefile.in @@ -36,6 +36,7 @@ NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ +@CONFIG_ORTE_RT_FALSE@@CONFIG_ORTE_WIN_TRUE@am__append_1 = service.c ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ @@ -172,7 +173,7 @@ target_vendor = @target_vendor@ @CONFIG_ORTE_RT_TRUE@rt_ortemanager_ko_SOURCES = ortemanager.c @CONFIG_ORTE_RT_TRUE@rt_ortemanager_ko_LINK = $(top_builddir)/modtool --link -o $@ @CONFIG_ORTE_RT_FALSE@bin_PROGRAMS = ortemanager -@CONFIG_ORTE_RT_FALSE@ortemanager_SOURCES = ortemanager.c +@CONFIG_ORTE_RT_FALSE@ortemanager_SOURCES = ortemanager.c $(am__append_1) @CONFIG_ORTE_MINGW_TRUE@@CONFIG_ORTE_RT_FALSE@win_libs = $(top_srcdir)/orte/contrib/win_pthread/libpthreadGC.a @CONFIG_ORTE_RT_FALSE@ortemanager_LDADD = ../liborte/liborte.a $(win_libs) subdir = orte/manager @@ -186,8 +187,11 @@ CONFIG_CLEAN_FILES = @CONFIG_ORTE_RT_FALSE@module_PROGRAMS = PROGRAMS = $(bin_PROGRAMS) $(module_PROGRAMS) -am__ortemanager_SOURCES_DIST = ortemanager.c -@CONFIG_ORTE_RT_FALSE@am_ortemanager_OBJECTS = ortemanager.$(OBJEXT) +am__ortemanager_SOURCES_DIST = ortemanager.c service.c +@CONFIG_ORTE_RT_FALSE@@CONFIG_ORTE_WIN_TRUE@am__objects_1 = \ +@CONFIG_ORTE_RT_FALSE@@CONFIG_ORTE_WIN_TRUE@ service.$(OBJEXT) +@CONFIG_ORTE_RT_FALSE@am_ortemanager_OBJECTS = ortemanager.$(OBJEXT) \ +@CONFIG_ORTE_RT_FALSE@ $(am__objects_1) ortemanager_OBJECTS = $(am_ortemanager_OBJECTS) @CONFIG_ORTE_MINGW_FALSE@@CONFIG_ORTE_RT_TRUE@ortemanager_DEPENDENCIES = @CONFIG_ORTE_MINGW_FALSE@@CONFIG_ORTE_RT_FALSE@ortemanager_DEPENDENCIES = \ @@ -209,7 +213,8 @@ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/orte/include depcomp = $(SHELL) $(top_srcdir)/admin/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/ortemanager.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/rt_ortemanager_ko-ortemanager.Po +@AMDEP_TRUE@ ./$(DEPDIR)/rt_ortemanager_ko-ortemanager.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/service.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -290,6 +295,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ortemanager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rt_ortemanager_ko-ortemanager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/service.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ diff --git a/orte/manager/mcvs/Makefile.msc b/orte/manager/mcvs/Makefile.msc index ae34d73..e02029a 100644 --- a/orte/manager/mcvs/Makefile.msc +++ b/orte/manager/mcvs/Makefile.msc @@ -17,13 +17,13 @@ CC= $(MSCDIR)\bin\cl LINK= $(MSCDIR)\bin\link LIBRARIAN= $(MSCDIR)\bin\lib -TARGETS=ORTEManager.exe +TARGETS=ortemanager.exe all : default default : $(TARGETS) -ORTEManager.exe: ..\ORTEManager.obj getopt.obj getopt_long.obj +ortemanager.exe: ..\service.obj ..\ortemanager.obj getopt.obj getopt_long.obj # --------------------------------------------------------------------- # Generic Compilation Rules @@ -36,7 +36,7 @@ ORTEManager.exe: ..\ORTEManager.obj getopt.obj getopt_long.obj $(CC) $(CFLAGS) $< -Fo$*.obj .obj.exe: - $(LINK) -out:$@ getopt.obj getopt_long.obj $(ORTELIB) $< $(LIBS) + $(LINK) -out:$@ ..\service.obj getopt.obj getopt_long.obj $(ORTELIB) $< $(LIBS) clean : del *.obj diff --git a/orte/manager/ortemanager.c b/orte/manager/ortemanager.c index d483e54..724f808 100644 --- a/orte/manager/ortemanager.c +++ b/orte/manager/ortemanager.c @@ -1,5 +1,5 @@ /* - * $Id: ORTEManager.c,v 0.0.0.1 2003/10/07 + * $Id: ortemanager.c,v 0.0.0.1 2003/10/07 * * DEBUG: section Manager * AUTHOR: Petr Smolik petr.smolik@wo.cz @@ -22,6 +22,15 @@ #include "orte.h" #ifndef CONFIG_ORTE_RT +//global variables +ORTEDomain *d; +ORTEDomainProp dp; +int32_t opt,domain=ORTE_DEFAULT_DOMAIN; +Boolean orteDaemon=ORTE_FALSE; +Boolean orteWinService=ORTE_FALSE; +ORTEDomainAppEvents *events=NULL; + +//event system Boolean onMgrAppRemoteNew(const struct ORTEAppInfo *appInfo, void *param) { printf("%s 0x%x-0x%x was accepted\n", @@ -37,7 +46,28 @@ onMgrAppDelete(const struct ORTEAppInfo *appInfo, void *param) { appInfo->hostId,appInfo->appId); } +#ifdef _WIN32 +//Windows service support +void serviceDispatchTable(void); //forward declaration +void removeService(void); //forward declaration +void installService(void); //forward declaration +int managerInit(void) { + d=ORTEDomainMgrCreate(domain,&dp,events,ORTE_TRUE); + if (d==NULL) return -1; + return 0; +} +int managerStart(void) { + ORTEDomainStart(d,ORTE_TRUE,ORTE_FALSE,ORTE_TRUE); + return 0; +} +int managerStop(void) { + ORTEDomainMgrDestroy(d); + return 0; +} +#endif + #ifdef CONFIG_ORTE_UNIX +//Unix daemon support pthread_mutex_t mutex; void sig_usr(int signo) { if ((signo==SIGTERM) || (signo==SIGINT)) { @@ -51,7 +81,7 @@ void waitForEndingCommand(void) { signal(SIGINT,sig_usr); pthread_mutex_lock(&mutex); } -static int daemon_init(void) { +static int daemonInit(void) { pid_t pid; if ((pid = fork()) < 0) { @@ -71,7 +101,7 @@ static int daemon_init(void) { #endif static void usage(void) { - printf("usage: ORTEManager \n"); + printf("usage: ortemanager \n"); printf(" -p, --peer possible locations of fellow managers\n"); printf(" -k, --key manualy assigned manager's keys\n"); printf(" -d, --domain working manager domain\n"); @@ -87,10 +117,15 @@ static void usage(void) { printf(" -e, --events register event system\n"); printf(" -l, --logfile set log file name\n"); printf(" -V, --version show version\n"); +#ifdef _WIN32 + printf(" -i, --install_service install service into service manager on Windows\n"); + printf(" -r, --remove_service remove service from service manager on Windows\n"); +#endif printf(" -h, --help this usage screen\n"); } int main(int argc,char *argv[]) { +#if defined HAVE_GETOPT_LONG || defined HAVE_GETOPT_LONG_ORTE static struct option long_opts[] = { { "peer",1,0, 'p' }, { "key",1,0, 'k' }, @@ -105,19 +140,21 @@ int main(int argc,char *argv[]) { { "events",0,0, 'e' }, { "logfile",1,0, 'l' }, { "version",0,0, 'V' }, + { "install_service",0,0, 'i' }, + { "remove_service",0,0, 'r' }, { "help", 0, 0, 'h' }, { 0, 0, 0, 0} }; - ORTEDomain *d; - ORTEDomainProp dp; - int32_t opt,domain=ORTE_DEFAULT_DOMAIN; - Boolean daemon=ORTE_FALSE; - ORTEDomainAppEvents *events=NULL; +#endif ORTEInit(); ORTEDomainPropDefaultGet(&dp); - while ((opt = getopt_long(argc, argv, "k:p:d:v:R:E:P:l:VhDe",&long_opts[0], NULL)) != EOF) { +#if defined HAVE_GETOPT_LONG || defined HAVE_GETOPT_LONG_ORTE + while ((opt = getopt_long(argc, argv, "k:p:d:v:R:E:P:l:VhDesir",&long_opts[0], NULL)) != EOF) { +#else + while ((opt = getopt(argc, argv, "k:p:d:v:R:E:P:l:VhDesir")) != EOF) { +#endif switch (opt) { case 'p': dp.mgrs=strdup(optarg); @@ -156,22 +193,40 @@ int main(int argc,char *argv[]) { exit(0); break; case 'D': - daemon=ORTE_TRUE; + orteDaemon=ORTE_TRUE; + break; + #ifdef _WIN32 + case 's': + serviceDispatchTable(); + exit(0); break; + case 'i': + installService(); + orteWinService=ORTE_TRUE; + break; + case 'r': + removeService(); + exit(0); + break; + #endif case 'h': default: usage(); exit(opt == 'h' ? 0 : 1); } } - + + if (orteWinService) { + exit(0); + } + d=ORTEDomainMgrCreate(domain,&dp,events,ORTE_TRUE); if (!d) exit(1); #ifdef CONFIG_ORTE_UNIX - if (daemon) - daemon_init(); + if (orteDaemon) + daemonInit(); #endif ORTEDomainStart(d,ORTE_TRUE,ORTE_FALSE,ORTE_FALSE); diff --git a/orte/manager/service.c b/orte/manager/service.c new file mode 100644 index 0000000..82dcc73 --- /dev/null +++ b/orte/manager/service.c @@ -0,0 +1,213 @@ +#include "orte.h" + +HANDLE killServiceEvent = NULL; +static SERVICE_STATUS ssStatus; // current status of the service +static SERVICE_STATUS_HANDLE sshStatusHandle; +static DWORD dwErr = 0; +static char szErr[1024] = ""; + +char *name_service="ortemanager"; +char *name_service_disp="ortemanager"; + +int managerInit(void); //forward declaration +int managerStart(void); //forward declaration +int managerStop(void); //forward declaration + +static void AddToMessageLog(char *lpszMsg) { + char szMsg[2048]; + HANDLE hEventSource; + char * lpszStrings[2]; + + dwErr = GetLastError(); + hEventSource = RegisterEventSource(NULL, name_service); + sprintf(szMsg, "%s error: %li", name_service, dwErr); + lpszStrings[0] = szMsg; + lpszStrings[1] = lpszMsg; + if(hEventSource != NULL) { + ReportEvent(hEventSource, // handle of event source + EVENTLOG_ERROR_TYPE, // event type + 0, // event category + 0, // event ID + NULL, // current user's SID + 2, // strings in lpszStrings + 0, // no bytes of raw data + (LPCSTR*)lpszStrings, // array of error strings + NULL); // no raw data + DeregisterEventSource(hEventSource); + } +} + +BOOL ReportStatusToSCMgr(DWORD dwCurrentState,DWORD dwWin32ExitCode, + DWORD dwWaitHint) { + static DWORD dwCheckPoint = 1; + BOOL fResult = TRUE; + + if(dwCurrentState == SERVICE_START_PENDING) ssStatus.dwControlsAccepted = 0; + else ssStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP; + ssStatus.dwCurrentState = dwCurrentState; + ssStatus.dwWin32ExitCode = dwWin32ExitCode; + ssStatus.dwWaitHint = dwWaitHint; + if((dwCurrentState == SERVICE_RUNNING) || (dwCurrentState == SERVICE_STOPPED)) ssStatus.dwCheckPoint = 0; + else ssStatus.dwCheckPoint = dwCheckPoint++; + if(!(fResult = SetServiceStatus(sshStatusHandle, &ssStatus))) { + AddToMessageLog("SetServiceStatus"); + } + return fResult; +} + +void WINAPI service_ctrl(DWORD dwCtrlCode) { + switch(dwCtrlCode) { + case SERVICE_CONTROL_STOP: + ssStatus.dwCurrentState = SERVICE_STOP_PENDING; + managerStop(); + SetEvent(killServiceEvent); + break; + case SERVICE_CONTROL_INTERROGATE: + break; + default: + break; + } + ReportStatusToSCMgr(ssStatus.dwCurrentState, NO_ERROR, 0); +} + +void WINAPI service_main(DWORD dwArgc, char **lpszArgv) { + int err; + sshStatusHandle = RegisterServiceCtrlHandler(name_service, service_ctrl); + if(sshStatusHandle) { + ssStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; + ssStatus.dwServiceSpecificExitCode = 0; + killServiceEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); + if (!killServiceEvent) goto cleanup; + if(!ReportStatusToSCMgr(SERVICE_START_PENDING,NO_ERROR,3000)) goto cleanup; + err=managerInit(); + if (err<0) { + AddToMessageLog("Starting communication"); + dwErr=NO_ERROR; + goto cleanup; + } + managerStart(); + if(!ReportStatusToSCMgr(SERVICE_RUNNING,NO_ERROR, 0 )) goto cleanup; + WaitForSingleObject(killServiceEvent,INFINITE); + CloseHandle(killServiceEvent); + } +cleanup: + if(sshStatusHandle) { + ReportStatusToSCMgr(SERVICE_STOP_PENDING,dwErr,0); + ReportStatusToSCMgr(SERVICE_STOPPED,dwErr,0); + } +} + +void serviceDispatchTable(void) { + SERVICE_TABLE_ENTRY dispatchTable[] = { + { name_service, (LPSERVICE_MAIN_FUNCTION)service_main }, + { NULL, NULL } + }; + if(!StartServiceCtrlDispatcher(dispatchTable)) { + AddToMessageLog("StartServiceCtrlDispatcher failed."); + } +} + +char *GetLastErrorText( char *lpszBuf, DWORD dwSize ) { + DWORD dwRet; + char *lpszTemp = NULL; + + dwRet = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_ARGUMENT_ARRAY, + NULL, + GetLastError(), + LANG_NEUTRAL, + (char *)&lpszTemp, + 0, + NULL); + // supplied buffer is not long enough + if(!dwRet || ((long)dwSize < (long)dwRet+14)) { + lpszBuf[0] = '\0'; + } else { + lpszTemp[lstrlen(lpszTemp)-2] = '\0'; //remove cr and newline character + sprintf(lpszBuf, "%s (%li)", lpszTemp, GetLastError()); + } + if(lpszTemp) LocalFree((HLOCAL) lpszTemp ); + return lpszBuf; +} + +void installService(void) { + SC_HANDLE schService; + SC_HANDLE schSCManager; + TCHAR szPath[512]; + + if(GetModuleFileName( NULL, szPath, sizeof(szPath) - 1) == 0) { + printf("Unable to install %s - %s\n", + name_service, + GetLastErrorText(szErr, sizeof(szErr))); + return; + } + strcat(szPath," -s"); + schSCManager = OpenSCManager(NULL, // machine (NULL == local) + NULL, // database (NULL == default) + SC_MANAGER_ALL_ACCESS); // access required + if(schSCManager) { + schService = CreateService(schSCManager, // SCManager database + name_service, // name of service + name_service_disp, // name to display + SERVICE_ALL_ACCESS, // desired access + SERVICE_WIN32_OWN_PROCESS, // service type + SERVICE_AUTO_START, // start type + SERVICE_ERROR_NORMAL, // error control type + szPath, // service's binary + NULL, // no load ordering group + NULL, // no tag identifier + NULL, // dependencies + NULL, // LocalSystem account + NULL); // no password + if(schService) { + CloseServiceHandle(schSCManager); + printf("Service name (%s) instaled!\n",name_service); + } else { + printf("OpenSCManager failed - %s\n", GetLastErrorText(szErr, sizeof(szErr))); + } + } +} + +void removeService(void) { + SC_HANDLE schService; + SC_HANDLE schSCManager; + + schSCManager = OpenSCManager(NULL, // machine (NULL == local) + NULL, // database (NULL == default) + SC_MANAGER_ALL_ACCESS ); // access required + if(schSCManager) { + schService = OpenService(schSCManager, name_service, SERVICE_ALL_ACCESS); + if(schService) { + // try to stop the service + if(ControlService( schService, SERVICE_CONTROL_STOP, &ssStatus )) { + printf("Stopping %s.", name_service); + Sleep(100); + while(QueryServiceStatus(schService, &ssStatus )) { + if(ssStatus.dwCurrentState == SERVICE_STOP_PENDING) { + printf("."); + Sleep(100); + } else { + break; + } + } + if(ssStatus.dwCurrentState == SERVICE_STOPPED) { + printf("\n%s stopped.\n", name_service); + } else { + printf("\n%s failed to stop.\n", name_service); + } + } + // now remove the service + if(DeleteService(schService)) { + printf("%s removed.\n", name_service); + } else { + printf("DeleteService failed - %s\n", GetLastErrorText(szErr, sizeof(szErr))); + } + CloseServiceHandle(schService); + } else { + printf("OpenService failed - %s\n", GetLastErrorText(szErr, sizeof(szErr))); + } + CloseServiceHandle(schSCManager); + } else { + printf("OpenSCManager failed - %s\n", GetLastErrorText(szErr, sizeof(szErr))); + } +} + diff --git a/readme b/readme index 9cbadac..1a6929e 100644 --- a/readme +++ b/readme @@ -8,11 +8,15 @@ RTPS is new application layer protocol targeted to real-time communication area, which is build on top of standard UDP stack. Which targets are supported by ORTE? --------------------------- -Linux +----------------------------------- +UNIX - Linux, Solars, MacOS Windows - MinGW, CygWin, MSVC -RTLinux -RTAI - RTNet +RTLinux - with preliminary UDP stack +RTAI - with RTNet + +note: was tested on +sparc-sun-solaris2.9 +powerpc-apple-darwin6.8 How to install it? ------------------ -- 2.39.2