+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
#! /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 <petr.smolik@wo.cz>.
#
# 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'
# 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]...
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
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.
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 $@
# Define the identity of the package.
PACKAGE=orte
- VERSION=0.2.1
+ VERSION=0.2.2
cat >>confdefs.h <<_ACEOF
# 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
#define CONFIG_ORTE_MINGW 1
_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_GETPOT_LONG_ORTE 1
+_ACEOF
+
;;
*)
# Assume Unix.
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
###############################
+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 <sys/types.h>
+ #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
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
+#ifdef HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #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 <sys/types.h>
+ #endif
+ #ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+ #endif
#include <$ac_header>
_ACEOF
-
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`
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
} >&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
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'`\\"
# 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
# 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)
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.
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
###############################
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 <sys/types.h>
+ #endif])
+ AC_CHECK_HEADERS([netinet/in.h], [], [],
+ [#ifdef HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif])
+ AC_CHECK_HEADERS([net/if.h], [], [],
+ [#ifdef HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif
+ #ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+ #endif])
fi
# win32
if test ${WIN} == 'yes' ; then
# 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
# 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
/**********************************************************************************/
-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
/**********************************************************************************/
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;
}
/**********************************************************************************/
-void print_app(u_int8_t app) {
+void print_app(uint8_t app) {
switch (app) {
case MANAGEDAPPLICATION:
fprintf(ptr_out,"(managed application)\n");
}
/**********************************************************************************/
-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)));
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;
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;
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",
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));
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",
/**********************************************************************************/
-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 */
}
/**********************************************************************************/
-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;
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);
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;
}
// 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;
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<msg[ptr+20]/8;) {
for(j=128;j!=0;j>>=1) fprintf(ptr_out,"%d",(msg[ptr+24+i] & j) ? 1:0);
fprintf(ptr_out," ");
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);
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");
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;
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");
/**********************************************************************************/
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;
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;
}
}
}
/****************************************************************************
-** $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.
**
/****************************************************************************
-** $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.
**
#include <stdio.h>
#include <stdlib.h>
-#include <getopt.h>
#ifndef _WIN32
#include <signal.h>
#endif
#include "orte_api.h"
+#ifdef HAVE_CONFIG_H
+ #ifdef HAVE_GETOPT_H
+ #include <getopt.h>
+ #endif
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h> //getopt.h for DarWin, Solaris, ...
+ #endif
+#else
+ #include <getopt.h>
+#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:
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:
}
static void usage(void) {
- printf("usage: ORTEPing <parameters> \n");
+ printf("usage: orteping <parameters> \n");
printf(" -d, --domain <domain> working manager domain\n");
printf(" -p, --publisher create publisher Ping,PingData\n");
printf(" -S, --strength strength of publisher <1>\n");
printf(" -E, --expiration <s> expiration time of application\n");
printf(" -m, --minimumSeparation <s> minimumSeparation between two issues\n");
printf(" -v, --verbosity <level> 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 <filename> set log file name\n");
printf(" -V, --version show version\n");
}
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' },
{ "help", 0, 0, 'h' },
{ 0, 0, 0, 0}
};
+#endif
ORTEDomain *d;
ORTEDomainProp dp;
ORTEPublication *p=NULL;
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);
#include <stdio.h>
#include <stdlib.h>
-#include <getopt.h>
#ifndef _WIN32
#include <signal.h>
#endif
#include "orte_api.h"
-
+#ifdef HAVE_CONFIG_H
+ #ifdef HAVE_GETOPT_H
+ #include <getopt.h>
+ #endif
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h> //getopt.h for DarWin, Solaris, ...
+ #endif
+#else
+ #include <getopt.h>
+#endif
#include "string.h"
ORTEDomain *d;
}
static void usage(void) {
- printf("usage: ORTESpy <parameters> \n");
+ printf("usage: ortespy <parameters> \n");
printf(" -d, --domain <domain> working manager domain\n");
printf(" -v, --verbosity <level> 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 <s> refresh period in second(s)\n");
printf(" -P, --purge <s> purge time in second(s)\n");
printf(" -e, --expiration <s> expiration time of manager in second(s)\n");
}
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' },
{ "help", 0, 0, 'h' },
{ 0, 0, 0, 0}
};
+#endif
ORTEDomainProp dp;
int opt,domain=ORTE_DEFAULT_DOMAIN;
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);
/* Define to 1 if you have the <getopt.h> 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
/* Define to 1 if you have the <rtnet.h> header file. */
#undef HAVE_RTNET_H
-/* Define to 1 if you have the <semaphore.h> header file. */
-#undef HAVE_SEMAPHORE_H
-
/* Define to 1 if you have the <signal.h> header file. */
#undef HAVE_SIGNAL_H
/* Define to 1 if you have the <stdarg.h> header file. */
#undef HAVE_STDARG_H
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
+/* Define to 1 if you have the <sys/sockio.h> header file. */
+#undef HAVE_SYS_SOCKIO_H
+
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
//////////////////////////////////////////////////////////////////////////////
// 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))
*
* res = sn + 1
*/
- #define SeqNumberInc(res,sn) { \
+#define SeqNumberInc(res,sn) { \
(res) = (sn); \
if (++(res).low==0) (res).high++; \
}
*
* 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) || \
* @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); \
}
* @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); \
}
* @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) - \
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
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
-#ifdef HAVE_NETINET_IN_H
- #include <netinet/in.h>
-#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
-#ifdef HAVE_SYS_SOCKET_H
- #include <sys/socket.h>
-#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#endif
-#ifdef HAVE_STDARG_H
- #include <stdarg.h>
-#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef HAVE_NET_IF_H
- #include <net/if.h>
+#ifdef HAVE_SYS_SOCKIO_H
+ #include <sys/sockio.h>
+#endif
+#ifdef HAVE_STDARG_H
+ #include <stdarg.h>
#endif
#ifdef HAVE_BYTESWAP_H
#include <byteswap.h>
#endif
-#ifdef HAVE_CTYPE_H
- #include <ctype.h>
-#endif
-#ifdef HAVE_SEMAPHORE_H
- #include <semaphore.h>
-#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
+#ifdef HAVE_CTYPE_H
+ #include <ctype.h>
+#endif
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
+#ifdef HAVE_STDINT_H
+ #include <stdint.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+ #include <netinet/in.h>
+#endif
+#ifdef HAVE_NET_IF_H
+ #include <net/if.h>
+#endif
//win32 headers
#if defined HAVE_WINSOCK2_H && !HAVE_SYS_SOCKET_H
#include <winsock2.h>
#elif CONFIG_ORTE_MINGW
#define SOCK_WIN
#include <win32/pthread.h>
- #include <win32/semaphore.h>
#include <win32/timeval.h>
#ifndef __GETOPT_H__ //mingw
#include <win32/getopt.h>
#include <ws2tcpip.h>
#include <windows.h>
#include <win32/pthread.h>
- #include <win32/semaphore.h>
#include <win32/timeval.h>
#include <win32/getopt.h>
#include <ew_types.h>
#define ioctl ioctlsocket
- #define ORTE_PACKAGE_STRING "orte 0.2.1"
+ #define ORTE_PACKAGE_STRING "orte 0.2.2"
#endif
#ifdef __cplusplus
#include "orte_config_omk_rtl.h"
#endif
-#ifdef HAVE_SYS_TYPES_H
+#ifdef HAVE_STDINT_H
+ #include <stdint.h>
+#elif defined HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_LINUX_TYPES_H
/* Define to 1 if you have the <rtnet.h> header file. */
/* #undef HAVE_RTNET_H */
-/* Define to 1 if you have the <semaphore.h> header file. */
-#define HAVE_SEMAPHORE_H 1
-
/* Define to 1 if you have the <signal.h> header file. */
/* #undef HAVE_SIGNAL_H */
#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). */
/* 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 */
/* Define to 1 if you have the <getopt.h> 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 */
/* Define to 1 if you have the <rtnet.h> header file. */
/* #undef HAVE_RTNET_H */
-/* Define to 1 if you have the <semaphore.h> header file. */
-#define HAVE_SEMAPHORE_H 1
-
/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
/* Define to 1 if you have the <stdarg.h> header file. */
#define HAVE_STDARG_H 1
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
/* Define to 1 if you have the <stdio.h> header file. */
#define HAVE_STDIO_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
+/* Define to 1 if you have the <sys/sockio.h> header file. */
+/* #undef HAVE_SYS_SOCKIO_H */
+
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
#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). */
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
///////////////////////////////////////////////////////////////////////////////
// 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
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);
///////////////////////////////////////////////////////////////////////////////
// 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);
///////////////////////////////////////////////////////////////////////////////
// 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
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 */
*/
typedef struct sock_t {
int fd;
- u_int16_t port;
+ uint16_t port;
} sock_t;
/**
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;
};
//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;
};
/**
struct CSTPublications {
gavl_cust_root_field_t cstWriter;
pthread_rwlock_t lock;
- u_int32_t counter;
+ uint32_t counter;
};
/**
struct CSTSubscriptions {
gavl_cust_root_field_t cstReader;
pthread_rwlock_t lock;
- u_int32_t counter;
+ uint32_t counter;
};
/**
* 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
* 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;
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;
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;
/**
for example: IP address working nodes
*/
-typedef u_int32_t HostId;
+typedef uint32_t HostId;
#define HID_UNKNOWN 0x00
/**
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
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
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
#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 {
#define LIST_POISON1 ((void *) 0)
#define LIST_POISON2 ((void *) 0)
+#undef LIST_HEAD
+
/*
* Simple doubly linked list implementation.
*
/*****************************************************************************/
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");
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-
/*****************************************************************************/
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");
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-
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,
&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,
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();
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
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);
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
//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
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);
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
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) {
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
//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);
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);
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);
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) {
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,
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);
/*****************************************************************************/
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;
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);
}
}
/**********************************************************************************/
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;
*((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;
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) {
&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");
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);
}
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)) {
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);
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;
/*****************************************************************************/
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 !
//second case of GAP sn
lsn=ssn=*sn;bit=0;
for(i=0;i<numbits;i++) {
- bitmap=*(((u_int32_t*)bitmaps)+i/32);
+ bitmap=*(((uint32_t*)bitmaps)+i/32);
conv_u32(&bitmap,e_bit);
bit=(bitmap & (1<<(31-i%32))) ? 1:0;
if (i>0) {
/**********************************************************************************/
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;
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;
/**********************************************************************************/
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))));
}
/**********************************************************************************/
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 */
/**********************************************************************************/
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;
/**********************************************************************************/
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;
#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");
/**********************************************************************************/
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;
/**********************************************************************************/
void
-RTPSInfoREPLY(u_int8_t *rtps_msg,MessageInterpret *mi) {
+RTPSInfoREPLY(uint8_t *rtps_msg,MessageInterpret *mi) {
IPAddress ipa;
Port port;
int8_t e_bit;
}
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;
#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;
/**********************************************************************************/
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;
/**********************************************************************************/
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];
#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);
/**********************************************************************************/
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);
#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");
/**********************************************************************************/
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;
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);
#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
}
/**********************************************************************************/
-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
*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;
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;i<d->appParams->managerKeyCount;i++) {
/*****************************************************************************/
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) {
/*****************************************************************************/
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
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:
for (i=0;i<ap->managerKeyCount;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++;
/* 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++;
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++;
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++;
/* 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++;
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++;
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++;
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:
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)
/*********************************************************************/
int
-sock_bind(sock_t *sock,u_int16_t port) {
+sock_bind(sock_t *sock,uint16_t port) {
struct sockaddr_in name;
int size;
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
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@
@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
@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 = \
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)
@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" \
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
$(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
/*
- * $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
#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",
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)) {
signal(SIGINT,sig_usr);
pthread_mutex_lock(&mutex);
}
-static int daemon_init(void) {
+static int daemonInit(void) {
pid_t pid;
if ((pid = fork()) < 0) {
#endif
static void usage(void) {
- printf("usage: ORTEManager <parameters> \n");
+ printf("usage: ortemanager <parameters> \n");
printf(" -p, --peer <IPAdd:IPAdd:...> possible locations of fellow managers\n");
printf(" -k, --key <IPAdd:IPAdd:...> manualy assigned manager's keys\n");
printf(" -d, --domain <domain> working manager domain\n");
printf(" -e, --events register event system\n");
printf(" -l, --logfile <filename> 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' },
{ "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);
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);
--- /dev/null
+#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)));
+ }
+}
+
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?
------------------