diff -urN tsp_orig/CMakeLists.txt tsp_modified/CMakeLists.txt
--- tsp_orig/CMakeLists.txt	2007-05-01 23:13:17.000000000 +0200
+++ tsp_modified/CMakeLists.txt	2009-01-12 17:16:14.000000000 +0100
@@ -54,6 +54,14 @@
     "Build libraries as shared library" ON)
 ENDIF (WIN32)
 
+IF(CMAKE_SYSTEM_NAME STREQUAL "VxWorks")
+	SET(BUILD_VXWORKS ON)
+	ADD_DEFINITIONS(-DVXWORKS)
+	SET(BUILD_CONSUMER OFF)
+	SET(BUILD_SHARED OFF)
+	SET(BUILD_SHARED_LIBS OFF)	
+ENDIF(CMAKE_SYSTEM_NAME STREQUAL "VxWorks")
+
 IF (NOT USE_XDR_LIB_ENCODING)
   ADD_DEFINITIONS(-DTSP_NO_XDR_ENCODE)
 ENDIF (NOT USE_XDR_LIB_ENCODING)
@@ -101,7 +109,6 @@
 ELSE (SOCKET_LIBRARY_HAS_CONNECT)
   SET(SOCKET_LIBRARY)
 ENDIF (SOCKET_LIBRARY_HAS_CONNECT)
-
 ################ PthreadWin32 Check ####################
 IF (BUILD_WIN32_PTHREADWIN32)
 	FIND_PACKAGE(PthreadWin32 REQUIRED)
@@ -143,6 +150,7 @@
 	ENDIF (HAS_GETHRTIME)
 	SET(PTHREAD_LIBRARY_NAME "pthread")
 	ADD_DEFINITIONS(-D_REENTRANT)
+	
 ENDIF (WIN32)
 
 INCLUDE_DIRECTORIES(
@@ -159,10 +167,15 @@
   ${CMAKE_SOURCE_DIR}/src/core/ctrl_init
   ${CMAKE_SOURCE_DIR}/src/core/ctrl
   ${CMAKE_SOURCE_DIR}/src/util/libtspcfg
+  ${CMAKE_SOURCE_DIR}/src/util/libcalc
   )
 
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/core/rpc) 
 
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/core/rpc)  
+IF(BUILD_VXWORKS)
+  INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/external/VxWorks/posix/h)
+ENDIF(BUILD_VXWORKS)
+ 
 IF (BUILD_XMLRPC)
   INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/core/xmlrpc)
 ENDIF (BUILD_XMLRPC)
diff -urN tsp_orig/CMakeLists.txt~ tsp_modified/CMakeLists.txt~
--- tsp_orig/CMakeLists.txt~	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/CMakeLists.txt~	2009-01-12 17:26:07.000000000 +0100
@@ -0,0 +1,529 @@
+PROJECT(TSP C)
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.4.4)
+
+# May be used to print extensive system informations
+#INCLUDE(CMakePrintSystemInformation)
+
+# Use TSP specific CMake modules first
+SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/make)
+# Load TSP Specific CMake macros (TSP_XSCRIPT, TSP_XINCLUDE, TSP_xxx_INSTALL)
+INCLUDE(TSPCMakeTools)
+
+#INCLUDE_DIRECTORIES(/usr/include)
+#INCLUDE_DIRECTORIES(/usr/local/include)
+# Load Checker macros
+INCLUDE(CheckFunctionExists)
+INCLUDE(CheckLibraryExists)
+
+#INCLUDE(TestBigEndian)
+#TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
+#MESSAGE(STATUS "IS_BIG_ENDIAN is : ${IS_BIG_ENDIAN}")
+
+OPTION(BUILD_ONLY_TSP_PORT
+  "Build TSP test port" OFF)
+
+OPTION(BUILD_PROVIDER
+  "Build providers" ON)
+
+OPTION(BUILD_CONSUMER
+  "Build consumers" ON)
+
+OPTION(BUILD_XMLRPC
+  "Build with XMLRPC support" OFF)
+
+OPTION(BUILD_API_DOC
+  "Build doxygen documentation" OFF)
+
+
+OPTION(USE_XDR_LIB_ENCODING
+  "Use XDR library instead of TSP own XDR encoding"
+  OFF)
+
+OPTION(BUILD_BB_KERNEL_MODULE
+  "Build the Black Board kernel module" OFF)
+
+IF (WIN32)        
+  OPTION(BUILD_WIN32_PTHREADWIN32
+    "Build under Windows with PthreadWin32" ON)
+  
+  OPTION(BUILD_WIN32_ACPLT_ONCPRC
+    "Build under Windows with ACPLT_ONCPRC" ON)	
+  
+  OPTION(BUILD_SHARED
+    "Build libraries as DLL" ON)
+ELSE (WIN32)
+  OPTION(BUILD_SHARED
+    "Build libraries as shared library" ON)
+ENDIF (WIN32)
+
+IF(CMAKE_SYSTEM_NAME STREQUAL "VxWorks")
+	SET(BUILD_VXWORKS ON)
+	ADD_DEFINITIONS(-DVXWORKS)
+	SET(BUILD_CONSUMER OFF)
+	SET(BUILD_SHARED OFF)
+	SET(BUILD_SHARED_LIBS OFF)	
+ENDIF(CMAKE_SYSTEM_NAME STREQUAL "VxWorks")
+
+IF (NOT USE_XDR_LIB_ENCODING)
+  ADD_DEFINITIONS(-DTSP_NO_XDR_ENCODE)
+ENDIF (NOT USE_XDR_LIB_ENCODING)
+
+IF (BUILD_SHARED)
+  SET(BUILD_SHARED_LIBS ON)
+  IF (WIN32)
+    ADD_DEFINITIONS(-DTSP_SHARED_LIBS)
+  ENDIF (WIN32)
+ELSE (BUILD_SHARED)
+  SET(BUILD_SHARED_LIBS OFF)
+ENDIF (BUILD_SHARED)
+
+## If no build type specified then default to Debug
+IF (NOT CMAKE_BUILD_TYPE)
+ SET(CMAKE_BUILD_TYPE "Debug")
+ IF (CMAKE_COMPILER_IS_GNUCC)
+    ADD_DEFINITIONS(-Wall)
+ ENDIF (CMAKE_COMPILER_IS_GNUCC)
+ENDIF (NOT CMAKE_BUILD_TYPE)
+
+SET(PACKAGE_NAME      "tsp")
+SET(PACKAGE_VERSION_MAJOR "0")
+SET(PACKAGE_VERSION_MINOR "8")
+SET(PACKAGE_VERSION_PATCH "3")
+SET(PACKAGE_VERSION   "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}")
+SET(PACKAGE_BUGREPORT "tsp@astrium.eads.net")
+
+MESSAGE(STATUS "Configuring ${PACKAGE_NAME} version ${PACKAGE_VERSION}")
+
+################ Visual Studio (VC) Check ####################
+IF (WIN32)
+  SET(CMAKE_INSTALL_VS "C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7")
+  SET(TSP_WIN32_LIB TspWin32)
+  INCLUDE_DIRECTORIES(external/TspWin32)
+ELSE (WIN32)
+  SET(TSP_WIN32_LIB)
+ENDIF (WIN32)
+
+################ Socket library Check ####################
+CHECK_LIBRARY_EXISTS("socket" "connect" "/usr/lib" SOCKET_LIBRARY_HAS_CONNECT)
+IF (SOCKET_LIBRARY_HAS_CONNECT)
+  MESSAGE(STATUS "Socket library needed for system ${CMAKE_SYSTEM_NAME}")
+  SET(SOCKET_LIBRARY "socket")
+ELSE (SOCKET_LIBRARY_HAS_CONNECT)
+  SET(SOCKET_LIBRARY)
+ENDIF (SOCKET_LIBRARY_HAS_CONNECT)
+################ PthreadWin32 Check ####################
+IF (BUILD_WIN32_PTHREADWIN32)
+	FIND_PACKAGE(PthreadWin32 REQUIRED)
+	IF (PTHREADWIN32_FOUND)
+		LINK_DIRECTORIES(${PTHREADWIN32_LIBRARY_DIRS})
+		INCLUDE_DIRECTORIES(${PTHREADWIN32_INCLUDE_DIRS})		
+		GET_FILENAME_COMPONENT(PTHREAD_LIBRARY_NAME ${PTHREADWIN32_LIBRARY} NAME_WE)
+	ENDIF (PTHREADWIN32_FOUND)
+ENDIF (BUILD_WIN32_PTHREADWIN32)
+
+################ ACPLT_ONCRPC Check ####################
+IF (BUILD_WIN32_ACPLT_ONCPRC)
+	FIND_PACKAGE(ACPLT_ONCRPC)
+	IF (ACPLT_ONCRPC_FOUND)
+		LINK_DIRECTORIES(${ACPLT_ONCRPC_LIBRARY_DIRS})
+		INCLUDE_DIRECTORIES(${ACPLT_ONCRPC_INCLUDE_DIRS})
+	ENDIF (ACPLT_ONCRPC_FOUND)
+	FIND_PACKAGE(ONCRPC)
+ELSE (BUILD_WIN32_ACPLT_ONCPRC)
+  FIND_PACKAGE(ONCRPC)
+ENDIF (BUILD_WIN32_ACPLT_ONCPRC)
+
+IF (WIN32)	
+	ADD_DEFINITIONS(-DTSP_SYSTEM_USE_WIN32_SLEEP)
+ELSE (WIN32)
+	CHECK_FUNCTION_EXISTS(nanosleep HAS_NANOSLEEP)
+	IF(HAS_NANOSLEEP)
+		ADD_DEFINITIONS(-DTSP_SYSTEM_HAVE_NANOSLEEP)
+	ELSE (HAS_NANOSLEEP)
+		CHECK_FUNCTION_EXISTS(usleep HAS_THREADSAFE_USLEEP)
+		IF (HAS_THREADSAFE_USLEEP)
+			ADD_DEFINITIONS(-DTSP_SYSTEM_HAVE_THREADSAFE_USLEEP)
+		ENDIF (HAS_THREADSAFE_USLEEP)
+	ENDIF(HAS_NANOSLEEP)
+			
+	CHECK_FUNCTION_EXISTS(gethrtime HAS_GETHRTIME)
+	IF(HAS_GETHRTIME)
+		ADD_DEFINITIONS(-DTSP_SYSTEM_HAVE_GETHRTIME)
+	ENDIF (HAS_GETHRTIME)
+	SET(PTHREAD_LIBRARY_NAME "pthread")
+	ADD_DEFINITIONS(-D_REENTRANT)
+	
+ENDIF (WIN32)
+
+INCLUDE_DIRECTORIES(
+  ${CMAKE_BINARY_DIR}/src/core/include
+  ${CMAKE_BINARY_DIR}/src/core
+  ${CMAKE_BINARY_DIR}/src/core/rpc
+  ${CMAKE_SOURCE_DIR}/src/core/include
+  ${CMAKE_SOURCE_DIR}/src/core/
+  ${CMAKE_SOURCE_DIR}/src/core/driver
+  ${CMAKE_SOURCE_DIR}/src/core/common
+  ${CMAKE_SOURCE_DIR}/src/core/misc_utils
+  ${CMAKE_SOURCE_DIR}/src/util/libpages
+  ${CMAKE_SOURCE_DIR}/src/util/libutil
+  ${CMAKE_SOURCE_DIR}/src/core/ctrl_init
+  ${CMAKE_SOURCE_DIR}/src/core/ctrl
+  ${CMAKE_SOURCE_DIR}/src/util/libtspcfg
+  ${CMAKE_SOURCE_DIR}/src/util/libcalc
+  )
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/core/rpc) 
+
+IF(BUILD_VXWORKS)
+  INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/external/VxWorks/posix/h)
+ENDIF(BUILD_VXWORKS)
+ 
+IF (BUILD_XMLRPC)
+  INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/core/xmlrpc)
+ENDIF (BUILD_XMLRPC)
+  
+
+
+#
+# Be nice use FIND PACKAGE for searching library
+# if there is no predefined CMake FindXXX module
+# for your needs please write one
+# and put it in {TSP_SRC_BASE}/make directory
+# see  
+# http://www.cmake.org/Wiki/CMake_HowToFindInstalledSoftware
+# for building your own CMake module
+#
+
+################ Open GL Check ####################
+MESSAGE(STATUS "Looking for OpenGL")
+FIND_PACKAGE(OpenGL)
+IF (OPENGL_FOUND)
+  MESSAGE(STATUS "Looking for OpenGL - found : ${OPENGL_gl_LIBRARY}")
+  GET_FILENAME_COMPONENT(GLPATH ${OPENGL_gl_LIBRARY} PATH)
+  LINK_DIRECTORIES(${GLPATH})
+ELSE (OPENGL_FOUND)
+  MESSAGE(STATUS "Looking for OpenGL - not found")
+ENDIF (OPENGL_FOUND)
+
+################ GLU Check ####################
+MESSAGE(STATUS "Looking for GLU")
+FIND_PACKAGE(GLU)
+IF (OPENGL_GLU_FOUND)
+  MESSAGE(STATUS "Looking for GLU - found : ${OPENGL_glu_LIBRARY}")
+ELSE (OPENGL_GLU_FOUND)
+  MESSAGE(STATUS "Looking for GLU - not found")
+ENDIF (OPENGL_GLU_FOUND)
+
+################ GLUT Check ####################
+MESSAGE(STATUS "Looking for GLUT")
+FIND_PACKAGE(GLUT)
+IF (GLUT_FOUND)
+  MESSAGE(STATUS "Looking for GLUT - found : ${GLUT_glut_LIBRARY}")
+  SET(GLUT_DEVEL_PACKAGE "glut-devel")
+ELSE (GLUT_FOUND)
+  MESSAGE(STATUS "Looking for GLUT - not found")
+ENDIF (GLUT_FOUND)
+
+################ LEX/YACC Check ####################
+FIND_PACKAGE(LexYacc)
+################ GTK+1 Check ####################
+FIND_PACKAGE(GTK)
+################ XML2 Check ####################
+FIND_PACKAGE(XML2)
+IF (XML2_XMLWRITER_SUPPORTED)
+  ADD_DEFINITIONS(-DXMLWRITER_SUPPORTED)
+ENDIF (XML2_XMLWRITER_SUPPORTED)
+
+################ FUSE Check ####################
+FIND_PACKAGE(FUSE)
+IF(FUSE_FOUND)
+  MESSAGE(STATUS "FUSE consumer enabled")
+ELSE(FUSE_FOUND)
+  MESSAGE(STATUS "FUSE consumer disabled")
+ENDIF(FUSE_FOUND)
+
+################ xmlrpc-c check ####################
+IF (BUILD_XMLRPC)
+    FIND_PACKAGE(XMLRPCC REQUIRED)
+    FIND_PACKAGE(libwww REQUIRED)
+ENDIF (BUILD_XMLRPC)
+
+################ BUILD related config ############################
+
+IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
+  ADD_DEFINITIONS(-DUSE_STRACE)
+ENDIF (CMAKE_BUILD_TYPE STREQUAL "Debug")
+
+IF (WIN32)
+  SET(LIBRARY_OUTPUT_PATH    ${CMAKE_BINARY_DIR}/${CMAKE_SYSTEM_NAME}/bin)
+  SET(EXECUTABLE_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH})
+  IF (BUILD_WIN32_PTHREADWIN32 AND PTHREADWIN32_FOUND)
+	## installer
+	INSTALL(PROGRAMS ${PTHREADWIN32_INSTALL} DESTINATION external/${PTHREAD_LIBRARY_NAME}/sources)
+	## external include
+	INSTALL(FILES	${PTHREADWIN32_INCLUDE_DIRS}/pthread.h 
+					${PTHREADWIN32_INCLUDE_DIRS}/sched.h 
+					${PTHREADWIN32_INCLUDE_DIRS}/semaphore.h 
+			DESTINATION external/${PTHREAD_LIBRARY_NAME}/include)
+	## external lib and dll
+	INSTALL(FILES ${PTHREADWIN32_LIBRARY_DIRS}/${PTHREAD_LIBRARY_NAME}.lib 
+			DESTINATION external/${PTHREAD_LIBRARY_NAME}/lib)
+	INSTALL(FILES ${PTHREADWIN32_LIBRARY_DIRS}/${PTHREAD_LIBRARY_NAME}.dll 
+			DESTINATION external/${PTHREAD_LIBRARY_NAME}/bin)
+    ## Copy .dll ##    
+    CONFIGURE_FILE(${PTHREADWIN32_LIBRARY_DIRS}/${PTHREAD_LIBRARY_NAME}.dll ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/${PTHREAD_LIBRARY_NAME}.dll COPYONLY)
+	## Install ##
+	INSTALL(FILES ${PTHREADWIN32_LIBRARY_DIRS}/${PTHREAD_LIBRARY_NAME}.dll DESTINATION bin)
+    
+    IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
+		## debug file ##
+		IF (EXISTS ${PTHREADWIN32_LIBRARY_DIRS}/${PTHREAD_LIBRARY_NAME}.pdb)
+		   CONFIGURE_FILE(${PTHREADWIN32_LIBRARY_DIRS}/${PTHREAD_LIBRARY_NAME}.pdb ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/${PTHREAD_LIBRARY_NAME}.pdb COPYONLY)
+		   INSTALL(FILES ${PTHREADWIN32_LIBRARY_DIRS}/${PTHREAD_LIBRARY_NAME}.pdb DESTINATION bin)
+		   INSTALL(FILES ${PTHREADWIN32_LIBRARY_DIRS}/${PTHREAD_LIBRARY_NAME}.pdb DESTINATION external/${PTHREAD_LIBRARY_NAME}/bin)
+		ENDIF (EXISTS ${PTHREADWIN32_LIBRARY_DIRS}/${PTHREAD_LIBRARY_NAME}.pdb)
+    ENDIF (CMAKE_BUILD_TYPE STREQUAL "Debug")
+  ENDIF (BUILD_WIN32_PTHREADWIN32 AND PTHREADWIN32_FOUND)
+  IF (BUILD_WIN32_ACPLT_ONCPRC AND ACPLT_ONCRPC_FOUND)
+	## installer
+	INSTALL(PROGRAMS ${ACPLT_ONCRPC_INSTALL} DESTINATION external/oncrpc/source)
+	## external include	
+	INSTALL(FILES	${ACPLT_INCLUDE_DIR1}/AUTH.H
+					${ACPLT_INCLUDE_DIR1}/AUTH_UNI.H
+					${ACPLT_INCLUDE_DIR1}/BCOPY.H
+					${ACPLT_INCLUDE_DIR1}/CLNT.H
+					${ACPLT_INCLUDE_DIR1}/NETDB.H
+					${ACPLT_INCLUDE_DIR1}/RPC.H
+					${ACPLT_INCLUDE_DIR1}/RPC_MSG.H
+					${ACPLT_INCLUDE_DIR1}/SVC.H
+					${ACPLT_INCLUDE_DIR1}/SVC_AUTH.H
+					${ACPLT_INCLUDE_DIR1}/TYPES.H
+					${ACPLT_INCLUDE_DIR1}/XDR.H 
+			DESTINATION external/oncrpc/include/rpc)
+	## external lib and dll
+	INSTALL(FILES ${ACPLT_ONCRPC_LIBRARY_DIRS}/oncrpc.lib 
+			DESTINATION external/oncrpc/lib)
+	INSTALL(FILES ${ACPLT_ONCRPC_LIBRARY_DIRS}/oncrpc.dll 
+			DESTINATION external/oncrpc/bin)
+	# external programs
+	INSTALL(PROGRAMS ${ACPLT_ONCRPC_BINARY_DIRS}/rpcinfo.exe
+					 ${ACPLT_ONCRPC_BINARY_DIRS}/rpcgen.exe
+					 ${ACPLT_ONCRPC_BINARY_DIRS}/portmap.exe
+					 ${ACPLT_ONCRPC_BINARY_DIRS}/pm_ascii.exe
+					 ${ACPLT_ONCRPC_BINARY_DIRS}/inst_pm.exe
+			DESTINATION external/oncrpc/bin)
+	## external services
+	INSTALL(FILES ${ACPLT_ONCRPC_BINARY_DIRS}/install.bat
+			DESTINATION external/oncrpc/service)
+	INSTALL(FILES ${ACPLT_ONCRPC_ETC_DIR}/rpc
+	        DESTINATION external/oncrpc/etc)
+	## Copy .dll ##
+    CONFIGURE_FILE(${ACPLT_ONCRPC_LIBRARY_DIRS}/oncrpc.dll ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/oncrpc.dll COPYONLY)
+    ## Install ##
+    INSTALL(FILES ${ACPLT_ONCRPC_LIBRARY_DIRS}/oncrpc.dll DESTINATION bin)
+    
+    IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
+		## debug file ##
+		IF (EXISTS ${ACPLT_ONCRPC_LIBRARY_DIRS}/oncrpc.pdb)
+		   CONFIGURE_FILE(${ACPLT_ONCRPC_LIBRARY_DIRS}/oncrpc.pdb ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/oncrpc.pdb COPYONLY)
+		   INSTALL(FILES ${ACPLT_ONCRPC_LIBRARY_DIRS}/oncrpc.pdb DESTINATION bin)
+		   INSTALL(FILES ${ACPLT_ONCRPC_LIBRARY_DIRS}/oncrpc.pdb DESTINATION external/oncrpc/bin)
+		ENDIF (EXISTS ${ACPLT_ONCRPC_LIBRARY_DIRS}/oncrpc.pdb)
+    ENDIF (CMAKE_BUILD_TYPE STREQUAL "Debug")
+  ENDIF (BUILD_WIN32_ACPLT_ONCPRC AND ACPLT_ONCRPC_FOUND)
+  
+  IF (MSVC71)
+    ## Install FIX the path to le system directoy##
+    INSTALL(FILES 
+      C:/Windows/system32/msvcr71d.dll
+      C:/Windows/system32/mfc71d.dll
+      DESTINATION external/msvc)
+  ENDIF (MSVC71)
+ELSE (WIN32)
+  #Nothing to do.
+  SET(LIBRARY_OUTPUT_PATH    ${CMAKE_BINARY_DIR}/${CMAKE_SYSTEM_NAME}/${CMAKE_BUILD_TYPE}/lib)
+  SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/${CMAKE_SYSTEM_NAME}/${CMAKE_BUILD_TYPE}/bin)
+ENDIF (WIN32)
+
+SET(DIST_DIR ${PROJECT_SOURCE_DIR}/dist)
+MARK_AS_ADVANCED(DIST_DIR)
+
+LINK_DIRECTORIES(${LIBRARY_OUTPUT_PATH})
+
+################ INSTALL related config ############################
+# the CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT is
+# CMake 2.4.4 (or later) feature
+# see
+# http://www.cmake.org/pipermail/cmake/2006-October/011559.html
+IF (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+  SET(CMAKE_INSTALL_PREFIX "/opt/${PACKAGE_NAME}-${PACKAGE_VERSION}" CACHE PATH "Install path prefix" FORCE)
+ENDIF (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+
+################ TSP SDK related config ###########################
+TSP_CONFIGURE_FILE_AUTOTOOLS_COMPAT(
+  src/scripts/tsp_dev.login.in
+  ${CMAKE_BINARY_DIR}/src/scripts/tsp_dev.login
+  @ONLY)
+
+TSP_CONFIGURE_FILE_AUTOTOOLS_COMPAT(
+  src/scripts/tsp_dev.login.sh.in 
+  ${CMAKE_BINARY_DIR}/src/scripts/tsp_dev.login.sh
+  @ONLY)
+
+TSP_CONFIGURE_FILE_AUTOTOOLS_COMPAT(
+  src/scripts/tsp.pc.in
+  ${CMAKE_BINARY_DIR}/src/scripts/tsp.pc
+  @ONLY)
+
+TSP_CONFIGURE_FILE_AUTOTOOLS_COMPAT(
+  src/scripts/tsp_profile.sh.in
+  ${CMAKE_BINARY_DIR}/src/scripts/tsp.profile.sh
+  @ONLY)
+
+TSP_CONFIGURE_FILE_AUTOTOOLS_COMPAT(
+  src/scripts/tsp_profile.csh.in
+  ${CMAKE_BINARY_DIR}/src/scripts/tsp.profile.csh
+  @ONLY)
+
+INSTALL(
+  FILES 
+  ${CMAKE_BINARY_DIR}/src/scripts/tsp.pc 
+  ${CMAKE_BINARY_DIR}/src/scripts/tsp.profile.sh
+  ${CMAKE_BINARY_DIR}/src/scripts/tsp.profile.csh
+  DESTINATION scripts)
+
+## Now add subdirectories
+IF (BUILD_ONLY_TSP_PORT)
+  ADD_SUBDIRECTORY(tests/tsp_port)
+ELSE (BUILD_ONLY_TSP_PORT)
+  ADD_SUBDIRECTORY(tests/tsp_port)
+  ADD_SUBDIRECTORY(external)
+  ADD_SUBDIRECTORY(src)
+ENDIF (BUILD_ONLY_TSP_PORT)
+
+ENABLE_TESTING()
+ADD_TEST(TestSocket ${EXECUTABLE_OUTPUT_PATH}/tsp_port_test -t socket -u localhost)
+
+SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Transport Sample Protocol")
+SET(CPACK_PACKAGE_VENDOR "The TSP Team")
+SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
+SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
+SET(CPACK_PACKAGE_NAME tsp)
+SET(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
+
+IF (NOT WIN32)
+  SET(CPACK_SOURCE_GENERATOR "TGZ;ZIP")
+  SET(CPACK_GENERATOR "TGZ")
+  EXECUTE_PROCESS(COMMAND uname -m
+    OUTPUT_VARIABLE MACHINE)
+  STRING(REPLACE "\n" "" 
+    MACHINE
+    ${MACHINE})
+  SET(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${MACHINE})
+ELSE (NOT WIN32) 
+  SET(CPACK_SOURCE_GENERATOR "ZIP")
+ENDIF (NOT WIN32)
+
+
+#How to exclude some files from source?
+#SET(CPACK_SOURCE_STRIP_FILES "cscope.out;cscope.files")
+SET(CPACK_SOURCE_IGNORE_FILES "/CVS/;/\\\\.svn/;\\\\.swp$;\\\\.#;/#;.*~;cscope.*")
+SET(CPACK_PACKAGE_VERSION ${PACKAGE_VERSION})
+SET(CPACK_PACKAGE_VERSION_MAJOR ${PACKAGE_VERSION_MAJOR})
+SET(CPACK_PACKAGE_VERSION_MINOR ${PACKAGE_VERSION_MINOR})
+SET(CPACK_PACKAGE_VERSION_PATCH ${PACKAGE_VERSION_PATCH})
+
+IF(WIN32)
+    ## Customize NSIS installer
+    SET(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/make/\\\\pieuvre_tsp_graph.bmp")
+    SET(CPACK_NSIS_CREATE_ICONS "
+		CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\TSP Help.lnk\\\" \\\"$INSTDIR\\\\doc\\\\html\\\\tsp.chm\\\"
+		CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\TSP RPC CleanUp.lnk\\\" \\\"$INSTDIR\\\\bin\\\\tsp_rpc_cleanup.exe\\\"
+	    CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\TSP StubServer.lnk\\\" \\\"$INSTDIR\\\\bin\\\\tsp_stub_server.exe\\\"
+	    CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\TSP StdOutClient.lnk\\\" \\\"$INSTDIR\\\\bin\\\\tsp_stdout_client.exe\\\" \\\"-p 10 -s 2 -n 0\\\"
+	")
+	SET(CPACK_NSIS_DELETE_ICONS "
+		Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\TSP Help.lnk\\\"
+		Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\TSP RPC CleanUp.lnk\\\"
+	    Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\TSP StubServer.lnk\\\"
+	    Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\TSP StdOutClient.lnk\\\"
+	")
+    SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} Transport Sample Protocol (TSP)")
+    SET(CPACK_NSIS_HELP_LINK "https:\\\\\\\\savannah.nongnu.org\\\\projects\\\\tsp")
+    SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.ts2p.org\\\\tsp")
+    SET(CPACK_NSIS_CONTACT "tsp@astrium.eads.net")
+    SET(CPACK_NSIS_MODIFY_PATH ON)
+	## Copy dll to the system path	
+	IF (BUILD_WIN32_ACPLT_ONCPRC AND ACPLT_ONCRPC_FOUND)
+		SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
+		    ExecWait  \\\"$INSTDIR\\\\external\\\\oncrpc\\\\bin\\\\inst_pm.exe remove\\\"
+		    CopyFiles \\\"$INSTDIR\\\\external\\\\oncrpc\\\\bin\\\\oncrpc.dll\\\" \\\"$SYSDIR\\\"
+		    CopyFiles \\\"$INSTDIR\\\\external\\\\oncrpc\\\\bin\\\\portmap.exe\\\" \\\"$SYSDIR\\\"
+		    CreateDirectory \\\"$SYSDIR\\\\drivers\\\\etc\\\"
+		    CopyFiles \\\"$INSTDIR\\\\external\\\\oncrpc\\\\etc\\\\rpc\\\" \\\"$SYSDIR\\\\drivers\\\\etc\\\"
+		    ExecWait  \\\"$INSTDIR\\\\external\\\\oncrpc\\\\bin\\\\inst_pm.exe $SYSDIR\\\\portmap.exe\\\"			
+		")
+	ENDIF (BUILD_WIN32_ACPLT_ONCPRC AND ACPLT_ONCRPC_FOUND)
+	
+	IF (BUILD_WIN32_PTHREADWIN32 AND PTHREADWIN32_FOUND)
+		SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS ${CPACK_NSIS_EXTRA_INSTALL_COMMANDS} "
+			CopyFiles \\\"$INSTDIR\\\\bin\\\\${PTHREAD_LIBRARY_NAME}.dll\\\" \\\"$SYSDIR\\\"
+		")
+	ENDIF (BUILD_WIN32_PTHREADWIN32 AND PTHREADWIN32_FOUND)
+	
+	SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS ${CPACK_NSIS_EXTRA_INSTALL_COMMANDS} "
+		CopyFiles \\\"$INSTDIR\\\\bin\\\\TspWin32.dll\\\" \\\"$SYSDIR\\\"
+		CopyFiles \\\"$INSTDIR\\\\bin\\\\Tsp_*.dll\\\" \\\"$SYSDIR\\\"
+	")
+	
+	IF (MSVC71)
+		SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS ${CPACK_NSIS_EXTRA_INSTALL_COMMANDS} "
+			IfFileExists \\\"$SYSDIR\\\\msvcr71d.dll\\\" next1 0
+			CopyFiles \\\"$INSTDIR\\\\external\\\\msvc\\\\msvcr71d.dll\\\" \\\"$SYSDIR\\\"
+			next1:
+			IfFileExists \\\"$SYSDIR\\\\mfc71d.dll\\\" next2 0
+			CopyFiles \\\"$INSTDIR\\\\external\\\\msvc\\\\mfc71d.dll\\\" \\\"$SYSDIR\\\"
+			next2:
+		")
+	ENDIF (MSVC71)
+	
+#	SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS ${CPACK_NSIS_EXTRA_INSTALL_COMMANDS} "
+#		MessageBox MB_OK \\\"Copy Libraries to the system directory\\\"
+#	")
+	
+	IF (BUILD_WIN32_PTHREADWIN32 AND PTHREADWIN32_FOUND)
+		SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "
+			Delete \\\"$SYSDIR\\\\${PTHREAD_LIBRARY_NAME}.dll\\\"
+		")
+	ENDIF (BUILD_WIN32_PTHREADWIN32 AND PTHREADWIN32_FOUND)
+	
+	SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS ${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS} "
+		Delete \\\"$SYSDIR\\\\TspWin32.dll\\\"
+		Delete \\\"$SYSDIR\\\\Tsp_*.dll\\\"
+		ExecWait  \\\"$INSTDIR\\\\external\\\\oncrpc\\\\bin\\\\inst_pm.exe remove\\\"
+		Delete    \\\"$SYSDIR\\\\oncrpc.dll\\\"
+		Delete    \\\"$SYSDIR\\\\portmap.exe\\\"
+		Delete    \\\"$SYSDIR\\\\drivers\\\\etc\\\\rpc\\\"
+	")
+	
+#	SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS ${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS} "
+#		MessageBox MB_OK \\\"Delete Libraries from the system directory\\\"
+#	")
+ENDIF(WIN32)
+
+INCLUDE(CPack)
+INCLUDE(UsePackageBackup)
+INCLUDE(UseRPMTools)
+IF(RPMTools_FOUND)
+  RPMTools_ADD_RPM_TARGETS(tsp ${CMAKE_SOURCE_DIR}/src/scripts/tsp.spec.in)
+  #RPMTools_ADD_RPM_TARGETS(tsp)
+ENDIF(RPMTools_FOUND)
+
+MESSAGE(STATUS "Configuring ${PACKAGE_NAME} version ${PACKAGE_VERSION}...Done.")
+
+IF (WIN32)
+  MESSAGE(STATUS "*** TSP for WIN32 has been successfully configured ********")
+ELSE (WIN32)
+  MESSAGE(STATUS "*** TSP has been successfully configured ********")
+ENDIF (WIN32)
diff -urN tsp_orig/.cvsignore tsp_modified/.cvsignore
--- tsp_orig/.cvsignore	2007-05-01 23:13:17.000000000 +0200
+++ tsp_modified/.cvsignore	1970-01-01 01:00:00.000000000 +0100
@@ -1,4 +0,0 @@
-CMakeFiles
-CMakeTmp
-CMakeCache.txt
-cmake_install.cmake
diff -urN tsp_orig/external/CMakeLists.txt tsp_modified/external/CMakeLists.txt
--- tsp_orig/external/CMakeLists.txt	2006-10-18 11:14:52.000000000 +0200
+++ tsp_modified/external/CMakeLists.txt	2009-01-12 17:26:09.000000000 +0100
@@ -1,7 +1,13 @@
-IF (GTK_FOUND)
+
+IF (GTK_FOUND AND NOT BUILD_VXWORKS)
   ADD_SUBDIRECTORY(gtk-1.2)
-ENDIF (GTK_FOUND)
+ENDIF (GTK_FOUND AND NOT BUILD_VXWORKS)
 
 IF (WIN32)
 	ADD_SUBDIRECTORY(TspWin32)
 ENDIF (WIN32)
+
+IF(BUILD_VXWORKS)
+	ADD_SUBDIRECTORY(VxWorks)
+#	ADD_SUBDIRECTORY(RpcGen)
+ENDIF(BUILD_VXWORKS)
diff -urN tsp_orig/external/RpcGen/CMakeLists.txt tsp_modified/external/RpcGen/CMakeLists.txt
--- tsp_orig/external/RpcGen/CMakeLists.txt	2006-06-26 22:25:44.000000000 +0200
+++ tsp_modified/external/RpcGen/CMakeLists.txt	2009-01-12 17:26:10.000000000 +0100
@@ -1,5 +1,8 @@
-ADD_EXECUTABLE(rpcgen 
-rpc_clntout rpc_hout rpc_parse
-rpc_scan rpc_tblout rpc_cout
-rpc_main rpc_sample rpc_svcout 
-rpc_util)
+ADD_EXECUTABLE(vxrpcgen.1 
+    rpc_clntout rpc_hout rpc_parse
+    rpc_scan rpc_tblout rpc_cout
+    rpc_main rpc_sample rpc_svcout 
+    rpc_util)
+MESSAGE(STATUS "addexe VxWorks Done")
+
+
diff -urN tsp_orig/external/RpcGen/rpc_cout.c tsp_modified/external/RpcGen/rpc_cout.c
--- tsp_orig/external/RpcGen/rpc_cout.c	2005-04-08 16:41:38.000000000 +0200
+++ tsp_modified/external/RpcGen/rpc_cout.c	2009-01-12 17:26:10.000000000 +0100
@@ -38,6 +38,7 @@
 #include "rpc_parse.h"
 #include "rpc_util.h"
 
+
 static void emit_program(definition *def);
 static void emit_union(definition *def);
 static void emit_struct(definition *def);
diff -urN tsp_orig/external/RpcGen/rpc_main.c tsp_modified/external/RpcGen/rpc_main.c
--- tsp_orig/external/RpcGen/rpc_main.c	2005-04-08 16:41:38.000000000 +0200
+++ tsp_modified/external/RpcGen/rpc_main.c	2009-01-12 17:26:10.000000000 +0100
@@ -33,6 +33,8 @@
  * rpc_main.c, Top level of the RPC protocol compiler. 
  */
 
+
+
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
@@ -50,6 +52,7 @@
 #include "rpc_clntout.h"
 #include "rpc_tblout.h"
 
+
 #define EXTEND	1		/* alias for TRUE */
 #define DONT_EXTEND	0		/* alias for FALSE */
 
diff -urN tsp_orig/external/RpcGen/rpc_svcout.c tsp_modified/external/RpcGen/rpc_svcout.c
--- tsp_orig/external/RpcGen/rpc_svcout.c	2005-04-08 16:41:38.000000000 +0200
+++ tsp_modified/external/RpcGen/rpc_svcout.c	2009-01-12 17:26:10.000000000 +0100
@@ -37,6 +37,8 @@
 #include "rpc_parse.h"
 #include "rpc_util.h"
 
+
+
 static void write_inetmost(char* infile);
 static void write_pm_most(char* infile, int netflag);
 static void write_rpc_svc_fg(char* infile, char *sp);
diff -urN tsp_orig/external/VxWorks/CMakeLists.txt tsp_modified/external/VxWorks/CMakeLists.txt
--- tsp_orig/external/VxWorks/CMakeLists.txt	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/external/VxWorks/CMakeLists.txt	2009-01-12 17:26:10.000000000 +0100
@@ -0,0 +1,2 @@
+ADD_SUBDIRECTORY(posix)
+
diff -urN tsp_orig/external/VxWorks/posix/CMakeLists.txt tsp_modified/external/VxWorks/posix/CMakeLists.txt
--- tsp_orig/external/VxWorks/posix/CMakeLists.txt	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/external/VxWorks/posix/CMakeLists.txt	2009-01-12 17:26:10.000000000 +0100
@@ -0,0 +1,2 @@
+#Find a way to properly generate the .o
+ADD_EXECUTABLE(posixEssai  posixWrap.c)
diff -urN tsp_orig/external/VxWorks/posix/h/libgen.h tsp_modified/external/VxWorks/posix/h/libgen.h
--- tsp_orig/external/VxWorks/posix/h/libgen.h	2006-02-26 14:32:00.000000000 +0100
+++ tsp_modified/external/VxWorks/posix/h/libgen.h	2009-01-12 17:26:10.000000000 +0100
@@ -42,6 +42,7 @@
 int getpid(void);
 char * basename(char * path);
 
+struct hostent *gethostbyname(const char *name);
 
 typedef uint32_t rpcprog_t;
 typedef uint32_t rpcvers_t;
diff -urN tsp_orig/external/VxWorks/posix/posixIpc.c tsp_modified/external/VxWorks/posix/posixIpc.c
--- tsp_orig/external/VxWorks/posix/posixIpc.c	2006-02-26 14:31:59.000000000 +0100
+++ tsp_modified/external/VxWorks/posix/posixIpc.c	2009-01-12 17:26:10.000000000 +0100
@@ -32,6 +32,7 @@
 
 Purpose   : posix implementation for VXWORKS
 
+
 -----------------------------------------------------------------------
 */
 
@@ -50,6 +51,8 @@
 
 #define MSG_MAX_SIZE		32
 
+/***may replace by smMemMalloc, to see....***/
+
 /* declare vme_malloc function : must be provided in BSP or user application */
 extern void * vme_malloc(unsigned long size);
 
diff -urN tsp_orig/external/VxWorks/posix/posixThread.c tsp_modified/external/VxWorks/posix/posixThread.c
--- tsp_orig/external/VxWorks/posix/posixThread.c	2006-02-26 14:31:59.000000000 +0100
+++ tsp_modified/external/VxWorks/posix/posixThread.c	2009-01-12 17:26:10.000000000 +0100
@@ -84,8 +84,10 @@
 static int pthread_number = 0;
 char pthread_name[16];
 
+
 if (attr == NULL) 
     {
+      printf("attr=NULL\n");
     /* default creation attribute in posix are 
      contentionscope   PTHREAD_SCOPE_PROCESS     Resource competition within process
      detachstate       PTHREAD_CREATE_JOINABLE   Joinable by other threads
@@ -98,7 +100,8 @@
 */
     Pid = taskIdSelf ();
     status = taskPriorityGet (Pid,&priority) ;
-    status = taskOptionsGet (Pid,&options) ;  
+    status = taskOptionsGet (Pid,&options) ;
+    printf("attention spawn just apres sprintf dans le buffer pthread_name\n");  
     sprintf(pthread_name, "pthread#%d", pthread_number++);
     retourcode = taskSpawn (pthread_name, /* task name */
                         priority, /* task priority */
@@ -119,6 +122,8 @@
     }
 else
     {
+      printf("invalide, point de spawn effecrtue\n");
+
     errno = EINVAL ;  /* on considére un paramétre non nul comme invalide */
     retourcode = -1 ;
     }
@@ -137,7 +142,7 @@
     return -1 ;
     } 
 else
-    taskDelay (0) ; /* FIXME wait foreever */
+    taskDelay (0) ; /* FIXME wait forever */
     return 0 ;
 
 }
diff -urN tsp_orig/external/VxWorks/posix/posixWrap.c tsp_modified/external/VxWorks/posix/posixWrap.c
--- tsp_orig/external/VxWorks/posix/posixWrap.c	2006-02-26 14:32:00.000000000 +0100
+++ tsp_modified/external/VxWorks/posix/posixWrap.c	2009-01-12 17:26:10.000000000 +0100
@@ -49,6 +49,7 @@
 #include <hostLib.h>
 #include <rpc/pmap_clnt.h>
 
+
 #include "strings.h"
 #include "libgen.h"
 
@@ -87,6 +88,7 @@
 
   if(getrpcport_called == 0) {
     getrpcport_called = 1;
+
     if(rpcTaskInit() == ERROR) {
       return 0;
     }
@@ -101,7 +103,6 @@
 
   address.sin_family = AF_INET;
   address.sin_port =  0;
- 
   return pmap_getport(&address, (u_long)prognum, (u_long)versnum, IPPROTO_TCP);
 }
 
@@ -202,3 +203,19 @@
 
   return ret;
 }
+
+
+int
+strncasecmp (const char *s1, const char *s2, size_t len)
+{
+  if ( len == 0 ) return 0;
+  while ( (len > 0) && (tolower(*s1) == tolower(*s2)) )
+  {
+    len--;
+    if ( (len == 0) || (*s1 == '\0') || (*s2 == '\0') )
+            break;
+    s1++;
+    s2++;
+  }
+  return tolower(*s1) - tolower(*s2);
+}
diff -urN tsp_orig/make/FindONCRPC.cmake tsp_modified/make/FindONCRPC.cmake
--- tsp_orig/make/FindONCRPC.cmake	2007-04-22 23:34:37.000000000 +0200
+++ tsp_modified/make/FindONCRPC.cmake	2009-01-12 17:26:07.000000000 +0100
@@ -23,19 +23,38 @@
 #   RPC_DEPENDS               -
 #
 
+IF(CMAKE_SYSTEM_NAME STREQUAL "VxWorks")
+  SET(VXWORKS ON)
+ENDIF(CMAKE_SYSTEM_NAME STREQUAL "VxWorks")
+
 IF (WIN32)
   SET(PATH_DIR ${CMAKE_SOURCE_DIR}/external/ACPLT-ONCRPC c:/oncrpc)
 ELSE (WIN32)
-  SET(PATH_DIR /usr/bin /usr/lib) 
+ IF(VXWORKS)
+	SET(PATH_DIR /home1/kerity/projets/tsp/dev/tools /home/kerity/windriver/PPC_2.2.1/target/h )
+  ELSE(VXWORKS)
+	 SET(PATH_DIR  /usr/bin /usr/lib) 
+ ENDIF(VXWORKS)
 ENDIF(WIN32)
 
 MESSAGE(STATUS "Looking for ONC-RPC library and programs...")
 
-FIND_PROGRAM(ONCRPC_RPCGEN_EXECUTABLE 
+IF(VXWORKS)
+  FIND_PROGRAM(ONCRPC_RPCGEN_EXECUTABLE 
+  NAMES vxrpcgen.sun.vxworks
+  PATHS ${PATH_DIR}
+  PATH_SUFFIXES rpcgen
+  DOC "The ONC-RPC stub/skeleton generator"
+  NO_CMAKE_FIND_ROOT_PATH
+  )
+ELSE(VXWORKS)
+ FIND_PROGRAM(ONCRPC_RPCGEN_EXECUTABLE 
   NAMES rpcgen 
   PATHS ${PATH_DIR}
   PATH_SUFFIXES bin
   DOC "The ONC-RPC stub/skeleton generator")
+ENDIF(VXWORKS)
+
 IF (ONCRPC_RPCGEN_EXECUTABLE) 
   MESSAGE(STATUS "Looking for ONCRPC... - found rpcgen is ${ONCRPC_RPCGEN_EXECUTABLE}")
   SET(ONCRPC_RPCGEN_FOUND "YES")
@@ -51,20 +70,25 @@
   SET(ONCRPC_LIBRARY_NAME "oncrpc;rpc")
 ENDIF (CMAKE_SYSTEM_NAME STREQUAL "SunOS")
 
-FIND_LIBRARY(ONCRPC_LIBRARY
-	NAMES ${ONCRPC_LIBRARY_NAME}
-	PATHS ${PATH_DIR}	
-	PATH_SUFFIXES lib librpc
-	DOC "The ONC-RPC Library")
+
+    FIND_LIBRARY(ONCRPC_LIBRARY
+	   NAMES ${ONCRPC_LIBRARY_NAME}
+           PATHS ${PATH_DIR}	
+	   PATH_SUFFIXES lib librpc
+	   DOC "The ONC-RPC Library")
 
 IF (NOT ONCRPC_LIBRARY)
-  IF (UNIX)
-    SET(ONCRPC_LIBRARY "")
-    SET(ONCRPC_NOLIB_NEEDED YES)
-    MESSAGE(STATUS "Looking for ONCRPC... - ONC-RPC library not FOUND on UNIX system --> considered embedded in libc.")
-  ELSE (UNIX)
-    MESSAGE(STATUS "Looking for ONCRPC... - ONCRPC lib : NOT FOUND")    
-  ENDIF (UNIX)
+  IF (UNIX OR VXWORKS)
+      SET(ONCRPC_LIBRARY "")
+      SET(ONCRPC_NOLIB_NEEDED YES)
+      IF(VXWORKS)
+         MESSAGE(STATUS "Looking for ONCRPC... - TARGET=VxWorks, no link with ONCRPC library")
+      ELSE(VXWORKS)
+         MESSAGE(STATUS "Looking for ONCRPC... - ONC-RPC library not FOUND on UNIX system --> considered embedded in libc.")
+      ENDIF(VXWORKS)
+  ELSE (UNIX OR VXWORKS)
+      MESSAGE(STATUS "Looking for ONCRPC... - ONCRPC lib : NOT FOUND")    
+  ENDIF (UNIX OR VXWORKS)
 ELSE (NOT ONCRPC_LIBRARY)  
   MESSAGE(STATUS "Looking for ONCRPC... - found ONCRPC lib : ${ONCRPC_LIBRARY}")
   GET_FILENAME_COMPONENT(ONCRPC_LIBRARY_DIRS ${ONCRPC_LIBRARY} PATH)      
diff -urN tsp_orig/make/FindXML2.cmake tsp_modified/make/FindXML2.cmake
--- tsp_orig/make/FindXML2.cmake	2007-01-24 20:50:07.000000000 +0100
+++ tsp_modified/make/FindXML2.cmake	2009-01-12 17:26:08.000000000 +0100
@@ -1,7 +1,8 @@
 
 MESSAGE(STATUS "Looking for xml2-config...")
+
 FIND_PROGRAM(XML2_CONFIG_PROGRAM
-  NAMES xml2-config 
+  NAMES xml2-config
   PATHS /usr/local/bin /usr/bin
   DOC "The libxml2 (www.xmlsoft.org) configuration tool")
 IF (XML2_CONFIG_PROGRAM)
diff -urN tsp_orig/make/Makeparams.vxworks tsp_modified/make/Makeparams.vxworks
--- tsp_orig/make/Makeparams.vxworks	2005-04-08 16:46:57.000000000 +0200
+++ tsp_modified/make/Makeparams.vxworks	2009-01-12 17:26:08.000000000 +0100
@@ -16,15 +16,15 @@
 AS  = $(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/asppc
 AR  = $(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/arppc
 
-RPCGEN=$(DEVBASE)/external/RpcGen/MyRpcGen
+RPCGEN=$DEVBASE/../tools/rpcgen/vxrpcgen.sun.vxworks
 
 # Default options
 # ---------------
 ARFLAGS = rvs
 
-CPPFLAGS += -DUSE_STRACE -DVXWORKS -D__PROTOTYPE_5_0 -DCPU=$(WIND_TARGET_TYPE) -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/types -I$(WIND_BASE)/target/config/all
+CPPFLAGS += -DUSE_STRACE -DVXWORKS -D__PROTOTYPE_5_0 -DCPU=$(WIND_TARGET_TYPE) -DTARGET_MVME5500 -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/types -I$(WIND_BASE)/target/config/all.mms  -I$(WIND_BASE)/target/config/mv5500.mms
 
-CFLAGS   += -B$(WIND_BASE)/host/sun4-solaris2/lib/gcc-lib/ -mstrict-align -fsigned-char -fvolatile -fno-builtin -fno-for-scope -Wall -mlongcall -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -O2
+CFLAGS   += -B$(WIND_BASE)/host/sun4-solaris2/lib/gcc-lib/ -mstrict-align -fsigned-char -g -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -mlongcall 
 
 LDFLAGS += -r -B$(WIND_BASE)/host/sun4-solaris2/lib/gcc-lib/ -L$(WIND_BASE)/host/$(WIND_HOST_TYPE)/lib/gcc-lib/powerpc-wrs-vxworks/gcc-2.96/$(WIND_TARGET_TYPE)gnu -nostdlib
 
diff -urN tsp_orig/make/TSPCMakeTools.cmake tsp_modified/make/TSPCMakeTools.cmake
--- tsp_orig/make/TSPCMakeTools.cmake	2007-01-25 22:12:05.000000000 +0100
+++ tsp_modified/make/TSPCMakeTools.cmake	2009-01-12 17:26:08.000000000 +0100
@@ -24,9 +24,10 @@
 	
 	IF (TSP_XINCLUDE_DIR_FOUND)
 		# handle missing extension
-		IF (NOT "${INCLUDE_FILE}" MATCHES ".h" AND NOT "${INCLUDE_FILE}" MATCHES ".H")
+                #(BUG) (in case of a file which contains a "h") must type double escape character
+		IF (NOT "${INCLUDE_FILE}" MATCHES "\\.h" AND NOT "${INCLUDE_FILE}" MATCHES "\\.H")
 			SET(INCLUDE_FILE ${INCLUDE_FILE}.h)
-		ENDIF ( NOT "${INCLUDE_FILE}" MATCHES ".h" AND NOT "${INCLUDE_FILE}" MATCHES ".H") 
+		ENDIF ( NOT "${INCLUDE_FILE}" MATCHES "\\.h" AND NOT "${INCLUDE_FILE}" MATCHES "\\.H") 
 		GET_FILENAME_COMPONENT(FN ${INCLUDE_FILE} NAME)
 		CONFIGURE_FILE(${INCLUDE_FILE} ${XINCLUDE_OUTPUT_PATH}${INCLUDE_DIR}/${FN} COPYONLY)
 		INSTALL_FILES(/include${INCLUDE_DIR} .h ${XINCLUDE_OUTPUT_PATH}${INCLUDE_DIR}/${FN})
diff -urN tsp_orig/src/consumers/ascii_writer/tsp_ascii_writer.c tsp_modified/src/consumers/ascii_writer/tsp_ascii_writer.c
--- tsp_orig/src/consumers/ascii_writer/tsp_ascii_writer.c	2007-03-25 16:18:13.000000000 +0200
+++ tsp_modified/src/consumers/ascii_writer/tsp_ascii_writer.c	2009-01-12 17:26:09.000000000 +0100
@@ -48,7 +48,7 @@
 #define ASCII_WRITER_C
 #include <tsp_ascii_writer.h>
 #include <tsp_consumer.h>
-#include <tsp_simple_trace.h>
+#include <tsp_common_trace.h>
 #include <tsp_const_def.h>
 #include <tsp_time.h>
 /*#include <macsim_fmt.h>*/
@@ -141,7 +141,7 @@
 
   retcode = TSP_consumer_init(argc, argv);
   if (TSP_STATUS_OK!=retcode) {
-    STRACE_ERROR(("TSP init failed"));    
+    STRACE_ERROR("TSP init failed");    
   } 
   return retcode;
 }  /* end of tsp_ascii_writer_initialise */
@@ -163,7 +163,7 @@
     /* increment first since initialised to -1 */
     ++tsp_ascii_writer_current_var;
     g_tsp_symbols[tsp_ascii_writer_current_var].name = strdup(symbol_name);
-    STRACE_INFO(("Added var <%s>",symbol_name));
+    STRACE_INFO("Added var <%s>",symbol_name);
     retcode =0;
   }
   return retcode;
@@ -173,7 +173,7 @@
 tsp_ascii_writer_add_var_period(int32_t period) {
   if (NULL != g_tsp_symbols) {
     g_tsp_symbols[tsp_ascii_writer_current_var].period = period;
-    STRACE_INFO(("Period <%d>",period));
+    STRACE_INFO("Period <%d>",period);
   }
   return 0;
 } /* tsp_ascii_writer_add_var_period */
@@ -198,15 +198,15 @@
   yyin = fopen(conffilename,"r");
   if (((FILE*)(NULL)) == yyin) {    
     strncpy(syserr,strerror(errno),TSP_MAX_SYSMSG_SIZE);
-    STRACE_ERROR(("Cannot open config file <%s> (%s)",conffilename,syserr));
+    STRACE_ERROR("Cannot open config file <%s> (%s)",conffilename,syserr);
     retcode = TSP_STATUS_ERROR_AW_CONFIG_FILE_INVALID;
   }
   /* Lets parse the config file */
   if (TSP_STATUS_OK == retcode) {    
-    STRACE_INFO(("Parsing config file..."));
+    STRACE_INFO("Parsing config file...");
     /* First parse used for COUNTING requested symbols */
     yyparse();
-    STRACE_INFO(("<%d> variables requested...",tsp_ascii_writer_nb_var));
+    STRACE_INFO("<%d> variables requested...",tsp_ascii_writer_nb_var);
     if (0!=tsp_ascii_writer_parse_error) {
       retcode = TSP_STATUS_ERROR_AW_CONFIG_FILE_PARSE_ERROR;
     }
@@ -320,13 +320,13 @@
     myprovider = TSP_consumer_connect_url(tsp_provider_url);
     /* Verify if the provider was reached */
     if (0==myprovider) {
-      STRACE_ERROR(("Unreachable or no TSP provider running at TSP URL <%s> ?!?",tsp_provider_url));
+      STRACE_ERROR("Unreachable or no TSP provider running at TSP URL <%s> ?!?",tsp_provider_url);
       retcode = TSP_STATUS_ERROR_PROVIDER_UNREACHABLE;
       return retcode;
     } else  {
       retcode =TSP_consumer_request_open(myprovider, 0, 0 );
       if (TSP_STATUS_OK!=retcode) {
-	STRACE_ERROR(("TSP_request_open to TSP URL <%s> FAILED",tsp_provider_url));
+	STRACE_ERROR("TSP_request_open to TSP URL <%s> FAILED",tsp_provider_url);
 	return retcode;
       }
     }
@@ -365,9 +365,9 @@
     for (i=0;i<TSP_SSIList_getSize(current_requestedSSIL);++i) { 
       
       currentSymbol = TSP_SSIList_getSSI(current_requestedSSIL,i);
-      STRACE_INFO(("Examining symbol <%s> of pgi <%d>",
+      STRACE_INFO("Examining symbol <%s> of pgi <%d>",
 		   currentSymbol->name,
-		   currentSymbol->provider_global_index));
+		   currentSymbol->provider_global_index);
 
       if (currentSymbol->provider_global_index == -1)  {
 	my_logMsg("Checking for symbol like <%s> on provider side.\n",currentSymbol->name);
@@ -438,7 +438,7 @@
       if (currentSymbol->phase >= 0) {
 	TSP_SSI_copy(TSP_SSIList_getSSI(*validatedSSIL,valid_index),
 		     *currentSymbol);
-	STRACE_DEBUG(("Asking for TSP var = <%s>",currentSymbol->name));
+	STRACE_DEBUG("Asking for TSP var = <%s>",currentSymbol->name);
 	++valid_index;
       } /* end if tsp_symbols[i].phase >= 0 */
     } /* loop over nb_symbols */
@@ -453,7 +453,7 @@
     retcode = TSP_consumer_request_sample(myprovider,validatedSSIL);
     if (TSP_STATUS_OK!=retcode) {
       TSP_consumer_print_invalid_symbols(stderr,validatedSSIL,tsp_provider_url);
-      STRACE_ERROR(("(final) TSP request sample refused by the provider?huh?..."));
+      STRACE_ERROR("(final) TSP request sample refused by the provider?huh?...");
       return retcode;
     }
   }
@@ -472,7 +472,7 @@
 
     retcode = TSP_consumer_request_extended_information(myprovider, pgis, pgis_len);
     if (TSP_STATUS_OK!=retcode) {
-      STRACE_ERROR(("TSP request extended information refused by the provider?huh?..."));
+      STRACE_ERROR("TSP request extended information refused by the provider?huh?...");
       free(pgis);
     }
     free(pgis);
@@ -719,12 +719,12 @@
 
   /* Demarrage des sample au niveau provider */
   if(TSP_STATUS_OK!=TSP_consumer_request_sample_init(myprovider,0,0)) {
-    STRACE_ERROR(("Sample init refused by the provider??..."));
+    STRACE_ERROR("Sample init refused by the provider??...");
     retcode = -1;
   }
 
   tsp_ascii_writer_sample_running = 1;
-  STRACE_DEBUG(("Begin sample read...\n"));
+  STRACE_DEBUG("Begin sample read...\n");
   if (0 == retcode) 
   {
     nb_sample_item    = 0;
@@ -810,11 +810,11 @@
   if (NULL != myprovider) {
     if (tsp_ascii_writer_sample_running) {
       if (TSP_STATUS_OK!=TSP_consumer_request_sample_destroy(myprovider)) {
-	STRACE_ERROR(("TSP_request_sample_destroy ERROR??..."));
+	STRACE_ERROR("TSP_request_sample_destroy ERROR??...");
       }  
     }
     if (TSP_STATUS_OK!=TSP_consumer_request_close(myprovider)) {
-      STRACE_ERROR(("TSP_request_close ERROR??..."));
+      STRACE_ERROR("TSP_request_close ERROR??...");
     }
   }
   TSP_consumer_end();
diff -urN tsp_orig/src/consumers/generic/generic_consumer_main.c tsp_modified/src/consumers/generic/generic_consumer_main.c
--- tsp_orig/src/consumers/generic/generic_consumer_main.c	2007-03-29 22:42:53.000000000 +0200
+++ tsp_modified/src/consumers/generic/generic_consumer_main.c	2009-01-12 17:26:08.000000000 +0100
@@ -124,7 +124,7 @@
 #endif
 
   if(TSP_STATUS_OK!=TSP_consumer_init(&argc, &argv)) {
-      STRACE_ERROR(("TSP init failed"));
+      STRACE_ERROR("TSP init failed");
       return -1;
   }
 
diff -urN tsp_orig/src/consumers/res_writer/client_res.c tsp_modified/src/consumers/res_writer/client_res.c
--- tsp_orig/src/consumers/res_writer/client_res.c	2007-03-29 22:42:53.000000000 +0200
+++ tsp_modified/src/consumers/res_writer/client_res.c	2009-01-12 17:26:09.000000000 +0100
@@ -86,12 +86,12 @@
 {
   stop = TRUE;
 
-  STRACE_TEST(("Waiting eol and saving file..."));
+  STRACE_TEST("Waiting eol and saving file...");
 }
 
 void usage (char *txt)
 {
-  STRACE_ERROR(("USAGE : %s -f: [-u:] [-tmdh]", txt));
+  STRACE_ERROR("USAGE : %s -f: [-u:] [-tmdh]", txt);
   printf("\t -f filename   : output RES format filename\n");
   printf("\t[-u serverURL] : TSP Universal Resource Locator\n\n");
   printf(TSP_URL_FORMAT_USAGE);
@@ -139,11 +139,11 @@
   MySignal(SIGINT, catch_ctrl_c);
 
 
-  STRACE_INFO(("Autodetect CPU : %d bits", sizeof(long)*8));
+  STRACE_INFO("Autodetect CPU : %d bits", sizeof(long)*8);
 
   /* TSP Init */
   if(TSP_STATUS_OK!=TSP_consumer_init(&argc, &argv)) {
-    STRACE_ERROR(("TSP init failed"));
+    STRACE_ERROR("TSP init failed");
     return -1;
   }
       
@@ -160,7 +160,7 @@
 	    nb_providers++;
 	  else
 	    {
-	      STRACE_ERROR(("Cannot connect to %s", optarg));
+	      STRACE_ERROR("Cannot connect to %s", optarg);
 	    }
 	  break;
 	case 'f':   out_file_res = optarg;      break;
@@ -180,7 +180,7 @@
       providers[nb_providers++] = TSP_consumer_connect_url(NULL);
       if(!providers[0])
         {
-          STRACE_ERROR(("Cannot connect to a TSP provider on local host"));
+          STRACE_ERROR("Cannot connect to a TSP provider on local host");
           usage(argv[0]);
 	 }
     }
@@ -191,7 +191,7 @@
       /* Open requested provider */
       /*-------------------------*/ 
       if (TSP_STATUS_OK!=TSP_consumer_request_open(providers[provider], 0, 0 )) {
-	STRACE_ERROR(("TSP_request_provider_open failed"));
+	STRACE_ERROR("TSP_request_provider_open failed");
 	return -1;
       }
  
@@ -203,7 +203,7 @@
 	{
 	  if(TSP_STATUS_OK!=TSP_consumer_request_information(providers[provider]))
 	    {
-	      STRACE_ERROR(("TSP_request_provider_information failed"));
+	      STRACE_ERROR("TSP_request_provider_information failed");
 	      return -1;
 	    }
 	  
@@ -219,7 +219,7 @@
       
       for( i = 0 ; i< symbols[provider].TSP_sample_symbol_info_list_t_len ; i++)
 	{
-	  STRACE_INFO(("Id=%d Sym='%s'",i, information->symbols.TSP_sample_symbol_info_list_t_val[i].name));
+	  STRACE_INFO("Id=%d Sym='%s'",i, information->symbols.TSP_sample_symbol_info_list_t_val[i].name);
 	  symbols[provider].TSP_sample_symbol_info_list_t_val[i].name = information->symbols.TSP_sample_symbol_info_list_t_val[i].name;
 	  symbols[provider].TSP_sample_symbol_info_list_t_val[i].period = period;
 	  symbols[provider].TSP_sample_symbol_info_list_t_val[i].phase = 0;
@@ -245,7 +245,7 @@
 	  symbols[provider].TSP_sample_symbol_info_list_t_len = 10;
 	  break;
 	default:
-	  STRACE_ERROR(("Unknown test number"));
+	  STRACE_ERROR("Unknown test number");
 	  return -1;
 	}
 
@@ -260,7 +260,7 @@
       /* Ask for sample list */
       /*---------------------*/ 
       if(TSP_STATUS_OK!=TSP_consumer_request_sample(providers[provider],&symbols[provider])) {
-	STRACE_ERROR(("TSP_request_provider_sample failed"));
+	STRACE_ERROR("TSP_request_provider_sample failed");
 	return -1;
       }
     }
@@ -273,7 +273,7 @@
     /* Start sampling */
     /*----------------*/ 
     if (TSP_STATUS_OK!=TSP_consumer_request_sample_init(providers[provider],0,0)) {
-	STRACE_ERROR(("TSP_request_provider_sample_init failed"));
+	STRACE_ERROR("TSP_request_provider_sample_init failed");
 	return -1;
       }
   }
@@ -283,7 +283,7 @@
   /* Loop on data read */
   /*-------------------*/ 
   
-  STRACE_INFO(("file=%s", out_file_res));
+  STRACE_INFO("file=%s", out_file_res);
   d_wopen(out_file_res);
   d_wcom(""); /* No comment */
 
diff -urN tsp_orig/src/consumers/stdout/client_stdout.c tsp_modified/src/consumers/stdout/client_stdout.c
--- tsp_orig/src/consumers/stdout/client_stdout.c	2007-03-29 22:42:53.000000000 +0200
+++ tsp_modified/src/consumers/stdout/client_stdout.c	2009-01-12 17:26:09.000000000 +0100
@@ -193,7 +193,7 @@
   
   if(TSP_STATUS_OK!=TSP_consumer_init(&argc, &argv)) {
     retcode=1;
-    STRACE_ERROR(("TSP init failed"));
+    STRACE_ERROR("TSP init failed");
     return retcode;
   }
 
@@ -203,23 +203,23 @@
   provider = TSP_consumer_connect_url(provider_url);
   if (provider) {
     const char* info = TSP_consumer_get_connected_name(provider) ;
-    STRACE_INFO(("Server %s, info = '%s'", provider_url, info));
+    STRACE_INFO("Server %s, info = '%s'", provider_url, info);
     
     /* Check name */
     if(test_mode && !strstr(info, "StubbedServer")) {
-      STRACE_ERROR(("Serveur name corrupted"));
+      STRACE_ERROR("Serveur name corrupted");
       retcode=2;
-      STRACE_TEST(("STAGE 001 | STEP 001 : FAILED"));
+      STRACE_TEST("STAGE 001 | STEP 001 : FAILED");
       return retcode;
     }	  
   }
   else {
     retcode = 3;
-    STRACE_ERROR(("Unable to find any provider for host"));
+    STRACE_ERROR("Unable to find any provider for host");
     return retcode;
   }
   
-  STRACE_TEST(("STAGE 001 | STEP 001 : PASSED"));
+  STRACE_TEST("STAGE 001 | STEP 001 : PASSED");
 
   /*-------------------------------------------------------------------------------------------------------*/ 
   /* TEST : STAGE 001 | STEP 002 */
@@ -227,26 +227,26 @@
   /* Request Open on the [found] provider */
 
   if(TSP_STATUS_OK!=TSP_consumer_request_open(provider, 0, NULL)) {
-    STRACE_ERROR(("TSP_request_provider_open failed"));
-    STRACE_TEST(("STAGE 001 | STEP 002 : FAILED"));
+    STRACE_ERROR("TSP_request_provider_open failed");
+    STRACE_TEST("STAGE 001 | STEP 002 : FAILED");
     return -1;
   }
   
-  STRACE_TEST(("STAGE 001 | STEP 002 : PASSED"));
+  STRACE_TEST("STAGE 001 | STEP 002 : PASSED");
 
   /*-------------------------------------------------------------------------------------------------------*/ 
   /* TEST : STAGE 001 | STEP 003 */
   /*-------------------------------------------------------------------------------------------------------*/ 
   if(TSP_STATUS_OK!=TSP_consumer_request_information(provider)) {
-    STRACE_ERROR(("TSP_request_provider_information failed"));
-    STRACE_TEST(("STAGE 001 | STEP 003 : FAILED"));
+    STRACE_ERROR("TSP_request_provider_information failed");
+    STRACE_TEST("STAGE 001 | STEP 003 : FAILED");
     return -1;
   }
   
   /* be wild, ask twice to try to trigger mem leak  */
   if(TSP_STATUS_OK!=TSP_consumer_request_information(provider)) {
-    STRACE_ERROR(("TSP_request_provider_information failed"));
-    STRACE_TEST(("STAGE 001 | STEP 003 : FAILED"));
+    STRACE_ERROR("TSP_request_provider_information failed");
+    STRACE_TEST("STAGE 001 | STEP 003 : FAILED");
     return -1;
   }
 
@@ -255,8 +255,8 @@
   if ((TSP_SSIList_getSize(information->symbols) < 1 ) ||
       (TSP_SSIList_getSize(information->symbols) > 999999)
       ) {
-    STRACE_ERROR(("The total number of symbols should be fair, and not %d",TSP_SSIList_getSize(information->symbols)));
-    STRACE_TEST(("STAGE 001 | STEP 003 : FAILED"));
+    STRACE_ERROR("The total number of symbols should be fair, and not %d",TSP_SSIList_getSize(information->symbols));
+    STRACE_TEST("STAGE 001 | STEP 003 : FAILED");
     return -1;      
   }
 
@@ -266,14 +266,14 @@
       sprintf(symbol_buf, "Symbol%d",i);
       if(strcmp(symbol_buf, TSP_SSIList_getSSI(information->symbols,i)->name)) {
 	printf("%s != %s\n", symbol_buf, TSP_SSIList_getSSI(information->symbols,i)->name);
-	STRACE_ERROR(("Symbol name corrupted"));
-	STRACE_TEST(("STAGE 001 | STEP 003 : FAILED"));
+	STRACE_ERROR("Symbol name corrupted");
+	STRACE_TEST("STAGE 001 | STEP 003 : FAILED");
 	return -1;
       }
     }
   }
       
-  STRACE_TEST(("STAGE 001 | STEP 003 : PASSED"));
+  STRACE_TEST("STAGE 001 | STEP 003 : PASSED");
   
   /* Initialize symbols list */
   TSP_SSIList_initialize(&symbols,nb_symbols);
@@ -291,28 +291,28 @@
   /* TEST : STAGE 001 | STEP 004 */
   /*-------------------------------------------------------------------------------------------------------*/ 
   if(TSP_STATUS_OK!=TSP_consumer_request_sample(provider, &symbols)) {
-    STRACE_ERROR(("TSP_request_provider_sample failed"));
-    STRACE_TEST(("STAGE 001 | STEP 004 : FAILED"));
+    STRACE_ERROR("TSP_request_provider_sample failed");
+    STRACE_TEST("STAGE 001 | STEP 004 : FAILED");
     return -1;
   }
   
   /* be wild, ask twice to try to trigger mem leak  */
   if(TSP_STATUS_OK!=TSP_consumer_request_sample(provider, &symbols)) {
-    STRACE_ERROR(("TSP_request_provider_sample failed"));
-    STRACE_TEST(("STAGE 001 | STEP 004 : FAILED"));
+    STRACE_ERROR("TSP_request_provider_sample failed");
+    STRACE_TEST("STAGE 001 | STEP 004 : FAILED");
     return -1;
   }
 
-  STRACE_TEST(("STAGE 001 | STEP 004 : PASSED"));
+  STRACE_TEST("STAGE 001 | STEP 004 : PASSED");
   /*-------------------------------------------------------------------------------------------------------*/ 
   /* TEST : STAGE 001 | STEP 005 */
   /*-------------------------------------------------------------------------------------------------------*/ 
   if(TSP_STATUS_OK!=TSP_consumer_request_sample_init(provider, 0, 0)) {
-    STRACE_ERROR(("TSP_request_provider_sample_init failed"));
-    STRACE_TEST(("STAGE 001 | STEP 005 : FAILED"));
+    STRACE_ERROR("TSP_request_provider_sample_init failed");
+    STRACE_TEST("STAGE 001 | STEP 005 : FAILED");
     return -1;
   }
-  STRACE_TEST(("STAGE 001 | STEP 005 : PASSED"));
+  STRACE_TEST("STAGE 001 | STEP 005 : PASSED");
 
   /*-------------------------------------------------------------------------------------------------------*/ 
   /* TEST : STAGE 001 | STEP 006 */
@@ -354,7 +354,7 @@
 	    /* pgi == 0 is t so don't check for t*/
 	    if(sample.provider_global_index != 0) {
 	      if( (ABS(sample.uvalue.double_value - calc) > 1e-7) && (t == (sample.time - 1)) ) {
-		STRACE_ERROR(("!!!!ERROR : T=%u, I=%d, V1=%f, V2=%f", sample.time,i,sample.uvalue.double_value,calc ));
+		STRACE_ERROR("!!!!ERROR : T=%u, I=%d, V1=%f, V2=%f", sample.time,i,sample.uvalue.double_value,calc );
 		all_data_ok = FALSE;
 	      }
 	    }	  
@@ -368,18 +368,18 @@
 	    if(all_data_ok) {
 	      
 	      printf("\n");
-	      STRACE_TEST(("STAGE 001 | STEP 006 : PASSED" ));			
+	      STRACE_TEST("STAGE 001 | STEP 006 : PASSED" );			
 	      
 	      /* --------------- */
 	      /* Close providers */
 	      /* --------------- */
 	      if(TSP_STATUS_OK!=TSP_consumer_request_sample_destroy(provider)) {
-		STRACE_ERROR(("Function TSP_consumer_request_sample_destroy failed" ));	 
+		STRACE_ERROR("Function TSP_consumer_request_sample_destroy failed" );	 
 	      }
 	      TSP_SSIList_finalize(&symbols);
 		  
 	      if(TSP_STATUS_OK!=TSP_consumer_request_close(provider)) {
-		STRACE_ERROR(("Function TSP_consumer_request_close failed" ));			    
+		STRACE_ERROR("Function TSP_consumer_request_close failed" );			    
 	      }
 		  
 	      TSP_consumer_disconnect_one(provider);	      
@@ -400,7 +400,7 @@
 	}
       }
       else {
-	STRACE_ERROR(("TSP_read_sample failed"));
+	STRACE_ERROR("TSP_read_sample failed");
       }
     } while(new_sample);
     
diff -urN tsp_orig/src/consumers/stdout_callback/client_callback_stdout.c tsp_modified/src/consumers/stdout_callback/client_callback_stdout.c
--- tsp_orig/src/consumers/stdout_callback/client_callback_stdout.c	2006-04-25 00:17:47.000000000 +0200
+++ tsp_modified/src/consumers/stdout_callback/client_callback_stdout.c	2009-01-12 17:26:09.000000000 +0100
@@ -82,7 +82,7 @@
     {
       if((ABS(sample->uvalue.double_value - calc ) > 1e-7) || (0 != strncmp((char*)user_data, USER_DATA, strlen(USER_DATA))))
         {
-          STRACE_ERROR(("!!!!ERROR : T=%u, I=%d, V1=%f, V2=%f", sample->time,i,sample->uvalue.double_value,calc ));			
+          STRACE_ERROR("!!!!ERROR : T=%u, I=%d, V1=%f, V2=%f", sample->time,i,sample->uvalue.double_value,calc );			
           all_data_ok = FALSE;
         }
     }
@@ -118,7 +118,7 @@
   printf ("#===========================================================================#\n");
  
   if (TSP_STATUS_OK!=TSP_consumer_init(&argc, &argv)) {
-    STRACE_ERROR(("TSP init failed"));
+    STRACE_ERROR("TSP init failed");
     return -1;
   }
 
@@ -133,7 +133,7 @@
     }
   else
     {
-      STRACE_ERROR(("USAGE %s : server period <test_mode>\n", argv[0]));
+      STRACE_ERROR("USAGE %s : server period <test_mode>\n", argv[0]);
       return -1;
     }
 
@@ -148,13 +148,13 @@
       for( i = 0 ; i<nb_providers ; i++)
 	{
 	  const char* info = TSP_consumer_get_connected_name(providers[i]) ;
-	  STRACE_INFO(("Server Nb %d, info = '%s'", i, info));
+	  STRACE_INFO("Server Nb %d, info = '%s'", i, info);
 	  
 	  /* Check name */
 	  if(strcmp(info, "StubbedServer"))
 	    {
-	      STRACE_ERROR(("Serveur name corrupted"));
-	      STRACE_TEST(("STAGE 001 | STEP 001 : FAILED"));
+	      STRACE_ERROR("Serveur name corrupted");
+	      STRACE_TEST("STAGE 001 | STEP 001 : FAILED");
 	      return -1;
 	    }
 	  
@@ -162,11 +162,11 @@
     }
   else
     {
-      STRACE_ERROR(("Unable to find any provider for host"));
+      STRACE_ERROR("Unable to find any provider for host");
       return -1;
     }
 
-  STRACE_TEST(("STAGE 001 | STEP 001 : PASSED"));
+  STRACE_TEST("STAGE 001 | STEP 001 : PASSED");
 
 
   /*-------------------------------------------------------------------------------------------------------*/ 
@@ -176,28 +176,28 @@
 
   if(TSP_STATUS_OK!=TSP_consumer_request_open(providers[0], 0, 0))
     {
-      STRACE_ERROR(("TSP_request_provider_open failed"));
-      STRACE_TEST(("STAGE 001 | STEP 002 : FAILED"));
+      STRACE_ERROR("TSP_request_provider_open failed");
+      STRACE_TEST("STAGE 001 | STEP 002 : FAILED");
       return -1;
     }
   
-  STRACE_TEST(("STAGE 001 | STEP 002 : PASSED"));
+  STRACE_TEST("STAGE 001 | STEP 002 : PASSED");
 
   /*-------------------------------------------------------------------------------------------------------*/ 
   /* TEST : STAGE 001 | STEP 003 */
   /*-------------------------------------------------------------------------------------------------------*/ 
   if(TSP_STATUS_OK!=TSP_consumer_request_information(providers[0]))
     {
-      STRACE_ERROR(("TSP_request_provider_information failed"));
-      STRACE_TEST(("STAGE 001 | STEP 003 : FAILED"));
+      STRACE_ERROR("TSP_request_provider_information failed");
+      STRACE_TEST("STAGE 001 | STEP 003 : FAILED");
       return -1;
     }
   
   /* be wild, ask twice to try to trigger mem leak  */
   if(TSP_STATUS_OK!=TSP_consumer_request_information(providers[0]))
     {
-      STRACE_ERROR(("TSP_request_provider_information failed"));
-      STRACE_TEST(("STAGE 001 | STEP 003 : FAILED"));
+      STRACE_ERROR("TSP_request_provider_information failed");
+      STRACE_TEST("STAGE 001 | STEP 003 : FAILED");
       return -1;
     }
 
@@ -207,8 +207,8 @@
   /* Check total symbol number */
   if(1000 !=  information->symbols.TSP_sample_symbol_info_list_t_len )
     {
-      STRACE_ERROR(("The total number of symbols should be 1000"));
-      STRACE_TEST(("STAGE 001 | STEP 003 : FAILED"));
+      STRACE_ERROR("The total number of symbols should be 1000");
+      STRACE_TEST("STAGE 001 | STEP 003 : FAILED");
       return -1;      
     }
 
@@ -218,14 +218,14 @@
       sprintf(symbol_buf, "Symbol%d",i);
       if(strcmp(symbol_buf,  information->symbols.TSP_sample_symbol_info_list_t_val[i].name))
 	{
-	  STRACE_ERROR(("Symbol name corrupted"));
-	  STRACE_TEST(("STAGE 001 | STEP 003 : FAILED"));
+	  STRACE_ERROR("Symbol name corrupted");
+	  STRACE_TEST("STAGE 001 | STEP 003 : FAILED");
 	  return -1;
 	}
       
     }
       
-  STRACE_TEST(("STAGE 001 | STEP 003 : PASSED"));
+  STRACE_TEST("STAGE 001 | STEP 003 : PASSED");
 
   symbols.TSP_sample_symbol_info_list_t_val = (TSP_sample_symbol_info_t*)calloc(information->symbols.TSP_sample_symbol_info_list_t_len, sizeof(TSP_sample_symbol_info_t));
   TSP_CHECK_ALLOC(symbols.TSP_sample_symbol_info_list_t_val, -1);
@@ -242,31 +242,31 @@
   /*-------------------------------------------------------------------------------------------------------*/ 
   if(TSP_STATUS_OK!=TSP_consumer_request_sample(providers[0], &symbols))
     {
-      STRACE_ERROR(("TSP_request_provider_sample failed"));
-      STRACE_TEST(("STAGE 001 | STEP 004 : FAILED"));
+      STRACE_ERROR("TSP_request_provider_sample failed");
+      STRACE_TEST("STAGE 001 | STEP 004 : FAILED");
       return -1;
     }
   /* be wild, ask twice to try to trigger mem leak  */
   if(TSP_STATUS_OK!=TSP_consumer_request_sample(providers[0], &symbols))
     {
-      STRACE_ERROR(("TSP_request_provider_sample failed"));
-      STRACE_TEST(("STAGE 001 | STEP 004 : FAILED"));
+      STRACE_ERROR("TSP_request_provider_sample failed");
+      STRACE_TEST("STAGE 001 | STEP 004 : FAILED");
       return -1;
     }
 
   free(symbols.TSP_sample_symbol_info_list_t_val);
 
-  STRACE_TEST(("STAGE 001 | STEP 004 : PASSED"));
+  STRACE_TEST("STAGE 001 | STEP 004 : PASSED");
   /*-------------------------------------------------------------------------------------------------------*/ 
   /* TEST : STAGE 001 | STEP 005 */
   /*-------------------------------------------------------------------------------------------------------*/ 
   if(TSP_STATUS_OK!=TSP_consumer_request_sample_init(providers[0], test_callback, (void*)(USER_DATA) ))
     {
-      STRACE_ERROR(("TSP_request_provider_sample_init failed"));
-      STRACE_TEST(("STAGE 001 | STEP 005 : FAILED"));
+      STRACE_ERROR("TSP_request_provider_sample_init failed");
+      STRACE_TEST("STAGE 001 | STEP 005 : FAILED");
       return -1;
     }
-  STRACE_TEST(("STAGE 001 | STEP 005 : PASSED"));
+  STRACE_TEST("STAGE 001 | STEP 005 : PASSED");
 
   /*-------------------------------------------------------------------------------------------------------*/ 
   /* TEST : STAGE 001 | STEP 006 */
@@ -280,7 +280,7 @@
           if(all_data_ok)
             {
               
-              STRACE_TEST(("STAGE 001 | STEP 006 : PASSED" ));			
+              STRACE_TEST("STAGE 001 | STEP 006 : PASSED" );			
               
               /* If test mode, the return code is the number of opened providers */
               /* --------------- */
@@ -288,12 +288,12 @@
               /* --------------- */
               if(TSP_STATUS_OK!=TSP_consumer_request_sample_destroy(providers[0]))
                 {
-                  STRACE_ERROR(("Function TSP_consumer_request_sample_destroy failed" ));	 
+                  STRACE_ERROR("Function TSP_consumer_request_sample_destroy failed" );	 
                 }
               
               if(TSP_STATUS_OK!=TSP_consumer_request_close(providers[0]))
                 {
-                  STRACE_ERROR(("Function TSP_consumer_request_close failed" ));			    
+                  STRACE_ERROR("Function TSP_consumer_request_close failed" );			    
                 }
               
               TSP_consumer_disconnect_all(providers);
diff -urN tsp_orig/src/consumers/test_group/client_group.c tsp_modified/src/consumers/test_group/client_group.c
--- tsp_orig/src/consumers/test_group/client_group.c	2006-04-25 00:17:47.000000000 +0200
+++ tsp_modified/src/consumers/test_group/client_group.c	2009-01-12 17:26:09.000000000 +0100
@@ -140,7 +140,7 @@
 
   if(TSP_STATUS_OK!=TSP_consumer_init(&argc, &argv))
     {
-      STRACE_ERROR(("TSP init failed"));
+      STRACE_ERROR("TSP init failed");
       return -1;
     }
 
@@ -153,7 +153,7 @@
     }
   else
     {
-      STRACE_ERROR(("USAGE %s : server period\n", argv[0]));
+      STRACE_ERROR("USAGE %s : server period\n", argv[0]);
       return -1;
     }
 
@@ -167,12 +167,12 @@
       for( i = 0 ; i<nb_providers ; i++)
 	{
 	  const char* info = TSP_consumer_get_connected_name(providers[i]) ;
-	  STRACE_INFO(("Server Nb %d, info = '%s'", i,info));
+	  STRACE_INFO("Server Nb %d, info = '%s'", i,info);
 	  
 	  /* Check name */
 	  if(strcmp(info, "StubbedServer"))
 	    {
-	      STRACE_ERROR(("Serveur name corrupted"));
+	      STRACE_ERROR("Serveur name corrupted");
 	      return -1;
 	    }
 	  
@@ -180,7 +180,7 @@
     }
   else
     {
-      STRACE_ERROR(("Unable to find any provider for host"));
+      STRACE_ERROR("Unable to find any provider for host");
       return -1;
     }
 
@@ -193,7 +193,7 @@
   /* Le 1er provider existe puisqu'il y en a au moins 1 */
 
   if(TSP_STATUS_OK!=TSP_consumer_request_open(providers[0], 0, 0)) {
-    STRACE_ERROR(("TSP_request_provider_open failed"));
+    STRACE_ERROR("TSP_request_provider_open failed");
     return -1;
   }
   
@@ -203,13 +203,13 @@
   /*-------------------------------------------------------------------------------------------------------*/ 
   if(TSP_STATUS_OK!=TSP_consumer_request_information(providers[0]))
     {
-      STRACE_ERROR(("TSP_request_provider_information failed"));
+      STRACE_ERROR("TSP_request_provider_information failed");
       return -1;
     }
   
   /* How many symbols do we want to send ? */
   for(requested_nb = 0; data_test[requested_nb].index != (-2); requested_nb++);
-  STRACE_INFO(("Total number of requested symbols = %d", requested_nb));
+  STRACE_INFO("Total number of requested symbols = %d", requested_nb);
 
 
   symbols.TSP_sample_symbol_info_list_t_len = requested_nb;
@@ -227,7 +227,7 @@
   /*-------------------------------------------------------------------------------------------------------*/ 
   if(TSP_STATUS_OK!=TSP_consumer_request_sample(providers[0], &symbols))
     {
-      STRACE_ERROR(("TSP_request_provider_sample failed"));
+      STRACE_ERROR("TSP_request_provider_sample failed");
       return -1;
     }
 
@@ -241,7 +241,7 @@
 
   if( group_nb != groups->table_len )
     {
-      STRACE_ERROR(("Wrong groups total number"));
+      STRACE_ERROR("Wrong groups total number");
       return -1;
     }
 
@@ -254,7 +254,7 @@
 	for(size = 0; group_test[i].index[size] != (-1); size++);
 	if ( size != groups->groups[i].group_len )
 	  {
-	    STRACE_ERROR(("Wrong groups size"));
+	    STRACE_ERROR("Wrong groups size");
 	    return -1;
 	  }
       }
@@ -268,13 +268,13 @@
 	{
 	  if (  group_test[i].index[j] != groups->groups[i].items[j].provider_global_index )
 	    {
-	      STRACE_ERROR(("Wrong provider global index"));
+	      STRACE_ERROR("Wrong provider global index");
 	      return -1;
 	    }
 	}
     }
 
-  STRACE_TEST(("STAGE 002 | STEP 001 : PASSED"));
+  STRACE_TEST("STAGE 002 | STEP 001 : PASSED");
   printf ("#=========================================================#\n");
   printf ("# End <test_group> OK #\n");
   printf ("#=========================================================#\n");
diff -urN tsp_orig/src/consumers/tspfs/tspfs.c tsp_modified/src/consumers/tspfs/tspfs.c
--- tsp_orig/src/consumers/tspfs/tspfs.c	2007-03-25 23:32:29.000000000 +0200
+++ tsp_modified/src/consumers/tspfs/tspfs.c	2009-01-12 17:26:09.000000000 +0100
@@ -244,11 +244,11 @@
 		free(tspfs.idx_to_pgi);
 
 	if (tspfs.sync && (TSP_STATUS_OK!=TSP_consumer_request_sample_destroy(tspfs.provider))) {
-		STRACE_ERROR(("Function TSP_consumer_request_sample_destroy failed"));
+		STRACE_ERROR("Function TSP_consumer_request_sample_destroy failed");
 	}
 
 	if (TSP_STATUS_OK!=TSP_consumer_request_close(tspfs.provider)) {
-		STRACE_ERROR(("Function TSP_consumer_request_close failed"));
+		STRACE_ERROR("Function TSP_consumer_request_close failed");
 	}
 
 	TSP_consumer_end();
diff -urN tsp_orig/src/core/CMakeLists.txt tsp_modified/src/core/CMakeLists.txt
--- tsp_orig/src/core/CMakeLists.txt	2007-04-27 10:46:38.000000000 +0200
+++ tsp_modified/src/core/CMakeLists.txt	2009-01-12 17:26:08.000000000 +0100
@@ -10,11 +10,11 @@
   include/tsp_abs_types.h
   include/tsp_const_def.h
   include/tsp_glu.h
-  include/tsp_simple_trace.h
   include/tsp_sys_headers.h
   rpc/tsp_datastruct.h)
 TSP_XINCLUDE(${INCLUDE_CORE_FILE})
 
+
 #tsp_rpc.h is generated a thus deserves a special treatment
 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/rpc/tsp_rpc.h DESTINATION include)
 
@@ -40,7 +40,10 @@
 
 TSP_XINCLUDE(${SERVICES_LIB_SRCS} misc_utils/tsp_ringbuf misc_utils/tsp_services)
 ADD_LIBRARY(tsp_services ${SERVICES_LIB_SRCS})
-TARGET_LINK_LIBRARIES(tsp_services ${PTHREAD_LIBRARY_NAME})
+
+IF(NOT BUILD_VXWORKS)
+   TARGET_LINK_LIBRARIES(tsp_services ${PTHREAD_LIBRARY_NAME})
+ENDIF(NOT BUILD_VXWORKS)
 
 IF (WIN32) 
   TARGET_LINK_LIBRARIES(tsp_services Ws2_32 oncrpc)
@@ -63,6 +66,7 @@
   common/tsp_common_ssei
   common/tsp_common_as
   common/tsp_common_status
+  common/tsp_common_trace
   common/tsp_encoder
   common/tsp_decoder)
 
@@ -106,9 +110,9 @@
   ADD_LIBRARY(tsp_consumer ${CONSUMER_LIB_SRCS})
   TSP_LIBRARY_INSTALL(tsp_consumer) 
   ADD_DEPENDENCIES(tsp_consumer tsp_common rpcgen_exec_clnt)
-  IF (WIN32)
+  IF (WIN32 AND NOT BUILD_VXWORKS)
     TARGET_LINK_LIBRARIES(tsp_consumer tsp_services ${PTHREAD_LIBRARY_NAME} Ws2_32 oncrpc)
-  ENDIF (WIN32)
+  ENDIF (WIN32 AND NOT BUILD_VXWORKS)
 ENDIF(BUILD_CONSUMER)
 
 #
@@ -125,8 +129,8 @@
             xmlrpc/tsp_xmlrpc_util)	
         ADD_DEFINITIONS(-DBUILD_XMLRPC)        
     ENDIF (BUILD_XMLRPC)  
-      
-    # PROVIDER SRC
+
+     # PROVIDER SRC
 	SET(PROVIDER_LIB_SRCS
 	${PROVIDER_LIB_SRCS}
 	ctrl/tsp_default_glu
@@ -137,7 +141,7 @@
 	ctrl/tsp_data_sender
 	ctrl/tsp_stream_sender
 	ctrl_init/tsp_provider_init)
-	
+  
 	TSP_XINCLUDE(${PROVIDER_LIB_SRCS})
 	
 	SET(PROVIDER_LIB_SRCS
@@ -150,7 +154,7 @@
 	${PROVIDER_LIB_SRCS}
 	${tsp_rpc_RPCGEN_OUTPUT_SVC}
 	rpc/tsp_server
-	rpc/tsp_rpc_confprogid)
+       	rpc/tsp_rpc_confprogid)
     
     # PROVIDER LIB    
     ADD_LIBRARY(tsp_provider ${PROVIDER_LIB_SRCS})
@@ -159,13 +163,17 @@
     IF (WIN32)		
       TARGET_LINK_LIBRARIES(tsp_provider tsp_services ${PTHREAD_LIBRARY_NAME} Ws2_32 oncrpc)
     ENDIF (WIN32)
-    
-    ADD_EXECUTABLE(tsp_rpc_cleanup rpc/tsp_rpc_cleanup.c rpc/tsp_rpc_confprogid)
-    TSP_PROGRAM_INSTALL(tsp_rpc_cleanup)
-    ADD_DEPENDENCIES(tsp_rpc_cleanup tsp_common tsp_provider tsp_services)
+
+    IF (NOT BUILD_VXWORKS)
+	   ADD_EXECUTABLE(tsp_rpc_cleanup rpc/tsp_rpc_cleanup.c rpc/tsp_rpc_confprogid)
+	   TSP_PROGRAM_INSTALL(tsp_rpc_cleanup)
+	   ADD_DEPENDENCIES(tsp_rpc_cleanup tsp_common tsp_provider tsp_services)
+    ENDIF (NOT BUILD_VXWORKS)
     IF (WIN32)		
-      TARGET_LINK_LIBRARIES(tsp_rpc_cleanup tsp_services Ws2_32 oncrpc)		
+      TARGET_LINK_LIBRARIES(tsp_rpc_cleanup tsp_services Ws2_32 oncrpc)	
     ELSE (WIN32)
-      TARGET_LINK_LIBRARIES(tsp_rpc_cleanup tsp_services ${ONCRPC_LIBRARY})
+	 IF (NOT BUILD_VXWORKS)
+		TARGET_LINK_LIBRARIES(tsp_rpc_cleanup tsp_services ${ONCRPC_LIBRARY})
+	 ENDIF (NOT BUILD_VXWORKS)
     ENDIF (WIN32)	
 ENDIF(BUILD_PROVIDER)
diff -urN tsp_orig/src/core/common/tsp_common_as.c tsp_modified/src/core/common/tsp_common_as.c
--- tsp_orig/src/core/common/tsp_common_as.c	2006-10-18 11:58:48.000000000 +0200
+++ tsp_modified/src/core/common/tsp_common_as.c	2009-01-12 17:26:08.000000000 +0100
@@ -39,7 +39,7 @@
 #include <tsp_sys_headers.h>
 #include <tsp_abs_types.h>
 #include <tsp_datastruct.h>
-#include <tsp_simple_trace.h>
+#include <tsp_common_trace.h>
 #include <tsp_const_def.h>
 #include <tsp_common_macros.h>
 #define TSP_COMMON_AS_C
diff -urN tsp_orig/src/core/common/tsp_common.c tsp_modified/src/core/common/tsp_common.c
--- tsp_orig/src/core/common/tsp_common.c	2006-11-24 19:15:38.000000000 +0100
+++ tsp_modified/src/core/common/tsp_common.c	2009-01-12 17:26:08.000000000 +0100
@@ -35,15 +35,15 @@
 -----------------------------------------------------------------------
  */
 #include <string.h>
-
 #include <tsp_sys_headers.h>
 #include <tsp_abs_types.h>
 #include <tsp_datastruct.h>
-#include <tsp_simple_trace.h>
+#include <tsp_common_trace.h>
 #include <tsp_const_def.h>
 #define TSP_COMMON_C
 #include <tsp_common.h>
 
+
 #ifdef WIN32
     #define assert(exp)     ((void)0)
 #else
diff -urN tsp_orig/src/core/common/tsp_common.h tsp_modified/src/core/common/tsp_common.h
--- tsp_orig/src/core/common/tsp_common.h	2006-10-18 11:58:48.000000000 +0200
+++ tsp_modified/src/core/common/tsp_common.h	2009-01-12 17:26:08.000000000 +0100
@@ -34,7 +34,6 @@
 
 -----------------------------------------------------------------------
  */
-
 #ifndef _TSP_COMMON_H
 #define _TSP_COMMON_H
 
diff -urN tsp_orig/src/core/common/tsp_common_macros.h tsp_modified/src/core/common/tsp_common_macros.h
--- tsp_orig/src/core/common/tsp_common_macros.h	2006-05-03 23:13:34.000000000 +0200
+++ tsp_modified/src/core/common/tsp_common_macros.h	2009-01-12 17:26:08.000000000 +0100
@@ -91,4 +91,39 @@
       }
 
 
+//definition for vxworks (doesn't handle IPv6)
+#ifdef VXWORKS
+#define ALLOCA_ALLOC(size) malloc(size)
+#define ALLOCA_FREE(ptr) free(ptr)
+#define GETHOSTBYNAME(hostname,myhost,addr)      \
+  myhost=(struct hostent *)calloc(1,sizeof(struct hostent));\
+  myhost->h_addr_list=(char**)calloc(1,sizeof(char*));\
+  myhost->h_addr_list[0]=(char*)calloc(1,INET_ADDR_LEN);\
+  if(myhost==NULL) STRACE_ERROR("memory allocation failed");\
+  if( hostGetByName(hostname)== -1)\
+  { \
+       STRACE_ERROR("Cannot gethostbyname '(hostname --> @IP)' for host <%s> check your /etc/hosts file.\n",hostname);\
+       free(myhost);\
+       myhost=NULL;\
+  }else{\
+       addr.s_addr=hostGetByName(hostname);\
+       inet_ntoa_b(addr,myhost->h_addr_list[0]);\
+       myhost->h_addrtype=AF_INET;\
+       myhost->h_length=4;\
+  }
+#define GETHOSTBYNAME_FREE(myhost)\
+  if(myhost!=NULL)\
+  {  if(myhost->h_addr_list != NULL) free(myhost->h_addr_list);\
+     free(myhost);\
+  }
+#else /*VXWORKS*/
+#define ALLOCA_ALLOC(size) alloca(size)
+#define ALLOCA_FREE(ptr)
+#define GETHOSTBYNAME(hostname,myhost,addr)\
+     myhost=gethostbyname(name);\
+     if(myhost == NULL)  STRACE_ERROR("Cannot gethostbyname '(hostname --> @IP)' for host <%s> check your /etc/hosts file.\n",host);
+#define GETHOSTBYNAME_FREE(myhost)
+#endif/*VXWORKS*/
+
+
 #endif /* _TSP_COMMON_MACROS_H */
diff -urN tsp_orig/src/core/common/tsp_common_request.c tsp_modified/src/core/common/tsp_common_request.c
--- tsp_orig/src/core/common/tsp_common_request.c	2006-10-18 11:58:48.000000000 +0200
+++ tsp_modified/src/core/common/tsp_common_request.c	2009-01-12 17:26:08.000000000 +0100
@@ -39,7 +39,7 @@
 #include <tsp_sys_headers.h>
 #include <tsp_abs_types.h>
 #include <tsp_datastruct.h>
-#include <tsp_simple_trace.h>
+#include <tsp_common_trace.h>
 #include <tsp_const_def.h>
 #define TSP_COMMON_REQUEST_C
 #include <tsp_common_request.h>
diff -urN tsp_orig/src/core/common/tsp_common_ssei.c tsp_modified/src/core/common/tsp_common_ssei.c
--- tsp_orig/src/core/common/tsp_common_ssei.c	2006-10-18 11:58:48.000000000 +0200
+++ tsp_modified/src/core/common/tsp_common_ssei.c	2009-01-12 17:26:08.000000000 +0100
@@ -39,7 +39,7 @@
 #include <tsp_sys_headers.h>
 #include <tsp_abs_types.h>
 #include <tsp_datastruct.h>
-#include <tsp_simple_trace.h>
+#include <tsp_common_trace.h>
 #include <tsp_const_def.h>
 #define TSP_COMMON_SSEI_C
 #include <tsp_common_ssei.h>
diff -urN tsp_orig/src/core/common/tsp_common_ssi.c tsp_modified/src/core/common/tsp_common_ssi.c
--- tsp_orig/src/core/common/tsp_common_ssi.c	2006-10-18 11:58:48.000000000 +0200
+++ tsp_modified/src/core/common/tsp_common_ssi.c	2009-01-12 17:26:08.000000000 +0100
@@ -39,7 +39,7 @@
 #include <tsp_sys_headers.h>
 #include <tsp_abs_types.h>
 #include <tsp_datastruct.h>
-#include <tsp_simple_trace.h>
+#include <tsp_common_trace.h>
 #include <tsp_const_def.h>
 #define TSP_COMMON_SSI_C
 #include <tsp_common_ssi.h>
@@ -114,7 +114,7 @@
     ssi->name                 = strdup(name);
     if (NULL==ssi->name) {
       retcode = TSP_STATUS_ERROR_MEMORY_ALLOCATION;
-      STRACE_ERROR(("Cannot strdup <%s>",name));
+      STRACE_ERROR("Cannot strdup <%s>",name);
     }
   } else {
     ssi->name                 = NULL;
diff -urN tsp_orig/src/core/common/tsp_common_status.c tsp_modified/src/core/common/tsp_common_status.c
--- tsp_orig/src/core/common/tsp_common_status.c	2007-04-26 19:51:30.000000000 +0200
+++ tsp_modified/src/core/common/tsp_common_status.c	2009-01-12 17:26:08.000000000 +0100
@@ -39,7 +39,7 @@
 #include <tsp_sys_headers.h>
 #include <tsp_abs_types.h>
 #include <tsp_datastruct.h>
-#include <tsp_simple_trace.h>
+#include <tsp_common_trace.h>
 #include <tsp_const_def.h>
 #include <tsp_common_macros.h>
 #define TSP_COMMON_STATUS_C
diff -urN tsp_orig/src/core/common/tsp_common_trace.c tsp_modified/src/core/common/tsp_common_trace.c
--- tsp_orig/src/core/common/tsp_common_trace.c	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/core/common/tsp_common_trace.c	2009-01-12 17:26:08.000000000 +0100
@@ -0,0 +1,137 @@
+/*
+
+$Id: tsp_common_trace.c,v 1.2 2008/08/02 11:01:46 deweerdt Exp $
+
+-----------------------------------------------------------------------
+
+TSP Library - core components for a generic Transport Sampling Protocol.
+
+Copyright (c) 2008 Robert de Vries
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+-----------------------------------------------------------------------
+
+Project    : TSP
+Maintainer : tsp@astrium.eads.net
+Component  : common
+
+-----------------------------------------------------------------------
+
+Purpose   : Tracing and error/warning message generation
+
+-----------------------------------------------------------------------
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <assert.h>
+
+#include "tsp_common_trace.h"
+
+
+static void default_trace_func(int level, const char *name, const char *file, const char *func, int line, const char *format, va_list args);
+
+static unsigned long int strace_debug_level = 0;
+static TSP_trace_func trace = default_trace_func;
+
+
+static const char *level_name(int level)
+{
+    switch(level) {
+    case STRACE_LEVEL_ERROR:
+	return "ERROR";
+    case STRACE_LEVEL_WARNING:
+	return "Warning";
+    case STRACE_LEVEL_INFO:
+	return "Info";
+    case STRACE_LEVEL_REQUEST:
+	return "Request";
+    case STRACE_LEVEL_DEBUG:
+	return "Debug";
+    case STRACE_LEVEL_DEBUG_MORE:
+	return "Debug More";
+    case STRACE_LEVEL_TEST:
+	return "Test";
+    }
+    return "???";
+}
+
+
+static void default_trace_func(int level, const char *name, const char *file, const char *func, int line, const char *format, va_list args)
+{
+    fprintf(stderr, "%7s||%s##%s##%d: ", name, file, func, line);
+    vfprintf(stderr, format, args);
+    putc('\n', stderr);
+    fflush(stderr);
+}
+
+static void _trace(int level, const char *file, const char *func, int line, const char *format, ...)
+{
+    va_list args;
+    va_start(args, format);
+    trace(level, level_name(level), file, func, line, format, args);
+    va_end(args);
+}
+
+static void init_strace_debug_level(void)
+{
+    char *end;
+    int new_level;
+    char *strace_env = getenv("STRACE_DEBUG");
+    if (strace_env == NULL) return;
+
+    new_level = strtoul(strace_env, &end, 0);
+    assert(errno != EINVAL); /* programming error, base contains an unsupported value */
+    if (*end != 0) {
+	_trace(STRACE_LEVEL_ERROR, __FILE__, __func__, __LINE__, "STRACE_DEBUG environment variable has trailing garbage");
+	return;
+    }
+    
+    if (errno == ERANGE) {
+	_trace(STRACE_LEVEL_ERROR, __FILE__, __func__, __LINE__, "STRACE_DEBUG environment variable value out of range");
+	return;
+    }
+
+    strace_debug_level = new_level;
+}
+
+void TSP_trace(int level, const char *file, const char *func, int line, const char *format, ...)
+{
+    static int first_time = 1;
+
+    if (first_time) {
+	first_time = 0;
+	init_strace_debug_level();
+    }
+    if ((0==level) || (strace_debug_level & level) ) {
+	va_list args;
+	va_start(args, format);
+	trace(level, level_name(level), file, func, line, format, args);
+	va_end(args);
+    }		    
+}
+
+void TSP_trace_install(TSP_trace_func trace_func)
+{
+    trace = trace_func;
+}
+
+void TSP_trace_set_debug_level(unsigned long int level)
+{
+    strace_debug_level = level;
+}
diff -urN tsp_orig/src/core/common/tsp_common_trace.h tsp_modified/src/core/common/tsp_common_trace.h
--- tsp_orig/src/core/common/tsp_common_trace.h	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/core/common/tsp_common_trace.h	2009-01-12 17:26:08.000000000 +0100
@@ -0,0 +1,92 @@
+/*
+
+$Id: tsp_common_trace.h,v 1.3 2008/10/03 07:49:29 rhdv Exp $
+
+-----------------------------------------------------------------------
+
+TSP Library - core components for a generic Transport Sampling Protocol.
+
+Copyright (c) 2008 Robert de Vries
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+-----------------------------------------------------------------------
+
+Project    : TSP
+Maintainer : tsp@astrium.eads.net
+Component  : common
+
+-----------------------------------------------------------------------
+
+Purpose   : Tracing and error/warning message generation
+
+-----------------------------------------------------------------------
+ */
+
+#ifndef _TSP_COMMON_TRACE_H
+#define _TSP_COMMON_TRACE_H
+
+#include <stdarg.h>
+#include <tsp_prjcfg.h>
+
+typedef void (*TSP_trace_func)(int level, const char *source, const char *file, const char *func, int line, const char *format, va_list args);
+
+#if __GNUC__ >= 3
+#define PRINTF_ATTRIBUTE __attribute__ ((__format__ (__printf__, 5, 6)))
+#else
+#define PRINTF_ATTRIBUTE
+#endif
+
+extern void TSP_trace(int level, const char *file, const char *func, int line, const char *format, ...) PRINTF_ATTRIBUTE;
+
+void TSP_trace_install(TSP_trace_func trace_func);
+
+void TSP_trace_set_debug_level(unsigned long int level);
+
+
+#ifndef S_SPLINT_S
+#if defined(__GNUC__) || defined(_MSC_VER)
+#define __func__ __FUNCTION__
+#else
+#define __func__ "where?"
+#endif
+#endif	/* S_SPLINT_S */
+
+#define STRACE_LEVEL_ERROR       (0)
+#define STRACE_LEVEL_WARNING     (1)
+#define STRACE_LEVEL_INFO        (2)
+#define STRACE_LEVEL_REQUEST     (4)
+#define STRACE_LEVEL_DEBUG       (8)
+#define STRACE_LEVEL_DEBUG_MORE (16)
+#define STRACE_LEVEL_TEST       (32)
+
+#ifdef  USE_STRACE
+# define STRACE_TEST(...)	TSP_trace(STRACE_LEVEL_TEST,       __FILE__, __func__, __LINE__, __VA_ARGS__)
+# define STRACE_DEBUG_MORE(...)	TSP_trace(STRACE_LEVEL_DEBUG_MORE, __FILE__, __func__, __LINE__, __VA_ARGS__)
+# define STRACE_DEBUG(...)	TSP_trace(STRACE_LEVEL_DEBUG,      __FILE__, __func__, __LINE__, __VA_ARGS__)
+# define STRACE_REQUEST( ...)	TSP_trace(STRACE_LEVEL_REQUEST,    __FILE__, __func__, __LINE__, __VA_ARGS__)
+# define STRACE_INFO(...)	TSP_trace(STRACE_LEVEL_INFO,       __FILE__, __func__, __LINE__, __VA_ARGS__)
+#else
+# define STRACE_TEST(...)
+# define STRACE_DEBUG_MORE(...)
+# define STRACE_DEBUG(...)
+# define STRACE_REQUEST(...)
+# define STRACE_INFO(...)
+#endif
+
+#define STRACE_WARNING(...)	 TSP_trace(STRACE_LEVEL_WARNING, __FILE__, __func__, __LINE__, __VA_ARGS__)
+#define STRACE_ERROR(...)	 TSP_trace(STRACE_LEVEL_ERROR,   __FILE__, __func__, __LINE__, __VA_ARGS__)
+
+#endif	/* _TSP_COMMON_TRACE_H */
diff -urN tsp_orig/src/core/common/tsp_decoder.c tsp_modified/src/core/common/tsp_decoder.c
--- tsp_orig/src/core/common/tsp_decoder.c	2007-01-26 17:47:19.000000000 +0100
+++ tsp_modified/src/core/common/tsp_decoder.c	2009-01-12 17:26:08.000000000 +0100
@@ -38,11 +38,13 @@
 #include <rpc/rpc.h>
 #include <rpc/types.h>
 #include <rpc/xdr.h>
- 
+
 #include <tsp_const_def.h>
 #include <tsp_datastruct.h>
-#include <tsp_simple_trace.h>
+#include <tsp_common_trace.h>
 #include <tsp_decoder.h>
+//For ALLOCA_XXX macro
+#include <tsp_common_macros.h>
 
 #if defined(sun) || defined(__sun)
 #include <alloca.h>
@@ -69,7 +71,7 @@
   {
     if( xdr_double(&xhandle, (double*)out_double+i) != TRUE)
     {
-      STRACE_ERROR(("Function xdr_double failed"));
+      STRACE_ERROR("Function xdr_double failed");
       return FALSE;
     }
     else
@@ -83,7 +85,7 @@
   for(i=0;i<dimension;++i)
   {
     ((uint64_t*)out_double)[i] = TSP_DECODE_DOUBLE_TO_UINT64(in_buf+(i*TSP_SIZEOF_ENCODED_DOUBLE));   
-    STRACE_DEBUG(("decoded DOUBLE = %f, (received) encoded DOUBLE=0x%08llx",((double*)out_double)[i],((uint64_t*)in_buf)[i]));
+    STRACE_DEBUG("decoded DOUBLE = %f, (received) encoded DOUBLE=0x%08llx",((double*)out_double)[i],((uint64_t*)in_buf)[i]);
   }
 #endif
 
@@ -105,7 +107,7 @@
   {
     if( xdr_float(&xhandle, (float*)out_float+i) != TRUE)
     {
-      STRACE_ERROR(("Function xdr_float failed"));
+      STRACE_ERROR("Function xdr_float failed");
       return FALSE;
     }
     else
@@ -129,8 +131,8 @@
 int32_t TSP_data_channel_int8_decoder(void* out_int8, uint32_t dimension,  char* in_buf)
 {
   uint32_t i;
-  int32_t* out_temp = alloca(sizeof(int32_t)*dimension);
 
+  int32_t* out_temp = ALLOCA_ALLOC(sizeof(int32_t)*dimension);
 
   if(TSP_data_channel_int32_decoder((void *)(&out_temp[0]), dimension, in_buf))
   {
@@ -138,11 +140,18 @@
     {
       ((int8_t *)out_int8)[i]=(int8_t)(out_temp[i]);
     }
+
+    ALLOCA_FREE(out_temp);
+
     return TRUE;
   }
   else
   {
+
+    ALLOCA_FREE(out_temp);
+
     return FALSE;
+
   }
 }
 
@@ -150,8 +159,8 @@
 {
 
   uint32_t i;
-  int32_t* out_temp = alloca(sizeof(int32_t)*dimension);
 
+  int32_t* out_temp = ALLOCA_ALLOC(sizeof(int32_t)*dimension);
 
   if(TSP_data_channel_int32_decoder((void *)(&out_temp[0]), dimension, in_buf))
   {
@@ -159,10 +168,16 @@
     {
       ((int16_t *)out_int16)[i]=(int16_t)(out_temp[i]);
     }
+
+    ALLOCA_FREE(out_temp);
+
     return TRUE;
   }
   else
   {
+
+    ALLOCA_FREE(out_temp);
+
     return FALSE;
   }
 }
@@ -182,7 +197,7 @@
   {
     if( xdr_int(&xhandle, (int32_t*)out_int32+i) != TRUE)
     {
-      STRACE_ERROR(("Function xdr_float failed"));
+      STRACE_ERROR("Function xdr_float failed");
       return FALSE;
     }
     else
@@ -217,7 +232,7 @@
   {
     if( xdr_hyper(&xhandle, (int64_t*)out_int64+i) != TRUE)
     {
-      STRACE_ERROR(("Function xdr_float failed"));
+      STRACE_ERROR("Function xdr_float failed");
       return FALSE;
     }
     else
@@ -241,8 +256,8 @@
 int32_t TSP_data_channel_uint8_decoder(void* out_uint8, uint32_t dimension,  char* in_buf)
 {
   uint32_t i;
-  int32_t* out_temp = alloca(sizeof(int32_t)*dimension);
 
+  int32_t* out_temp = ALLOCA_ALLOC(sizeof(int32_t)*dimension);
 
   if(TSP_data_channel_int32_decoder((void *)(&out_temp[0]), dimension, in_buf))
   {
@@ -250,10 +265,16 @@
     {
       ((uint8_t *)out_uint8)[i]=(uint8_t)(out_temp[i]);
     }
+
+    ALLOCA_FREE(out_temp);
+
     return TRUE;
   }
   else
   {
+
+    ALLOCA_FREE(out_temp);
+
     return FALSE;
   }
 }
@@ -261,8 +282,8 @@
 int32_t TSP_data_channel_uint16_decoder(void* out_uint16, uint32_t dimension,  char* in_buf)
 {
   uint32_t i;
-  int32_t* out_temp = alloca(sizeof(int32_t)*dimension);
 
+  int32_t* out_temp = ALLOCA_ALLOC(sizeof(int32_t)*dimension);
 
   if(TSP_data_channel_int32_decoder((void *)(&out_temp[0]), dimension, in_buf))
   {
@@ -270,10 +291,16 @@
     {
       ((uint16_t *)out_uint16)[i]=(uint16_t)(out_temp[i]);
     }
+
+    ALLOCA_FREE(out_temp);
+
     return TRUE;
   }
   else
   {
+
+    ALLOCA_FREE(out_temp);
+
     return FALSE;
   }
 }
@@ -292,7 +319,7 @@
   {
     if( xdr_int(&xhandle, (uint32_t*)out_uint32+i) != TRUE)
     {
-      STRACE_ERROR(("Function xdr_float failed"));
+      STRACE_ERROR("Function xdr_float failed");
       return FALSE;
     }
     else
@@ -327,7 +354,7 @@
   {
     if( xdr_hyper(&xhandle, (uint64_t*)out_uint64+i) != TRUE)
     {
-      STRACE_ERROR(("Function xdr_float failed"));
+      STRACE_ERROR("Function xdr_float failed");
       return FALSE;
     }
     else
@@ -352,8 +379,8 @@
 {
 
   uint32_t i;
-  int32_t* out_temp = alloca(sizeof(int32_t)*dimension);
 
+  int32_t* out_temp = ALLOCA_ALLOC(sizeof(int32_t)*dimension);
 
   if(TSP_data_channel_int32_decoder((void *)(&out_temp[0]), dimension, in_buf))
   {
@@ -361,10 +388,16 @@
     {
       ((char *)out_char)[i]=(char)(out_temp[i]);
     }
+
+    ALLOCA_FREE(out_temp);
+
     return TRUE;
   }
   else
   {
+
+    ALLOCA_FREE(out_temp);
+
     return FALSE;
   }
 }
@@ -373,8 +406,8 @@
 {
 
   uint32_t i;
-  int32_t* out_temp = alloca(sizeof(int32_t)*dimension);
 
+  int32_t* out_temp = ALLOCA_ALLOC(sizeof(int32_t)*dimension);
 
   if(TSP_data_channel_int32_decoder((void *)(&out_temp[0]), dimension, in_buf))
   {
@@ -382,10 +415,16 @@
     {
       ((unsigned char *)out_uchar)[i]=(unsigned char)(out_temp[i]);
     }
+
+    ALLOCA_FREE(out_temp);
+
     return TRUE;
   }
   else
   {
+
+    ALLOCA_FREE(out_temp);
+
     return FALSE;
   }
 }
@@ -394,8 +433,8 @@
 {
 
   uint32_t i;
-  int32_t* out_temp = alloca(sizeof(int32_t)*dimension);
 
+  int32_t* out_temp = ALLOCA_ALLOC(sizeof(int32_t)*dimension);
 
   if(TSP_data_channel_int32_decoder((void *)(&out_temp[0]), dimension, in_buf))
   {
@@ -403,10 +442,16 @@
     {
       (( uint8_t *)out_user)[i]=(uint8_t)(out_temp[i]);
     }
+
+    ALLOCA_FREE(out_temp);
+
     return TRUE;
   }
   else
   {
+
+    ALLOCA_FREE(out_temp);
+
     return FALSE;
   }
 }
@@ -508,7 +553,7 @@
     return TSP_SIZEOF_ENCODED_USER;
         
   default:
-    STRACE_ERROR(("Unknown TSP Type <%d>",type))
+    STRACE_ERROR("Unknown TSP Type <%d>",type);
     return 0;
 
   }
diff -urN tsp_orig/src/core/common/tsp_encoder.c tsp_modified/src/core/common/tsp_encoder.c
--- tsp_orig/src/core/common/tsp_encoder.c	2007-02-11 22:45:56.000000000 +0100
+++ tsp_modified/src/core/common/tsp_encoder.c	2009-01-12 17:26:08.000000000 +0100
@@ -40,11 +40,14 @@
 #include <rpc/xdr.h>
 
 #include <tsp_const_def.h>
-#include <tsp_simple_trace.h>
+#include <tsp_common_trace.h>
 #include <tsp_datastruct.h>
 #include <tsp_encoder.h>
 #include <tsp_decoder.h>
 
+//For ALLOCA_XXX macro
+#include "../common/tsp_common_macros.h"
+
 #if defined(sun) || defined(__sun)
 #include <alloca.h>
 #endif
@@ -80,7 +83,7 @@
   }
   
   if (size  < taille ) {
-    STRACE_ERROR(("buffer is too small"));
+    STRACE_ERROR("buffer is too small");
     return 0;
   }
   
@@ -94,7 +97,7 @@
   {
     if( xdr_double(&xhandle, pt_double+i) != TRUE)
     {
-       STRACE_ERROR(("Function xdr_double failed"));
+       STRACE_ERROR("Function xdr_double failed");
        return 0;
     }
   }
@@ -106,7 +109,7 @@
    
   for (i=0;i<dimension;++i) {
     ((uint64_t*)out_buf)[i] = TSP_ENCODE_DOUBLE_TO_UINT64(pt_double+i);
-    STRACE_DEBUG_MORE(("DOUBLE = %f, encoded DOUBLE=0x%08llx",*pt_double,((uint64_t*)out_buf)[i]));
+    STRACE_DEBUG_MORE("DOUBLE = %f, encoded DOUBLE=0x%08llx",*pt_double,((uint64_t*)out_buf)[i]);
   } 
   
   return (uint32_t)(taille);
@@ -140,7 +143,7 @@
   }
 
   if (size  < taille ) {
-    STRACE_ERROR(("buffer is too small"));
+    STRACE_ERROR("buffer is too small");
     return 0;
   }
 
@@ -154,7 +157,7 @@
   {
     if( xdr_float(&xhandle, pt_float+i) != TRUE)
     {
-       STRACE_ERROR(("Function xdr_float failed"));
+       STRACE_ERROR("Function xdr_float failed");
        return 0;
     }
   }
@@ -192,7 +195,8 @@
     return TSP_data_channel_int32_encoder(NULL,dimension,out_buf,size);
   }
 
-  temp = alloca(sizeof(int32_t)*dimension);
+  temp = ALLOCA_ALLOC(sizeof(int32_t)*dimension);
+ 
   pt_int8=(int8_t*)v_int8;
 
   for (i=0;i<dimension;++i) {
@@ -219,7 +223,8 @@
     return TSP_data_channel_int32_encoder(NULL,dimension,out_buf,size);
   }
 
-  temp = alloca(sizeof(int32_t)*dimension);
+  temp = ALLOCA_ALLOC(sizeof(int32_t)*dimension);
+ 
   pt_int16=(int16_t*)v_int16;
 
   for (i=0;i<dimension;++i) {
@@ -252,11 +257,14 @@
   }
 
   if (size  < taille) {
-    STRACE_ERROR(("buffer is too small"));
+    STRACE_ERROR("buffer is too small");
     return 0;
   }
 
   pt_int32=(int32_t*)v_int32;
+  
+
+  ALLOCA_FREE(v_int32);
 
 #ifndef TSP_NO_XDR_ENCODE
 
@@ -266,7 +274,7 @@
   {
     if( xdr_int(&xhandle, pt_int32+i) != TRUE)
     {
-       STRACE_ERROR(("Function xdr_int failed"));
+       STRACE_ERROR("Function xdr_int failed");
        return 0;
     }
   }
@@ -309,7 +317,7 @@
   }
 
   if (size  < taille ) {
-     STRACE_ERROR(("buffer is too small"));
+     STRACE_ERROR("buffer is too small");
      return 0;
   }
 
@@ -323,7 +331,7 @@
   {
     if( xdr_hyper(&xhandle, pt_int64+i) != TRUE)
     {
-       STRACE_ERROR(("Function xdr_hyper failed"));
+       STRACE_ERROR("Function xdr_hyper failed");
        return 0;
     }
   }
@@ -359,7 +367,8 @@
     return TSP_data_channel_uint32_encoder(NULL,dimension,out_buf,size);
   }
 
-  temp = alloca(sizeof(int32_t)*dimension);
+  temp = ALLOCA_ALLOC(sizeof(int32_t)*dimension);
+
   pt_uint8=(uint8_t*)v_uint8;
 
   for (i=0;i<dimension;++i) {
@@ -383,8 +392,9 @@
   if (NULL==v_uint16) {
     return TSP_data_channel_uint32_encoder(NULL,dimension,out_buf,size);
   }
-  
-  temp = alloca(sizeof(int32_t)*dimension);
+
+  temp = ALLOCA_ALLOC(sizeof(int32_t)*dimension);
+
   pt_uint16=(uint16_t*)v_uint16;
 
   for (i=0;i<dimension;++i) {
@@ -417,12 +427,14 @@
   }
 
   if (size  < taille) {
-    STRACE_ERROR(("buffer is too small"));
+    STRACE_ERROR("buffer is too small");
     return 0;
   }
 
   pt_uint32=(uint32_t*)v_uint32;
 
+  // ALLOCA_FREE(v_uint32);
+
 #ifndef TSP_NO_XDR_ENCODE
 
   xdrmem_create(&xhandle, out_buf,  size, XDR_ENCODE);
@@ -431,7 +443,7 @@
   {
     if( xdr_int(&xhandle, pt_uint32+i) != TRUE)
     {
-       STRACE_ERROR(("Function xdr_int failed"));
+       STRACE_ERROR("Function xdr_int failed");
        return 0;
     }
   }
@@ -476,7 +488,7 @@
   }
 
   if (size  < taille) {
-    STRACE_ERROR(("buffer is too small"));
+    STRACE_ERROR("buffer is too small");
     return 0;
   }
 
@@ -490,7 +502,7 @@
   {
     if( xdr_hyper(&xhandle, pt_uint64+i) != TRUE)
     {
-       STRACE_ERROR(("Function xdr_long failed"));
+       STRACE_ERROR("Function xdr_long failed");
        return 0;
     }
   }
@@ -526,8 +538,9 @@
   if (NULL == v_char) {
     return TSP_data_channel_uint32_encoder(NULL,dimension,out_buf,size);
   }
+ 
+  temp = ALLOCA_ALLOC(sizeof(int32_t)*dimension);
 
-  temp = alloca(sizeof(int32_t)*dimension);
   pt_char=(uint8_t*)v_char;
 
   for (i=0;i<dimension;++i) {
@@ -553,7 +566,8 @@
     return TSP_data_channel_uint32_encoder(NULL,dimension,out_buf,size);
   }
 
-  temp = alloca(sizeof(int32_t)*dimension);
+  temp = ALLOCA_ALLOC(sizeof(int32_t)*dimension);
+
   pt_uchar=(uint8_t*)v_uchar;
 
   for (i=0;i<dimension;++i) {
@@ -579,7 +593,8 @@
     return TSP_data_channel_uint32_encoder(NULL,dimension,out_buf,size);
   }
 
-  temp = alloca(sizeof(int32_t)*dimension);
+  temp = ALLOCA_ALLOC(sizeof(int32_t)*dimension);
+
   pt_user=(uint8_t*)v_user;
 
   for (i=0;i<dimension;++i) {
diff -urN tsp_orig/src/core/ctrl/tsp_datapool.c tsp_modified/src/core/ctrl/tsp_datapool.c
--- tsp_orig/src/core/ctrl/tsp_datapool.c	2007-03-23 20:52:15.000000000 +0100
+++ tsp_modified/src/core/ctrl/tsp_datapool.c	2009-01-12 17:26:08.000000000 +0100
@@ -37,6 +37,7 @@
 -----------------------------------------------------------------------
  */
 
+
 #ifdef WIN32
     #define assert(exp)     ((void)0)
 #else
@@ -71,7 +72,7 @@
 { \
 	if( (index) >= (obj).size ) \
 	{ \
-		STRACE_ERROR(("ERROR :-->OUT : provider_global_index %d does not exist !",(index))) \
+		STRACE_ERROR("ERROR :-->OUT : provider_global_index %d does not exist !",(index)); \
 		return ret; \
 	} \
 }
@@ -114,25 +115,25 @@
     
   case GLU_GET_EOF :
     TSP_session_all_session_send_msg_ctrl(TSP_MSG_CTRL_EOF);
-    STRACE_INFO(("GLU sent EOF"));
+    STRACE_INFO("GLU sent EOF");
     /* End of flow. Our datapool is dead */
     datapool->terminated = TRUE;
     break;
     
   case GLU_GET_RECONF :
     TSP_session_all_session_send_msg_ctrl(TSP_MSG_CTRL_RECONF);
-    STRACE_INFO(("GLU sent RECONF"));
+    STRACE_INFO("GLU sent RECONF");
     /* End of flow. Our datapool is dead */
     datapool->terminated = TRUE;
     break;
     
   case GLU_GET_DATA_LOST :
     TSP_session_all_session_send_msg_ctrl(TSP_MSG_CTRL_GLU_DATA_LOST);
-    STRACE_INFO(("GLU sent DATA_LOST"));
+    STRACE_INFO("GLU sent DATA_LOST");
     break;
     
   default:
-    STRACE_ERROR(("?"));
+    STRACE_ERROR("?");
     assert(0);
   }    
   return 0;  
@@ -195,9 +196,9 @@
 void 
 TSP_datapool_delete(TSP_datapool_t** datapool) {
 
-   TSP_datapool_finalize(*datapool);
-   free(*datapool);
-   *datapool=NULL;
+  TSP_datapool_finalize(*datapool);
+  free(*datapool);
+  *datapool=NULL;
 } /* End of TSP_datapool_delete */
 
 
@@ -272,4 +273,3 @@
 
   return glu->datapool;
 } /* end of TSP_datapool_instantiate */
-
diff -urN tsp_orig/src/core/ctrl/tsp_data_sender.c tsp_modified/src/core/ctrl/tsp_data_sender.c
--- tsp_orig/src/core/ctrl/tsp_data_sender.c	2007-02-11 22:45:56.000000000 +0100
+++ tsp_modified/src/core/ctrl/tsp_data_sender.c	2009-01-12 17:26:08.000000000 +0100
@@ -90,9 +90,11 @@
   sender->fifo_full   = FALSE;
   sender->buffer_size = TSP_DATA_STREAM_MAX_BUFFER_SIZE(group_max_byte_size);
 
-  STRACE_DEBUG(("Data Sender buffer size is: <%d> byte(s)",sender->buffer_size));
+  STRACE_DEBUG("Data Sender buffer size is: <%d> byte(s)",sender->buffer_size);
   /* Create the sender stream with its fifo size*/
   sender->stream_sender = (TSP_data_sender_t)TSP_stream_sender_create(fifo_size, sender->buffer_size);
+
+  
   if (sender->stream_sender) {      
     /* Check if the user wants any fifo */
     sender->use_fifo = fifo_size > 0 ? TRUE : FALSE ;
@@ -108,7 +110,7 @@
     }
   }
   else {
-    STRACE_ERROR(("Function TSP_stream_sender_create failed"));
+    STRACE_ERROR("Function TSP_stream_sender_create failed");
     free(sender);
     sender = NULL;
   }
@@ -200,7 +202,7 @@
       if(!TSP_stream_sender_send(data_sender->stream_sender,
 				 TSP_STREAM_SENDER_ITEM_BUF(tosend),
 				 tosend->len) ) {
-	  STRACE_WARNING(("Function TSP_stream_sender_send failed "));
+	  STRACE_WARNING("Function TSP_stream_sender_send failed ");
 	  ret = FALSE;
 	}  
     }
@@ -241,7 +243,7 @@
       tsp_reserved_group = TSP_RESERVED_GROUP_CONSUMER_DATA_LOST;
       break;
     default:
-      STRACE_ERROR(("We should not be there..."));
+      STRACE_ERROR("We should not be there...");
       assert(0);
       return FALSE;
     }
@@ -322,8 +324,8 @@
 	   * FIXME : we cannot STRACE_DEBUG value simply due
 	   * to multi-type handling 
 	   */
-	  /* STRACE_DEBUG(("Gr=%d V=%f", group_index, *(double*)(group->items[i].data))); */
-	  STRACE_DEBUG(("Gr=%d Ne=%d", group_index, group->items[i].nelem));
+	  /* STRACE_DEBUG("Gr=%d V=%f", group_index, *(double*)(group->items[i].data)); */
+	  STRACE_DEBUG("Gr=%d Ne=%d", group_index, group->items[i].nelem);
 	  
 	  /* Call encode function */
 	  assert(group->items[i].data_encoder);
@@ -332,7 +334,7 @@
 						buf_char,
 						data_sender->buffer_size - ( buf_char - buf_main) );
 	  if ( 0 == size ) {
-	    STRACE_ERROR(("data_encoder failed"));	    
+	    STRACE_ERROR("data_encoder failed");	    
 	    ret = FALSE;
 	    break;
 	  }
diff -urN tsp_orig/src/core/ctrl/tsp_default_glu.c tsp_modified/src/core/ctrl/tsp_default_glu.c
--- tsp_orig/src/core/ctrl/tsp_default_glu.c	2006-10-18 11:58:48.000000000 +0200
+++ tsp_modified/src/core/ctrl/tsp_default_glu.c	2009-01-12 17:26:08.000000000 +0100
@@ -76,9 +76,9 @@
   (*glu)->get_type            = &GLU_get_server_type_default;
   (*glu)->get_base_frequency  = &GLU_get_base_frequency_default;
   (*glu)->get_nb_max_consumer = &GLU_get_nb_max_consumer_default;
-
+  
   if (GLU_SERVER_TYPE_ACTIVE==type) {
-    (*glu)->get_instance = &GLU_get_instance_default;
+    (*glu)->get_instance =(GLU_get_instance_ft) &GLU_get_instance_default;
     retcode = TRUE;
   } else if (GLU_SERVER_TYPE_PASSIVE==type) {
     /* we may not provide default get_instance for passive GLU */
@@ -95,14 +95,14 @@
    * initialize, run and get_ssi_list do not have default
    * start and get_pgi does.
    */
-  (*glu)->start                 = &GLU_start_default;
-  (*glu)->get_pgi               = &GLU_get_pgi_default;
-  (*glu)->get_filtered_ssi_list = &GLU_get_filtered_ssi_list_default;
-  (*glu)->get_ssi_list_fromPGI  = &GLU_get_ssi_list_fromPGI_default;
-  (*glu)->get_ssei_list_fromPGI = &GLU_get_ssei_list_fromPGI_default;
-  (*glu)->get_nb_symbols        = &GLU_get_nb_symbols_default;
-  (*glu)->async_read            = &GLU_async_sample_read_default;
-  (*glu)->async_write           = &GLU_async_sample_write_default;
+  (*glu)->start                 =(GLU_start_ft) &GLU_start_default;
+  (*glu)->get_pgi               =(GLU_get_pgi_ft) &GLU_get_pgi_default;
+  (*glu)->get_filtered_ssi_list =(GLU_get_filtered_ssi_list_ft) &GLU_get_filtered_ssi_list_default;
+  (*glu)->get_ssi_list_fromPGI  =(GLU_get_ssi_list_fromPGI_ft) &GLU_get_ssi_list_fromPGI_default;
+  (*glu)->get_ssei_list_fromPGI =(GLU_get_ssei_list_fromPGI_ft) &GLU_get_ssei_list_fromPGI_default;
+  (*glu)->get_nb_symbols        =(GLU_get_nb_symbols_ft) &GLU_get_nb_symbols_default;
+  (*glu)->async_read            =(GLU_async_sample_read_ft) &GLU_async_sample_read_default;
+  (*glu)->async_write           =(GLU_async_sample_write_ft) &GLU_async_sample_write_default;
   
   return retcode;
 } /* end if GLU_handle_create */
@@ -197,7 +197,7 @@
 	pg_indexes[i]=looked_for->provider_global_index;
       }
       if(found) {
-	STRACE_INFO(("Found symbol <%s> pgi=<%d> ",  looked_for->name, looked_for->provider_global_index));	   
+	STRACE_INFO("Found symbol <%s> pgi=<%d> ",  looked_for->name, looked_for->provider_global_index);	   
 	break;
       }
       
@@ -205,15 +205,14 @@
     if(!found) {
       retcode = FALSE;
       pg_indexes[i]= -1;
-      STRACE_INFO(("Unable to find symbol '%s'",  looked_for->name));	   
+      STRACE_INFO("Unable to find symbol '%s'",  looked_for->name);	   
     }
-    
     found = FALSE;     
     found = GLU_validate_sample_default(looked_for,compared,&pg_indexes[i]);
     
     if(!found) {
       retcode = FALSE;
-      STRACE_INFO(("No good data in symbol '%s'",  looked_for->name));	   
+      STRACE_INFO("No good data in symbol '%s'",  looked_for->name);	   
     }
   }
   return retcode;
@@ -251,7 +250,7 @@
 
   switch (filter_kind) {
   case TSP_FILTER_SIMPLE:
-    STRACE_INFO(("Requested filter kind <%d>, filter string = <%s>",filter_kind,filter_string));
+    STRACE_INFO("Requested filter kind <%d>, filter string = <%s>",filter_kind,filter_string);
     /* first loop to count matching symbols */
     nb_match      = 0;
     matched_index = calloc(complete_symbol_list.TSP_sample_symbol_info_list_t_len,sizeof(int32_t));
@@ -261,13 +260,13 @@
 	nb_match++;	
       }
     }
-    STRACE_INFO(("Nb Match(es) is <%d>",nb_match));
+    STRACE_INFO("Nb Match(es) is <%d>",nb_match);
     /* second loop if nb_match > 0 */
     if (nb_match>0) {
       TSP_SSIList_finalize(&(answer_sample->symbols));
       TSP_SSIList_initialize(&(answer_sample->symbols),nb_match);
       for (i=0;i<nb_match;i++) {
-	STRACE_DEBUG(("Adding <%s> to answer_sample...",complete_symbol_list.TSP_sample_symbol_info_list_t_val[matched_index[i]].name));
+	STRACE_DEBUG("Adding <%s> to answer_sample...",complete_symbol_list.TSP_sample_symbol_info_list_t_val[matched_index[i]].name);
 	TSP_SSI_copy(&(answer_sample->symbols.TSP_sample_symbol_info_list_t_val[i]),
 		     complete_symbol_list.TSP_sample_symbol_info_list_t_val[matched_index[i]]);
       }
@@ -307,7 +306,7 @@
     }
     else {
       SSI_list->TSP_sample_symbol_info_list_t_val[i].provider_global_index=-1;      
-      STRACE_INFO(("Unable to find symbol '%s'",  SSI_list->TSP_sample_symbol_info_list_t_val[i].name));      
+      STRACE_INFO("Unable to find symbol '%s'",  SSI_list->TSP_sample_symbol_info_list_t_val[i].name);      
       ret=TSP_STATUS_ERROR_SYMBOLS;      
     }
   }
@@ -372,14 +371,14 @@
   if(looked_for->period < 1) 
   {
     *pg_indexes=-1;
-    STRACE_DEBUG(("Invalid period"));
+    STRACE_DEBUG("Invalid period");
     return FALSE;
   }
 
   if(looked_for->phase < 0) 
   {
     *pg_indexes=-1;
-    STRACE_DEBUG(("Invalid phase"));
+    STRACE_DEBUG("Invalid phase");
     return FALSE;
   }
 	  
@@ -389,7 +388,7 @@
     if(looked_for->type != compared->type)
     {
       *pg_indexes=-1;
-       STRACE_DEBUG(("Invalid type"));
+       STRACE_DEBUG("Invalid type");
       return FALSE;
 
     }
@@ -405,7 +404,7 @@
     if(looked_for->offset >= compared->dimension)
     {
       *pg_indexes=-1;
-      STRACE_DEBUG(("Invalid offset"));
+      STRACE_DEBUG("Invalid offset");
       return FALSE;
     }
  }
@@ -415,7 +414,7 @@
     if((looked_for->offset + looked_for->nelem - 1) >= compared->dimension)
     {
       *pg_indexes=-1;
-      STRACE_DEBUG(("Invalid nelem"));
+      STRACE_DEBUG("Invalid nelem");
       return FALSE;
     }
  }
@@ -430,7 +429,7 @@
     if(looked_for->dimension != compared->dimension)
     {
       *pg_indexes=-1;
-      STRACE_DEBUG(("Invalid dimension"));
+      STRACE_DEBUG("Invalid dimension");
       return FALSE;
     }
  }
diff -urN tsp_orig/src/core/ctrl/tsp_default_glu.h tsp_modified/src/core/ctrl/tsp_default_glu.h
--- tsp_orig/src/core/ctrl/tsp_default_glu.h	2006-10-18 11:58:48.000000000 +0200
+++ tsp_modified/src/core/ctrl/tsp_default_glu.h	2009-01-12 17:26:08.000000000 +0100
@@ -137,17 +137,17 @@
 
 int32_t
 GLU_get_ssi_list_fromPGI_default(struct GLU_handle_t* cthis, 
-				 int* pgis, int pgis_len, 
+				 int32_t* pgis, int32_t pgis_len, 
 				 TSP_sample_symbol_info_list_t* SSI_list);
 
 int32_t
 GLU_get_ssei_list_fromPGI_default(struct GLU_handle_t* cthis, 
-				  int* pgis, int pgis_len, 
+				  int32_t* pgis, int32_t pgis_len, 
   				  TSP_sample_symbol_extended_info_list_t* SSEI_list);
 
 int32_t
 GLU_async_sample_read_default(struct GLU_handle_t* cthis, 
-			      int pgi, 
+			      int32_t pgi, 
 			      void* value_ptr, uint32_t* value_size);
 
 int32_t
diff -urN tsp_orig/src/core/ctrl/tsp_group_algo.c tsp_modified/src/core/ctrl/tsp_group_algo.c
--- tsp_orig/src/core/ctrl/tsp_group_algo.c	2007-02-11 22:45:56.000000000 +0100
+++ tsp_modified/src/core/ctrl/tsp_group_algo.c	2009-01-12 17:26:08.000000000 +0100
@@ -100,14 +100,14 @@
     
     /* We calculate the LCM for the period of all symbols */
     int ppcm = (symbols->TSP_sample_symbol_info_list_t_val[0].period);
-    STRACE_DEBUG(("Frequency_ratio No0= %d", ppcm));
+    STRACE_DEBUG("Frequency_ratio No0= %d", ppcm);
     
     for( i = 1 ; i < nb_symbols ; i++) {	
       
       int frequency_ratio =
 	(symbols->TSP_sample_symbol_info_list_t_val[i].period);
       
-      STRACE_DEBUG(("Frequency_ratio No%u= %d", i, frequency_ratio));
+      STRACE_DEBUG("Frequency_ratio No%u= %d", i, frequency_ratio);
       
       /* LCM */         
       PPCM(ppcm,frequency_ratio, ppcm); 
@@ -117,9 +117,9 @@
     
   }
   else {
-    STRACE_WARNING(("No symbols in list !"));    
+    STRACE_WARNING("No symbols in list !");    
   }
-  STRACE_INFO(("Found <%d> group(s) for request with <%d> symbol(s)",nb_groups,nb_symbols));
+  STRACE_INFO("Found <%d> group(s) for request with <%d> symbol(s)",nb_groups,nb_symbols);
   return nb_groups;    
 }
 
@@ -154,7 +154,7 @@
       }      
     }
     
-  STRACE_INFO(("Group_size for group[%d] is %d", group_id, group_size));    
+  STRACE_INFO("Group_size for group[%d] is %d", group_id, group_size);    
   return group_size;
 }
 
@@ -179,7 +179,7 @@
     groups_summed_size += TSP_group_algo_get_group_size(symbols, group_id,&group_byte_size); 
   }
     
-  STRACE_INFO(("Groups_summed_size is %d", groups_summed_size));
+  STRACE_INFO("Groups_summed_size is %d", groups_summed_size);
     
   return groups_summed_size;
 } /* end of TSP_group_algo_get_groups_summed_size */
@@ -252,8 +252,8 @@
 
     }
 
-  STRACE_INFO(("Max group size      = %d", table->max_group_len));  
-  STRACE_INFO(("Group max byte size = %d", table->group_max_byte_size));
+  STRACE_INFO("Max group size      = %d", table->max_group_len);  
+  STRACE_INFO("Group max byte size = %d", table->group_max_byte_size);
   return table;
 } /* TSP_group_algo_allocate_group_table */
                                                              
@@ -261,11 +261,10 @@
 TSP_group_algo_destroy_symbols_table(TSP_groups_t* groups) {
 
    TSP_algo_table_t* table = (TSP_algo_table_t*)groups;
-
    if (NULL!=table) {
-       free(table->all_items);
-       free(table->groups);
-       free(table);
+     free(table->all_items);
+     free(table->groups); 
+     free(table);
    }
 } /* TSP_group_algo_destroy_symbols_table */
 
@@ -288,7 +287,7 @@
   uint32_t out_current_info, in_current_info;
   TSP_sample_symbol_info_t* in_info;
   TSP_sample_symbol_info_t* out_info;
-    
+
   /* Allocate group table from requested symbols */
   table = TSP_group_algo_allocate_group_table(in_symbols);
   *out_groups = table;
@@ -319,7 +318,7 @@
       /* Does - it belong to the group */
       if (BELONGS_TO_GROUP(in_info->period, in_info->phase , group_id) ) {		
 	/*Yes, we add it*/
-	STRACE_DEBUG(("Adding provider_global_index %d at group %d and rank %d",in_info->provider_global_index,group_id,rank));
+	STRACE_DEBUG("Adding provider_global_index %d at group %d and rank %d",in_info->provider_global_index,group_id,rank);
 	/* 1 - In the out group table */
 	
 	/* find the encoder of the data type */
@@ -371,6 +370,5 @@
   TSP_algo_table_t* group_table = (TSP_algo_table_t*)groups;
   int i;
   assert(groups);
-
   return group_table->group_max_byte_size;
 }
diff -urN tsp_orig/src/core/ctrl/tsp_group_algo.h tsp_modified/src/core/ctrl/tsp_group_algo.h
--- tsp_orig/src/core/ctrl/tsp_group_algo.h	2007-02-11 22:45:56.000000000 +0100
+++ tsp_modified/src/core/ctrl/tsp_group_algo.h	2009-01-12 17:26:08.000000000 +0100
@@ -54,7 +54,7 @@
  * to the value in the group table
  * @return TRUE=OK
  */
-int TSP_group_algo_create_symbols_table(const TSP_sample_symbol_info_list_t* symbols,
+int32_t TSP_group_algo_create_symbols_table(const TSP_sample_symbol_info_list_t* symbols,
 					TSP_sample_symbol_info_list_t* out_symbols,
 					TSP_groups_t* out_groups,
 					TSP_datapool_t* datapool);
diff -urN tsp_orig/src/core/ctrl/tsp_provider.c tsp_modified/src/core/ctrl/tsp_provider.c
--- tsp_orig/src/core/ctrl/tsp_provider.c	2006-10-18 11:58:48.000000000 +0200
+++ tsp_modified/src/core/ctrl/tsp_provider.c	2009-01-12 17:26:08.000000000 +0100
@@ -51,6 +51,7 @@
 #include <tsp_common.h>
 #include <tsp_datapool.h>
 
+
 /** modified argc and argv, will be returned to user code after init */
 static  char** X_argv = 0;
 
@@ -98,14 +99,14 @@
   int32_t retval = TSP_STATUS_OK;
 
   if (version_id != TSP_PROTOCOL_VERSION) {
-    STRACE_ERROR(("TSP version ERROR. Requested=%d Current=%d",version_id, TSP_PROTOCOL_VERSION ));    
+    STRACE_ERROR("TSP version ERROR. Requested=%d Current=%d",version_id, TSP_PROTOCOL_VERSION );    
     retval = TSP_STATUS_ERROR_VERSION;
   }
 
   if ((TSP_STATUS_OK==retval) && (NULL!=glu)) {
     *glu = TSP_session_get_GLU_by_channel(channel_id);
     if (NULL==*glu) {
-      STRACE_ERROR(("TSP channel id ERROR. Trying to use Channel Id=%d ",channel_id));
+      STRACE_ERROR("TSP channel id ERROR. Trying to use Channel Id=%d ",channel_id);
       retval=TSP_STATUS_ERROR_INVALID_CHANNEL_ID;
     }
   }
@@ -144,13 +145,13 @@
       if(p && (p == (*argv)[i] ))
 	{
 	  /* TSP Arg */
-	  STRACE_INFO(("Tsp ARG : '%s'", (*argv)[i]));
+	  STRACE_INFO("Tsp ARG : '%s'", (*argv)[i]);
 
 	  /* First we must not be looking for a argument */
 	  if(found_server_number_flag)
 	    {
 	      /* Error we are expecting an arguement not a TSP option*/
-	      STRACE_WARNING(("Unexpected %s", (*argv)[i]));
+	      STRACE_WARNING("Unexpected %s", (*argv)[i]);
 	      ret = FALSE;
 	    }
 	  /* Look for start flag */
@@ -169,7 +170,7 @@
 		}
 	      else
 		{
-		  STRACE_WARNING(("Unexpected "TSP_ARG_STREAM_INIT_START));
+		  STRACE_WARNING("Unexpected "TSP_ARG_STREAM_INIT_START);
 		  ret = FALSE;
 		}
 	    }
@@ -181,7 +182,7 @@
 		}
 	      else
 		{
-		  STRACE_WARNING(("Unexpected "TSP_ARG_STREAM_INIT_STOP));
+		  STRACE_WARNING("Unexpected "TSP_ARG_STREAM_INIT_STOP);
 		  ret = FALSE;
 		}
 	    }
@@ -190,14 +191,14 @@
 	      found_server_number_flag = TRUE;
 	      if(found_stream_start && !found_stream_stop)		
 		{
-		  STRACE_WARNING(("Unexpected "TSP_ARG_SERVER_NUMBER));
+		  STRACE_WARNING("Unexpected "TSP_ARG_SERVER_NUMBER);
 		  ret = FALSE;
 		}
 	    }
 	  else
 	    {
 	      /* Unkown option */
-	      STRACE_WARNING(("Unknown TSP option : '%s'",(*argv)[i] ))
+	      STRACE_WARNING("Unknown TSP option : '%s'",(*argv)[i] );
 	      ret = FALSE;
 	    }
 	}
@@ -213,7 +214,7 @@
 	      /* Found arg for server number option */
 	      found_server_number_flag = FALSE;
 	      X_server_base_number = atoi((*argv)[i]);
-	      STRACE_INFO(("Server base number = %d", X_server_base_number));
+	      STRACE_INFO("Server base number = %d", X_server_base_number);
 	    }
 	  else
 	    {	      
@@ -228,13 +229,13 @@
   
   if( found_stream_start && !found_stream_stop )
     {
-      STRACE_WARNING(("A " TSP_ARG_STREAM_INIT_STOP " flag was expected"));
+      STRACE_WARNING("A " TSP_ARG_STREAM_INIT_STOP " flag was expected");
       ret = FALSE;
     }
 
   if( found_server_number_flag )
     {
-      STRACE_WARNING(("An argument was expected after " TSP_ARG_SERVER_NUMBER));
+      STRACE_WARNING("An argument was expected after " TSP_ARG_SERVER_NUMBER);
       ret = FALSE;
     }
 
@@ -245,13 +246,13 @@
   /* Display usage */
   if(!ret)
     {
-      STRACE_WARNING((TSP_ARG_PROVIDER_USAGE));
+      STRACE_WARNING(TSP_ARG_PROVIDER_USAGE);
     }
   else
     {
       if (! X_glu_argc )
 	{
-	  STRACE_INFO(("No GLU stream init provided on command line"));
+	  STRACE_INFO("No GLU stream init provided on command line");
 	}
     }
 
@@ -282,10 +283,10 @@
   char* error_info;
   int i;
 
-  STRACE_REQUEST(("OPEN"));
-	
+  STRACE_REQUEST("OPEN");
+  
+  
   TSP_LOCK_MUTEX(&X_tsp_request_mutex,);
-
   ans_open->version_id = TSP_UNDEFINED_VERSION_ID;
   ans_open->channel_id = TSP_UNDEFINED_CHANNEL_ID;
   ans_open->status     = TSP_STATUS_ERROR_UNKNOWN;
@@ -293,11 +294,11 @@
 
   if (req_open->argv.TSP_argv_t_len) {
     for( i = 0; i< req_open->argv.TSP_argv_t_len ;i++) {
-      STRACE_DEBUG(("arg %d is '%s'", i,  req_open->argv.TSP_argv_t_val[i]));
+      STRACE_DEBUG("arg %d is '%s'", i,  req_open->argv.TSP_argv_t_val[i]);
     }
   }
   else {
-    STRACE_DEBUG(("No custom args from consumer"));
+    STRACE_DEBUG("No custom args from consumer");
   }
 
   /*  
@@ -325,7 +326,7 @@
   }
    
   if (NULL != glu_h) {
-    ans_open->status = TSP_add_session(&(ans_open->channel_id), glu_h);
+    ans_open->status = TSP_add_session((channel_id_t)&(ans_open->channel_id), glu_h);
     if (TSP_STATUS_OK==ans_open->status) {
       if (req_open->version_id == TSP_PROTOCOL_VERSION) {
 	TSP_session_change_stateTo_byChannel(ans_open->channel_id,TSP_SESSION_STATE_OPENED);
@@ -333,19 +334,20 @@
 	ans_open->status      = TSP_STATUS_OK;
       }
       else {
-	STRACE_ERROR(("TSP version ERROR. Requested=%d Current=%d",req_open->version_id, TSP_PROTOCOL_VERSION ));
+	STRACE_ERROR("TSP version ERROR. Requested=%d Current=%d",req_open->version_id, TSP_PROTOCOL_VERSION );
 	ans_open->status = TSP_STATUS_ERROR_VERSION;
       }
     }
     else {
-      STRACE_ERROR(("TSP_add_session failed"));
+      STRACE_ERROR("TSP_add_session failed");
     }
   } else {
-    STRACE_INFO(("Unable to get first GLU instance"));
+    STRACE_INFO("Unable to get first GLU instance");
     ans_open->status = TSP_STATUS_ERROR_SEE_STRING;
     ans_open->status_str = error_info;
   }  
-  TSP_UNLOCK_MUTEX(&X_tsp_request_mutex,);  
+  
+  TSP_UNLOCK_MUTEX(&X_tsp_request_mutex,); 
 } /* End of TSP_provider_request_open */
 
 
@@ -357,8 +359,7 @@
 
 void 
 TSP_provider_request_close(const TSP_request_close_t* req_close) {
-
-  STRACE_REQUEST(("CLOSE channel_id=<%d>",req_close->channel_id));
+   
   TSP_LOCK_MUTEX(&X_tsp_request_mutex,);
   
   if (TSP_STATUS_OK==TSP_provider_checkVersionAndChannelId(req_close->version_id,
@@ -377,9 +378,9 @@
 void  
 TSP_provider_request_information(TSP_request_information_t* req_info, 
 				 TSP_answer_sample_t* ans_sample) {
-  STRACE_REQUEST(("INFORMATIONS channel_id=<%d>",req_info->channel_id));
+  STRACE_REQUEST("INFORMATIONS channel_id=<%d>",req_info->channel_id);
   TSP_provider_request_filtered_information(req_info,TSP_FILTER_NONE,NULL,ans_sample);  
-  STRACE_DEBUG(("Nb symbol = %d",ans_sample->symbols.TSP_sample_symbol_info_list_t_len));
+  STRACE_DEBUG("Nb symbol = %d",ans_sample->symbols.TSP_sample_symbol_info_list_t_len);
 } /* End of TSP_provider_request_information */
 
 void TSP_provider_update_answer_with_minimalinfo(int32_t version_id, int32_t channel_id,
@@ -391,6 +392,7 @@
 							     glu);
 
   if (TSP_STATUS_OK==ans_sample->status) {
+   
     ans_sample->version_id            = version_id;
     ans_sample->channel_id            = channel_id;    
     ans_sample->provider_group_number = 0;
@@ -411,7 +413,7 @@
 
   GLU_handle_t* myGLU = NULL;
 
-  STRACE_REQUEST(("FILTERED INFORMATIONS channel_id=<%d>",req_info->channel_id));
+  STRACE_REQUEST("FILTERED INFORMATIONS channel_id=<%d>",req_info->channel_id);
   TSP_LOCK_MUTEX(&X_tsp_request_mutex,);
   
   /* fill-in minimal info in answer_sample */
@@ -423,15 +425,15 @@
     /* switch case for filter_kind */
     switch (filter_kind) {
     case TSP_FILTER_NONE:
-      STRACE_INFO(("Requested filter NONE"));
+      STRACE_INFO("Requested filter NONE");
       TSP_filter_symbol_none(req_info,filter_string,ans_sample);
       break;
     case TSP_FILTER_MINIMAL:
-      STRACE_INFO(("Requested filter MINIMAL, filter string = <%s>",filter_string));
+      STRACE_INFO("Requested filter MINIMAL, filter string = <%s>",filter_string);
       TSP_filter_symbol_minimal(req_info,filter_string,ans_sample);
       break;
     default:
-      STRACE_INFO(("Requested filter kind <%d>, filter string = <%s>",filter_kind,filter_string));
+      STRACE_INFO("Requested filter kind <%d>, filter string = <%s>",filter_kind,filter_string);
       /* 
        * Forward other filtered request directly to GLU 
        * such that even non anticipated filtering method could
@@ -453,17 +455,19 @@
 
   GLU_handle_t* myGLU;
   
-  STRACE_REQUEST(("SAMPLE channel_id=<%d>",req_sample->channel_id));
-  TSP_LOCK_MUTEX(&X_tsp_request_mutex,);	
+  STRACE_REQUEST("SAMPLE channel_id=<%d>",req_sample->channel_id);
   
-  /* Always re-init answer_sample */
+  TSP_LOCK_MUTEX(&X_tsp_request_mutex,);	
+
+  /* Always re-init answer_sample */  
   TSP_AS_finalize(ans_sample);
+   
   TSP_provider_update_answer_with_minimalinfo(req_sample->version_id,
 					      req_sample->channel_id,
 					      ans_sample,
 					      &myGLU);
-  
-  STRACE_INFO(("Consumer No %d asked for %d symbols",req_sample->channel_id,req_sample->symbols.TSP_sample_symbol_info_list_t_len  ));
+
+  STRACE_INFO("Consumer No %d asked for %d symbols",req_sample->channel_id,req_sample->symbols.TSP_sample_symbol_info_list_t_len  );
 
   if (0>=req_sample->symbols.TSP_sample_symbol_info_list_t_len) {
     ans_sample->status = TSP_STATUS_ERROR_EMPTY_REQUEST_SAMPLE;
@@ -472,10 +476,11 @@
   if (TSP_STATUS_OK == ans_sample->status) {
     if(TSP_session_get_symbols_global_index_by_channel(req_sample->channel_id, &(req_sample->symbols) )) {  
       /* The datapool will be created here (if it does not already exist) */
+
       ans_sample->status =
 	TSP_session_create_symbols_table_by_channel(req_sample, ans_sample);
       if (TSP_STATUS_OK!= ans_sample->status) {
-	STRACE_ERROR(("Function TSP_session_create_symbols_table_by_channel failed"));
+	STRACE_ERROR("Function TSP_session_create_symbols_table_by_channel failed");
       }  else {
 	TSP_session_change_stateTo_byChannel(req_sample->channel_id,TSP_SESSION_STATE_REQUEST_SAMPLE_OK);
       }
@@ -484,7 +489,7 @@
        * Start It only upon request_sample_init request.
        */      
     } else {
-      STRACE_WARNING(("Function TSP_session_get_symbols_global_index_by_channel failed"));
+      STRACE_WARNING("Function TSP_session_get_symbols_global_index_by_channel failed");
       ans_sample->status = TSP_STATUS_ERROR_SYMBOLS;
       /* 
        * Now we shall update answer_sample->symbols in order to indicates
@@ -494,9 +499,9 @@
 		       req_sample->symbols);
     }
   } else {
-    STRACE_WARNING(("TSP ERROR"));
+    STRACE_WARNING("TSP ERROR");
   }
-
+  
   TSP_UNLOCK_MUTEX(&X_tsp_request_mutex,);
 } /* End of TSP_provider_request_sample */
 
@@ -504,8 +509,8 @@
 TSP_provider_request_sample_init(TSP_request_sample_init_t* req_sample_init, 
 				 TSP_answer_sample_init_t* ans_sample_init) {  
   GLU_handle_t* myGLU;
-
-  STRACE_REQUEST(("SAMPLE_INIT channel_id=<%d>",req_sample_init->channel_id));
+  
+  STRACE_REQUEST("SAMPLE_INIT channel_id=<%d>",req_sample_init->channel_id);
   TSP_LOCK_MUTEX(&X_tsp_request_mutex,);
     
   ans_sample_init->status = TSP_provider_checkVersionAndChannelId(req_sample_init->version_id,
@@ -519,12 +524,12 @@
       TSP_session_create_data_sender_by_channel(req_sample_init->channel_id);
     
     if (TSP_STATUS_OK!=ans_sample_init->status) {
-      STRACE_ERROR(("TSP_data_sender_create failed"));
+      STRACE_ERROR("TSP_data_sender_create failed");
     } else {      
       /* send data address to client */
       ans_sample_init->data_address =
 	(char*)TSP_session_get_data_address_string_by_channel(req_sample_init->channel_id);  
-      STRACE_DEBUG(("ANSWER SAMPLE INIT data_address = '%s'", ans_sample_init->data_address));
+      STRACE_DEBUG("ANSWER SAMPLE INIT data_address = '%s'", ans_sample_init->data_address);
       TSP_session_change_stateTo_byChannel(req_sample_init->channel_id,TSP_SESSION_STATE_REQUEST_SAMPLE_INIT_OK);
     }
   }
@@ -535,8 +540,9 @@
 static 
 void TSP_provider_request_sample_destroy_priv(channel_id_t channel_id) {
   if(TSP_STATUS_OK!=TSP_session_destroy_data_sender_by_channel(channel_id)) {
-    STRACE_ERROR(("TSP_session_destroy_data_sender_by_channel failed"));
+    STRACE_ERROR("TSP_session_destroy_data_sender_by_channel failed");
   }
+
   TSP_session_change_stateTo_byChannel(channel_id,TSP_SESSION_STATE_REQUEST_SAMPLE_DESTROY_OK);
 }
 
@@ -544,9 +550,9 @@
 TSP_provider_request_sample_destroy(TSP_request_sample_destroy_t* req_sample_destroy, 
 				    TSP_answer_sample_destroy_t*  ans_sample_destroy) {
 
-  STRACE_REQUEST(("SAMPLE DESTROY channel_id=<%d>",req_sample_destroy->channel_id));
+  STRACE_REQUEST("SAMPLE DESTROY channel_id=<%d>",req_sample_destroy->channel_id);
+  
   TSP_LOCK_MUTEX(&X_tsp_request_mutex,);
-
   ans_sample_destroy->status = TSP_provider_checkVersionAndChannelId(req_sample_destroy->version_id,
 								     req_sample_destroy->channel_id,
 								     NULL);
@@ -555,7 +561,7 @@
     ans_sample_destroy->channel_id = req_sample_destroy->channel_id;
     TSP_provider_request_sample_destroy_priv(req_sample_destroy->channel_id);
   }
-
+ 
   TSP_UNLOCK_MUTEX(&X_tsp_request_mutex,);
 } /* End of  TSP_provider_request_sample_destroy */
 
@@ -564,35 +570,32 @@
 TSP_provider_garbage_collector_thread(void* dummy) {
    channel_id_t channel_id;
    int32_t state = TSP_SESSION_STATE_UNKNOWN;
-
-   /* Save memory ! */
+   
    pthread_detach(pthread_self());
-
    while(TRUE) {
      while(TRUE==TSP_session_get_garbage_session(&channel_id)) {
        /* get the state of the garbage session */
        state = TSP_session_get_state(channel_id);
-       STRACE_INFO(("Will garbage collect session channel_id <%d> in state <%d>",channel_id,state));
+       STRACE_INFO("Will garbage collect session channel_id <%d> in state <%d>",channel_id,state);
        /* 
 	* If the session is garbage this means that the consumer
 	* did not close the session properly so do it.
 	*/
-
+   
        /* Simulate request sample destroy */       
        if ((TSP_SESSION_STATE_SAMPLING          == state) ||
 	   (TSP_SESSION_STATE_BROKEN_LINK       == state)) {
-	 STRACE_INFO(("Sending missing SAMPLE DESTROY to channel_id <%d> in state <%d>",channel_id,state));
+	 STRACE_INFO("Sending missing SAMPLE DESTROY to channel_id <%d> in state <%d>",channel_id,state);
 	 TSP_provider_request_sample_destroy_priv(channel_id);
 	 /* update state */
 	 state = TSP_session_get_state(channel_id);
        }
-
        /* Simulate request close if consumer did not send it */
        if (TSP_SESSION_STATE_REQUEST_SAMPLE_DESTROY_OK == state) {
-	 STRACE_INFO(("Sending missing REQUEST CLOSE to channel_id <%d> in state <%d>",channel_id,state));
+	 STRACE_INFO("Sending missing REQUEST CLOSE to channel_id <%d> in state <%d>",channel_id,state);
 	 TSP_provider_request_close_priv(channel_id);
        }
-       STRACE_INFO(("Session No %d 'garbage-collected'", channel_id));
+       STRACE_INFO("Session No %d 'garbage-collected'", channel_id);
      }
      tsp_usleep(TSP_GARBAGE_COLLECTOR_POLL_TIME_US);
    }
@@ -620,7 +623,7 @@
     if (TRUE!=theGLU->initialize(theGLU, X_glu_argc, X_glu_argv)) {
       retcode = TSP_STATUS_ERROR_GLU_INITIALIZE;
     } else {
-    
+      
       /* Launch garbage collection for sessions */
       status = pthread_create(&thread, NULL, TSP_provider_garbage_collector_thread,  NULL);
       TSP_CHECK_THREAD(status, TSP_STATUS_ERROR_UNKNOWN);      
@@ -628,7 +631,7 @@
   }
 
   if (TSP_STATUS_OK!=retcode) {
-    STRACE_INFO(("TSP private init error"));
+    STRACE_INFO("TSP private init error");
     X_tsp_provider_init_ok = FALSE;
   } else {
     X_tsp_provider_init_ok = TRUE;
@@ -650,11 +653,11 @@
   if (GLU_SERVER_TYPE_ACTIVE == firstGLU->type) {
     /* Instantiate GLOBAL datapool */
     if (NULL==TSP_datapool_instantiate(firstGLU)) {
-      retcode = TSP_STATUS_ERROR_DATAPOOL_INSTANTIATE;
+       retcode = TSP_STATUS_ERROR_DATAPOOL_INSTANTIATE;
     }
     /* Start GLU now since it is an ACTIVE one */
     if (0!=firstGLU->start(firstGLU)) {
-      STRACE_ERROR(("Cannot start GLU (ACTIVE case)"));
+      STRACE_ERROR("Cannot start GLU (ACTIVE case)");
       retcode = TSP_STATUS_ERROR_GLU_START;
     }	
     retcode = TSP_STATUS_OK;
@@ -670,15 +673,15 @@
 TSP_provider_request_async_sample_write(TSP_async_sample_t* async_sample_write) {
   int32_t ret = TSP_STATUS_OK;
 
-  STRACE_REQUEST(("ASYNC WRITE")); 
-  STRACE_DEBUG(("TSP_PROVIDER Before async_write: pgi %d value %s return %d ",async_sample_write->provider_global_index,async_sample_write->data.data_val,ret ));
+  STRACE_REQUEST("ASYNC WRITE"); 
+  STRACE_DEBUG("TSP_PROVIDER Before async_write: pgi %d value %s return %d ",async_sample_write->provider_global_index,async_sample_write->data.data_val,ret );
 
   /* FIXME should check channel id and get GLU from session object */
   ret = firstGLU->async_write(firstGLU,
 			      async_sample_write->provider_global_index,
   			      async_sample_write->data.data_val,async_sample_write->data.data_len);
 
-  STRACE_DEBUG(("TSP_PROVIDER After async_write: pgi %d value %s return %d ",async_sample_write->provider_global_index,async_sample_write->data.data_val,ret ));
+  STRACE_DEBUG("TSP_PROVIDER After async_write: pgi %d value %s return %d ",async_sample_write->provider_global_index,async_sample_write->data.data_val,ret );
   
   return ret;
 
@@ -689,8 +692,8 @@
 TSP_provider_request_async_sample_read(TSP_async_sample_t* async_sample_read) {
   int32_t ret = TSP_STATUS_OK;
 
-  STRACE_REQUEST(("ASYNC READ")); 
-  STRACE_DEBUG(("TSP_PROVIDER Before async_read: pgi %d value %s return %d ",async_sample_read->provider_global_index,async_sample_read->data.data_val,ret ));
+  STRACE_REQUEST("ASYNC READ"); 
+  STRACE_DEBUG("TSP_PROVIDER Before async_read: pgi %d value %s return %d ",async_sample_read->provider_global_index,async_sample_read->data.data_val,ret );
   
   /* FIXME should check channel id and get GLU from session object */
 
@@ -699,7 +702,7 @@
 			     (async_sample_read->data.data_val),
 			     &(async_sample_read->data.data_len));
 
-  STRACE_DEBUG(("TSP_PROVIDER After async_read: pgi %d value %f return %d ",async_sample_read->provider_global_index,*((double*)(async_sample_read->data.data_val)),ret ));
+  STRACE_DEBUG("TSP_PROVIDER After async_read: pgi %d value %f return %d ",async_sample_read->provider_global_index,*((double*)(async_sample_read->data.data_val)),ret );
   
   return ret;
 
@@ -710,7 +713,7 @@
 TSP_provider_request_extended_information(TSP_request_extended_information_t* req_extinfo, 
 					  TSP_answer_extended_information_t* ans_extinfo) {
   GLU_handle_t* myGLU;
-  STRACE_REQUEST(("EXTENDED INFORMATION channel_id=<%d>",req_extinfo->channel_id));
+  STRACE_REQUEST("EXTENDED INFORMATION channel_id=<%d>",req_extinfo->channel_id);
   TSP_LOCK_MUTEX(&X_tsp_request_mutex,);  
 
   ans_extinfo->status= TSP_provider_checkVersionAndChannelId(req_extinfo->version_id,
diff -urN tsp_orig/src/core/ctrl/tsp_provider.h tsp_modified/src/core/ctrl/tsp_provider.h
--- tsp_orig/src/core/ctrl/tsp_provider.h	2006-10-18 23:23:51.000000000 +0200
+++ tsp_modified/src/core/ctrl/tsp_provider.h	2009-01-12 17:26:08.000000000 +0100
@@ -60,9 +60,9 @@
  * @param[in,out] argc   the number of argument of the main
  * @param[in,out] argv   array of argument of size argc.
  */
-int TSP_provider_private_init(GLU_handle_t* theGLU, int* argc, char** argv[]);
+int32_t TSP_provider_private_init(GLU_handle_t* theGLU, int* argc, char** argv[]);
 
-int TSP_provider_private_run();
+int32_t TSP_provider_private_run();
 
 const char* TSP_provider_get_name();
 
@@ -93,9 +93,9 @@
 int TSP_provider_get_server_number();
 int TSP_provider_get_server_base_number( );
 
-int TSP_provider_request_async_sample_write(TSP_async_sample_t* async_sample_write);
+int32_t TSP_provider_request_async_sample_write(TSP_async_sample_t* async_sample_write);
 
-int TSP_provider_request_async_sample_read(TSP_async_sample_t* async_sample_read);
+int32_t TSP_provider_request_async_sample_read(TSP_async_sample_t* async_sample_read);
 
 void  TSP_provider_request_extended_information(TSP_request_extended_information_t* req_extinfo, 
 						TSP_answer_extended_information_t* ans_extinfo);
diff -urN tsp_orig/src/core/ctrl/tsp_request_handler.c tsp_modified/src/core/ctrl/tsp_request_handler.c
--- tsp_orig/src/core/ctrl/tsp_request_handler.c	2006-10-21 10:48:00.000000000 +0200
+++ tsp_modified/src/core/ctrl/tsp_request_handler.c	2009-01-12 17:26:08.000000000 +0100
@@ -35,6 +35,8 @@
 -----------------------------------------------------------------------
  */
 
+
+
 #include "tsp_sys_headers.h"
 #define REQUEST_HANDLER_C
 #include "tsp_request_handler.h"
@@ -50,12 +52,13 @@
 
   int retval = 0;
   int i;
-
+  
   TSP_LOCK_MUTEX(&rqh_manager_if.mutex,-1);
   for (i=0; i<TSP_provider_rqh_manager_get_max_nb(); ++i) {
     if (rqh_manager_if.request_handlers[i].status != TSP_RQH_STATUS_NOTINSTALLED)
       ++retval;
   }
+  
   TSP_UNLOCK_MUTEX(&rqh_manager_if.mutex,-1);
 
   return retval;
@@ -67,7 +70,7 @@
 
   int retval = 0;
 
-  TSP_LOCK_MUTEX(&rqh_manager_if.mutex,-1);
+  TSP_LOCK_MUTEX(&rqh_manager_if.mutex,-1); 
   retval = rqh_manager_if.nb_running_rhq;
   TSP_UNLOCK_MUTEX(&rqh_manager_if.mutex,-1);
 
@@ -80,7 +83,7 @@
   TSP_provider_request_handler_t*  retval = NULL;
 
   if ((rank<0) || (rank>TSP_provider_rqh_manager_get_max_nb())) {
-    STRACE_ERROR(("Invalid request handler RANK=%d, max=%d",rank,TSP_provider_rqh_manager_get_max_nb()));
+    STRACE_ERROR("Invalid request handler RANK=%d, max=%d",rank,TSP_provider_rqh_manager_get_max_nb());
   }
   else {
     retval = &rqh_manager_if.request_handlers[rank];
@@ -107,7 +110,6 @@
 
   int retval = TRUE;
   TSP_provider_request_handler_t* rqh_p;
-
   rqh_p = TSP_provider_rqh_manager_get(rank);
   TSP_LOCK_MUTEX(&rqh_manager_if.mutex,FALSE);
   if (!rqh_p) {
@@ -116,13 +118,13 @@
   else {
     /* Verify the adressed rqh was not already installed */
     if (rqh_p->status != TSP_RQH_STATUS_NOTINSTALLED) {
-      STRACE_ERROR(("Could not replace an installed request handler"));
+      STRACE_ERROR("Could not replace an installed request handler");
       retval = FALSE;
     }
     else {
        /* Really install handler */
       if (!rqh_constructor(rqh_p)) {
-	STRACE_ERROR(("Invalid request handler constructor"));
+	STRACE_ERROR("Invalid request handler constructor");
 	retval = FALSE;
       }
     } /* (rqh_p->status == TSP_RQH_STATUS_RUNNING) [else] */
@@ -144,6 +146,7 @@
    * function since they should ALWAYS return 0.
    * see pthread_cond_init(3), pthread_mutex_init(3)
    */
+  
   pthread_cond_init(&rqh_manager_if.cond,(pthread_condattr_t *)NULL);  
   pthread_mutex_init(&rqh_manager_if.mutex,(const pthread_mutexattr_t *)NULL);
   
@@ -182,40 +185,37 @@
    * configure and run all TSP request handlers
    * which are installed, but not running
    */
+  
   TSP_LOCK_MUTEX(&rqh_manager_if.mutex,FALSE);
-
   nb = TSP_provider_rqh_manager_get_max_nb();
   rank = 0;
   while (rank < nb && TRUE == retval)
     {
       rqh_p = TSP_provider_rqh_manager_get(rank);
-
       if (rqh_p->status == TSP_RQH_STATUS_IDLE)
 	{
 	  retval = rqh_p->config(rqh_p);
 	  if (retval)
-	    {
-	      tstatus = pthread_create(&rqh_p->tid, NULL, rqh_p->run, rqh_p);
-	
+	    { 
+              tstatus = pthread_create(&rqh_p->tid, NULL, rqh_p->run, rqh_p);
 	      if (0 == tstatus)
 		{
 		  /* wait for handler to be really running, 1 second */
 		  timeout = 100;
 		  while(rqh_p->status != TSP_RQH_STATUS_RUNNING && timeout)
-		    {
-		      tsp_usleep(10000);
-		      timeout --;
+		    { 
+                      tsp_usleep(10000);
+                      timeout --;
 		    }
-
 		  if(rqh_p->status == TSP_RQH_STATUS_RUNNING)
 		    {
 		      rqh_manager_if.nb_running_rhq++;
 		      /*FIXME: should not reference rpc explicitely */
-		      /*STRACE_INFO(("Request handler # %d started with URL %s", rank, TSP_rpc_request_url(rqh_p)));*/
+                      STRACE_INFO("Request handler # %d started with URL %s", rank, TSP_rpc_request_url(rqh_p));
 		    }
 		  else
 		    {
-		      STRACE_ERROR(("Request handler # %d could not start properly", rank));
+		      STRACE_ERROR("Request handler # %d could not start properly", rank);
 		    }
 		}
 	    }
@@ -234,25 +234,23 @@
   int timeout;
   TSP_provider_request_handler_t *rqh_p;
   int rank, nb;
-
+  
   /* 
    * call stop for all TSP request handlers
    * that are running
    */
-
   TSP_LOCK_MUTEX(&rqh_manager_if.mutex,FALSE);
-
   nb = TSP_provider_rqh_manager_get_max_nb();
   for(rank = 0; rank < nb; rank++)
-    {
+    { 
       rqh_p = TSP_provider_rqh_manager_get(rank);
-
       if (rqh_p->status == TSP_RQH_STATUS_RUNNING)
-	{
+	{ 
 	  rqh_p->stop(rqh_p);
 
 	  /* wait for handler to be really stopped, 1 second */
 	  timeout = 100;
+
 	  while(rqh_p->status != TSP_RQH_STATUS_STOPPED && timeout)
 	    {
 	      tsp_usleep(10000);
@@ -261,7 +259,7 @@
 
 	  if(rqh_p->status != TSP_RQH_STATUS_STOPPED)
 	    {
-	      STRACE_ERROR(("Could not stop handler # %d, canceling", rank));
+	      STRACE_ERROR("Could not stop handler # %d, canceling", rank);
 	      pthread_cancel(rqh_p->tid);
 	    }
 	  rqh_manager_if.nb_running_rhq--;
@@ -269,17 +267,17 @@
     } /* End while loop over running request handlers */
 
   TSP_UNLOCK_MUTEX(&rqh_manager_if.mutex,FALSE);
-
   return TRUE;
 } /* end of TSP_provider_rqh_manager_end */
 
-
 void TSP_provider_rqh_manager_waitend() {
 
   TSP_LOCK_MUTEX(&rqh_manager_if.mutex,);
+
   while (rqh_manager_if.nb_running_rhq > 0) {
-    pthread_cond_wait(&rqh_manager_if.cond,&rqh_manager_if.mutex);
+     pthread_cond_wait(&rqh_manager_if.cond,&rqh_manager_if.mutex);
   }
+
   TSP_UNLOCK_MUTEX(&rqh_manager_if.mutex,);
-  STRACE_DEBUG(("No more Request Hanndler running -->terminate"));
+  STRACE_DEBUG("No more Request Handler running -->terminate");
 } /* end of TSP_provider_rqh_manager_waitend */
diff -urN tsp_orig/src/core/ctrl/tsp_session.c tsp_modified/src/core/ctrl/tsp_session.c
--- tsp_orig/src/core/ctrl/tsp_session.c	2007-03-01 18:36:41.000000000 +0100
+++ tsp_modified/src/core/ctrl/tsp_session.c	2009-01-12 17:26:08.000000000 +0100
@@ -54,11 +54,12 @@
 #include <tsp_data_sender.h>
 #include <tsp_datapool.h>
 
+
 #define TSP_GET_SESSION(session, channel_id, ret)			\
   {									\
     if( NULL == (session = TSP_get_session(channel_id) ) )		\
       {									\
-	STRACE_ERROR(("Unable to get session for channel_id=%u",channel_id)); \
+	STRACE_ERROR("Unable to get session for channel_id=%u",channel_id); \
 	TSP_UNLOCK_MUTEX(&X_session_list_mutex,ret);			\
       }									\
   }
@@ -111,10 +112,10 @@
 	
   TSP_session_t* session = NULL;
   int i = 0;
-	
+ 
   for( i = 0 ;  i < X_session_nb ; i++) {
     if( X_session_t[i].channel_id == channel_id ) {
-      STRACE_DEBUG(("Channel_id = <%d> is session Idx <%d>", channel_id,i));
+      STRACE_DEBUG("Channel_id = <%d> is session Idx <%d> ", channel_id,i);
       assert(X_session_t[i].session_data);
       session = &(X_session_t[i]);
       break;			
@@ -122,7 +123,7 @@
   }
   
   if( NULL == session ) { 
-    STRACE_ERROR(("No session found for channel_id=%u", channel_id));    
+    STRACE_ERROR("No session found for channel_id=%u", channel_id);    
   }
 	
   return session ;
@@ -144,11 +145,12 @@
   case TSP_SESSION_STATE_REQUEST_SAMPLE_DESTROY_OK:
   case TSP_SESSION_STATE_BROKEN_LINK:
   case TSP_SESSION_STATE_CLOSE_ON_EOF:
-    STRACE_INFO(("Session was in state <%d> goes to <%d>",session->state,newState))
+   
+    STRACE_INFO("Session was in state <%d> goes to <%d>",session->state,newState);
     session->state = newState;
     break;
   default:
-    STRACE_ERROR(("Unknown transition from state <%d> to <%d> IGNORED.",session->state,newState));
+    STRACE_ERROR("Unknown transition from state <%d> to <%d> IGNORED.",session->state,newState);
     retcode = TSP_STATUS_ERROR_UNKNOWN; 
     break;
   }
@@ -161,7 +163,8 @@
 TSP_session_close_session(channel_id_t channel_id) {
   int ret = FALSE;
   TSP_session_t* session = NULL;
-  STRACE_DEBUG(("Request Closing session channel_id = %d", channel_id));
+  
+  STRACE_DEBUG("Request Closing session channel_id = %d ", channel_id);
   session = TSP_get_session(channel_id);
   if (NULL != session) {
     assert(session->session_data);
@@ -170,12 +173,12 @@
     /* Fill the hole with latest element */
     *session = X_session_t[X_session_nb - 1];
     X_session_nb--;
-    STRACE_DEBUG(("X_session_nb now = %d.", X_session_nb));
+    STRACE_DEBUG("X_session_nb now = %d. ", X_session_nb);
     ret = TRUE;
   }
 
   if(!ret) {
-    STRACE_WARNING(("Unable to find session number %d", channel_id));
+    STRACE_WARNING("Unable to find session number %d", channel_id);
   }
 
 } /* end of TSP_session_close_session */
@@ -187,16 +190,15 @@
   if(NULL != session->session_data->datapool) {
     TSP_datapool_delete(&(session->session_data->datapool));
   }
-  
   /* Erase the group table */
   TSP_group_algo_destroy_symbols_table(session->session_data->groups);
 } /* end of TSP_session_destroy_symbols_table */
 
 void 
 TSP_session_init() {
-  if( FALSE == X_initialized )
-    {
-      /* Mise a 0 de la zone memoire */
+   if( FALSE == X_initialized )
+    { 
+       /* Mise a 0 de la zone memoire */
       memset(X_session_t, 0, TSP_MAX_CLIENT_NUMBER*sizeof(TSP_session_t));
       X_initialized = TRUE;
     }
@@ -205,6 +207,7 @@
 GLU_handle_t* 
 TSP_session_get_GLU_by_channel(channel_id_t channel_id) {
   TSP_session_t* session = NULL;
+  
   TSP_LOCK_MUTEX(&X_session_list_mutex,NULL);
   TSP_GET_SESSION(session,channel_id,NULL);  
   TSP_UNLOCK_MUTEX(&X_session_list_mutex,NULL);
@@ -214,7 +217,6 @@
 void 
 TSP_session_close_session_by_channel(channel_id_t channel_id) {
   TSP_LOCK_MUTEX(&X_session_list_mutex,);
-
   TSP_session_close_session(channel_id);
 
   TSP_UNLOCK_MUTEX(&X_session_list_mutex,);
@@ -227,7 +229,6 @@
   TSP_session_state_t retval=TSP_SESSION_STATE_UNKNOWN;
 
   TSP_LOCK_MUTEX(&X_session_list_mutex,retval);
-
   session = TSP_get_session(channel_id);
   if (NULL!=session) {
     retval= session->state;
@@ -243,6 +244,7 @@
   int client_number;
 
   TSP_LOCK_MUTEX(&X_session_list_mutex,-1);  
+  
   client_number = X_session_nb;  
   TSP_UNLOCK_MUTEX(&X_session_list_mutex,-1);
   return client_number;
@@ -252,12 +254,12 @@
 TSP_add_session(channel_id_t* new_channel_id, GLU_handle_t* glu_h) {
   
   *new_channel_id = (channel_id_t)(TSP_UNDEFINED_CHANNEL_ID);
-	
+ 
   TSP_LOCK_MUTEX(&X_session_list_mutex,TSP_STATUS_ERROR_UNKNOWN);
 
   /* Is there room left for the new session ? */
   if( X_session_nb == TSP_MAX_CLIENT_NUMBER) {
-    STRACE_ERROR(("Max session number reached : %d", TSP_MAX_CLIENT_NUMBER));
+    STRACE_ERROR("Max session number reached : %d", TSP_MAX_CLIENT_NUMBER);
     /* do not forget to unlock!! */
     TSP_UNLOCK_MUTEX(&X_session_list_mutex,TSP_STATUS_ERROR_UNKNOWN);
     return TSP_STATUS_ERROR_NO_MORE_SESSION;
@@ -266,7 +268,7 @@
   /* Create a new channel Id*/
   *new_channel_id = X_count_channel_id++;
   
-  STRACE_DEBUG(("I've found room in X_session_t for the new session. Id in X_session_t is %d", X_session_nb));
+  STRACE_DEBUG("I've found room in X_session_t for the new session. Id in X_session_t is %d ", X_session_nb);
   
   /* The position is always X_session_nb, 
    * 'coz' any holes in array are filled during session removal 
@@ -287,11 +289,10 @@
   
   /* OK, there's a new session*/
   X_session_nb++;
-  
-  STRACE_INFO(("New consumer registered with TSP channel_id=%u", *new_channel_id ));
+ 
+  STRACE_INFO("New consumer registered with TSP channel_id=%u ", *new_channel_id );
   	
   TSP_UNLOCK_MUTEX(&X_session_list_mutex,FALSE);
-
   return TSP_STATUS_OK;
 } /* end of TSP_add_session */
 
@@ -299,7 +300,8 @@
 TSP_session_change_stateTo_byChannel(channel_id_t channel_id, TSP_session_state_t newState) {
 
   TSP_session_t * session;
-
+  
+  
   TSP_LOCK_MUTEX(&X_session_list_mutex,TSP_STATUS_ERROR_UNKNOWN);
   TSP_GET_SESSION(session,channel_id,TSP_STATUS_ERROR_INVALID_CHANNEL_ID);  
   TSP_UNLOCK_MUTEX(&X_session_list_mutex,TSP_STATUS_ERROR_UNKNOWN) ;   
@@ -355,7 +357,7 @@
       TSP_group_algo_get_group_number(session->session_data->groups);
   }
   else {
-    STRACE_ERROR(("Function TSP_group_algo_create_symbols_table failed"));    
+    STRACE_ERROR("Function TSP_group_algo_create_symbols_table failed");    
   }
     
   TSP_UNLOCK_MUTEX(&X_session_list_mutex,FALSE);
@@ -369,7 +371,7 @@
 
   TSP_session_t* session;
   int ret;
-
+  
   TSP_LOCK_MUTEX(&X_session_list_mutex,FALSE);
 	
   TSP_GET_SESSION(session, channel_id, FALSE);
@@ -377,7 +379,6 @@
   ret = (session->session_data->glu_h)->get_ssi_list(session->session_data->glu_h, symbol_list);
   
   TSP_UNLOCK_MUTEX(&X_session_list_mutex,FALSE);
-  
   return ret;
 
 }
@@ -404,7 +405,7 @@
       ) {
 
     if(!TSP_data_sender_send_msg_ctrl(session->session_data->sender, msg_ctrl)) {
-      STRACE_WARNING(("Data link broken for session No %d",channel_id ));
+      STRACE_WARNING("Data link broken for session No %d",channel_id );
       session->state = TSP_SESSION_STATE_BROKEN_LINK;
     }
   } else {
@@ -418,16 +419,16 @@
 TSP_session_all_session_send_data(time_stamp_t t) {
   int i;
   TSP_session_t* currentSession;
-
-  TSP_LOCK_MUTEX(&X_session_list_mutex,);
+   
+   TSP_LOCK_MUTEX(&X_session_list_mutex,);
 
   /* Loop over all ACTIVE sessions */
   for (i = 0 ; i< X_session_nb ; ++i) {
-
     /* promote session to SAMPLING if consumer is connected */
     if (TSP_SESSION_STATE_REQUEST_SAMPLE_INIT_OK == X_session_t[i].state) {
       if (TRUE==TSP_data_sender_is_consumer_connected(X_session_t[i].session_data->sender)) {
-	TSP_session_change_stateTo(&(X_session_t[i]),TSP_SESSION_STATE_SAMPLING);
+	   
+	    TSP_session_change_stateTo(&(X_session_t[i]),TSP_SESSION_STATE_SAMPLING);
       }
     }
     /* 
@@ -438,15 +439,15 @@
       int32_t waitconsumer = 1;
       currentSession = &X_session_t[i];
       while (1==waitconsumer) {
-
+         
 	if (TSP_SESSION_STATE_BROKEN_LINK==currentSession->state) {
-	  STRACE_DEBUG(("Data link broken (during wait loop) for session = %d / idx = %d.",currentSession->channel_id,i));
+	  STRACE_DEBUG("Data link broken (during wait loop) for session = %d / idx = %d.",currentSession->channel_id,i);
 	  waitconsumer = 0;
 	  continue;
 	}
 	
 	if (TSP_SESSION_STATE_CLOSED==currentSession->state) {
-	  STRACE_DEBUG(("Session closed (during wait loop) for session = %d / idx = %d.",currentSession->channel_id,i));
+	  STRACE_DEBUG("Session closed (during wait loop) for session = %d / idx = %d.",currentSession->channel_id,i);
 	  waitconsumer = 0;
 	  continue;
 	}
@@ -456,16 +457,15 @@
 	  waitconsumer = 0;	  
 	  continue;
 	}		
-
 	/* Dangerous but should be OK for passive GLU though */
 	TSP_UNLOCK_MUTEX(&X_session_list_mutex,);
 	tsp_usleep(500000);	
 	TSP_LOCK_MUTEX(&X_session_list_mutex,);
-
-	STRACE_DEBUG(("Waiting session (session = %d / idx = %d) to reach SAMPLING state now %d...",currentSession->channel_id,i,currentSession->state));
+	STRACE_DEBUG("Waiting session (session = %d / idx = %d) to reach SAMPLING state now %d...",currentSession->channel_id,i,currentSession->state);
 
 	if (TSP_SESSION_STATE_REQUEST_SAMPLE_INIT_OK == currentSession->state) {
 	  if (TRUE==TSP_data_sender_is_consumer_connected(currentSession->session_data->sender)) {
+          
 	    TSP_session_change_stateTo(currentSession,TSP_SESSION_STATE_SAMPLING);
 	  }
 	}
@@ -481,7 +481,7 @@
 				 X_session_t[i].session_data->groups, 
 				 t))
 	  {
-	    STRACE_WARNING(("Data link broken for session No %d",X_session_t[i].channel_id ));
+	    STRACE_WARNING("Data link broken for session No %d",X_session_t[i].channel_id );
 	    X_session_t[i].state = TSP_SESSION_STATE_BROKEN_LINK;		  
 	  }
       }
@@ -494,9 +494,10 @@
 void 
 TSP_session_all_session_send_msg_ctrl(TSP_msg_ctrl_t msg_ctrl) {
   int i;
-
+  
+  
   TSP_LOCK_MUTEX(&X_session_list_mutex,);
-
+  
   for( i = 0 ; i< X_session_nb ; i++) {
     if( X_session_t[i].session_data->groups /* The sample request was done */
 	&& X_session_t[i].session_data->sender /* The sample request init was done */
@@ -504,7 +505,7 @@
       {
 	
 	if(!TSP_data_sender_send_msg_ctrl(X_session_t[i].session_data->sender, msg_ctrl)) {
-	  STRACE_WARNING(("Data link broken for session No %d",X_session_t[i].channel_id ));
+	  STRACE_WARNING("Data link broken for session No %d",X_session_t[i].channel_id );
 	  X_session_t[i].state = TSP_SESSION_STATE_BROKEN_LINK;	      
 	} else if (TSP_MSG_CTRL_EOF==msg_ctrl) {
 	  /* terminate session on EOF (passive GLU case) please */
@@ -556,12 +557,12 @@
     if ( base_frequency > 0.0 ) {
       ringbuf_size = TSP_STREAM_SENDER_RINGBUF_SIZE * base_frequency;
       
-      STRACE_DEBUG(("Stream sender ringbuf size will be : %d items (i.e. %d seconds)",
+      STRACE_DEBUG("Stream sender ringbuf size will be : %d items (i.e. %d seconds)",
 		    ringbuf_size,
-		    TSP_STREAM_SENDER_RINGBUF_SIZE));
+		    TSP_STREAM_SENDER_RINGBUF_SIZE);
     }
     else {
-      STRACE_ERROR(("GLU return base frequency = %f", base_frequency));
+      STRACE_ERROR("GLU return base frequency = %f", base_frequency);
       retcode = TSP_STATUS_ERROR_UNKNOWN;
     }
   }
@@ -570,11 +571,13 @@
   /* Create data sender */
   /*--------------------*/
   if (TSP_STATUS_OK==retcode) {
+
     uint32_t max_group_size = TSP_group_algo_get_biggest_group_size(session->session_data->groups);
-    STRACE_DEBUG(("Channel Id <%d> has Max TSP Group Size <%d> byte(s)",
-		  channel_id,max_group_size));
-    STRACE_DEBUG(("Using RINBUF size of <%d> byte(s)",
-		  ringbuf_size));
+    STRACE_DEBUG("Channel Id <%d> has Max TSP Group Size <%d> byte(s)",
+		  channel_id,max_group_size);
+    STRACE_DEBUG("Using RINBUF size of <%d> byte(s)",
+		  ringbuf_size);
+
     session->session_data->sender = TSP_data_sender_create(ringbuf_size, max_group_size);      
     if(NULL != session->session_data->sender) {
       /* If there's no fifo, 
@@ -589,16 +592,16 @@
 	 */
 	if (0!=(session->session_data->glu_h->start(session->session_data->glu_h))) {
 	  retcode = TSP_STATUS_ERROR_GLU_START;
-	  STRACE_ERROR(("Unable to start GLU (PASSIVE case)"));
+	  STRACE_ERROR("Unable to start GLU (PASSIVE case)");
 	} else {
-	  STRACE_DEBUG(("PASSIVE GLU started."));
+	  STRACE_DEBUG("PASSIVE GLU started.");
 	  retcode = TSP_STATUS_OK;
 	}
       }
     }
     else {
       retcode = TSP_STATUS_ERROR_UNKNOWN;
-      STRACE_ERROR(("function TSP_data_sender_create failed"));      
+      STRACE_ERROR("function TSP_data_sender_create failed");      
     }
   }
   
@@ -645,8 +648,8 @@
   data_address = TSP_data_sender_get_data_address_string(session->session_data->sender);
     
   TSP_UNLOCK_MUTEX(&X_session_list_mutex,FALSE);
-
-  STRACE_DEBUG_MORE(("data_address='%s'",data_address ));
+  
+  STRACE_DEBUG_MORE("data_address='%s'",data_address );
 
     
   return data_address;
@@ -683,14 +686,13 @@
     TSP_GET_SESSION(session, channel_id, FALSE);    
     
     if (pg_indexes == NULL) {
-      STRACE_ERROR(("Unable to allocate memory for global provider index"));
+      STRACE_ERROR("Unable to allocate memory for global provider index");
       return FALSE;
     }
-  
     /* Get global provider indexes */
     myGLU = session->session_data->glu_h;
     if (myGLU->get_pgi(myGLU,symbol_list,pg_indexes) == FALSE) {
-      STRACE_ERROR(("Some symbols have not been found"));
+      STRACE_ERROR("Some symbols have not been found");
       ret=FALSE;
     }
      
@@ -706,9 +708,9 @@
   int found;
 	
   TSP_LOCK_MUTEX(&X_session_list_mutex,FALSE);
-
   found = FALSE;
-  /* There is multiple criterion for session garbage collection */  
+  
+  /* There is multiple cirterion for session garbage collection */  
   for( i = 0 ;  i < X_session_nb ; i++) {
 
     /* Do not garbage collect session in the following state */
@@ -721,7 +723,7 @@
     /* Garbage collect Data link broken session */
     if (X_session_t[i].state == TSP_SESSION_STATE_BROKEN_LINK ) {
       found = TRUE;
-      STRACE_INFO(("Garbage Collector thread found broken link session <%d>",X_session_t[i].channel_id));
+      STRACE_INFO("Garbage Collector thread found broken link session <%d>",X_session_t[i].channel_id);
       *channel_id = X_session_t[i].channel_id;
       break;
     } 
@@ -750,8 +752,8 @@
 	    ((TSP_SESSION_STATE_SAMPLING                  == X_session_t[i].state)  || 
 	     (TSP_SESSION_STATE_REQUEST_SAMPLE_DESTROY_OK == X_session_t[i].state)
 	     )
-	    ){
-	  STRACE_INFO(("Garbage Collector thread found Datapool TERMINATED for session <%d>",X_session_t[i].channel_id));
+	    ){ 
+	  STRACE_INFO("Garbage Collector thread found Datapool TERMINATED for session <%d>",X_session_t[i].channel_id);
 	  found = TRUE;
 	  *channel_id = X_session_t[i].channel_id;
 	}
@@ -761,6 +763,5 @@
   }
 	
   TSP_UNLOCK_MUTEX(&X_session_list_mutex,FALSE);
-
   return found;
 } /* end of TSP_session_get_garbage_session */
diff -urN tsp_orig/src/core/ctrl/tsp_session.h tsp_modified/src/core/ctrl/tsp_session.h
--- tsp_orig/src/core/ctrl/tsp_session.h	2006-10-18 11:58:48.000000000 +0200
+++ tsp_modified/src/core/ctrl/tsp_session.h	2009-01-12 17:26:08.000000000 +0100
@@ -50,7 +50,7 @@
  * @param glu_h The GLU handled that will be linked to the session
  * @return TRUE or FALSE. TRUE = OK.
  */
-int TSP_add_session(channel_id_t* new_channel_id, GLU_handle_t* glu_h);
+int32_t TSP_add_session(channel_id_t* new_channel_id, GLU_handle_t* glu_h);
 
 /**
  * Session initialisation.
diff -urN tsp_orig/src/core/ctrl/tsp_stream_sender.c tsp_modified/src/core/ctrl/tsp_stream_sender.c
--- tsp_orig/src/core/ctrl/tsp_stream_sender.c	2006-10-21 10:48:00.000000000 +0200
+++ tsp_modified/src/core/ctrl/tsp_stream_sender.c	2009-01-12 17:26:08.000000000 +0100
@@ -35,8 +35,12 @@
 -----------------------------------------------------------------------
  */
 
+
 #include <signal.h>
 #include <pthread.h>
+//For GETHOSTBYNAME macro
+#include <../common/tsp_common_macros.h>
+
 #ifdef WIN32
     #include <Windows.h>
     #include <WinSock2.h>
@@ -50,6 +54,10 @@
     #include <sys/socket.h>
     #include <assert.h>
 #endif
+#ifdef VXWORKS
+    #include <libgen.h>
+    #include <inetLib.h>
+#endif
 
 #if !defined (VXWORKS) && !defined(WIN32)
 #include <strings.h> /* for bzero */
@@ -166,14 +174,15 @@
   static int status = 0;
      
   /* Wait for consumer connection before we send data */  
-
-  STRACE_DEBUG(("Thread stream sender created : waiting for client to connect..."));
+ 
+  STRACE_DEBUG("Thread stream sender created : waiting for client to connect...");
   while(!sock->client_is_connected)
     {
       tsp_usleep(TSP_STREAM_SENDER_CONNECTION_POLL_TIME);
      
     }
-  STRACE_DEBUG(("Client connected ! Send loop starts !"));
+ 
+  STRACE_DEBUG("Client connected ! Send loop starts !");
 
   item = RINGBUF_PTR_GETBYADDR(sock->out_ringbuf);
   /* FIXME : gerer l'arret */
@@ -193,11 +202,11 @@
     }
 
   if(!sock->is_stopped)
-    {
-      STRACE_DEBUG(("Connection with client was lost ! "));
+    { 
+      STRACE_DEBUG("Connection with client was lost ! ");
     }
-
-  STRACE_DEBUG(("End of fifo thread stream sender"));
+ 
+  STRACE_DEBUG("End of fifo thread stream sender");
   return &status;
 }
 
@@ -240,37 +249,36 @@
   strcpy(sock->data_address, host);
   strcat(sock->data_address, ":");    
   strcat(sock->data_address, strPort);
-    
-  STRACE_DEBUG_MORE(("address='%s'", sock->data_address));
+  
+  STRACE_DEBUG_MORE("address='%s'", sock->data_address);
 }
 
 static void* TSP_streamer_sender_connector(void* arg)
 {
   /* FIXME : When the client can't find us (somehow, ex : routing error on the network)
      this function badly leaks */
-    
+  
   TSP_socket_t* sock = (TSP_socket_t*)arg;
-  socklen_t Len = 0;
+  u_int Len = 0;
   sock->client_is_connected = FALSE;
-    
+  
   pthread_detach(pthread_self());
     
   /* Accept connection on socket */
-  STRACE_DEBUG(("Thread acceptor started waiting for client to connect %d", sock->hClient));
+  STRACE_DEBUG("Thread acceptor started waiting for client to connect %d", sock->hClient);
 #if defined (WIN32)  
   sock->hClient = accept(sock->socketId, NULL, NULL);
 #else
   /* FIXME */
   sock->hClient = accept(sock->socketId, NULL, &Len);
 #endif
-
   if(sock->hClient > 0) {
     /* OK, the client is connected */
     sock->client_is_connected = TRUE;
-    STRACE_DEBUG(("New connection accepted on socket client socket %d", sock->hClient));
+    STRACE_DEBUG("New connection accepted on socket client socket %d", sock->hClient);
   }
   else {
-    STRACE_ERROR(("Accept error"));
+    STRACE_ERROR("Accept error");
     close(sock->socketId);
     return 0;
   }
@@ -282,9 +290,6 @@
 {   
     
   TSP_socket_t* sock = (TSP_socket_t*)sender;
-    
-  STRACE_INFO(("-->address='%s'", sock->data_address));
-
   return sock->data_address;
 }
 
@@ -296,41 +301,42 @@
   char host[TSP_MAXHOSTNAMELEN+1];
   TSP_socket_t* sock;
   pthread_t thread_connect_id;
+  struct in_addr addr;
   struct hostent*  myhost;
   union {
     uint32_t    addr;
     uint8_t     parts[4];
   } myu;
+ 
+   //test
+  char *plast;
 
 #if defined (WIN32)
   /* no SIGPIPE signal under Windows (waitforsingleobject insteed) */
 #else
   /* First disable SIGPIPE signal to avoir being crashed by a disconnected client*/
   if( SIG_ERR == MySignal(SIGPIPE, SIG_IGN)) {
-    STRACE_ERROR(("Unable to disable SIGPIPE signal"));
+    STRACE_ERROR("Unable to disable SIGPIPE signal");
     return 0;
   }
 #endif
+  
   if( -1 == gethostname(host, TSP_MAXHOSTNAMELEN))
     {
-      STRACE_ERROR(("gethostname error"));
+      STRACE_ERROR("gethostname error");
 
       return 0;
     }
-  myhost = gethostbyname(host);
-  if (myhost == NULL) {
-    STRACE_ERROR(("Cannot gethostbyname '(hostname --> @IP)' for host <%s> check your /etc/hosts file.\n",host));
-    /* be tolerant we keep going with hostname but... consumer may not handle this properly */    
-  } else {
-     /* 
-      * Now translate hostname to @IP in order
-      * to avoid name -> IP resolution on consumer side 
-      */
-    memset(host,0,sizeof(host));
-    myu.addr = (uint32_t)ntohl(*((uint32_t*)myhost->h_addr_list[0]));
-    sprintf(host,"%d.%d.%d.%d",myu.parts[3], myu.parts[2], myu.parts[1], myu.parts[0]);
-  }
-     
+  
+
+  GETHOSTBYNAME(host,myhost,addr)
+
+  memset(host,0,sizeof(host));
+  myu.addr=(uint32_t)inet_addr(myhost->h_addr_list[0]);    
+  sprintf(host,"%d.%d.%d.%d",myu.parts[0],myu.parts[1],myu.parts[2],myu.parts[3]);
+
+  GETHOSTBYNAME_FREE(myhost)
+  
   sock = (TSP_socket_t*)calloc(1, sizeof(TSP_socket_t));
   TSP_CHECK_ALLOC(sock, 0);
 
@@ -344,6 +350,7 @@
   sock->connection_ok = TRUE;
   
   /* Init socket */
+
   sock->socketId = socket(AF_INET, SOCK_STREAM, 0);
 
   if (sock->socketId > 0)
@@ -351,9 +358,9 @@
       OptInt = TSP_DATA_STREAM_SOCKET_FIFO_SIZE;
       status = setsockopt(sock->socketId, SOL_SOCKET, SO_SNDBUF, (void * )&OptInt, sizeof(OptInt));
       if (status == -1)
-	{
-	  STRACE_ERROR(("Probleme with set socket size"));
-
+	{ 
+         
+	  STRACE_ERROR("Probleme with set socket size");
 	  close(sock->socketId);
 	  return 0;
 	}
@@ -364,8 +371,8 @@
       status = setsockopt(sock->socketId, SOL_SOCKET, SO_REUSEADDR,
 			  (void *) &OptInt, sizeof(OptInt));
       if (status == -1)
-	{
-          STRACE_ERROR(("pb set local address reuse"));
+	{         
+          STRACE_ERROR("pb set local address reuse");
 	  close(sock->socketId);
 	  return 0;
 	}
@@ -376,8 +383,7 @@
 			  (void *) &OptInt, sizeof(OptInt));
       if (status == -1)
 	{
-	  STRACE_ERROR(("pb set periodic state control"));
-
+	  STRACE_ERROR("pb set periodic state control");
 	  close(sock->socketId);
 	  return 0;
 	}
@@ -387,9 +393,8 @@
       status = setsockopt(sock->socketId, IPPROTO_TCP, TCP_NODELAY, (void *) &OptInt,
 			  sizeof(OptInt));
       if (status == -1)
-	{
-	  STRACE_ERROR(("pb set TCP no delay"));
-
+	{ 
+	  STRACE_ERROR("pb set TCP no delay");
 	  close(sock->socketId);
 	  return 0;
 	}
@@ -406,33 +411,47 @@
 	ListenAddr.sin_len = sizeof(ListenAddr);
 #endif
 	ListenAddr.sin_addr.s_addr = htonl(INADDR_ANY);
+	
+	//Maybe removable ...
+	if(getenv("REMOTE_TSP_PORT_NUM") != (char *)0) 
+	{	
+	  printf("OK FOR REMOTE TEST \n");
+	  //Port used to dispatch packet in alf3cdt
+	  //Just used for test
+	  ListenAddr.sin_port=htons(49152);
+	}
 
 	/* The kernel will choose a free port */
-	status = bind(sock->socketId, (struct sockaddr*) &ListenAddr, sizeof (struct sockaddr_in));
 
+	status = bind(sock->socketId, (struct sockaddr*) &ListenAddr, sizeof (struct sockaddr_in));
+	
 	if (status != -1)
 	  {
 	    /* Find the chosen port*/
 	    struct sockaddr_in buf_addr;
-	    socklen_t len = sizeof(buf_addr);
+	    u_int len = sizeof(buf_addr);
 	    if( 0 ==  getsockname(sock->socketId, (struct sockaddr*) &buf_addr, &len) )
 	      {
 		/* Save the address in the tsp_socket struct */
 		unsigned short port =  ntohs(buf_addr.sin_port);
-		TSP_stream_sender_save_address_string(sock, host, port);
+   
+		//test for distant connection (in astrium network) outside the private networks
+		if(getenv("REMOTE_TSP_PORT_NUM") != (char *)0) 
+		  TSP_stream_sender_save_address_string(sock,"alf3cdt",port);
+		else
+		  TSP_stream_sender_save_address_string(sock,host,port);
 	      }
 	    else
-	      {
-		STRACE_ERROR(("getsockname failed"));
-		  
+	      { 
+
+     		STRACE_ERROR("getsockname failed");
 		close(sock->socketId);
 		return 0;
 	      }
 	  }
 	else
-	  {
-	    STRACE_ERROR(("pb bind to socket"));
-	    
+	  { 
+	    STRACE_ERROR("pb bind to socket");
 	    close(sock->socketId);
 	    return 0;
 	  }
@@ -442,9 +461,8 @@
       /* Try and listen onto socket */
       status = listen (sock->socketId, SOMAXCONN);
       if (status == -1)
-	{
-	  STRACE_ERROR(("pb listening to socket"));
-
+	{ 
+	  STRACE_ERROR("pb listening to socket");
 	  close(sock->socketId);
 	  return 0;
 	}
@@ -454,8 +472,8 @@
       if(sock->fifo_size > 0 )	
 	{
 	  if(!TSP_stream_sender_init_bufferized(sock))
-	    {
-	      STRACE_ERROR(("Function TSP_stream_sender_init_bufferized failed"));
+	    { 
+ 	      STRACE_ERROR("Function TSP_stream_sender_init_bufferized failed");
 	      close(sock->socketId);	  
 	      return 0;
 	    }
@@ -470,8 +488,7 @@
       
       /* When the client is be connected, the thread function
 	 TSP_streamer_sender_connector will set the client_is_connected  var to TRUE */            
-      
-      status = pthread_create(&thread_connect_id, NULL, TSP_streamer_sender_connector,  sock);
+       status = pthread_create(&thread_connect_id, NULL, TSP_streamer_sender_connector,  sock);
       TSP_CHECK_THREAD(status, FALSE);      
 
     }
@@ -502,7 +519,7 @@
    TSP_socket_t* sock = (TSP_socket_t*)sender;
    
    sock->is_stopped = TRUE;
-
+   
    shutdown(sock->socketId, SHUT_RDWR);
    shutdown(sock->hClient, SHUT_RDWR);
    close(sock->socketId);
@@ -542,9 +559,9 @@
 	}
 	else {		  
 #ifdef WIN32
-     STRACE_DEBUG(("send failed with errno = %d : <%s>",WSAGetLastError(),strerror(errno)));   
-#else
-	  STRACE_ERROR(("send failed with errno = %d : <%s>",errno,strerror(errno)));
+     STRACE_DEBUG("send failed with errno = %d : <%s>",WSAGetLastError(),strerror(errno));   
+#else     
+	  STRACE_ERROR("send failed with errno = %d : <%s>",errno,strerror(errno));
 #endif
 	  sock->connection_ok = FALSE;
 	  return FALSE;
@@ -554,7 +571,7 @@
       bufferLen -= nwrite;
     } /* end while buffer not written fully */ 
   } else {
-    STRACE_ERROR(("identSocket = %d",identSocket));
+    STRACE_ERROR("identSocket = %d",identSocket);
     return (FALSE);
   }
 
diff -urN tsp_orig/src/core/ctrl_init/tsp_provider_init.c tsp_modified/src/core/ctrl_init/tsp_provider_init.c
--- tsp_orig/src/core/ctrl_init/tsp_provider_init.c	2007-04-26 19:51:30.000000000 +0200
+++ tsp_modified/src/core/ctrl_init/tsp_provider_init.c	2009-01-12 17:26:08.000000000 +0100
@@ -10,7 +10,7 @@
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
+License as published by the Free Software Foundation; ether
 version 2.1 of the License, or (at your option) any later version.
 
 This library is distributed in the hope that it will be useful,
@@ -35,6 +35,7 @@
 
 -----------------------------------------------------------------------
  */
+
 #include <string.h>
 
 #include <tsp_sys_headers.h>
@@ -59,23 +60,27 @@
   int32_t retcode = TSP_STATUS_OK;
 
 #if defined (WIN32)
-  if (WSAStartup(MAKEWORD(2,2), &WSAData)) {
+  if0 (WSAStartup(MAKEWORD(2,2), &WSAData)) {
 	WSACleanup();
 	retcode = TSP_STATUS_NOK;
     return retcode;
    }
 #endif
-
+  
   retcode = TSP_provider_private_init(theGLU,argc, argv);
   
   /* Initialize tsp request handlers structures */
   if (TSP_STATUS_OK==retcode) {
+    
     if (TRUE != TSP_provider_rqh_manager_init()) {
       retcode = TSP_STATUS_ERROR_UNKNOWN;
+      
     } else {
       /* install atexit handler to close properly */
+       
       atexit(TSP_provider_end);
-    }  
+  
+      }  
   }
 
   return retcode;
@@ -85,16 +90,15 @@
 TSP_provider_run(int spawn_mode) {
   int32_t retcode = TSP_STATUS_OK;
 
-  if (TSP_provider_is_initialized()) {            
+  if (TSP_provider_is_initialized()) { 
+  
       /* build and install default request handler (RPC) */
       TSP_provider_rqh_manager_install(0,TSP_rpc_request);
 #ifdef BUILD_XMLRPC
       TSP_provider_rqh_manager_install(1,TSP_xmlrpc_request);
 #endif
 
-
-
-      if (spawn_mode & TSP_ASYNC_REQUEST_DYNAMIC) {
+        if (spawn_mode & TSP_ASYNC_REQUEST_DYNAMIC) {
 	/*
 	 * un-comment this if you want to test
 	 * more then one RPC request handler
@@ -108,7 +112,7 @@
       if (TRUE != TSP_provider_rqh_manager_refresh()) {
 	retcode = TSP_STATUS_ERROR_UNKNOWN;
       }
-      
+  
       if (TSP_STATUS_OK==retcode) {
 	retcode = TSP_provider_private_run();
       }
@@ -125,10 +129,10 @@
       }
     }
   else {
-    STRACE_ERROR(("Call TSP_provider_init first, and then call TSP_provider_run ! "));
+    STRACE_ERROR("Call TSP_provider_init first, and then call TSP_provider_run ! ");
     retcode = TSP_STATUS_ERROR_UNKNOWN;
   }
-  
+ 
   return retcode;  
   
 } /* TSP_provider_run */
@@ -137,7 +141,7 @@
 void 
 TSP_provider_end() {
   /* TODO : call flush on streams */
-
+ 
   /* remove any published URL */
   {
 #if !defined (WIN32)
@@ -146,10 +150,8 @@
     system(systemCmd);
 #endif
   }
-
   /* Call handlers end function */
   TSP_provider_rqh_manager_end();
-
 #if defined (WIN32)
     WSACleanup();
 #endif
@@ -178,7 +180,7 @@
 	      urls[rank] = strdup(url);
 
 	      if(pub_mode & TSP_PUBLISH_URLS_PRINT)
-		printf("TSP Provider on PID %d - URL #%d : <%s>\n", getpid(), rank, url);
+		STRACE_INFO("TSP Provider on PID %d - URL #%d : <%s>\n", getpid(), rank, url);
 
 	      if(pub_mode & TSP_PUBLISH_URLS_FILE)
 		{
@@ -191,11 +193,11 @@
 
 	      if(pub_mode & TSP_PUBLISH_URLS_SNMP)
 		/* TODO */
-		STRACE_ERROR(("SNMP publication of TSP URLs not yet implemented\n"));
+		STRACE_ERROR("SNMP publication of TSP URLs not yet implemented\n");
 	    }
 	  else
 	    {
-	      STRACE_ERROR(("Request Handler #%d did not provided an URL", rank));
+	      STRACE_ERROR("Request Handler #%d did not provided an URL", rank);
 	      urls[rank] = strdup("");
 	    }
 	}
@@ -203,3 +205,4 @@
   return urls;
 } /* TSP_provider_urls */
 
+
diff -urN tsp_orig/src/core/driver/tsp_consumer.c tsp_modified/src/core/driver/tsp_consumer.c
--- tsp_orig/src/core/driver/tsp_consumer.c	2007-04-26 19:51:30.000000000 +0200
+++ tsp_modified/src/core/driver/tsp_consumer.c	2009-01-12 17:26:08.000000000 +0100
@@ -57,12 +57,12 @@
 	{ \
 		if (0 == session) \
 		{  \
-			STRACE_ERROR(("The session object is NULL !")) \
+			STRACE_ERROR("The session object is NULL !"); \
 			return (ret); \
 		} \
 		if( TSP_UNDEFINED_CHANNEL_ID == session->channel_id) \
 		{  \
-			STRACE_ERROR(("No Channel Id available, the session need to be opened first !")) \
+			STRACE_ERROR("No Channel Id available, the session need to be opened first !"); \
 			return (ret); \
 		} \
 	}
@@ -174,8 +174,8 @@
   otsp->information.max_client_number     = ans_sample->max_client_number;
   otsp->information.current_client_number = ans_sample->current_client_number;
   
-  STRACE_DEBUG(("Number of symbols found in answer = %d",symbols_number));
-  STRACE_INFO(("Provider base frequency = %f Hz", ans_sample->base_frequency));
+  STRACE_DEBUG("Number of symbols found in answer = %d",symbols_number);
+  STRACE_INFO("Provider base frequency = %f Hz", ans_sample->base_frequency);
   
   /* allocate memory to store those symbols */
   otsp->information.symbols.TSP_sample_symbol_info_list_t_len = symbols_number;
@@ -292,9 +292,9 @@
 
 void 
 TSP_print_object_tsp(TSP_otsp_t* o) {	
-  STRACE_INFO(("----------------------------------------------"));
-  STRACE_INFO(("SERVER_INFO->INFO='%s'\n", o->server_info.info));
-  STRACE_INFO(("----------------------------------------------"));
+  STRACE_INFO("----------------------------------------------");
+  STRACE_INFO("SERVER_INFO->INFO='%s'\n", o->server_info.info);
+  STRACE_INFO("----------------------------------------------");
 }
 
 /*-------------------------------------------------------------------*/
@@ -326,7 +326,7 @@
       if(p && (p == (*argv)[i] )) {
 	
 	  /* TSP Arg */
-	  STRACE_INFO(("Tsp ARG : '%s'", (*argv)[i]));
+	  STRACE_INFO("Tsp ARG : '%s'", (*argv)[i]);
 	  
 	  /* Look for start flag */
 	  if(!strcmp(TSP_ARG_STREAM_INIT_START, (*argv)[i]))
@@ -344,7 +344,7 @@
 		}
 	      else
 		{
-		  STRACE_WARNING(("Unexpected "TSP_ARG_STREAM_INIT_START));
+		  STRACE_WARNING("Unexpected "TSP_ARG_STREAM_INIT_START);
 		  retcode = TSP_STATUS_ERROR_UNKNOWN;
 		}
 	    }
@@ -356,14 +356,14 @@
 		}
 	      else
 		{
-		  STRACE_WARNING(("Unexpected "TSP_ARG_STREAM_INIT_STOP));
+		  STRACE_WARNING("Unexpected "TSP_ARG_STREAM_INIT_STOP);
 		  retcode = TSP_STATUS_ERROR_UNKNOWN;
 		}
 	    }
 	  else
 	    {
 	      /* Unkown option */
-	      STRACE_WARNING(("Unknown TSP option : '%s'",(*argv)[i] ));
+	      STRACE_WARNING("Unknown TSP option : '%s'",(*argv)[i] );
 	      retcode = TSP_STATUS_ERROR_UNKNOWN;
 	    }
 	}
@@ -387,7 +387,7 @@
   
   if( found_stream_start && !found_stream_stop )
     {
-      STRACE_WARNING(("A " TSP_ARG_STREAM_INIT_STOP " flag was expected"));
+      STRACE_WARNING("A " TSP_ARG_STREAM_INIT_STOP " flag was expected");
       retcode = TSP_STATUS_ERROR_UNKNOWN;
     }
 
@@ -406,7 +406,7 @@
     X_tsp_init_ok = TRUE;
   } else {
     X_tsp_init_ok = FALSE;
-    STRACE_WARNING((TSP_ARG_CONSUMER_USAGE));
+    STRACE_WARNING(TSP_ARG_CONSUMER_USAGE);
   }
   
   return retcode;  
@@ -425,7 +425,7 @@
    /* By the way. do ->NOT<- free X_tsp_argv and X_argv,
      the main code may be using them... */
 
-  STRACE_INFO(("End..."));
+  STRACE_INFO("End...");
 } /* TSP_consumer_end */
 
 TSP_provider_t
@@ -508,7 +508,7 @@
   if( servernumber >= 0 )
     {
       sprintf(url_lkup, TSP_URL_FORMAT, protocol, hostname, servername, servernumber);
-      STRACE_INFO(("Trying to connect to <%s>", url_lkup ));
+      STRACE_INFO("Trying to connect to <%s>", url_lkup );
 
       /* Is server name/number alive on given host on that protocol ?*/ 
       if(TSP_remote_open_server(  protocol,
@@ -523,7 +523,7 @@
 	  return (TSP_provider_t*)TSP_new_object_tsp(server, url_lkup);
 	}
       
-      STRACE_INFO(("No TSP provider on URL <%s>", url_lkup));
+      STRACE_INFO("No TSP provider on URL <%s>", url_lkup);
       return NULL;
     }
   else {
@@ -536,11 +536,11 @@
       if(provider)
 	return provider;
     }
-    STRACE_INFO(("No TSP provider based on URL <%s>", url));
+    STRACE_INFO("No TSP provider based on URL <%s>", url);
     return NULL;    
   }
   
-  STRACE_ERROR(("Cannot parse such URL %s", url));
+  STRACE_ERROR("Cannot parse such URL %s", url);
   return NULL;
 } /* end of TSP_consumer_connect_url */
 
@@ -579,7 +579,7 @@
 	  TSP_server_t server;
 	  TSP_server_info_string_t server_info;
 
-	  STRACE_DEBUG(("Trying to open server No %d", i));
+	  STRACE_DEBUG("Trying to open server No %d", i);
 
 	  /* Is server number 'i' alive ?*/ 
 	  if(TSP_remote_open_server(  TSP_DEFAULT_PROTOCOL,
@@ -593,7 +593,7 @@
 	      (*providers)[*nb_providers] = TSP_new_object_tsp(server, server_info);
 	      if( 0 == (*providers)[*nb_providers])
 		{
-		  STRACE_ERROR(("TSP_new_object_tsp failed for No=%d", i));
+		  STRACE_ERROR("TSP_new_object_tsp failed for No=%d", i);
 		  (*nb_providers) = 0;
 		  return;
 
@@ -603,17 +603,17 @@
 	    }
 	  else
 	    {
-	      STRACE_DEBUG(("unable to open server No %d for target '%s'", i, host_name));
+	      STRACE_DEBUG("unable to open server No %d for target '%s'", i, host_name);
 	    }
 				
 	}
     }
   else
     {
-      STRACE_ERROR(("Unable to get server max number"));
+      STRACE_ERROR("Unable to get server max number");
     }
 
-  STRACE_INFO(("%d server opened", *nb_providers));
+  STRACE_INFO("%d server opened", *nb_providers);
 }
 
 
@@ -640,7 +640,7 @@
     }
   else
     {
-      STRACE_ERROR(("Unable to get server max number"));
+      STRACE_ERROR("Unable to get server max number");
     }
   
   free(providers);
@@ -666,7 +666,7 @@
   TSP_answer_open_t* ans_open = 0;
   int32_t retcode = TSP_STATUS_OK;
 
-  STRACE_REQUEST(("OPEN"));
+  STRACE_REQUEST("OPEN");
        
   assert(X_tsp_init_ok);
   
@@ -681,7 +681,7 @@
       /* Check if a command line exists and trace a warning */
       if( 0 != X_tsp_argv.TSP_argv_t_len )
 	{
-	  STRACE_WARNING(("Overriding command line stream initialisation by custom stream initialisation")); 
+	  STRACE_WARNING("Overriding command line stream initialisation by custom stream initialisation"); 
 	}
       req_open.argv.TSP_argv_t_val = custom_argv;
       req_open.argv.TSP_argv_t_len = custom_argc;
@@ -700,25 +700,25 @@
 	  otsp->channel_id = ans_open->channel_id;
 	  break;
 	case TSP_STATUS_ERROR_SEE_STRING :
-	  STRACE_WARNING(("Provider error : %s", ans_open->status_str));
+	  STRACE_WARNING("Provider error : %s", ans_open->status_str);
 	  break;
 	case TSP_STATUS_ERROR_UNKNOWN :
-	  STRACE_WARNING(("Provider unknown error"));
+	  STRACE_WARNING("Provider unknown error");
 	  break;
 	case TSP_STATUS_ERROR_VERSION :
-	  STRACE_WARNING(("Provider version error"));
+	  STRACE_WARNING("Provider version error");
 	  break;
 	default:
-	  STRACE_ERROR(("The provider sent an unreferenced error. It looks like a bug."));
+	  STRACE_ERROR("The provider sent an unreferenced error. It looks like a bug.");
 	  break;
 	}
     }
     else {
-      STRACE_ERROR(("Unable to communicate with the provider"));
+      STRACE_ERROR("Unable to communicate with the provider");
     }		
   }
   else {
-    STRACE_ERROR(("This provider need to be tsp_consumer_connect_url first"));    
+    STRACE_ERROR("This provider need to be tsp_consumer_connect_url first");    
   }
   
   return retcode;	
@@ -738,14 +738,14 @@
   TSP_request_close_t req_close;
   int32_t retcode = TSP_STATUS_OK;
 
-  STRACE_REQUEST(("CLOSE"));	
+  STRACE_REQUEST("CLOSE");	
 
   TSP_CHECK_SESSION(otsp, TSP_STATUS_ERROR_INVALID_CHANNEL_ID);
 	
   req_close.version_id = TSP_PROTOCOL_VERSION;
   req_close.channel_id = otsp->channel_id;
 	
-  STRACE_DEBUG(("TSP_request_close(ing) channel_id=%u", otsp->channel_id));
+  STRACE_DEBUG("TSP_request_close(ing) channel_id=%u", otsp->channel_id);
 	
   TSP_request_close(&req_close, otsp->server);
   otsp->channel_id = TSP_UNDEFINED_CHANNEL_ID;
@@ -760,7 +760,7 @@
   TSP_answer_sample_t* ans_sample = 0;
   int32_t retcode = TSP_STATUS_ERROR_UNKNOWN;
 	
-  STRACE_REQUEST(("INFORMATION"));	
+  STRACE_REQUEST("INFORMATION");	
   TSP_CHECK_SESSION(otsp, TSP_STATUS_ERROR_INVALID_CHANNEL_ID);
 
   /* Delete allocation of any previous call */
@@ -780,13 +780,13 @@
 	case TSP_STATUS_OK :
 	  break;
 	case TSP_STATUS_ERROR_UNKNOWN :
-	  STRACE_WARNING(("Provider unknown error"));
+	  STRACE_WARNING("Provider unknown error");
 	  break;
 	case TSP_STATUS_ERROR_VERSION :
-	  STRACE_WARNING(("Provider version error"));
+	  STRACE_WARNING("Provider version error");
 	  break;
 	default:
-	  STRACE_ERROR(("The provider sent an unreferenced error. It looks like a bug."));
+	  STRACE_ERROR("The provider sent an unreferenced error. It looks like a bug.");
 	  break;
 	}
     }
@@ -796,11 +796,11 @@
   if( TSP_STATUS_OK == retcode ) {
     retcode = TSP_consumer_store_informations(otsp,ans_sample);
     if (TSP_STATUS_OK != retcode) {
-      STRACE_ERROR(("Unable to store answer information in session"));
+      STRACE_ERROR("Unable to store answer information in session");
     }
   }
   else {
-    STRACE_ERROR(("Unable to communicate with the provider"));
+    STRACE_ERROR("Unable to communicate with the provider");
   }
 			
   return retcode;	
@@ -816,7 +816,7 @@
   TSP_answer_sample_t* ans_sample = 0;
   int32_t retcode = TSP_STATUS_ERROR_UNKNOWN;
 		
-  STRACE_REQUEST(("FILTERED INFORMATION"));	
+  STRACE_REQUEST("FILTERED INFORMATION");	
   TSP_CHECK_SESSION(otsp, TSP_STATUS_ERROR_INVALID_CHANNEL_ID);
 
   /* Delete allocation of any previous call */
@@ -836,30 +836,30 @@
 	case TSP_STATUS_OK :
 	  break;
 	case TSP_STATUS_ERROR_SYMBOL_FILTER :
-	  STRACE_WARNING(("Symbol filter error"));
+	  STRACE_WARNING("Symbol filter error");
 	  break;
         case TSP_STATUS_ERROR_SYMBOLS :	  
-	  STRACE_WARNING(("Symbols error"));
+	  STRACE_WARNING("Symbols error");
 	  break;
 	case TSP_STATUS_ERROR_UNKNOWN :
-	  STRACE_WARNING(("Provider unknown error"));
+	  STRACE_WARNING("Provider unknown error");
 	  break;
 	case TSP_STATUS_ERROR_VERSION :
-	  STRACE_WARNING(("Provider version error"));
+	  STRACE_WARNING("Provider version error");
 	  break;
 	default:
-	  STRACE_ERROR(("The provider sent an unreferenced error. It looks like a bug."));
+	  STRACE_ERROR("The provider sent an unreferenced error. It looks like a bug.");
 	  break;
 	}
     }
 
   if( TSP_STATUS_OK == retcode ) {
     if (TSP_STATUS_OK != TSP_consumer_store_informations(otsp,ans_sample)) {
-      STRACE_ERROR(("Unable to store answer information in session"));
+      STRACE_ERROR("Unable to store answer information in session");
     }
   }
   else {
-    STRACE_ERROR(("Unable to communicate with the provider"));    
+    STRACE_ERROR("Unable to communicate with the provider");    
   }
 			
   return retcode;	
@@ -873,7 +873,7 @@
   TSP_answer_extended_information_t* ans_extinfo;
   int32_t i;
 
-  STRACE_REQUEST(("EXTENDED INFORMATION"));	
+  STRACE_REQUEST("EXTENDED INFORMATION");	
   TSP_CHECK_SESSION(otsp, FALSE);  
   TSP_consumer_delete_extended_informations(otsp);
 
@@ -900,25 +900,25 @@
     case TSP_STATUS_OK :
       break;
     case TSP_STATUS_ERROR_SYMBOL_FILTER :
-      STRACE_WARNING(("Symbol filter error"));
+      STRACE_WARNING("Symbol filter error");
       break;
     case TSP_STATUS_ERROR_PGI_UNKNOWN :	  
-      STRACE_WARNING(("Some provided PGI were unknown"));
+      STRACE_WARNING("Some provided PGI were unknown");
       break;
     case TSP_STATUS_ERROR_UNKNOWN :
-      STRACE_WARNING(("Provider unknown error"));
+      STRACE_WARNING("Provider unknown error");
       break;
     case TSP_STATUS_ERROR_VERSION :
-      STRACE_WARNING(("Provider version error"));
+      STRACE_WARNING("Provider version error");
       break;
     default:
-      STRACE_ERROR(("The provider sent an unreferenced error=%d. It looks like a bug.",ans_extinfo->status));
+      STRACE_ERROR("The provider sent an unreferenced error=%d. It looks like a bug.",ans_extinfo->status);
       break;
     }
     TSP_consumer_store_extended_informations(otsp,ans_extinfo);
   } else {
     retcode = TSP_STATUS_ERROR_PROVIDER_UNREACHABLE;
-    STRACE_ERROR(("Unable to communicate with the provider"));    
+    STRACE_ERROR("Unable to communicate with the provider");    
   }
   return retcode;
 }  /* end of TSP_consumer_request_extended_information */
@@ -975,7 +975,7 @@
   TSP_answer_sample_t* ans_sample = 0;
   TSP_request_sample_t req_sample;
   
-  STRACE_REQUEST(("SAMPLE"));		
+  STRACE_REQUEST("SAMPLE");		
   TSP_CHECK_SESSION(otsp, TSP_STATUS_ERROR_INVALID_CHANNEL_ID);
 	
   req_sample.version_id = TSP_PROTOCOL_VERSION;
@@ -992,7 +992,7 @@
 
   /* Check if ans_sample is valid */
   if (NULL == ans_sample) {
-    STRACE_ERROR(("Unable to communicate with the provider"));    
+    STRACE_ERROR("Unable to communicate with the provider");    
     retcode = TSP_STATUS_ERROR_PROVIDER_UNREACHABLE;
     return retcode;
   }
@@ -1012,19 +1012,19 @@
     case TSP_STATUS_OK :
       break;
     case TSP_STATUS_ERROR_UNKNOWN :
-      STRACE_WARNING(("Provider unknown error"));
+      STRACE_WARNING("Provider unknown error");
       break;
     case TSP_STATUS_ERROR_VERSION :
-      STRACE_WARNING(("Provider version error"));
+      STRACE_WARNING("Provider version error");
       break;
     case TSP_STATUS_ERROR_SYMBOLS :
-      STRACE_WARNING(("Provider symbols error"));
+      STRACE_WARNING("Provider symbols error");
       break;
     case TSP_STATUS_ERROR_INVALID_REQUEST :
-      STRACE_WARNING(("Provider says request is invalid"));
+      STRACE_WARNING("Provider says request is invalid");
       break;
     default:
-      STRACE_ERROR(("The provider sent an unreferenced error. It looks like a bug."));
+      STRACE_ERROR("The provider sent an unreferenced error. It looks like a bug.");
       break;
     }
   
@@ -1033,7 +1033,7 @@
   /* Create group table and store requested symbols */
   /*-------------------------------------------------*/
   if (TSP_STATUS_OK==retcode) {
-    STRACE_INFO(("Total group number = %d", ans_sample->provider_group_number));
+    STRACE_INFO("Total group number = %d", ans_sample->provider_group_number);
     /* Create group table but delete any previous allocation*/
     TSP_group_delete_group_table(otsp->groups);
     otsp->groups = TSP_group_create_group_table(&(ans_sample->symbols), ans_sample->provider_group_number);
@@ -1043,7 +1043,7 @@
       }
     }
     else {
-      STRACE_ERROR(("Function TSP_group_create_group_table failed"));	   
+      STRACE_ERROR("Function TSP_group_create_group_table failed");	   
     }
   }
   return retcode;
@@ -1060,7 +1060,7 @@
     return &(otsp->requested_sym);
   }
   else {
-    STRACE_ERROR(("TSP_consumer_request_sample must be called first"));
+    STRACE_ERROR("TSP_consumer_request_sample must be called first");
     return NULL;
   }
 } /* TSP_consumer_get_requested_sample */
@@ -1073,9 +1073,9 @@
   int is_fifo_full;  
 
 #if defined(WIN32)
-  STRACE_INFO(("Receiver thread started. Id=%u", (uint32_t)pthread_self().p)); 
+  STRACE_INFO("Receiver thread started. Id=%u", (uint32_t)pthread_self().p); 
 #else
-  STRACE_INFO(("Receiver thread started. Id=%u", (uint32_t)pthread_self())); 
+  STRACE_INFO("Receiver thread started. Id=%u", (uint32_t)pthread_self()); 
 #endif
 
   while(TRUE)
@@ -1090,7 +1090,7 @@
 	}
       else
         {
-	  STRACE_INFO(("function TSP_data_receiver_receive returned FALSE. End of Thread"));
+	  STRACE_INFO("function TSP_data_receiver_receive returned FALSE. End of Thread");
 	  break;
         }
  
@@ -1107,7 +1107,7 @@
   TSP_answer_sample_init_t* ans_sample = 0;
   TSP_request_sample_init_t req_sample;
 
-  STRACE_REQUEST(("SAMPLE INIT"));	
+  STRACE_REQUEST("SAMPLE INIT");	
   TSP_CHECK_SESSION(otsp, TSP_STATUS_ERROR_INVALID_CHANNEL_ID);
   
   req_sample.version_id = TSP_PROTOCOL_VERSION;
@@ -1117,7 +1117,7 @@
   
   if (NULL!=ans_sample) {
     retcode = ans_sample->status;
-    STRACE_DEBUG(("data_address = '%s'", ans_sample->data_address));
+    STRACE_DEBUG("data_address = '%s'", ans_sample->data_address);
       
     /* Create the data receiver */
     otsp->receiver = TSP_data_receiver_create(ans_sample->data_address, callback, user_data);
@@ -1149,13 +1149,13 @@
 	}
       else
 	{
-	  STRACE_ERROR(("Unable to create data receiver"));
+	  STRACE_ERROR("Unable to create data receiver");
 	  
 	}
     }
   else
     {
-      STRACE_ERROR(("Unable to communicate with the provider"));
+      STRACE_ERROR("Unable to communicate with the provider");
     }
   
   return retcode;
@@ -1169,7 +1169,7 @@
   TSP_answer_sample_destroy_t* ans_sample = 0;
   TSP_request_sample_destroy_t req_sample;
 	
-  STRACE_REQUEST(("SAMPLE DESTROY"));
+  STRACE_REQUEST("SAMPLE DESTROY");
 
   TSP_CHECK_SESSION(otsp, FALSE);
   
@@ -1189,20 +1189,20 @@
 	case TSP_STATUS_OK :
 	  break;
 	case TSP_STATUS_ERROR_UNKNOWN :
-	  STRACE_WARNING(("Provider unknown error"));
+	  STRACE_WARNING("Provider unknown error");
 	  break;
 	case TSP_STATUS_ERROR_VERSION :
-	  STRACE_WARNING(("Provider version error"));
+	  STRACE_WARNING("Provider version error");
 	  break;
 	default:
-	  STRACE_ERROR(("The provider sent an unreferenced error. It looks like a bug."));
+	  STRACE_ERROR("The provider sent an unreferenced error. It looks like a bug.");
 	  break;
 	}
     }
   else
     {
       retcode = TSP_STATUS_ERROR_PROVIDER_UNREACHABLE;
-      STRACE_WARNING(("Unable to communicate with the provider"));            
+      STRACE_WARNING("Unable to communicate with the provider");            
     }
   
     /* Destroy our socket */
@@ -1242,35 +1242,35 @@
 	  
 	  /* GIGAFIXME : We need some kind of get_last_error to read
 	     these values thrue the consumer API */
-	  STRACE_INFO(("Received status message %X",  sample->provider_global_index));
+	  STRACE_INFO("Received status message %X",  sample->provider_global_index);
 	  switch(sample->provider_global_index)
 	    {
 	    case TSP_DUMMY_PROVIDER_GLOBAL_INDEX_EOF :
-	      STRACE_INFO (("status message EOF"));
+	      STRACE_INFO ("status message EOF");
 	      /* FIXME : get last error à gerer ? */
 	      break;
 	    case TSP_DUMMY_PROVIDER_GLOBAL_INDEX_RECONF :
-	      STRACE_INFO (("status message RECONF"));
+	      STRACE_INFO ("status message RECONF");
 	      /* FIXME : get last error à gerer ? */
 	      break;
 	    case TSP_DUMMY_PROVIDER_GLOBAL_INDEX_RECEIVER_ERROR :
-	      STRACE_WARNING (("status message RECEIVER ERROR"));
+	      STRACE_WARNING ("status message RECEIVER ERROR");
 	      retcode = TSP_STATUS_ERROR_PROVIDER_UNREACHABLE;
 	      /* FIXME : get last error à gerer ? */
 	      break;
 	    case TSP_DUMMY_PROVIDER_GLOBAL_INDEX_GLU_DATA_LOST :
-	      STRACE_WARNING (("status message GLU DATA LOST. Some data were lost by the GLU on the provider side. "
-			       "is the provider too slow ?"));
+	      STRACE_WARNING ("status message GLU DATA LOST. Some data were lost by the GLU on the provider side. "
+			       "is the provider too slow ?");
 	      /* FIXME : get last error à gerer ? */
 	      break;
 	    case TSP_DUMMY_PROVIDER_GLOBAL_INDEX_CONSUMER_DATA_LOST :
-	      STRACE_WARNING (("status message CONSUMER DATA LOST. Some data were lost for this consumer"
+	      STRACE_WARNING ("status message CONSUMER DATA LOST. Some data were lost for this consumer"
 			       " on the provider side. Is the consumer too slow, or"
-			       " the network overloaded ?"));
+			       " the network overloaded ?");
 	      /* FIXME : get last error à gerer ? */
 	      break;
 	    default:
-	      STRACE_ERROR (("Unknown status message"));
+	      STRACE_ERROR ("Unknown status message");
 	      /* FIXME : get last error à gerer ? */
 	    }
 	}
@@ -1292,7 +1292,7 @@
   TSP_async_sample_t async_write;
   int32_t ret = TSP_STATUS_ERROR_UNKNOWN;
   TSP_otsp_t* otsp = (TSP_otsp_t*)provider;
-   STRACE_REQUEST(("ASYNC WRITE")); 
+   STRACE_REQUEST("ASYNC WRITE"); 
   /* As there are a two level structure for hidding all RPC stuff, we need to copy the struct fields */
   
   async_write.provider_global_index = async_sample_write->provider_global_index;
@@ -1306,10 +1306,10 @@
     if (result) {
       ret = *result; 
     } else {
-      STRACE_DEBUG(("result is <0x%X>\n", (unsigned int) result));      
+      STRACE_DEBUG("result is <0x%X>\n", (unsigned int) result);      
     }
   } else {
-    STRACE_ERROR(("This provider is not instanciate"));
+    STRACE_ERROR("This provider is not instanciate");
   }
      
   return ret;
@@ -1326,7 +1326,7 @@
   
   int32_t ret = TSP_STATUS_ERROR_UNKNOWN;
   TSP_otsp_t* otsp = (TSP_otsp_t*)provider;
-  STRACE_REQUEST(("ASYNC READ")); 
+  STRACE_REQUEST("ASYNC READ"); 
   /* update internal RPC structure */
   async_read_param.provider_global_index  = async_sample_read->provider_global_index;
   async_read_param.data.data_val = async_sample_read->value_ptr;
@@ -1334,18 +1334,18 @@
 
   
   if(0 != otsp) {   
-    STRACE_DEBUG(("TSP consumer async read for pgi <%d>\n",async_sample_read->provider_global_index));
+    STRACE_DEBUG("TSP consumer async read for pgi <%d>\n",async_sample_read->provider_global_index);
 
     async_read_result = TSP_request_async_sample_read(&async_read_param,otsp->server);
-    STRACE_DEBUG(("async_read_result is <0x%X>\n", (unsigned int)async_read_result));
+    STRACE_DEBUG("async_read_result is <0x%X>\n", (unsigned int)async_read_result);
 
     /* Provider has probably died */
     if (async_read_result == NULL) {
       ret=TSP_STATUS_ERROR_UNKNOWN;
     } else {
-      STRACE_DEBUG(("async_read_result->pgi=%d\n", async_read_result->provider_global_index));
-      STRACE_DEBUG(("async_read_result->value_size=%d\n", async_sample_read->value_size));
-      STRACE_DEBUG(("async_read_result->data.data_val = 0x%X\n", (unsigned int)async_read_result->data.data_val));
+      STRACE_DEBUG("async_read_result->pgi=%d\n", async_read_result->provider_global_index);
+      STRACE_DEBUG("async_read_result->value_size=%d\n", async_sample_read->value_size);
+      STRACE_DEBUG("async_read_result->data.data_val = 0x%X\n", (unsigned int)async_read_result->data.data_val);
       if (-1 == async_read_result->provider_global_index) {
 	ret = TSP_STATUS_ERROR_PGI_UNKNOWN;
       } else {
@@ -1363,7 +1363,7 @@
     }
   }
   else{
-    STRACE_ERROR(("This provider is not instanciate"));
+    STRACE_ERROR("This provider is not instanciate");
   }
      
   return ret;
@@ -1432,7 +1432,7 @@
     */
   default:
     /* nothing to do 0 */
-    STRACE_WARNING(("No possible conversion for type <%d>", sample.type));
+    STRACE_WARNING("No possible conversion for type <%d>", sample.type);
     break;
   }
   return retval;
diff -urN tsp_orig/src/core/driver/tsp_data_receiver.c tsp_modified/src/core/driver/tsp_data_receiver.c
--- tsp_orig/src/core/driver/tsp_data_receiver.c	2007-02-10 19:49:37.000000000 +0100
+++ tsp_modified/src/core/driver/tsp_data_receiver.c	2009-01-12 17:26:08.000000000 +0100
@@ -107,7 +107,7 @@
 	break;
     
     default:	 
-      STRACE_ERROR(("Group id % in not a reserved group", group_index));
+      STRACE_ERROR("Group id % in not a reserved group", group_index);
       ret = FALSE;
     }
   
@@ -137,7 +137,7 @@
   if( 0 == receiver->stream_receiver)
     {
       /* FIXME : bof...*/
-      STRACE_ERROR(("TSP_stream_receiver_create failed")); 
+      STRACE_ERROR("TSP_stream_receiver_create failed"); 
       free(receiver->buf);receiver->buf = 0;
       free(receiver);
       receiver = 0;
@@ -220,7 +220,7 @@
 									   in_buf);
 		      if(!ret)
 			{
-			  STRACE_ERROR(("decoder function failed"));
+			  STRACE_ERROR("decoder function failed");
 			  break;
 			}
 
@@ -299,7 +299,7 @@
 			case TSP_TYPE_UNKNOWN:
 			  
 			default:
-			  STRACE_WARNING(("Impossible TSP TYPE in decode??"));
+			  STRACE_WARNING("Impossible TSP TYPE in decode??");
 			  sample->uvalue.raw_value= ((uint8_t*)groups[group_index].decode_buffer)[i];
                                break;
 			       
@@ -331,7 +331,7 @@
 		{
 		  if(!receiver_stopped)
 		    {
-		      STRACE_WARNING(("Unable to receive samples"));
+		      STRACE_WARNING("Unable to receive samples");
 		      /* Add in fifo a message to report the incident via the read_sample API*/
 		      TSP_data_receiver_process_receiver_error(sample_fifo);
 		    }
@@ -344,7 +344,7 @@
 	      ret = TSP_data_receiver_process_reserved_group_id(group_index, sample_fifo);
 	      if(!ret)
 		{
-		  STRACE_ERROR(("The received group id is corrupted. This should not happen..."));
+		  STRACE_ERROR("The received group id is corrupted. This should not happen...");
 		  assert(0);
 		  TSP_data_receiver_process_receiver_error(sample_fifo);
 		}
@@ -355,7 +355,7 @@
 	{
 	  if(!receiver_stopped)
 	    {		  
-	      STRACE_WARNING(("Unable to receive group size and time stamp, provider died?"));
+	      STRACE_WARNING("Unable to receive group size and time stamp, provider died?");
 	      /* Add in fifo a message to report the incident via the read sample API*/
 	      TSP_data_receiver_process_receiver_error(sample_fifo);
 	    }
diff -urN tsp_orig/src/core/driver/tsp_group.c tsp_modified/src/core/driver/tsp_group.c
--- tsp_orig/src/core/driver/tsp_group.c	2006-10-21 10:48:00.000000000 +0200
+++ tsp_modified/src/core/driver/tsp_group.c	2009-01-12 17:26:08.000000000 +0100
@@ -132,10 +132,10 @@
 				       table->groups[group_id].items[rank].sizeof_encoded_item :
 				       decode_buffer_maxsize);
 	      
-	      STRACE_DEBUG(("Added to group table Id=%d, Gr=%d, Rank=%d", 
+	      STRACE_DEBUG("Added to group table Id=%d, Gr=%d, Rank=%d", 
 			    table->groups[group_id].items[rank].provider_global_index,
 			    group_id,
-			    rank));
+			    rank);
 	      rank++; 
 	      i++;
 	    }  
diff -urN tsp_orig/src/core/driver/tsp_stream_receiver.c tsp_modified/src/core/driver/tsp_stream_receiver.c
--- tsp_orig/src/core/driver/tsp_stream_receiver.c	2006-10-21 10:48:00.000000000 +0200
+++ tsp_modified/src/core/driver/tsp_stream_receiver.c	2009-01-12 17:26:08.000000000 +0100
@@ -35,6 +35,9 @@
 -----------------------------------------------------------------------
  */
 
+
+//for GETHOSTBYNAME macro
+#include <../common/tsp_common_macros.h>
 #include "tsp_sys_headers.h"
 
 #if defined (WIN32)
@@ -86,7 +89,7 @@
   str_port = strtok_r(NULL, ":", &last);
   port = (unsigned short)atoi(str_port);
   
-  STRACE_DEBUG(("Connection Data : Host='%s' port=%u", host, (unsigned int)port));
+  STRACE_DEBUG("Connection Data : Host='%s' port=%u", host, (unsigned int)port);
 
   /* Init socket */
   sock->socketId = socket(AF_INET, SOCK_STREAM, 0);
@@ -98,7 +101,7 @@
       status = setsockopt(sock->socketId, SOL_SOCKET, SO_RCVBUF, (void * )&OptInt, sizeof(OptInt));
       if (status == -1)
 	{
-	  STRACE_ERROR(("Probleme with set socket size"));
+	  STRACE_ERROR("Probleme with set socket size");
 
 	  close(sock->socketId);
 	  free(sock);
@@ -112,7 +115,7 @@
 			  (void *) &OptInt, sizeof(OptInt));
       if (status == -1)
 	{
-          STRACE_ERROR(("pb set local address reuse"));
+          STRACE_ERROR("pb set local address reuse");
 	  close(sock->socketId);
 	  free(sock);
 	  return 0;
@@ -125,7 +128,7 @@
 			  (void *) &OptInt, sizeof(OptInt));
       if (status == -1)
 	{
-	  STRACE_ERROR(("pb set periodic state control"));
+	  STRACE_ERROR("pb set periodic state control");
 
 	  close(sock->socketId);
 	  free(sock);
@@ -138,7 +141,7 @@
 			  sizeof(OptInt));
       if (status == -1)
 	{
-	  STRACE_ERROR(("pb set TCP no delay"));
+	  STRACE_ERROR("pb set TCP no delay");
 
 	  close(sock->socketId);
 	  free(sock);
@@ -147,11 +150,12 @@
 
       /* Bind to socket : */
       /* Get host from the database */
-      Host_p = gethostbyname(host);
+      GETHOSTBYNAME(host,Host_p)
+       
       if (Host_p == (struct hostent *) NULL)
 	{
-	  STRACE_ERROR(("pb get host by name"));
-
+	  STRACE_ERROR("pb get host by name");
+          
 	  close(sock->socketId);
 	  free(sock);
 	  return 0;
@@ -164,9 +168,9 @@
 
 	struct sockaddr_in readAddr;
 
-	bcopy((char *) Host_p->h_addr, (char *) &InAddr, Host_p->h_length);
+	bcopy((char *) Host_p->h_addr_list[0], (char *) &InAddr, Host_p->h_length);
 	InAddr = ntohl(InAddr);
-
+	GETHOSTBYNAME_FREE(Host_p);
 	bzero((char *) &readAddr, sizeof(struct sockaddr_in));
 	readAddr.sin_family = AF_INET;
 #ifdef _SOCKADDR_LEN
@@ -181,7 +185,7 @@
     
       if (status == -1)
 	{
-	  STRACE_ERROR(("pb connecting to socket"));
+	  STRACE_ERROR("pb connecting to socket");
 	  close(sock->socketId);
 	  free(sock);
 	  return 0;
@@ -267,13 +271,13 @@
 	      else 
 		  {
 		  
-		    STRACE_INFO(("read failed"));
+		    STRACE_INFO("read failed");
 		    return FALSE;
 		  }
 	  }
       else if (nread == 0)
 	  {
-		  STRACE_INFO(("Received socket EOF"));
+		  STRACE_INFO("Received socket EOF");
 		  return FALSE;
 	  }
 	  
diff -urN tsp_orig/src/core/include/tsp_abs_types.h tsp_modified/src/core/include/tsp_abs_types.h
--- tsp_orig/src/core/include/tsp_abs_types.h	2007-01-26 18:09:52.000000000 +0100
+++ tsp_modified/src/core/include/tsp_abs_types.h	2009-01-12 17:26:08.000000000 +0100
@@ -199,10 +199,14 @@
 # include <inttypes.h>
 # define TSP_BYTE_ORDER TSP_BIG_ENDIAN
 # define TSP_GUINT64_FORMAT "llu"
-# undef TSP_SYSTEM_HAVE_GETHRTIME 
+# undef TSP_SYSTEM_HAVE_GETHRTIME
+# ifndef TSP_SYSTEM_HAVE_NANOSLEEP 
 # define TSP_SYSTEM_HAVE_NANOSLEEP
+# endif
 # define TSP_HAVE_INT64 1
 # define TSP_INT64_CONSTANT(val)  (val##LL)
+/* for compatibility in tsp_glu.h */
+typedef unsigned int socklen_t; 
 #endif /* VXWORKS */
 
 /* FreeBSD : may need testing on non i386 */
diff -urN tsp_orig/src/core/include/tsp_const_def.h tsp_modified/src/core/include/tsp_const_def.h
--- tsp_orig/src/core/include/tsp_const_def.h	2007-02-26 20:30:11.000000000 +0100
+++ tsp_modified/src/core/include/tsp_const_def.h	2009-01-12 17:26:08.000000000 +0100
@@ -95,7 +95,6 @@
 #define TSP_DATA_STREAM_MAX_BUFFER_SIZE(group_max_byte_size)		\
   ( (group_max_byte_size) > TSP_DATA_STREAM_MAX_BUFFER_MAXSIZE ? TSP_DATA_STREAM_MAX_BUFFER_MAXSIZE :  (group_max_byte_size) + TSP_DATA_STREAM_MAX_HEADER_SIZE )
 
-
 /** 
  * Size of buffer used to receive the data
  * FIXME : autocalculate this with max group size and TSP_DATA_STREAM_MAX_BUFFER_SIZE,
@@ -276,7 +275,7 @@
 	{ \
 		if ( 0 == p ) \
 		{ \
-			STRACE_ERROR(("TSP_CHECK_ALLOC : ERROR : Memory allocation failed"))  \
+			STRACE_ERROR("TSP_CHECK_ALLOC : ERROR : Memory allocation failed");  \
 			return ret; \
 		} \
 	}
@@ -285,7 +284,7 @@
 	{ \
 		if ( NULL == p ) \
 		{ \
-			STRACE_ERROR(("TSP_CHECK_POINTER : NULL POINTER : " # msg ))  \
+			STRACE_ERROR("TSP_CHECK_POINTER : NULL POINTER : " # msg );  \
 			return ret; \
 		} \
 	}
@@ -294,7 +293,7 @@
 	{ \
 		if ( 0 != status ) \
 		{ \
-			STRACE_ERROR(("TSP_CHECK_THREAD : ERROR : Thread API Error"))  \
+			STRACE_ERROR("TSP_CHECK_THREAD : ERROR : Thread API Error");  \
 			return ret; \
 		} \
 	}	
@@ -303,7 +302,7 @@
 	{ \
 		if ( 0 != pthread_mutex_lock(mutex) )\
 		{ \
-			STRACE_ERROR(("TSP_LOCK_MUTEX : ERROR : Mutex Lock Error"))  \
+			STRACE_ERROR("TSP_LOCK_MUTEX : ERROR : Mutex Lock Error");  \
 			return ret; \
 		} \
 	}	
@@ -312,7 +311,7 @@
 	{ \
 		if ( 0 != pthread_mutex_unlock(mutex) ) \
 		{ \
-			STRACE_ERROR(("TSP_UNLOCK_MUTEX : ERROR : Mutex Unlock Error"))  \
+			STRACE_ERROR("TSP_UNLOCK_MUTEX : ERROR : Mutex Unlock Error");  \
 			return ret; \
 		} \
 	}	
diff -urN tsp_orig/src/core/include/tsp_glu.h tsp_modified/src/core/include/tsp_glu.h
--- tsp_orig/src/core/include/tsp_glu.h	2006-10-18 11:58:48.000000000 +0200
+++ tsp_modified/src/core/include/tsp_glu.h	2009-01-12 17:26:08.000000000 +0100
@@ -43,6 +43,9 @@
 #if defined (WIN32)
 #include <pthread.h>
 #endif
+
+//define de posix thread for VxWorks which pthread.h is used (win32 or VxWorks),how the system make the difference
+#include <pthread.h>
 /* forward declare datapool type */
 struct TSP_datapool;
 
diff -urN tsp_orig/src/core/include/tsp_prjcfg.h.in tsp_modified/src/core/include/tsp_prjcfg.h.in
--- tsp_orig/src/core/include/tsp_prjcfg.h.in	2006-10-18 11:58:48.000000000 +0200
+++ tsp_modified/src/core/include/tsp_prjcfg.h.in	2009-01-12 17:26:08.000000000 +0100
@@ -49,7 +49,7 @@
  */
 #define TSP_SOURCE_VERSION "@PACKAGE_VERSION@"
 
-#include <tsp_simple_trace.h>
+#include <tsp_common_trace.h>
 
 /*
  * The following macro is used under windows system to declare 
diff -urN tsp_orig/src/core/include/tsp_simple_trace.h tsp_modified/src/core/include/tsp_simple_trace.h
--- tsp_orig/src/core/include/tsp_simple_trace.h	2006-10-21 10:48:00.000000000 +0200
+++ tsp_modified/src/core/include/tsp_simple_trace.h	1970-01-01 01:00:00.000000000 +0100
@@ -1,81 +0,0 @@
-/*
-
-$Header: /sources/tsp/tsp/src/core/include/tsp_simple_trace.h,v 1.22 2006/10/21 08:48:00 erk Exp $
-
------------------------------------------------------------------------
-
-TSP Library - core components for a generic Transport Sampling Protocol.
-
-Copyright (c) 2002 Yves DUFRENNE, Stephane GALLES, Eric NOULARD and Robert PAGNOT 
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
------------------------------------------------------------------------
-
-Project   : TSP
-Maintainer : tsp@astrium-space.com
-Component : Consumer / Provider
-
------------------------------------------------------------------------
-
-Purpose   : Some trace macro
-
------------------------------------------------------------------------
- */
-
-#ifndef __TSP_SIMPLE_TRACE_H
-#define __TSP_SIMPLE_TRACE_H
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#define SIMPLE_TRACE_FUNC(level,src,func,text) \
-{ \
-    static int _strace_debug_level = -1; \
-    if (_strace_debug_level<0) { \
-        if (getenv ("STRACE_DEBUG") != (char *)0) {\
-            _strace_debug_level = atoi(getenv("STRACE_DEBUG")); \
-        } else {\
-            _strace_debug_level = 0; }\
-    }\
-    if ((0==level) || (_strace_debug_level & level) ) {		       \
-           printf("%7s||%s##%s##%d: ", src, __FILE__, func, __LINE__); \
-           printf text; printf("\n"); fflush(stdout);\
-    }\
-} 
-#if defined(__GNUC__) || defined(_MSC_VER)
-#  define SIMPLE_TRACE(level,src,text) SIMPLE_TRACE_FUNC(level,src,__FUNCTION__,text)
-#else 
-#  define SIMPLE_TRACE(level,src,text) SIMPLE_TRACE_FUNC(level,src,"where?",text)
-#endif
-				  
-#ifdef  USE_STRACE
-# define STRACE_TEST(text) SIMPLE_TRACE(32, "TEST", text)
-# define STRACE_DEBUG_MORE(text) SIMPLE_TRACE(16, "Debug More", text)
-# define STRACE_DEBUG(text) SIMPLE_TRACE(8, "Debug", text)
-# define STRACE_REQUEST(text) SIMPLE_TRACE(4, "TSP Request", text)
-# define STRACE_INFO(text) SIMPLE_TRACE(2, "Info", text)
-#else
-# define STRACE_TEST(text)
-# define STRACE_DEBUG_MORE(text)
-# define STRACE_DEBUG(text)
-# define STRACE_REQUEST(text)
-# define STRACE_INFO(text)
-#endif
-
-#define STRACE_WARNING(text) SIMPLE_TRACE(1, "WarninG", text)
-#define STRACE_ERROR(text) SIMPLE_TRACE(0,"ERROR", text)
-
-#endif /*_SIMPLE_TRACE_H*/
diff -urN tsp_orig/src/core/include/tsp_sys_headers.h tsp_modified/src/core/include/tsp_sys_headers.h
--- tsp_orig/src/core/include/tsp_sys_headers.h	2007-01-29 17:52:39.000000000 +0100
+++ tsp_modified/src/core/include/tsp_sys_headers.h	2009-01-12 17:26:08.000000000 +0100
@@ -47,6 +47,7 @@
 int _rpcsvcdirty;
 #endif /* __OpenBSD__ */
 
+
 /* FIXME using POSIX_SOURCE on SOLARIS gives me very strange compilation trouble (Erk) */
 #if !defined(_POSIX_SOURCE) && !(defined(sun) || defined(__sun))
 #define _POSIX_SOURCE
diff -urN tsp_orig/src/core/misc_utils/tsp_mtgprof.h tsp_modified/src/core/misc_utils/tsp_mtgprof.h
--- tsp_orig/src/core/misc_utils/tsp_mtgprof.h	2007-01-29 17:52:39.000000000 +0100
+++ tsp_modified/src/core/misc_utils/tsp_mtgprof.h	2009-01-12 17:26:08.000000000 +0100
@@ -1,6 +1,7 @@
 #ifndef __TSP_MTGPROG
 #define __TSP_MTGPROG
 
+
 /* 
  * pthread_create wrapper for gprof compatibility
  * Provided by Samuel Hocevar at http://sam.zoy.org/doc/programming/gprof.html
diff -urN tsp_orig/src/core/rpc/tsp_client.c tsp_modified/src/core/rpc/tsp_client.c
--- tsp_orig/src/core/rpc/tsp_client.c	2007-03-01 23:26:39.000000000 +0100
+++ tsp_modified/src/core/rpc/tsp_client.c	2009-01-12 17:26:08.000000000 +0100
@@ -44,13 +44,13 @@
 int tsp_wrap_rpc_clnt_set_timeout(CLIENT *client, int timeout);
 
 #define LOCAL_RPCCHECK_NORETURN  	if( server == (TSP_server_t)0)  \
-                                        { STRACE_ERROR(("RPCCHECK failed")) ;} 
+                                        { STRACE_ERROR("RPCCHECK failed") ;} 
 
 #define LOCAL_RPCCHECK_FALSE  	if( server == (TSP_server_t)0)  \
-				{ STRACE_ERROR(("RPCCHECK failed")) ; return FALSE ;} 
+				{ STRACE_ERROR("RPCCHECK failed") ; return FALSE ;} 
 				
 #define LOCAL_RPCCHECK_0  	if( server == (TSP_server_t)0) \
-				{ STRACE_ERROR(("RPCCHECK failed")) ; return 0 ;} 
+				{ STRACE_ERROR("RPCCHECK failed") ; return 0 ;} 
 
 TSP_provider_info_t * tsp_provider_information(TSP_server_t server)
 {
@@ -76,10 +76,10 @@
   cl = clnt_create(target_name, progid, TSP_RPC_VERSION_INITIAL, "tcp");
 
   if (cl == (CLIENT *)0) {
-    STRACE_ERROR(("ERROR : GLOBAL clnt_create failed for host <%s> / progid <%d/0x%08X>", target_name, progid,progid));
+    STRACE_ERROR("ERROR : GLOBAL clnt_create failed for host <%s> / progid <%d/0x%08X>", target_name, progid,progid);
   }
   else {
-    STRACE_INFO(("CONNECTED to server %s", target_name));
+    STRACE_INFO("CONNECTED to server %s", target_name);
     /* Set time out */
     tsp_wrap_rpc_clnt_set_timeout(cl, TSP_RPC_CONNECT_TIMEOUT);    
   }
@@ -107,7 +107,7 @@
 
   if(strcmp(protocol, TSP_RPC_PROTOCOL) != 0)
     {
-      STRACE_ERROR(("Protocol %s not handled, use %s", protocol, TSP_RPC_PROTOCOL));
+      STRACE_ERROR("Protocol %s not handled, use %s", protocol, TSP_RPC_PROTOCOL);
     }
   else if((server_id < prodid_max_number) && (server_id >=0) )
     {
@@ -129,42 +129,42 @@
 				 strlen(server_name)) == 0)
 			{
 			  strcpy(server_info, server_info_t->info);
-			  STRACE_INFO(("Server opened : '%s'", server_info));
+			  STRACE_INFO("Server opened : '%s'", server_info);
 			  ret = TRUE;
 			}
 		      else
 			{
-			  STRACE_INFO(("Not the requested server : '%s'", server_info_t->info));
+			  STRACE_INFO("Not the requested server : '%s'", server_info_t->info);
 			  TSP_remote_close_server(*server);
 			  ret = FALSE;
 			}
 		    }
 		  else
 		    {
-		      STRACE_ERROR(("Returned info string too long"));
+		      STRACE_ERROR("Returned info string too long");
 		    }
 		}
 	      else
 		{
-		  STRACE_ERROR(("%s", clnt_sperror(*server, "sp_server_info_1\n") ));
+		  STRACE_ERROR("%s", clnt_sperror(*server, "sp_server_info_1\n") );
 		}
 	      
 	    }
 	  else
 	    {
-	      STRACE_DEBUG(("tsp_remote_open_progid failed"));
+	      STRACE_DEBUG("tsp_remote_open_progid failed");
 	    }
 			
 	}
       else
 	{
-	  STRACE_ERROR(("No ProgId for Server Id=%d", server_id));
+	  STRACE_ERROR("No ProgId for Server Id=%d", server_id);
 	}
 		
     }
   else
     {
-      STRACE_ERROR(("server_id %d too high", server_id));
+      STRACE_ERROR("server_id %d too high", server_id);
     }
 	
   return ret;
diff -urN tsp_orig/src/core/rpc/tsp_rpc_cleanup.c tsp_modified/src/core/rpc/tsp_rpc_cleanup.c
--- tsp_orig/src/core/rpc/tsp_rpc_cleanup.c	2007-04-26 19:51:30.000000000 +0200
+++ tsp_modified/src/core/rpc/tsp_rpc_cleanup.c	2009-01-12 17:26:08.000000000 +0100
@@ -82,9 +82,8 @@
     return -1;
    }
 #endif
-
   for(servernumber=0; servernumber<TSP_MAX_SERVER_NUMBER; servernumber++)
-    {
+    { 
       svc_unregister (TSP_get_progid(servernumber), TSP_RPC_VERSION_INITIAL);
       pmap_unset (TSP_get_progid(servernumber), TSP_RPC_VERSION_INITIAL);
     }
diff -urN tsp_orig/src/core/rpc/tsp_rpc_clnt.c.linux tsp_modified/src/core/rpc/tsp_rpc_clnt.c.linux
--- tsp_orig/src/core/rpc/tsp_rpc_clnt.c.linux	2007-04-22 23:15:35.000000000 +0200
+++ tsp_modified/src/core/rpc/tsp_rpc_clnt.c.linux	2009-01-12 17:26:08.000000000 +0100
@@ -16,7 +16,7 @@
  tv.tv_usec = 0;
  return clnt_control(client, CLSET_TIMEOUT, (char *)&tv);
 }
-#define TSP_STRACE_RPC_ERROR(cl, pResult) if(!pResult) { STRACE_ERROR(("%s", clnt_sperror(cl, ""))); }
+#define TSP_STRACE_RPC_ERROR(cl, pResult) if(!pResult) { STRACE_ERROR("%s", clnt_sperror(cl, "")); }
 
 /* Default timeout can be changed using clnt_control() */
 static struct timeval TIMEOUT = { 25, 0 };
diff -urN tsp_orig/src/core/rpc/tsp_rpc_clnt.c.win32 tsp_modified/src/core/rpc/tsp_rpc_clnt.c.win32
--- tsp_orig/src/core/rpc/tsp_rpc_clnt.c.win32	2007-04-26 19:51:30.000000000 +0200
+++ tsp_modified/src/core/rpc/tsp_rpc_clnt.c.win32	2009-01-12 17:26:08.000000000 +0100
@@ -16,7 +16,7 @@
  tv.tv_usec = 0;
  return clnt_control(client, CLSET_TIMEOUT, (char *)&tv);
 }
-#define TSP_STRACE_RPC_ERROR(cl, pResult) if(!pResult) { STRACE_ERROR(("%s", clnt_sperror(cl, ""))); }
+#define TSP_STRACE_RPC_ERROR(cl, pResult) if(!pResult) { STRACE_ERROR("%s", clnt_sperror(cl, "")); }
 
 /* Default timeout can be changed using clnt_control() */
 static struct timeval TIMEOUT = { 25, 0 };
diff -urN tsp_orig/src/core/rpc/tsp_rpc.h.linux tsp_modified/src/core/rpc/tsp_rpc.h.linux
--- tsp_orig/src/core/rpc/tsp_rpc.h.linux	2007-04-22 23:15:35.000000000 +0200
+++ tsp_modified/src/core/rpc/tsp_rpc.h.linux	2009-01-12 17:26:08.000000000 +0100
@@ -276,7 +276,7 @@
 	char *info;
 };
 typedef struct TSP_provider_info_t TSP_provider_info_t;
-#define TSP_STRACE_RPC_ERROR(cl, pResult) if(!pResult) { STRACE_ERROR(("%s", clnt_sperror(cl, ""))); }
+#define TSP_STRACE_RPC_ERROR(cl, pResult) if(!pResult) { STRACE_ERROR("%s", clnt_sperror(cl, "")); }
 
 struct tsp_request_filtered_information_1_argument {
 	TSP_request_information_t arg1;
diff -urN tsp_orig/src/core/rpc/tsp_rpc.h.win32 tsp_modified/src/core/rpc/tsp_rpc.h.win32
--- tsp_orig/src/core/rpc/tsp_rpc.h.win32	2007-04-26 19:51:30.000000000 +0200
+++ tsp_modified/src/core/rpc/tsp_rpc.h.win32	2009-01-12 17:26:08.000000000 +0100
@@ -276,7 +276,7 @@
 	char *info;
 };
 typedef struct TSP_provider_info_t TSP_provider_info_t;
-#define TSP_STRACE_RPC_ERROR(cl, pResult) if(!pResult) { STRACE_ERROR(("%s", clnt_sperror(cl, ""))); }
+#define TSP_STRACE_RPC_ERROR(cl, pResult) if(!pResult) { STRACE_ERROR("%s", clnt_sperror(cl, "")); }
 
 struct tsp_request_filtered_information_1_argument {
 	TSP_request_information_t req_info;
diff -urN tsp_orig/src/core/rpc/tsp_rpc_svc.c.linux tsp_modified/src/core/rpc/tsp_rpc_svc.c.linux
--- tsp_orig/src/core/rpc/tsp_rpc_svc.c.linux	2007-04-22 23:15:35.000000000 +0200
+++ tsp_modified/src/core/rpc/tsp_rpc_svc.c.linux	2009-01-12 17:26:08.000000000 +0100
@@ -1,4 +1,5 @@
-#ifdef VXWORKS
+
+#ifndef VXWORKS
 #define static extern
 #endif /* !VXWORKS */
 /*
@@ -18,7 +19,7 @@
 #ifndef SIG_PF
 #define SIG_PF void(*)(int)
 #endif
-#define TSP_STRACE_RPC_ERROR(cl, pResult) if(!pResult) { STRACE_ERROR(("%s", clnt_sperror(cl, ""))); }
+#define TSP_STRACE_RPC_ERROR(cl, pResult) if(!pResult) { STRACE_ERROR("%s", clnt_sperror(cl, "")); }
 
 static TSP_provider_info_t *
 _tsp_provider_information_1 (void  *argp, struct svc_req *rqstp)
@@ -34,7 +35,7 @@
 
 static int *
 _tsp_request_close_1 (TSP_request_close_t  *argp, struct svc_req *rqstp)
-{
+{	
 	return (tsp_request_close_1_svc(*argp, rqstp));
 }
 
diff -urN tsp_orig/src/core/rpc/tsp_rpc_svc.c.win32 tsp_modified/src/core/rpc/tsp_rpc_svc.c.win32
--- tsp_orig/src/core/rpc/tsp_rpc_svc.c.win32	2007-04-26 19:51:30.000000000 +0200
+++ tsp_modified/src/core/rpc/tsp_rpc_svc.c.win32	2009-01-12 17:26:08.000000000 +0100
@@ -22,7 +22,7 @@
 #ifndef SIG_PF
 #define SIG_PF void(*)(int)
 #endif
-#define TSP_STRACE_RPC_ERROR(cl, pResult) if(!pResult) { STRACE_ERROR(("%s", clnt_sperror(cl, ""))); }
+#define TSP_STRACE_RPC_ERROR(cl, pResult) if(!pResult) { STRACE_ERROR("%s", clnt_sperror(cl, "")); }
 
 static TSP_provider_info_t *
 _tsp_provider_information_1 (void  *argp, struct svc_req *rqstp)
diff -urN tsp_orig/src/core/rpc/tsp_rpc.x tsp_modified/src/core/rpc/tsp_rpc.x
--- tsp_orig/src/core/rpc/tsp_rpc.x	2006-10-25 16:40:30.000000000 +0200
+++ tsp_modified/src/core/rpc/tsp_rpc.x	2009-01-12 17:26:08.000000000 +0100
@@ -755,4 +755,4 @@
 %}
 #endif
 
-%#define TSP_STRACE_RPC_ERROR(cl, pResult) if(!pResult)  {  STRACE_ERROR(("%s", clnt_sperror(cl, "")));  }
+%#define TSP_STRACE_RPC_ERROR(cl, pResult) if(!pResult)  {  STRACE_ERROR("%s", clnt_sperror(cl, ""));  }
diff -urN tsp_orig/src/core/rpc/tsp_rpc_xdr.c.linux tsp_modified/src/core/rpc/tsp_rpc_xdr.c.linux
--- tsp_orig/src/core/rpc/tsp_rpc_xdr.c.linux	2007-04-22 23:15:35.000000000 +0200
+++ tsp_modified/src/core/rpc/tsp_rpc_xdr.c.linux	2009-01-12 17:26:08.000000000 +0100
@@ -857,4 +857,4 @@
 		 return FALSE;
 	return TRUE;
 }
-#define TSP_STRACE_RPC_ERROR(cl, pResult) if(!pResult) { STRACE_ERROR(("%s", clnt_sperror(cl, ""))); }
+#define TSP_STRACE_RPC_ERROR(cl, pResult) if(!pResult) { STRACE_ERROR("%s", clnt_sperror(cl, "")); }
diff -urN tsp_orig/src/core/rpc/tsp_rpc_xdr.c.win32 tsp_modified/src/core/rpc/tsp_rpc_xdr.c.win32
--- tsp_orig/src/core/rpc/tsp_rpc_xdr.c.win32	2007-04-26 19:51:30.000000000 +0200
+++ tsp_modified/src/core/rpc/tsp_rpc_xdr.c.win32	2009-01-12 17:26:08.000000000 +0100
@@ -852,4 +852,4 @@
 		 return FALSE;
 	return TRUE;
 }
-#define TSP_STRACE_RPC_ERROR(cl, pResult) if(!pResult) { STRACE_ERROR(("%s", clnt_sperror(cl, ""))); }
+#define TSP_STRACE_RPC_ERROR(cl, pResult) if(!pResult) { STRACE_ERROR("%s", clnt_sperror(cl, "")); }
diff -urN tsp_orig/src/core/rpc/tsp_server.c tsp_modified/src/core/rpc/tsp_server.c
--- tsp_orig/src/core/rpc/tsp_server.c	2006-10-21 10:48:00.000000000 +0200
+++ tsp_modified/src/core/rpc/tsp_server.c	2009-01-12 17:26:08.000000000 +0100
@@ -1,6 +1,6 @@
 /*
 
-$Header: /sources/tsp/tsp/src/core/rpc/tsp_server.c,v 1.33 2006/10/21 08:48:00 erk Exp $
+$Header: /sources/tsp/tsp/src/core/rpc/tsp_server.c,v 1.38 2008/08/02 11:01:47 deweerdt Exp $
 
 -----------------------------------------------------------------------
 
@@ -64,6 +64,8 @@
 /* same FIXME IDL <--> C dependency */
 #include "../common/tsp_common_macros.h"
 
+#include <tsp_common_trace.h>
+
 #include <tsp_server.h>
 #include <tsp_rpc.h>
 #include <tsp_rpc_confprogid.h>
@@ -98,11 +100,8 @@
 
 int *tsp_request_close_1_svc(TSP_request_close_t req_close, struct svc_req * rqstp)
 {
-
   static int retcode = 0;
-	
   TSP_provider_request_close(&req_close);
-	
   return &retcode;
 }
 
@@ -179,7 +178,7 @@
   
 
   /* endianity managment*/
-/*   STRACE_DEBUG(("Len=%d,  pgi = %d value = %f et ret = %d", async_sample_write.data.data_len, async_sample_write.provider_global_index,(double*)(async_sample_write.data.data_val),ret)); */
+/*   STRACE_DEBUG("Len=%d,  pgi = %d value = %f et ret = %d", async_sample_write.data.data_len, async_sample_write.provider_global_index,(double*)(async_sample_write.data.data_val),ret); */
 
 /*   switch (async_sample_write.data.data_len) { */
 /*   case 2:  */
@@ -196,11 +195,11 @@
 /*   } */
 	
 
-  STRACE_DEBUG(("TSP_SERVER Before async_write : pgi %d value %s return %d ",async_sample_write.provider_global_index,async_sample_write.data.data_val,ret ));
+  STRACE_DEBUG("TSP_SERVER Before async_write : pgi %d value %s return %d ",async_sample_write.provider_global_index,async_sample_write.data.data_val,ret);
   
   ret = TSP_provider_request_async_sample_write(&async_sample_write);	
   
-  STRACE_DEBUG(("TSP_SERVER After async_write : pgi %d value %s return %d ",async_sample_write.provider_global_index,async_sample_write.data.data_val,ret ));
+  STRACE_DEBUG("TSP_SERVER After async_write : pgi %d value %s return %d ",async_sample_write.provider_global_index,async_sample_write.data.data_val,ret);
 
   return &ret;
   
@@ -211,7 +210,7 @@
   static TSP_async_sample_t ret;
   
   /* endianity managment*/
-/*   STRACE_DEBUG(("Len=%d,  pgi = %d value = %f et ret = %d", async_sample_read.data.data_len, async_sample_read.provider_global_index,(double*)(async_sample_read.data.data_val),ret)); */
+/*   STRACE_DEBUG("Len=%d,  pgi = %d value = %f et ret = %d", async_sample_read.data.data_len, async_sample_read.provider_global_index,(double*)(async_sample_read.data.data_val),ret); */
 
 /*   switch (async_sample_read.data.data_len) { */
 /*   case 2:  */
@@ -239,7 +238,6 @@
   
 }
 
-
 static int TSP_rpc_init(TSP_rpc_request_config_t *config)
 {
   int rpcport = -1;
@@ -258,37 +256,95 @@
   return config->server_number;
 }
 
+#if !defined(__rtems__)
 static void TSP_rpc_run(TSP_rpc_request_config_t *config)
 {
   int32_t rpc_progid = TSP_get_progid(config->server_number);
 
+#ifdef VXWORKS
+  //Any tasks uses RPC must call rpcTaskInit();
+  if(rpcTaskInit() == ERROR) 
+      STRACE_ERROR("rpcTaskInit error");
+#endif
+
   /* svc_create does not exist for linux, we must use the deprecated function */
   /* pmap_unset (rpc_progid, TSP_RPC_VERSION_INITIAL); */
 
-  config->xprt = svctcp_create(RPC_ANYSOCK, 0, 0);
-  if (config->xprt == NULL) 
-    {
-      STRACE_ERROR(("Cannot create TCP service"));
-      return;
-    }
+  config->xprt = svctcp_create(RPC_ANYSOCK, 0, 0);  
 
+  if (config->xprt == NULL) 
+  {
+    STRACE_ERROR("Cannot create TCP service");
+    return;
+  }
+  
   if (!svc_register(config->xprt, rpc_progid, TSP_RPC_VERSION_INITIAL, tsp_rpc_1, IPPROTO_TCP))
-    {
-      STRACE_ERROR(("RPC server unable to register ProgId=%X",  rpc_progid));
-      return;
-    }
+  {
+    STRACE_ERROR("RPC server unable to register ProgId=%X",  rpc_progid);
+    return;
+  }
 
-  STRACE_DEBUG(("RPC server is being be started with ProgId=%X", rpc_progid));
+  STRACE_DEBUG("RPC server is being be started with ProgId=%X", rpc_progid);
   
-  STRACE_DEBUG(("launching svc_run..."));
+  STRACE_DEBUG("launching svc_run...");
   svc_run();
-  STRACE_INFO(("svc_run returned"));
+  STRACE_INFO("svc_run returned");
 
 }
+#else
+static void TSP_rpc_run(TSP_rpc_request_config_t *config)
+{
+	int32_t rpc_progid = TSP_get_progid(config->server_number);
+	int sock;
+	struct sockaddr_in srv_addr;
+	SVCXPRT *transp;
+	bool_t status;
+
+	/*
+	 * Create socket
+	 */
+	sock = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
+	if (sock < 0) {
+		perror ("socket creation problem");
+		return 1;
+	}
+
+	/*
+	 * Bind to local address
+	 */
+	srv_addr.sin_family = htons (AF_INET);
+	srv_addr.sin_port = htons (TCP_PORT);
+	srv_addr.sin_addr.s_addr = htonl (INADDR_ANY);
+	if (bind (sock, (struct sockaddr *)&srv_addr, sizeof srv_addr) < 0) {
+		STRACE_ERROR("RPC server unable to register ProgId=%X",  strerror(errno));
+		return 2;
+	}
+
+	/*
+	 * Create TCP server
+	 */
+
+	config->xprt = svctcp_create(sock, 0, 0);
+	if (config->xprt == NULL) {
+		STRACE_ERROR("Cannot create TCP service");
+		return;
+	}
+	if (!svc_register(config->xprt, rpc_progid, TSP_RPC_VERSION_INITIAL, tsp_rpc_1, 0))
+	{
+		STRACE_ERROR("RPC server unable to register ProgId=%X",  rpc_progid);
+		return;
+	}
+	STRACE_DEBUG("RPC server is being be started with ProgId=%X", rpc_progid);
+
+	STRACE_DEBUG("launching svc_run...");
+	svc_run();
+	STRACE_INFO("svc_run returned");
+}
+#endif /* !defined(__rtems__) */
 
 static void TSP_rpc_stop(TSP_rpc_request_config_t *config)
 {
-  /* STRACE_DEBUG(("calling svc_exit...")); */
+  /* STRACE_DEBUG("calling svc_exit..."); */
   /* svc_destroy(config->xprt); */
 
   /* Clean-up Port map so that next provider could use this ProgId */
@@ -299,73 +355,68 @@
     }
 }
 
-int TSP_rpc_request(TSP_provider_request_handler_t* this)
+int TSP_rpc_request(TSP_provider_request_handler_t* cthis)
 {
-  this->config             = TSP_rpc_request_config;
-  this->run                = TSP_rpc_request_run;
-  this->stop               = TSP_rpc_request_stop;
-  this->url                = TSP_rpc_request_url;
-#if defined (WIN32)
+  cthis->config             = TSP_rpc_request_config;
+  cthis->run                = TSP_rpc_request_run;
+  cthis->stop               = TSP_rpc_request_stop;
+  cthis->url                = TSP_rpc_request_url;
+#if defined (_WIN32)
   /* structure pthread_t different under Windows */
-  this->tid.p              = -1;
+  cthis->tid.p              = -1;
 #else
-  this->tid                = (pthread_t)-1;
+  cthis->tid                = (pthread_t)-1;
 #endif
-  this->config_param       = calloc(1, sizeof(TSP_rpc_request_config_t));
+  cthis->config_param       = calloc(1, sizeof(TSP_rpc_request_config_t));
 
-  this->status             = TSP_RQH_STATUS_IDLE;
+  cthis->status             = TSP_RQH_STATUS_IDLE;
   return TRUE;
 }
 
-int TSP_rpc_request_config(TSP_provider_request_handler_t* this)
+int TSP_rpc_request_config(TSP_provider_request_handler_t* cthis)
 {
-  TSP_rpc_request_config_t *config = (TSP_rpc_request_config_t *)(this->config_param);
+  TSP_rpc_request_config_t *config = (TSP_rpc_request_config_t *)(cthis->config_param);
   char  hostname[MAXHOSTNAMELEN+1];
   char* servername;
   int  hostnameOk;
 #undef NUMERIC_HOST
 #if NUMERIC_HOST
+  struct in_addr addr;
   struct hostent*  myhost;
   union {
     uint32_t    addr;
     uint8_t     parts[4];
   } myu;
 #endif
-
+  
   config->server_number = TSP_provider_get_server_base_number();
   /* do not buffer overflow */
   memset(&config->url[0],'\0',TSP_URL_MAXLENGTH);
   
   config->server_number = TSP_rpc_init(config);
   if(config->server_number < 0) {
-      STRACE_ERROR(("unable to register any RPC progid :\n\tcheck RPC daemons, or use tsp_rpc_cleanup to clean-up all TSP RPC port mapping"));
-      this->status = TSP_RQH_STATUS_IDLE;
+      STRACE_ERROR("unable to register any RPC progid :\n\tcheck RPC daemons, or use tsp_rpc_cleanup to clean-up all TSP RPC port mapping");
+      cthis->status = TSP_RQH_STATUS_IDLE;
       
       return FALSE;
   }
   else {
     hostnameOk = gethostname(hostname, MAXHOSTNAMELEN);
 #if NUMERIC_HOST
-    myhost = gethostbyname(hostname);
-    if (myhost == NULL) {
-      STRACE_ERROR(("Cannot gethostbyname '(hostname --> @IP)' for host <%s> check your /etc/hosts file.\n",hostname));
-      /* be tolerant we keep going with hostname but... consumer may not handle this properly */    
-    } else {
-     /* 
-      * Now translate hostname to @IP in order
-      * to avoid name -> IP resolution on consumer side 
-      */
+    GETHOSTBYNAME(hostname,myhost,addr)
+
       memset(hostname,0,sizeof(hostname));
-      myu.addr = (uint32_t)ntohl(*((uint32_t*)myhost->h_addr_list[0]));
-      sprintf(hostname,"%d.%d.%d.%d",myu.parts[3], myu.parts[2], myu.parts[1], myu.parts[0]);
-    }
+      myu.addr =*((uint32_t*)myhost->h_addr_list[0]);
+      sprintf(hostname,"%d.%d.%d.%d",myu.parts[0], myu.parts[1], myu.parts[2], myu.parts[3]);
+
+      GETHOSTBYNAME_FREE(myhost);
 #endif
     servername = (char*)TSP_provider_get_name();
     
     sprintf(config->url, /* TSP_URL_MAXLENGTH, pour snprintf quand Solaris 2.5 sera mort */
 	    TSP_URL_FORMAT, TSP_RPC_PROTOCOL, hostname, servername, config->server_number);
     
-    this->status = TSP_RQH_STATUS_CONFIGURED;
+    cthis->status = TSP_RQH_STATUS_CONFIGURED;
     
     return TRUE;
   }
@@ -374,38 +425,38 @@
 
 
 
-void* TSP_rpc_request_run(TSP_provider_request_handler_t* this)
+void* TSP_rpc_request_run(void* cthis)
 {
-
-  TSP_rpc_request_config_t *config = (TSP_rpc_request_config_t *)(this->config_param);
+  TSP_provider_request_handler_t* rthis = (TSP_provider_request_handler_t*) cthis;
+  TSP_rpc_request_config_t *config = (TSP_rpc_request_config_t *)(rthis->config_param);
 
   /* pthread_detach(pthread_self()); */ /* FIXME shoudl we do this */ 
 
   if(config->server_number >= 0)
     {
-      this->status = TSP_RQH_STATUS_RUNNING;
+      rthis->status = TSP_RQH_STATUS_RUNNING;
       TSP_rpc_run(config);
-      this->status = TSP_RQH_STATUS_IDLE;
+      rthis->status = TSP_RQH_STATUS_IDLE;
    }
 
   return (void*)NULL;
 } /* end of TSP_rpc_request_run */
 
-char *TSP_rpc_request_url(TSP_provider_request_handler_t* this)
+char *TSP_rpc_request_url(TSP_provider_request_handler_t* cthis)
 {
-  TSP_rpc_request_config_t *config = (TSP_rpc_request_config_t*)(this->config_param);
-  if(this->status == TSP_RQH_STATUS_RUNNING)
+  TSP_rpc_request_config_t *config = (TSP_rpc_request_config_t*)(cthis->config_param);
+  if(cthis->status == TSP_RQH_STATUS_RUNNING)
     return config->url;
   else
     return NULL;
 }
 
-int TSP_rpc_request_stop(TSP_provider_request_handler_t* this)
+int TSP_rpc_request_stop(TSP_provider_request_handler_t* cthis)
 {
-  TSP_rpc_request_config_t *config = (TSP_rpc_request_config_t*)(this->config_param);
+  TSP_rpc_request_config_t *config = (TSP_rpc_request_config_t*)(cthis->config_param);
   
   TSP_rpc_stop(config);
-  this->status = TSP_RQH_STATUS_STOPPED;
+  cthis->status = TSP_RQH_STATUS_STOPPED;
 
   return TRUE;
 } /* end of TSP_rpc_request_stop */
diff -urN tsp_orig/src/core/rpc/tsp_server.h tsp_modified/src/core/rpc/tsp_server.h
--- tsp_orig/src/core/rpc/tsp_server.h	2006-10-18 11:58:48.000000000 +0200
+++ tsp_modified/src/core/rpc/tsp_server.h	2009-01-12 17:26:08.000000000 +0100
@@ -1,6 +1,6 @@
 /*
 
-$Id: tsp_server.h,v 1.11 2006/10/18 09:58:48 erk Exp $
+$Id: tsp_server.h,v 1.12 2007/08/30 15:14:42 erk Exp $
 
 -----------------------------------------------------------------------
 
@@ -51,7 +51,7 @@
 
 int TSP_rpc_request(TSP_provider_request_handler_t* cthis);
 int TSP_rpc_request_config(TSP_provider_request_handler_t* cthis);
-void* TSP_rpc_request_run(TSP_provider_request_handler_t* cthis);
+void* TSP_rpc_request_run(void* cthis);
 int TSP_rpc_request_stop(TSP_provider_request_handler_t* cthis);
 char* TSP_rpc_request_url(TSP_provider_request_handler_t* cthis);
 
diff -urN tsp_orig/src/core/xmlrpc/tsp_xmlrpc_client.c tsp_modified/src/core/xmlrpc/tsp_xmlrpc_client.c
--- tsp_orig/src/core/xmlrpc/tsp_xmlrpc_client.c	2006-07-19 01:59:19.000000000 +0200
+++ tsp_modified/src/core/xmlrpc/tsp_xmlrpc_client.c	2009-01-12 17:26:08.000000000 +0100
@@ -56,7 +56,7 @@
   TSP_provider_info_t *prov_info;
   xmlrpc_value *result;
 	
-  STRACE_IO(("-->IN"));
+  STRACE_IO("-->IN");
 
   result = xmlrpc_client_call(&server->xmlrpc_envi, server->url, "tsp.tsp_provider_information", "()");
   die_if_fault_occurred(&server->xmlrpc_envi);
@@ -64,7 +64,7 @@
   prov_info = xmlrpc_value_to_TSP_provider_info(&server->xmlrpc_envi, result);
   xmlrpc_DECREF(result);
 
-  STRACE_IO(("-->OUT"));
+  STRACE_IO("-->OUT");
 
   return prov_info;
 }	
@@ -83,7 +83,7 @@
   *server = (TSP_server_t)malloc(sizeof(**server));
   server_info[0] = '\0';
 	
-  STRACE_IO(("-->IN"));
+  STRACE_IO("-->IN");
 
   /* XMLRPC client library startup */
   xmlrpc_client_init(XMLRPC_CLIENT_NO_FLAGS, NAME, VERSION);
@@ -104,21 +104,21 @@
 							 server_info_t->info,
 							 strlen(server_name)) == 0) {
 						  strcpy(server_info, server_info_t->info);
-						  STRACE_INFO(("Server opened : '%s'", server_info));
+						  STRACE_INFO("Server opened : '%s'", server_info);
 						  ret = TRUE;
 				  } else {																					 
-						  STRACE_INFO(("Not the requested server : '%s'", server_info_t->info));
+						  STRACE_INFO("Not the requested server : '%s'", server_info_t->info);
 						  TSP_remote_close_server(*server);
 						  ret = FALSE;
 				  }
 		  } else {
-				  STRACE_ERROR(("Returned info string too long"));
+				  STRACE_ERROR("Returned info string too long");
 		  }
   } else {
-		  STRACE_ERROR(("Could not connect to specified server"));
+		  STRACE_ERROR("Could not connect to specified server");
   }
   
-  STRACE_IO(("-->OUT"));
+  STRACE_IO("-->OUT");
 
 	
   return ret;
@@ -127,7 +127,7 @@
 
 void TSP_remote_close_server(TSP_server_t server)
 {
-  STRACE_IO(("-->IN"));
+  STRACE_IO("-->IN");
 
   
   /* Clean up our error-handling environment. */
@@ -136,7 +136,7 @@
   /* Shutdown our XML-RPC client library. */
   xmlrpc_client_cleanup();
 
-  STRACE_IO(("-->OUT"));
+  STRACE_IO("-->OUT");
 }
 
 
@@ -151,9 +151,9 @@
   TSP_answer_open_t *ans_open;
   xmlrpc_value *result;
 	
-  STRACE_IO(("-->IN"));
+  STRACE_IO("-->IN");
 
-  STRACE_IO((server->url));
+  STRACE_IO(server->url);
 
 
   result = xmlrpc_client_call(&server->xmlrpc_envi, server->url, "tsp.tsp_request_open", 
@@ -168,7 +168,7 @@
 
   xmlrpc_DECREF(result);
 
-  STRACE_IO(("-->OUT"));
+  STRACE_IO("-->OUT");
   return   ans_open;
 }	
 
@@ -178,7 +178,7 @@
   int res;
   xmlrpc_value *result;
 	
-  STRACE_IO(("-->IN"));
+  STRACE_IO("-->IN");
 
   result = xmlrpc_client_call(&server->xmlrpc_envi, 
 							  server->url, 
@@ -195,7 +195,7 @@
   /* Dispose of our result value. */
   xmlrpc_DECREF(result);
 
-  STRACE_IO(("-->OUT"));
+  STRACE_IO("-->OUT");
 	
   return res;
 }	
@@ -206,7 +206,7 @@
   TSP_answer_sample_t *ans_sample;
   xmlrpc_value *result;
 
-  STRACE_IO(("-->IN"));
+  STRACE_IO("-->IN");
 
   result = xmlrpc_client_call(&server->xmlrpc_envi, 
 							  server->url, 
@@ -220,7 +220,7 @@
 
   xmlrpc_DECREF(result);
 
-  STRACE_IO(("-->OUT"));
+  STRACE_IO("-->OUT");
   return ans_sample;
   
 }	
@@ -233,7 +233,7 @@
   TSP_answer_sample_t *ans_sample;
   xmlrpc_value *xmlrpc_params, *result;
 	
-  STRACE_IO(("-->IN"));
+  STRACE_IO("-->IN");
 
   xmlrpc_params = TSP_request_sample_to_xmlrpc_value(&server->xmlrpc_envi, req_sample);
 
@@ -247,7 +247,7 @@
   ans_sample = xmlrpc_value_to_TSP_answer_sample(&server->xmlrpc_envi, result);
   xmlrpc_DECREF(result);
 
-  STRACE_IO(("-->OUT"));
+  STRACE_IO("-->OUT");
 	
   return ans_sample;
 }
@@ -260,7 +260,7 @@
   TSP_answer_sample_init_t* ans_sample_init;
   xmlrpc_value *xr_result;
 	
-  STRACE_IO(("-->IN"));
+  STRACE_IO("-->IN");
 
   xr_result = xmlrpc_client_call(&server->xmlrpc_envi, 
 							  server->url, 
@@ -274,7 +274,7 @@
   ans_sample_init = xmlrpc_value_to_TSP_answer_sample_init(&server->xmlrpc_envi, xr_result);
   xmlrpc_DECREF(xr_result);
 
-  STRACE_IO(("-->OUT"));
+  STRACE_IO("-->OUT");
 	
   return ans_sample_init;
 }
@@ -287,7 +287,7 @@
   TSP_answer_sample_destroy_t* ans_sample_destroy;
   xmlrpc_value *xr_result;
 	
-  STRACE_IO(("-->IN"));
+  STRACE_IO("-->IN");
 	
   xr_result = xmlrpc_client_call(&server->xmlrpc_envi, 
 								 server->url, 
@@ -303,26 +303,26 @@
  	
   xmlrpc_DECREF(xr_result);
 
-  STRACE_IO(("-->OUT"));
+  STRACE_IO("-->OUT");
 	
   return ans_sample_destroy;
 }
 	
 TSP_answer_sample_t * TSP_request_filtered_information(const TSP_request_information_t* req_info, int filter_kind, char* filter_string, TSP_server_t server)
 {
-    STRACE_ERROR(("TSP_request_filtered_information unimplemented in XMLRPC"));
+    STRACE_ERROR("TSP_request_filtered_information unimplemented in XMLRPC");
 	return NULL;
 }
 
 int* TSP_request_async_sample_write(const TSP_async_sample_t* async_sample_write, TSP_server_t server)
 {
-    STRACE_ERROR(("TSP_request_async_sample_write unimplemented in XMLRPC"));
+    STRACE_ERROR("TSP_request_async_sample_write unimplemented in XMLRPC");
 	return NULL;
 }
 TSP_async_sample_t* TSP_request_async_sample_read(const TSP_async_sample_t* async_sample_read, 
 						  TSP_server_t server)
 {
-    STRACE_ERROR(("TSP_request_async_sample_read unimplemented in XMLRPC"));
+    STRACE_ERROR("TSP_request_async_sample_read unimplemented in XMLRPC");
 	return NULL;
 }
 
diff -urN tsp_orig/src/core/xmlrpc/tsp_xmlrpc_server.c tsp_modified/src/core/xmlrpc/tsp_xmlrpc_server.c
--- tsp_orig/src/core/xmlrpc/tsp_xmlrpc_server.c	2007-02-28 23:01:43.000000000 +0100
+++ tsp_modified/src/core/xmlrpc/tsp_xmlrpc_server.c	2009-01-12 17:26:08.000000000 +0100
@@ -84,7 +84,7 @@
   TSP_provider_info_t server_info;
 
   server_info.info = strdup(GLU_get_server_name());
-  STRACE_DEBUG(("server_info.info: %s\n",server_info.info));
+  STRACE_DEBUG("server_info.info: %s\n",server_info.info);
   return xmlrpc_build_value(env, "{s:s}", "info", server_info.info);
 }
 
@@ -311,7 +311,7 @@
   xmlrpc_registry * registry;
   xmlrpc_env env;
 
-  STRACE_DEBUG(("Launched Abyss server"));
+  STRACE_DEBUG("Launched Abyss server");
 
   atexit(clean_exit);
 
@@ -372,9 +372,9 @@
   //TODO: make it configurable
   serverparm.log_file_name = "/dev/stderr";
 
-  STRACE_INFO(("Starting abyss server..."));
+  STRACE_INFO("Starting abyss server...");
   xmlrpc_server_abyss(&env, &serverparm, XMLRPC_APSIZE(log_file_name));
-  STRACE_ERROR(("Abyss server returned"));
+  STRACE_ERROR("Abyss server returned");
   return;
 }
 
diff -urN tsp_orig/src/core/xmlrpc/tsp_xmlrpc_util.c tsp_modified/src/core/xmlrpc/tsp_xmlrpc_util.c
--- tsp_orig/src/core/xmlrpc/tsp_xmlrpc_util.c	2007-02-20 22:09:15.000000000 +0100
+++ tsp_modified/src/core/xmlrpc/tsp_xmlrpc_util.c	2009-01-12 17:26:08.000000000 +0100
@@ -1,5 +1,5 @@
 #include "tsp_xmlrpc_util.h"
-#include "tsp_simple_trace.h"
+#include "tsp_common_trace.h"
 
 
 
@@ -221,7 +221,7 @@
   
   die_if_fault_occurred(env);
 
-  STRACE_DEBUG(("Nombre de symboles: %d\n\n", req_sample->symbols.TSP_sample_symbol_info_list_t_len));
+  STRACE_DEBUG("Nombre de symboles: %d\n\n", req_sample->symbols.TSP_sample_symbol_info_list_t_len);
 
 
   req_sample->symbols.TSP_sample_symbol_info_list_t_val = malloc(sizeof(TSP_sample_symbol_info_t)*req_sample->symbols.TSP_sample_symbol_info_list_t_len);
diff -urN tsp_orig/src/core/xmlrpc/tsp_xmlrpc_util.h tsp_modified/src/core/xmlrpc/tsp_xmlrpc_util.h
--- tsp_orig/src/core/xmlrpc/tsp_xmlrpc_util.h	2006-07-19 01:59:19.000000000 +0200
+++ tsp_modified/src/core/xmlrpc/tsp_xmlrpc_util.h	2009-01-12 17:26:08.000000000 +0100
@@ -8,8 +8,8 @@
 #define die_if_fault_occurred(x) \
 { \
     if ((x)->fault_occurred) { \
-        STRACE_ERROR(("XML-RPC Fault: %s (%d)\n", \
-					  (x)->fault_string, (x)->fault_code)); \
+        STRACE_ERROR("XML-RPC Fault: %s (%d)\n", \
+					  (x)->fault_string, (x)->fault_code); \
         exit(1); \
     } \
 }
diff -urN tsp_orig/src/providers/bb_provider/bb_tsp_provider.c tsp_modified/src/providers/bb_provider/bb_tsp_provider.c
--- tsp_orig/src/providers/bb_provider/bb_tsp_provider.c	2007-03-23 22:12:53.000000000 +0100
+++ tsp_modified/src/providers/bb_provider/bb_tsp_provider.c	2009-01-12 17:26:08.000000000 +0100
@@ -45,6 +45,7 @@
 #define BB_TSP_PROVIDER_C
 #include <bb_tsp_provider.h>
 
+
 /*
  * Ugly declare for smooth TSP startup
  * FIXME.
@@ -62,6 +63,8 @@
 
 #include <signal.h>
 
+#include <tsp_common_trace.h>
+
 /*
  * Some static
  */
@@ -402,7 +405,7 @@
 		} else  { /* skip unhandled BB type */ 
 			char *n;
 			n = bb_get_varname(&bb_data_desc(shadow_bb)[i]);
-			STRACE_INFO(("Skipping unhandled symbol type <%d> name <%s>",bb_data_desc(shadow_bb)[i].type, n));
+			STRACE_INFO("Skipping unhandled symbol type <%d> name <%s>",bb_data_desc(shadow_bb)[i].type, n);
 			free(n);
 		}
 	} /* loop over bb items */
@@ -446,7 +449,7 @@
   void *sym_value;
   char *n;
 
-  STRACE_INFO(("Starting symbol Valid nb_symbol=%u",symbol_list->TSP_sample_symbol_info_list_t_len));
+  STRACE_INFO("Starting symbol Valid nb_symbol=%u",symbol_list->TSP_sample_symbol_info_list_t_len);
   /* For each requested symbols, check by name, and find the provider global index */
   for (i = 0 ; i < symbol_list->TSP_sample_symbol_info_list_t_len ; i++) {
 
@@ -458,27 +461,28 @@
           n,
           VARNAME_MAX_SIZE,
           array_index, &array_index_len)) {
-      STRACE_INFO  (("%s: cannot parse symname <%s>",
+      STRACE_INFO  ("%s: cannot parse symname <%s>",
             "BB_GLU_get_pgi",
-            symbol_list->TSP_sample_symbol_info_list_t_val[i].name));
+            symbol_list->TSP_sample_symbol_info_list_t_val[i].name);
       ret = FALSE;
       free(n);
       continue;
     } 	 
     else {
-      STRACE_DEBUG  (("%s: array name <%s> parsed to symname <%s>",
+      STRACE_DEBUG  ("%s: array name <%s> parsed to symname <%s>",
             "BB_GLU_get_pgi",
-            symbol_list->TSP_sample_symbol_info_list_t_val[i].name, n));
+            symbol_list->TSP_sample_symbol_info_list_t_val[i].name, n);
       /* search if the symbol is published in the blackboard */
       bb_set_varname(&sym_data_desc, n);
       sym_data_desc.type      = E_BB_DISCOVER;
       sym_data_desc.type_size = 0;
       sym_data_desc.dimension = 0;
+    
       sym_value = bb_alias_subscribe(shadow_bb,&sym_data_desc,array_index,array_index_len);    	
-
+    
       if (NULL==sym_value) {
-        STRACE_INFO  (("symbol <%s> not found in BB <%s>",
-              n, shadow_bb->name));
+        STRACE_INFO  ("symbol <%s> not found in BB <%s>",
+              n, shadow_bb->name);
         pg_indexes[i] = -1;	     
         ret = FALSE;
         free(n);
@@ -488,8 +492,8 @@
         /* find the index of the symbol in the BB */
         bbidx = bb_find(shadow_bb, n);
 
-        STRACE_DEBUG(("Validate symbol: orig_name=<%s>, short=<%s>",
-              symbol_list->TSP_sample_symbol_info_list_t_val[i].name, n));
+        STRACE_DEBUG("Validate symbol: orig_name=<%s>, short=<%s>",
+              symbol_list->TSP_sample_symbol_info_list_t_val[i].name, n);
 
         /* 
          * Array index is in reverse order of aliasstack.
@@ -509,7 +513,7 @@
         if (-1==bbidx) {
           pg_indexes[i] = -1;
           ret=FALSE;
-          STRACE_INFO(("Symbol=%s, not found",symbol_list->TSP_sample_symbol_info_list_t_val[i].name));
+          STRACE_INFO("Symbol=%s, not found",symbol_list->TSP_sample_symbol_info_list_t_val[i].name);
           free(n);
           continue;
         } else {
@@ -523,9 +527,9 @@
             /* validate */
             if ((aliasstack[j].dimension > 1) && (aliasstack[j].dimension < array_index[array_index_ptr])) {
               char *n = bb_get_varname(&aliasstack[j]);
-              STRACE_INFO(("Symbol=%s, found but index=%d out of range for element <%s>",
+              STRACE_INFO("Symbol=%s, found but index=%d out of range for element <%s>",
                     symbol_list->TSP_sample_symbol_info_list_t_val[i].name,
-                    array_index[array_index_ptr], n));
+                    array_index[array_index_ptr], n);
               ret = FALSE;
               free(n);
             }
@@ -578,7 +582,7 @@
             }
 
             pg_indexes[i] = bbindex_to_pgi[bbidx] + pgi_offset;
-            STRACE_INFO(("Symbol=%s, found index=%d",symbol_list->TSP_sample_symbol_info_list_t_val[i].name,pg_indexes[i]));
+            STRACE_INFO("Symbol=%s, found index=%d",symbol_list->TSP_sample_symbol_info_list_t_val[i].name,pg_indexes[i]);
           }
         }
       }
@@ -591,7 +595,7 @@
         &(pg_indexes[i]));
   }
 
-  STRACE_INFO(("End of symbol Valid")); 
+  STRACE_INFO("End of symbol Valid"); 
 
   return ret;
 } /* BB_GLU_get_pgi */
@@ -634,7 +638,9 @@
     /* 
      * Update shadow BB data zone
      */    
+   
     bb_shadow_update_data(shadow_bb,the_bb);
+   
     /* 
      * Refresh the [reverse list of consumed symbols]
      * Must be call at each step in case of new samples wanted 
@@ -680,7 +686,7 @@
 	char   strvalue[256];
 	void*  genuineBBdata;
 	
-	STRACE_INFO(("BB_PROVIDER want to AsyncWrite : pgi <%d> with value : 0x%X (value_size=%d)",provider_global_index, (uint32_t)value_ptr,value_size));
+	STRACE_INFO("BB_PROVIDER want to AsyncWrite : pgi <%d> with value : 0x%X (value_size=%d)",provider_global_index, (uint32_t)value_ptr,value_size);
 	
 	/* FIXME : Should use the pgi to cast properly the data versus the real type */
 	value = *(double*)value_ptr;
@@ -693,7 +699,7 @@
 			char *n;
 	    data_desc = bbdatadesc_by_pgi[provider_global_index];
 			n = bb_get_varname(data_desc);
-	    STRACE_INFO(("About to write on symbol <%s> value <%f> (strvalue=%s)...",n,value,strvalue));	    
+	    STRACE_INFO("About to write on symbol <%s> value <%f> (strvalue=%s)...",n,value,strvalue);	    
 			free(n);
 	    /* 
 	     * Note that we should write to genuine BB not the shadow ... 
@@ -705,13 +711,13 @@
 	                   (value_by_pgi[provider_global_index] - bb_data(shadow_bb));
 	    retcode = bb_value_direct_write(genuineBBdata,*data_desc,strvalue,0);
 	  } else {
-	    STRACE_INFO(("BB_GLU : pgi = %d is not allowed to be written",provider_global_index));
+	    STRACE_INFO("BB_GLU : pgi = %d is not allowed to be written",provider_global_index);
 	  }
 	} else {
-	  STRACE_INFO(("BB_GLU : pgi = %d is not valid provider_global_index",provider_global_index));	
+	  STRACE_INFO("BB_GLU : pgi = %d is not valid provider_global_index",provider_global_index);	
 	}
 	
-	STRACE_DEBUG(("BB_PROVIDER After AsyncWrite : value %f return :%d",*((double*)value_by_pgi[provider_global_index]), retcode));
+	STRACE_DEBUG("BB_PROVIDER After AsyncWrite : value %f return :%d",*((double*)value_by_pgi[provider_global_index]), retcode);
 
 	return retcode;
 } /* end of BB_GLU_async_sample_write */
@@ -723,14 +729,14 @@
 	int retcode = BB_NOK; 
 	void*  genuineBBdata;
 	
-	STRACE_DEBUG(("BB_PROVIDER want to AsyncRead : pgi <%d> (value_size allowed=%d)",provider_global_index,*value_size));
+	STRACE_DEBUG("BB_PROVIDER want to AsyncRead : pgi <%d> (value_size allowed=%d)",provider_global_index,*value_size);
 	
 	/* try to read */
 	if (provider_global_index>=0 && provider_global_index<nbTspSymbols) {
 			char *n;
 	    data_desc = bbdatadesc_by_pgi[provider_global_index];
 			n = bb_get_varname(data_desc);
-	    STRACE_INFO(("About to read from symbol <%s> value...",n));
+	    STRACE_INFO("About to read from symbol <%s> value...",n);
 			free(n);
 	    /* 
 	     * Note that we should read from genuine BB not the shadow ... 
@@ -743,13 +749,13 @@
 	    
 	    *((double*)value_ptr) = bb_double_of(genuineBBdata,
 						 bbdatadesc_by_pgi[provider_global_index]->type);
-	    STRACE_INFO(("AsyncRead value is <%f>.",*((double*)value_ptr)));
+	    STRACE_INFO("AsyncRead value is <%f>.",*((double*)value_ptr));
 	    retcode = BB_OK;	
 	} else {
-	  STRACE_INFO(("BB_GLU : pgi = %d is not valid provider_global_index",provider_global_index));	
+	  STRACE_INFO("BB_GLU : pgi = %d is not valid provider_global_index",provider_global_index);	
 	}
 	
-	STRACE_DEBUG(("BB_PROVIDER After AsyncRead : value %f return :%d",*((double*)value_ptr), retcode));
+	STRACE_DEBUG("BB_PROVIDER After AsyncRead : value %f return :%d",*((double*)value_ptr), retcode);
 
 	return retcode;
 } /* end of BB_GLU_async_sample_read */
diff -urN tsp_orig/src/providers/bb_provider/bb_tsp_provider_main.c tsp_modified/src/providers/bb_provider/bb_tsp_provider_main.c
--- tsp_orig/src/providers/bb_provider/bb_tsp_provider_main.c	2006-10-18 11:58:48.000000000 +0200
+++ tsp_modified/src/providers/bb_provider/bb_tsp_provider_main.c	2009-01-12 17:26:08.000000000 +0100
@@ -42,11 +42,11 @@
 #include <math.h>
 #include <signal.h>
 
-
 #include "bb_tsp_provider.h"
 #include "tsp_provider_init.h"
 #include "tsp_const_def.h"
 
+
 /**
  * @defgroup BB_TSPProvider BB TSP Provider
  * A TSP BlackBoard provider, this provider attach itself
@@ -94,52 +94,64 @@
 #include <bb_tools.h>
 
 
-int launch_bb_vx_provider (char * bb_name) 
+int launch_bb_vx_provider (char * bb_name,char *freq) 
 {
   int	argc = 2;
   char	**argv;
 
   argv = malloc(2*sizeof(char *));
-
+  
   argv[0] = strdup("launch_bb_vx_provider");
   argv[1] = bb_name;
+  argv[2] = freq;
 
   bb_simple_synchro_config(1);  /* FIXME : try to use mode PROCESS  */
-				/* 0 = BB_SIMPLE_SYNCHRO_PROCESS    */
+				/* 2 = BB_SIMPLE_SYNCHRO_PROCESS    */
 				/* 1 = BB_SIMPLE_SYNCHRO_THREAD     */
 
+
+  printf("\n");
+  printf("########################################################\n");
+  printf("######### LAUNCH VXWORKS BlackBoard Provider ###########\n");
+  printf("#########     Name : <%s> freq : <%f>        ###########\n",bb_name,atof(argv[2]));
+  printf("########################################################\n");
+   
+
   bb_tsp_provider_initialise(&argc,&argv,
-			     TSP_ASYNC_REQUEST_SIMPLE | TSP_ASYNC_REQUEST_NON_BLOCKING,
-			     argv[1],atof(argv[2]), 0);
+			     TSP_ASYNC_REQUEST_SIMPLE | TSP_ASYNC_REQUEST_NON_BLOCKING,bb_name,atof(argv[2]), 0);
+
   return 0;
 }
 
-int debug_bb(char * cmd, char * bb_name, char * sym_name, char * value)
+int debug_bb(char *cmd, char *bb_name, char *sym_name, char *value,char *valueType)
 {
+  
   bbtools_request_t  the_request;
-
+   
+  /* initialize bbtools request */
+  bbtools_init(&the_request);
 
   the_request.argv[0] = bb_name;
   the_request.verbose = 1;
   the_request.silent = 0;
-
-  /* initialize bbtools request */
-  bbtools_init(&the_request);
+  the_request.bbname = bb_name;
+ 
   the_request.theBB=bbtools_checkbbname(the_request.argv[0]);
+   
+  the_request.argc = 3;
+  the_request.argv[1] = sym_name;
+  the_request.argv[2] = value;
+  
+  if(strcmp("READ", cmd) == 0)        bbtools_read(&the_request);
+  else if(strcmp("WRITE", cmd) == 0)  bbtools_write(&the_request);
+  else if(strcmp("DUMP", cmd) == 0)   bbtools_dump(&the_request);
+  else if(strcmp("PUBLISH",cmd) == 0) {
+    the_request.argv[2]=valueType;
+    bbtools_publish(&the_request);
+  } 
+  else if(strcmp("FIND",cmd) == 0)    bbtools_find(&the_request);
+  else printf("*** NOT IMPLEMENTED ***\n");
   
-  if(strcmp("READ", cmd) == 0) {
-    the_request.argc = 2;
-    the_request.argv[1] = sym_name;
-    bbtools_read(&the_request);
-  } else if(strcmp("WRITE", cmd) == 0) {
-    the_request.argc = 3;
-    the_request.argv[1] = sym_name;
-    the_request.argv[2] = value;
-    bbtools_write(&the_request);
-  } else if(strcmp("DUMP", cmd) == 0) {
-    the_request.argc = 1;
-    bbtools_dump(&the_request);
-  }
   
   return 0;
 }
diff -urN tsp_orig/src/providers/bb_provider/CMakeLists.txt tsp_modified/src/providers/bb_provider/CMakeLists.txt
--- tsp_orig/src/providers/bb_provider/CMakeLists.txt	2006-10-18 11:58:48.000000000 +0200
+++ tsp_modified/src/providers/bb_provider/CMakeLists.txt	2009-01-12 17:26:08.000000000 +0100
@@ -1,19 +1,24 @@
 SET(_EXE tsp_bb_provider)
 SET(_LIB bb_tsp_provider)
 SET(LIB_SRC bb_tsp_provider.c) 
-SET(TSPTARGET "linux")
 
-IF(TSPTARGET STREQUAL "vxworks")
-	SET(EXE_SRC bb_vx_provider.c) 
-ELSE(TSPTARGET STREQUAL "vxworks")
-	SET(EXE_SRC bb_tsp_provider_main.c)
-ENDIF(TSPTARGET STREQUAL "vxworks")
+IF(CMAKE_SYSTEM_NAME STREQUAL "VxWorks")
+ SET(TSPTARGET "vxworks")
+ ADD_DEFINITIONS(-D_POSIX_PTHREAD_SEMANTICS)
+ENDIF(CMAKE_SYSTEM_NAME STREQUAL "VxWorks")
+
+SET(EXE_SRC bb_tsp_provider_main.c)
+
 
 ADD_EXECUTABLE(${_EXE} ${EXE_SRC})
-TSP_PROGRAM_INSTALL(${_EXE})
+IF(NOT TSPTARGET STREQUAL "vxworks")
+  TSP_PROGRAM_INSTALL(${_EXE})
+ENDIF(NOT TSPTARGET STREQUAL "vxworks")
 
 ADD_LIBRARY(${_LIB} ${LIB_SRC})
-TSP_LIBRARY_INSTALL(${_LIB})
+IF(NOT TSPTARGET STREQUAL "vxworks")
+  TSP_LIBRARY_INSTALL(${_LIB})	
+ENDIF(NOT TSPTARGET STREQUAL "vxworks")
 
 ADD_DEPENDENCIES(${_LIB} bb)
 ADD_DEPENDENCIES(${_EXE} tsp_provider)
@@ -26,7 +31,7 @@
   ${CMAKE_SOURCE_DIR}/src/util/libbb
   ${CMAKE_SOURCE_DIR}/src/providers/bb_provider)
 IF(TSPTARGET STREQUAL "vxworks")
-	#TODO: Find a way to generate the .o
+	#TODO :Find a way to generate properly the .o (Not with ADD_EXECUTABLE below)
 ELSE(TSPTARGET STREQUAL "vxworks")
 	SET(EXE_SRC bb_tsp_provider_main.c)
 	TARGET_LINK_LIBRARIES(${_EXE} bb_tsp_provider)
diff -urN tsp_orig/src/providers/CMakeLists.txt tsp_modified/src/providers/CMakeLists.txt
--- tsp_orig/src/providers/CMakeLists.txt	2006-10-18 11:58:48.000000000 +0200
+++ tsp_modified/src/providers/CMakeLists.txt	2009-01-12 17:26:08.000000000 +0100
@@ -1,17 +1,18 @@
 
-IF (NOT WIN32)
-  ADD_SUBDIRECTORY(bb_provider)
-  ADD_SUBDIRECTORY(generic_reader)
-  ADD_SUBDIRECTORY(res_reader)
-  IF (DUF_FIXME)
-    ADD_SUBDIRECTORY(rt_stub)
-  ENDIF (DUF_FIXME)
-ENDIF (NOT WIN32)
+IF(NOT BUILD_VXWORKS)
+  IF (NOT WIN32)
+      ADD_SUBDIRECTORY(bb_provider)     
+      ADD_SUBDIRECTORY(generic_reader)
+      ADD_SUBDIRECTORY(res_reader)
+      IF (DUF_FIXME)
+         ADD_SUBDIRECTORY(rt_stub)
+      ENDIF (DUF_FIXME)   
+  ENDIF (NOT WIN32)
 
 ADD_SUBDIRECTORY(stub)
 
-IF (NOT WIN32)
-  ADD_SUBDIRECTORY(vxstub)
-ENDIF (NOT WIN32)
-
-
+ELSE(NOT BUILD_VXWORKS)
+   ADD_SUBDIRECTORY(vxstub)
+   ADD_SUBDIRECTORY(bb_provider)  
+ENDIF(NOT BUILD_VXWORKS)
+ 
diff -urN tsp_orig/src/providers/generic_reader/glu_genreader.c tsp_modified/src/providers/generic_reader/glu_genreader.c
--- tsp_orig/src/providers/generic_reader/glu_genreader.c	2007-03-29 22:42:53.000000000 +0200
+++ tsp_modified/src/providers/generic_reader/glu_genreader.c	2009-01-12 17:26:08.000000000 +0100
@@ -99,7 +99,7 @@
       /*end of line no good*/
       if(END_SAMPLE_SET!=rep && item.provider_global_index>=genreader->ssi_list->TSP_sample_symbol_info_list_t_len)
       {
-	STRACE_ERROR(("ERROR: file format is not good (not enough or too much symbol or end of line no good\n"));
+	STRACE_ERROR("ERROR: file format is not good (not enough or too much symbol or end of line no good\n");
 	break;
       }
 
diff -urN tsp_orig/src/providers/generic_reader/macsim_fmt.c tsp_modified/src/providers/generic_reader/macsim_fmt.c
--- tsp_orig/src/providers/generic_reader/macsim_fmt.c	2007-03-25 16:17:06.000000000 +0200
+++ tsp_modified/src/providers/generic_reader/macsim_fmt.c	2009-01-12 17:26:08.000000000 +0100
@@ -588,7 +588,7 @@
 
   if(data_var==rep || '\0'!=*rep)
   {
-    STRACE_ERROR(("Error conversion double for <%s>\n",data_var));
+    STRACE_ERROR("Error conversion double for <%s>\n",data_var);
     return TSP_STATUS_ERROR_UNKNOWN;
   }
 
@@ -607,7 +607,7 @@
 
   if(data_var==rep || '\0'!=*rep)
   {
-    STRACE_ERROR(("Error conversion float\n"));
+    STRACE_ERROR("Error conversion float\n");
     return TSP_STATUS_ERROR_UNKNOWN;
   }
 
@@ -625,7 +625,7 @@
 
   if(data_var==rep || '\0'!=*rep)
   {
-    STRACE_ERROR(("Error conversion int8\n"));
+    STRACE_ERROR("Error conversion int8\n");
     return TSP_STATUS_ERROR_UNKNOWN;
   }
 
@@ -644,7 +644,7 @@
 
   if(data_var==rep || '\0'!=*rep)
   {
-    STRACE_ERROR(("Error conversion int16\n"));
+    STRACE_ERROR("Error conversion int16\n");
     return TSP_STATUS_ERROR_UNKNOWN;
   }
 
@@ -663,7 +663,7 @@
 
   if(data_var==rep || '\0'!=*rep)
   {
-    STRACE_ERROR(("Error conversion int32\n"));
+    STRACE_ERROR("Error conversion int32\n");
     return TSP_STATUS_ERROR_UNKNOWN;
   }
   return TSP_STATUS_OK;
@@ -681,7 +681,7 @@
 
   if(data_var==rep || '\0'!=*rep)
   {
-    STRACE_ERROR(("Error conversion int64\n"));
+    STRACE_ERROR("Error conversion int64\n");
     return TSP_STATUS_ERROR_UNKNOWN;
   }
   return TSP_STATUS_OK;
@@ -699,7 +699,7 @@
 
   if(data_var==rep || '\0'!=*rep)
   {
-    STRACE_ERROR(("Error conversion uint8\n"));
+    STRACE_ERROR("Error conversion uint8\n");
     return TSP_STATUS_ERROR_UNKNOWN;
   }
   return TSP_STATUS_OK;
@@ -717,7 +717,7 @@
 
   if(data_var==rep || '\0'!=*rep)
   {
-    STRACE_ERROR(("Error conversion uint16\n"));
+    STRACE_ERROR("Error conversion uint16\n");
     return TSP_STATUS_ERROR_UNKNOWN;
   }
   return TSP_STATUS_OK;
@@ -735,7 +735,7 @@
 
   if(data_var==rep || '\0'!=*rep)
   {
-    STRACE_ERROR(("Error conversion uint32\n"));
+    STRACE_ERROR("Error conversion uint32\n");
     return TSP_STATUS_ERROR_UNKNOWN;
   }
   return TSP_STATUS_OK;
@@ -753,7 +753,7 @@
 
   if(data_var==rep || '\0'!=*rep)
   {
-    STRACE_ERROR(("Error conversion uint64\n"));
+    STRACE_ERROR("Error conversion uint64\n");
     return TSP_STATUS_ERROR_UNKNOWN;
   }
   return TSP_STATUS_OK;
diff -urN tsp_orig/src/providers/res_reader/glue_res.c tsp_modified/src/providers/res_reader/glue_res.c
--- tsp_orig/src/providers/res_reader/glue_res.c	2006-04-24 00:28:43.000000000 +0200
+++ tsp_modified/src/providers/res_reader/glue_res.c	2009-01-12 17:26:08.000000000 +0100
@@ -90,7 +90,7 @@
     {
       if(d_read_r(obj->h_res, obj->res_values) == EOF)
 	{
-	  STRACE_DEBUG (("EOF for time=%d, val[0]=%g", obj->time_stamp, *((double*)item.raw_value)));
+	  STRACE_DEBUG ("EOF for time=%d, val[0]=%g", obj->time_stamp, *((double*)item.raw_value));
 	  if(!_wait_eof)
 	    {
 	      state = GLU_GET_EOF;
@@ -122,7 +122,7 @@
 	      TSP_datapool_push_next_item(res_GLU->datapool,&item);
 
 	      if(i==0)
-		STRACE_INFO (("New record : time=%d, val[0]=%g", obj->time_stamp, *((double*)item.raw_value)));
+		STRACE_INFO ("New record : time=%d, val[0]=%g", obj->time_stamp, *((double*)item.raw_value));
 	    }
       
 	}
@@ -161,7 +161,7 @@
       /* FIXME : quand la fonction renvera un code d'erreur, le verifier ! */
       obj->time_stamp = -1;
 
-      STRACE_INFO(("stream_init = '%s'", res_file));
+      STRACE_INFO("stream_init = '%s'", res_file);
       obj->h_res = d_ropen_r(res_file, &(obj->use_dbl));
 	 
       if( obj->h_res )
@@ -169,9 +169,9 @@
 	  obj->nbvar = d_rval_r(obj->h_res, 'v');
 	  nbrec = d_rval_r(obj->h_res, 'r');
 
-	  STRACE_INFO(("Total number of records = %d", nbrec));
-	  STRACE_INFO(("Total number of variables = %d", obj->nbvar));
-	  STRACE_INFO(("Data type = %s", obj->use_dbl ? "DOUBLE" : "FLOAT" ));
+	  STRACE_INFO("Total number of records = %d", nbrec);
+	  STRACE_INFO("Total number of variables = %d", obj->nbvar);
+	  STRACE_INFO("Data type = %s", obj->use_dbl ? "DOUBLE" : "FLOAT" );
 
 	  obj->ssiList = TSP_SSIList_new(obj->nbvar+1);
 	  assert(obj->ssiList);
@@ -211,7 +211,7 @@
 	}
       else
 	{
-	  STRACE_ERROR(("Function d_rval_r failed for file : '%s'", res_file));
+	  STRACE_ERROR("Function d_rval_r failed for file : '%s'", res_file);
 	}
 
        if(fallback_argc > GLU_RES_WAIT_EOF)
@@ -221,7 +221,7 @@
     }
   else
     {
-      STRACE_ERROR((GLU_STREAM_INIT_USAGE));
+      STRACE_ERROR(GLU_STREAM_INIT_USAGE);
       ret = FALSE;
     }
 
diff -urN tsp_orig/src/providers/stub/glue_stub.c tsp_modified/src/providers/stub/glue_stub.c
--- tsp_orig/src/providers/stub/glue_stub.c	2006-10-25 17:00:31.000000000 +0200
+++ tsp_modified/src/providers/stub/glue_stub.c	2009-01-12 17:26:08.000000000 +0100
@@ -165,7 +165,7 @@
 		*((uint8_t*)item.raw_value) = 10; /* (uint8_t)calc_func(index, my_time);*/
 		break;
 	      default:
-		STRACE_ERROR(("Unhandled TSP datatype =%d",X_sample_symbol_info_list_val[index].type));
+		STRACE_ERROR("Unhandled TSP datatype =%d",X_sample_symbol_info_list_val[index].type);
 	 
 	      }
 	      }
@@ -195,12 +195,12 @@
       my_time++;    
       
       /* print out some pseudo time for debug purpose */
-      if (!(my_time%1000))  STRACE_INFO(("TOP %d : %s=%g \t%s=%g \t%s=%g \t%s=%g", my_time,
+      if (!(my_time%1000))  STRACE_INFO("TOP %d : %s=%g \t%s=%g \t%s=%g \t%s=%g", my_time,
 					 X_sample_symbol_info_list_val[0].name, memo_val[0],
 					 X_sample_symbol_info_list_val[1].name, memo_val[1],
 					 X_sample_symbol_info_list_val[2].name, memo_val[2],
 					 X_sample_symbol_info_list_val[3].name, memo_val[3]
-					));
+					);
     }
     
   return cthis;
@@ -482,7 +482,7 @@
 
   /* Store all global indexes into list including NOT FOUND ones */
   for ( i=0 ; i < pgis_len;++i) {    
-    STRACE_DEBUG(("Getting extended info for PGI <%d>",pgis[i]));
+    STRACE_DEBUG("Getting extended info for PGI <%d>",pgis[i]);
     if(-1!=pgis[i]) {
 
       SSEI_list->TSP_sample_symbol_extended_info_list_t_val[i].provider_global_index=pgis[i]; 
diff -urN tsp_orig/src/providers/stub/server_main.c tsp_modified/src/providers/stub/server_main.c
--- tsp_orig/src/providers/stub/server_main.c	2007-03-29 22:42:53.000000000 +0200
+++ tsp_modified/src/providers/stub/server_main.c	2009-01-12 17:26:08.000000000 +0100
@@ -105,7 +105,7 @@
   /* intercept SIGINT signal */
   if ( SIG_ERR == signal(SIGINT, intrpt))
   {
-    STRACE_ERROR(("Error initialisation signal intercept function"));
+    STRACE_ERROR("Error initialisation signal intercept function");
     exit(1);
   }
 #else
diff -urN tsp_orig/src/providers/vxstub/bb_server_main.c tsp_modified/src/providers/vxstub/bb_server_main.c
--- tsp_orig/src/providers/vxstub/bb_server_main.c	2006-02-26 14:36:06.000000000 +0100
+++ tsp_modified/src/providers/vxstub/bb_server_main.c	2009-01-12 17:26:08.000000000 +0100
@@ -48,6 +48,7 @@
 #include <bb_simple.h>
 #include <bb_tools.h>
 
+#include <tsp_common_trace.h>
 
 typedef struct mytype {
   int     a;
@@ -63,6 +64,9 @@
 double *POSA_0_d_DirLun;	/* 3 elems */
 double *Sequenceur_0_d_t_s;
 
+uint64_t* ping;
+int64_t* pong;
+
 uint32_t* display_level;
 int32_t* Toto;
 double* Titi;
@@ -78,31 +82,33 @@
 
 #define BB_PUBLISH(bb_name,name,base,instance,bb_type,c_type,dim) \
   name = (c_type*) bb_simple_publish(bb_name, #name, (base), instance, bb_type, sizeof(c_type), dim); \
-  printf ("INFO : BB_PUBLISH %s[%d] type %s\n", #name, dim, #c_type); \
+  printf("INFO : BB_PUBLISH %s[%d] type %s\n", #name, dim, #c_type); \
   for (ii=0;ii<dim;++ii) { \
     name[ii] = (c_type)0; \
   }
 
-int _stub_bb_server_stop = 0;
+int stop = 0;
 
 int stub_bb_server_launch(int synchro, char * bb_name) {
-
+  
   int data_size;
   int n_data;
   mytype_t* myvar;
   char*     astring;
+   
+    
+  //Find a way to have a posix BB by default not with "p:/" in the name
 
   /* Creation BB */
   /***************/
   n_data = 1000;
   data_size = n_data*8 + 500*30*4 + 20000*8;
-  if (E_NOK==bb_create(&mybb,bb_name,n_data,data_size)) {
+  if (BB_NOK==bb_create(&mybb,bb_name,n_data,data_size)) {
     bb_attach(&mybb,bb_name);
   }
 
   /* Publish data in the BB */
   /**************************/ 
-
   display_level = (uint32_t*) bb_simple_publish(mybb,"display_level",bb_name,-1, E_BB_UINT32, sizeof(uint32_t),1);
   *display_level = 0;
   
@@ -131,6 +137,10 @@
   for (ii=0;ii<9;++ii) {
     Tata[ii] = cos(*Titi/(ii+1));
   }
+  
+  ping=(uint64_t*) bb_simple_publish(mybb,"TARTEMPION",bb_name,-1, E_BB_UINT64, sizeof(uint64_t),1);
+  pong=(int64_t*) bb_simple_publish(mybb,"TARTEMPOIL",bb_name,-1, E_BB_INT64, sizeof(int64_t),1);
+
 
 #undef HUGE_ARRAY
 #ifdef HUGE_ARRAY
@@ -161,14 +171,14 @@
   
   ii = 0;
 
-  
   sem_main_task = semBCreate (
            SEM_Q_FIFO ,      /* semaphore options */
            SEM_FULL  /* initial semaphore state */
            );
-
+  
+  printf("tick per second is %d",sysClkRateGet());
   taskSpawn (
-           "CALC_STUB",             /* name of new task (stored at pStackBase) */
+           "t_bb_simu",             /* name of new task (stored at pStackBase) */
            50,			    /* priority of new task */
            VX_FP_TASK,              /* task option word */
            4096,        /* size (bytes) of stack needed plus name */
@@ -196,18 +206,17 @@
 int bb_server_main_task(int synchro) 
 {
     double dq1, dq2, teta, d;
-
     while(1) {
-      if(_stub_bb_server_stop != 0) {
+      if(stop != 0) {
 	sysAuxClkDisable();
 	break;
       }
 
       semTake(sem_main_task, WAIT_FOREVER);
-
+     
       d = 7e6; /*km*/
       
-      *Sequenceur_0_d_t_s = *Sequenceur_0_d_t_s + 0.01; /* 10 Hz Simu */
+      *Sequenceur_0_d_t_s = *Sequenceur_0_d_t_s + 0.01; /* 100 Hz Simu */
       teta = *Sequenceur_0_d_t_s*2*3.14/100; /* 100s for a complete turn around */
       ORBT_0_d_possat_m[0] = d*cos(teta); /* simple circular orbit */
       ORBT_0_d_possat_m[1] = d*sin(teta); /* do better later */
@@ -220,8 +229,9 @@
       DYN_0_d_qsat[3] = -0.2-dq2;
       POSA_0_d_DirLun[1] = 0.4; /* e6 */
       POSA_0_d_DirSol[0] = 0.15; /* e3 */
-      *ECLA_0_d_ecl_lune = 1;
-      *ECLA_0_d_ecl_sol = 1;
+      //pour voir sur targa car les autres sont des tableaux pas encore géré avec la version disponible
+      *ECLA_0_d_ecl_lune = sin(3*teta);
+      *ECLA_0_d_ecl_sol = cos(3*teta);
       
       
       Tata[0] = sin((2.0*ii)/180.0);
@@ -241,6 +251,7 @@
 	  logMsg("Synchro GO...");
 	}
 	bb_simple_synchro_go(mybb,BB_SIMPLE_MSGID_SYNCHRO_COPY);
+
 	if (*display_level & 0x4) {
 	  logMsg("OK.\n");
 	}
diff -urN tsp_orig/src/providers/vxstub/CMakeLists.txt tsp_modified/src/providers/vxstub/CMakeLists.txt
--- tsp_orig/src/providers/vxstub/CMakeLists.txt	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/providers/vxstub/CMakeLists.txt	2009-01-12 17:26:08.000000000 +0100
@@ -0,0 +1,3 @@
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/util/libbb)
+#find a way to generate PROPERLY the .o
+ADD_EXECUTABLE(tsp_vxstub  glue_stub.c server_main.c bb_server_main.c)
\ No newline at end of file
diff -urN tsp_orig/src/providers/vxstub/glue_stub.c tsp_modified/src/providers/vxstub/glue_stub.c
--- tsp_orig/src/providers/vxstub/glue_stub.c	2006-02-26 14:36:06.000000000 +0100
+++ tsp_modified/src/providers/vxstub/glue_stub.c	2009-01-12 17:26:08.000000000 +0100
@@ -41,12 +41,13 @@
 #include <stdio.h>
 #include <assert.h>
 
-#include "tsp_sys_headers.h"
+#include <tsp_sys_headers.h>
 #include <tsp_glu.h>
-#include "tsp_ringbuf.h"
-#include "tsp_time.h"
-#include "tsp_datapool.h"
-#include "calc_func.h"
+#include <tsp_ringbuf.h>
+#include <tsp_time.h>
+#include <tsp_datapool.h>
+#include <calc_func.h>
+#include <tsp_common.h>
 
 /* TSP glue server defines */
 #define TSP_STUB_FREQ 100 /*Hz*/
@@ -57,6 +58,8 @@
 /* Nasty static variables */
 static TSP_sample_symbol_info_t *X_sample_symbol_info_list_val;
 static time_stamp_t my_time = 0;
+static GLU_handle_t* stub_GLU = NULL;
+static int32_t taille_max_symbol=0;
 
 /* protypes declarations */
 int  STUB_GLU_get_symbol_number(void) ;
@@ -75,17 +78,22 @@
   return i;
 }
 
-void* STUB_GLU_thread(GLU_handle_t* arg)
+void* STUB_GLU_thread(void* arg)
 {
   
-  int i, symbols_nb, *ptr_index;
+  int i, index,symbols_nb, *ptr_index;
   tsp_hrtime_t current_time, next_time;
   unsigned long tickNow;
   glu_item_t item;
   double memo_val[GLU_MAX_SYMBOLS]; /* for building calc_function % 10 */
-
+  GLU_handle_t* cthis  = (GLU_handle_t*) arg;
   symbols_nb  = STUB_GLU_get_symbol_number();
   current_time = tsp_gethrtime();
+  
+
+  item.raw_value=calloc(1,taille_max_symbol);
+  assert(item.raw_value);
+
 
   /* infinite loop for symbols generation */
   while(1)
@@ -96,45 +104,50 @@
 	{ 
 	  taskDelay(1);
 	}
- 
+      
       /* Must be call at each step in case of new samples wanted */
-      TSP_datapool_get_reverse_list (&symbols_nb, &ptr_index); 
+      TSP_datapool_get_reverse_list (cthis->datapool,&symbols_nb, &ptr_index); 
       for(i = 0 ; i < symbols_nb ; i++)
-	{
-          int index=ptr_index[i];
+	{  
+          index=ptr_index[i];
 	  if(my_time%X_sample_symbol_info_list_val[i].period == 0)
-	    {
+	    { 
+
+              item.size = X_sample_symbol_info_list_val[index].dimension * tsp_type_size[X_sample_symbol_info_list_val[index].type];
 	      item.time = my_time;
 	      item.provider_global_index = index;
 	      if (index!=0)
-		item.value = calc_func(index, my_time);
+		*((double*)item.raw_value) = calc_func(index, my_time);
 	      else
-		item.value = (double)(my_time) / (double)(TSP_STUB_FREQ);
-	      memo_val[index]=item.value;
+		*((double*)item.raw_value) = (double)(my_time) / (double)(TSP_STUB_FREQ);
+	      memo_val[index]=*((double*)item.raw_value);
 
-              TSP_datapool_push_next_item(&item);
+              TSP_datapool_push_next_item(cthis->datapool,&item);
 	    }
 	}
+
       /* Finalize the datapool state with new time : Ready to send */
-      TSP_datapool_push_commit(my_time, GLU_GET_NEW_ITEM);
-      
+      TSP_datapool_push_commit(cthis->datapool,my_time, GLU_GET_NEW_ITEM);
 
-      if (!(my_time%1000))  STRACE_INFO(("TOP %d : %s=%g \t%s=%g \t%s=%g \t%s=%g", my_time,
+      my_time++;
+
+      /*      if (!(my_time%1000))  STRACE_INFO("TOP %d : %s=%g \t%s=%g \t%s=%g \t%s=%g", my_time,
 					 X_sample_symbol_info_list_val[0].name, memo_val[0],
 					 X_sample_symbol_info_list_val[1].name, memo_val[1],
 					 X_sample_symbol_info_list_val[2].name, memo_val[2],
 					 X_sample_symbol_info_list_val[3].name, memo_val[3]
-					));
-      my_time++;    
+					 );*/
+          
     }
     
-  return arg;
+  return cthis;
 
 }
 
 int STUB_GLU_init(GLU_handle_t* this, int fallback_argc, char* fallback_argv[])
 {
   int i;
+  int32_t size;
   char symbol_buf[50];
   
   X_sample_symbol_info_list_val = calloc (GLU_MAX_SYMBOLS+1, sizeof (TSP_sample_symbol_info_t)) ;
@@ -146,8 +159,18 @@
       X_sample_symbol_info_list_val[i].name = strdup(symbol_buf);
       X_sample_symbol_info_list_val[i].provider_global_index = i;
       X_sample_symbol_info_list_val[i].period = 1;
+      X_sample_symbol_info_list_val[i].type=TSP_TYPE_DOUBLE;
+      X_sample_symbol_info_list_val[i].dimension=1;
+
+      size=X_sample_symbol_info_list_val[i].dimension * tsp_type_size[X_sample_symbol_info_list_val[i].type];
+
+       if (taille_max_symbol< size)
+      {
+	taille_max_symbol= size;
+      }
     }  
-  /*overide first name*/
+  
+  /*override first name*/
   X_sample_symbol_info_list_val[0].name = strdup("t");
 	
   return TRUE;
@@ -163,34 +186,38 @@
     {
       i++;
     }
-
+  
   symbol_list->TSP_sample_symbol_info_list_t_len = i;
   symbol_list->TSP_sample_symbol_info_list_t_val = X_sample_symbol_info_list_val;
 	    
   return TRUE;
 }
 
-int STUB_GLU_start(GLU_handle_t* this)
-{  /* At first consumer connection : start thread */
-  if(!this->tid)
-    {
-      TSP_CHECK_THREAD( (pthread_create(&(this->tid), NULL, GLU_thread, NULL)), FALSE);
-    }
-  return ((this->tid) != 0);
+int32_t STUB_GLU_start(GLU_handle_t* this)
+{ 
+  // At first consumer connection : start thread 
+   if(!this->tid)
+   { 
+      return pthread_create(&(this->tid), NULL, STUB_GLU_thread, this);
+   }
+   else 
+      return 0;
 }
 
 /* create the GLU handle instance for STUB */
 GLU_handle_t* GLU_stub_create() {
   
   /* create a default GLU */
+
   GLU_handle_create(&stub_GLU,"StubbedServer",GLU_SERVER_TYPE_ACTIVE,TSP_STUB_FREQ);
   
-  stub_GLU->initialize     = &STUB_GLU_init;
-  stub_GLU->run            = &STUB_GLU_thread;
-  stub_GLU->get_ssi_list   = &STUB_GLU_get_sample_symbol_info_list;
+  stub_GLU->initialize     = (GLU_init_ft)&STUB_GLU_init;
+  stub_GLU->run            = (GLU_run_ft)&STUB_GLU_thread;
+  stub_GLU->get_ssi_list   = (GLU_get_ssi_list_ft)&STUB_GLU_get_sample_symbol_info_list;
   /* ovveride default method */
-  stub_GLU->start          = &STUB_GLU_start;
+  
+   stub_GLU->start          = (GLU_start_ft)&STUB_GLU_start;
 
   return stub_GLU;
-}
+ }
 
diff -urN tsp_orig/src/providers/vxstub/server_main.c tsp_modified/src/providers/vxstub/server_main.c
--- tsp_orig/src/providers/vxstub/server_main.c	2006-04-24 23:05:34.000000000 +0200
+++ tsp_modified/src/providers/vxstub/server_main.c	2009-01-12 17:26:08.000000000 +0100
@@ -1,3 +1,4 @@
+
 /*
 
 $Id: server_main.c,v 1.4 2006/04/24 21:05:34 erk Exp $
@@ -36,35 +37,112 @@
 
 -----------------------------------------------------------------------
 */
+
 #include <stdio.h>
-#include "tsp_provider_init.h"
-#include "tsp_sys_headers.h"
+#include <signal.h>
 
-GLU_handle_t* GLU_stub_create();
- 
-int TSP_launcher () 
+#include <tsp_provider_init.h>
+#include <tsp_sys_headers.h>
+#include <tsp_glu.h>
+#include <envLib.h>
+
+SEM_ID sem_main_task;
+int run;
+
+
+int stub_server_handler(void) ;
+int stub_task() ;
+int TSP_stub_stop();
+
+int TSP_launcher()
+{
+  sem_main_task = semBCreate (
+           SEM_Q_FIFO ,      /* semaphore options */
+           SEM_FULL  /* initial semaphore state */
+           );
+
+  run=1;
+    taskSpawn (
+      "tStubServer",             /* name of new task (stored at pStackBase) */
+      50,			    /* priority of new task */
+      VX_FP_TASK,              /* task option word */
+      4096,        /* size (bytes) of stack needed plus name */
+      stub_task,          /* entry point of new task */
+      0,             /* 1st of 10 req'd task args to pass to func */
+      0, 0, 0, 0, 0, 0, 0, 0, 0
+      );
+
+   sysAuxClkDisable();
+   sysAuxClkConnect(stub_server_handler, 1);
+   sysAuxClkEnable();
+  
+  return 0;
+
+
+}
+
+int stub_server_handler()
+{
+  semGive(sem_main_task);
+
+  return 0; 
+
+}
+
+
+int stub_task () 
 {
+ 
+
 int argc = 1 ;
+
 char **argv;
-char *tableau[] ={"TSP_launcher"} ;
-	argv=tableau ;
+
+char *tableau[] ={"stub_task"} ;
+
+GLU_handle_t* GLU_stub;
+
+argv=tableau ;
+
+semTake(sem_main_task, WAIT_FOREVER);
+
+ printf ("\n");
   printf ("#===================================================================#\n");
   printf ("# Launching <StubbedServer> for generation of 1000 Symbols at 100Hz    #\n");
   printf ("#===================================================================#\n");
 
-  GLU_handle_t* GLU_stub = GLU_stub_create();
+  GLU_stub=(GLU_handle_t*)GLU_stub_create() ;
+
   /* Init server */
   if (TSP_STATUS_OK==TSP_provider_init(GLU_stub,&argc, &argv)) {
     if (TSP_STATUS_OK!=TSP_provider_run(TSP_ASYNC_REQUEST_SIMPLE | TSP_ASYNC_REQUEST_NON_BLOCKING)) {
       return (int)-1;
     }
+    /* print out TSP URL */
+    TSP_provider_urls(TSP_PUBLISH_URLS_PRINT | TSP_PUBLISH_URLS_FILE);
+
+      while(run!=0){
+         
+	taskDelay(5*sysAuxClkRateGet());
+       }
+      sysAuxClkDisable();
+     
+       TSP_provider_end();
+       logMsg("#=== End ===#\n");
+
+          
   }
   return (int)0 ;
 }
-   
+
+int TSP_stub_stop()
+{
+  run=0; 
+  return (int)0;
+}
 void smallTester (int *arg) ;
 void smallTester (int *arg) 
-{
+{ 
 logMsg ("My id is : %0X arg = %0X\n",pthread_self(),*arg,0,0,0,0) ;
 
 }
@@ -80,3 +158,6 @@
 logMsg ("My son is %0X\n",newThread,0,0,0,0,0) ;
 
 }
+
+
+
diff -urN tsp_orig/src/util/CMakeLists.txt tsp_modified/src/util/CMakeLists.txt
--- tsp_orig/src/util/CMakeLists.txt	2007-01-29 20:40:38.000000000 +0100
+++ tsp_modified/src/util/CMakeLists.txt	2009-01-12 17:26:09.000000000 +0100
@@ -1,16 +1,17 @@
 
-IF (XML2_FOUND AND NOT WIN32)
+IF (XML2_FOUND AND NOT WIN32 AND NOT BUILD_VXWORKS)
   ADD_SUBDIRECTORY(libpages)
   ADD_SUBDIRECTORY(libtspcfg)
-ENDIF (XML2_FOUND AND NOT WIN32)
+ENDIF (XML2_FOUND AND NOT WIN32 AND NOT BUILD_VXWORKS)
 
-IF (NOT WIN32)
+
+IF (NOT WIN32 AND NOT BUILD_VXWORKS)
   ADD_SUBDIRECTORY(libutil)
   ADD_SUBDIRECTORY(libres)
-ENDIF (NOT WIN32)
+ENDIF (NOT WIN32 AND NOT BUILD_VXWORKS)
 
 ADD_SUBDIRECTORY(libcalc)
 
-IF (NOT WIN32)
-  ADD_SUBDIRECTORY(libbb)
-ENDIF (NOT WIN32)
+IF(NOT WIN32)
+   ADD_SUBDIRECTORY(libbb)
+ENDIF(NOT WIN32)
diff -urN tsp_orig/src/util/libbb/bb_alias.c tsp_modified/src/util/libbb/bb_alias.c
--- tsp_orig/src/util/libbb/bb_alias.c	2007-04-01 15:17:21.000000000 +0200
+++ tsp_modified/src/util/libbb/bb_alias.c	2009-01-12 17:26:09.000000000 +0100
@@ -1,6 +1,6 @@
 /*
   
-$Header: /sources/tsp/tsp/src/util/libbb/bb_alias.c,v 1.7 2007/04/01 13:17:21 deweerdt Exp $
+$Header: /sources/tsp/tsp/src/util/libbb/bb_alias.c,v 1.8 2008/03/24 23:56:21 deweerdt Exp $
 
 -----------------------------------------------------------------------
 
@@ -40,7 +40,9 @@
 #include <string.h>
 #include <stdlib.h>
 #include <sys/types.h>
-#include <sys/mman.h>
+#if !defined(__rtems__)
+#  include <sys/mman.h>
+#endif
 #include <unistd.h>
 #include <assert.h>
 
@@ -141,8 +143,7 @@
     if (bb->n_data >= bb->max_data_desc_size) {
       bb_logMsg(BB_LOG_SEVERE,"BlackBoard::bb_alias_publish", 
 		"No more room in BB data descriptor!! [current n_data=%d]",
-		bb->n_data);
-         
+		bb->n_data);         
     } 
     else {
       char *n;
diff -urN tsp_orig/src/util/libbb/bb_alias.h tsp_modified/src/util/libbb/bb_alias.h
--- tsp_orig/src/util/libbb/bb_alias.h	2006-12-07 22:25:21.000000000 +0100
+++ tsp_modified/src/util/libbb/bb_alias.h	2009-01-12 17:26:09.000000000 +0100
@@ -1,6 +1,6 @@
 /*
 
-$Header: /sources/tsp/tsp/src/util/libbb/bb_alias.h,v 1.5 2006/12/07 21:25:21 erk Exp $
+$Header: /sources/tsp/tsp/src/util/libbb/bb_alias.h,v 1.6 2007/07/24 23:30:12 erk Exp $
 
 -----------------------------------------------------------------------
 
@@ -64,10 +64,10 @@
  * @defgroup BBAliasLib The BB Alias System
  * The BB alias system is a part of the BlackBoard library
  * which enable a special publish interface called
- * @ref bb_alias_publish. When publishing alias, one does not
+ * ::bb_alias_publish. When publishing alias, one does not
  * allocate new data in the BlackBoard but only define aliases
  * on already published data. Using alias publish one may publish
- * user define type/structure (see @ref E_BB_USER) and then 
+ * user define type/structure (see #E_BB_USER) and then 
  * describe the elements of the published structure.
  * A <em> normal </em> publish is called a <em>genuine</em>
  * publish which is opposed to an <em> alias publish </em>.
@@ -88,7 +88,7 @@
 
 /**
  * Build up an alias stack.
- * An alias stack is a sequence of @ref S_BB_DATADESC_T
+ * An alias stack is a sequence of #S_BB_DATADESC_T
  * describing the way to go from an alias to a genuine
  * published symbol.
  * @param[in] bb the BlackBoard
diff -urN tsp_orig/src/util/libbb/bb_callback.c tsp_modified/src/util/libbb/bb_callback.c
--- tsp_orig/src/util/libbb/bb_callback.c	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/bb_callback.c	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1,276 @@
+/*
+
+$Header: /sources/tsp/tsp/src/util/libbb/bb_callback.c,v 1.6 2008/07/23 15:18:06 jaggy Exp $
+
+-----------------------------------------------------------------------
+
+BlackBoard Library - Implementation of the subscribe/unsubscribe
+callback on messages receiving
+
+Copyright (c) 2008 Jerome ARBEZ-GINDRE
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+-----------------------------------------------------------------------
+
+Project   : TSP
+Maintainer : tsp@astrium-space.com
+Component : Blackboard
+
+-----------------------------------------------------------------------
+
+Purpose   : BlackBoard Message Callback implementation
+
+-----------------------------------------------------------------------
+ */
+
+#include "bb_core.h"
+#include "bb_local.h"
+#include "bb_callback.h"
+
+#define MOD_NAME "BB_CALLBACK"
+
+#ifdef __KERNEL__
+#include "bb_core_k.h"
+#include <linux/connector.h>
+#else /* __KERNEL__ */
+#include <pthread.h>
+
+#endif
+
+struct S_BB_SUBSCRIBE {
+	struct S_BB_MSG msg;
+	void (*callback)(struct S_BB *bb, void *context, struct S_BB_MSG *msg);
+	void *context;
+	struct S_BB *bb;
+	struct S_BB_SUBSCRIBE *next;
+
+#ifndef __KERNEL__
+	pthread_t thread;
+#endif /* __KERNEL__ */
+};
+
+
+#ifdef __KERNEL__
+static void bb_cn_callback (void *);
+#else /* __KERNEL__ */
+static void *thread_routine(void * arg);
+#endif /* __KERNEL__ */
+
+int32_t bb_msg_subscribe(struct S_BB *bb, void *context,
+			 const struct S_BB_MSG *msg,
+			 void (*callback)(struct S_BB *bb, void *context,
+					  struct S_BB_MSG *msg))
+{
+	struct S_BB_SUBSCRIBE **last_subscribe;
+	struct S_BB_LOCAL *local = bb_get_local(bb);
+
+	/* mtype si stored on the NBIT_FOR_MTYPE LSB bits of cb_id.val */
+	if (msg->mtype > MTYPE_MASK)
+		goto err;
+
+	if (!local)
+		goto err;
+
+	/* find the end of the list (or already subscribed msg)*/
+	for (last_subscribe = &local->subscribed;
+	     (*last_subscribe) !=  NULL &&
+		     (*last_subscribe)->msg.mtype != msg->mtype;
+	     last_subscribe = &(*last_subscribe)->next);
+
+	/* mtype already subscribed*/
+	if (*last_subscribe !=  NULL)
+		goto err;
+
+	*last_subscribe = malloc (sizeof(**last_subscribe));
+	if (*last_subscribe == NULL)
+		goto err;
+
+	(*last_subscribe)->next = NULL;
+	(*last_subscribe)->msg.mtype = msg->mtype;
+	(*last_subscribe)->callback = callback;
+	(*last_subscribe)->context = context;
+	(*last_subscribe)->bb = bb;
+
+#ifdef __KERNEL__
+	{
+		int ret;
+		struct cb_id cb_id = {
+			.idx = CN_IDX_BB,
+			.val = MTYPE_INDEX_2_VAL((*last_subscribe)->msg.mtype,
+						 bb->priv.k.index)
+		};
+		char cn_name[128];
+		snprintf(cn_name, sizeof(cn_name), "%s_%d",
+			 bb->name, cb_id.idx);
+		cn_name[sizeof(cn_name)-1] = '\0';
+		ret = cn_add_callback(&cb_id, cn_name, bb_cn_callback);
+		if ( ret != 0) {
+			printk("cn_add_callback failed ret %d\n",ret);
+			goto err_free_mem;
+		}
+	}
+#else /* __KERNEL__ */
+	if (pthread_create(&(*last_subscribe)->thread, NULL,
+			   thread_routine, (*last_subscribe)) != 0) {
+		goto err_free_mem;
+	}
+#endif /* __KERNEL__ */
+
+	return BB_OK;
+
+err_free_mem:
+	free (*last_subscribe);
+	*last_subscribe = NULL;
+err:
+	return BB_NOK;
+}
+#ifdef __KERNEL__
+EXPORT_SYMBOL_GPL(bb_msg_subscribe);
+#endif /* __KERNEL__ */
+
+#ifdef __KERNEL__
+static void bb_cn_callback(void *arg)
+{
+	struct cn_msg *cn_msg = arg;
+	struct S_BB *bb = present_bbs[VAL_2_INDEX(cn_msg->id.val)];
+	struct S_BB_LOCAL *local = bb_get_local(bb);
+	struct S_BB_SUBSCRIBE *subscribe;
+
+	for (subscribe = local->subscribed;
+	     subscribe !=  NULL &&
+		     subscribe->msg.mtype != VAL_2_MTYPE(cn_msg->id.val);
+	     subscribe = subscribe->next);
+
+	if (subscribe == NULL) {
+		printk("subscribed FAILED !! mtype (%d) bb (%s) val (0x%08x) index (%d)\n",
+		       VAL_2_MTYPE(cn_msg->id.val), bb->name,
+		       cn_msg->id.val, VAL_2_INDEX(cn_msg->id.val));
+		return;
+	}
+
+	if (cn_msg->len > MAX_SYSMSG_SIZE) {
+		printk("connector messsage too long (%d)\n", cn_msg->len);
+		return;
+	}
+
+	memcpy(subscribe->msg.mtext, cn_msg->data, cn_msg->len);
+
+	subscribe->callback(subscribe->bb, subscribe->context,
+			    &subscribe->msg);
+}
+
+#else /* __KERNEL__ */
+static void * thread_routine(void *arg)
+{
+	struct S_BB_SUBSCRIBE * subscribe = (struct S_BB_SUBSCRIBE *) arg;
+	int retcode;
+
+	retcode = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+	if (retcode != 0) {
+		bb_logMsg(BB_LOG_WARNING, MOD_NAME,
+			  "pthread_setcanceltype failed (retcode %d)",
+			  retcode);
+		return NULL;
+	} ;
+
+	while (1) {
+		if (bb_rcv_msg(subscribe->bb,
+			       &subscribe->msg) == BB_NOK) {
+			bb_logMsg(BB_LOG_WARNING, MOD_NAME,
+				  "bb_rcv_msg failed -> thread stoped\n");
+			return NULL;
+		}
+		subscribe->callback(subscribe->bb, subscribe->context,
+				    &subscribe->msg);
+	}
+}
+#endif /* __KERNEL__ */
+
+int32_t bb_msg_unsubscribe(struct S_BB *bb, const struct S_BB_MSG *msg)
+{
+	struct S_BB_SUBSCRIBE **previous_subscribe;
+	struct S_BB_SUBSCRIBE *elem;
+	struct S_BB_LOCAL *local = bb_get_local(bb);
+
+	/* mtype si stored on the NBIT_FOR_MTYPE LSB bits of cb_id.val */
+	if (msg->mtype > MTYPE_MASK)
+		return BB_NOK;
+
+	if (!local)
+		return BB_NOK;
+
+	/* find the end of the list (or subscribed msg)*/
+	for (previous_subscribe = &local->subscribed;
+	     (*previous_subscribe) !=  NULL &&
+		     (*previous_subscribe)->msg.mtype != msg->mtype;
+	     previous_subscribe = &(*previous_subscribe)->next);
+
+	/* not found ? */
+	if ((*previous_subscribe) ==  NULL)
+		return BB_NOK;
+
+#ifdef __KERNEL__
+	{
+		struct cb_id cb_id = {
+			.idx = CN_IDX_BB,
+			.val = MTYPE_INDEX_2_VAL((*previous_subscribe)->msg.mtype,
+						 bb->priv.k.index)
+		};
+		cn_del_callback(&cb_id);
+	}
+#else /* __KERNEL__ */
+	pthread_cancel((*previous_subscribe)->thread);
+	pthread_join((*previous_subscribe)->thread, NULL);
+#endif /* __KERNEL__ */
+
+	elem = *previous_subscribe;
+	(*previous_subscribe) = (*previous_subscribe)->next;
+	free(elem);
+
+	return BB_OK;
+}
+#ifdef __KERNEL__
+EXPORT_SYMBOL_GPL(bb_msg_unsubscribe);
+#endif /* __KERNEL__ */
+
+
+int32_t bb_msg_unsubscribe_all(struct S_BB *bb)
+{
+	struct S_BB_SUBSCRIBE *subscribe;
+	struct S_BB_SUBSCRIBE *next;
+	struct S_BB_LOCAL *local = bb_get_local(bb);
+
+	if (!local)
+		return BB_NOK;
+
+	/* find the end of the list (or subscribed msg)*/
+	for (subscribe = local->subscribed;
+	     subscribe != NULL;
+	     subscribe = next) {
+		/* we are calculating the next now... because
+		   subscribe will not exist any more after the call to
+		   bb_msg_unsubscribe */
+		next = subscribe->next;
+		bb_msg_unsubscribe (bb, &subscribe->msg);
+	}
+
+	return BB_OK;
+}
+#ifdef __KERNEL__
+EXPORT_SYMBOL_GPL(bb_msg_unsubscribe_all);
+#endif /* __KERNEL__ */
+
+
diff -urN tsp_orig/src/util/libbb/bb_callback.h tsp_modified/src/util/libbb/bb_callback.h
--- tsp_orig/src/util/libbb/bb_callback.h	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/bb_callback.h	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1,96 @@
+/*
+
+$Header: /sources/tsp/tsp/src/util/libbb/bb_callback.h,v 1.2 2008/07/21 12:02:27 jaggy Exp $
+
+-----------------------------------------------------------------------
+
+BlackBoard Library - API to subscribe/unsubscribe callback on messages
+receiving
+
+Copyright (c) 2008 Jerome ARBEZ-GINDRE
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+-----------------------------------------------------------------------
+
+Project   : TSP
+Maintainer : tsp@astrium-space.com
+Component : Blackboard
+
+-----------------------------------------------------------------------
+
+Purpose   : BlackBoard Message Callback implementation
+
+-----------------------------------------------------------------------
+ */
+
+#ifndef _BB_CALLBACK_H_
+#define _BB_CALLBACK_H_
+
+#ifdef __KERNEL__
+
+#include <linux/types.h>
+
+#else /* __KERNEL__ */
+
+#include <inttypes.h>
+
+#endif /* __KERNEL__ */
+
+struct S_BB;
+struct S_BB_MSG;
+
+/**
+ * Launch a thread which waits in endless loop for a message on the BB
+ * message queue, and then calls the callback.
+ *
+ * @param[in,out] bb  pointer to BB.
+ * @param[in,out] msg  the message to be subcribed on.
+ *                  The type of the message to be received should be
+ *                  be specified on entry in the message structure
+ *                  msg->mtype.
+ * @param[in,out] callback The callback wich will be called each time
+ *                   the message is received.
+ * @return BB_OK on success, BB_NOK otherwise
+ */
+int32_t bb_msg_subscribe(struct S_BB *bb, void *context,
+			 const struct S_BB_MSG *msg,
+			 void (*callback)(struct S_BB *bb, void *context,
+					  struct S_BB_MSG *msg));
+
+/**
+ * Stops the thread which is waiting for a message on the BB message
+ * queue.
+ *
+ * @param[in,out] bb  pointer to BB.
+ * @param[in,out] msg  the message to be subcribed on.
+ *                  The type of the message to be received should be
+ *                  be specified on entry in the message structure
+ *                  msg->mtype.
+ * @return BB_OK on success, BB_NOK otherwise
+ */
+int32_t bb_msg_unsubscribe(struct S_BB *bb, const struct S_BB_MSG *msg);
+
+/**
+ * unsubscribe to all subscribed msg
+ * queue.
+ *
+ * @param[in,out] bb  pointer to BB.
+ * @return BB_OK on success, BB_NOK otherwise
+ */
+int32_t bb_msg_unsubscribe_all(struct S_BB *bb);
+
+
+#endif /* _BB_CALLBACK_H_ */
diff -urN tsp_orig/src/util/libbb/bb_core.c tsp_modified/src/util/libbb/bb_core.c
--- tsp_orig/src/util/libbb/bb_core.c	2007-04-01 15:17:21.000000000 +0200
+++ tsp_modified/src/util/libbb/bb_core.c	2009-01-12 17:26:09.000000000 +0100
@@ -1,6 +1,7 @@
+
 /*
 
-$Header: /sources/tsp/tsp/src/util/libbb/bb_core.c,v 1.40 2007/04/01 13:17:21 deweerdt Exp $
+$Header: /sources/tsp/tsp/src/util/libbb/bb_core.c,v 1.59 2008/07/24 13:27:33 jaggy Exp $
 
 -----------------------------------------------------------------------
 
@@ -39,28 +40,68 @@
 #include <string.h>
 #include <stdlib.h>
 #include <sys/types.h>
-#include <sys/mman.h>
 #include <fcntl.h>
+#ifdef VXWORKS
+#include <vxTypesOld.h>
+#endif
 #include <sys/stat.h>
 #include <errno.h>
 #include <unistd.h>
 #include <assert.h>
 #include <ctype.h>
-#include <dlfcn.h>
+#if !defined(__rtems__) && !defined(VXWORKS)
+#  include <dlfcn.h>
+#  include <sys/mman.h>
+#endif
 #ifndef RTLD_DEFAULT
 #define RTLD_DEFAULT (void *)0
 #endif
 
 #include <tsp_abs_types.h>
-#include <tsp_abs_types.h>
 #include <tsp_sys_headers.h>
-#include <tsp_simple_trace.h>
+
+#include <tsp_common_trace.h>
 
 #endif /* __KERNEL__ */
 
 #include "bb_alias.h"
 #include "bb_utils.h"
 #include "bb_core.h"
+#include "bb_local.h"
+
+
+/*Macro to handle memory alignment in BB_publish:
+BB_ALIGN=0  --> let the system do his work
+BB_ALIGN=-1 --> align on the needed size of the data
+Other --> align on BB_ALIGN value 
+*/
+#ifndef BB_ALIGN
+#define MEM_ALIGN(addr,needed_size,offset) offset=0;
+#else  
+#define MEM_ALIGN(addr,needed_size,offset)\
+ if(needed_size==1){\
+     offset=0;}\
+ else{\
+   if(BB_ALIGN!=0){ \
+     int space;\
+     if(BB_ALIGN==-1){\
+        offset=(needed_size - ((int)addr & (needed_size-1))) % needed_size;\
+     }\
+     else{\
+       space=(int)addr & (BB_ALIGN-1);\
+       if(needed_size <= space) \
+          offset=0;\
+       if(needed_size > space)\
+	  offset=space;\
+    }\
+  }\
+ }
+#endif
+
+/* uintptr_t doesn't exist in VXWORKS, replaced by his equivalent uint16_t  */
+#ifdef VXWORKS
+#define uintptr_t uint16_t
+#endif
 
 /**
  * Convert type to string for display use.
@@ -84,13 +125,13 @@
 #endif
 
 static const size_t E_BB_TYPE_SIZE[] = {0,
-			#ifndef __KERNEL__
+/* #ifndef __KERNEL__ */
 					sizeof(double),
 					sizeof(float),
-      #else
-          0,
-          0,
-			#endif
+/* #else */
+/*					0, */
+/*					0, */
+/* #endif */
 					sizeof(int8_t),
 					sizeof(int16_t),
 					sizeof(int32_t),
@@ -104,25 +145,42 @@
 					0,
 					0};
 
-#ifdef __KERNEL__
 /* In case we're compiling kernel code, there's really no need
-   for the sysv code */
-static struct bb_operations sysv_bb_ops;
-extern struct bb_operations k_bb_ops;
-#else
+   for the sysv or posix code */
+#ifndef __KERNEL__
+
 extern struct bb_operations sysv_bb_ops;
-#if defined(linux) || defined(__linux)
-extern struct bb_operations k_bb_ops;
-#endif
+
+#if defined(USE_POSIX_BB)
+extern struct bb_operations posix_bb_ops;
 #endif
 
+#endif /*! __KERNEL__*/
+
+#if	   (defined(linux) || defined(__linux))				\
+	&& (defined (CONNECTOR_AVAILABLE) || defined (__KERNEL__))
+extern struct bb_operations k_bb_ops;
+#endif /* linux */
+
 /* Note: This is thigtly related to enum bb_type in bb_core.h,
    if you ever modify this, you'll probably need to modify
    enum bb_type */
 static struct bb_operations *ops[] = {
+#if !defined(__rtems__) && !defined(VXWORKS) && !defined (__KERNEL__)
 	&sysv_bb_ops
-#if defined(linux) || defined(__linux)
+#else
+	NULL
+#endif
+#if	   (defined(linux) || defined(__linux))				\
+	&& (defined (CONNECTOR_AVAILABLE) || defined (__KERNEL__))
 	,&k_bb_ops
+#else
+	,NULL
+#endif /* linux */
+#if defined(USE_POSIX_BB) && !defined (__KERNEL__)
+	,&posix_bb_ops
+#else
+	,NULL
 #endif
 };
 
@@ -130,18 +188,23 @@
 {
 #ifdef __KERNEL__
 	return BB_KERNEL;
-#else
+#endif /* __KERNEL__ */
+
 	if (!strncmp(name, "/dev/", 5))
 		return BB_KERNEL;
-
+	//Patch to be sure to have Posix BB whatever BB name is.
+#ifdef VXWORKS
+	return BB_POSIX;
+#endif
+	if (!strncmp(name, "p:/", 3)) {
+		return BB_POSIX;
+	}
 	return BB_SYSV;
-#endif /* __KERNEL__ */
 }
 
-size_t 
-sizeof_bb_type(E_BB_TYPE_T bb_type) {
+size_t sizeof_bb_type(E_BB_TYPE_T bb_type) {
   size_t retval = 0;
-  if ((bb_type>=1) && (bb_type<E_BB_USER)) {
+  if ((bb_type >= 1) && (bb_type < E_BB_USER)) {
     retval = E_BB_TYPE_SIZE[bb_type];
   }
   return retval;
@@ -225,7 +288,7 @@
 bb_set_varname_fn bb_set_varname = bb_set_varname_default;
 bb_varname_max_len_fn bb_varname_max_len = bb_varname_max_len_default;
 
-#ifndef __KERNEL__
+#if !defined (__KERNEL__)  && !defined (__rtems__) && !defined(VXWORKS) 
 static int32_t
 bb_varname_init(S_BB_T *bb)
 {
@@ -534,9 +597,9 @@
       break;
     case E_BB_USER:
       if (NULL == default_value) {
-				memset(data + (data_desc->type)*i,0,data_desc->type_size);
+				memset(data + (data_desc->type_size)*i,0,data_desc->type_size);
       } else {
-				memcpy(data + (data_desc->type)*i,default_value,data_desc->type_size);
+				memcpy(data + (data_desc->type_size)*i,default_value,data_desc->type_size);
       }
       break; 
     default:
@@ -563,14 +626,12 @@
   retval = BB_OK;
 
   switch (data_desc.type) {
-#ifndef __KERNEL__
   case E_BB_DOUBLE: 
     ((double *)data)[0] = atof(value);
     break;
   case E_BB_FLOAT:
     ((float *)data)[0] = atof(value);
     break;
-#endif
   case E_BB_INT8:
     ((int8_t*)data)[0] = strtol(value,(char **)NULL,hexval ? 16 : 10);
     break; 
@@ -626,18 +687,12 @@
   char* data;
   int retval;
   int hexval;
-  int lenval;
   assert(bb);
   
   retval = BB_OK;
 
-  lenval = strlen(value);
-
-  if ((NULL != strstr(value,"0x")) | 
-      (NULL != strstr(value,"0X"))
-      ) {
+  if (!strncasecmp(value, "0x", 2)) {
     hexval  = 1;
-    lenval -= 2;
   } else {
     hexval = 0;
   }
@@ -653,12 +708,14 @@
 
 #ifndef __KERNEL__
 
-int32_t
-bb_data_header_print(S_BB_DATADESC_T data_desc, FILE* pf, int32_t idx, int32_t aliastack) {
+
+static int32_t
+bb_data_header_print_xml(struct bb_printer *bp, S_BB_DATADESC_T data_desc, int32_t idx, int32_t aliastack) {
   const char oneTab[] = "    "; 
   char tabs[MAX_ALIAS_LEVEL*5]="";
   char *n;
   int i;
+  struct classic_printer_priv *priv = bp->priv;
 
   for (i=0; i<(aliastack-1); i++)
     {
@@ -666,28 +723,61 @@
     }
 
   n = bb_get_varname(&data_desc);
-  fprintf(pf,"%s---------- < %s > ----------\n", tabs, n);
+  fprintf(priv->fp,"%s<variable name=\"%s\" ", tabs, n);
   free(n);
-  fprintf(pf,"%s  alias-target = %d\n", tabs, data_desc.alias_target);
-  fprintf(pf,"%s  type         = %d  (%s)\n",tabs,data_desc.type,E_BB_2STRING[data_desc.type]);
-  fprintf(pf,"%s  dimension    = %d  \n",tabs,data_desc.dimension);
-  fprintf(pf,"%s  type_size    = %d  \n",tabs,data_desc.type_size);
-  fprintf(pf,"%s  data_offset  = %ld \n",tabs,data_desc.data_offset);
+  fprintf(priv->fp,"alias_target=\"%d\" ", data_desc.alias_target);
+  fprintf(priv->fp,"type=\"%d\" ", data_desc.type);
+  fprintf(priv->fp,"dimension=\"%d\" ",data_desc.dimension);
+  fprintf(priv->fp,"type_size=\"%zd\"  ",data_desc.type_size);
+  fprintf(priv->fp,"data_offset=\"%ld\" ",data_desc.data_offset);
+  if ((idx>=0) &&
+      ((E_BB_UCHAR != data_desc.type) &&
+       (E_BB_CHAR  != data_desc.type)
+       )
+      ) {
+    fprintf(priv->fp,"index=\"%d\" value=",idx);
+  } else {
+    fprintf(priv->fp,"value=");
+  }
+  return 0;
+} /* end of bb_data_header_print */
+
+static int32_t
+bb_data_header_print(struct bb_printer *bp, S_BB_DATADESC_T data_desc, int32_t idx, int32_t aliastack) {
+  const char oneTab[] = "    "; 
+  char tabs[MAX_ALIAS_LEVEL*5]="";
+  char *n;
+  int i;
+  struct classic_printer_priv *priv = bp->priv;
+
+  for (i=0; i<(aliastack-1); i++)
+    {
+      strncat(tabs, oneTab, sizeof(tabs)-strlen(tabs));
+    }
+
+  n = bb_get_varname(&data_desc);
+  fprintf(priv->fp,"%s---------- < %s > ----------\n", tabs, n);
+  free(n);
+  fprintf(priv->fp,"%s  alias-target = %d\n", tabs, data_desc.alias_target);
+  fprintf(priv->fp,"%s  type         = %d  (%s)\n",tabs,data_desc.type,E_BB_2STRING[data_desc.type]);
+  fprintf(priv->fp,"%s  dimension    = %d  \n",tabs,data_desc.dimension);
+  fprintf(priv->fp,"%s  type_size    = %zd  \n",tabs,data_desc.type_size);
+  fprintf(priv->fp,"%s  data_offset  = %ld \n",tabs,data_desc.data_offset);
   if ((idx>=0) && 
       ((E_BB_UCHAR != data_desc.type) &&
        (E_BB_CHAR  != data_desc.type)
        )
       ) {
-    fprintf(pf,"%s  value[%d]     = ",tabs,idx);
+    fprintf(priv->fp,"%s  value[%d]     = ",tabs,idx);
   } else {
-    fprintf(pf,"%s  value        = ",tabs);
+    fprintf(priv->fp,"%s  value        = ",tabs);
   }
   if ((data_desc.dimension > 1) &&
       ((E_BB_UCHAR != data_desc.type) &&
        (E_BB_CHAR  != data_desc.type)
        )
       ){
-    fprintf(pf," [ ");
+    fprintf(priv->fp," [ ");
   } 
 
   if ((idx>=0) && 
@@ -695,16 +785,24 @@
        (E_BB_CHAR  != data_desc.type)
        )
       ) {
-    fprintf(pf,"... ");
+    fprintf(priv->fp,"... ");
   }
   return 0;
 } /* end of bb_data_header_print */
 
-int32_t
-bb_data_footer_print(S_BB_DATADESC_T data_desc, FILE* pf, int32_t idx, int32_t aliastack) {
+static int32_t
+bb_data_footer_print_xml(struct bb_printer *bp, S_BB_DATADESC_T data_desc, int32_t idx, int32_t aliastack) {
+  struct classic_printer_priv *priv = bp->priv;
+  fprintf(priv->fp,"</variable>\n");
+
+  return 0;
+} /* end of bb_data_footer_print */
+
+static int32_t
+bb_data_footer_print(struct bb_printer *bp, S_BB_DATADESC_T data_desc, int32_t idx, int32_t aliastack) {
   const char oneTab[] = "    ";
   char tabs[MAX_ALIAS_LEVEL*5]="";
-  
+  struct classic_printer_priv *priv = bp->priv;
   int i;
   
   for (i=0; i<(aliastack-1); i++) {
@@ -716,7 +814,7 @@
        (E_BB_CHAR  != data_desc.type)
        )
       ) {
-    fprintf(pf,"... ");
+    fprintf(priv->fp,"... ");
   }  
 
   if ((data_desc.dimension > 1) &&
@@ -724,20 +822,22 @@
        (E_BB_CHAR  != data_desc.type)
        )
       ){
-    fprintf(pf,"]");
+    fprintf(priv->fp,"]");
   }  
-  fprintf(pf,"\n");    
-  fprintf(pf,"%s---------- ---------- ----------\n", tabs);
+  fprintf(priv->fp,"\n");    
+  fprintf(priv->fp,"%s---------- ---------- ----------\n", tabs);
   
   return 0;
 } /* end of bb_data_footer_print */
 
-int32_t 
-bb_string_value_print(volatile S_BB_T* bb, S_BB_DATADESC_T data_desc, FILE* pf, 
+static int32_t 
+bb_string_value_print(struct bb_printer *bp, volatile S_BB_T* bb, S_BB_DATADESC_T data_desc,
 		      int32_t* idxstack, int32_t idxstack_len) {
   int32_t i,ibeg,iend;
   char* data;
   int32_t idx;
+  struct classic_printer_priv *priv = bp->priv;
+
   assert(bb);
   /* We get BB data address  */
   data = bb_item_offset(bb, &data_desc,idxstack,idxstack_len);
@@ -769,148 +869,175 @@
       if ('\0'==((char*) data)[i]) {
 	break;
       } else {
-	fprintf(pf,"%c",isprint((int)data[i]) ? ((char*) data)[i] : '?');
+	fprintf(priv->fp,"%c",isprint((int)data[i]) ? ((char*) data)[i] : '?');
       }
     }
   } else {
     /* This is not a char type ? */
-    fprintf(pf,"bb_string_value_print: Not a char type");
+    fprintf(priv->fp,"bb_string_value_print: Not a char type");
     return 1;
   }
   return 0;
 } /* end of bb_string_value_print */
 
-int32_t 
-bb_value_print(volatile S_BB_T* bb, S_BB_DATADESC_T data_desc, FILE* pf, 
-               int32_t* idxstack, int32_t idxstack_len) {
-  
-  int32_t i,j,ibeg,iend;
-  char* data;
-  int32_t idx;
-  int32_t charNullCount;
-  assert(bb);
-  /* We get BB data address  */
-  data = bb_item_offset(bb, &data_desc,idxstack,idxstack_len);
-  
-  /* check index stack to handle index */
-  if ((idxstack_len>0) && (data_desc.dimension > 1)){
-    idx = idxstack[idxstack_len-1];
-    if (idx>=0) {
-      ibeg=0;
-      iend=1;
-    } else {
-      ibeg=0;
-      iend=data_desc.dimension;
-    }
-  } else {
-    idx = 0;
-    ibeg=0;
-    iend=data_desc.dimension;
-  }
-
-  /* 
-   * If we have character this means we want
-   * a character-like or string-like display 
-   * HEX dump should be for UINT8/16/32/64
-   */
-  if ((E_BB_CHAR ==data_desc.type) ||
-      (E_BB_UCHAR==data_desc.type)) {
-    charNullCount = 0;
-    for (i=ibeg; i< iend; ++i) {
-      if ('\0'==((char*) data)[i]) {
-	charNullCount++;
-      } else {
-	if (charNullCount>0) {
-	  fprintf(pf,"(%d*'\\0')",charNullCount);
-	  charNullCount = 0;
-	}
-	if (isprint((int)data[i])) {
-	  fprintf(pf,"%c",((char*) data)[i]);
+static int32_t
+__bb_value_print(struct bb_printer *bp, volatile S_BB_T* bb, S_BB_DATADESC_T data_desc,
+		int32_t* idxstack, int32_t idxstack_len, char separator)
+{
+	int32_t i,j,ibeg,iend;
+	char* data;
+	int32_t idx;
+	int32_t charNullCount;
+	struct classic_printer_priv *priv = bp->priv;
+
+	assert(bb);
+	/* We get BB data address  */
+	data = bb_item_offset(bb, &data_desc,idxstack,idxstack_len);
+
+	/* check index stack to handle index */
+	if ((idxstack_len>0) && (data_desc.dimension > 1)){
+		idx = idxstack[idxstack_len-1];
+		if (idx>=0) {
+			ibeg=0;
+			iend=1;
+		} else {
+			ibeg=0;
+			iend=data_desc.dimension;
+		}
 	} else {
-	  fprintf(pf," 0x%02X ",((char*) data)[i]);
+		idx = 0;
+		ibeg=0;
+		iend=data_desc.dimension;
 	}
-      }
-    }
-    if (charNullCount>0) {
-      fprintf(pf," (%d*'\\0')",charNullCount);
-      charNullCount = 0;
-    }
 
-/*     fprintf(pf," (0x"); */
-/*     for (i=ibeg; i< iend; ++i) { */
-/*       fprintf(pf,"%02x",((char*) data)[i]); */
-/*     } */
-/*     fprintf(pf,")"); */
-  } else {
+	/* 
+	 * If we have character this means we want
+	 * a character-like or string-like display 
+	 * HEX dump should be for UINT8/16/32/64
+	 */
+	if ((E_BB_CHAR ==data_desc.type) ||
+			(E_BB_UCHAR==data_desc.type)) {
+		charNullCount = 0;
+		for (i=ibeg; i< iend; ++i) {
+			if ('\0'==((char*) data)[i]) {
+				charNullCount++;
+			} else {
+				if (charNullCount>0) {
+					fprintf(priv->fp,"(%d*'\\0')",charNullCount);
+					charNullCount = 0;
+				}
+				if (isprint((int)data[i])) {
+					fprintf(priv->fp,"%c",((char*) data)[i]);
+				} else {
+					fprintf(priv->fp," 0x%02X ",((char*) data)[i]);
+				}
+			}
+		}
+		if (charNullCount>0 && separator == ' ') {
+			fprintf(priv->fp," (%d*'\\0')",charNullCount);
+			charNullCount = 0;
+		}
+
+		/*     fprintf(priv->fp," (0x"); */
+		/*     for (i=ibeg; i< iend; ++i) { */
+		/*       fprintf(priv->fp,"%02x",((char*) data)[i]); */
+		/*     } */
+		/*     fprintf(priv->fp,")"); */
+	} else {
 
-    for (i=ibeg; i< iend; ++i) {    
-      switch (data_desc.type) {
-      case E_BB_DOUBLE: 
-	fprintf(pf,"%1.16f ",((double*) data)[i]);
-	break;
-      case E_BB_FLOAT:
-	fprintf(pf,"%f ",((float*) data)[i]);
-	break;
-      case E_BB_INT8:
-	fprintf(pf,"%d ",((int8_t*) data)[i]);
-	break;
-      case E_BB_INT16:
-	fprintf(pf,"%d ",((int16_t*) data)[i]);
-	break; 
-      case E_BB_INT32:
-	fprintf(pf,"%d ",((int32_t*) data)[i]);
-	break; 
-      case E_BB_INT64:
-	fprintf(pf,"%lld ",((int64_t*) data)[i]);
-	break;
-      case E_BB_UINT8:
-	fprintf(pf,"0x%x ",((uint8_t*) data)[i]);
-	break; 
-      case E_BB_UINT16:
-	fprintf(pf,"0x%x ",((uint16_t*) data)[i]);
-	break;
-      case E_BB_UINT32:
-	fprintf(pf,"0x%x ",((uint32_t*) data)[i]);
-	break;	
-      case E_BB_UINT64:
-	fprintf(pf,"0x%llx ",((uint64_t*) data)[i]);
-	break;	
-	/*     case E_BB_CHAR: */
-	/*       fprintf(pf,"0x%02x<%c> ",((char*) data)[i], */
-	/* 	      isprint((int)data[i]) ? ((char*) data)[i] : '?'); */
-	/*       break; */
-	/*     case E_BB_UCHAR: */
-	/*       fprintf(pf,"0x%02x<%c> ",((char*) data)[i], */
-	/* 	      isprint((int)data[i]) ? ((char*) data)[i] : '?'); */
-	/*       break;*/
-      case E_BB_USER:
-	for (j=0; j<data_desc.type_size; ++j) {
-	  fprintf(pf,"0x%02x ",((uint8_t*) data)[i*data_desc.type_size+j]);
-	  //bb_data_print(bb, *(&data_desc+1), pf);  
-	}
-	break; 
-      default:
-	fprintf(pf,"0x%x ",((char*) data)[i]);
-	break;
-      }
-    }
-  } 
-  return 0;
-} /* end of bb_value_print */
+		for (i=ibeg; i< iend; ++i) {    
+			switch (data_desc.type) {
+				case E_BB_DOUBLE: 
+					fprintf(priv->fp,"%1.16f",((double*) data)[i]);
+					break;
+				case E_BB_FLOAT:
+					fprintf(priv->fp,"%f",((float*) data)[i]);
+					break;
+				case E_BB_INT8:
+					fprintf(priv->fp,"%d",((int8_t*) data)[i]);
+					break;
+				case E_BB_INT16:
+					fprintf(priv->fp,"%d",((int16_t*) data)[i]);
+					break; 
+				case E_BB_INT32:
+					fprintf(priv->fp,"%d",((int32_t*) data)[i]);
+					break; 
+				case E_BB_INT64:
+					fprintf(priv->fp,"%"BB_INT64_FORMAT"d",((int64_t*) data)[i]);
+					break;
+				case E_BB_UINT8:
+					fprintf(priv->fp,"0x%x",((uint8_t*) data)[i]);
+					break; 
+				case E_BB_UINT16:
+					fprintf(priv->fp,"0x%x",((uint16_t*) data)[i]);
+					break;
+				case E_BB_UINT32:
+					fprintf(priv->fp,"0x%x",((uint32_t*) data)[i]);
+					break;	
+				case E_BB_UINT64:
+					fprintf(priv->fp,"0x%"BB_INT64_FORMAT"x",((uint64_t*) data)[i]);
+					break;	
+					/*     case E_BB_CHAR: */
+					/*       fprintf(priv->fp,"0x%02x<%c> ",((char*) data)[i], */
+					/* 	      isprint((int)data[i]) ? ((char*) data)[i] : '?'); */
+					/*       break; */
+					/*     case E_BB_UCHAR: */
+					/*       fprintf(priv->fp,"0x%02x<%c> ",((char*) data)[i], */
+					/* 	      isprint((int)data[i]) ? ((char*) data)[i] : '?'); */
+					/*       break;*/
+				case E_BB_USER:
+					for (j=0; j<data_desc.type_size; ++j) {
+						fprintf(priv->fp,"0x%02x",((uint8_t*) data)[i*data_desc.type_size+j]);
+						if (((j+1)<data_desc.type_size) && separator != ' ') {
+							fprintf(priv->fp, "%c", separator);
+						}
+						//bb_data_print(bb, *(&data_desc+1), priv->fp);  
+					}
+					break; 
+				default:
+					fprintf(priv->fp,"0x%x",((char*) data)[i]);
+					break;
+			}
+			if ((i + 1) < iend) {
+				fprintf(priv->fp, "%c", separator);
+			}
+		}
+	} 
+	return 0;
+} /* end of __bb_value_print */
 
-int32_t 
-bb_data_print(volatile S_BB_T* bb, S_BB_DATADESC_T data_desc, FILE* pf,
-              int32_t* idxstack, int32_t idxstack_len) {
-   int32_t          aliasstack_size = MAX_ALIAS_LEVEL;
-   S_BB_DATADESC_T  aliasstack[MAX_ALIAS_LEVEL];
-   
-   aliasstack[0]=data_desc;		
-   bb_find_aliastack(bb, aliasstack, &aliasstack_size);
-   bb_data_header_print(data_desc,pf,-1,aliasstack_size);
-   bb_value_print(bb,data_desc,pf,idxstack,idxstack_len);
-   bb_data_footer_print(data_desc,pf,-1,aliasstack_size);
-   return BB_OK;
-} /* end of bb_data_print */
+static int32_t 
+bb_value_print_xml(struct bb_printer *bp, volatile S_BB_T* bb, S_BB_DATADESC_T data_desc,
+	           int32_t* idxstack, int32_t idxstack_len)
+{
+	struct classic_printer_priv *priv = bp->priv;
+	int32_t ret;
+	fprintf(priv->fp,"\"");
+	ret = __bb_value_print(bp, bb, data_desc, idxstack, idxstack_len, ',');
+	fprintf(priv->fp,"\">\n");
+	return ret;
+}
+static int32_t 
+bb_value_print(struct bb_printer *bp, volatile S_BB_T* bb, S_BB_DATADESC_T data_desc,
+	       int32_t* idxstack, int32_t idxstack_len)
+{
+	return __bb_value_print(bp, bb, data_desc, idxstack, idxstack_len, ' ');
+}
+static int32_t
+bb_data_print(struct bb_printer *bp, volatile S_BB_T * bb,
+	      S_BB_DATADESC_T data_desc, int32_t * idxstack,
+	      int32_t idxstack_len)
+{
+	int32_t aliasstack_size = MAX_ALIAS_LEVEL;
+	S_BB_DATADESC_T aliasstack[MAX_ALIAS_LEVEL];
+
+	aliasstack[0] = data_desc;
+	bb_find_aliastack(bb, aliasstack, &aliasstack_size);
+	bp->ops->bb_data_header_print(bp, data_desc, -1, aliasstack_size);
+	bp->ops->bb_value_print(bp, bb, data_desc, idxstack, idxstack_len);
+	bp->ops->bb_data_footer_print(bp, data_desc, -1, aliasstack_size);
+	return BB_OK;
+}				/* end of bb_data_print */
 #endif /* !__KERNEL__ */
 
 int32_t 
@@ -921,10 +1048,17 @@
 
   enum bb_type type;
   int32_t retcode;
+  struct S_BB_LOCAL *local;
+  
   assert(bb);
-
+  local = bb_local_new();
+  if (local == NULL) {
+          retcode = BB_NOK;
+          goto err;
+  }
+  
   type = bb_type(pc_bb_name);
-  retcode = ops[type]->bb_shmem_get(bb, pc_bb_name, n_data, data_size, 1);
+  retcode = ops[type]->bb_shmem_get(bb, local, pc_bb_name, n_data, data_size, 1);
   if (retcode != BB_OK)
   	goto err;
 
@@ -933,7 +1067,9 @@
   	goto err;
 
   retcode = ops[(*bb)->type]->bb_msgq_get(*bb, 1);
-  
+
+  bb_attach_local(*bb, local);
+
 err:
   return retcode;
 } /* end of bb_create */
@@ -945,27 +1081,42 @@
 bb_destroy(S_BB_T** bb) {
   
   int32_t retcode;
+  struct S_BB_LOCAL *local;
   
   assert(bb);
-  assert(*bb);  
-  /* 
+  assert(*bb);
+  
+  local = bb_get_local(*bb);
+  if (local == NULL) {
+          retcode = BB_NOK;
+          goto out;
+  }
+
+  bb_detach_local(*bb);
+
+  /*
    * On signale la destruction en cours pour les processes qui
-   * resteraient attachés
+   * resteraient attachï¿½s
    */
   (*bb)->status = BB_STATUS_DESTROYED;
-  retcode = ops[(*bb)->type]->bb_sem_destroy(*bb);
+   retcode = ops[(*bb)->type]->bb_sem_destroy(*bb);
   if (retcode != BB_OK)
   	goto out;
   retcode = ops[(*bb)->type]->bb_msgq_destroy(*bb);
   if (retcode != BB_OK)
   	goto out;
-  retcode = ops[(*bb)->type]->bb_shmem_destroy(bb);
+  retcode = ops[(*bb)->type]->bb_shmem_destroy(bb, local);
   if (retcode != BB_OK)
   	goto out;
-    
+  
 out:
+  bb_local_delete(local);
   return retcode;
 } /* end of bb_destroy */
+#ifdef __KERNEL__
+EXPORT_SYMBOL_GPL(bb_destroy);
+#endif
+
 
 int32_t
 bb_data_memset(S_BB_T* bb, const char c) { 
@@ -978,7 +1129,7 @@
 
 int32_t 
 bb_lock(volatile S_BB_T* bb) {
-  return ops[bb->type]->bb_unlock(bb);
+  return ops[bb->type]->bb_lock(bb);
 } /* end of bb_lock */
 
 int32_t 
@@ -992,9 +1143,16 @@
 {
   enum bb_type type;
   int ret;
+  struct S_BB_LOCAL *local;
+  
+  assert(bb);
+
+  local = bb_local_new();
+  if (local == NULL)
+          return  BB_NOK;
 
   type = bb_type(pc_bb_name);
-  ret = ops[type]->bb_shmem_attach(bb, pc_bb_name);
+  ret = ops[type]->bb_shmem_attach(bb, local, pc_bb_name);
   if (ret != BB_OK)
     return ret;
 
@@ -1007,15 +1165,31 @@
     bb_logMsg(BB_LOG_WARNING, "%s", "Could not setup a proper varname encoding scheme\n");
   }
 #endif
+
+  bb_attach_local(*bb, local);
+
   return ret;
 } /* end of bb_attach */
 
 int32_t
 bb_detach(S_BB_T** bb) {
-  assert(bb);
-  assert(*bb);
+	int32_t ret ;
+	struct S_BB_LOCAL *local;
+	assert(bb);
+	assert(*bb);
+
+	local = bb_get_local(*bb);
+	if (local == NULL) {
+		return BB_NOK;
+	}
+
+	bb_detach_local(*bb);
+
+        ret =  ops[(*bb)->type]->bb_shmem_detach(bb, local);
 
-  return ops[(*bb)->type]->bb_shmem_detach(bb);
+        bb_local_delete(local);
+
+        return ret;
 } /* end of bb_detach */
 
 void*
@@ -1023,6 +1197,7 @@
   void* retval;
   int32_t needed_size;
   char *n;
+  int addrOffset;
 
   retval = NULL;
   assert(bb);
@@ -1034,9 +1209,9 @@
    */
   bb_lock(bb);
   n = bb_get_varname(data_desc);
-  if (bb_find(bb, n) != -1) {
+ if(bb_find(bb, n) != -1) {
     char *name = bb_get_varname(data_desc);
-    bb_logMsg(BB_LOG_FINER,"BlackBoard::bb_publish",
+       bb_logMsg(BB_LOG_FINER,"BlackBoard::bb_publish",
         "Key <%s> already exists in blackboard (automatic subscribe)!!", name);
     free(name);
     bb_unlock(bb);
@@ -1045,6 +1220,7 @@
   } else {
     /* compute required data size  */
     needed_size = data_desc->type_size*data_desc->dimension;
+
     /* verify available space in BB data descriptor zone */
     if (bb->n_data >= bb->max_data_desc_size) {
       bb_logMsg(BB_LOG_SEVERE,"BlackBoard::bb_publish",
@@ -1059,11 +1235,15 @@
       /* Compute the free address */
       retval = (char*) bb_data(bb) + bb->data_free_offset;
       /* Update returned data descriptor */
-      data_desc->data_offset = bb->data_free_offset;
+      /*Calculate offset for adresses to avoid alignment error*/
+      MEM_ALIGN(retval,needed_size,addrOffset)
+      /*apply the offset */
+      retval=(char *)retval + addrOffset;
+      data_desc->data_offset = bb->data_free_offset + addrOffset;
       /* this is not an alias */
       data_desc->alias_target = -1;
       /* Update next free address */
-      bb->data_free_offset  = bb->data_free_offset + needed_size;
+      bb->data_free_offset  = bb->data_free_offset + needed_size + addrOffset;
       /* Update data descriptor zone */
       bb_data_desc(bb)[bb->n_data] = *data_desc;
       /* Increment number of published data */
@@ -1156,9 +1336,92 @@
 
 #ifndef __KERNEL__
 
-int32_t 
-bb_dump(volatile S_BB_T *bb, FILE* p_filedesc) {  
-  
+static int32_t
+bb_header_print_xml(struct bb_printer *printer, volatile S_BB_T *bb)
+{
+	struct classic_printer_priv *priv = printer->priv;
+	fprintf(priv->fp,"<bb name=\"%s\" ", bb->name);
+	fprintf(priv->fp,"n_data=\"%d\" ", bb->n_data);
+	fprintf(priv->fp,"max_data_desc_size=\"%ld\">\n", bb->max_data_size);
+	return 0;
+}
+
+static int32_t
+bb_header_print(struct bb_printer *printer, volatile S_BB_T *bb)
+{
+
+
+	struct classic_printer_priv *priv = printer->priv;
+	fprintf(priv->fp,"============= <[begin] BlackBoard [%s] [begin] > ===============\n", bb->name);
+	fprintf(priv->fp,"  @start blackboard    = 0x%zx\n",(uintptr_t) (bb));
+	fprintf(priv->fp,"  stored data          = %d / %d [max desc]\n",
+			bb->n_data,
+			bb->max_data_desc_size);
+	fprintf(priv->fp,"  free data size       = %ld / %ld\n",
+			bb->max_data_size - bb->data_free_offset,
+			bb->max_data_size);  
+	fprintf(priv->fp,"  @data_desc           = 0x%zx\n",
+			(uintptr_t) (bb_data_desc(bb)));
+	fprintf(priv->fp,"  @data                = 0x%zx\n",
+			(uintptr_t) (bb_data(bb)));
+	fprintf(priv->fp,"================ < [begin] Data [begin] > ==================\n");
+	return 0;
+}
+
+static int32_t
+bb_footer_print_xml(struct bb_printer *printer, volatile S_BB_T *bb)
+{
+	struct classic_printer_priv *priv = printer->priv;
+	fprintf(priv->fp,"</bb>\n");
+	return 0;
+}
+
+static int32_t
+bb_footer_print(struct bb_printer *printer, volatile S_BB_T *bb)
+{
+	struct classic_printer_priv *priv = printer->priv;
+	fprintf(priv->fp,"================== < [end] Data [end] > ====================\n");
+	fprintf(priv->fp,"============== < [end] BlackBoard [%s] [end] > ================\n",
+			bb->name);
+	return 0;
+}
+
+struct bb_printer_operations xml_printer_ops =  { "xml",
+						  bb_data_print,
+						  bb_data_footer_print_xml,
+						  bb_data_header_print_xml,
+						  bb_value_print_xml,
+						  bb_string_value_print,
+						  bb_header_print_xml,
+						  bb_footer_print_xml,
+						};
+struct bb_printer_operations classic_printer_ops =  { "classic",
+						      bb_data_print,
+						      bb_data_footer_print,
+						      bb_data_header_print,
+						      bb_value_print,
+						      bb_string_value_print,
+						      bb_header_print,
+						      bb_footer_print,
+						    };
+struct bb_printer_operations *printer_operations[] = { &classic_printer_ops,
+						       &xml_printer_ops,
+						       NULL };
+
+struct bb_printer_operations *get_printer_ops_from_format(char *format)
+{
+	int i;
+	for (i=0; printer_operations[i] != NULL; i++) {
+		if (!strncmp(printer_operations[i]->name,
+			     format, BB_PRINTER_OPT_NAME_LEN)) {
+			return printer_operations[i];
+		}
+	}
+	return NULL;
+}
+int32_t
+bb_dump(volatile S_BB_T *bb, struct bb_printer *printer) {
+
   int32_t retcode;
   /* char syserr[MAX_SYSMSG_SIZE]; */
   int32_t i;
@@ -1169,29 +1432,15 @@
   S_BB_DATADESC_T  aliasstack[MAX_ALIAS_LEVEL];
   int32_t array_in_aliasstack;
 
-  
   retcode = BB_OK;
   assert(bb);
-  fprintf(p_filedesc,"============= <[begin] BlackBoard [%s] [begin] > ===============\n",
-	  bb->name);
-  fprintf(p_filedesc,"  @start blackboard    = 0x%x\n",(unsigned int) (bb));
-  fprintf(p_filedesc,"  stored data          = %d / %d [max desc]\n",
-	  bb->n_data,
-	  bb->max_data_desc_size);
-  fprintf(p_filedesc,"  free data size       = %ld / %ld\n",
-	  bb->max_data_size - bb->data_free_offset,
-	  bb->max_data_size);  
-  fprintf(p_filedesc,"  @data_desc           = 0x%x\n",
-	  (unsigned int) (bb_data_desc(bb)));
-  fprintf(p_filedesc,"  @data                = 0x%x\n",
-	  (unsigned int) (bb_data(bb)));
-  fprintf(p_filedesc,"================ < [begin] Data [begin] > ==================\n");
+  printer->ops->bb_header_print(printer, bb);
   for (i=0;i<bb->n_data;++i) {
     /* NON ALIAS CASE */
     if ((bb_data_desc(bb)[i]).alias_target == -1) {
       indexstack[0]  = 0;
       indexstack_len = 0;
-      bb_data_print(bb,bb_data_desc(bb)[i],p_filedesc,indexstack, indexstack_len);
+      printer->ops->bb_data_print(printer, bb,bb_data_desc(bb)[i],indexstack, indexstack_len);
     }
     /* ALIAS CASE */
     else {
@@ -1209,7 +1458,7 @@
 	for (j=0; j<bb_data_desc(bb)[i].dimension; j++){
 	  indexstack[0] = j;
 	  indexstack_len = 1;
-	  bb_data_print(bb, bb_data_desc(bb)[i], p_filedesc,indexstack, indexstack_len);
+	  printer->ops->bb_data_print(printer, bb, bb_data_desc(bb)[i], indexstack, indexstack_len);
 	  
 	}
       }
@@ -1218,16 +1467,14 @@
 	for (j=0; j<aliasstack[aliasstack_size-1].dimension; j++){
 	  indexstack[0] = j;
 	  indexstack_len = 1;
-	  bb_data_print(bb, bb_data_desc(bb)[i], p_filedesc,indexstack, indexstack_len);
+	  printer->ops->bb_data_print(printer, bb, bb_data_desc(bb)[i], indexstack, indexstack_len);
 	  
 	}			
       }             
     }
   }
-  fprintf(p_filedesc,"================== < [end] Data [end] > ====================\n");
-  fprintf(p_filedesc,"============== < [end] BlackBoard [%s] [end] > ================\n",
-	  bb->name);
-  
+  printer->ops->bb_footer_print(printer, bb);
+
   return retcode;
 } /* end of bb_dump */
 
@@ -1319,7 +1566,7 @@
 } /* end of bb_shadow_update_data */
 
 
-int32_t 
+ssize_t
 bb_snd_msg(volatile S_BB_T *bb,
 		S_BB_MSG_T* msg) {
   
@@ -1331,7 +1578,7 @@
 } /* end of bb_snd_msg */
 
 
-int32_t 
+ssize_t
 bb_rcv_msg(volatile S_BB_T *bb,
 		S_BB_MSG_T* msg) {
     
@@ -1450,18 +1697,18 @@
     
   case BB_LOG_ABORT:
   case BB_LOG_SEVERE:
-    STRACE_ERROR(("%s : %s",who,message));
+    STRACE_ERROR("%s : %s",who,message);
     break;
   case BB_LOG_WARNING:
-    STRACE_WARNING(("%s : %s",who,message));
+    STRACE_WARNING("%s : %s",who,message);
     break;
   case BB_LOG_INFO:
   case BB_LOG_CONFIG:
-    STRACE_INFO(("%s : %s",who,message));
+    STRACE_INFO("%s : %s",who,message);
     break;
   case BB_LOG_FINE:
   case BB_LOG_FINER:
-    STRACE_DEBUG(("%s : %s",who,message));
+    STRACE_DEBUG("%s : %s",who,message);
 
   }
   return 0;
diff -urN tsp_orig/src/util/libbb/bb_core.h tsp_modified/src/util/libbb/bb_core.h
--- tsp_orig/src/util/libbb/bb_core.h	2007-04-01 15:17:21.000000000 +0200
+++ tsp_modified/src/util/libbb/bb_core.h	2009-01-12 17:26:09.000000000 +0100
@@ -1,6 +1,6 @@
 /*
 
-$Header: /sources/tsp/tsp/src/util/libbb/bb_core.h,v 1.36 2007/04/01 13:17:21 deweerdt Exp $
+$Header: /sources/tsp/tsp/src/util/libbb/bb_core.h,v 1.46 2008/07/24 13:27:33 jaggy Exp $
 
 -----------------------------------------------------------------------
 
@@ -62,7 +62,8 @@
 
 #else /* __KERNEL__ */
 
-#include <stdint.h>
+/*removal of stdint.h, see bug #24421*/
+
 #include <stdlib.h>
 #include <assert.h>
 #include <inttypes.h>
@@ -71,9 +72,19 @@
 #include <stdio.h>
 #include <sys/types.h>
 #include <tsp_abs_types.h>
+#include <mqueue.h>
+#include <semaphore.h>
 
 #endif /* __KERNEL__ */
 
+#if defined(__i386__) 
+#define BB_INT64_FORMAT "ll"
+#elif defined(__x86_64__)
+#define BB_INT64_FORMAT "l"
+#else
+#define BB_INT64_FORMAT "ll"
+#endif
+
 /**
  * @defgroup BlackBoard BlackBoard (BB)
  * BlackBoard idiom definition and functions.
@@ -138,6 +149,11 @@
  * to be sent by BlackBoard message queue.
  */
 #define MAX_SYSMSG_SIZE     255
+
+#if MAX_SYSMSG_SIZE > 1024
+#	warning This constant should not excceed 1ko (it is used to declare buffers in kernel stack)
+#endif
+
 /**
  * The maximum size of the BB message queue(s).
  */
@@ -195,8 +211,8 @@
  */
 typedef enum {
   E_BB_DISCOVER=0, /*!< Discover is used by @ref bb_subscribe when discovering data type */
-  E_BB_DOUBLE=1,   /*!< An IEEE double precision floating point  */
-  E_BB_FLOAT,      /*!< An IEEE simple precision floating point  */
+  E_BB_DOUBLE=1,   /*!< An IEEE-754 double precision floating point  */
+  E_BB_FLOAT,      /*!< An IEEE-754 simple precision floating point  */
   E_BB_INT8,       /*!< An 8bit signed integer                   */
   E_BB_INT16,      /*!< A 16bit signed integer                   */
   E_BB_INT32,      /*!< A 32bit signed integer                   */
@@ -249,7 +265,7 @@
   unsigned long data_offset;
   
   /**
-   * The index of the aliases published (@ref bb_alias_publish)
+   * The index of the aliases published (::bb_alias_publish)
    * data in the BlackBoard data descriptor array
    * -1 if genuine published data (not an alias).
    */
@@ -261,6 +277,7 @@
 
 struct S_BB;
 struct S_BB_MSG;
+struct S_BB_LOCAL;
 
 /**
  * Implementation agnostic operations, for now these
@@ -270,12 +287,14 @@
  * - in-kernel bb_create, bb_publish
  */
 struct bb_operations {
-	int (*bb_shmem_get)(struct S_BB ** bb, const char *name, int n_data, 
-				int data_size, int create);
-
-	int (*bb_shmem_attach)(struct S_BB ** bb, const char *name);
-	int (*bb_shmem_detach)(struct S_BB ** bb);
-	int (*bb_shmem_destroy)(struct S_BB **bb);
+	int (*bb_shmem_get)(struct S_BB ** bb, struct S_BB_LOCAL *local,
+                            const char *name, int n_data, 
+                            int data_size, int create);
+
+	int (*bb_shmem_attach)(struct S_BB ** bb, struct S_BB_LOCAL *local,
+                               const char *name);
+	int (*bb_shmem_detach)(struct S_BB ** bb, struct S_BB_LOCAL *local);
+	int (*bb_shmem_destroy)(struct S_BB **bb, struct S_BB_LOCAL *local);
 
 	int (*bb_sem_get)(struct S_BB *bb, int create);
 	int (*bb_lock)(volatile struct S_BB *bb);
@@ -298,16 +317,7 @@
 struct kernel_private {
 	/** the size of the allocated black board */
 	unsigned long shm_size;
-	/** 
-	 * The actual pointer to the allocated memory,
-	 * this is needed as the BB must be aligned on a
-	 * PAGE_SIZE boundary, kmalloc_ptr is the _real_
-	 * start of the allocate memory */
-	void *kmalloc_ptr;
-	/** in-kernel structure, points to the char device */
-	struct bb_device *dev;
-	/** the index of the char device, used for cleaup
-	 * purposes */
+	/** the index of the char device, used for cleaup purposes */
 	int index;
 };
 
@@ -325,7 +335,21 @@
 	int msg_id;
 };
 
-
+#ifndef __KERNEL__
+/**
+ * POSIX specific data, part of the S_BB_T structure
+ */
+struct posix_private {
+	/* shm file descriptor */
+	int fd;
+	/** the size of the allocated black board */
+	int shm_size;
+	/* posix semaphore handle */
+	sem_t *sem_id ;
+	/* posix message queue handle */
+	mqd_t msg_id;
+};
+#endif /* __KERNEL*/
 /**
  * BlackBoard message definition.
  * This type must conform to the constraint of
@@ -348,19 +372,20 @@
 } S_BB_MSG_T ;
 
 /**
- * The black board type, this is tightly coupled to the 
+ * The blackboard type, this is tightly coupled to the 
  * struct bb_operations *ops[] defined in bb_core.c
  * it's used as a selector of the right set of operations
  */
 enum bb_type {
-	BB_SYSV,
-	BB_KERNEL,
+	BB_SYSV,   /*!< SysV Blackboard type       */
+	BB_KERNEL, /*!< Kernel Blackboard type     */
+	BB_POSIX
 };
 /**
  * BlackBoard description structure.
  * This structure describes the BlackBoard itself
  * (not data published in BlackBoard which are described
- *  by the @ref S_BB_DATADESC_T structure).
+ *  by the #S_BB_DATADESC_T structure).
  */
 typedef struct S_BB {
   /**
@@ -407,7 +432,7 @@
   /** 
    * Offset (in bytes) of the next free byte 
    * in the blackboard data zone. This offset
-   * is relative to @ref data_offset
+   * is relative to #data_offset
    */
   unsigned long data_free_offset;
   /**
@@ -426,6 +451,9 @@
   union {
 	struct sysv_private sysv;
 	struct kernel_private k;
+#ifndef __KERNEL__
+	struct posix_private posix;
+#endif /* __KERNEL__ */
   } priv;
 
 } S_BB_T;
@@ -442,6 +470,7 @@
 
 /**
  * Get a pointer to the private structure of the BB
+ *ï¿½@param[in] bb the pointer to BB structure  
  * @return a pointer to the private structure of the BB
  */
 S_BB_PRIV_T *
@@ -457,19 +486,19 @@
 typedef int32_t (*bb_set_varname_fn)(S_BB_DATADESC_T *, const char *);
 typedef int32_t (*bb_varname_max_len_fn)(void);
 /**
- * Get the name of a variable described by @dd
+ * Get the name of a variable described by dd
  * @param[in] dd the descriptor of the variable
  * @return the variable name, must be freed by caller
  */
 extern bb_get_varname_fn bb_get_varname;
 /**
- * Get the name of a variable described by @dd
+ * Get the name of a variable described by dd
  * @param[in] dd the descriptor of the variable
  * @return the variable name, must be freed by caller
  */
 extern bb_set_varname_fn bb_set_varname;
 /**
- * Get the max len of a name of a variable described by @dd
+ * Get the max len of a name of a variable described by dd
  * @return the max lenght of a variable name
  */
 extern bb_varname_max_len_fn bb_varname_max_len;
@@ -491,7 +520,7 @@
 /**
  * The size (in byte) of a BlackBoard data type.
  * @param[in] bb_type a BlackBoard data type
- * @return The size (in byte) of a BlackBoard data type or -1 if bb_type equals @ref E_BB_USER
+ * @return The size (in byte) of a BlackBoard data type or -1 if bb_type equals #E_BB_USER
  *         or is unknown.
  */
 size_t 
@@ -540,7 +569,7 @@
 /*
  * Search a variable within a BlackBoard using fastfind algorithm.
  * @param[in] bb BlackBoard pointer
- * @param[in] fastfind_string the fastfind string build with @ref bb_fastfind_build
+ * @param[in] fastfind_string the fastfind string build with ::bb_fastfind_build
  * @param[in] var_name the name of the searched variable
  * @return index of the variable in the BB descriptor array
  */
@@ -587,7 +616,7 @@
  *                (should NOT be NULL).
  * @param[in,out] default_value default pointer to the default value used for init.
  *                         If NULL then initialize to 0.
- * @return E_OK if init OK E_NOK otherwise.
+ * @return BB_OK if init OK BB_NOK otherwise.
  */
 int32_t 
 bb_data_initialise(volatile S_BB_T* bb, S_BB_DATADESC_T* data_desc,void* default_value);
@@ -604,7 +633,7 @@
  *                      a properly initialised data_desc since the
  *                      function does not verify this. 
  * @param[in] value the string representing the value to be written to BB data
- * @param[in] idxstack the indexstack (in the alias case)  @ref BBAliasLib.
+ * @param[in] idxstack the indexstack (in the alias case see BBAliasLib).
  *                     it is not read if idxstack_len is 0.
  * @param[in] idxstack_len the indexstack length should be >= 0, if 0 idxstack is ignored
  * @return BB_OK on success BB_NOK otherwise.
@@ -619,69 +648,86 @@
 int32_t
 bb_value_direct_rawwrite(void* data, S_BB_DATADESC_T data_desc, void* value);
 
-/**
- * Print the value off a BB published data on a STDIO file stream.
- * @param[in] bb the BlackBoard where data is published
- * @param[in] data_desc the BB data descriptor. Be sure to provide
- *                      a properly initialised data_desc since the
- *                      function does not verify this. 
- * @param[in] pf the STDIO file stream pointer, should be open for writing.
- * @param[in] idxstack the indexstack (in the alias case)  @ref BBAliasLib.
- *                     it is not read if idxstack_len is 0.
- * @param[in] idxstack_len the indexstack length should be >= 0, if 0 idxstack is ignored
- */
-int32_t 
-bb_string_value_print(volatile S_BB_T* bb, S_BB_DATADESC_T data_desc, FILE* pf,
-		      int32_t* idxstack, int32_t idxstack_len);
-
-/**
- * Print the value off a BB published data on a STDIO file stream.
- *
- * @param[in] bb the BlackBoard where data is published
- * @param[in] data_desc the BB data descriptor. Be sure to provide
- *                      a properly initialised data_desc since the
- *                      function does not verify this. 
- * @param[in] pf the STDIO file stream pointer, should be open for writing.
- * @param[in] idxstack the indexstack (in the alias case)  @ref BBAliasLib.
- *                     it is not read if idxstack_len is 0.
- * @param[in] idxstack_len the indexstack length should be >= 0, if 0 idxstack is ignored
- */
-int32_t 
-bb_value_print(volatile S_BB_T* bb, S_BB_DATADESC_T data_desc, FILE* pf,
-               int32_t* idxstack, int32_t idxstack_len);
-
-
-
-int32_t
-bb_data_header_print(S_BB_DATADESC_T data_desc, FILE* pf, int32_t idx, int32_t aliastack);
-
-int32_t
-bb_data_footer_print(S_BB_DATADESC_T data_desc, FILE* pf, int32_t idx, int32_t aliastack);
-
+struct classic_printer_priv {
+	FILE *fp;
+};
+#define BB_PRINTER_OPT_NAME_LEN 256
+struct bb_printer;
+struct bb_printer_operations {
+	char name[BB_PRINTER_OPT_NAME_LEN];
+	/**
+	 * Print the content of a data descriptor.
+	 * @param[in] bb  pointer to BB where the data reside
+	 * @param[in,out] data_desc pointer to data descriptor.
+	 * @param[in,out] pf stream file pointer to be used for printing.
+	 * @param[in] idxstack the index stack 
+	 * @param[in] idxstack_len  the size of the index stack
+	 * @return always return BB_OK unless pf is NULL.
+	 */
+	 int32_t(*bb_data_print) (struct bb_printer * bp, volatile S_BB_T * bb,
+				  S_BB_DATADESC_T desc, int32_t *
+				  idxstack, int32_t idxstack_len);
+	 int32_t(*bb_data_footer_print) (struct bb_printer * bp,
+					 S_BB_DATADESC_T data_desc,
+					 int32_t idx, int32_t aliastack);
+	 /**
+	  * Print the value off a BB published data on a STDIO file stream.
+	  *
+	  * @param[in] bb the BlackBoard where data is published
+	  * @param[in] data_desc the BB data descriptor. Be sure to provide
+	  *                      a properly initialised data_desc since the
+	  *                      function does not verify this. 
+	  * @param[in] pf the STDIO file stream pointer, should be open for writing.
+	  * @param[in] idxstack the indexstack (in the alias case)  @ref BBAliasLib.
+	  *                     it is not read if idxstack_len is 0.
+	  * @param[in] idxstack_len the indexstack length should be >= 0, if 0 idxstack is ignored
+	  */
+	 int32_t(*bb_data_header_print) (struct bb_printer * bp,
+					 S_BB_DATADESC_T data_desc,
+					 int32_t idx, int32_t aliastack);
+	 int32_t(*bb_value_print) (struct bb_printer * bp, volatile
+				   S_BB_T * bb,
+				   S_BB_DATADESC_T data_desc, int32_t *
+				   idxstack, int32_t idxstack_len);
+	 /**
+	  * Print the value off a BB published data on a STDIO file stream.
+	  * @param[in] bb the BlackBoard where data is published
+	  * @param[in] data_desc the BB data descriptor. Be sure to provide
+	  *                      a properly initialised data_desc since the
+	  *                      function does not verify this. 
+	  * @param[in] pf the STDIO file stream pointer, should be open for writing.
+	  * @param[in] idxstack the indexstack (in the alias case)  @ref BBAliasLib.
+	  *                     it is not read if idxstack_len is 0.
+	  * @param[in] idxstack_len the indexstack length should be >= 0, if 0 idxstack is ignored
+	  */
+	 int32_t(*bb_string_value_print) (struct bb_printer * bp, volatile
+					  S_BB_T * bb,
+					  S_BB_DATADESC_T data_desc,
+					  int32_t * idxstack,
+					  int32_t idxstack_len);
+	int32_t (*bb_header_print)(struct bb_printer *printer, volatile S_BB_T *bb);
+	int32_t (*bb_footer_print)(struct bb_printer *printer, volatile S_BB_T *bb);
+};
 
+struct bb_printer {
+	void *priv;
+	struct bb_printer_operations *ops;
+};
 
-/**
- * Print the content of a data descriptor.
- * @param[in] bb  pointer to BB where the data reside
- * @param[in,out] data_desc pointer to data descriptor.
- * @param[in,out] pf stream file pointer to be used for printing.
- * @param[in] idxstack the index stack 
- * @param[in] idxstack_len  the size of the index stack
- * @return always return E_OK unless pf is NULL.
- */
-int32_t 
-bb_data_print(volatile S_BB_T* bb, S_BB_DATADESC_T data_desc, FILE* pf,
-              int32_t* idxstack, int32_t idxstack_len);
+extern struct bb_printer_operations classic_printer_ops;
+extern struct bb_printer_operations xml_printer_ops;
+struct bb_printer_operations *get_printer_ops_from_format(char *format);
 
 /**
  * Dump a blackboard to a file stream.
  * Blackboard description and all data content is dumped.
  * @param[in,out] bb  pointer to BB.
- * @param[in,out] filedesc  file stream descriptor.
- * @return E_OK if dump succeed E_NOK otherwise.
+ * @param[in,out] printer  a struct bb_printer describing how to output
+ * the bb
+ * @return BB_OK if dump succeed BB_NOK otherwise.
  */
 int32_t 
-bb_dump(volatile S_BB_T *bb, FILE* filedesc);
+bb_dump(volatile S_BB_T *bb, struct bb_printer *printer);
 
 #endif /* __KERNEL__ */
 
@@ -702,7 +748,7 @@
  *                 (each element has an associated key)
  * @param[in] data_size the maximum data zone size (in byte) of the blackboard.
  *                     This is the sum of all data published in the blackboard.
- * @return E_OK if creation succeed E_NOK if failed.
+ * @return BB_OK if creation succeed BB_NOK if failed.
  */
 int32_t 
 bb_create(S_BB_T** bb, 
@@ -717,7 +763,7 @@
  * is detached (through @see bb_detach for example).
  * @param[in,out] bb Pointer to BB pointer.
  *                 Should not be NULL.
- * @return E_OK on success E_NOK otherwise.
+ * @return BB_OK on success BB_NOK otherwise.
  */
 int32_t 
 bb_destroy(S_BB_T** bb);
@@ -733,13 +779,13 @@
 
 /**
  * Lock blackboard.
- * A BlackBoard should be locked befaore any structural change
+ * A BlackBoard should be locked before any structural change
  * or to protect different process against each other from
  * concurrent modifications.
  * This is a blocking call (using sys V semaphore).
  * @see bb_publish/ @see bb_subscribe automatically lock the blackboard.
  * @param[in,out] bb BB pointer, should not be NULL.
- * @return E_OK if lock succeed, E_NOK otherwise.
+ * @return BB_OK if lock succeed, BB_NOK otherwise.
  */
 int32_t 
 bb_lock(volatile S_BB_T* bb);
@@ -747,7 +793,7 @@
 /**
  * Unlock blackboard.
  * @param[in,out] bb BB pointer, should not be NULL.
- * @return E_OK if unlock succeed, E_NOK otherwise.
+ * @return BB_OK if unlock succeed, BB_NOK otherwise.
  */
 int32_t 
 bb_unlock(volatile S_BB_T* bb);
@@ -757,8 +803,8 @@
  * @param[out] bb Pointer to BB pointer (should not be NULL).
  *               the pointed value is updated is BB attach succeed.
  * @param[in] bb_name blackboard name
- * @return  E_OK  if blackboard exists and attach succeed
- *                E_NOK otherwise.
+ * @return  BB_OK  if blackboard exists and attach succeed
+ *                BB_NOK otherwise.
  */
 int32_t 
 bb_attach(S_BB_T** bb, const char* bb_name);
@@ -766,7 +812,7 @@
 /**
  * Detach from blackboard.
  * @param[in,out] bb Pointer to BB pointer (should not be NULL)
- * @return E_OK if blackboard exists and detach succeed E_NOK otherwise.
+ * @return BB_OK if blackboard exists and detach succeed BB_NOK otherwise.
  */
 int32_t 
 bb_detach(S_BB_T** bb);
@@ -845,7 +891,7 @@
  * @param[in,out] bb_shadow pointer to pre-allocated data zone
  *                         which will receive the shadow BB.
  * @param[in] bb_src pointer to source blackboard to be shadowed.
- * @return  E_OK on success E_NOK if not.
+ * @return  BB_OK on success BB_NOK if not.
  */
 int32_t 
 bb_shadow_get(S_BB_T *bb_shadow, volatile S_BB_T *bb_src);
@@ -856,7 +902,7 @@
  * @param[in,out] bb_shadow pointer to shadow BB
  * @param[in] bb_src pointer to source BB (the same BB
  *                   initially used for making shadow)
- * @return E_OK on success.
+ * @return BB_OK on success.
  */
 int32_t 
 bb_shadow_update_data(S_BB_T *bb_shadow, volatile S_BB_T *bb_src);
@@ -876,9 +922,9 @@
  * and lost.
  * @param[in,out] bb pointer to BB
  * @param[in,out] msg pointer to message to be sent
- * @return E_OK on success E_NOK otherwise.
+ * @return the size of the sent message on success, -1 on error.
  */
-int32_t 
+ssize_t
 bb_snd_msg(volatile S_BB_T *bb, S_BB_MSG_T* msg);
 
 
@@ -890,9 +936,9 @@
  *                  The type of the message to be received should be
  *                  be specified on entry in the message structure
  *                  msg->mtype.
- * @return E_OK on success, E_NOK otherwise
+ * @return the size of the sent message on success, -1 on error.
  */
-int32_t 
+ssize_t
 bb_rcv_msg(volatile S_BB_T *bb, S_BB_MSG_T* msg);
 
 /**
@@ -904,7 +950,7 @@
  * @param[in] aliasstack_size the size of the alias stack
  * @param[in] indexstack the index stack 
  * @param[in] indexstack_len the lenth of the index stack
- * @return E_OK on success, E_NOK otherwise
+ * @return BB_OK on success, BB_NOK otherwise
  */
 int32_t
 bb_get_array_name(char * array_name,
@@ -917,7 +963,7 @@
  * Allow the caller to verify if the message queue is
  * still working.
  * @param[in,out] bb pointer to BB.
- * @return E_OK on success, E_NOK otherwise
+ * @return BB_OK on success, BB_NOK otherwise
  */
 int32_t bb_msgq_isalive(S_BB_T *bb);
 
@@ -953,6 +999,19 @@
 
 #endif /* __KERNEL__ */
 
+
+#define NBIT_FOR_MTYPE		(24)
+#define NBIT_FOR_INDEX		(32 - (NBIT_FOR_MTYPE))
+
+#define MTYPE_MASK		((1 << (NBIT_FOR_MTYPE))-1)
+#define MTYPE_INDEX_2_VAL(__mtype, __index)		\
+	(((__index) << NBIT_FOR_MTYPE) |		\
+	 ((__mtype) &   MTYPE_MASK))
+#define VAL_2_MTYPE(__val)			\
+	((__val) & MTYPE_MASK)
+#define VAL_2_INDEX(__val)			\
+	((__val) >> NBIT_FOR_MTYPE)
+
 #ifndef __KERNEL__
 END_C_DECLS
 #endif
diff -urN tsp_orig/src/util/libbb/bb_core_k.c tsp_modified/src/util/libbb/bb_core_k.c
--- tsp_orig/src/util/libbb/bb_core_k.c	2007-04-01 15:17:21.000000000 +0200
+++ tsp_modified/src/util/libbb/bb_core_k.c	2009-01-12 17:26:09.000000000 +0100
@@ -1,6 +1,6 @@
 /*
 
-$Header: /sources/tsp/tsp/src/util/libbb/bb_core_k.c,v 1.3 2007/04/01 13:17:21 deweerdt Exp $
+$Header: /sources/tsp/tsp/src/util/libbb/bb_core_k.c,v 1.9 2008/07/24 13:09:11 jaggy Exp $
 
 -----------------------------------------------------------------------
 
@@ -53,6 +53,8 @@
 #include <linux/highmem.h>
 #include <linux/cdev.h>
 #include <linux/mutex.h>
+#include <linux/device.h>
+#include <linux/connector.h>
 
 #else
 
@@ -62,12 +64,21 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <linux/connector.h>
+#include <linux/netlink.h>
+#include <errno.h>
 
 #endif /* __KERNEL__ */
 
 #include "bb_core.h"
 #include "bb_core_k.h"
 #include "bb_utils.h"
+#include "bb_local.h"
+
+#define MOD_NAME "BB_CORE_K"
+
 
 /* dummy declaration, see the bottom of the file */
 struct bb_operations k_bb_ops;
@@ -121,18 +132,27 @@
 	return BB_OK;
 }
 
-static int k_bb_shmem_detach(S_BB_T ** bb)
+static int k_bb_shmem_detach(S_BB_T ** bb, struct S_BB_LOCAL *local)
 {
 	return BB_OK;
 }
 
 #ifdef __KERNEL__
-static int k_bb_shmem_attach(S_BB_T ** bb, const char *name)
+static int k_bb_shmem_attach(S_BB_T ** bb, struct S_BB_LOCAL *local,
+                             const char *name)
 {
-	return BB_OK;
+	return BB_NOK;
 }
 #else
-static int k_bb_shmem_attach(S_BB_T ** bb, const char *name)
+
+#ifdef  ALLOW_KBB_WRITE_ACCESS_FROM_USERSPACE
+#define MMAP_PROT (PROT_READ | PROT_WRITE)
+#else /* ALLOW_KBB_WRITE_ACCESS_FROM_USERSPACE */
+#define MMAP_PROT (PROT_READ)
+#endif /* ALLOW_KBB_WRITE_ACCESS_FROM_USERSPACE */
+
+static int k_bb_shmem_attach(S_BB_T ** bb, struct S_BB_LOCAL *local,
+                             const char *name)
 {
 	int fd;
 	int shm_size;
@@ -152,7 +172,7 @@
 	munmap(*bb, sizeof(S_BB_T));
 
 	/* ... then remap with the size of the BB + _data_ */
-        *bb = mmap(0, shm_size, PROT_READ, MAP_FILE | MAP_SHARED, fd, 0);
+        *bb = mmap(0, shm_size, MMAP_PROT, MAP_FILE | MAP_SHARED, fd, 0);
         if(*bb == MAP_FAILED) {
 		close(fd);
 		return BB_NOK;
@@ -163,8 +183,9 @@
 #endif /* __KERNEL__ */
 
 #ifdef __KERNEL__
-static int allocate_bb(S_BB_T ** bb, const char *name, int n_data,
-			     int data_size, int create)
+static int allocate_bb(S_BB_T ** bb, struct S_BB_LOCAL *local,
+                       const char *name, int n_data,
+                       int data_size, int create)
 {
 	int shm_size;
 	void *kmalloc_ptr;
@@ -207,29 +228,30 @@
                 (*bb)->data_free_offset = 0;
                 (*bb)->status = BB_STATUS_GENUINE;
                 (*bb)->priv.k.shm_size = shm_size;
-                (*bb)->priv.k.kmalloc_ptr = kmalloc_ptr;
+                local->kmalloc_ptr = kmalloc_ptr;
         }
         (*bb)->type = BB_KERNEL;
 	return BB_OK;
 }
 
-static int k_bb_shmem_get(S_BB_T ** bb, const char *name, int n_data,
-			     int data_size, int create)
+static int k_bb_shmem_get(S_BB_T ** bb, struct S_BB_LOCAL *local,
+                          const char *name, int n_data,
+                          int data_size, int create)
 {
-	struct bb_device *dev;
+	struct bb_device *bb_dev;
 	int err, index;
-	dev_t devno;
+	struct class_device *class;
 
 	/* register and allocate a new character device */
-	dev = kmalloc(sizeof(*dev), GFP_KERNEL);
-	if (!dev) {
+	bb_dev = kmalloc(sizeof(*bb_dev), GFP_KERNEL);
+	if (!bb_dev) {
 		printk("Not enough memory to allocate device\n");
 		return BB_NOK;
 	}
 
-	cdev_init(&dev->cdev, &bb_fops);
-	dev->cdev.owner = THIS_MODULE;
-	dev->cdev.ops = &bb_fops;
+	cdev_init(&bb_dev->cdev, &bb_fops);
+	bb_dev->cdev.owner = THIS_MODULE;
+	bb_dev->cdev.ops = &bb_fops;
 
 	spin_lock(&pdeviceslock);
 	index = find_first_zero_bit(present_devices, BB_DEV_MAX);
@@ -238,7 +260,7 @@
 		goto err_unlock;
 	}
 	set_bit(index, present_devices);
-	err = allocate_bb(bb, name, n_data, data_size, create);
+	err = allocate_bb(bb, local, name, n_data, data_size, create);
 	if (err != BB_OK) {
 		printk("Cannot allocate BB\n");
 		goto err_unlock;
@@ -246,29 +268,47 @@
 	present_bbs[index] = *bb;
 	spin_unlock(&pdeviceslock);
 
-	devno = MKDEV(bb_major, bb_minor + index);
-	err = cdev_add(&dev->cdev, devno, 1);
-	if(err != 0) 
+	bb_dev->devno = MKDEV(bb_major, bb_minor + index);
+	err = cdev_add(&bb_dev->cdev, bb_dev->devno, 1);
+	if(err != 0)
 		goto err_destroy_bb;
+	bb_dev->name = strdup(name);
 
-	printk("New bb device created, major: %d, minor: %d\n",
-				MAJOR(devno), MINOR(devno));
-	dev->bb = *bb;
-	(*bb)->priv.k.dev = dev;
+	if (bb_dev->name == NULL)
+		goto err_destroy_cdev;
+
+	class = class_device_create(bb_dev_class, NULL, bb_dev->devno,
+				    NULL, bb_dev->name);
+
+	if (IS_ERR(class)) {
+		printk ("class_device_create \"%s\" FAILED with errno %ld\n",
+			name, PTR_ERR(class));
+		goto err_free_name_mem;
+	}
+
+	printk("New bb device created, major: %d, minor: %d name: %s\n",
+	       MAJOR(bb_dev->devno), MINOR(bb_dev->devno), bb_dev->name);
+	bb_dev->bb = *bb;
+	local->dev = bb_dev;
 	(*bb)->priv.k.index = index;
 
 	return BB_OK;
 
+err_free_name_mem:
+	kfree(bb_dev->name);
+err_destroy_cdev:
+	cdev_del (&bb_dev->cdev) ;
 err_destroy_bb:
 	bb_destroy(bb);
 err_unlock:
 	spin_unlock(&pdeviceslock);
-	kfree(dev);
+	kfree(bb_dev);
 	return BB_NOK;
 }
 #else
-static int k_bb_shmem_get(S_BB_T ** bb, const char *name, int n_data,
-			     int data_size, int create)
+static int k_bb_shmem_get(S_BB_T ** bb, struct S_BB_LOCAL *local,
+                          const char *name, int n_data,
+                          int data_size, int create)
 {
 	return BB_OK;
 }
@@ -276,11 +316,13 @@
 
 
 #ifdef __KERNEL__
-static int32_t k_bb_shmem_destroy(S_BB_T ** bb)
+static int32_t k_bb_shmem_destroy(S_BB_T ** bb, struct S_BB_LOCAL *local)
 {
 	unsigned long virt_addr;
 
-	cdev_del(&(*bb)->priv.k.dev->cdev);
+	class_device_destroy(bb_dev_class, local->dev->devno);
+	kfree(local->dev->name);
+	cdev_del(&local->dev->cdev);
 	spin_lock(&pdeviceslock);
 	clear_bit((*bb)->priv.k.index, present_devices);
 	spin_unlock(&pdeviceslock);
@@ -291,13 +333,13 @@
 		/* clear all pages */
 		ClearPageReserved(virt_to_page(virt_addr));
 	}
-	kfree((*bb)->priv.k.kmalloc_ptr);
+	kfree(local->kmalloc_ptr);
 	*bb = NULL;
 
 	return BB_OK;
 } /* end of k_bb_shmem_destroy */
 #else
-static int32_t k_bb_shmem_destroy(S_BB_T ** bb)
+static int32_t k_bb_shmem_destroy(S_BB_T ** bb, struct S_BB_LOCAL *local)
 {
 	return BB_OK;
 }
@@ -305,12 +347,162 @@
 
 static int32_t k_bb_msgq_recv(volatile S_BB_T * bb, S_BB_MSG_T * msg)
 {
+#ifdef __KERNEL__
+	return BB_NOK;
+#else /* __KERNEL__ */
+	int s;
+	struct sockaddr_nl l_local;
+	char buf[MAX_SYSMSG_SIZE + sizeof(struct nlmsghdr) + sizeof(struct cn_msg)];
+	struct nlmsghdr *nlmsghdr;
+	struct cn_msg *cn_msg;
+	int len;
+	int recv_ok = 0;
+
+	/* mtype si stored on the NBIT_FOR_MTYPE LSB bits of cb_id.val */
+	if (msg->mtype > MTYPE_MASK)
+		return BB_NOK;
+
+	s = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR);
+	if (s == -1) {
+		bb_logMsg(BB_LOG_SEVERE,"socket failed: ",
+			  strerror (errno));
+		return BB_NOK;
+	}
+	l_local.nl_family = AF_NETLINK;
+	l_local.nl_groups = 1 << (CN_IDX_BB - 1); /* bitmask of requested groups */
+	l_local.nl_pid = 0;
+
+	if (bind(s, (struct sockaddr *)&l_local, sizeof(struct sockaddr_nl)) == -1) {
+		bb_logMsg(BB_LOG_SEVERE,"bind failed: ",
+			  strerror (errno));
+		close(s);
+		return -1;
+	}
+
+	memset(buf, 0, sizeof(buf));
+
+	while (!recv_ok) {
+		len = recv(s, buf, sizeof(buf), 0);
+		if (len == -1) {
+			bb_logMsg(BB_LOG_SEVERE,"recv failed: ",
+				  strerror (errno));
+			close(s);
+			return BB_NOK;
+		}
+
+		nlmsghdr = (struct nlmsghdr *)buf;
+
+		if (nlmsghdr->nlmsg_type != NLMSG_DONE) {
+			bb_logMsg(BB_LOG_SEVERE,"%s", "Error message received.");
+			continue;
+		}
+
+		cn_msg = (struct cn_msg *)NLMSG_DATA(nlmsghdr);
+
+		if (cn_msg->id.val !=
+		    MTYPE_INDEX_2_VAL(msg->mtype, bb->priv.k.index)) {
+			continue;
+		}
+
+		if (cn_msg->id.idx != CN_IDX_BB) {
+			continue;
+		}
+
+		if (cn_msg->len > MAX_SYSMSG_SIZE) {
+			bb_logMsg(BB_LOG_SEVERE, MOD_NAME, "message too long [%d]\n",
+				  cn_msg->len);
+			close (s);
+			return BB_NOK;
+		}
+		memcpy(msg->mtext, cn_msg->data, cn_msg->len);
+		recv_ok = 1;
+	}
+
+
+	close(s);
 	return BB_OK;
-}
+#endif /* __KERNEL__ */
+	}
+
+#ifndef __KERNEL__
+static int netlink_send(int s, struct cn_msg *msg);
+#endif /* __KERNEL__ */
 
 static int32_t k_bb_msgq_send(volatile S_BB_T * bb, S_BB_MSG_T * msg)
 {
+#ifdef __KERNEL__
+	char buf[MAX_SYSMSG_SIZE + sizeof(struct cn_msg)];
+
+	struct cn_msg *cn_msg = (struct cn_msg *)buf;
+	int ret;
+
+	/* mtype si stored on the NBIT_FOR_MTYPE LSB bits of cb_id.val */
+	if (msg->mtype > MTYPE_MASK)
+		return BB_NOK;
+
+	cn_msg->id.idx = CN_IDX_BB;
+	cn_msg->id.val = MTYPE_INDEX_2_VAL(msg->mtype, bb->priv.k.index);
+	cn_msg->seq = 0;
+	cn_msg->ack = 0;
+	cn_msg->len = MAX_SYSMSG_SIZE;
+
+	memcpy (cn_msg->data, msg->mtext, MAX_SYSMSG_SIZE);
+
+	ret = cn_netlink_send(cn_msg, CN_IDX_BB, gfp_any());
+
+	if ( ret < 0 && ret != -ESRCH) {
+		printk ("BB %s : Sending idx [%d] val[0x%08x] FAILED "
+			"with errno %d\n", bb->name,
+			cn_msg->id.idx, cn_msg->id.val, ret);
+		return BB_NOK;
+	}
+
+	return BB_OK;
+#else /* __KERNEL__ */
+	int s;
+	struct sockaddr_nl l_local;
+	char buf[MAX_SYSMSG_SIZE + sizeof(struct cn_msg)];
+	struct cn_msg *cn_msg;
+	int len;
+
+	s = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR);
+	if (s == -1) {
+		bb_logMsg(BB_LOG_SEVERE,"socket failed: ",
+			  strerror (errno));
+		return BB_NOK;
+	}
+	l_local.nl_family = AF_NETLINK;
+	l_local.nl_groups = 1 << (CN_IDX_BB -1); /* bitmask of requested groups */
+	l_local.nl_pid = 0;
+
+	if (bind(s, (struct sockaddr *)&l_local, sizeof(struct sockaddr_nl)) == -1) {
+		bb_logMsg(BB_LOG_SEVERE,"bind failed: ",
+			  strerror (errno));
+		close(s);
+		return -1;
+	}
+
+	cn_msg = (struct cn_msg *)buf;
+
+	cn_msg->id.idx = CN_IDX_BB;
+	cn_msg->id.val = MTYPE_INDEX_2_VAL(msg->mtype, bb->priv.k.index);
+	cn_msg->seq = 0;
+	cn_msg->ack = 0;
+	cn_msg->len = MAX_SYSMSG_SIZE;
+
+	memcpy (cn_msg->data, msg->mtext, MAX_SYSMSG_SIZE);
+
+	len = netlink_send(s, cn_msg);
+
+	if (len == -1) {
+		bb_logMsg(BB_LOG_SEVERE,"send failed: ",
+			  strerror (errno));
+		close(s);
+		return BB_NOK;
+	}
+	close(s);
 	return BB_OK;
+#endif /* __KERNEL__ */
 }
 
 static int32_t k_bb_msgq_isalive(S_BB_T * bb)
@@ -345,3 +537,38 @@
 	.bb_msgq_isalive = k_bb_msgq_isalive,
 	.bb_msgq_destroy = k_bb_msgq_destroy,
 };
+
+
+#ifndef __KERNEL__
+static int seq = 0;
+static int netlink_send(int s, struct cn_msg *msg)
+{
+	struct nlmsghdr *nlh;
+	unsigned int size;
+	int err;
+	char buf[CONNECTOR_MAX_MSG_SIZE];
+	struct cn_msg *m;
+
+	size = NLMSG_SPACE(sizeof(struct cn_msg) + msg->len);
+
+	nlh = (struct nlmsghdr *)buf;
+	nlh->nlmsg_seq = seq++;
+	nlh->nlmsg_pid = getpid();
+	nlh->nlmsg_type = NLMSG_DONE;
+	nlh->nlmsg_len = NLMSG_LENGTH(size - sizeof(*nlh));
+	nlh->nlmsg_flags = 0;
+
+	m = NLMSG_DATA(nlh);
+
+	memcpy(m, msg, sizeof(*m) + msg->len);
+
+	err = send(s, nlh, size, 0);
+	if (err == -1) {
+		bb_logMsg(BB_LOG_SEVERE, "Failed to send: %s [%d].\n",
+			  strerror(errno), errno);
+	}
+
+	return err;
+}
+
+#endif /* __KERNEL__ */
diff -urN tsp_orig/src/util/libbb/bb_core_k.h tsp_modified/src/util/libbb/bb_core_k.h
--- tsp_orig/src/util/libbb/bb_core_k.h	2007-04-01 15:17:21.000000000 +0200
+++ tsp_modified/src/util/libbb/bb_core_k.h	2009-01-12 17:26:09.000000000 +0100
@@ -3,6 +3,8 @@
 
 #define BB_DEV_MAX 128
 
+#include <linux/connector.h>
+
 #ifdef __KERNEL__
 #include <linux/fs.h>
 #include <linux/cdev.h>
@@ -20,16 +22,28 @@
 extern DECLARE_BITMAP(present_devices, BB_DEV_MAX);
 extern spinlock_t pdeviceslock;
 
+extern struct class *bb_dev_class;
+
 struct bb_device {
 	struct S_BB *bb;
 	/* represents the char device, useless in user space */
 	struct cdev cdev;
-	int major;
-	int minor;
+	dev_t devno;
+	char *name;
 };
 
 
 #endif /* __KERNEL__ */
 
+#ifndef CN_IDX_BB
+#define CN_IDX_BB 5   /* idealy defined in kernel/connector.h (done
+		       * since 2.6.27)*/
+#endif /* CN_IDX_BB */
+
+#define INDEX_MAX_VAL		((1 << (NBIT_FOR_INDEX))-1)
+
+#if BB_DEV_MAX > INDEX_MAX_VAL
+#	error Not enought space to store index in id.idx (kernel connectors)
+#endif /* BB_DEV_MAX > INDEX_MAX_VAL */
 
 #endif /* __BB_CORE_K_H__ */
diff -urN tsp_orig/src/util/libbb/bb_core_posix.c tsp_modified/src/util/libbb/bb_core_posix.c
--- tsp_orig/src/util/libbb/bb_core_posix.c	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/bb_core_posix.c	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1,479 @@
+/*
+
+$Header: /sources/tsp/tsp/src/util/libbb/bb_core_posix.c,v 1.4 2008/07/21 11:55:10 jaggy Exp $
+
+-----------------------------------------------------------------------
+
+TSP Library - core components for a generic Transport Sampling Protocol.
+
+Copyright (c) 2006 Eric NOULARD, Frederik DEWEERDT
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+-----------------------------------------------------------------------
+
+Project   : TSP
+Maintainer : tsp@astrium-space.com
+Component : Consumer
+
+-----------------------------------------------------------------------
+
+Purpose   : Blackboard POSIX implementation
+
+Note	  : Most of the code was written by Eric, and was historically
+	    in bb_core.c
+-----------------------------------------------------------------------
+ */
+
+
+#include <errno.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <mqueue.h>
+#include <semaphore.h>
+#include <pthread.h>
+#include <fcntl.h>
+#if !defined(__rtems__) && !defined(VXWORKS)
+#  include <sys/mman.h>
+#endif
+
+#include "bb_core_posix.h"
+#include "bb_core.h"
+#include "bb_utils.h"
+
+
+#define LOG(x, ...)
+
+
+#if defined(__rtems__)
+/* FIXME to implement */
+static int shm_open(const char *name, int oflag, mode_t mode)
+{
+	return 0;
+}
+#endif
+
+struct bb_used_t bb_used[MAX_NUM_OF_BB];
+
+int bb_count = 0;
+
+/* posix rtems ok */
+static int posix_bb_msgq_get(S_BB_T *bb, int create)
+{
+	char *name_msg;
+	int retcode = BB_OK;
+	int oflag = 0 ;
+
+	if (create)
+		oflag = O_CREAT | O_EXCL;
+		name_msg = bb_utils_build_msg_name(bb->name);
+		bb->priv.posix.msg_id = (mqd_t) mq_open( bb_utils_build_msg_name(bb->name),
+											oflag | BB_MSG_ACCESS_RIGHT );
+
+	if (bb->priv.posix.msg_id < 0) {
+		LOG(BB_LOG_SEVERE, "BlackBoard::bb_create", "Cannot message queue %s ", name_msg);
+		retcode = BB_NOK;
+	}
+	//free(name_msg);
+	return retcode;
+}
+
+/* posix rtems ok */
+static int posix_bb_lock(volatile S_BB_T *bb)
+{
+	int32_t retcode;
+
+	assert(bb);
+        
+        /* add because it is present in unlock, so lock is made with no unlock (when shadowed BB), it leads to a provider block ... at least for VxWorks*/
+        /* shadow do not honor locking
+	 * they have neither semaphore nor msgqueue attached
+	 */
+	if (BB_STATUS_SHADOW == bb->status) {
+		return BB_OK;
+	}
+
+	if (-1 == sem_wait(bb->priv.posix.sem_id)) {
+		if (EINVAL == errno) {
+			LOG(BB_LOG_WARNING, "BlackBoard::bb_lock",
+				  "Is BB semaphore destroyed?");
+		} else {
+			LOG(BB_LOG_SEVERE, "BlackBoard::bb_lock",
+				  "sem_open failed");
+		}
+		retcode = BB_NOK;
+	} else {
+		retcode = BB_OK;
+	}
+
+	return retcode;
+}
+
+/* posix rtems ok */
+static int posix_bb_unlock(volatile S_BB_T *bb)
+{
+	int32_t retcode;
+
+
+	/* shadow do not honor locking
+	 * they have neither semaphore nor msgqueue attached
+	 */
+	if (BB_STATUS_SHADOW == bb->status) {
+		return BB_OK;
+	}
+
+	if (-1 == sem_post(bb->priv.posix.sem_id)) {
+		if (EINVAL == errno) {
+			bb_logMsg(BB_LOG_WARNING, "BlackBoard::bb_unlock",
+				  "Is BB semaphore destroyed?");
+		}
+		LOG(BB_LOG_SEVERE, "BlackBoard::bb_unlock",
+			  "semop failed");
+		retcode = BB_NOK;
+	} else {
+		retcode = BB_OK;
+	}
+	return retcode;
+}
+
+/*
+ *	posix_bb_sem_get : posix rtems ok
+ */
+static int posix_bb_sem_get(S_BB_T *bb, int create)
+{
+	int32_t retcode = BB_OK;
+	//char* name_sem = NULL;
+	int oflag = 0;
+
+	if (create)
+		oflag = O_CREAT | O_EXCL;
+
+	//name_sem = bb_utils_build_sem_name(bb->name);
+
+	bb->priv.posix.sem_id = (sem_t *)sem_open(bb_utils_build_sem_name(bb->name),
+											oflag | BB_SEM_ACCESS_RIGHT);
+
+	if ( bb->priv.posix.sem_id < 0) {
+		LOG(BB_LOG_SEVERE, "BlackBoard::bb_create",
+		    "Cannot create semaphore < %s >", name_sem);
+		retcode = BB_NOK;
+	} else {
+		retcode = BB_OK;
+	}
+	return retcode;
+}
+
+/*
+ * Detache le segment de memoire partagee
+ * posix rtems ok
+ */
+static int posix_bb_shmem_detach(S_BB_T ** bb, struct S_BB_LOCAL *local)
+{
+	int32_t retcode = BB_OK;
+	assert(bb);
+	assert(*bb);
+
+#if defined(__rtems__)
+	retcode = shm_unlink((char *)*bb);
+#else
+	free((char *)*bb);
+#endif
+	*bb = NULL;
+	if (!retcode)
+		return BB_OK;
+	else
+		LOG(bb_log_severe, "blackboard::bb_detach","shmem detach failed");
+		return BB_NOK;
+}
+
+/*
+ * posix_bb_shmem_attach : posix Rtems ok
+ */
+static int posix_bb_shmem_attach(S_BB_T ** bb, struct S_BB_LOCAL *local,
+                                 const char *name)
+{
+	int i_bb, fd_shm, retcode;
+	int success = FALSE;
+
+	retcode = BB_OK;
+	fd_shm  = 0;
+
+	for (i_bb = 0; i_bb < bb_count; i_bb++){
+		if ( strncmp((char *)bb_used[i_bb].name, name, BB_NAME_MAX_SIZE + 1) == 0){
+			*bb = bb_used[i_bb].fd;
+			success = TRUE;
+			retcode = BB_OK;
+		}
+	}
+
+	if (!success){
+		LOG(BB_LOG_SEVERE, "BlackBoard::bb_attach", "Cannot find the BB named :%s ", name);
+		retcode = BB_NOK;
+	}
+
+	if ((retcode == BB_OK) && ((void *) -1 == *bb)) {
+		LOG(BB_LOG_SEVERE, "BlackBoard::bb_attach", "Cannot attach shm segment (%s)");
+		retcode = BB_NOK;
+	}
+	return retcode;
+}
+
+/*
+ *	posix_bb_shmem_get : posix rtems ok
+ */
+static int posix_bb_shmem_get(S_BB_T ** bb,
+                              struct S_BB_LOCAL *local,
+			      const char *name,
+			      int n_data,
+			      int data_size,
+			      int create)
+{
+	int i_bb, shm_size;
+	int success = FALSE;
+
+	shm_size = bb_size(n_data, data_size);
+
+	if (create) {
+		if (bb_count == MAX_NUM_OF_BB-1) {
+			LOG(BB_LOG_SEVERE, "BlackBoard::bb_create",
+			  "Max number of BB reached !");
+			return BB_NOK;
+		}
+
+		*bb = (S_BB_T *)malloc(shm_size);
+
+		if (*bb == NULL) {
+			LOG(BB_LOG_SEVERE, "BlackBoard::bb_create",
+			  "Cannot allow memory ");
+			return BB_NOK;
+		}
+
+		/* Init the freshly allocated structure */
+		memset(*bb, 0, shm_size);
+		(*bb)->bb_version_id = BB_VERSION_ID;
+		strncpy((char *)(*bb)->name, name, BB_NAME_MAX_SIZE + 1);
+		(*bb)->max_data_desc_size = n_data;
+		(*bb)->data_desc_offset = sizeof(S_BB_T);
+		(*bb)->n_data = 0;
+		(*bb)->max_data_size = data_size;
+		(*bb)->data_offset = (*bb)->data_desc_offset + ((*bb)->max_data_desc_size) * sizeof(S_BB_DATADESC_T);
+		(*bb)->data_free_offset = 0;
+		(*bb)->status = BB_STATUS_GENUINE;
+		(*bb)->priv.posix.shm_size = shm_size;
+		(*bb)->priv.posix.fd = (int)*bb;
+		(*bb)->type = BB_POSIX;
+
+		/* created BB memorisation */
+		strncpy((char *)bb_used[bb_count].name, name, BB_NAME_MAX_SIZE + 1);
+		bb_used[bb_count].fd   = (S_BB_T *)*bb;
+		bb_count++;
+
+		return BB_OK;
+	}
+
+	/* else look for the corresponding fd */
+	for (i_bb = 0; i_bb < bb_count; i_bb++) {
+		if (!strncmp((char *)bb_used[i_bb].name, name, BB_NAME_MAX_SIZE + 1)) {
+			*bb = bb_used[i_bb].fd;
+			success = TRUE;
+		}
+	}
+
+	if (!success) {
+		LOG(BB_LOG_SEVERE, "BlackBoard::bb_get", "Cannot find the BB named :%s ", name);
+		return BB_NOK;
+	}
+
+	return BB_OK;
+}
+
+/*
+ *	posix_bb_shmem_destroy
+ */
+static int32_t posix_bb_shmem_destroy(S_BB_T ** bb, struct S_BB_LOCAL *local)
+{
+	int32_t retcode = BB_OK;
+	int i_bb, j_bb;
+
+	/*S_BB_MSG_T bb_msg;*/
+
+	/*
+	 * On signale la destruction en cours pour les processes qui
+	 * resteraient attachÃ©s
+	 */
+
+	/* FIXME should reserve a message type for signaling destroy */
+	/*   bb_msg.mtype = 1; */
+	/*   bb_snd_msg(*bb,&bb_msg); */
+	/*   sleep(1); */
+
+	/* Look for the corresponding BB */
+	for (i_bb = 0; i_bb < bb_count; i_bb++){
+		if ( (S_BB_T *)bb_used[i_bb].fd == ((S_BB_T *)(*bb)->priv.posix.fd) ) {
+			if ( i_bb == (MAX_NUM_OF_BB - 1)){
+				/* cas en fin de tab*/
+				bb_used[i_bb].name[0] = '\0';
+				bb_used[i_bb].fd = NULL;
+				bb_count--;
+			} else { // decallage
+				for (j_bb = i_bb; j_bb < bb_count-1; j_bb++){
+					strncpy((char *)bb_used[j_bb].name, (char *)bb_used[j_bb+1].name, BB_NAME_MAX_SIZE + 1);
+					bb_used[j_bb].fd = bb_used[j_bb+1].fd;
+				}
+				bb_count--;
+			}
+		}
+	}
+	free(*bb);
+	*bb = NULL;
+	return retcode;
+} /* end of posix_bb_shmem_destroy */
+
+/*
+ * posix_bb_msgq_recv : posix rtems ok
+ */
+static int32_t posix_bb_msgq_recv(volatile S_BB_T * bb, S_BB_MSG_T * msg)
+{
+	int32_t retcode;
+	int32_t i_cont;
+
+	retcode = BB_OK;
+	assert(bb);
+
+	i_cont = 1;
+	/* RÃ©ception bloquante */
+	while (i_cont) {
+
+		retcode = mq_receive(bb->priv.posix.msg_id, (char *)msg->mtext, MAX_SYSMSG_SIZE, NULL );
+
+		/* On sort de la boucle si on a pas pris un signal */
+		if ((-1 != retcode) || (EINTR != errno)) {
+			i_cont = 0;
+		}
+	}
+	if (-1 == retcode) {
+		retcode = BB_NOK;
+		/* The identifier removed case and INTR
+		 * should not generate a log message
+		 * FIXME on devrait pouvoir faire mieux que Ã§a.
+		 */
+		if ((EIDRM != errno) && (EINTR != errno)) {
+			bb_logMsg(BB_LOG_SEVERE,
+				  "Blackboard::bb_rcv_msg",
+				  "Cannot receive messsage");
+		}
+	}
+	return retcode;
+}
+
+/*
+ * posix_bb_msgq_send : posix rtems ok
+ */
+static int32_t posix_bb_msgq_send(volatile S_BB_T * bb, S_BB_MSG_T * msg)
+{
+	int32_t retcode;
+	struct mq_attr mqstat;
+
+	retcode = BB_OK;
+	assert(bb);
+	/* do not flood message queue if no one read it !! */
+	retcode =  mq_getattr(bb->priv.posix.msg_id, &mqstat);
+
+	if ( !(mqstat.mq_curmsgs * mqstat.mq_msgsize > 2 * MAX_SYSMSG_SIZE) ) {
+		/* Non blocking send */
+		retcode = mq_send( bb->priv.posix.msg_id, (char *)msg->mtext, MAX_SYSMSG_SIZE, 0);
+		if (-1 == retcode) {
+			retcode = BB_NOK;
+			if (EAGAIN == errno) {
+				/*bb_logMsg(BB_LOG_WARNING,
+				   "Blackboard::bb_snd_msg",
+				   "Envoi du message impossible (queue pleine) <%s>",
+				   syserr);
+				 */
+			} else {
+				LOG(BB_LOG_SEVERE,
+				    "Blackboard::bb_snd_msg",
+				    "Cannot send message");
+			}
+		}
+	}
+	return retcode;
+}
+
+/*
+ * posix_bb_msgq_isalive : posix rtems ok
+ */
+static int32_t posix_bb_msgq_isalive(S_BB_T * bb)
+{
+	int32_t retcode;
+	struct mq_attr mqstat;
+
+	retcode =  mq_getattr( bb->priv.posix.msg_id , &mqstat );
+
+	if ( !retcode && mqstat.mq_curmsgs > 0 ) {
+		retcode = BB_NOK;
+	} else {
+		retcode = BB_OK;
+	}
+
+	return retcode;
+}
+
+/*
+ * posix_bb_sem_destroy : posix rtems ok
+ */
+static int posix_bb_sem_destroy(S_BB_T *bb)
+{
+	/* FIXME should the sem be taken before being removed? */
+	/* Remove the bb's semaphore */
+	return sem_destroy( bb->priv.posix.sem_id );
+}
+
+/*
+ * posix_bb_msgq_destroy : posix rtems ok
+ */
+static int posix_bb_msgq_destroy(S_BB_T *bb)
+{
+	char *name_msg;
+	name_msg = bb_utils_build_msg_name(bb->name);
+
+	/* Destroy the bb's message queue */
+	return mq_unlink(name_msg);
+}
+
+
+/*
+ * Structure bb_operations : pointeurs de fonctions
+ */
+struct bb_operations posix_bb_ops = {
+	.bb_shmem_get = posix_bb_shmem_get,
+	.bb_shmem_attach = posix_bb_shmem_attach,
+	.bb_shmem_detach = posix_bb_shmem_detach,
+	.bb_shmem_destroy = posix_bb_shmem_destroy,
+
+	.bb_sem_get = posix_bb_sem_get,
+	.bb_lock = posix_bb_lock,
+	.bb_unlock = posix_bb_unlock,
+	.bb_sem_destroy = posix_bb_sem_destroy,
+
+	.bb_msgq_get = posix_bb_msgq_get,
+	.bb_msgq_send = posix_bb_msgq_send,
+	.bb_msgq_recv = posix_bb_msgq_recv,
+	.bb_msgq_isalive = posix_bb_msgq_isalive,
+	.bb_msgq_destroy = posix_bb_msgq_destroy,
+};
+
diff -urN tsp_orig/src/util/libbb/bb_core_posix.h tsp_modified/src/util/libbb/bb_core_posix.h
--- tsp_orig/src/util/libbb/bb_core_posix.h	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/bb_core_posix.h	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1,52 @@
+/*
+
+$Header: /sources/tsp/tsp/src/util/libbb/bb_core_posix.h,v 1.1 2008/03/16 20:55:00 deweerdt Exp $
+
+-----------------------------------------------------------------------
+
+TSP Library - core components for a generic Transport Sampling Protocol.
+
+Copyright (c) 2006 Eric NOULARD, Frederik DEWEERDT
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+-----------------------------------------------------------------------
+
+Project   : TSP
+Maintainer : tsp@astrium-space.com
+Component : BlackBoard
+
+-----------------------------------------------------------------------
+ */
+#ifndef _BB_CORE_POSIX_H_
+#define _BB_CORE_POSIX_H_
+
+#include <tsp_abs_types.h>
+#include "bb_core.h"
+
+/*
+ *	The maximum number of BlackBoard's
+ */
+#define MAX_NUM_OF_BB	5
+
+struct bb_used_t {
+	char name[BB_NAME_MAX_SIZE+1];
+	S_BB_T *fd;
+};
+
+
+
+
+#endif /* _BB_CORE_POSIX_H_ */
diff -urN tsp_orig/src/util/libbb/bb_core_sysv.c tsp_modified/src/util/libbb/bb_core_sysv.c
--- tsp_orig/src/util/libbb/bb_core_sysv.c	2007-03-01 19:43:35.000000000 +0100
+++ tsp_modified/src/util/libbb/bb_core_sysv.c	2009-01-12 17:26:09.000000000 +0100
@@ -1,6 +1,6 @@
 /*
 
-$Header: /sources/tsp/tsp/src/util/libbb/bb_core_sysv.c,v 1.4 2007/03/01 18:43:35 deweerdt Exp $
+$Header: /sources/tsp/tsp/src/util/libbb/bb_core_sysv.c,v 1.5 2008/07/21 11:55:10 jaggy Exp $
 
 -----------------------------------------------------------------------
 
@@ -175,7 +175,7 @@
 	return BB_NOK;
 }
 
-static int sysv_bb_shmem_detach(S_BB_T ** bb)
+static int sysv_bb_shmem_detach(S_BB_T ** bb, struct S_BB_LOCAL *local)
 {
 	int32_t retcode;
 
@@ -192,7 +192,8 @@
 	*bb = NULL;
 	return retcode;
 }
-static int sysv_bb_shmem_attach(S_BB_T ** bb, const char *name)
+static int sysv_bb_shmem_attach(S_BB_T ** bb, struct S_BB_LOCAL *local,
+                                const char *name)
 {
 	int fd_shm, retcode;
 	char *name_shm;
@@ -237,8 +238,8 @@
 	return retcode;
 
 }
-static int sysv_bb_shmem_get(S_BB_T ** bb, const char *name, int n_data,
-			     int data_size, int create)
+static int sysv_bb_shmem_get(S_BB_T ** bb, struct S_BB_LOCAL *local, const char *name,
+                             int n_data, int data_size, int create)
 {
 	unsigned long flags = 0;
 	char *shm_name;
@@ -293,7 +294,7 @@
 	return BB_NOK;
 }
 
-static int32_t sysv_bb_shmem_destroy(S_BB_T ** bb)
+static int32_t sysv_bb_shmem_destroy(S_BB_T ** bb, struct S_BB_LOCAL *local)
 {
 	int32_t retcode;
 	char *name_shm;
diff -urN tsp_orig/src/util/libbb/bb_local.c tsp_modified/src/util/libbb/bb_local.c
--- tsp_orig/src/util/libbb/bb_local.c	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/bb_local.c	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1,176 @@
+/*
+
+$Header: /sources/tsp/tsp/src/util/libbb/bb_local.c,v 1.3 2008/07/23 15:18:05 jaggy Exp $
+
+-----------------------------------------------------------------------
+
+TSP Library - A way to attach local context to a Blackboard.
+
+Copyright (c) 2008 Jerome Arbez-Gindre
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+-----------------------------------------------------------------------
+
+Project   : TSP
+Maintainer : tsp@astrium-space.com
+Component : BlackBoard
+
+-----------------------------------------------------------------------
+
+Purpose   : BlackBoard Local Data
+
+-----------------------------------------------------------------------
+*/
+
+#include "bb_local.h"
+#include "bb_callback.h"
+
+#define MOD_NAME "BB_LOCAL"
+
+#ifdef __KERNEL__
+
+#include "bb_core_k.h"
+#define fprintf(fd,fmt,pr...) printk(fmt, ## pr)
+
+struct S_BB_LOCAL *present_locals[BB_DEV_MAX] =
+{ [0]			= NULL,
+  [BB_DEV_MAX-1]	= NULL};
+
+#else /* __KERNEL__ */
+struct S_BB_2_LOCAL
+{
+	const struct S_BB *bb;
+	struct S_BB_LOCAL *local;
+};
+
+#define MAX_LOCAL (255)
+static struct S_BB_2_LOCAL bb2local[MAX_LOCAL] =
+{[0]			= {NULL,NULL},
+ [MAX_LOCAL - 1]	= {NULL,NULL}};
+
+#endif /* __KERNEL__ */
+
+static void bb_local_initialize(struct S_BB_LOCAL *local)
+{
+#ifdef __KERNEL__
+	local->kmalloc_ptr = NULL;
+	local->dev = NULL;
+#endif /* __KERNEL__ */
+	local->subscribed = NULL;
+
+	return;
+}
+
+struct S_BB_LOCAL *bb_local_new(void)
+{
+	struct S_BB_LOCAL *local = malloc(sizeof(*local));
+
+	if (local)
+		bb_local_initialize (local);
+	return local;
+}
+
+void bb_local_delete (struct S_BB_LOCAL *local)
+{
+	free(local);
+}
+
+#ifdef __KERNEL__
+
+int32_t bb_attach_local(struct S_BB *bb, struct S_BB_LOCAL *local)
+{
+	if (present_locals[bb->priv.k.index] != NULL)
+		return BB_NOK;
+
+	present_locals[bb->priv.k.index] = local;
+	return BB_OK;
+}
+
+struct S_BB_LOCAL *bb_get_local(const S_BB_T *bb)
+{
+	return present_locals[bb->priv.k.index];
+}
+
+int32_t bb_detach_local(struct S_BB *bb)
+{
+	/* this must be done first (can still use
+	   bb_get_local)*/
+	bb_msg_unsubscribe_all(bb);
+	present_locals[bb->priv.k.index] = NULL;
+	return BB_OK;
+}
+
+#else /* __KERNEL__ */
+
+int32_t bb_attach_local(struct S_BB *bb, struct S_BB_LOCAL *local)
+{
+	int i;
+	struct S_BB_2_LOCAL *free_entry = NULL;
+
+	/* find if a local is already attached to this bb and search a
+	 * free entry */
+	for (i = 0 ; i < MAX_LOCAL ; i++) {
+		if (bb2local[i].bb == bb) {
+			return BB_NOK;
+		}
+		if (bb2local[i].bb == NULL && free_entry == NULL) {
+			free_entry = &bb2local[i];
+		}
+	}
+
+	/* if there's no free_entry... create one */
+	if (free_entry == NULL) {
+		bb_logMsg(BB_LOG_WARNING, MOD_NAME,
+			  "Fail to find a free entry... "
+			  "Consider increase MAX_LOCAL (actually %d)",
+			  MAX_LOCAL);
+		return BB_NOK;
+	}
+
+	free_entry->bb = bb;
+	free_entry->local = local;
+
+	return BB_OK;
+}
+
+struct S_BB_LOCAL *bb_get_local(const S_BB_T *bb)
+{
+	int i;
+	for (i = 0 ; i < MAX_LOCAL ; i++)
+		if (bb2local[i].bb == bb)
+			return bb2local[i].local;
+	return NULL;
+}
+
+int32_t bb_detach_local(struct S_BB *bb)
+{
+#ifndef __KERNEL__
+#define printk printf
+#endif
+	int i;
+	for (i = 0 ; i < MAX_LOCAL ; i++) {
+		if (bb2local[i].bb == bb) {
+			/* this must be done first (can still use
+			 bb_get_local)*/
+			bb_msg_unsubscribe_all(bb);
+			bb2local[i].bb = NULL;
+			return BB_OK;
+		}
+	}
+	return BB_NOK;
+}
+
+#endif /* __KERNEL__ */
diff -urN tsp_orig/src/util/libbb/bb_local.h tsp_modified/src/util/libbb/bb_local.h
--- tsp_orig/src/util/libbb/bb_local.h	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/bb_local.h	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1,102 @@
+/*
+
+$Header: /sources/tsp/tsp/src/util/libbb/bb_local.h,v 1.5 2008/07/23 15:18:05 jaggy Exp $
+
+-----------------------------------------------------------------------
+
+TSP Library - A way to attach local context to a Blackboard.
+
+Copyright (c) 2008 Jerome Arbez-Gindre
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+-----------------------------------------------------------------------
+
+Project   : TSP
+Maintainer : tsp@astrium-space.com
+Component : BlackBoard
+
+-----------------------------------------------------------------------
+
+Purpose   : BlackBoard Local Data
+
+-----------------------------------------------------------------------
+ */
+
+#ifndef _BB_LOCAL_H_
+#define _BB_LOCAL_H_
+
+#include "bb_core.h"
+
+struct S_BB_SUBSCRIBE;
+
+/**
+ * BlackBoard local data descriptor.
+ * Any field declared in S_BB_T is shared between every users which
+ * are attach to this BB.
+ * This structure contains every field which need toi be loacl to a
+ * particular BB user.
+ */
+typedef struct S_BB_LOCAL {
+#ifdef __KERNEL__
+	/** The actual pointer to the allocated memory, this is needed
+	    as the BB must be aligned on a PAGE_SIZE boundary,
+	    kmalloc_ptr is the _real_ start of the allocate memory */
+	void *kmalloc_ptr;
+	/** in-kernel structure, points to the char device */
+	struct bb_device *dev;
+#endif /* __KERNEL__ */
+	/** single chained list to keep track to message
+	    subscribtions */
+	struct S_BB_SUBSCRIBE *subscribed;
+} S_BB_LOCAL_T;
+
+
+/**
+ * A function to create and initiliaze a local structure
+ *
+ * @return a valid pointer if the operation succeeded, NULL otherwise.
+ */
+struct S_BB_LOCAL *bb_local_new(void);
+
+/**
+ * A function to delete a local structure
+ *
+ * @param[in] local a BB local pointer
+ */
+void bb_local_delete(struct S_BB_LOCAL *local);
+
+/**
+ * A function to attach a local structure to a BlackBoard
+ * @param[in] bb a BlackBoard pointer
+ * @return BB_OK is the operation succeeded, BB_NOK otherwise.
+ */
+int32_t bb_attach_local(struct S_BB *bb, struct S_BB_LOCAL *local);
+
+/**
+ * A function to clear local structure attached to a BlackBoard
+ * @param[in] bb a BlackBoard pointer
+ * @return BB_OK is the operation succeeded, BB_NOK otherwise.
+ */
+int32_t bb_detach_local(struct S_BB *bb);
+
+/**
+ * A function to get local structure attached to a BlackBoard
+ * @param[in] bb a BlackBoard pointer
+ * @return BB_OK is the operation succeeded, BB_NOK otherwise.
+ */
+struct S_BB_LOCAL *bb_get_local(const S_BB_T *bb);
+
+#endif /* _BB_LOCAL_H_ */
diff -urN tsp_orig/src/util/libbb/bb_module.c tsp_modified/src/util/libbb/bb_module.c
--- tsp_orig/src/util/libbb/bb_module.c	2007-04-01 15:17:21.000000000 +0200
+++ tsp_modified/src/util/libbb/bb_module.c	2009-01-12 17:26:09.000000000 +0100
@@ -1,6 +1,6 @@
 /*
 
-$Header: /sources/tsp/tsp/src/util/libbb/bb_module.c,v 1.3 2007/04/01 13:17:21 deweerdt Exp $
+$Header: /sources/tsp/tsp/src/util/libbb/bb_module.c,v 1.7 2008/07/24 13:09:11 jaggy Exp $
 
 -----------------------------------------------------------------------
 
@@ -59,11 +59,12 @@
 #include "bb_core.h"
 #include "bb_core_k.h"
 #include "bb_simple.h"
+#include "bb_callback.h"
 
-static int run_test = 1;
+static int run_test = 0;
 module_param(run_test, int, 0);
 
-static struct class *bb_dev_class;
+struct class *bb_dev_class = NULL;
 static dev_t bb_devt;
 int bb_major;
 int bb_minor = 0;
@@ -109,6 +110,9 @@
 	return ret;
 }
 
+static void msg_callback(struct S_BB *bb, void * context,
+			 struct S_BB_MSG *msg);
+
 static struct task_struct *test_thread;
 static int test_running = 0;
 #define MS_TO_JIFFIES(j) ((j * HZ) / 1000)
@@ -117,6 +121,8 @@
 	int *v1, *v2;
 	S_BB_T *test_bb1;
 	S_BB_T *test_bb2;
+	struct S_BB_MSG msg;
+
 
 	bb_create(&test_bb1, "bb_test1", 2, 200);
 	v1 = (int*)bb_simple_publish(test_bb1,"variable","bb_test1", -1, E_BB_INT32, sizeof(int), 1);
@@ -126,11 +132,21 @@
 	*v1 = 0;
 	*v2 = 0;
 
+	msg.mtype = 10;
+	bb_msg_subscribe(test_bb2, "Coucou bb2 10",  &msg, msg_callback);
+
+	msg.mtype = 20;
+	bb_msg_subscribe(test_bb1, "Coucou bb1 20",  &msg, msg_callback);
+
+
 	while(!kthread_should_stop()) {
 		test_running = 1;
 		msleep(1000);
 		*v1=*v1+1;
 		*v2=*v2+1;
+
+		bb_simple_synchro_go(test_bb1, 10);
+		bb_simple_synchro_go(test_bb2, 20);
 	}
 	test_running = 0;
 	bb_destroy(&test_bb1);
@@ -138,6 +154,14 @@
 	return 0;
 }
 
+static void msg_callback(struct S_BB *bb, void* context, struct S_BB_MSG *msg)
+{
+	(void)bb;
+	printk("BB : Received msg (bb [%s] context [%s] mtype [%ld])\n",
+		bb->name, (char *)context, msg->mtype);
+	return;
+}
+
 static int bb_mmap(struct file *filp, struct vm_area_struct *vma)
 {
 
@@ -150,8 +174,8 @@
 	/* sanity check, assert that the user doesn't request more
 	 * than available */
 	if (vsize > (bb->priv.k.shm_size + 2 * PAGE_SIZE)) {
-		printk("mmap requested more than available: %lu > %lu\n", 
-			vsize, bb->priv.k.shm_size + 2 * PAGE_SIZE);
+		printk("mmap requested more than available: %lu > %lu\n",
+		       vsize, bb->priv.k.shm_size + 2 * PAGE_SIZE);
 		return -EINVAL;
 	}
 
@@ -163,8 +187,10 @@
 
 	/* In theory, this could be writeable, at least for root */
 	/* Disable it for now, as this needs testing */
-        if (vma->vm_flags & VM_WRITE)
+#if !defined ALLOW_KBB_WRITE_ACCESS_FROM_USERSPACE
+	if (vma->vm_flags & VM_WRITE)
 		return -EPERM;
+#endif /* !defined ALLOW_KBB_WRITE_ACCESS_FROM_USERSPACE */
 
 
 	/* remap pages to the user's address space */
diff -urN tsp_orig/src/util/libbb/bb_simple.c tsp_modified/src/util/libbb/bb_simple.c
--- tsp_orig/src/util/libbb/bb_simple.c	2007-04-01 15:17:21.000000000 +0200
+++ tsp_modified/src/util/libbb/bb_simple.c	2009-01-12 17:26:09.000000000 +0100
@@ -1,6 +1,6 @@
 /*
 
-$Header: /sources/tsp/tsp/src/util/libbb/bb_simple.c,v 1.16 2007/04/01 13:17:21 deweerdt Exp $
+$Header: /sources/tsp/tsp/src/util/libbb/bb_simple.c,v 1.19 2008/04/01 09:33:17 deweerdt Exp $
 
 -----------------------------------------------------------------------
 
@@ -36,7 +36,13 @@
  */
 #ifndef __KERNEL__
 #include <sys/types.h>
-#include <sys/msg.h>
+
+#if !defined(__rtems__)
+# include <sys/msg.h>
+#else
+# include <mqueue.h>
+#endif /* !__rtems__ */
+
 #include <string.h>
 #endif /* __KERNEL__ */
 
@@ -312,7 +318,7 @@
   retcode = BB_OK;
   
   return retcode;
-} /* end of bb_simple_synchro_go */
+} /* end of bb_simple_thread_synchro_go */
 #endif /* __KERNEL__ */
 
 #ifdef __KERNEL__
@@ -346,7 +352,7 @@
   retcode = BB_OK;
   
   return retcode;
-} /* end of bb_simple_synchro_wait */
+} /* end of bb_simple_thread_synchro_wait */
 #endif /* __KERNEL__ */
 
 #ifdef __KERNEL__
diff -urN tsp_orig/src/util/libbb/bbtools/bb_load tsp_modified/src/util/libbb/bbtools/bb_load
--- tsp_orig/src/util/libbb/bbtools/bb_load	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/bbtools/bb_load	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1,2 @@
+#!/bin/sh
+bb_tools `basename $0` $@
diff -urN tsp_orig/src/util/libbb/bbtools/bb_simu.c tsp_modified/src/util/libbb/bbtools/bb_simu.c
--- tsp_orig/src/util/libbb/bbtools/bb_simu.c	2007-02-11 22:41:11.000000000 +0100
+++ tsp_modified/src/util/libbb/bbtools/bb_simu.c	2009-01-12 17:26:09.000000000 +0100
@@ -1,6 +1,6 @@
 /*
 
-$Header: /sources/tsp/tsp/src/util/libbb/bbtools/bb_simu.c,v 1.11 2007/02/11 21:41:11 erk Exp $
+$Header: /sources/tsp/tsp/src/util/libbb/bbtools/bb_simu.c,v 1.14 2008/05/02 14:55:34 deweerdt Exp $
 
 -----------------------------------------------------------------------
 
@@ -41,21 +41,23 @@
 #include <math.h>
 #include <libgen.h>
 #include <string.h>
+#include <signal.h>
+
 #include <bb_core.h>
 #include <bb_simple.h>
 #include <tsp_abs_types.h>
 
 typedef struct MyInsiderType {
-  int32_t       ai[2];
-  double        f;
+	int32_t ai[2];
+	double f;
 } MyInsiderType_t;
 
 typedef struct MyType {
-  int32_t         a;
-  double          d;
-  uint8_t         byte;
-  MyInsiderType_t insider;
-  MyInsiderType_t insider_array[2];
+	int32_t a;
+	double d;
+	uint8_t byte;
+	MyInsiderType_t insider;
+	MyInsiderType_t insider_array[2];
 } MyType_t;
 
 double *DYN_0_d_qsat;		/* 4 elems */
@@ -73,119 +75,164 @@
     name[i] = (c_type)0; \
   }
 
-int 
-main (int argc, char ** argv) {
+static S_BB_T *mybb;
+static void sigint_handler(int sig)
+{
+	bb_destroy(&mybb);
+}
 
-  /* Définitions des variables */
- 
-  int retcode=0;
-  int data_size;
-  int n_data;
-  uint32_t* display_level;
-  int32_t* Toto;
-  int8_t* aint8;
-  uint8_t* auint8;
-  double* Titi;
-  double* Tata;
-  double* HugeArray;
-  int i;
-  int synchro;
-  S_BB_T* mybb;
-  MyType_t* myvar;
-  char*     astring;
-  /* char      c_opt; */
-
-  /*
-   * Analyse cmd line option
-   * FIXME we should add 
-   *   a option for acknowledged BB mode
-   *   d option for "destroy on exists"
-   */
-  if (EOF != getopt(argc,argv,"s")) {
-    synchro = 1;
-    printf("Run with synchro ACTIVE\n");
-  } else {
-    synchro = 0;
-    printf("Run with synchro INACTIVE\n");
-  }
-  /* Creation BB */
-  /***************/
-  n_data = 1000;
-  data_size = n_data*8 + 500*30*4 + 200000*8;
-  if (BB_NOK==bb_create(&mybb,basename(argv[0]),n_data,data_size)) {
-    bb_attach(&mybb,basename(argv[0]));
-/*     bb_destroy(&mybb); */
-/*     bb_create(&mybb,argv[0],n_data,data_size); */
-  }
+int main(int argc, char **argv)
+{
 
-  /* Publish data in the BB */
-  /**************************/ 
+	/* Définitions des variables */
 
-  display_level = (uint32_t*) bb_simple_publish(mybb,"display_level",basename(argv[0]),-1, E_BB_UINT32, sizeof(uint32_t),1);
-  *display_level = 0;
+	int retcode = 0;
+	int data_size;
+	int n_data;
+	uint32_t *display_level;
+	int32_t *Toto;
+	int8_t *aint8;
+	uint8_t *auint8;
+	double *Titi;
+	double *Tata;
+	double *HugeArray;
+	int i;
+	int synchro = 0;
+	MyType_t *myvar;
+	char *astring;
+	int opt;
+
+	/*
+	 * FIXME we should add
+	 *   -a for acknowledged BB mode
+	 */
+#define USAGE_STRING "Usage: %s [-s] [-x]\n\
+\t\t-s: use synchro\n\
+\t\t-x: destroy bb on exit\n"
+	while ((opt = getopt(argc, argv, "sxh")) != -1) {
+		switch (opt) {
+		case 's':
+			synchro = 1;
+			break;
+		case 'x':
+			signal(SIGINT, sigint_handler);
+			break;
+		case 'h':
+		default:
+			fprintf(stderr, USAGE_STRING, argv[0]);
+			exit(EXIT_FAILURE);
+		}
+	}
 
-  aint8 = (int8_t*) bb_simple_publish(mybb,"int8",basename(argv[0]),-1, E_BB_INT8, sizeof(int8_t),2);
-  auint8 = (uint8_t*) bb_simple_publish(mybb,"uint8",basename(argv[0]),-1, E_BB_UINT8, sizeof(uint8_t),2);
-  
-  myvar = (MyType_t*) bb_simple_publish(mybb,"MyType_t_var",basename(argv[0]),-1, E_BB_USER, sizeof(MyType_t),1);
-
-  /* Now we may alias publish the structure in order to be able 
-   * to distribute the component of the structure using TSP
-   * Note that most of the time we may ignore the return value
-   * since the variable is usable trough the structure itself
-   */
-  bb_simple_alias_publish(mybb,"a","MyType_t_var",basename(argv[0]),-1,E_BB_INT32,
-			  sizeof(int32_t),1,offsetof(MyType_t,a));
-  bb_simple_alias_publish(mybb,"d","MyType_t_var",basename(argv[0]),-1,E_BB_DOUBLE,
-			  sizeof(double),1,offsetof(MyType_t,d));
-  bb_simple_alias_publish(mybb,"byte","MyType_t_var",basename(argv[0]),-1,E_BB_UINT8,
-			  sizeof(uint8_t),1,offsetof(MyType_t,byte));
-
-  /* You may specify USER type in USER type */
-  bb_simple_alias_publish(mybb,"insider","MyType_t_var",basename(argv[0]),-1,E_BB_USER,
-			  sizeof(MyInsiderType_t),1,offsetof(MyType_t,insider));
-
-  /* Now the (in)famous structure in structure i.e. alias of alias example */
-  bb_simple_alias_publish(mybb,"ai","MyType_t_var.insider",basename(argv[0]),-1,E_BB_INT32,
-			  sizeof(int32_t),2,offsetof(MyInsiderType_t,ai));
-
-  bb_simple_alias_publish(mybb,"f","MyType_t_var.insider",basename(argv[0]),-1,E_BB_DOUBLE,
-			  sizeof(double),1,offsetof(MyInsiderType_t,f));
-
-  /* You may even specify ARRAY of USER type in USER type */
-  bb_simple_alias_publish(mybb,"insider_array","MyType_t_var",basename(argv[0]),-1,E_BB_USER,
-			  sizeof(MyInsiderType_t),2,offsetof(MyType_t,insider_array));
-
-  /* Then you should re-specify alias of alias where target alias is an array */
-  bb_simple_alias_publish(mybb,"ai","MyType_t_var.insider_array",basename(argv[0]),-1,E_BB_INT32,
-			  sizeof(int32_t),2,offsetof(MyInsiderType_t,ai));
-
-  bb_simple_alias_publish(mybb,"f","MyType_t_var.insider_array",basename(argv[0]),-1,E_BB_DOUBLE,
-			  sizeof(double),1,offsetof(MyInsiderType_t,f));
-  myvar->a = 1;
-  myvar->d = 3.14159;
-  myvar->byte = 0xFF;
-
-  astring = (char*) bb_simple_publish(mybb,"astring",basename(argv[0]),-1, E_BB_CHAR, sizeof(char),20);
-  strncpy(astring,"A little string",20);
-
-  Toto = (int32_t*) bb_simple_publish(mybb,"Toto",basename(argv[0]),1, E_BB_INT32, sizeof(int32_t),3);  
-  for (i=0;i<3;++i) {
-    Toto[i] = i;
-  }
-  for (i=0;i<3;++i) {
-    printf("@Toto = 0x%x, Toto[%d] = %d\n",(unsigned int)&Toto[i],i,Toto[i]);  
-  }
-  
-  Titi= (double*) bb_simple_publish(mybb,"Titi",basename(argv[0]),1, E_BB_DOUBLE, sizeof(double),1);
-  *Titi = 3.14159;
-  
-  printf("@Titi = 0x%x, Titi = %f\n",(unsigned int)Titi,*Titi);
-  
-  Tata = (double*) bb_simple_publish(mybb,"Tata",basename(argv[0]),1, E_BB_DOUBLE, sizeof(double),9);
-  for (i=0;i<9;++i) {
-    Tata[i] = cos(*Titi/(i+1));
-  }
+	/* Creation BB */
+	n_data = 1000;
+	data_size = n_data * 8 + 500 * 30 * 4 + 200000 * 8;
+	if (BB_NOK == bb_create(&mybb, basename(argv[0]), n_data, data_size)) {
+		bb_attach(&mybb, basename(argv[0]));
+	}
+
+	/* Publish data in the BB */
+	display_level = (uint32_t *) bb_simple_publish(mybb, "display_level",
+						       basename(argv[0]), -1,
+						       E_BB_UINT32, sizeof(uint32_t),
+						       1);
+	*display_level = 0;
+
+	aint8 = (int8_t *) bb_simple_publish(mybb, "int8", basename(argv[0]),
+					     -1, E_BB_INT8, sizeof(int8_t), 2);
+	auint8 = (uint8_t *) bb_simple_publish(mybb, "uint8", basename(argv[0]),
+					       -1, E_BB_UINT8, sizeof(uint8_t),
+					       2);
+
+	myvar = (MyType_t *) bb_simple_publish(mybb, "MyType_t_var",
+					       basename(argv[0]), -1,
+					       E_BB_USER, sizeof(MyType_t), 1);
+
+	/* Now we may alias publish the structure in order to be able 
+	 * to distribute the component of the structure using TSP
+	 * Note that most of the time we may ignore the return value
+	 * since the variable is usable trough the structure itself
+	 */
+	bb_simple_alias_publish(mybb, "a", "MyType_t_var",
+				basename(argv[0]), -1, E_BB_INT32,
+				sizeof(int32_t), 1, offsetof(MyType_t, a));
+	bb_simple_alias_publish(mybb, "d", "MyType_t_var",
+				basename(argv[0]), -1, E_BB_DOUBLE,
+				sizeof(double), 1, offsetof(MyType_t, d));
+	bb_simple_alias_publish(mybb, "byte", "MyType_t_var",
+				basename(argv[0]), -1, E_BB_UINT8,
+				sizeof(uint8_t), 1, offsetof(MyType_t,
+							     byte));
+
+	/* You may specify USER type in USER type */
+	bb_simple_alias_publish(mybb, "insider", "MyType_t_var",
+				basename(argv[0]), -1, E_BB_USER,
+				sizeof(MyInsiderType_t), 1,
+				offsetof(MyType_t, insider));
+
+	/* Now the (in)famous structure in structure i.e. alias of alias example */
+	bb_simple_alias_publish(mybb, "ai", "MyType_t_var.insider",
+				basename(argv[0]), -1, E_BB_INT32,
+				sizeof(int32_t), 2,
+				offsetof(MyInsiderType_t, ai));
+
+	bb_simple_alias_publish(mybb, "f", "MyType_t_var.insider",
+				basename(argv[0]), -1, E_BB_DOUBLE,
+				sizeof(double), 1,
+				offsetof(MyInsiderType_t, f));
+
+	/* You may even specify ARRAY of USER type in USER type */
+	bb_simple_alias_publish(mybb, "insider_array", "MyType_t_var",
+				basename(argv[0]), -1, E_BB_USER,
+				sizeof(MyInsiderType_t), 2,
+				offsetof(MyType_t, insider_array));
+
+	/* Then you should re-specify alias of alias where target alias is an array */
+	bb_simple_alias_publish(mybb, "ai", "MyType_t_var.insider_array",
+				basename(argv[0]), -1, E_BB_INT32,
+				sizeof(int32_t), 2,
+				offsetof(MyInsiderType_t, ai));
+
+	bb_simple_alias_publish(mybb, "f", "MyType_t_var.insider_array",
+				basename(argv[0]), -1, E_BB_DOUBLE,
+				sizeof(double), 1,
+				offsetof(MyInsiderType_t, f));
+	myvar->a = 1;
+	myvar->d = 3.14159;
+	myvar->byte = 0xFF;
+
+	astring =
+	    (char *) bb_simple_publish(mybb, "astring", basename(argv[0]),
+				       -1, E_BB_CHAR, sizeof(char), 20);
+	strncpy(astring, "A little string", 20);
+
+	Toto =
+	    (int32_t *) bb_simple_publish(mybb, "Toto", basename(argv[0]),
+					  1, E_BB_INT32, sizeof(int32_t),
+					  3);
+	for (i = 0; i < 3; ++i) {
+		Toto[i] = i;
+	}
+	for (i = 0; i < 3; ++i) {
+		printf("@Toto = %p, Toto[%d] = %d\n",
+		       &Toto[i], i, Toto[i]);
+	}
+
+	Titi =
+	    (double *) bb_simple_publish(mybb, "Titi", basename(argv[0]),
+					 1, E_BB_DOUBLE, sizeof(double),
+					 1);
+	*Titi = 3.14159;
+
+	printf("@Titi = %p, Titi = %f\n", Titi, *Titi);
+
+	Tata =
+	    (double *) bb_simple_publish(mybb, "Tata", basename(argv[0]),
+					 1, E_BB_DOUBLE, sizeof(double),
+					 9);
+	for (i = 0; i < 9; ++i) {
+		Tata[i] = cos(*Titi / (i + 1));
+	}
 
 #undef HUGE_ARRAY
 #ifdef HUGE_ARRAY
@@ -193,99 +240,107 @@
 #else
 #define BIG_SIZE 250
 #endif
-  HugeArray = (double*) bb_simple_publish(mybb,"HugeArray",basename(argv[0]),1, E_BB_DOUBLE, sizeof(double),BIG_SIZE);
-  if (NULL==HugeArray) {
-    printf("Cannot allocate HUGE array of size %d aborting...\n",BIG_SIZE);
-    return -1;
-  }
-  for (i=0;i<BIG_SIZE;++i) {
-    HugeArray[i] = cos(*Titi/(i+1));
-  }
+	HugeArray =
+	    (double *) bb_simple_publish(mybb, "HugeArray",
+					 basename(argv[0]), 1, E_BB_DOUBLE,
+					 sizeof(double), BIG_SIZE);
+	if (NULL == HugeArray) {
+		printf("Cannot allocate HUGE array of size %d aborting...\n",
+		       BIG_SIZE);
+		return -1;
+	}
+	for (i = 0; i < BIG_SIZE; ++i) {
+		HugeArray[i] = cos(*Titi / (i + 1));
+	}
 
-  BB_PUBLISH(mybb, DYN_0_d_qsat, "", -1, E_BB_DOUBLE, double, 4);
-  BB_PUBLISH(mybb, ORBT_0_d_possat_m, "", -1,  E_BB_DOUBLE, double, 3);
-  BB_PUBLISH(mybb, ECLA_0_d_ecl_sol, "", -1,  E_BB_DOUBLE, double, 1);
-  BB_PUBLISH(mybb, ECLA_0_d_ecl_lune, "", -1,  E_BB_DOUBLE, double, 1);
-  BB_PUBLISH(mybb, POSA_0_d_DirSol, "", -1,  E_BB_DOUBLE, double, 3);
-  BB_PUBLISH(mybb, POSA_0_d_DirLun, "", -1,  E_BB_DOUBLE, double, 3);
-  BB_PUBLISH(mybb, Sequenceur_0_d_t_s, "", -1,  E_BB_DOUBLE, double, 1);
+	BB_PUBLISH(mybb, DYN_0_d_qsat, "", -1, E_BB_DOUBLE, double, 4);
+	BB_PUBLISH(mybb, ORBT_0_d_possat_m, "", -1, E_BB_DOUBLE, double, 3);
+	BB_PUBLISH(mybb, ECLA_0_d_ecl_sol, "", -1, E_BB_DOUBLE, double, 1);
+	BB_PUBLISH(mybb, ECLA_0_d_ecl_lune, "", -1, E_BB_DOUBLE, double, 1);
+	BB_PUBLISH(mybb, POSA_0_d_DirSol, "", -1, E_BB_DOUBLE, double, 3);
+	BB_PUBLISH(mybb, POSA_0_d_DirLun, "", -1, E_BB_DOUBLE, double, 3);
+	BB_PUBLISH(mybb, Sequenceur_0_d_t_s, "", -1, E_BB_DOUBLE, double, 1);
 
-  for (i=0;i<3;++i) {
-    printf("Toto[%d] = %d\n",i,Toto[i]);  
-  }
-  printf("Titi = %f\n",*Titi);
-  for (i=0;i<9;++i) {
-    printf("Tata[%d] = %f\n",i,Tata[i]);  
-  }
-  
-  i = 0;
-  sleep(5);
-  while (i<2000000) {
-    double dq1, dq2, teta, d=7e6 /*km*/;
-    *Sequenceur_0_d_t_s = *Sequenceur_0_d_t_s + 0.01; /* 10 Hz Simu */
-    teta = *Sequenceur_0_d_t_s*2*3.14/100; /* 100s for a complete turn around */
-    ORBT_0_d_possat_m[0] = d*cos(teta); /* simple circular orbit */
-    ORBT_0_d_possat_m[1] = d*sin(teta); /* do better later */
-    ORBT_0_d_possat_m[2] = d*0.0; /* force Z axis is null */
-    dq1 = cos(teta)/4;
-    dq2 = sin(teta)/4;
-    DYN_0_d_qsat[0] = 0.7+dq1;
-    DYN_0_d_qsat[1] = 0.3-dq1;
-    DYN_0_d_qsat[2] = 0.3+dq2;
-    DYN_0_d_qsat[3] = -0.2-dq2;
-    POSA_0_d_DirLun[1] = 0.4; /* e6 */
-    POSA_0_d_DirSol[0] = 0.15; /* e3 */
-    *ECLA_0_d_ecl_lune = 1;
-    *ECLA_0_d_ecl_sol = 1;
-
-
-    Tata[0] = sin((2.0*i)/180.0);
-    Tata[1] = cos((2.0*i)/180.0);
-    Toto[0] = i % 1000;
-    if (0==(i % 100)) {
-      Toto[1] = -Toto[1];
-    }     
-    if ((i % 2) == 0) {
-      bb_lock(mybb);
-      *Titi += 1;
-      if (*display_level & 0x1) {
-	printf("Titi = %f\n",*Titi);
-      }
-      if (*display_level & 0x2) {
-	printf("BB locked <i=%d>\n",i);
-      }
-    } else {
-      *Titi += 1;
-      if (*display_level & 0x1) {
-	printf("Titi = %f\n",*Titi);
-      }
-      bb_unlock(mybb);      
-      if (*display_level & 0x2) {
-	printf("BB unlocked\n");
-      }
-      if (synchro) {
-	if (*display_level & 0x4) {
-	  printf("Synchro GO...");
-	  fflush(stdout);
+	for (i = 0; i < 3; ++i) {
+		printf("Toto[%d] = %d\n", i, Toto[i]);
 	}
-	bb_simple_synchro_go(mybb,BB_SIMPLE_MSGID_SYNCHRO_COPY);
-	if (*display_level & 0x4) {
-	  printf("OK.\n");
+	printf("Titi = %f\n", *Titi);
+	for (i = 0; i < 9; ++i) {
+		printf("Tata[%d] = %f\n", i, Tata[i]);
 	}
-/* 	printf("Synchro Wait..."); */
-/* 	fflush(stdout); */
-/* 	bbntb_synchro_wait(BBNTB_MSGID_SYNCHRO_COPY_ACK); */
-/* 	printf("OK.\n"); */
-/* 	fflush(stdout); */
-      }
-    }
-    usleep(10000);
-    if (++i%100==0) { printf ("."); fflush(stdout); }
-  }
-  
-  /* Destruction BB */
-  /******************/
-  retcode = bb_destroy(&mybb);
 
-  return (retcode);
+	i = 0;
+	sleep(5);
+	while (i < 2000000) {
+		double dq1, dq2, teta, d = 7e6 /*km */ ;
+		*Sequenceur_0_d_t_s = *Sequenceur_0_d_t_s + 0.01;	/* 10 Hz Simu */
+		teta = *Sequenceur_0_d_t_s * 2 * 3.14 / 100;	/* 100s for a complete turn around */
+		ORBT_0_d_possat_m[0] = d * cos(teta);	/* simple circular orbit */
+		ORBT_0_d_possat_m[1] = d * sin(teta);	/* do better later */
+		ORBT_0_d_possat_m[2] = d * 0.0;	/* force Z axis is null */
+		dq1 = cos(teta) / 4;
+		dq2 = sin(teta) / 4;
+		DYN_0_d_qsat[0] = 0.7 + dq1;
+		DYN_0_d_qsat[1] = 0.3 - dq1;
+		DYN_0_d_qsat[2] = 0.3 + dq2;
+		DYN_0_d_qsat[3] = -0.2 - dq2;
+		POSA_0_d_DirLun[1] = 0.4;	/* e6 */
+		POSA_0_d_DirSol[0] = 0.15;	/* e3 */
+		*ECLA_0_d_ecl_lune = 1;
+		*ECLA_0_d_ecl_sol = 1;
+
+
+		Tata[0] = sin((2.0 * i) / 180.0);
+		Tata[1] = cos((2.0 * i) / 180.0);
+		Toto[0] = i % 1000;
+		if (0 == (i % 100)) {
+			Toto[1] = -Toto[1];
+		}
+		if ((i % 2) == 0) {
+			bb_lock(mybb);
+			*Titi += 1;
+			if (*display_level & 0x1) {
+				printf("Titi = %f\n", *Titi);
+			}
+			if (*display_level & 0x2) {
+				printf("BB locked <i=%d>\n", i);
+			}
+		} else {
+			*Titi += 1;
+			if (*display_level & 0x1) {
+				printf("Titi = %f\n", *Titi);
+			}
+			bb_unlock(mybb);
+			if (*display_level & 0x2) {
+				printf("BB unlocked\n");
+			}
+			if (synchro) {
+				if (*display_level & 0x4) {
+					printf("Synchro GO...");
+					fflush(stdout);
+				}
+				bb_simple_synchro_go(mybb, BB_SIMPLE_MSGID_SYNCHRO_COPY);
+				if (*display_level & 0x4) {
+					printf("OK.\n");
+				}
+#if 0
+ 	printf("Synchro Wait...");
+ 	fflush(stdout);
+ 	bbntb_synchro_wait(BBNTB_MSGID_SYNCHRO_COPY_ACK);
+ 	printf("OK.\n");
+ 	fflush(stdout);
+#endif
+			}
+		}
+		usleep(10000);
+		if (++i % 100 == 0) {
+			printf(".");
+			fflush(stdout);
+		}
+	}
+
+	/* Destroy BB */
+	retcode = bb_destroy(&mybb);
+
+	return (retcode);
 }
diff -urN tsp_orig/src/util/libbb/bbtools/bb_tools_main.c tsp_modified/src/util/libbb/bbtools/bb_tools_main.c
--- tsp_orig/src/util/libbb/bbtools/bb_tools_main.c	2007-03-29 22:42:53.000000000 +0200
+++ tsp_modified/src/util/libbb/bbtools/bb_tools_main.c	2009-01-12 17:26:09.000000000 +0100
@@ -1,6 +1,6 @@
 /*
 
-$Header: /sources/tsp/tsp/src/util/libbb/bbtools/bb_tools_main.c,v 1.7 2007/03/29 20:42:53 deweerdt Exp $
+$Header: /sources/tsp/tsp/src/util/libbb/bbtools/bb_tools_main.c,v 1.8 2007/12/08 14:00:22 erk Exp $
 
 -----------------------------------------------------------------------
 
@@ -189,7 +189,7 @@
   bbtools_init(&the_request);
   
   /* Analyse command line parameters */
-  while (opt_ok && (EOF != (c_opt = getopt(argc,argv,"nsvh")))) {    
+  while (opt_ok && (EOF != (c_opt = getopt(argc,argv,"+nsvh")))) {    
     switch (c_opt) {
     case 's':
       the_request.silent  = 1;
diff -urN tsp_orig/src/util/libbb/bbtools/cmakelists.txt tsp_modified/src/util/libbb/bbtools/cmakelists.txt
--- tsp_orig/src/util/libbb/bbtools/cmakelists.txt	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/bbtools/cmakelists.txt	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1,30 @@
+SET(SIMU_SRC bb_simu)
+SET(TOOLS_SRC bb_tools_main)
+
+TSP_XSCRIPT( 
+  bb_findlabel 
+  bb_find
+  bb_dump
+  bb_load
+  bb_read 
+  bb_write
+  bb_check_id 
+  bb_destroy
+  bb_synchro_send 
+  bb_synchro_recv 
+  bb_memset 
+  bb_check_version 
+  bb_publish 
+  bb_create
+  bb_help
+  )
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/util/libbb)
+
+ADD_EXECUTABLE(bb_simu ${SIMU_SRC})
+TARGET_LINK_LIBRARIES(bb_simu bb tsp_common m)
+TSP_PROGRAM_INSTALL(bb_simu)
+
+ADD_EXECUTABLE(bb_tools ${TOOLS_SRC})
+TARGET_LINK_LIBRARIES(bb_tools bb tsp_common)
+TSP_PROGRAM_INSTALL(bb_tools)
diff -urN tsp_orig/src/util/libbb/bbtools/CMakeLists.txt tsp_modified/src/util/libbb/bbtools/CMakeLists.txt
--- tsp_orig/src/util/libbb/bbtools/CMakeLists.txt	2006-10-18 11:58:49.000000000 +0200
+++ tsp_modified/src/util/libbb/bbtools/CMakeLists.txt	1970-01-01 01:00:00.000000000 +0100
@@ -1,29 +0,0 @@
-SET(SIMU_SRC bb_simu)
-SET(TOOLS_SRC bb_tools_main)
-
-TSP_XSCRIPT( 
-  bb_findlabel 
-  bb_find
-  bb_dump
-  bb_read 
-  bb_write
-  bb_check_id 
-  bb_destroy
-  bb_synchro_send 
-  bb_synchro_recv 
-  bb_memset 
-  bb_check_version 
-  bb_publish 
-  bb_create
-  bb_help
-  )
-
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/util/libbb)
-
-ADD_EXECUTABLE(bb_simu ${SIMU_SRC})
-TARGET_LINK_LIBRARIES(bb_simu bb m)
-TSP_PROGRAM_INSTALL(bb_simu)
-
-ADD_EXECUTABLE(bb_tools ${TOOLS_SRC})
-TARGET_LINK_LIBRARIES(bb_tools bb)
-TSP_PROGRAM_INSTALL(bb_tools)
diff -urN tsp_orig/src/util/libbb/bbtools/readme tsp_modified/src/util/libbb/bbtools/readme
--- tsp_orig/src/util/libbb/bbtools/readme	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/bbtools/readme	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1,10 @@
+
+BBTools are sample tools for using BB.
+You may try this:
+
+1) in a first window "bb_simu -s"
+2) in a second window "bb_tsp_provider bb_simu"
+3) in a third window "tsp_gdisp bb_simu.xml localhost"
+4) in a fourth window "tsp_ascii_writer --f=bb_simu.dat --o=bb_simu.out --output_limit 50"
+5) in a fifth (yes you can do it)
+   gnuplot bb_simu.gp
diff -urN tsp_orig/src/util/libbb/bbtools/README tsp_modified/src/util/libbb/bbtools/README
--- tsp_orig/src/util/libbb/bbtools/README	2005-02-23 14:33:26.000000000 +0100
+++ tsp_modified/src/util/libbb/bbtools/README	1970-01-01 01:00:00.000000000 +0100
@@ -1,10 +0,0 @@
-
-BBTools are sample tools for using BB.
-You may try this:
-
-1) in a first window "bb_simu -s"
-2) in a second window "bb_tsp_provider bb_simu"
-3) in a third window "tsp_gdisp bb_simu.xml localhost"
-4) in a fourth window "tsp_ascii_writer --f=bb_simu.dat --o=bb_simu.out --output_limit 50"
-5) in a fifth (yes you can do it)
-   gnuplot bb_simu.gp
diff -urN tsp_orig/src/util/libbb/bb_tools.c tsp_modified/src/util/libbb/bb_tools.c
--- tsp_orig/src/util/libbb/bb_tools.c	2007-03-01 19:45:13.000000000 +0100
+++ tsp_modified/src/util/libbb/bb_tools.c	2009-01-12 17:26:09.000000000 +0100
@@ -1,12 +1,13 @@
 /*
 
-$Header: /sources/tsp/tsp/src/util/libbb/bb_tools.c,v 1.31 2007/03/01 18:45:13 deweerdt Exp $
+$Header: /sources/tsp/tsp/src/util/libbb/bb_tools.c,v 1.37 2008/04/01 15:42:55 deweerdt Exp $
 
 -----------------------------------------------------------------------
 
 TSP Library - core components for a generic Transport Sampling Protocol.
 
 Copyright (c) 2002 Yves DUFRENNE, Stephane GALLES, Eric NOULARD and Robert PAGNOT 
+Copyright (c) 2007 Frederik Deweerdt
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -42,6 +43,8 @@
 #include <string.h>
 #include <libgen.h>
 #include <stdarg.h>
+#define _XOPEN_SOURCE 600
+#include <stdlib.h>
 
 #include <tsp_prjcfg.h>
 #include <bb_core.h>
@@ -50,971 +53,878 @@
 #define BB_TOOLS_C
 #include <bb_tools.h>
 #include <bb_simple.h>
+#ifdef XML2_FOUND
+#include <bb_xml.h>
+#endif
+
+/*for alloca function, see if there is another way,because the list wants BB and TSP to remain independent*/
+
+#include <../common/tsp_common_macros.h>
+
+void bbtools_logMsg(FILE * stream, char *fmt, ...)
+{
+	va_list args;
+	char message[2048];
+
+	memset(message, 0, 2048);
+	va_start(args, fmt);
+	fprintf(stream, "%s::", bbtools_cmdname_tab[E_BBTOOLS_GENERIC]);
+	vfprintf(stream, fmt, args);
+	va_end(args);
+
+}/* end of bbtools_logMsg */
+
+void bbtools_init(bbtools_request_t * req)
+{
+	req->verbose = 0;
+	req->silent = 0;
+	req->argc = 0;
+	req->argv = NULL;
+	req->nb_global_opt = 0;
+	req->cmd = E_BBTOOLS_UNKNOWN;
+	req->stream = stdout;
+	req->bbname = NULL;
+	req->theBB = NULL;
+	req->newline[1] = '\0';
+	req->newline[0] = '\n';
+}/* end of bbtools_init */
+
+E_BBTOOLS_CMD_T bbtools_cmd(const char *bbtools_string)
+{
+
+	E_BBTOOLS_CMD_T retval;
+	int32_t i;
+	char *cmdbasename;
+	char *cmdstr_cpy;
+	char *cmdstr_abbrev;
+
+	cmdstr_cpy = strdup(bbtools_string);
+	cmdbasename = basename(cmdstr_cpy);
+
+	retval = E_BBTOOLS_UNKNOWN;
+
+	/* complete name match */
+	for (i = E_BBTOOLS_GENERIC; i < E_BBTOOLS_LASTCMD; ++i) {
+		if (!strncmp(cmdbasename, bbtools_cmdname_tab[i], strlen(bbtools_cmdname_tab[i]))) {
+			retval = i;
+			break;
+		}
+	}
 
-void 
-bbtools_logMsg(FILE* stream, char* fmt, ...) {
-  va_list args;
-  char    message[2048];
-
-  memset(message,0,2048);
-  va_start(args, fmt);
-  fprintf(stream,"%s::",bbtools_cmdname_tab[E_BBTOOLS_GENERIC]);
-  vfprintf(stream,fmt,args);
-  va_end(args);
-
-} /* end of bbtools_logMsg */
-
-void
-bbtools_init(bbtools_request_t* req) {
-  req->verbose       = 0;
-  req->silent        = 0;
-  req->argc          = 0;
-  req->argv          = NULL;
-  req->nb_global_opt = 0;
-  req->cmd           = E_BBTOOLS_UNKNOWN;
-  req->stream        = stdout;
-  req->bbname        = NULL;
-  req->theBB         = NULL;
-  req->newline[1]    = '\0';
-  req->newline[0]    = '\n';
-}  /* end of bbtools_init */
-
-E_BBTOOLS_CMD_T 
-bbtools_cmd(const char* bbtools_string) {
-
-  E_BBTOOLS_CMD_T retval;
-  int32_t          i;
-  char*           cmdbasename;
-  char*           cmdstr_cpy;
-  char*           cmdstr_abbrev;
-
-  cmdstr_cpy = strdup(bbtools_string);
-  cmdbasename = basename(cmdstr_cpy);
-
-  retval = E_BBTOOLS_UNKNOWN;
-  
-  /* complete name match */
-  for (i=E_BBTOOLS_GENERIC;i<E_BBTOOLS_LASTCMD;++i) {
-    if (!strncmp(cmdbasename,bbtools_cmdname_tab[i],strlen(bbtools_cmdname_tab[i]))) {
-      retval = i;
-      break;
-    }
-  }
-  
-  /* abbreviate name match */
-  /* FIXME should implement partial match */
-  if (E_BBTOOLS_UNKNOWN == retval) {
-    for (i=E_BBTOOLS_GENERIC;i<E_BBTOOLS_LASTCMD;++i) {
-      cmdstr_abbrev = strstr(bbtools_cmdname_tab[i],"_")+1;
-      if (!strncmp(cmdbasename,cmdstr_abbrev,strlen(cmdstr_abbrev))) {
-	retval = i;
-	break;
-      }
-    }
-  }
-
-  free(cmdstr_cpy);
-  return retval;
-} /* end of bbtools_cmd */
-
-E_BBTOOLS_CMD_T
-bbtools_checkargs(bbtools_request_t* req) {
-  E_BBTOOLS_CMD_T retval = E_BBTOOLS_UNKNOWN;
-
-  /* 
-   * Check if we called us with non generic
-   * bb_cmd name
-   */
-  retval = bbtools_cmd(req->argv[0]);
-
-  /* 
-   * If we were call with the generic name
-   * compute bbtools command and shift args in the request.
-   */
-  if ((E_BBTOOLS_GENERIC == retval) && (req->argc - req->nb_global_opt)>1) {
-    retval = bbtools_cmd(req->argv[1+req->nb_global_opt]);
-    /* shift argv */
-    req->argv = &(req->argv[2+req->nb_global_opt]);    
-    /* shift argc since we are in the bb_tools generic call case */
-    req->argc -= 2 + req->nb_global_opt;
-  }  else {
-    /* shift argv */
-    req->argv = &(req->argv[1+req->nb_global_opt]);    
-    /* shift argc since we are in the bb_tools generic call case */
-    req->argc -= 1 + req->nb_global_opt;
-  }
-
-  return retval;
-} /* end of bb_tools_checkargs */
-
-S_BB_T*
-bbtools_checkbbname(const char* bbname) {
-  S_BB_T* retval;
-  retval = NULL;
-  if (bb_attach(&retval,bbname) != BB_OK) {
-    retval = NULL;
-  }  
-  return retval;
-} /* end of bbtools_checkbbname */
-
-
-
-
-int32_t
-bbtools(bbtools_request_t* req) {
-
-  int32_t retval = 0;
-
-  /* Get real bb_tools command */
-  req->cmd = bbtools_checkargs(req);
-
-  if (req->verbose) {
-    bbtools_logMsg(req->stream,
-		   "%s\n",
-		   bbtools_cmdname_tab[req->cmd]);
-  }
-
-  /*
-   * If NOT in those cases we need to open BB 
-   */
-  if (!((E_BBTOOLS_UNKNOWN==req->cmd) || 
-	(E_BBTOOLS_GENERIC==req->cmd) ||  
-	(E_BBTOOLS_HELP   ==req->cmd) ||  
-	(E_BBTOOLS_CHECK_ID==req->cmd) ||
-	(E_BBTOOLS_CREATE ==req->cmd))
-      /* should not try to open BB if the bbname arg is missing */
-      && (req->argc > 0)
-      ) {
-    /* first request arg should be bbname */
-    req->theBB=bbtools_checkbbname(req->argv[0]);    
-    if (NULL == req->theBB) {
-      if (!req->silent) {
-	bbtools_logMsg(req->stream,
-		       "Blackboard <%s> does not exist\n",
-		       req->argv[0]);
-      }
-      return -1;
-    } else { /* assign bbname */
-      req->bbname = req->argv[0];
-    }
-  }
-
-  /* FIXME should assign retval using 
-   * retcode from bb_<cmd>
-   */
-  switch (req->cmd) {
-  case E_BBTOOLS_UNKNOWN:
-    req->stream = stderr;
-    bbtools_usage(req);
-    return -1;
-    break;  
-  case E_BBTOOLS_GENERIC:
-    req->stream = stdout;
-    bbtools_usage(req);
-    break;
-  case E_BBTOOLS_HELP:
-    req->stream = stdout;
-    bbtools_usage(req);
-    return -1;
-    break;  
-  case E_BBTOOLS_READ:    
-    bbtools_read(req);
-    break;
-  case E_BBTOOLS_WRITE:
-    bbtools_write(req);
-    break;
-  case E_BBTOOLS_DUMP:
-    bbtools_dump(req);
-    break;
-  case E_BBTOOLS_FIND:
-    bbtools_find(req);
-    break;
-  case E_BBTOOLS_CHECK_ID:
-    return bbtools_check_id(req);
-    break;
-  case E_BBTOOLS_DESTROY:
-    bbtools_destroy(req);
-    break;
-  case E_BBTOOLS_CREATE:
-    bbtools_create(req);
-    break;
-  case E_BBTOOLS_PUBLISH:
-    bbtools_publish(req);
-    break;
-  case E_BBTOOLS_SYNCHRO_SEND:
-    bbtools_synchro_send(req);
-    break;
-  case E_BBTOOLS_SYNCHRO_RECV:
-    bbtools_synchro_recv(req);
-    break;
-  case E_BBTOOLS_MEMSET:
-    bbtools_memset(req);
-    break;
-  case E_BBTOOLS_CHECK_VERSION:
-    bbtools_check_version(req);
-    break;
-  default:
-    req->stream = stderr;
-    req->cmd    = E_BBTOOLS_UNKNOWN;
-    bbtools_usage(req);
-    return -1;
-    break;
-  }
-
-  if (NULL != req->theBB) {
-    bb_detach(&req->theBB);
-  }
-  return retval;
-} /* end of bbtools */
+	/* abbreviate name match */
+	/* FIXME should implement partial match */
+	if (E_BBTOOLS_UNKNOWN == retval) {
+		for (i = E_BBTOOLS_GENERIC; i < E_BBTOOLS_LASTCMD; ++i) {
+			cmdstr_abbrev = strstr(bbtools_cmdname_tab[i], "_") + 1;
+			if (!strncmp(cmdbasename, cmdstr_abbrev, strlen(cmdstr_abbrev))) {
+				retval = i;
+				break;
+			}
+		}
+	}
+
+	free(cmdstr_cpy);
+	return retval;
+}/* end of bbtools_cmd */
+
+E_BBTOOLS_CMD_T bbtools_checkargs(bbtools_request_t * req)
+{
+	E_BBTOOLS_CMD_T retval = E_BBTOOLS_UNKNOWN;
+
+	/* 
+	 * Check if we called us with non generic
+	 * bb_cmd name
+	 */
+	retval = bbtools_cmd(req->argv[0]);
+
+	/* 
+	 * If we were call with the generic name
+	 * compute bbtools command and shift args in the request.
+	 */
+	if ((E_BBTOOLS_GENERIC == retval) && (req->argc - req->nb_global_opt) > 1) {
+		retval = bbtools_cmd(req->argv[1 + req->nb_global_opt]);
+		/* shift argv */
+		req->argv = &(req->argv[2 + req->nb_global_opt]);
+		/* shift argc since we are in the bb_tools generic call case */
+		req->argc -= 2 + req->nb_global_opt;
+	} else {
+		/* shift argv */
+		req->argv = &(req->argv[1 + req->nb_global_opt]);
+		/* shift argc since we are in the bb_tools generic call case */
+		req->argc -= 1 + req->nb_global_opt;
+	}
+
+	return retval;
+}/* end of bb_tools_checkargs */
+
+S_BB_T *bbtools_checkbbname(const char *bbname)
+{
+	S_BB_T *retval;
+	retval = NULL;
+	if (bb_attach(&retval, bbname) != BB_OK) {
+		retval = NULL;
+	}
+	return retval;
+}/* end of bbtools_checkbbname */
+
+
+
+
+int32_t bbtools(bbtools_request_t * req)
+{
+
+	int32_t retval = 0;
+
+	/* Get real bb_tools command */
+	req->cmd = bbtools_checkargs(req);
+
+	if (req->verbose) {
+		bbtools_logMsg(req->stream, "%s\n", bbtools_cmdname_tab[req->cmd]);
+	}
+
+	/*
+	 * If NOT in those cases we need to open BB 
+	 */
+	if (!((E_BBTOOLS_UNKNOWN == req->cmd) ||
+	      (E_BBTOOLS_GENERIC == req->cmd) || (E_BBTOOLS_HELP == req->cmd) || (E_BBTOOLS_CHECK_ID == req->cmd) || (E_BBTOOLS_LOAD == req->cmd) || (E_BBTOOLS_CREATE == req->cmd))
+	    /* should not try to open BB if the bbname arg is missing */
+	    && (req->argc > 0)
+	    ) {
+		/* first request arg should be bbname */
+		req->theBB = bbtools_checkbbname(req->argv[0]);
+		if (NULL == req->theBB) {
+			if (!req->silent) {
+				bbtools_logMsg(req->stream, "Blackboard <%s> does not exist\n", req->argv[0]);
+			}
+			return -1;
+		} else {	/* assign bbname */
+			req->bbname = req->argv[0];
+		}
+	}
+
+	switch (req->cmd) {
+	case E_BBTOOLS_UNKNOWN:
+		req->stream = stderr;
+		bbtools_usage(req);
+		return -1;
+		break;
+	case E_BBTOOLS_GENERIC:
+		req->stream = stdout;
+		bbtools_usage(req);
+		return -1;
+		break;
+	case E_BBTOOLS_HELP:
+		req->stream = stdout;
+		bbtools_usage(req);
+		return 0;
+		break;
+	case E_BBTOOLS_READ:
+		retval = bbtools_read(req);
+		break;
+	case E_BBTOOLS_WRITE:
+		retval = bbtools_write(req);
+		break;
+	case E_BBTOOLS_DUMP:
+		retval = bbtools_dump(req);
+		break;
+	case E_BBTOOLS_FIND:
+		retval = bbtools_find(req);
+		break;
+	case E_BBTOOLS_CHECK_ID:
+		return bbtools_check_id(req);
+		break;
+	case E_BBTOOLS_DESTROY:
+		retval = bbtools_destroy(req);
+		break;
+	case E_BBTOOLS_CREATE:
+		retval = bbtools_create(req);
+		break;
+	case E_BBTOOLS_PUBLISH:
+		retval = bbtools_publish(req);
+		break;
+	case E_BBTOOLS_SYNCHRO_SEND:
+		retval = bbtools_synchro_send(req);
+		break;
+	case E_BBTOOLS_SYNCHRO_RECV:
+		retval = bbtools_synchro_recv(req);
+		break;
+	case E_BBTOOLS_MEMSET:
+		retval = bbtools_memset(req);
+		break;
+	case E_BBTOOLS_CHECK_VERSION:
+		retval = bbtools_check_version(req);
+		break;
+	case E_BBTOOLS_LOAD:
+		retval = bbtools_load(req);
+		break;
+	default:
+		req->stream = stderr;
+		req->cmd = E_BBTOOLS_UNKNOWN;
+		bbtools_usage(req);
+		return -1;
+		break;
+	}
+
+	if (NULL != req->theBB) {
+		bb_detach(&req->theBB);
+	}
+	return retval;
+}/* end of bbtools */
 
 
 #define BBTOOLS_MAX_BLANK 80
 
-char* bbtools_fillspace(int size, const char* str) {
-  static char myspace[BBTOOLS_MAX_BLANK];
-  int i;
-  for (i=0;i<size-strlen(str);++i) {
-    myspace[i] = ' ';    
-  }
-  myspace[i] = '\0';
-  return myspace;
-} /* end of bbtools_fillspace */
-
-void 
-bbtools_usage(bbtools_request_t* req) {
-
-  int32_t i;
-
-  switch (req->cmd) {
-  case E_BBTOOLS_UNKNOWN:
-    fprintf(req->stream, 
-	    "%s::unknown %s command\n",
-	    bbtools_cmdname_tab[E_BBTOOLS_GENERIC],
-	    bbtools_cmdname_tab[E_BBTOOLS_GENERIC]);	    
-  case E_BBTOOLS_GENERIC:
-  case E_BBTOOLS_HELP:
-    fprintf(req->stream, 
-	    "TSP bb_tools (BB vId=0x%08X, TSP v%s, %s)\n",BB_VERSION_ID,TSP_SOURCE_VERSION,TSP_PROJECT_URL);
-    fprintf(req->stream, 
-	    "Usage: %s [bb_tools_opts] <bb_tools_cmd> [cmd_opts]\n",
-	    bbtools_cmdname_tab[E_BBTOOLS_GENERIC]);
-    fprintf(req->stream,"   bb_tools_opts:\n");
-    fprintf(req->stream,"    -s silent mode (may be used for silent scripting)\n");
-    fprintf(req->stream,"    -v verbose mode\n");
-    fprintf(req->stream,"    -n no newline read mode\n");
-    fprintf(req->stream,"   supported <bb_tools_cmd> are: \n");
-    for (i=E_BBTOOLS_GENERIC+1;i<E_BBTOOLS_LASTCMD;++i) {
-      fprintf(req->stream,
-	      "    %s%s: %s\n",
-	      bbtools_cmdname_tab[i],
-	      bbtools_fillspace(20,bbtools_cmdname_tab[i]),
-	      bbtools_cmdhelp_tab[i]
-	      );
-    }
-    break;
-  case E_BBTOOLS_READ:    
-    fprintf(req->stream,
-	    "Usage: %s <bbname> <symbol_name>\n",
-	    bbtools_cmdname_tab[E_BBTOOLS_READ]);    	    
-    break;    
-  case E_BBTOOLS_WRITE:
-    fprintf(req->stream,
-	    "Usage: %s <bbname> <symbol_name> <value>\n",
-	    bbtools_cmdname_tab[E_BBTOOLS_WRITE]);    	    
-    break;    
-  case E_BBTOOLS_DUMP:
-    fprintf(req->stream,"Usage : %s <bbname>\n",
-	    bbtools_cmdname_tab[E_BBTOOLS_DUMP]);    	    
-    break;
-  case E_BBTOOLS_FIND:
-    fprintf(req->stream,"Usage : %s <bbname> <symbolpattern>\n",
-	    bbtools_cmdname_tab[E_BBTOOLS_FIND]); 
-    break;
-  case E_BBTOOLS_CHECK_ID:
-    	fprintf(req->stream,
-		"Usage: %s <bbname> [<user_specific_value>]\n",
-		bbtools_cmdname_tab[E_BBTOOLS_CHECK_ID]);
-    break;
-  case E_BBTOOLS_DESTROY:
-    fprintf(req->stream,"Usage : %s <bbname>\n",
-	    bbtools_cmdname_tab[E_BBTOOLS_DESTROY]);    	  
-    break;
-  case E_BBTOOLS_CREATE:
-    fprintf(req->stream,"Usage : %s <bbname> <ndata> <datazonesize>\n",
-	    bbtools_cmdname_tab[E_BBTOOLS_CREATE]);  
-    break;
-  case E_BBTOOLS_PUBLISH:
-    fprintf(req->stream,"Usage : %s <bbname> <symbol_name> [<symbol_type>=UINT32] [<arraysize>=1]\n",
-	    bbtools_cmdname_tab[E_BBTOOLS_PUBLISH]);  
-    fprintf(req->stream,"bb_tools publishable types (case insensitive) are :\n");	  
-    fprintf(req->stream,"    INT8,INT16,INT32,INT64\n");
-    fprintf(req->stream,"    UINT8,UINT16,UINT32,UINT64\n");
-    fprintf(req->stream,"    FLOAT,DOUBLE\n");
-    fprintf(req->stream,"    CHAR,UCHAR\n");        
-    break;
-  case E_BBTOOLS_SYNCHRO_SEND:
-    fprintf(req->stream,"Usage : %s <bbname>\n",
-	    bbtools_cmdname_tab[E_BBTOOLS_SYNCHRO_SEND]); 
-    break;
-  case E_BBTOOLS_SYNCHRO_RECV:
-    fprintf(req->stream,"Usage : %s <bbname>\n",
-	    bbtools_cmdname_tab[E_BBTOOLS_SYNCHRO_RECV]); 
-    break;
-  case E_BBTOOLS_MEMSET:
-    fprintf(req->stream,"Usage : %s <bbname> <bytevalue>\n",
-	    bbtools_cmdname_tab[E_BBTOOLS_MEMSET]);   
-    break;
-  case E_BBTOOLS_CHECK_VERSION:
-    fprintf(req->stream,"Usage : %s <bbname>\n",
-	    bbtools_cmdname_tab[E_BBTOOLS_CHECK_VERSION]);   
-    break;
-  default:
-    fprintf(req->stream, 
-	    "default: should never be reached?\n");
-  }
-
-  if ((req->cmd>=E_BBTOOLS_UNKNOWN) &&
-      (req->cmd<E_BBTOOLS_LASTCMD)) {
-    fprintf(req->stream, 
-	    "%s::%s\n",
-	    bbtools_cmdname_tab[req->cmd],
-	    bbtools_cmdhelp_tab[req->cmd]);
-  }
-
-} /* end of bb_tools_usage */
-
-
-int32_t 
-bbtools_unimplemented_cmd(const char* cmdname) {
-
-  bbtools_logMsg(stderr,"<%s> not implemented!\n",
-		 cmdname);
-
-  return -1;
-} /* end of bbtools_unimplemented_cmd */
-
-int32_t 
-bbtools_read(bbtools_request_t* req) {
-  int32_t retval  = 0;
-  S_BB_DATADESC_T sym_data_desc;
-  int32_t array_index[MAX_ALIAS_LEVEL];
-  int32_t array_index_len=MAX_ALIAS_LEVEL;
-  int32_t          aliasstack_size = MAX_ALIAS_LEVEL;
-  S_BB_DATADESC_T  aliasstack[MAX_ALIAS_LEVEL];
-  void *sym_value;
+char *bbtools_fillspace(int size, const char *str)
+{
+	static char myspace[BBTOOLS_MAX_BLANK];
+	int i;
+	for (i = 0; i < size - strlen(str); ++i) {
+		myspace[i] = ' ';
+	}
+	myspace[i] = '\0';
+	return myspace;
+}/* end of bbtools_fillspace */
+
+void bbtools_usage(bbtools_request_t * req)
+{
+
+	int32_t i;
+
+	switch (req->cmd) {
+	case E_BBTOOLS_UNKNOWN:
+		fprintf(req->stream, "%s::unknown %s command\n", bbtools_cmdname_tab[E_BBTOOLS_GENERIC], bbtools_cmdname_tab[E_BBTOOLS_GENERIC]);
+	case E_BBTOOLS_GENERIC:
+	case E_BBTOOLS_HELP:
+		fprintf(req->stream, "TSP bb_tools (BB vId=0x%08X, TSP v%s, %s)\n", BB_VERSION_ID, TSP_SOURCE_VERSION, TSP_PROJECT_URL);
+		fprintf(req->stream, "Usage: %s [bb_tools_opts] <bb_tools_cmd> [cmd_opts]\n", bbtools_cmdname_tab[E_BBTOOLS_GENERIC]);
+		fprintf(req->stream, "   bb_tools_opts:\n");
+		fprintf(req->stream, "    -s silent mode (may be used for silent scripting)\n");
+		fprintf(req->stream, "    -v verbose mode\n");
+		fprintf(req->stream, "    -n no newline read mode\n");
+		fprintf(req->stream, "   supported <bb_tools_cmd> are: \n");
+		for (i = E_BBTOOLS_GENERIC + 1; i < E_BBTOOLS_LASTCMD; ++i) {
+			fprintf(req->stream, "    %s%s: %s\n", bbtools_cmdname_tab[i], bbtools_fillspace(20, bbtools_cmdname_tab[i]), bbtools_cmdhelp_tab[i]
+			    );
+		}
+		break;
+	case E_BBTOOLS_READ:
+		fprintf(req->stream, "Usage: %s <bbname> <symbol_name>\n", bbtools_cmdname_tab[E_BBTOOLS_READ]);
+		break;
+	case E_BBTOOLS_WRITE:
+		fprintf(req->stream, "Usage: %s <bbname> <symbol_name> <value>\n", bbtools_cmdname_tab[E_BBTOOLS_WRITE]);
+		break;
+	case E_BBTOOLS_DUMP:
+		fprintf(req->stream, "Usage : %s <bbname>\n", bbtools_cmdname_tab[E_BBTOOLS_DUMP]);
+		break;
+	case E_BBTOOLS_FIND:
+		fprintf(req->stream, "Usage : %s <bbname> <symbolpattern>\n", bbtools_cmdname_tab[E_BBTOOLS_FIND]);
+		break;
+	case E_BBTOOLS_CHECK_ID:
+		fprintf(req->stream, "Usage: %s <bbname> [<user_specific_value>]\n", bbtools_cmdname_tab[E_BBTOOLS_CHECK_ID]);
+		break;
+	case E_BBTOOLS_DESTROY:
+		fprintf(req->stream, "Usage : %s <bbname>\n", bbtools_cmdname_tab[E_BBTOOLS_DESTROY]);
+		break;
+	case E_BBTOOLS_CREATE:
+		fprintf(req->stream, "Usage : %s <bbname> <ndata> <datazonesize>\n", bbtools_cmdname_tab[E_BBTOOLS_CREATE]);
+		break;
+	case E_BBTOOLS_PUBLISH:
+		fprintf(req->stream, "Usage : %s <bbname> <symbol_name> [<symbol_type>=UINT32] [<arraysize>=1]\n", bbtools_cmdname_tab[E_BBTOOLS_PUBLISH]);
+		fprintf(req->stream, "bb_tools publishable types (case insensitive) are :\n");
+		fprintf(req->stream, "    INT8,INT16,INT32,INT64\n");
+		fprintf(req->stream, "    UINT8,UINT16,UINT32,UINT64\n");
+		fprintf(req->stream, "    FLOAT,DOUBLE\n");
+		fprintf(req->stream, "    CHAR,UCHAR\n");
+		break;
+	case E_BBTOOLS_SYNCHRO_SEND:
+		fprintf(req->stream, "Usage : %s <bbname>\n", bbtools_cmdname_tab[E_BBTOOLS_SYNCHRO_SEND]);
+		break;
+	case E_BBTOOLS_SYNCHRO_RECV:
+		fprintf(req->stream, "Usage : %s <bbname>\n", bbtools_cmdname_tab[E_BBTOOLS_SYNCHRO_RECV]);
+		break;
+	case E_BBTOOLS_MEMSET:
+		fprintf(req->stream, "Usage : %s <bbname> <bytevalue>\n", bbtools_cmdname_tab[E_BBTOOLS_MEMSET]);
+		break;
+	case E_BBTOOLS_CHECK_VERSION:
+		fprintf(req->stream, "Usage : %s <bbname>\n", bbtools_cmdname_tab[E_BBTOOLS_CHECK_VERSION]);
+		break;
+	default:
+		fprintf(req->stream, "default: should never be reached?\n");
+	}
+
+	if ((req->cmd >= E_BBTOOLS_UNKNOWN) && (req->cmd < E_BBTOOLS_LASTCMD)) {
+		fprintf(req->stream, "%s::%s\n", bbtools_cmdname_tab[req->cmd], bbtools_cmdhelp_tab[req->cmd]);
+	}
+
+}/* end of bb_tools_usage */
+
+
+int32_t bbtools_unimplemented_cmd(const char *cmdname)
+{
+
+	bbtools_logMsg(stderr, "<%s> not implemented!\n", cmdname);
+
+	return -1;
+}/* end of bbtools_unimplemented_cmd */
+
+int32_t bbtools_read(bbtools_request_t * req)
+{
+	int32_t retval = 0;
+	S_BB_DATADESC_T sym_data_desc;
+	int32_t array_index[MAX_ALIAS_LEVEL];
+	int32_t array_index_len = MAX_ALIAS_LEVEL;
+	int32_t aliasstack_size = MAX_ALIAS_LEVEL;
+	S_BB_DATADESC_T aliasstack[MAX_ALIAS_LEVEL];
+	void *sym_value;
 #define MSG_SIZE 1024
-  char msg[MSG_SIZE];
-  int32_t nbcar;
-  int32_t i;
-  int32_t j;
-  int32_t idx;
-  char *name = alloca(bb_varname_max_len());
-  
-  if (req->argc<2) {
-    bbtools_logMsg(req->stream,"%s: <%d> argument(s) missing\n",
-		   bbtools_cmdname_tab[E_BBTOOLS_READ],
-		   2-req->argc);
-    bbtools_usage(req);
-    retval = -1;
-    return retval;
-  }
-  memset(&sym_data_desc,0,sizeof(S_BB_DATADESC_T));
-   
-  if (bb_utils_parsearrayname(req->argv[1],
-			      name,
-			      bb_varname_max_len(),
-			      array_index,&array_index_len)) {
-    bbtools_logMsg(req->stream,"%s: cannot parse symname <%s>",
-		   bbtools_cmdname_tab[E_BBTOOLS_READ],
-		   req->argv[1]);
-    retval = -1;
-  } else {
-    bb_set_varname(&sym_data_desc, name);
-    if (req->verbose) {
-      char *n = bb_get_varname(&sym_data_desc);
-      bbtools_logMsg(req->stream,
-          "%s: Trying to read symbol <%s> on blackboard <%s>...\n",
-          bbtools_cmdname_tab[E_BBTOOLS_READ], n, req->bbname);
-      free(n);
-      nbcar = 0;
-      nbcar += snprintf(&msg[nbcar],MSG_SIZE-nbcar,"%s","[");			 
-      for (i=0;i<array_index_len;++i) {
-        nbcar += snprintf(&msg[nbcar],MSG_SIZE-nbcar,"%d ",array_index[i]);
-      }			 
-      nbcar += snprintf(&msg[nbcar],MSG_SIZE-nbcar," %s","]");			 
-      msg[nbcar] = '\0';
-      bbtools_logMsg(req->stream,
-          "%s: array_index_len = <%d> indexes = %s...\n",
-          bbtools_cmdname_tab[E_BBTOOLS_READ],
-          array_index_len,
-          msg);				 
-
-    }
-  }
-	  /* 
-     * Use low-level subscribe in order to discover the 
-     * type of the variable
-     */
-    sym_data_desc.type      = E_BB_DISCOVER;
-    sym_data_desc.type_size = 0;
-    sym_data_desc.dimension = 0;
-    sym_value = bb_alias_subscribe(req->theBB,&sym_data_desc,array_index,array_index_len);    	
-
-    if (NULL==sym_value) {
-      char *n = bb_get_varname(&sym_data_desc);
-      bbtools_logMsg(req->stream,"%s: symbol <%s> not found in BB <%s>\n",
-		     bbtools_cmdname_tab[E_BBTOOLS_READ], n, req->bbname);
-      free(n);
-    } else {
-	 /* the test to determine exeeding array dimension */
-     if (array_index_len>0) {
-			aliasstack[0]=sym_data_desc;
+	char msg[MSG_SIZE];
+	int32_t nbcar;
+	int32_t i;
+	int32_t j;
+	int32_t idx;
+
+	struct classic_printer_priv classic_priv = {.fp = req->stream };
+	struct bb_printer printer = { &classic_priv, &classic_printer_ops };
+        char *name = ALLOCA_ALLOC(bb_varname_max_len());
+
+	if (req->argc < 2) {
+		bbtools_logMsg(req->stream, "%s: <%d> argument(s) missing\n", bbtools_cmdname_tab[E_BBTOOLS_READ], 2 - req->argc);
+		bbtools_usage(req);
+		retval = -1;
+		return retval;
+	}
+	memset(&sym_data_desc, 0, sizeof(S_BB_DATADESC_T));
+
+	if (bb_utils_parsearrayname(req->argv[1], name, bb_varname_max_len(), array_index, &array_index_len)) {
+		bbtools_logMsg(req->stream, "%s: cannot parse symname <%s>", bbtools_cmdname_tab[E_BBTOOLS_READ], req->argv[1]);
+		retval = -1;
+	} else {
+		bb_set_varname(&sym_data_desc, name);
+		if (req->verbose) {
+			char *n = bb_get_varname(&sym_data_desc);
+			bbtools_logMsg(req->stream, "%s: Trying to read symbol <%s> on blackboard <%s>...\n", bbtools_cmdname_tab[E_BBTOOLS_READ], n, req->bbname);
+			free(n);
+			nbcar = 0;
+			nbcar += snprintf(&msg[nbcar], MSG_SIZE - nbcar, "%s", "[");
+			for (i = 0; i < array_index_len; ++i) {
+				nbcar += snprintf(&msg[nbcar], MSG_SIZE - nbcar, "%d ", array_index[i]);
+			}
+			nbcar += snprintf(&msg[nbcar], MSG_SIZE - nbcar, " %s", "]");
+			msg[nbcar] = '\0';
+			bbtools_logMsg(req->stream, "%s: array_index_len = <%d> indexes = %s...\n", bbtools_cmdname_tab[E_BBTOOLS_READ], array_index_len, msg);
+
+		}
+	}
+
+        ALLOCA_FREE(name);
+	/* 
+	 * Use low-level subscribe in order to discover the 
+	 * type of the variable
+	 */
+	sym_data_desc.type = E_BB_DISCOVER;
+	sym_data_desc.type_size = 0;
+	sym_data_desc.dimension = 0;
+	sym_value = bb_alias_subscribe(req->theBB, &sym_data_desc, array_index, array_index_len);
+
+	if (NULL == sym_value) {
+		char *n = bb_get_varname(&sym_data_desc);
+		bbtools_logMsg(req->stream, "%s: symbol <%s> not found in BB <%s>\n", bbtools_cmdname_tab[E_BBTOOLS_READ], n, req->bbname);
+		free(n);
+	} else {
+		/* the test to determine exeeding array dimension */
+		if (array_index_len > 0) {
+			aliasstack[0] = sym_data_desc;
 			bb_find_aliastack(req->theBB, aliasstack, &aliasstack_size);
-			j=aliasstack_size;
-			while ( (aliasstack[j-1].dimension<=1) && (j>0) ){
+			j = aliasstack_size;
+			while ((aliasstack[j - 1].dimension <= 1) && (j > 0)) {
 				--j;
 			}
 		}
-		if ( (array_index_len>0) && (j==0)) {
-			bbtools_logMsg(req->stream,"%s: no array found in aliasstack\n",
-		   				    bbtools_cmdname_tab[E_BBTOOLS_READ]);
-		}
-		else if ( (array_index_len>0) && (aliasstack[j-1].dimension <= array_index[array_index_len-1]) ) {
-			bbtools_logMsg(req->stream,"%s: index <%d> exceeding symbol array dimension <%d>\n",
-		   				   bbtools_cmdname_tab[E_BBTOOLS_READ],
-		       				array_index[array_index_len-1],
-		                	aliasstack[j-1].dimension);
+		if ((array_index_len > 0) && (j == 0)) {
+			bbtools_logMsg(req->stream, "%s: no array found in aliasstack\n", bbtools_cmdname_tab[E_BBTOOLS_READ]);
+		} else if ((array_index_len > 0) && (aliasstack[j - 1].dimension <= array_index[array_index_len - 1])) {
+			bbtools_logMsg(req->stream, "%s: index <%d> exceeding symbol array dimension <%d>\n",
+				       bbtools_cmdname_tab[E_BBTOOLS_READ], array_index[array_index_len - 1], aliasstack[j - 1].dimension);
 		} else {
-		  	if (array_index_len>0) {
-		    	 idx = array_index[array_index_len-1];
-		  	} else {
-		    	idx = 0;
-		  	}
-	  		if (req->verbose) {
-			  bb_data_header_print(sym_data_desc,req->stream,idx,1);
-			  bb_value_print(req->theBB,sym_data_desc,req->stream,array_index,array_index_len);
-			  bb_data_footer_print(sym_data_desc,req->stream,idx,1);
+			if (array_index_len > 0) {
+				idx = array_index[array_index_len - 1];
 			} else {
-			  if ((E_BB_CHAR ==sym_data_desc.type) ||
-			      (E_BB_UCHAR==sym_data_desc.type)) {
-			    bb_string_value_print(req->theBB,sym_data_desc,req->stream,array_index,array_index_len);
-			  } else {
-			    bb_value_print(req->theBB,sym_data_desc,req->stream,array_index,array_index_len);
-			  }
-			  fprintf(req->stream,"%s",req->newline);
+				idx = 0;
+			}
+			if (req->verbose) {
+				printer.ops->bb_data_header_print(&printer, sym_data_desc, idx, 1);
+				printer.ops->bb_value_print(&printer, req->theBB, sym_data_desc, array_index, array_index_len);
+				printer.ops->bb_data_footer_print(&printer, sym_data_desc, idx, 1);
+			} else {
+				if ((E_BB_CHAR == sym_data_desc.type) || (E_BB_UCHAR == sym_data_desc.type)) {
+					printer.ops->bb_string_value_print(&printer, req->theBB, sym_data_desc, array_index, array_index_len);
+				} else {
+					printer.ops->bb_value_print(&printer, req->theBB, sym_data_desc, array_index, array_index_len);
+				}
+				fprintf(req->stream, "%s", req->newline);
+			}
+		}
+	}
+
+	return retval;
+
+}/* end of bbtools_read */
+
+int32_t bbtools_write(bbtools_request_t * req)
+{
+	int32_t retval = 0;
+	S_BB_DATADESC_T sym_data_desc;
+	int32_t array_index[MAX_ALIAS_LEVEL];
+	int32_t array_index_len = MAX_ALIAS_LEVEL;
+	int32_t aliasstack_size = MAX_ALIAS_LEVEL;
+	S_BB_DATADESC_T aliasstack[MAX_ALIAS_LEVEL];
+	void *sym_value;
+	int32_t nbcar;
+	char msg[MSG_SIZE];
+	int32_t i;
+	int32_t j;
+	int32_t idx;
+        char *name = ALLOCA_ALLOC(bb_varname_max_len());
+	/* verify request write arguments */
+	if (req->argc < 3) {
+		bbtools_logMsg(req->stream, "%s: <%d> argument(s) missing\n", bbtools_cmdname_tab[E_BBTOOLS_WRITE], 3 - req->argc);
+		bbtools_usage(req);
+		retval = -1;
+		return retval;
+	}
+
+	/* parse for array name */
+	memset(&sym_data_desc, 0, sizeof(S_BB_DATADESC_T));
+	if (bb_utils_parsearrayname(req->argv[1], name, bb_varname_max_len(), array_index, &array_index_len)) {
+		bbtools_logMsg(req->stream, "%s: cannot parse symname <%s>", bbtools_cmdname_tab[E_BBTOOLS_WRITE], req->argv[1]);
+		retval = -1;
+	} else {
+		bb_set_varname(&sym_data_desc, name);
+		if (req->verbose) {
+			char *n = bb_get_varname(&sym_data_desc);
+			bbtools_logMsg(req->stream, "%s: Trying to write symbol <%s> on blackboard <%s>...\n", bbtools_cmdname_tab[E_BBTOOLS_WRITE], n, req->bbname);
+			free(n);
+			nbcar = 0;
+			nbcar += snprintf(&msg[nbcar], MSG_SIZE - nbcar, "%s", "[");
+			for (i = 0; i < array_index_len; ++i) {
+				nbcar += snprintf(&msg[nbcar], MSG_SIZE - nbcar, "%d ", array_index[i]);
 			}
-		}    
-    }
+			nbcar += snprintf(&msg[nbcar], MSG_SIZE - nbcar, " %s", "]");
+			msg[nbcar] = '\0';
+			bbtools_logMsg(req->stream, "%s: array_index_len = <%d> indexes = %s...\n", bbtools_cmdname_tab[E_BBTOOLS_WRITE], array_index_len, msg);
 
-  return retval;
+		}
+	}
 
-} /* end of bbtools_read */
+        ALLOCA_FREE(name);
+	/* 
+	 * Use low-level subscribe in order to discover the 
+	 * type of the variable
+	 */
+	sym_data_desc.type = E_BB_DISCOVER;
+	sym_data_desc.type_size = 0;
+	sym_data_desc.dimension = 0;
+	sym_value = bb_alias_subscribe(req->theBB, &sym_data_desc, array_index, array_index_len);
+
+	if ((sym_data_desc.dimension > 1) && (0 == array_index_len)) {
+		if (req->verbose) {
+			bbtools_logMsg(req->stream, "%s: Implicit first array element write\n", bbtools_cmdname_tab[E_BBTOOLS_WRITE]);
+
+		}
+		array_index[0] = 0;
+		if (req->verbose) {
+			char *n = bb_get_varname(&sym_data_desc);
+			bbtools_logMsg(req->stream,
+				       "%s: Trying to write index <%d> of array symbol <%s> on blackboard <%s>...\n", bbtools_cmdname_tab[E_BBTOOLS_WRITE], array_index[0], n, req->bbname);
+			free(n);
+		}
+	}
+
+	if (NULL == sym_value) {
+		char *n = bb_get_varname(&sym_data_desc);
+		bbtools_logMsg(req->stream, "%s: symbol <%s> not found in BB <%s>\n", bbtools_cmdname_tab[E_BBTOOLS_WRITE], n, req->bbname);
+		free(n);
+		retval = -1;
+	} else {
+		/* 
+		 * If array index stack is specified then look
+		 * for array in alias stack
+		 */
+		if (array_index_len > 0) {
+			aliasstack[0] = sym_data_desc;
+			bb_find_aliastack(req->theBB, aliasstack, &aliasstack_size);
+			j = aliasstack_size;
+			while ((aliasstack[j - 1].dimension <= 1) && (j > 0)) {
+				--j;
+			}
+		}
+
+		if ((array_index_len > 0) && (j == 0)) {
+			bbtools_logMsg(req->stream, "%s: no array found in aliasstack\n", bbtools_cmdname_tab[E_BBTOOLS_WRITE]);
+			retval = -1;
+		} else if ((array_index_len > 0) && (aliasstack[j - 1].dimension <= array_index[array_index_len - 1])) {
+			bbtools_logMsg(req->stream, "%s: index <%d> exceeds symbol array dimension <%d> whose valid index range is <0..%d>\n",
+				       bbtools_cmdname_tab[E_BBTOOLS_WRITE], array_index[array_index_len - 1], aliasstack[j - 1].dimension, aliasstack[j - 1].dimension - 1);
+		} else {
+			if (array_index_len > 0) {
+				idx = array_index[array_index_len - 1];
+			} else {
+				idx = 0;
+			}
+			if (req->verbose) {
+				bbtools_logMsg(req->stream, "Writing <%s> (at index=%d)\n", req->argv[2], idx);
+			}
+			bb_value_write(req->theBB, sym_data_desc, req->argv[2], array_index, array_index_len);
+		}
+	}
+
+	return retval;
+}/* end of bbtools_write */
+
+#ifdef XML2_FOUND
+int32_t bbtools_load(bbtools_request_t * req)
+{
+	int32_t retcode = 0;
+	int nr_args = 2;
+	if (req->argc < nr_args) {
+		bbtools_logMsg(req->stream, "%s: <%d> argument missing\n", bbtools_cmdname_tab[E_BBTOOLS_LOAD], nr_args - req->argc);
+		bbtools_usage(req);
+		retcode = -1;
+		return retcode;
+	}
+	if (req->verbose) {
+		bbtools_logMsg(req->stream, "%s: load BB <%s>\n", bbtools_cmdname_tab[E_BBTOOLS_LOAD], req->bbname);
+	}
+
+	req->bbname = strdup(req->argv[0]);
+	bb_xml_load_file(req);
+	free(req->bbname);
+	return retcode;
+}
+#else
+int32_t bbtools_load(bbtools_request_t * req)
+{
+	bbtools_logMsg(req->stream, "bb_load needs xml support, please recompile tsp with libxml2\n", bbtools_cmdname_tab[E_BBTOOLS_LOAD], req->bbname);
+	return -1;
+}
+#endif /* XML2_FOUND */
+
+
+int32_t bbtools_dump(bbtools_request_t * req)
+{
+	int32_t retcode = 0;
+	struct classic_printer_priv classic_priv;
+	struct bb_printer printer;
+	char format[BB_PRINTER_OPT_NAME_LEN];
+
+	printer.priv = &classic_priv;
+	classic_priv.fp = req->stream;
+
+	if (req->argc < 1) {
+		bbtools_logMsg(req->stream, "%s: <%d> argument missing\n", bbtools_cmdname_tab[E_BBTOOLS_DUMP], 1 - req->argc);
+		bbtools_usage(req);
+		return -1;
+	}
+	if (req->verbose) {
+		bbtools_logMsg(req->stream, "%s: dump BB <%s>\n", bbtools_cmdname_tab[E_BBTOOLS_DUMP], req->bbname);
+	}
+
+	strcpy(format, "classic");
+	if (req->argc > 1) {
+		strcpy(format, req->argv[1]);
+	}
+	printer.ops = get_printer_ops_from_format(format);
+
+	if (!printer.ops) {
+		bbtools_logMsg(req->stream, "%s: unknown dump format <%s>\n", bbtools_cmdname_tab[E_BBTOOLS_DUMP], format);
+		return -1;
+	}
+
+	retcode = bb_dump(req->theBB, &printer);
+
+	return retcode;
+}/* end of bbtools_dump */
+
+int32_t bbtools_find(bbtools_request_t * req)
+{
+	int32_t retcode = 0;
+	char *varmatch;
+	int32_t i;
+	int32_t nmatch = 0;
+
+	if (req->argc < 2) {
+		bbtools_logMsg(req->stream, "%s: <%d> argument missing\n", bbtools_cmdname_tab[E_BBTOOLS_FIND], 1 - req->argc);
+		bbtools_usage(req);
+		retcode = -1;
+		return retcode;
+	}
+
+	varmatch = strdup(req->argv[1]);
+
+	if (req->verbose) {
+		bbtools_logMsg(req->stream, "%s: find symbol matching <%s> in  BB <%s>\n", bbtools_cmdname_tab[E_BBTOOLS_FIND], varmatch, req->bbname);
+	}
+
+
+	for (i = 0; i < req->theBB->n_data; ++i) {
+		char *n = bb_get_varname(&bb_data_desc(req->theBB)[i]);
+		if (NULL != strstr(n, varmatch)) {
+			fprintf(req->stream, "%s", n);
+			fprintf(req->stream, "%s", req->newline);
+			++nmatch;
+		}
+		free(n);
+	}			/* end for */
+
+	if (req->verbose) {
+		bbtools_logMsg(req->stream, "%s: found <%d> symbol(s) matching <%s> in  BB <%s>\n", bbtools_cmdname_tab[E_BBTOOLS_FIND], nmatch, varmatch, req->bbname);
+	}
+	free(varmatch);
+	return retcode;
+}/* end of bbtools_find */
+
+int32_t bbtools_check_id(bbtools_request_t * req)
+{
+	int32_t retcode = 0;
+	int32_t user_specific_value;
+	char *shm_name;
+	char *sem_name;
+	char *msg_name;
+
+	if (req->argc < 1) {
+		bbtools_logMsg(req->stream, "%s: at least <%d> argument(s) missing\n", bbtools_cmdname_tab[E_BBTOOLS_CHECK_ID], 1 - req->argc);
+		bbtools_usage(req);
+		retcode = -1;
+		return retcode;
+	}
+
+
+	if (req->argc > 1) {
+		user_specific_value = atoi(req->argv[1]);
+	} else {
+		user_specific_value = getuid();
+	}
+	if (req->verbose) {
+		fprintf(stdout, "Computing BB IPC ID for BB <%s> with specific user value <%d>\n", req->argv[0], user_specific_value);
+	}
+
+	shm_name = bb_utils_build_shm_name(req->argv[0]);
+	sem_name = bb_utils_build_sem_name(req->argv[0]);
+	msg_name = bb_utils_build_msg_name(req->argv[0]);
+	bbtools_logMsg(req->stream, "SHM Key [name=<%s>] is 0x%08x\n", shm_name, bb_utils_ntok_user(shm_name, user_specific_value));
+	bbtools_logMsg(req->stream, "SEM Key [name=<%s>] is 0x%08x\n", sem_name, bb_utils_ntok_user(sem_name, user_specific_value));
+	bbtools_logMsg(req->stream, "MSG Key [name=<%s>] is 0x%08x\n", msg_name, bb_utils_ntok_user(msg_name, user_specific_value));
+
+	free(msg_name);
+	free(sem_name);
+	free(shm_name);
+	return retcode;
+}/* end of bbtools_check_id */
+
+int32_t bbtools_destroy(bbtools_request_t * req)
+{
+	int32_t retcode = 0;
+	if (req->argc < 1) {
+		bbtools_logMsg(req->stream, "%s: <%d> argument missing\n", bbtools_cmdname_tab[E_BBTOOLS_DESTROY], 1 - req->argc);
+		bbtools_usage(req);
+		retcode = -1;
+		return retcode;
+	}
+	if (req->verbose) {
+		bbtools_logMsg(req->stream, "%s: destroying BB <%s>\n", bbtools_cmdname_tab[E_BBTOOLS_DESTROY], req->bbname);
+	}
+	retcode = bb_destroy(&(req->theBB));
+	return retcode;
+}/* end of bbtools_destroy */
+
+int32_t bbtools_create(bbtools_request_t * req)
+{
+	int32_t retcode = 0;
+	uint32_t ndata;
+	uint32_t datasize;
+
+	if (req->argc < 2) {
+		bbtools_logMsg(req->stream, "%s: at least <%d> argument(s) missing\n", bbtools_cmdname_tab[E_BBTOOLS_CREATE], 2 - req->argc);
+		bbtools_usage(req);
+		retcode = -1;
+		return retcode;
+	}
+
+	req->bbname = req->argv[0];
+	ndata = atoi(req->argv[1]);
+	if (req->argc > 2) {
+		datasize = atoi(req->argv[2]);
+	} else {
+		datasize = 3 * 8 * ndata;
+	}
+
+	if (req->verbose) {
+		bbtools_logMsg(req->stream, "%s: creating BB <%s> with <%d> elements and <%d> bytes for datazone\n", bbtools_cmdname_tab[E_BBTOOLS_CREATE], req->bbname, ndata, datasize);
+	}
+
+	retcode = bb_create(&(req->theBB), req->bbname, ndata, datasize);
+	if ((retcode != BB_OK) && (req->verbose)) {
+		bbtools_logMsg(req->stream, "%s: creating failed to create BB <%s>\n", bbtools_cmdname_tab[E_BBTOOLS_CREATE], req->bbname);
+	}
+	return retcode;
+}/* end of bbtools_create */
+
+int32_t bbtools_publish(bbtools_request_t * req)
+{
+	int32_t retcode = 0;
+	char *symbol_type_str;
+	S_BB_DATADESC_T symbol_desc;
+	int32_t dimension[MAX_ALIAS_LEVEL];
+
+	memset(&symbol_desc, 0, sizeof(S_BB_DATADESC_T));
+	if (req->argc < 2) {
+		bbtools_logMsg(req->stream, "%s: at least <%d> argument(s) missing\n", bbtools_cmdname_tab[E_BBTOOLS_PUBLISH], 2 - req->argc);
+		bbtools_usage(req);
+		retcode = -1;
+		return retcode;
+	}
+
+	if (req->argc > 2) {
+		symbol_type_str = req->argv[2];
+	} else {
+		symbol_type_str = "UINT32";
+	}
+
+	if (req->argc > 3) {
+		dimension[0] = atoi(req->argv[3]);
+	} else {
+		dimension[0] = 1;
+	}
+
+	if (dimension[0] == -1) {
+		/* default dimension is 1 (scalar) */
+		symbol_desc.dimension = 1;
+	} else {
+		symbol_desc.dimension = dimension[0];
+	}
+	/* copy symbol name */
+	bb_set_varname(&symbol_desc, req->argv[1]);
+	/* find the requested type */
+	symbol_desc.type = bb_type_string2bb_type(symbol_type_str);
+
+	if (req->verbose) {
+		char *n = bb_get_varname(&symbol_desc);
+		bbtools_logMsg(req->stream, "%s: publish symbol <%s> of type <%s> in BB <%s>\n", bbtools_cmdname_tab[E_BBTOOLS_PUBLISH], n, symbol_type_str, req->bbname);
+		free(n);
+	}
+
+	if (symbol_desc.type != 0) {
+		/* guess the type size */
+		if (symbol_desc.type != E_BB_USER) {
+			symbol_desc.type_size = sizeof_bb_type(symbol_desc.type);
+		} else {
+			/* FIXME the user case is not supported */
+			/* @todo */
+			printf("\ntaille d'un alias?\n");
+			symbol_desc.type_size = 1;
+		}
+		/* do we have dimension (array type) */
 
-int32_t 
-bbtools_write(bbtools_request_t* req) {
-  int32_t retval = 0;
-  S_BB_DATADESC_T sym_data_desc;
-  int32_t array_index[MAX_ALIAS_LEVEL];
-  int32_t array_index_len=MAX_ALIAS_LEVEL;
-  int32_t          aliasstack_size = MAX_ALIAS_LEVEL;
-  S_BB_DATADESC_T  aliasstack[MAX_ALIAS_LEVEL];
-  void *sym_value;
-  int32_t nbcar;
-  char msg[MSG_SIZE];
-  int32_t i;
-  int32_t j;
-  int32_t idx;
-  char *name = alloca(bb_varname_max_len());
-
-  /* verify request write arguments */
-  if (req->argc<3) {
-    bbtools_logMsg(req->stream,"%s: <%d> argument(s) missing\n",
-		   bbtools_cmdname_tab[E_BBTOOLS_WRITE],
-		   3-req->argc);
-    bbtools_usage(req);
-    retval = -1;
-    return retval;
-  }
-
-  /* parse for array name */
-  memset(&sym_data_desc,0,sizeof(S_BB_DATADESC_T));
-  if (bb_utils_parsearrayname(req->argv[1],
-			      name,
-			      bb_varname_max_len(),
-			      array_index,&array_index_len)) {
-    bbtools_logMsg(req->stream,"%s: cannot parse symname <%s>",
-		   bbtools_cmdname_tab[E_BBTOOLS_WRITE],
-		   req->argv[1]);
-    retval = -1;
-  } else {
-    bb_set_varname(&sym_data_desc, name);
-    if (req->verbose) {
-      char *n = bb_get_varname(&sym_data_desc);
-      bbtools_logMsg(req->stream,
-		     "%s: Trying to write symbol <%s> on blackboard <%s>...\n",
-		     bbtools_cmdname_tab[E_BBTOOLS_WRITE], n, req->bbname);
-      free(n);
-      nbcar =0;
-      nbcar += snprintf(&msg[nbcar],MSG_SIZE-nbcar,"%s","[");			 
-      for (i=0;i<array_index_len;++i) {
-	nbcar += snprintf(&msg[nbcar],MSG_SIZE-nbcar,"%d ",array_index[i]);
-      }			 
-      nbcar += snprintf(&msg[nbcar],MSG_SIZE-nbcar," %s","]");			 
-      msg[nbcar] = '\0';
-      bbtools_logMsg(req->stream,
-		     "%s: array_index_len = <%d> indexes = %s...\n",
-		     bbtools_cmdname_tab[E_BBTOOLS_WRITE],
-		     array_index_len,
-		     msg);				 
-      
-    }
-  }
-  /* 
-   * Use low-level subscribe in order to discover the 
-   * type of the variable
-   */
-  sym_data_desc.type      = E_BB_DISCOVER;
-  sym_data_desc.type_size = 0;
-  sym_data_desc.dimension = 0;
-  sym_value = bb_alias_subscribe(req->theBB,&sym_data_desc,array_index,array_index_len);    	
-  
-  if ((sym_data_desc.dimension>1) && (0==array_index_len)) {
-    if (req->verbose) {
-      bbtools_logMsg(req->stream,"%s: Implicit first array element write\n",
-		     bbtools_cmdname_tab[E_BBTOOLS_WRITE]);
-      
-    }     
-    array_index[0] = 0;
-    if (req->verbose) {
-      char *n = bb_get_varname(&sym_data_desc);
-      bbtools_logMsg(req->stream,
-		       "%s: Trying to write index <%d> of array symbol <%s> on blackboard <%s>...\n",
-		       bbtools_cmdname_tab[E_BBTOOLS_WRITE], array_index[0], n, req->bbname);
-      free(n);
-    }
-  }
-
-  if (NULL==sym_value) {
-    char *n = bb_get_varname(&sym_data_desc);
-    bbtools_logMsg(req->stream,"%s: symbol <%s> not found in BB <%s>\n",
-		   bbtools_cmdname_tab[E_BBTOOLS_WRITE], n, req->bbname);
-    free(n);
-    retval = -1;
-  } else {
-    /* 
-     * If array index stack is specified then look
-     * for array in alias stack
-     */
-    if (array_index_len>0) {
-      aliasstack[0]=sym_data_desc;
-      bb_find_aliastack(req->theBB, aliasstack, &aliasstack_size);
-      j=aliasstack_size;
-      while ( (aliasstack[j-1].dimension<=1) && (j>0) ){
-	--j;
-      }
-    }
-
-    if ( (array_index_len>0) && (j==0)) {
-      bbtools_logMsg(req->stream,"%s: no array found in aliasstack\n",
-		     bbtools_cmdname_tab[E_BBTOOLS_WRITE]);
-      retval = -1;
-    } else if ( (array_index_len>0) && (aliasstack[j-1].dimension <= array_index[array_index_len-1]) ) {
-      bbtools_logMsg(req->stream,"%s: index <%d> exceeds symbol array dimension <%d> whose valid index range is <0..%d>\n",
-		     bbtools_cmdname_tab[E_BBTOOLS_WRITE],
-		     array_index[array_index_len-1],
-		     aliasstack[j-1].dimension,
-		     aliasstack[j-1].dimension-1);
-    } else {
-      if (array_index_len>0) {
-	idx = array_index[array_index_len-1];
-      } else {
-	idx = 0;
-      }
-      if (req->verbose) {
-	bbtools_logMsg(req->stream,"Writing <%s> (at index=%d)\n",
-		       req->argv[2],idx);	 		 
-      }
-      bb_value_write(req->theBB,sym_data_desc,req->argv[2],array_index,array_index_len);
-    } 
-  }
-  
-  return retval;
-}  /* end of bbtools_write */
-
-int32_t 
-bbtools_dump(bbtools_request_t* req) {
-  int32_t retcode = 0;
-  if (req->argc<1) {
-    bbtools_logMsg(req->stream,"%s: <%d> argument missing\n", 
-		   bbtools_cmdname_tab[E_BBTOOLS_DUMP],
-		   1-req->argc);
-    bbtools_usage(req);
-    retcode = -1;
-    return retcode;
-  }
-  if (req->verbose) {
-    bbtools_logMsg(req->stream,
-		   "%s: dump BB <%s>\n",
-		   bbtools_cmdname_tab[E_BBTOOLS_DUMP],
-		   req->bbname);
-  }
-  retcode = bb_dump(req->theBB,req->stream);
-  return retcode;
-}  /* end of bbtools_dump */
-
-int32_t
-bbtools_find(bbtools_request_t* req) {
-  int32_t    retcode = 0;
-  char*      varmatch;
-  int32_t    i; 
-  int32_t    nmatch = 0;
-
-  if (req->argc<2) {
-    bbtools_logMsg(req->stream,"%s: <%d> argument missing\n", 
-		   bbtools_cmdname_tab[E_BBTOOLS_FIND],
-		   1-req->argc);
-    bbtools_usage(req);
-    retcode = -1;
-    return retcode;
-  }
-
-  varmatch = strdup(req->argv[1]);
-
-  if (req->verbose) {
-    bbtools_logMsg(req->stream,
-		   "%s: find symbol matching <%s> in  BB <%s>\n",
-		   bbtools_cmdname_tab[E_BBTOOLS_FIND],
-		   varmatch,
-		   req->bbname);
-  }
-
-
-  for (i=0; i< req->theBB->n_data;++i) {
-    char *n = bb_get_varname(&bb_data_desc(req->theBB)[i]);
-    if (NULL != strstr(n ,varmatch)) {
-      fprintf(req->stream,"%s",n);
-      fprintf(req->stream,"%s",req->newline);
-      ++nmatch;
-     } 
-    free(n);
-   } /* end for */
-    
-  if (req->verbose) {
-    bbtools_logMsg(req->stream,
-		   "%s: found <%d> symbol(s) matching <%s> in  BB <%s>\n",
-		   bbtools_cmdname_tab[E_BBTOOLS_FIND],
-		   nmatch,
-		   varmatch,
-		   req->bbname);
-  }
-  free(varmatch);
-  return retcode;
-}  /* end of bbtools_find */
-
-int32_t
-bbtools_check_id(bbtools_request_t* req) {
-  int32_t retcode=0;
-  int32_t user_specific_value;
-  char*   shm_name;
-  char*   sem_name;
-  char*   msg_name;
-  
-  if (req->argc<1) {
-    bbtools_logMsg(req->stream,"%s: at least <%d> argument(s) missing\n", 
-		   bbtools_cmdname_tab[E_BBTOOLS_CHECK_ID],
-		   1-req->argc);
-    bbtools_usage(req);
-    retcode = -1;
-    return retcode;
-  }
-
-
-  if (req->argc > 1) {
-    user_specific_value = atoi(req->argv[1]);
-  } else {
-    user_specific_value = getuid();
-  }
-  if (req->verbose) {
-    fprintf(stdout,"Computing BB IPC ID for BB <%s> with specific user value <%d>\n",
-	    req->argv[0],user_specific_value);
-  }
-
-  shm_name = bb_utils_build_shm_name(req->argv[0]);
-  sem_name = bb_utils_build_sem_name(req->argv[0]);
-  msg_name = bb_utils_build_msg_name(req->argv[0]);
-  bbtools_logMsg(req->stream,
-		 "SHM Key [name=<%s>] is 0x%08x\n",
-		 shm_name,
-		 bb_utils_ntok_user(shm_name,user_specific_value));
-  bbtools_logMsg(req->stream,
-		 "SEM Key [name=<%s>] is 0x%08x\n",
-		 sem_name,
-		 bb_utils_ntok_user(sem_name,user_specific_value));
-  bbtools_logMsg(req->stream,
-		 "MSG Key [name=<%s>] is 0x%08x\n",
-		 msg_name,
-		 bb_utils_ntok_user(msg_name,user_specific_value));
-  
-  free(msg_name);
-  free(sem_name);    
-  free(shm_name);
-  return  retcode;
-} /* end of bbtools_check_id */
-
-int32_t
-bbtools_destroy(bbtools_request_t* req) {
-  int32_t retcode = 0;
-  if (req->argc<1) {
-    bbtools_logMsg(req->stream,"%s: <%d> argument missing\n", 
-		   bbtools_cmdname_tab[E_BBTOOLS_DESTROY],
-		   1-req->argc);
-    bbtools_usage(req);
-    retcode = -1;
-    return retcode;
-  }
-  if (req->verbose) {
-    bbtools_logMsg(req->stream,
-		   "%s: destroying BB <%s>\n",
-		   bbtools_cmdname_tab[E_BBTOOLS_DESTROY],
-		   req->bbname);
-  }
-  retcode = bb_destroy(&(req->theBB));
-  return retcode;
-}  /* end of bbtools_destroy */
-
-int32_t
-bbtools_create(bbtools_request_t* req) {
-  int32_t retcode = 0;
-  uint32_t ndata;
-  uint32_t datasize;
-
-  if (req->argc<2) {
-    bbtools_logMsg(req->stream,"%s: at least <%d> argument(s) missing\n", 
-		   bbtools_cmdname_tab[E_BBTOOLS_CREATE],
-		   2-req->argc);
-    bbtools_usage(req);
-    retcode = -1;
-    return retcode;
-  }
-
-  req->bbname = req->argv[0];
-  ndata =  atoi(req->argv[1]);
-  if (req->argc>2) {
-    datasize =  atoi(req->argv[2]);
-  } else {
-    datasize = 3*8*ndata;
-  }
-
-  if (req->verbose) {
-    bbtools_logMsg(req->stream,
-		   "%s: creating BB <%s> with <%d> elements and <%d> bytes for datazone\n",
-		   bbtools_cmdname_tab[E_BBTOOLS_CREATE],
-		   req->bbname,
-			 ndata,
-			 datasize);
-  }
- 
-  retcode = bb_create(&(req->theBB),req->bbname,ndata,datasize);
-  if ((retcode != BB_OK) && (req->verbose)) {
-    bbtools_logMsg(req->stream,
-		   "%s: creating failed to create BB <%s>\n",
-		   bbtools_cmdname_tab[E_BBTOOLS_CREATE],
-		   req->bbname);
-  }
-  return retcode;
-}  /* end of bbtools_create */
-
-int32_t
-bbtools_publish(bbtools_request_t* req) {
-  int32_t retcode = 0;
-  char* symbol_type_str;
-  S_BB_DATADESC_T  symbol_desc;
-  int32_t dimension[MAX_ALIAS_LEVEL];
-
-  memset(&symbol_desc,0,sizeof(S_BB_DATADESC_T));
-  if (req->argc<2) {
-    bbtools_logMsg(req->stream,"%s: at least <%d> argument(s) missing\n", 
-		   bbtools_cmdname_tab[E_BBTOOLS_PUBLISH],
-		   2-req->argc);
-    bbtools_usage(req);
-    retcode = -1;
-    return retcode;
-  }
-  
-  if (req->argc>2) {
-    symbol_type_str = req->argv[2];
-  } else {
-    symbol_type_str = "UINT32";
-  }
-
-  if (req->argc > 3) {
-    dimension[0] = atoi(req->argv[3]);
-  } else {
-    dimension[0] = 1;
-  }
-
-  if (dimension[0]==-1) {
-    /* default dimension is 1 (scalar) */
-    symbol_desc.dimension = 1;
-  } else {
-    symbol_desc.dimension = dimension[0];
-  }
-  /* copy symbol name */
-  bb_set_varname(&symbol_desc,req->argv[1]);
-  /* find the requested type */
-  symbol_desc.type = bb_type_string2bb_type(symbol_type_str);
-
-  if (req->verbose) {
-    char *n = bb_get_varname(&symbol_desc);
-    bbtools_logMsg(req->stream,
-		   "%s: publish symbol <%s> of type <%s> in BB <%s>\n",
-		   bbtools_cmdname_tab[E_BBTOOLS_PUBLISH], n,
-		   symbol_type_str,
-		   req->bbname);
-    free(n);
-  }
-
-  if (symbol_desc.type!=0) {
-    /* guess the type size */
-    if (symbol_desc.type != E_BB_USER) {
-      symbol_desc.type_size = sizeof_bb_type(symbol_desc.type);
-    } else {
-      /* FIXME the user case is not supported */
-      /* @todo */
-      printf("\ntaille d'un alias?\n");
-      symbol_desc.type_size = 1;
-    }
-    /* do we have dimension (array type) */
-        
-    bb_publish(req->theBB,&symbol_desc);
-  } else {
-    bbtools_logMsg(req->stream,
-		   "%s: publish FAILED unrecognized bb_type: <%s>\n",
-		   bbtools_cmdname_tab[E_BBTOOLS_PUBLISH],
-		   symbol_type_str);
-  }
-
-  return retcode;
-} /* end of bbtools_publish */
-
-int32_t
-bbtools_synchro_send(bbtools_request_t* req) {
-  int32_t retcode = 0;
-  if (req->argc<1) {
-    bbtools_logMsg(req->stream,"%s: <%d> argument missing\n", 
-		   bbtools_cmdname_tab[E_BBTOOLS_SYNCHRO_SEND],
-		   1-req->argc);
-    bbtools_usage(req);
-    retcode = -1;
-    return retcode;
-  }
-  if (req->verbose) {
-    bbtools_logMsg(req->stream,
-		   "%s: sending synchro to BB <%s>\n",
-		   bbtools_cmdname_tab[E_BBTOOLS_SYNCHRO_SEND],
-		   req->bbname);
-  }
-  
-  /* FIXME simple synchro for now 
-   * should use bb_snd_msg and enrich 
-   * the API
-   */
-  retcode = bb_simple_synchro_go(req->theBB,BB_SIMPLE_MSGID_SYNCHRO_COPY);
-  return retcode;
-} /* end of bbtools_synchro_send */
-
-int32_t
-bbtools_synchro_recv(bbtools_request_t* req) {
-  int32_t retcode = 0;
-  if (req->argc<1) {
-    bbtools_logMsg(req->stream,"%s: <%d> argument missing\n", 
-		   bbtools_cmdname_tab[E_BBTOOLS_SYNCHRO_SEND],
-		   1-req->argc);
-    bbtools_usage(req);
-    retcode = -1;
-    return retcode;
-  }
-  if (req->verbose) {
-    bbtools_logMsg(req->stream,
-		   "%s: sending synchro to BB <%s>\n",
-		   bbtools_cmdname_tab[E_BBTOOLS_SYNCHRO_SEND],
-		   req->bbname);
-  }
-  
-  /* FIXME simple synchro for now 
-   * should use bb_snd_recv and enrich 
-   * the API
-   */
-  retcode = bb_simple_synchro_wait(req->theBB,BB_SIMPLE_MSGID_SYNCHRO_COPY);
-  return retcode;
-} /* end of bbtools_synchro_recv */
-
-int32_t
-bbtools_memset(bbtools_request_t* req) {
-  int32_t retcode = 0;
-  int32_t hexval;
-  char    value;
-
-  if (req->argc<2) {
-    bbtools_logMsg(req->stream,"%s: <%d> argument missing\n", 
-		   bbtools_cmdname_tab[E_BBTOOLS_MEMSET],
-		   1-req->argc);
-    bbtools_usage(req);
-    retcode = -1;
-    return retcode;
-  }
-
-  /* check if we enter hexa or decimal value for memset */
-  if ((NULL != strstr(req->argv[1],"0x")) | 
-      (NULL != strstr(req->argv[1],"0X"))
-      ) {
-    hexval = 1;
-  } else {
-    hexval = 0;
-  }
-
-  value  = (char) strtol(req->argv[1],(char **)NULL,hexval ? 16 : 10);
-  if (req->verbose) {
-    bbtools_logMsg(req->stream,
-		   "%s: setting all data zone of BB <%s> to <0x%02x>\n",
-		   bbtools_cmdname_tab[E_BBTOOLS_MEMSET],
-		   req->bbname,
-		   value,value);
-  }
-  retcode = bb_data_memset(req->theBB,value);
-  return retcode;
-} /* end of bbtools_memset */
-
-int32_t
-bbtools_check_version(bbtools_request_t* req) {
-  int32_t retcode = 0;
-  if (req->argc<1) {
-    bbtools_logMsg(req->stream,"%s: <%d> argument missing\n", 
-		   bbtools_cmdname_tab[E_BBTOOLS_CHECK_VERSION],
-		   1-req->argc);
-    bbtools_usage(req);
-    retcode = -1;
-    return retcode;
-  }
-  if (req->verbose) {
-    bbtools_logMsg(req->stream,
-		   "%s: checking BB version for BB <%s>\n",
-		   bbtools_cmdname_tab[E_BBTOOLS_CHECK_VERSION],
-		   req->bbname);
-    
-  }
-  retcode = bb_check_version(req->theBB);
-  if (retcode != 0) {
-     bbtools_logMsg(req->stream,
-		   "%s: ERROR BB version mismatch !!\nbb_tools with BB version <0x%08X> used to access BB version <0x%08X>\n",
-		   bbtools_cmdname_tab[E_BBTOOLS_CHECK_VERSION],
-		    BB_VERSION_ID,req->theBB->bb_version_id);
-  } else {
-     bbtools_logMsg(req->stream,
-		   "%s: OK.\nbb_tools and accessed BB [%s] version are the same <0x%08X>\n",
-		   bbtools_cmdname_tab[E_BBTOOLS_CHECK_VERSION],
-		    req->bbname,
-		   req->theBB->bb_version_id);
-  }
-  return retcode;
-} /* end of bbtools_check_version */
+		bb_publish(req->theBB, &symbol_desc);
+	} else {
+		bbtools_logMsg(req->stream, "%s: publish FAILED unrecognized bb_type: <%s>\n", bbtools_cmdname_tab[E_BBTOOLS_PUBLISH], symbol_type_str);
+	}
+
+	return retcode;
+}/* end of bbtools_publish */
+
+int32_t bbtools_synchro_send(bbtools_request_t * req)
+{
+	int32_t retcode = 0;
+	if (req->argc < 1) {
+		bbtools_logMsg(req->stream, "%s: <%d> argument missing\n", bbtools_cmdname_tab[E_BBTOOLS_SYNCHRO_SEND], 1 - req->argc);
+		bbtools_usage(req);
+		retcode = -1;
+		return retcode;
+	}
+	if (req->verbose) {
+		bbtools_logMsg(req->stream, "%s: sending synchro to BB <%s>\n", bbtools_cmdname_tab[E_BBTOOLS_SYNCHRO_SEND], req->bbname);
+	}
+
+	/* FIXME simple synchro for now 
+	 * should use bb_snd_msg and enrich 
+	 * the API
+	 */
+	retcode = bb_simple_synchro_go(req->theBB, BB_SIMPLE_MSGID_SYNCHRO_COPY);
+	return retcode;
+}/* end of bbtools_synchro_send */
+
+int32_t bbtools_synchro_recv(bbtools_request_t * req)
+{
+	int32_t retcode = 0;
+	if (req->argc < 1) {
+		bbtools_logMsg(req->stream, "%s: <%d> argument missing\n", bbtools_cmdname_tab[E_BBTOOLS_SYNCHRO_SEND], 1 - req->argc);
+		bbtools_usage(req);
+		retcode = -1;
+		return retcode;
+	}
+	if (req->verbose) {
+		bbtools_logMsg(req->stream, "%s: sending synchro to BB <%s>\n", bbtools_cmdname_tab[E_BBTOOLS_SYNCHRO_SEND], req->bbname);
+	}
+
+	/* FIXME simple synchro for now 
+	 * should use bb_snd_recv and enrich 
+	 * the API
+	 */
+	retcode = bb_simple_synchro_wait(req->theBB, BB_SIMPLE_MSGID_SYNCHRO_COPY);
+	return retcode;
+}/* end of bbtools_synchro_recv */
+
+int32_t bbtools_memset(bbtools_request_t * req)
+{
+	int32_t retcode = 0;
+	int32_t hexval;
+	char value;
+
+	if (req->argc < 2) {
+		bbtools_logMsg(req->stream, "%s: <%d> argument missing\n", bbtools_cmdname_tab[E_BBTOOLS_MEMSET], 1 - req->argc);
+		bbtools_usage(req);
+		retcode = -1;
+		return retcode;
+	}
+
+	/* check if we enter hexa or decimal value for memset */
+	if ((NULL != strstr(req->argv[1], "0x")) | (NULL != strstr(req->argv[1], "0X"))
+	    ) {
+		hexval = 1;
+	} else {
+		hexval = 0;
+	}
+
+	value = (char) strtol(req->argv[1], (char **) NULL, hexval ? 16 : 10);
+	if (req->verbose) {
+		bbtools_logMsg(req->stream, "%s: setting all data zone of BB <%s> to <0x%02x>\n", bbtools_cmdname_tab[E_BBTOOLS_MEMSET], req->bbname, value, value);
+	}
+	retcode = bb_data_memset(req->theBB, value);
+	return retcode;
+}/* end of bbtools_memset */
+
+int32_t bbtools_check_version(bbtools_request_t * req)
+{
+	int32_t retcode = 0;
+	if (req->argc < 1) {
+		bbtools_logMsg(req->stream, "%s: <%d> argument missing\n", bbtools_cmdname_tab[E_BBTOOLS_CHECK_VERSION], 1 - req->argc);
+		bbtools_usage(req);
+		retcode = -1;
+		return retcode;
+	}
+	if (req->verbose) {
+		bbtools_logMsg(req->stream, "%s: checking BB version for BB <%s>\n", bbtools_cmdname_tab[E_BBTOOLS_CHECK_VERSION], req->bbname);
+
+	}
+	retcode = bb_check_version(req->theBB);
+	if (retcode != 0) {
+		bbtools_logMsg(req->stream,
+			       "%s: ERROR BB version mismatch !!\nbb_tools with BB version <0x%08X> used to access BB version <0x%08X>\n",
+			       bbtools_cmdname_tab[E_BBTOOLS_CHECK_VERSION], BB_VERSION_ID, req->theBB->bb_version_id);
+	} else {
+		bbtools_logMsg(req->stream,
+			       "%s: OK.\nbb_tools and accessed BB [%s] version are the same <0x%08X>\n", bbtools_cmdname_tab[E_BBTOOLS_CHECK_VERSION], req->bbname, req->theBB->bb_version_id);
+	}
+	return retcode;
+}/* end of bbtools_check_version */
diff -urN tsp_orig/src/util/libbb/bb_tools.h tsp_modified/src/util/libbb/bb_tools.h
--- tsp_orig/src/util/libbb/bb_tools.h	2006-12-07 22:25:21.000000000 +0100
+++ tsp_modified/src/util/libbb/bb_tools.h	2009-01-12 17:26:09.000000000 +0100
@@ -1,6 +1,6 @@
 /*
 
-$Header: /sources/tsp/tsp/src/util/libbb/bb_tools.h,v 1.9 2006/12/07 21:25:21 erk Exp $
+$Header: /sources/tsp/tsp/src/util/libbb/bb_tools.h,v 1.10 2007/05/04 13:35:51 deweerdt Exp $
 
 -----------------------------------------------------------------------
 
@@ -76,6 +76,7 @@
               E_BBTOOLS_SYNCHRO_RECV,
 	      E_BBTOOLS_MEMSET,
 	      E_BBTOOLS_CHECK_VERSION,
+	      E_BBTOOLS_LOAD,
               E_BBTOOLS_LASTCMD} E_BBTOOLS_CMD_T;
 
 typedef struct bbtools_request {
@@ -107,6 +108,7 @@
 				     "bb_synchro_recv",
 				     "bb_memset",
 				     "bb_check_version",
+				     "bb_load",
 				     "bb_last_cmd"
 };
 
@@ -125,6 +127,7 @@
 				     "recv [wait] synchro message from blackboard MSQ queue",
 				     "memset blackboard data region",
 				     "check blackboard version vs bb_tools runtime version",
+				     "load a file into the BB",
 				     "BB LAST COMMAND"
 };
 #else
@@ -265,6 +268,12 @@
 int32_t
 bbtools_check_version(bbtools_request_t* req);
 
+/**
+ *
+ */
+int32_t
+bbtools_load(bbtools_request_t* req);
+
 /**  @} */
 
 
diff -urN tsp_orig/src/util/libbb/bb_utils.c tsp_modified/src/util/libbb/bb_utils.c
--- tsp_orig/src/util/libbb/bb_utils.c	2007-03-20 11:11:33.000000000 +0100
+++ tsp_modified/src/util/libbb/bb_utils.c	2009-01-12 17:26:09.000000000 +0100
@@ -1,6 +1,6 @@
 /*
 
-$Header: /sources/tsp/tsp/src/util/libbb/bb_utils.c,v 1.15 2007/03/20 10:11:33 deweerdt Exp $
+$Header: /sources/tsp/tsp/src/util/libbb/bb_utils.c,v 1.19 2008/03/31 13:32:29 deweerdt Exp $
 
 -----------------------------------------------------------------------
 
@@ -41,12 +41,11 @@
 #include <stdarg.h>
 #include <stdio.h>
 #include <assert.h>
-#include <sys/ipc.h>
 
 #include <tsp_sys_headers.h>
 #include <bb_utils.h>
 #include <bb_sha1.h>
-#include "tsp_simple_trace.h"
+#include "tsp_common_trace.h"
 
 char* 
 bb_utils_build_shm_name(const char* shm_name) {
@@ -70,21 +69,20 @@
 char*
 bb_utils_build_sem_name(const char* sem_name) {
   
-  char* retval;
+  char* retval = NULL;
   int i_size_name;
   const char * prefix = "/";
   const char * postfix = "_sem";
 
   i_size_name = strlen(sem_name)+strlen(prefix)+strlen(postfix)+1;
-  retval = NULL;
   retval = (char *) malloc(i_size_name*sizeof(char));
+
   if (retval!=NULL) {
     strncpy(retval,prefix,strlen(prefix));
     strncpy(retval+strlen(prefix),sem_name,strlen(sem_name));
     strncpy(retval+strlen(prefix)+strlen(sem_name),postfix,strlen(postfix));
     retval[i_size_name-1] = '\0';
   }
-
   return retval;
 } /* end of bb_utils_build_sem_name */
 
@@ -250,7 +248,7 @@
   remain = remaining_symname;
 
   while ((NULL != remain) && (0 == retcode)) {
-    retcode &= bb_utils_parseone_array(current_symname,
+    retcode = bb_utils_parseone_array(current_symname,
         symname_part,parsed_symname_maxlen,
         &array_index[i],
         &remain,parsed_symname_maxlen);
diff -urN tsp_orig/src/util/libbb/bb_utils.h tsp_modified/src/util/libbb/bb_utils.h
--- tsp_orig/src/util/libbb/bb_utils.h	2006-11-27 21:05:22.000000000 +0100
+++ tsp_modified/src/util/libbb/bb_utils.h	2009-01-12 17:26:09.000000000 +0100
@@ -1,6 +1,6 @@
 /*
 
-$Header: /sources/tsp/tsp/src/util/libbb/bb_utils.h,v 1.12 2006/11/27 20:05:22 deweerdt Exp $
+$Header: /sources/tsp/tsp/src/util/libbb/bb_utils.h,v 1.14 2008/03/24 23:56:21 deweerdt Exp $
 
 -----------------------------------------------------------------------
 
@@ -40,7 +40,10 @@
 #ifdef __KERNEL__
 #include <linux/types.h>
 #else
-#include <sys/ipc.h>
+#if !defined(__rtems__)
+# include <sys/ipc.h>
+#endif /* !__rtems__ */
+
 #include <sys/types.h>
 
 #include <tsp_abs_types.h>
diff -urN tsp_orig/src/util/libbb/bb_xml.c tsp_modified/src/util/libbb/bb_xml.c
--- tsp_orig/src/util/libbb/bb_xml.c	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/bb_xml.c	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1,186 @@
+/*
+
+$Header: /sources/tsp/tsp/src/util/libbb/bb_xml.c,v 1.1 2007/09/04 23:37:20 deweerdt Exp $
+
+-----------------------------------------------------------------------
+
+TSP Library - core components for a generic Transport Sampling Protocol.
+
+Copyright (c) 2007 Frederik Deweerdt
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+-----------------------------------------------------------------------
+
+Project   : TSP
+Maintainer : tsp@astrium-space.com
+Component : BlackBoard
+
+-----------------------------------------------------------------------
+
+Purpose   : XML dumper for the blackboard
+
+-----------------------------------------------------------------------
+ */
+
+#include <bb_core.h>
+#include <bb_alias.h>
+#include <bb_tools.h>
+#include <libxml/xmlreader.h>
+
+static int bb_xml_process_node(xmlTextReaderPtr reader, bbtools_request_t * req)
+{
+	const xmlChar *name;
+
+	name = xmlTextReaderConstName(reader);
+	if (name == NULL) {
+		puts("aze1");
+		return -1;
+	}
+
+	if (!strcmp((char *) name, "bb")) {
+		int n_data;
+		int max_data_desc_size;
+		char *n_data_str;
+		char *max_data_desc_size_str;
+		n_data_str = (char *) xmlTextReaderGetAttribute(reader, BAD_CAST "n_data");
+		n_data = atoi(n_data_str);
+		free(n_data_str);
+		max_data_desc_size_str = (char *) xmlTextReaderGetAttribute(reader, BAD_CAST "max_data_desc_size");
+		max_data_desc_size = atoi(max_data_desc_size_str);
+		free(max_data_desc_size_str);
+
+		printf("n_data %d, max_data_desc_size %d\n", n_data, max_data_desc_size);
+		if (bb_attach(&req->theBB, req->bbname) != BB_OK) {
+			if (bb_create(&req->theBB, req->bbname, n_data, max_data_desc_size) != BB_OK) {
+				return -1;
+			}
+
+		}
+		return 0;
+	} else if (!strcmp((char *) name, "variable")) {
+		int alias_target, type, dimension, type_size, data_offset;
+		char *alias_target_str, *type_str, *dimension_str, *type_size_str, *data_offset_str;
+		char *value, *name;
+		S_BB_DATADESC_T dd;
+		void *v;
+		int i = 0;
+		char *str_to_free, *cur_val;
+		char *saveptr;
+
+		alias_target_str = (char *) xmlTextReaderGetAttribute(reader, BAD_CAST "alias_target");
+		alias_target = atoi(alias_target_str);
+		type_str = (char *) xmlTextReaderGetAttribute(reader, BAD_CAST "type");
+		type = atoi(type_str);
+		dimension_str = (char *) xmlTextReaderGetAttribute(reader, BAD_CAST "dimension");
+		dimension = atoi(dimension_str);
+		type_size_str = (char *) xmlTextReaderGetAttribute(reader, BAD_CAST "type_size");
+		type_size = atoi(type_size_str);
+		data_offset_str = (char *) xmlTextReaderGetAttribute(reader, BAD_CAST "data_offset");
+		data_offset = atoi(data_offset_str);
+		name = (char *) xmlTextReaderGetAttribute(reader, BAD_CAST "name");
+		value = (char *) xmlTextReaderGetAttribute(reader, BAD_CAST "value");
+
+		cur_val = strdup(value);
+		str_to_free = cur_val;
+		bb_set_varname(&dd, name);
+		dd.type = type;
+		dd.dimension = dimension;
+		dd.type_size = type_size;
+		dd.data_offset = data_offset;
+		dd.alias_target = alias_target;
+
+		if (alias_target != -1) {
+			/* this is an alias */
+			bb_alias_publish(req->theBB, &dd, &bb_data_desc(req->theBB)[alias_target]);
+		} else {
+			/*
+			   Then, consider the real variables. Tought part,
+			   as we need to restore the original values
+			 */
+			v = bb_publish(req->theBB, &dd);
+			while (i++ < dimension) {
+				char *val;
+				int is_hex = !strncasecmp(value, "0x", 2);
+				val = strtok_r(cur_val, ",", &saveptr);
+				cur_val = NULL;
+				switch (type) {
+					case E_BB_CHAR:
+					case E_BB_UCHAR:
+						memset(v, 0, dimension);
+						strcpy((char *) v, value);
+						i = dimension;
+						break;
+					case E_BB_USER:
+						{
+							int n;
+							for (n = 0; n < type_size; n++) {
+								*(uint8_t *) v = strtol(val, NULL, is_hex ? 16 : 10);
+								v = ((int8_t *) v) + 1;
+								val = strtok_r(cur_val, ",", &saveptr);
+								cur_val = NULL;
+								if (val && !strncmp("0x", val, 2)) {
+									val += 2;
+									is_hex = 1;
+								}
+							}
+						}
+						continue;
+					default:
+						bb_value_direct_write(v, dd, val, is_hex);
+						v = ((int8_t *)v)+type_size;
+					}
+				}
+				free(str_to_free);
+			}
+		free(name);
+		free(value);
+		free(alias_target_str);
+		free(type_str);
+		free(dimension_str);
+		free(type_size_str);
+		free(data_offset_str);
+	} else {
+		return 0;
+	}
+
+	return 0;
+}
+
+int bb_xml_load_file(bbtools_request_t * req)
+{
+	xmlTextReaderPtr reader;
+	int ret;
+	char *filename = req->argv[1];
+
+	reader = xmlNewTextReaderFilename(filename);
+	if (reader != NULL) {
+		ret = xmlTextReaderRead(reader);
+		while (ret == 1) {
+			if (bb_xml_process_node(reader, req) < 0) {
+				puts("failed");
+				return -1;
+			}
+			ret = xmlTextReaderRead(reader);
+		}
+		xmlFreeTextReader(reader);
+		if (ret != 0) {
+			printf("%s : failed to parse\n", filename);
+		}
+	} else {
+		printf("Unable to open %s\n", filename);
+	}
+	return 0;
+}
diff -urN tsp_orig/src/util/libbb/bb_xml.h tsp_modified/src/util/libbb/bb_xml.h
--- tsp_orig/src/util/libbb/bb_xml.h	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/bb_xml.h	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1,38 @@
+/*
+
+$Header: /sources/tsp/tsp/src/util/libbb/bb_xml.h,v 1.1 2007/09/04 23:37:20 deweerdt Exp $
+
+-----------------------------------------------------------------------
+
+TSP Library - core components for a generic Transport Sampling Protocol.
+
+Copyright (c) 2007 Frederik Deweerdt
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+-----------------------------------------------------------------------
+
+Project   : TSP
+Maintainer : tsp@astrium-space.com
+Component : BlackBoard
+
+-----------------------------------------------------------------------
+
+Purpose   : Header file for the XML dumper for the blackboard
+
+-----------------------------------------------------------------------
+ */
+
+int bb_xml_load_file(bbtools_request_t * req);
diff -urN tsp_orig/src/util/libbb/build_kbb_debian.sh tsp_modified/src/util/libbb/build_kbb_debian.sh
--- tsp_orig/src/util/libbb/build_kbb_debian.sh	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/build_kbb_debian.sh	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1,16 @@
+#!/bin/sh
+# This helper script switches Makefiles between the one needed for the 
+# module and the "main" one
+
+SRC_DIR=$1
+DST_DIR=$2
+
+rm -rf $DST_DIR/kbb_debian_build
+mkdir -p $DST_DIR/kbb_debian_build
+cp $DST_DIR/Makefile.k $DST_DIR/kbb_debian_build/Makefile
+cp $SRC_DIR/bb_alias.h $SRC_DIR/bb_utils.h $SRC_DIR/bb_core.h $SRC_DIR/bb_core_k.h $SRC_DIR/bb_simple.h $SRC_DIR/bb_local.h $SRC_DIR/bb_callback.h $DST_DIR/kbb_debian_build/
+cp $SRC_DIR/bb_core.c $SRC_DIR/bb_alias.c $SRC_DIR/bb_core_k.c $SRC_DIR/bb_module.c $SRC_DIR/bb_simple.c $SRC_DIR/bb_local.c $SRC_DIR/bb_callback.c $DST_DIR/kbb_debian_build/
+cp -r kbb_debian $DST_DIR/kbb_debian_build/debian
+cp -r $DST_DIR/debian_changelog $DST_DIR/kbb_debian_build/debian/changelog
+cd $DST_DIR/kbb_debian_build
+fakeroot dpkg-buildpackage -us -uc
diff -urN tsp_orig/src/util/libbb/build_module.sh tsp_modified/src/util/libbb/build_module.sh
--- tsp_orig/src/util/libbb/build_module.sh	2006-11-27 20:44:10.000000000 +0100
+++ tsp_modified/src/util/libbb/build_module.sh	2009-01-12 17:26:09.000000000 +0100
@@ -1,4 +1,13 @@
 #!/bin/sh
-# This helper script switches Makefiles between the one needed for the 
-# module and the "main" one
-cp Makefile Makefile.us && cp Makefile.k Makefile && make && mv Makefile.us Makefile
+
+# This helper script creates a kbuild buiding environment... fill it
+# with whatever is needed before building
+
+SRC_DIR=$1
+DST_DIR=$2
+
+mkdir -p $DST_DIR/kbuild
+cp $DST_DIR/Makefile.k $DST_DIR/kbuild/Makefile
+cp $SRC_DIR/bb_alias.h $SRC_DIR/bb_utils.h $SRC_DIR/bb_core.h $SRC_DIR/bb_core_k.h $SRC_DIR/bb_simple.h $SRC_DIR/bb_local.h $SRC_DIR/bb_callback.h $DST_DIR/kbuild/
+cp $SRC_DIR/bb_core.c $SRC_DIR/bb_alias.c $SRC_DIR/bb_core_k.c $SRC_DIR/bb_module.c $SRC_DIR/bb_simple.c $SRC_DIR/bb_local.c $SRC_DIR/bb_callback.c $DST_DIR/kbuild/
+make -C $DST_DIR/kbuild
diff -urN tsp_orig/src/util/libbb/CMakeLists.txt tsp_modified/src/util/libbb/CMakeLists.txt
--- tsp_orig/src/util/libbb/CMakeLists.txt	2007-03-01 19:45:13.000000000 +0100
+++ tsp_modified/src/util/libbb/CMakeLists.txt	2009-01-12 17:26:09.000000000 +0100
@@ -1,21 +1,79 @@
+
+
+INCLUDE(CheckIncludeFiles)
+
+OPTION(BUILD_SYSV_BB
+  "SysV API for Blackboards" ON)
+OPTION(BUILD_POSIX_BB
+  "Posix API for Blackboards" OFF)
+OPTION(ALLOW_KBB_WRITE_ACCESS_FROM_USERSPACE
+  "Allow write access from userspace to kbb -- Dangerous: Could produce kernel crash" OFF)
+
+#for memory alignment in bb_publish,BB_ALIGN= 0 no alignment, =-1 alignment on
+# the value of the data which we want to write, others > 0 alignment on the
+# value of BB_ALIGN
+
+#32 bits word
+ADD_DEFINITIONS(-DBB_ALIGN=4)
+
+IF(BUILD_VXWORKS)
+	SET(BUILD_POSIX_BB ON)
+	SET(BUILD_SYSV_BB OFF)
+ENDIF(BUILD_VXWORKS)
+
+IF(BUILD_POSIX_BB)
+	SET(POSIX_BB_SRC bb_core_posix.c)
+	SET(POSIX_BB_INC bb_core_posix.h)
+	ADD_DEFINITIONS(-DUSE_POSIX_BB)
+ELSE(BUILD_POSIX_BB)
+	SET(POSIX_BB_SRC "")
+	SET(POSIX_BB_INC "")
+ENDIF(BUILD_POSIX_BB)
+
+IF(BUILD_SYSV_BB)
+	SET(SYSV_BB_SRC bb_core_sysv.c)
+	SET(SYSV_BB_INC bb_core_sysv.h)
+ELSE(BUILD_SYSV_BB)
+	SET(SYSV_BB_SRC "")
+	SET(SYSV_BB_INC "")
+ENDIF(BUILD_SYSV_BB)
+
+SET(KERNEL_BUILD_EXTRA_CFLAGS "")
+IF (ALLOW_KBB_WRITE_ACCESS_FROM_USERSPACE)
+	ADD_DEFINITIONS(-DALLOW_KBB_WRITE_ACCESS_FROM_USERSPACE)
+	SET(KERNEL_BUILD_EXTRA_CFLAGS
+	  ${KERNEL_BUILD_EXTRA_CFLAGS} " -DALLOW_KBB_WRITE_ACCESS_FROM_USERSPACE")
+ELSE (ALLOW_KBB_WRITE_ACCESS_FROM_USERSPACE)
+ENDIF (ALLOW_KBB_WRITE_ACCESS_FROM_USERSPACE)
+
 SET(_SRC
-  bb_utils bb_alias
-  bb_core bb_simple
-  bb_sha1 bb_tools 
-  bb_core_sysv.c)
+  bb_alias.c
+  bb_core.c bb_simple.c
+  bb_sha1.c bb_tools.c
+  bb_utils.c bb_callback.c
+  bb_local.c
+  ${SYSV_BB_SRC}
+  ${POSIX_BB_SRC})
 
 SET(LIB_VARNAME_SARRAY_SRC bb_varname_sarray.c)
 
 IF(ZLIB_FOUND)
 SET(LIB_VARNAME_ZIP_SRC ${_SRC} bb_varname_zip.c)
 ENDIF(ZLIB_FOUND)
+
 #
-# bb_core_k kernel device API on works on linux 
+# bb_core_k kernel device API on works on linux
 #
 IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
-  SET(_SRC 
-    ${_SRC}
-    bb_core_k.c)
+  CHECK_INCLUDE_FILES(linux/connector.h CONNECTOR_AVAILABLE CONNECTOR_AVAILABLE)
+  IF (CONNECTOR_AVAILABLE)
+    ADD_DEFINITIONS(-DCONNECTOR_AVAILABLE)
+    SET(_SRC
+      ${_SRC}
+      bb_core_k.c)
+  ELSE (CONNECTOR_AVAILABLE)
+    MESSAGE ("Missing linux/connector.h: No kernel blackboards access from userspace")
+  ENDIF (CONNECTOR_AVAILABLE)
 ENDIF (CMAKE_SYSTEM_NAME MATCHES "Linux")
 
 SET(BB_INCLUDE_FILES
@@ -25,8 +83,10 @@
   bb_tools.h
   bb_utils.h
   bb_sha1.h
-  bb_core_sysv.h
-  bb_core_k.h)
+  bb_local.h
+  bb_callback.h
+  ${SYSV_BB_INC}
+  ${POSIX_BB_INC})
 
 IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
   SET(BB_INCLUDE_FILES 
@@ -36,19 +96,42 @@
 
 TSP_XINCLUDE(${BB_INCLUDE_FILES})
 
+
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/util/libbb)
 
-ADD_LIBRARY(bb ${_SRC})
-TSP_LIBRARY_INSTALL(bb)
-TARGET_LINK_LIBRARIES(bb ${PTHREAD_LIBRARY_NAME} dl)
-ADD_LIBRARY(sarray ${LIB_VARNAME_SARRAY_SRC})
-TSP_LIBRARY_INSTALL(sarray)
+IF (XML2_FOUND)
+  SET(_SRC
+    ${_SRC}
+    bb_xml.c)
+  ADD_DEFINITIONS(${XML2_CFLAGS} -DXML2_FOUND)
+ENDIF (XML2_FOUND)
 
 IF(ZLIB_FOUND)
 ADD_LIBRARY(sarray ${LIB_VARNAME_SARRAY_SRC_SRC})
 ENDIF(ZLIB_FOUND)
 
-ADD_SUBDIRECTORY(bbtools)
+ADD_LIBRARY(bb ${_SRC})
+IF (XML2_FOUND)
+  TARGET_LINK_LIBRARIES(bb ${XML2_LIBRARY})
+ENDIF (XML2_FOUND)
+TSP_LIBRARY_INSTALL(bb)
+IF (BUILD_POSIX_BB AND NOT BUILD_VXWORKS)
+  TARGET_LINK_LIBRARIES(bb rt)
+ENDIF (BUILD_POSIX_BB AND NOT BUILD_VXWORKS)
+
+IF (NOT BUILD_VXWORKS)
+  TARGET_LINK_LIBRARIES(bb ${PTHREAD_LIBRARY_NAME} dl)
+ENDIF (NOT BUILD_VXWORKS)
+TSP_LIBRARY_INSTALL(bb)
+
+IF(NOT BUILD_VXWORKS)
+  ADD_LIBRARY(sarray ${LIB_VARNAME_SARRAY_SRC})
+  TSP_LIBRARY_INSTALL(sarray)
+ENDIF(NOT BUILD_VXWORKS)
+
+IF (NOT BUILD_VXWORKS)
+  ADD_SUBDIRECTORY(bbtools)
+ENDIF (NOT BUILD_VXWORKS)
 
 IF(BUILD_SCRIPT_BINDING)
 	ADD_SUBDIRECTORY(scripting)
@@ -56,20 +139,61 @@
 
  
 # Build a kernel module
-# This is a bit tricky: building a kernel module needs a Makefile which
-# is not the one provided by cmake. The workaround is in build_module.sh
-# which copies Makefile.k to Makefile, does the build and then restores
-# the original Makefile.
+# This is a bit tricky: building a kernel module needs a Makefile
+# which is not the one provided by cmake.
+# The workaround is in build_module.sh which creates a "kbuild"
+# directory, copies everythings needed in it and does the build.
+
+SET(MODULE_SRC 
+  bb_core.c bb_alias.c
+  bb_core_k.c bb_module.c
+  bb_simple.c bb_alias.c 
+  bb_callback.c )
+
+SET(MODULE_HDR 
+  bb_alias.h bb_core.h
+  bb_core_k.h bb_simple.h 
+  bb_utils.h bb_alias.h
+  bb_callback.h)
+
 IF(BUILD_BB_KERNEL_MODULE)
-  SET(MODULE_SRC 
-    bb_core.c bb_alias.c
-    bb_core_k.c bb_module.c
-    bb_simple.c)
-    
-  ADD_CUSTOM_COMMAND(OUTPUT bb.ko
-    COMMAND ${CMAKE_SOURCE_DIR}/src/util/libbb/build_module.sh
-    DEPENDS ${MODULE_SRC}
+   
+  CONFIGURE_FILE(Makefile.k.in ${CMAKE_BINARY_DIR}//src/util/libbb/Makefile.k @ONLY)
+
+  ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/src/util/libbb/kbuild/bb.ko
+    COMMAND ${CMAKE_SOURCE_DIR}/src/util/libbb/build_module.sh ${CMAKE_SOURCE_DIR}/src/util/libbb ${CMAKE_BINARY_DIR}/src/util/libbb
+    DEPENDS Makefile.k.in ${MODULE_SRC} ${MODULE_HDR}
     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/util/libbb)
-  ADD_CUSTOM_TARGET(kernel_module ALL DEPENDS bb.ko)
+  ADD_CUSTOM_TARGET(kernel_module ALL DEPENDS ${CMAKE_BINARY_DIR}/src/util/libbb/kbuild/bb.ko)
+
 ENDIF(BUILD_BB_KERNEL_MODULE)
 
+
+# Build a debian kernel module-assistant package
+# This is a bit tricky: building a debian kernel module-assistant
+# package needs a special evironment which is not the one provided by
+# cmake.
+# The workaround is in build_kbb_debian.sh which creates a
+# "kbb_debian_build" directory, copies everythings needed in it and
+# does the build.
+SET(DEBIAN_KBB_BUILD_FILE
+  kbb_debian/README.Debian
+  kbb_debian/changelog.in
+  kbb_debian/compat
+  kbb_debian/control
+  kbb_debian/control.modules.in
+  kbb_debian/copyright
+  kbb_debian/kbb-_KVERS_.postinst.modules.in
+  kbb_debian/rules)
+
+IF(BUILD_BB_KERNEL_DEBIAN_PACKAGE)
+
+  CONFIGURE_FILE(kbb_debian/changelog.in ${CMAKE_BINARY_DIR}/src/util/libbb/debian_changelog @ONLY)
+
+  ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/src/util/libbb/kbb-source_${PACKAGE_VERSION}-1_all.deb
+    COMMAND ${CMAKE_SOURCE_DIR}/src/util/libbb/build_kbb_debian.sh ${CMAKE_SOURCE_DIR}/src/util/libbb ${CMAKE_BINARY_DIR}/src/util/libbb
+    DEPENDS Makefile.k.in ${MODULE_SRC} ${MODULE_HDR} ${DEBIAN_KBB_BUILD_FILE}
+    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/util/libbb)
+  ADD_CUSTOM_TARGET(debian_kbb ALL DEPENDS ${CMAKE_BINARY_DIR}/src/util/libbb/kbb-source_${PACKAGE_VERSION}-1_all.deb)
+
+ENDIF(BUILD_BB_KERNEL_DEBIAN_PACKAGE)
diff -urN tsp_orig/src/util/libbb/doc/readme tsp_modified/src/util/libbb/doc/readme
--- tsp_orig/src/util/libbb/doc/readme	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/doc/readme	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1,7 @@
+BlackBoard documentation
+
+High level doc moved to tsp_bbguide/ top-level CVS module:
+ cvs co tsp_bbguide.
+
+API doc is doxygen generated:
+ look at $DEVBASE/doc/html/index.html
diff -urN tsp_orig/src/util/libbb/doc/README tsp_modified/src/util/libbb/doc/README
--- tsp_orig/src/util/libbb/doc/README	2005-02-20 17:53:04.000000000 +0100
+++ tsp_modified/src/util/libbb/doc/README	1970-01-01 01:00:00.000000000 +0100
@@ -1,7 +0,0 @@
-BlackBoard documentation
-
-High level doc moved to tsp_bbguide/ top-level CVS module:
- cvs co tsp_bbguide.
-
-API doc is doxygen generated:
- look at $DEVBASE/doc/html/index.html
diff -urN tsp_orig/src/util/libbb/kbb_debian/changelog.in tsp_modified/src/util/libbb/kbb_debian/changelog.in
--- tsp_orig/src/util/libbb/kbb_debian/changelog.in	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/kbb_debian/changelog.in	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1,12 @@
+kbb (@PACKAGE_VERSION@-1) stable; urgency=low
+
+  * Last Official release
+
+ -- Jerome Arbez-Gindre <jerome.arbez-gindre@thalesaleniaspace.com>  Wed, 22 May 2008 14:27:00 +0100
+
+kbb (0.0.1-1) unstable; urgency=low
+
+  * Initial release (Closes: #nnnn)  <nnnn is the bug number of your ITP>
+
+ -- Jerome Arbez-Gindre <jerome.arbez-gindre@thalesaleniaspace.com>  Wed, 13 Feb 2008 09:17:57 +0100
+
diff -urN tsp_orig/src/util/libbb/kbb_debian/compat tsp_modified/src/util/libbb/kbb_debian/compat
--- tsp_orig/src/util/libbb/kbb_debian/compat	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/kbb_debian/compat	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1 @@
+5
diff -urN tsp_orig/src/util/libbb/kbb_debian/control tsp_modified/src/util/libbb/kbb_debian/control
--- tsp_orig/src/util/libbb/kbb_debian/control	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/kbb_debian/control	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1,14 @@
+Source: kbb
+Section: unknown
+Priority: extra
+Maintainer: Jerome Arbez-Gindre <jeromearbezgindre@gmail.com>
+Build-Depends: debhelper (>= 5), bzip2
+Standards-Version: 3.7.2
+
+Package: kbb-source
+Architecture: all
+Depends: module-assistant, debhelper (>= 5), make, bzip2
+Description: Source for the kbb kernel module.
+ This package provides the source code for the kbb kernel modules.
+ The kbb package is also required in order to make use of these
+ modules. Kernel source or headers are required to compile these modules.
diff -urN tsp_orig/src/util/libbb/kbb_debian/control.modules.in tsp_modified/src/util/libbb/kbb_debian/control.modules.in
--- tsp_orig/src/util/libbb/kbb_debian/control.modules.in	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/kbb_debian/control.modules.in	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1,20 @@
+Source: kbb
+Section: unknown
+Priority: optional
+Maintainer: Jerome Arbez-Gindre <jeromearbezgindre@gmail.com>
+Build-Depends: debhelper (>= 5)
+Standards-Version: 3.7.2
+
+Package: kbb-_KVERS_
+Architecture: any
+Provides: kbb
+Description: kbb module for Linux (kernel _KVERS_).
+ This package contains the loadable kernel modules for the
+ kernel version of the TSP blackboard.
+ .
+ This package contains the compiled kernel module for _KVERS_
+ .
+ If you have compiled your own kernel, you will most likely need to build
+ your own kbb. The kbb-source package has been
+ provided for use with the Debian's module-assistant or kernel-package
+ utilities to produce a version of kbb for your kernel.
diff -urN tsp_orig/src/util/libbb/kbb_debian/copyright tsp_modified/src/util/libbb/kbb_debian/copyright
--- tsp_orig/src/util/libbb/kbb_debian/copyright	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/kbb_debian/copyright	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1,37 @@
+This package was debianized by Jerome Arbez-Gindre <Jeromearbezgindre@gmail.com> on
+Thu, 26 Jun 2008 14:41:14 +0200.
+
+It was downloaded from http://savannah.nongnu.org/projects/tsp
+
+Upstream Author(s): 
+
+	Jerome ARBEZ-GINDRE
+	         Linux Kernel Blackboard
+	Cesare BERTONA,
+	         the BlackBoard VxWorks port
+	Frederik DEWEERDT
+	         Linux Kernel Blackboard, FreeBSD port and more...
+	Eric NOULARD
+	         Initial Blackboard implementation and design
+	Miguel SENNOUN,
+	         Blackboard Alias System
+	Thomas TESTASECCA,
+	         Blackboard Alias System and some Blackboard optimization
+	
+Copyright: 
+
+	Copyright (c) 2004 Jerome ARBEZ-GINDRE, Cesare BERTONA, Frederik DEWEERDT,
+		      	   Eric NOULARD, Miguel SENNOUN and Thomas TESTASECCA,
+
+License:
+
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+
+The Debian packaging is (C) 2008, Jerome Arbez-Gindre <Jeromearbezgindre@gmail.com> and
+is licensed under the GPL, see `/usr/share/common-licenses/GPL'.
+
+# Please also look if there are files or directories which have a
+# different copyright/license attached and list them here.
diff -urN tsp_orig/src/util/libbb/kbb_debian/kbb-_kvers_.postinst.modules.in tsp_modified/src/util/libbb/kbb_debian/kbb-_kvers_.postinst.modules.in
--- tsp_orig/src/util/libbb/kbb_debian/kbb-_kvers_.postinst.modules.in	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/kbb_debian/kbb-_kvers_.postinst.modules.in	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1,40 @@
+#!/bin/sh
+# postinst script for modules package built from kbb
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    configure)
+	depmod -a _KVERS_
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
diff -urN tsp_orig/src/util/libbb/kbb_debian/readme.debian tsp_modified/src/util/libbb/kbb_debian/readme.debian
--- tsp_orig/src/util/libbb/kbb_debian/readme.debian	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/kbb_debian/readme.debian	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1,21 @@
+kbb for Debian
+--------------
+
+The Debian kbb source package provides one packages,
+
+   kbb-source, which provides the source for the kernel modules
+
+The kbb-source package can be used in several ways,
+
+ - Using the make-kpkg(1) command provided by the kernel-package Debian
+   package. This will produce a corresponding kbb package for
+   the Debian kernel-image package that you are using. This is "the Debian
+   way". See the "modules_image" section of the make-kpkg(1) man page.
+
+ - Changing to the /usr/src/modules/kbb/ directory and building as
+   the README file instructs using "make; make install". This will build
+   and install a module specific to the system you are building on and is
+   not under control of the packaging system.
+
+ -- Jérôme Arbez-Gindre <jeromearbezgindre@gmail.com>, Tue,  8 Jul 2008 09:28:33 +0200
+
diff -urN tsp_orig/src/util/libbb/kbb_debian/rules tsp_modified/src/util/libbb/kbb_debian/rules
--- tsp_orig/src/util/libbb/kbb_debian/rules	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/kbb_debian/rules	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1,213 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper. 
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+#
+# This version is for a hypothetical package that can build a kernel modules
+# architecture-dependant package via make-kpkg, as well as an
+# architecture-independent module source package, and other packages
+# either dep/indep for things like common files or userspace components
+# needed for the kernel modules.
+
+# Uncomment this to turn on verbose mode. 
+export DH_VERBOSE=1
+
+
+
+
+# some default definitions, important!
+# 
+# Name of the source package
+psource:=kbb-source
+
+# The short upstream name, used for the module source directory
+sname:=kbb
+
+### KERNEL SETUP
+### Setup the stuff needed for making kernel module packages
+### taken from /usr/share/kernel-package/sample.module.rules
+
+# prefix of the target package name
+PACKAGE=kbb
+# modifieable for experiments or debugging m-a
+MA_DIR ?= /usr/share/modass
+# load generic variable handling
+-include $(MA_DIR)/include/generic.make
+# load default rules, including kdist, kdist_image, ...
+-include $(MA_DIR)/include/common-rules.make
+  
+# module assistant calculates all needed things for us and sets
+# following variables:
+# KSRC (kernel source directory), KVERS (kernel version string), KDREV
+# (revision of the Debian kernel-image package), CC (the correct
+# compiler), VERSION (the final package version string), PKGNAME (full
+# package name with KVERS included), DEB_DESTDIR (path to store DEBs)
+  
+# The kdist_config target is called by make-kpkg modules_config and
+# by kdist* rules by dependency. It should configure the module so it is
+# ready for compilation (mostly useful for calling configure).
+# prep-deb-files from module-assistant creates the neccessary debian/ files 
+kdist_config: prep-deb-files
+  
+# the kdist_clean target is called by make-kpkg modules_clean and from
+# kdist* rules. It is responsible for cleaning up any changes that have
+# been made by the other kdist_commands (except for the .deb files created)
+kdist_clean:
+# 	$(MAKE) $(MFLAGS) -f debian/rules clean
+#	rm -f driver/*.o driver/*.ko
+#
+### end  KERNEL SETUP
+
+configure: configure-stamp
+configure-stamp:
+	dh_testdir
+	# Add here commands to configure the package.
+
+	touch configure-stamp
+
+
+build-arch: configure-stamp  build-arch-stamp
+build-arch-stamp:
+	dh_testdir
+
+	touch $@
+
+#k = $(shell echo $(KVERS) | grep -q ^2.6 && echo k)
+
+# the binary-modules rule is invoked by module-assistant while processing the
+# kdist* targets. It is called by module-assistant or make-kpkg and *not*
+# during a normal build
+binary-modules:
+	dh_testroot
+	dh_clean -k
+	dh_installdirs lib/modules/$(KVERS)/kernel/drivers/misc/satdrv
+
+	# Build the module
+	$(MAKE) KDIR=$(KSRC) KVER=$(KVERS)
+
+	# Install the module
+	$(MAKE) KDIR=$(KSRC) KVER=$(KVERS) DESTDIR=debian/$(PKGNAME) install 
+
+	dh_installdocs
+	dh_installchangelogs
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_gencontrol -- -v$(VERSION)
+	dh_md5sums
+	dh_builddeb --destdir=$(DEB_DESTDIR)
+	dh_clean -k
+
+build-indep:  configure-stamp build-indep-stamp
+build-indep-stamp:
+	dh_testdir
+
+	# Add here command to compile/build the arch indep package.
+	# It's ok not to do anything here, if you don't need to build
+	#  anything for this package.
+	#docbook-to-man debian/kbb.sgml > kbb.1
+
+	touch $@
+
+build: build-arch build-indep
+
+clean:
+	dh_testdir
+	#dh_testroot
+	rm -f build-arch-stamp build-indep-stamp configure-stamp
+
+	# Add here commands to clean up after the build process.
+	$(MAKE) clean
+
+	dh_clean
+
+install: DH_OPTIONS=
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	# Create the directories to install the source into
+	dh_installdirs -p$(psource)  usr/src/modules/$(sname)/debian
+
+	# Copy only the driver source to the proper location
+	$(MAKE) DESTDIR=debian/$(psource)/usr/src/modules/$(sname) install_src
+	# Copy the needed debian/ pieces to the proper location
+	cp debian/*modules.in* \
+		debian/$(psource)/usr/src/modules/$(sname)/debian
+	cp debian/*_KVERS_* debian/rules debian/changelog debian/copyright \
+		debian/compat debian/$(psource)/usr/src/modules/$(sname)/debian/
+	cd debian/$(psource)/usr/src && tar c modules | bzip2 -9 > $(sname).tar.bz2 && rm -rf modules
+
+# 	# Add here commands to install the package into debian/kbb.
+# 	$(MAKE) DESTDIR=$(CURDIR)/debian/kbb install_src
+
+	dh_install
+
+# Build architecture-independent files here.
+# Pass -i to all debhelper commands in this target to reduce clutter.
+binary-indep: build install
+	dh_testdir -i
+	dh_testroot -i
+	dh_installchangelogs  -i
+	dh_installdocs -i
+	dh_installexamples -i
+#	dh_install -i
+#	dh_installmenu -i
+#	dh_installdebconf -i
+#	dh_installlogrotate -i
+#	dh_installemacsen -i
+#	dh_installpam -i
+#	dh_installmime -i
+#	dh_installinit -i
+#	dh_installcron -i
+#	dh_installinfo -i
+	dh_installman -i
+	dh_link -i
+	dh_compress -i
+	dh_fixperms -i
+	dh_installdeb -i
+#	dh_perl -i
+#	dh_python -i
+#	dh_makeshlibs -i
+	dh_installdeb -i
+	dh_shlibdeps -i
+	dh_gencontrol -i
+	dh_md5sums -i
+	dh_builddeb -i
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testdir -s
+	dh_testroot -s
+#	dh_installdebconf -s
+	dh_installdocs -s
+	dh_installexamples -s
+	dh_installmenu -s
+#	dh_installlogrotate -s
+#	dh_installemacsen -s
+#	dh_installpam -s
+#	dh_installmime -s
+#	dh_installinit -s
+	dh_installcron -s
+#	dh_installman -s
+	dh_installinfo -s
+	dh_installchangelogs  -s
+	dh_strip -s
+	dh_link -s
+	dh_compress -s
+	dh_fixperms -s
+#	dh_makeshlibs -s
+	dh_installdeb -s
+#	dh_perl -s
+	dh_shlibdeps -s
+	dh_gencontrol -s
+	dh_md5sums -s
+	dh_builddeb -s
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure binary-modules kdist kdist_configure kdist_image kdist_clean
diff -urN tsp_orig/src/util/libbb/Makefile.k tsp_modified/src/util/libbb/Makefile.k
--- tsp_orig/src/util/libbb/Makefile.k	2006-11-27 20:44:30.000000000 +0100
+++ tsp_modified/src/util/libbb/Makefile.k	1970-01-01 01:00:00.000000000 +0100
@@ -1,18 +0,0 @@
-MODULE_NAME = bb
-${MODULE_NAME}-objs := bb_core.o bb_alias.o bb_core_k.o bb_module.o bb_simple.o
-
-ifneq ($(KERNELRELEASE),)
-
-obj-m   := $(MODULE_NAME).o
-
-else
-
-KDIR	?= /lib/modules/$(shell uname -r)/build
-PWD	:= $(shell pwd)
-
-all:
-	$(MAKE) -C $(KDIR) M=$(PWD) modules
-
-endif
-
-
diff -urN tsp_orig/src/util/libbb/Makefile.k.in tsp_modified/src/util/libbb/Makefile.k.in
--- tsp_orig/src/util/libbb/Makefile.k.in	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/Makefile.k.in	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1,46 @@
+MODULE_NAME = bb
+${MODULE_NAME}-objs := bb_core.o bb_alias.o bb_core_k.o bb_module.o bb_simple.o bb_local.o bb_callback.o 
+
+MDIR := kernel/drivers/misc/
+KVER ?= $(shell uname -r)
+KDIR ?= /lib/modules/$(KVER)/build
+
+EXTRA_CFLAGS = @KERNEL_BUILD_EXTRA_CFLAGS@
+
+ifneq ($(KERNELRELEASE),)
+
+obj-m   := $(MODULE_NAME).o
+
+else
+
+PWD	:= $(shell pwd)
+
+all:
+	$(MAKE) -C $(KDIR) M=$(PWD) modules
+
+install:: all
+	for file in `find . -name "*.ko"` ; do						\
+		mkdir -p $(DESTDIR)/lib/modules/$(KVER)/$(MDIR)/`dirname $$file` ;	\
+		cp $$file $(DESTDIR)/lib/modules/$(KVER)/$(MDIR)/$$file ;		\
+	done
+
+clean::
+	$(MAKE) -C $(KDIR) M=$(CURDIR) clean
+
+endif
+
+
+src_package: kbb-$(VERSION).tar.gz
+
+install_src:
+	for file in `find . -name "*.[ch]" -o -name "Makefile"` ; do	\
+		mkdir -p $(DESTDIR)/`dirname $$file` ;			\
+		cp $$file $(DESTDIR)/$$file ;				\
+	done
+
+kbb-$(VERSION).tar.gz:
+	$(MAKE) DESTDIR=kbb-$(VERSION) install_src
+	tar zcf $@ kbb-$(VERSION)
+	rm -rf mkdir kbb-$(VERSION)
+
+.PHONY: clean install test_compile rpm
diff -urN tsp_orig/src/util/libbb/scripting/pkgindex.tcl tsp_modified/src/util/libbb/scripting/pkgindex.tcl
--- tsp_orig/src/util/libbb/scripting/pkgindex.tcl	1970-01-01 01:00:00.000000000 +0100
+++ tsp_modified/src/util/libbb/scripting/pkgindex.tcl	2009-01-12 17:26:09.000000000 +0100
@@ -0,0 +1 @@
+package ifneeded bb 0.1 [list tclPkgSetup $dir bb 0.1 {{libbb.so load {bb::bbtools_cmd bb::bbtools_dump}}}]
diff -urN tsp_orig/src/util/libbb/scripting/pkgIndex.tcl tsp_modified/src/util/libbb/scripting/pkgIndex.tcl
--- tsp_orig/src/util/libbb/scripting/pkgIndex.tcl	2005-02-27 14:37:53.000000000 +0100
+++ tsp_modified/src/util/libbb/scripting/pkgIndex.tcl	1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-package ifneeded bb 0.1 [list tclPkgSetup $dir bb 0.1 {{libbb.so load {bb::bbtools_cmd bb::bbtools_dump}}}]
diff -urN tsp_orig/src/util/libcalc/CMakeLists.txt tsp_modified/src/util/libcalc/CMakeLists.txt
--- tsp_orig/src/util/libcalc/CMakeLists.txt	2007-04-22 18:56:01.000000000 +0200
+++ tsp_modified/src/util/libcalc/CMakeLists.txt	2009-01-12 17:26:09.000000000 +0100
@@ -1,3 +1,4 @@
+
 SET(LIBCALC_SRC calc_func)
 
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/util/libcalc)
diff -urN tsp_orig/src/util/libtspcfg/tspcfg_file.c tsp_modified/src/util/libtspcfg/tspcfg_file.c
--- tsp_orig/src/util/libtspcfg/tspcfg_file.c	2006-10-19 01:44:38.000000000 +0200
+++ tsp_modified/src/util/libtspcfg/tspcfg_file.c	2009-01-12 17:26:09.000000000 +0100
@@ -148,7 +148,7 @@
     if (NULL==tspCfgSampleList->implicit_type)
     {
       retcode = TSP_STATUS_ERROR_MEMORY_ALLOCATION;
-      STRACE_ERROR(("Cannot strdup <%s>",implicit_type));
+      STRACE_ERROR("Cannot strdup <%s>",implicit_type);
     }
  } 
  else
@@ -162,7 +162,7 @@
     if (NULL==tspCfgSampleList->implicit_access)
     {
       retcode = TSP_STATUS_ERROR_MEMORY_ALLOCATION;
-      STRACE_ERROR(("Cannot strdup <%s>",implicit_access));
+      STRACE_ERROR("Cannot strdup <%s>",implicit_access);
     }
  } 
  else
@@ -176,7 +176,7 @@
     if (NULL==tspCfgSampleList->implicit_provider)
     {
       retcode = TSP_STATUS_ERROR_MEMORY_ALLOCATION;
-      STRACE_ERROR(("Cannot strdup <%s>",implicit_provider));
+      STRACE_ERROR("Cannot strdup <%s>",implicit_provider);
     }
  } 
  else
@@ -190,7 +190,7 @@
     if (NULL==tspCfgSampleList->renamed)
     {
       retcode = TSP_STATUS_ERROR_MEMORY_ALLOCATION;
-      STRACE_ERROR(("Cannot strdup <%s>",renamed));
+      STRACE_ERROR("Cannot strdup <%s>",renamed);
     }
  } 
  else
@@ -299,7 +299,7 @@
     if (NULL==provider->name)
     {
       retcode = TSP_STATUS_ERROR_MEMORY_ALLOCATION;
-      STRACE_ERROR(("Cannot strdup <%s>",name));
+      STRACE_ERROR("Cannot strdup <%s>",name);
     }
 
   } 
@@ -322,7 +322,7 @@
     if (NULL==provider->url)
     {
       retcode = TSP_STATUS_ERROR_MEMORY_ALLOCATION;
-      STRACE_ERROR(("Cannot strdup <%s>",url));
+      STRACE_ERROR("Cannot strdup <%s>",url);
     }
   } 
   else
diff -urN tsp_orig/src/util/libutil/tsp_check_host_and_ip.c tsp_modified/src/util/libutil/tsp_check_host_and_ip.c
--- tsp_orig/src/util/libutil/tsp_check_host_and_ip.c	2007-04-01 22:35:29.000000000 +0200
+++ tsp_modified/src/util/libutil/tsp_check_host_and_ip.c	2009-01-12 17:26:09.000000000 +0100
@@ -39,6 +39,8 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <rpc/rpc.h>
+
+
 #ifdef LINUX
 #include <sys/socket.h>
 #include <sys/ioctl.h>
@@ -63,34 +65,34 @@
   
   gethostname(name,1024);
   printf("hostname is  <%s> (as reported by gethostname)\n",name);
-  myhost = gethostbyname(name);
-  if (myhost == NULL) {
+  myhost=gethostbyname(name);
+  if (myhost == NULL ) {
     fprintf(stderr,"Cannot 'gethostbyname (hostname --> @IP)' check your /etc/hosts file.\n");
     exit(1);
   }
-  myu.addr = (uint32_t)ntohl(*((uint32_t*)myhost->h_addr_list[0]));
+  myu.addr = *((uint32_t*)myhost->h_addr_list[0]);
   printf("@IP returned is <%d.%d.%d.%d> <addrtype= %s> (as reported by gethostbyname)\n",
-	 myu.parts[3], myu.parts[2], myu.parts[1], myu.parts[0],
+	 myu.parts[0], myu.parts[1], myu.parts[2], myu.parts[3],
 	 (myhost->h_addrtype == AF_INET6 ?  "AF_INET6" : "AF_INET"));
   
   myhost_byaddr = gethostbyaddr(myhost->h_addr_list[0], myhost->h_length,myhost->h_addrtype);
-  
-  if (myhost_byaddr == NULL) {
+
+   if (myhost_byaddr == NULL) {
     fprintf(stderr, "Cannot 'gethostbyaddr (@IP --> hostname)' check your /etc/hosts file\n");
     exit(1);
   }
-  myu.addr = (uint32_t)ntohl(*((uint32_t*)myhost_byaddr->h_addr_list[0]));
+  myu.addr =*((uint32_t*)myhost_byaddr->h_addr_list[0]);
   
   printf("hostname returned is <%s> for @IP <%d.%d.%d.%d> <addrtype= %s> (as reported by gethostbyaddr)\n",
 	 myhost_byaddr->h_name,
-	 myu.parts[3], myu.parts[2], myu.parts[1], myu.parts[0],
+	 myu.parts[0], myu.parts[1], myu.parts[2], myu.parts[3],
 	 (myhost_byaddr->h_addrtype == AF_INET6 ?  "AF_INET6" : "AF_INET"));
 
 
   get_myaddress(&my_addr);
-  myu.addr = (uint32_t)ntohl((uint32_t)(my_addr.sin_addr.s_addr));
+  myu.addr = (uint32_t)(my_addr.sin_addr.s_addr);
   printf("@IP returned is <%d.%d.%d.%d> (as returned by get_myaddress (rpclib))\n",
-	  myu.parts[3], myu.parts[2], myu.parts[1], myu.parts[0]);
+	  myu.parts[0], myu.parts[1], myu.parts[2], myu.parts[3]);
 #ifdef LINUX
   fdIPV4 = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
   ioctl(fdIPV4, SIOCGIFADDR, &myifrq);
diff -urN tsp_orig/tests/tsp_port/src/test_api.c tsp_modified/tests/tsp_port/src/test_api.c
--- tsp_orig/tests/tsp_port/src/test_api.c	2007-01-29 09:39:40.000000000 +0100
+++ tsp_modified/tests/tsp_port/src/test_api.c	2009-01-12 17:26:07.000000000 +0100
@@ -4,6 +4,8 @@
 #include <stdio.h>
 #include <assert.h>
 #include <pthread.h>
+//For ALLOCA_XXX and GETHOSTBYNAME_XXX macros
+#include <../common/tsp_common_macros.h>
 #ifdef WIN32
   #include <windows.h>
 #else
@@ -189,7 +191,7 @@
 
     gethostname(name,1024);
     test_printf("hostname is  <%s> (as reported by gethostname)\n",name);
-    myhost = gethostbyname(name);
+    gethostbyname(name);
 
     if (myhost == NULL) {
         fprintf(stderr,"Cannot 'gethostbyname (hostname --> @IP)' check your /etc/hosts file.\n");
@@ -202,7 +204,6 @@
 	    (myhost->h_addrtype == AF_INET6 ?  "AF_INET6" : "AF_INET"));
       
     myhost_byaddr = gethostbyaddr(myhost->h_addr_list[0], myhost->h_length,myhost->h_addrtype);
-      
     if (myhost_byaddr == NULL) {
         fprintf(stderr, "Cannot 'gethostbyaddr (@IP --> hostname)' check your /etc/hosts file\n");
         return ;
@@ -256,7 +257,7 @@
 #ifdef WIN32
     out_temp = _alloca(sizeof(int)*4);
 #else
-    out_temp = alloca(sizeof(int)*4);
+    out_temp = ALLOCA_ALLOC(sizeof(int)*4);
 #endif
     out_temp[0] = 10;
     out_temp[1] = 20;
@@ -276,6 +277,7 @@
 #endif
 
     test_printf("Fin test memoire\n");
+    ALLOCA_FREE(out_temp);
 }
 
 void test_pthread()
